ROHC compression/decompression library
|
IP-agnostic packet. More...
#include "ip.h"
#include "rohc_utils.h"
#include "protocols/ip_numbers.h"
#include "protocols/ip.h"
#include "protocols/ipv4.h"
#include "protocols/ipv6.h"
#include <string.h>
#include <assert.h>
Functions | |
void | ip_set_version (struct ip_packet *const ip, const ip_version value) |
Set the IP version of an IP packet. More... | |
uint8_t | ip_get_protocol (const struct ip_packet *const ip) |
Get the protocol transported by an IP packet. More... | |
void | ip_set_protocol (struct ip_packet *const ip, const uint8_t value) |
Set the protocol transported by an IP packet. More... | |
unsigned int | 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. More... | |
void | 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. More... | |
unsigned int | 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. More... | |
void | 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. More... | |
void | ip_set_saddr (struct ip_packet *const ip, const uint8_t *value) |
Set the Source Address of an IP packet. More... | |
void | ip_set_daddr (struct ip_packet *const ip, const uint8_t *value) |
Set the Destination Address of an IP packet. More... | |
IP-agnostic packet.
uint8_t 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 |
unsigned int 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 int 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 |
void ip_set_daddr | ( | struct ip_packet *const | ip, |
const uint8_t * | value | ||
) |
Set the Destination Address 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 IP address value |
void 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 ip_set_saddr | ( | struct ip_packet *const | ip, |
const uint8_t * | value | ||
) |
Set the Source Address 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 IP address value |
void 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 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 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 |