|
ROHC compression/decompression library
|
ROHC compression context for the UDP profile. More...
#include "c_udp.h"#include "c_ip.h"#include "rohc_traces_internal.h"#include "rohc_packets.h"#include "rohc_utils.h"#include "crc.h"#include "c_generic.h"#include "protocols/udp.h"#include <stdlib.h>#include <string.h>#include <assert.h>
Data Structures | |
| struct | udp_tmp_vars |
| Define the UDP-specific temporary variables in the profile compression context. More... | |
| struct | sc_udp_context |
| Define the UDP part of the profile decompression context. More... | |
Functions | |
| bool | c_udp_check_profile (const struct rohc_comp *const comp, const struct ip_packet *const outer_ip, const struct ip_packet *const inner_ip, const uint8_t protocol, rohc_ctxt_key_t *const ctxt_key) |
| Check if the given packet corresponds to the UDP profile. | |
| bool | c_udp_check_context (const struct c_context *context, const struct ip_packet *ip) |
| Check if the IP/UDP packet belongs to the context. | |
| int | udp_code_uo_remainder (const struct c_context *context, const unsigned char *next_header, unsigned char *const dest, int counter) |
| Build UDP-related fields in the tail of the UO packets. | |
| int | udp_code_static_udp_part (const struct c_context *context, const unsigned char *next_header, unsigned char *const dest, int counter) |
| Build the static part of the UDP header. | |
Variables | |
| struct c_profile | c_udp_profile |
| Define the compression part of the UDP profile as described in the RFC 3095. | |
ROHC compression context for the UDP profile.
| bool c_udp_check_context | ( | const struct c_context * | context, |
| const struct ip_packet * | ip | ||
| ) |
Check if the IP/UDP packet belongs to the context.
Conditions are:
This function is one of the functions that must exist in one profile for the framework to work.
| context | The compression context |
| ip | The IP/UDP packet to check |
References c_context::compressor, ipv4_hdr::daddr, udphdr::dest, c_profile::id, ip_header_info::info, c_generic_context::ip2_flags, ipv6_hdr::ip6_dst, ipv6_hdr::ip6_src, c_generic_context::ip_flags, ip_get_inner_packet(), ip_get_next_layer(), ip_get_protocol(), ip_get_version(), IPV4, ipv4_get_daddr(), ipv4_get_saddr(), IPV6, IPV6_ADDR_CMP, ipv6_get_daddr(), IPV6_GET_FLOW_LABEL, ipv6_get_flow_label(), ipv6_get_saddr(), c_generic_context::is_ip2_initialized, ipv4_header_info::old_ip, ipv6_header_info::old_ip, sc_udp_context::old_udp, c_context::profile, ROHC_IPPROTO_IPIP, ROHC_IPPROTO_IPV6, ROHC_IPPROTO_UDP, ROHC_TRACE_COMP, rohc_warning, ipv4_hdr::saddr, udphdr::source, c_generic_context::specific, c_context::specific, ip_header_info::v4, ip_header_info::v6, version, and ip_header_info::version.
| bool c_udp_check_profile | ( | const struct rohc_comp *const | comp, |
| const struct ip_packet *const | outer_ip, | ||
| const struct ip_packet *const | inner_ip, | ||
| const uint8_t | protocol, | ||
| rohc_ctxt_key_t *const | ctxt_key | ||
| ) |
Check if the given packet corresponds to the UDP profile.
Conditions are:
This function is one of the functions that must exist in one profile for the framework to work.
| comp | The ROHC compressor |
| outer_ip | The outer IP header of the IP packet to check |
| inner_ip |
|
| protocol | The transport protocol carried by the IP packet:
|
| ctxt_key | The key to help finding the context associated with packet |
References c_generic_check_profile(), udphdr::dest, ip_get_next_layer(), ip_get_plen(), udphdr::len, ROHC_IPPROTO_UDP, rohc_ntoh16(), and udphdr::source.
| int udp_code_static_udp_part | ( | const struct c_context * | context, |
| const unsigned char * | next_header, | ||
| unsigned char *const | dest, | ||
| int | counter | ||
| ) |
Build the static part of the UDP header.
Static part of UDP header (5.7.7.5):
+---+---+---+---+---+---+---+---+
1 / Source Port / 2 octets
+---+---+---+---+---+---+---+---+
2 / Destination Port / 2 octets
+---+---+---+---+---+---+---+---+
| context | The compression context |
| next_header | The UDP header |
| dest | The rohc-packet-under-build buffer |
| counter | The current position in the rohc-packet-under-build buffer |
References udphdr::dest, rohc_comp_debug, and udphdr::source.
| int udp_code_uo_remainder | ( | const struct c_context * | context, |
| const unsigned char * | next_header, | ||
| unsigned char *const | dest, | ||
| int | counter | ||
| ) |
Build UDP-related fields in the tail of the UO packets.
--- --- --- --- --- --- --- ---
: :
13 + UDP Checksum + 2 octets,
: : if context(UDP Checksum) != 0
--- --- --- --- --- --- --- ---
| context | The compression context |
| next_header | The UDP header |
| dest | The rohc-packet-under-build buffer |
| counter | The current position in the rohc-packet-under-build buffer |
References udphdr::check, and rohc_comp_debug.
| struct c_profile c_udp_profile |
{
ROHC_IPPROTO_UDP,
ROHC_PROFILE_UDP,
"UDP / Compressor",
c_udp_create,
c_generic_destroy,
c_udp_check_profile,
c_udp_check_context,
c_udp_encode,
c_generic_reinit_context,
c_generic_feedback,
c_generic_use_udp_port,
}
Define the compression part of the UDP profile as described in the RFC 3095.
1.7.6.1