ROHC compression/decompression library
|
IP-agnostic packet. More...
#include "dllexport.h"
#include "protocols/ipv4.h"
#include "protocols/ipv6.h"
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | net_hdr |
struct | ip_packet |
Defines an IP-agnostic packet that can handle an IPv4 or IPv6 packet. More... | |
Defines | |
#define | IP_GET_16_SUBFIELD(field, bitmask, offset) ((rohc_ntoh16(field) & (bitmask)) >> (offset)) |
Get a subpart of a 16-bit IP field. | |
#define | IP_GET_32_SUBFIELD(field, bitmask, offset) ((rohc_ntoh32(field) & (bitmask)) >> (offset)) |
Get a subpart of a 32-bit IP field. | |
#define | IP_SET_16_SUBFIELD(field, bitmask, offset, value) |
Set a subpart of a 16-bit IP field. | |
#define | IP_SET_32_SUBFIELD(field, bitmask, offset, value) |
Set a subpart of a 32-bit IP field. | |
#define | IPV4_DF_OFFSET 14 |
The offset for the DF flag in an ipv4_hdr->frag_off variable. | |
#define | IPV4_GET_DF(ip4) IP_GET_16_SUBFIELD((ip4).frag_off, IP_DF, IPV4_DF_OFFSET) |
Get the IPv4 Don't Fragment (DF) bit from an ipv4_hdr object. | |
#define | IPV4_SET_DF(ip4, value) IP_SET_16_SUBFIELD((ip4)->frag_off, IP_DF, IPV4_DF_OFFSET, (value)) |
Set the IPv4 Don't Fragment (DF) bit in an ipv4_hdr object. | |
#define | IPV4_ADDR_FORMAT "%02x%02x%02x%02x (%u.%u.%u.%u)" |
The format to print an IPv4 address. | |
#define | IPV4_ADDR_RAW(x) |
The data to print an IPv4 address in raw format. | |
#define | IPV6_VERSION_MASK 0xf0000000 |
The bitmask for the Version field in an ipv6_hdr->ip6_flow variable. | |
#define | IPV6_VERSION_OFFSET 28 |
The offset for the Version field in an ipv6_hdr->ip6_flow variable. | |
#define | IPV6_TC_MASK 0x0ff00000 |
The bitmask for the Traffic Class (TC) field in an ipv6_hdr->ip6_flow variable. | |
#define | IPV6_TC_OFFSET 20 |
The offset for the Traffic Class (TC) field in an ipv6_hdr->ip6_flow variable. | |
#define | IPV6_FLOW_LABEL_MASK 0x000fffff |
The bitmask for the FLow Label field in an ipv6_hdr->ip6_flow variable. | |
#define | IPV6_GET_VERSION(ip6) IP_GET_32_SUBFIELD((ip6).ip6_flow, IPV6_VERSION_MASK, IPV6_VERSION_OFFSET) |
Get the IPv6 Version 4-bit field from ipv6_hdr object. | |
#define | IPV6_SET_VERSION(ip6, value) IP_SET_32_SUBFIELD((ip6)->ip6_flow, IPV6_VERSION_MASK, IPV6_VERSION_OFFSET, (value)) |
Set the IPv6 Version 4-bit field in an ipv6_hdr object. | |
#define | IPV6_GET_TC(ip6) IP_GET_32_SUBFIELD((ip6).ip6_flow, IPV6_TC_MASK, IPV6_TC_OFFSET) |
Get the IPv6 Traffic Class (TC) byte from an ipv6_hdr object. | |
#define | IPV6_SET_TC(ip6, value) IP_SET_32_SUBFIELD((ip6)->ip6_flow, IPV6_TC_MASK, IPV6_TC_OFFSET, (value)) |
Set the IPv6 Traffic Class (TC) byte in an ipv6_hdr object. | |
#define | IPV6_GET_FLOW_LABEL(ip6) IP_GET_32_SUBFIELD((ip6).ip6_flow, IPV6_FLOW_LABEL_MASK, 0) |
Get the IPv6 Flow Label 20-bit field from an ipv6_hdr object. | |
#define | IPV6_SET_FLOW_LABEL(ip6, value) IP_SET_32_SUBFIELD((ip6)->ip6_flow, IPV6_FLOW_LABEL_MASK, 0, (value)) |
Set the IPv6 Flow Label 20-bit field in an ipv6_hdr variable. | |
#define | IPV6_ADDR_FORMAT "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x" |
The format to print an IPv6 address. | |
#define | IPV6_ADDR_IN6(x) IPV6_ADDR_RAW((x)->addr.u8) |
The data to print an IPv6 address in (struct ipv6_addr *) format. | |
#define | IPV6_ADDR_RAW(x) |
The data to print an IPv6 address in raw format. | |
#define | IPV6_ADDR_CMP(x, y) |
Compare two IPv6 addresses in (struct ipv6_addr *) format. | |
Enumerations | |
enum | ip_header_pos_t { ROHC_IP_HDR_NONE = 0, ROHC_IP_HDR_FIRST = 1, ROHC_IP_HDR_SECOND = 2 } |
enum | ip_version { IPV4 = 4, IPV6 = 6, IP_UNKNOWN = 0, IPV4_MALFORMED = 1, IPV6_MALFORMED = 2 } |
IP version. More... | |
Functions | |
static uint16_t | swab16 (const uint16_t value) |
In-place change the byte order in a two-byte value. | |
static uint16_t | from32to16 (const uint32_t x) |
static uint16_t | ip_fast_csum (const uint8_t *const iph, const size_t ihl) |
bool ROHC_EXPORT | ip_create (struct ip_packet *const ip, const uint8_t *const packet, const size_t size) |
bool ROHC_EXPORT | ip_get_inner_packet (const struct ip_packet *const outer, struct ip_packet *const inner) |
Get the inner IP packet (IP in IP) | |
const uint8_t *ROHC_EXPORT | ip_get_raw_data (const struct ip_packet *const ip) |
Get the IP raw data (header + payload) | |
uint8_t *ROHC_EXPORT | ip_get_next_header (const struct ip_packet *const ip, uint8_t *const type) |
Get the IP next header. | |
uint8_t *ROHC_EXPORT | ip_get_next_layer (const struct ip_packet *const ip) |
Get the next header (but skip IP extensions) | |
uint8_t *ROHC_EXPORT | ip_get_next_ext_from_ip (const struct ip_packet *const ip, uint8_t *const type) |
Get the next extension header of IPv6 packets from an IPv6 header. | |
uint8_t *ROHC_EXPORT | ip_get_next_ext_from_ext (const uint8_t *const ext, uint8_t *const type) |
unsigned int ROHC_EXPORT | ip_get_totlen (const struct ip_packet *const ip) |
Get the total length of an IP packet. | |
unsigned int ROHC_EXPORT | ip_get_hdrlen (const struct ip_packet *const ip) |
Get the length of an IP header. | |
unsigned int ROHC_EXPORT | ip_get_plen (const struct ip_packet *const ip) |
Get the length of an IPv4/IPv6 payload. | |
bool ROHC_EXPORT | ip_is_fragment (const struct ip_packet *const ip) |
Whether the IP packet is an IP fragment or not. | |
ip_version ROHC_EXPORT | ip_get_version (const struct ip_packet *const ip) |
Get the IP version of an IP packet. | |
uint8_t ROHC_EXPORT | ip_get_protocol (const struct ip_packet *const ip) |
Get the protocol transported by an IP packet. | |
unsigned int ROHC_EXPORT | ip_get_tos (const struct ip_packet *const ip) |
Get the IPv4 Type Of Service (TOS) or IPv6 Traffic Class (TC) of an IP packet. | |
unsigned int ROHC_EXPORT | ip_get_ttl (const struct ip_packet *const ip) |
Get the IPv4 Time To Live (TTL) or IPv6 Hop Limit (HL) of an IP packet. | |
void ROHC_EXPORT | ip_set_version (struct ip_packet *const ip, const ip_version value) |
Set the IP version of an IP packet. | |
void ROHC_EXPORT | ip_set_protocol (struct ip_packet *const ip, const uint8_t value) |
Set the protocol transported by an IP packet. | |
void ROHC_EXPORT | ip_set_tos (struct ip_packet *const ip, const uint8_t value) |
Set the IPv4 Type Of Service (TOS) or IPv6 Traffic Class (TC) of an IP packet. | |
void ROHC_EXPORT | ip_set_ttl (struct ip_packet *const ip, const uint8_t value) |
Set the IPv4 Time To Live (TTL) or IPv6 Hop Limit (HL) of an IP packet. | |
void ROHC_EXPORT | ip_set_saddr (struct ip_packet *const ip, const uint8_t *value) |
void ROHC_EXPORT | ip_set_daddr (struct ip_packet *const ip, const uint8_t *value) |
struct ipv4_hdr *ROHC_EXPORT | ipv4_get_header (const struct ip_packet *const ip) |
Get the IPv4 header. | |
uint16_t ROHC_EXPORT | ipv4_get_id (const struct ip_packet *const ip) |
Get the IP-ID of an IPv4 packet. | |
uint16_t ROHC_EXPORT | ipv4_get_id_nbo (const struct ip_packet *const ip, const unsigned int nbo) |
Get the IP-ID of an IPv4 packet in Network Byte Order. | |
int ROHC_EXPORT | ipv4_get_df (const struct ip_packet *const ip) |
Get the Don't Fragment (DF) bit of an IPv4 packet. | |
uint32_t ROHC_EXPORT | ipv4_get_saddr (const struct ip_packet *const ip) |
Get the source address of an IPv4 packet. | |
uint32_t ROHC_EXPORT | ipv4_get_daddr (const struct ip_packet *const ip) |
Get the destination address of an IPv4 packet. | |
void ROHC_EXPORT | ipv4_set_id (struct ip_packet *const ip, const int value) |
Set the IP-ID of an IPv4 packet. | |
void ROHC_EXPORT | ipv4_set_df (struct ip_packet *const ip, const int value) |
Set the Don't Fragment (DF) bit of an IPv4 packet. | |
struct ipv6_hdr *ROHC_EXPORT | ipv6_get_header (const struct ip_packet *const ip) |
Get the IPv6 header. | |
uint32_t ROHC_EXPORT | ipv6_get_flow_label (const struct ip_packet *const ip) |
Get the flow label of an IPv6 packet. | |
struct ipv6_addr *ROHC_EXPORT | ipv6_get_saddr (const struct ip_packet *const ip) |
Get the source address of an IPv6 packet. | |
struct ipv6_addr *ROHC_EXPORT | ipv6_get_daddr (const struct ip_packet *const ip) |
Get the destination address of an IPv6 packet. | |
void ROHC_EXPORT | ipv6_set_flow_label (struct ip_packet *const ip, const uint32_t value) |
Set the flow label of an IPv6 packet. | |
unsigned short ROHC_EXPORT | ip_get_extension_size (const uint8_t *const ext) |
unsigned short ROHC_EXPORT | ip_get_total_extension_size (const struct ip_packet *const ip) |
Get the size of the extension list. | |
bool | get_ip_version (const uint8_t *const packet, const size_t size, ip_version *const version) |
IP-agnostic packet.
#define IP_GET_16_SUBFIELD | ( | field, | |
bitmask, | |||
offset | |||
) | ((rohc_ntoh16(field) & (bitmask)) >> (offset)) |
Get a subpart of a 16-bit IP field.
#define IP_GET_32_SUBFIELD | ( | field, | |
bitmask, | |||
offset | |||
) | ((rohc_ntoh32(field) & (bitmask)) >> (offset)) |
Get a subpart of a 32-bit IP field.
#define IP_SET_16_SUBFIELD | ( | field, | |
bitmask, | |||
offset, | |||
value | |||
) |
(field) = (((field) & rohc_hton16(~(bitmask))) | \ rohc_hton16(((value) << (offset)) & (bitmask)))
Set a subpart of a 16-bit IP field.
#define IP_SET_32_SUBFIELD | ( | field, | |
bitmask, | |||
offset, | |||
value | |||
) |
(field) = (((field) & rohc_hton32(~(bitmask))) | \ rohc_hton32(((value) << (offset)) & (bitmask)))
Set a subpart of a 32-bit IP field.
#define IPV4_ADDR_FORMAT "%02x%02x%02x%02x (%u.%u.%u.%u)" |
The format to print an IPv4 address.
#define IPV4_ADDR_RAW | ( | x | ) |
(x)[0], (x)[1], (x)[2], (x)[3], \ (x)[0], (x)[1], (x)[2], (x)[3]
The data to print an IPv4 address in raw format.
#define IPV4_DF_OFFSET 14 |
The offset for the DF flag in an ipv4_hdr->frag_off variable.
#define IPV4_GET_DF | ( | ip4 | ) | IP_GET_16_SUBFIELD((ip4).frag_off, IP_DF, IPV4_DF_OFFSET) |
Get the IPv4 Don't Fragment (DF) bit from an ipv4_hdr object.
#define IPV4_SET_DF | ( | ip4, | |
value | |||
) | IP_SET_16_SUBFIELD((ip4)->frag_off, IP_DF, IPV4_DF_OFFSET, (value)) |
Set the IPv4 Don't Fragment (DF) bit in an ipv4_hdr object.
#define IPV6_ADDR_CMP | ( | x, | |
y | |||
) |
((x)->addr.u32[0] == (y)->addr.u32[0] && \ (x)->addr.u32[1] == (y)->addr.u32[1] && \ (x)->addr.u32[2] == (y)->addr.u32[2] && \ (x)->addr.u32[3] == (y)->addr.u32[3])
Compare two IPv6 addresses in (struct ipv6_addr *) format.
#define IPV6_ADDR_FORMAT "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x" |
The format to print an IPv6 address.
#define IPV6_ADDR_IN6 | ( | x | ) | IPV6_ADDR_RAW((x)->addr.u8) |
The data to print an IPv6 address in (struct ipv6_addr *) format.
#define IPV6_ADDR_RAW | ( | x | ) |
(x)[0], (x)[1], (x)[2], (x)[3], (x)[4], (x)[5], (x)[6], (x)[7], \ (x)[8], (x)[9], (x)[10], (x)[11], (x)[12], (x)[13], (x)[14], (x)[15]
The data to print an IPv6 address in raw format.
#define IPV6_FLOW_LABEL_MASK 0x000fffff |
The bitmask for the FLow Label field in an ipv6_hdr->ip6_flow variable.
#define IPV6_GET_FLOW_LABEL | ( | ip6 | ) | IP_GET_32_SUBFIELD((ip6).ip6_flow, IPV6_FLOW_LABEL_MASK, 0) |
Get the IPv6 Flow Label 20-bit field from an ipv6_hdr object.
#define IPV6_GET_TC | ( | ip6 | ) | IP_GET_32_SUBFIELD((ip6).ip6_flow, IPV6_TC_MASK, IPV6_TC_OFFSET) |
Get the IPv6 Traffic Class (TC) byte from an ipv6_hdr object.
#define IPV6_GET_VERSION | ( | ip6 | ) | IP_GET_32_SUBFIELD((ip6).ip6_flow, IPV6_VERSION_MASK, IPV6_VERSION_OFFSET) |
Get the IPv6 Version 4-bit field from ipv6_hdr object.
#define IPV6_SET_FLOW_LABEL | ( | ip6, | |
value | |||
) | IP_SET_32_SUBFIELD((ip6)->ip6_flow, IPV6_FLOW_LABEL_MASK, 0, (value)) |
Set the IPv6 Flow Label 20-bit field in an ipv6_hdr variable.
#define IPV6_SET_TC | ( | ip6, | |
value | |||
) | IP_SET_32_SUBFIELD((ip6)->ip6_flow, IPV6_TC_MASK, IPV6_TC_OFFSET, (value)) |
Set the IPv6 Traffic Class (TC) byte in an ipv6_hdr object.
#define IPV6_SET_VERSION | ( | ip6, | |
value | |||
) | IP_SET_32_SUBFIELD((ip6)->ip6_flow, IPV6_VERSION_MASK, IPV6_VERSION_OFFSET, (value)) |
Set the IPv6 Version 4-bit field in an ipv6_hdr object.
#define IPV6_TC_MASK 0x0ff00000 |
The bitmask for the Traffic Class (TC) field in an ipv6_hdr->ip6_flow variable.
#define IPV6_TC_OFFSET 20 |
The offset for the Traffic Class (TC) field in an ipv6_hdr->ip6_flow variable.
#define IPV6_VERSION_MASK 0xf0000000 |
The bitmask for the Version field in an ipv6_hdr->ip6_flow variable.
#define IPV6_VERSION_OFFSET 28 |
The offset for the Version field in an ipv6_hdr->ip6_flow variable.
enum ip_header_pos_t |
enum ip_version |
static uint16_t from32to16 | ( | const uint32_t | x | ) | [inline, static] |
bool get_ip_version | ( | const uint8_t *const | packet, |
const size_t | size, | ||
ip_version *const | version | ||
) |
bool ROHC_EXPORT ip_create | ( | struct ip_packet *const | ip, |
const uint8_t *const | packet, | ||
const size_t | size | ||
) |
static uint16_t ip_fast_csum | ( | const uint8_t *const | iph, |
const size_t | ihl | ||
) | [inline, static] |
This is a version of ip_compute_csum() optimized for IP headers, which always checksum on 4 octet boundaries.
unsigned short ROHC_EXPORT ip_get_extension_size | ( | const uint8_t *const | ext | ) |
unsigned int ROHC_EXPORT ip_get_hdrlen | ( | const struct ip_packet *const | ip | ) |
Get the length of an IP header.
The function does not handle ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IP packet to analyze |
bool ROHC_EXPORT ip_get_inner_packet | ( | const struct ip_packet *const | outer, |
struct ip_packet *const | inner | ||
) |
Get the inner IP packet (IP in IP)
The function does not handle ip_packet whose ip_packet::version is IP_UNKNOWN.
outer | The outer IP packet to analyze |
inner | The inner IP packet to create |
uint8_t* ROHC_EXPORT ip_get_next_ext_from_ext | ( | const uint8_t *const | ext, |
uint8_t *const | type | ||
) |
uint8_t* ROHC_EXPORT ip_get_next_ext_from_ip | ( | const struct ip_packet *const | ip, |
uint8_t *const | type | ||
) |
Get the next extension header of IPv6 packets from an IPv6 header.
The function does not handle ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IP packet to analyze |
type | OUT: The type of the next header If there is no next header the value must be ignored |
uint8_t* ROHC_EXPORT ip_get_next_header | ( | const struct ip_packet *const | ip, |
uint8_t *const | type | ||
) |
Get the IP next header.
The function does not handle ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IP packet to analyze |
type | OUT: The type of the next header |
uint8_t* ROHC_EXPORT ip_get_next_layer | ( | const struct ip_packet *const | ip | ) |
Get the next header (but skip IP extensions)
The function does not handle ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IP packet to analyze |
unsigned int ROHC_EXPORT ip_get_plen | ( | const struct ip_packet *const | ip | ) |
Get the length of an IPv4/IPv6 payload.
The function does not handle ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IPv4/IPv6 packet to analyze |
uint8_t ROHC_EXPORT ip_get_protocol | ( | const struct ip_packet *const | ip | ) |
Get the protocol transported by an IP packet.
The protocol returned is the one transported by the last known IP extension header if any is found.
The function handles ip_packet whose ip_packet::version is IP_UNKNOWN. It always returns the special value 0.
ip | The IP packet to analyze |
const uint8_t* ROHC_EXPORT ip_get_raw_data | ( | const struct ip_packet *const | ip | ) |
Get the IP raw data (header + payload)
The function handles ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IP packet to analyze |
unsigned int ROHC_EXPORT ip_get_tos | ( | const struct ip_packet *const | ip | ) |
Get the IPv4 Type Of Service (TOS) or IPv6 Traffic Class (TC) of an IP packet.
The function does not handle ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IP packet to analyze |
unsigned short ROHC_EXPORT ip_get_total_extension_size | ( | const struct ip_packet *const | ip | ) |
Get the size of the extension list.
The function does not handle ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The packet to analyse |
unsigned int ROHC_EXPORT ip_get_totlen | ( | const struct ip_packet *const | ip | ) |
Get the total length of an IP packet.
The function handles ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IP packet to analyze |
unsigned int ROHC_EXPORT ip_get_ttl | ( | const struct ip_packet *const | ip | ) |
Get the IPv4 Time To Live (TTL) or IPv6 Hop Limit (HL) of an IP packet.
The function does not handle ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IP packet to analyze |
ip_version ROHC_EXPORT ip_get_version | ( | const struct ip_packet *const | ip | ) |
Get the IP version of an IP packet.
The function handles ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IP packet to analyze |
bool ROHC_EXPORT ip_is_fragment | ( | const struct ip_packet *const | ip | ) |
Whether the IP packet is an IP fragment or not.
The IP packet is a fragment if the MF (More Fragments) bit is set or the Fragment Offset field is non-zero.
The function does not handle ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IP packet to analyze |
void ROHC_EXPORT ip_set_daddr | ( | struct ip_packet *const | ip, |
const uint8_t * | value | ||
) |
void ROHC_EXPORT ip_set_protocol | ( | struct ip_packet *const | ip, |
const uint8_t | value | ||
) |
Set the protocol transported by an IP packet.
The function does not handle ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IP packet to modify |
value | The protocol value |
void ROHC_EXPORT ip_set_saddr | ( | struct ip_packet *const | ip, |
const uint8_t * | value | ||
) |
void ROHC_EXPORT ip_set_tos | ( | struct ip_packet *const | ip, |
const uint8_t | value | ||
) |
Set the IPv4 Type Of Service (TOS) or IPv6 Traffic Class (TC) of an IP packet.
The function does not handle ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IP packet to modify |
value | The TOS/TC value |
void ROHC_EXPORT ip_set_ttl | ( | struct ip_packet *const | ip, |
const uint8_t | value | ||
) |
Set the IPv4 Time To Live (TTL) or IPv6 Hop Limit (HL) of an IP packet.
The function does not handle ip_packet whose ip_packet::version is IP_UNKNOWN.
ip | The IP packet to modify |
value | The TTL/HL value |
void ROHC_EXPORT ip_set_version | ( | struct ip_packet *const | ip, |
const ip_version | value | ||
) |
Set the IP version of an IP packet.
ip | The IP packet to modify |
value | The version value |
uint32_t ROHC_EXPORT ipv4_get_daddr | ( | const struct ip_packet *const | ip | ) |
Get the destination address of an IPv4 packet.
The function does not handle ip_packet whose ip_packet::version is not IPV4.
ip | The IPv4 packet to analyze |
int ROHC_EXPORT ipv4_get_df | ( | const struct ip_packet *const | ip | ) |
Get the Don't Fragment (DF) bit of an IPv4 packet.
The function does not handle ip_packet whose ip_packet::version is not IPV4.
ip | The IP packet to analyze |
struct ipv4_hdr* ROHC_EXPORT ipv4_get_header | ( | const struct ip_packet *const | ip | ) | [read] |
Get the IPv4 header.
The function does not handle ip_packet whose ip_packet::version is not IPV4.
ip | The IP packet to analyze |
uint16_t ROHC_EXPORT ipv4_get_id | ( | const struct ip_packet *const | ip | ) |
Get the IP-ID of an IPv4 packet.
The IP-ID value is returned as-is (ie. not automatically converted to the host byte order).
The function does not handle ip_packet whose ip_packet::version is not IPV4.
ip | The IP packet to analyze |
uint16_t ROHC_EXPORT ipv4_get_id_nbo | ( | const struct ip_packet *const | ip, |
const unsigned int | nbo | ||
) |
Get the IP-ID of an IPv4 packet in Network Byte Order.
The function does not handle ip_packet whose ip_packet::version is not IPV4.
ip | The IP packet to analyze |
nbo | The NBO flag (if RND = 1, use NBO = 1) |
uint32_t ROHC_EXPORT ipv4_get_saddr | ( | const struct ip_packet *const | ip | ) |
Get the source address of an IPv4 packet.
The function does not handle ip_packet whose ip_packet::version is not IPV4.
ip | The IPv4 packet to analyze |
void ROHC_EXPORT ipv4_set_df | ( | struct ip_packet *const | ip, |
const int | value | ||
) |
Set the Don't Fragment (DF) bit of an IPv4 packet.
The function does not handle ip_packet whose ip_packet::version is not IPV4.
ip | The IP packet to modify |
value | The value of the DF bit |
void ROHC_EXPORT ipv4_set_id | ( | struct ip_packet *const | ip, |
const int | value | ||
) |
Set the IP-ID of an IPv4 packet.
The IP-ID value is set as-is (ie. not automatically converted to the host byte order).
The function does not handle ip_packet whose ip_packet::version is not IPV4.
ip | The IP packet to modify |
value | The IP-ID value |
struct ipv6_addr* ROHC_EXPORT ipv6_get_daddr | ( | const struct ip_packet *const | ip | ) | [read] |
Get the destination address of an IPv6 packet.
The function does not handle ip_packet whose ip_packet::version is not IPV6.
ip | The IPv6 packet to analyze |
uint32_t ROHC_EXPORT ipv6_get_flow_label | ( | const struct ip_packet *const | ip | ) |
Get the flow label of an IPv6 packet.
The function does not handle ip_packet whose ip_packet::version is not IPV6.
ip | The IPv6 packet to analyze |
struct ipv6_hdr* ROHC_EXPORT ipv6_get_header | ( | const struct ip_packet *const | ip | ) | [read] |
Get the IPv6 header.
The function does not handle ip_packet whose ip_packet::version is not IPV6.
ip | The IP packet to analyze |
struct ipv6_addr* ROHC_EXPORT ipv6_get_saddr | ( | const struct ip_packet *const | ip | ) | [read] |
Get the source address of an IPv6 packet.
The function does not handle ip_packet whose ip_packet::version is not IPV6.
ip | The IPv6 packet to analyze |
void ROHC_EXPORT ipv6_set_flow_label | ( | struct ip_packet *const | ip, |
const uint32_t | value | ||
) |
Set the flow label of an IPv6 packet.
The function does not handle ip_packet whose ip_packet::version is not IPV6.
ip | The IPv6 packet to modify |
value | The flow label value |
static uint16_t swab16 | ( | const uint16_t | value | ) | [inline, static] |
In-place change the byte order in a two-byte value.
value | The two-byte value to modify |