|
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 | |
| static bool | c_udp_create (struct rohc_comp_ctxt *const context, const struct net_pkt *const packet) |
| Create a new UDP context and initialize it thanks to the given IP/UDP packet. | |
| static void | udp_decide_state (struct rohc_comp_ctxt *const context) |
| Decide the state that should be used for the next packet compressed with the ROHC UDP profile. | |
| static int | c_udp_encode (struct rohc_comp_ctxt *const context, const struct net_pkt *const uncomp_pkt, unsigned char *const rohc_pkt, const size_t rohc_pkt_max_len, rohc_packet_t *const packet_type, size_t *const payload_offset) |
| Encode an IP/UDP packet according to a pattern decided by several different factors. | |
| static size_t | udp_code_dynamic_udp_part (const struct rohc_comp_ctxt *const context, const unsigned char *const next_header, unsigned char *const dest, const size_t counter) |
| Build the dynamic part of the UDP header. | |
| static int | udp_changed_udp_dynamic (const struct rohc_comp_ctxt *context, const struct udphdr *udp) |
| Check if the dynamic part of the UDP header changed. | |
| bool | c_udp_check_profile (const struct rohc_comp *const comp, const struct net_pkt *const packet) |
| Check if the given packet corresponds to the UDP profile. | |
| bool | c_udp_check_context (const struct rohc_comp_ctxt *const context, const struct net_pkt *const packet) |
| Check if the IP/UDP packet belongs to the context. | |
| size_t | udp_code_uo_remainder (const struct rohc_comp_ctxt *const context, const unsigned char *const next_header, unsigned char *const dest, const size_t counter) |
| Build UDP-related fields in the tail of the UO packets. | |
| size_t | udp_code_static_udp_part (const struct rohc_comp_ctxt *const context, const unsigned char *const next_header, unsigned char *const dest, const size_t counter) |
| Build the static part of the UDP header. | |
Variables | |
| struct rohc_comp_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 rohc_comp_ctxt *const | context, |
| const struct net_pkt *const | packet | ||
| ) |
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 |
| packet | The IP/UDP packet to check |
| bool c_udp_check_profile | ( | const struct rohc_comp *const | comp, |
| const struct net_pkt *const | packet | ||
| ) |
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 |
| packet | The packet to check |
| static bool c_udp_create | ( | struct rohc_comp_ctxt *const | context, |
| const struct net_pkt *const | packet | ||
| ) | [static] |
Create a new UDP context and initialize it thanks to the given IP/UDP packet.
This function is one of the functions that must exist in one profile for the framework to work.
| context | The compression context |
| packet | The IP/UDP packet given to initialize the new context |
| static int c_udp_encode | ( | struct rohc_comp_ctxt *const | context, |
| const struct net_pkt *const | uncomp_pkt, | ||
| unsigned char *const | rohc_pkt, | ||
| const size_t | rohc_pkt_max_len, | ||
| rohc_packet_t *const | packet_type, | ||
| size_t *const | payload_offset | ||
| ) | [static] |
Encode an IP/UDP packet according to a pattern decided by several different factors.
| context | The compression context |
| uncomp_pkt | The uncompressed packet to encode |
| rohc_pkt | OUT: The ROHC packet |
| rohc_pkt_max_len | The maximum length of the ROHC packet |
| packet_type | OUT: The type of ROHC packet that is created |
| payload_offset | OUT: The offset for the payload in the IP packet |
| static int udp_changed_udp_dynamic | ( | const struct rohc_comp_ctxt * | context, |
| const struct udphdr * | udp | ||
| ) | [static] |
Check if the dynamic part of the UDP header changed.
| context | The compression context |
| udp | The UDP header |
| static size_t udp_code_dynamic_udp_part | ( | const struct rohc_comp_ctxt *const | context, |
| const unsigned char *const | next_header, | ||
| unsigned char *const | dest, | ||
| const size_t | counter | ||
| ) | [static] |
Build the dynamic part of the UDP header.
Dynamic part of UDP header (5.7.7.5):
+---+---+---+---+---+---+---+---+
1 / Checksum / 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 |
| size_t udp_code_static_udp_part | ( | const struct rohc_comp_ctxt *const | context, |
| const unsigned char *const | next_header, | ||
| unsigned char *const | dest, | ||
| const size_t | 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 |
| size_t udp_code_uo_remainder | ( | const struct rohc_comp_ctxt *const | context, |
| const unsigned char *const | next_header, | ||
| unsigned char *const | dest, | ||
| const size_t | 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 |
| static void udp_decide_state | ( | struct rohc_comp_ctxt *const | context | ) | [static] |
Decide the state that should be used for the next packet compressed with the ROHC UDP profile.
The three states are:
| context | The compression context |
| struct rohc_comp_profile c_udp_profile |
{
.id = ROHC_PROFILE_UDP,
.protocol = ROHC_IPPROTO_UDP,
.create = c_udp_create,
.destroy = c_generic_destroy,
.check_profile = c_udp_check_profile,
.check_context = c_udp_check_context,
.encode = c_udp_encode,
.reinit_context = c_generic_reinit_context,
.feedback = c_generic_feedback,
.use_udp_port = c_generic_use_udp_port,
}
Define the compression part of the UDP profile as described in the RFC 3095.
1.7.6.1