d_udp.c File Reference
ROHC decompression context for the UDP profile.
More...
#include "d_udp.h"
#include "d_ip.h"
#include "rohc_traces_internal.h"
#include "rohc_bit_ops.h"
#include "rohc_debug.h"
#include "rohc_utils.h"
#include "crc.h"
#include "protocols/udp.h"
#include <string.h>
#include <assert.h>
Data Structures |
| struct | d_udp_context |
| | Define the UDP part of the decompression profile context. More...
|
Functions |
| static bool | d_udp_create (const struct rohc_decomp_ctxt *const context, struct rohc_decomp_rfc3095_ctxt **const persist_ctxt, struct rohc_decomp_volat_ctxt *const volat_ctxt) |
| | Create the UDP decompression context.
|
| static void | d_udp_destroy (struct rohc_decomp_rfc3095_ctxt *const rfc3095_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt) |
| | Destroy the context.
|
| static int | udp_parse_dynamic_udp (const struct rohc_decomp_ctxt *const context, const uint8_t *packet, const size_t length, struct rohc_extr_bits *const bits) |
| | Parse the UDP dynamic part of the ROHC packet.
|
| static int | udp_parse_uo_remainder (const struct rohc_decomp_ctxt *const context, const uint8_t *packet, unsigned int length, struct rohc_extr_bits *const bits) |
| | Parse the UDP tail of the UO* ROHC packets.
|
| static bool | udp_decode_values_from_bits (const struct rohc_decomp_ctxt *context, const struct rohc_extr_bits *const bits, struct rohc_decoded_values *const decoded) |
| | Decode UDP values from extracted bits.
|
| static int | udp_build_uncomp_udp (const struct rohc_decomp_ctxt *const context, const struct rohc_decoded_values *const decoded, uint8_t *const dest, const unsigned int payload_len) |
| | Build an uncompressed UDP header.
|
| static void | udp_update_context (struct rohc_decomp_ctxt *const context, const struct rohc_decoded_values *const decoded) |
| | Update context with decoded UDP values.
|
| int | udp_parse_static_udp (const struct rohc_decomp_ctxt *const context, const uint8_t *packet, size_t length, struct rohc_extr_bits *const bits) |
| | Parse the UDP static part of the ROHC packet.
|
Variables |
| struct rohc_decomp_profile | d_udp_profile |
| | Define the decompression part of the UDP profile as described in the RFC 3095.
|
Detailed Description
ROHC decompression context for the UDP profile.
- Author:
- Didier Barvaux <didier.barvaux@toulouse.viveris.com>
-
Didier Barvaux <didier@barvaux.org>
Function Documentation
Create the UDP decompression context.
This function is one of the functions that must exist in one profile for the framework to work.
- Parameters:
-
| context | The main decompression context |
| [out] | persist_ctxt | The persistent part of the decompression context |
| [out] | volat_ctxt | The volatile part of the decompression context |
- Returns:
- true if the UDP context was successfully created, false if a problem occurred
Destroy the context.
This function is one of the functions that must exist in one profile for the framework to work.
- Parameters:
-
| rfc3095_ctxt | The persistent decompression context for the RFC3095 profiles |
| volat_ctxt | The volatile decompression context |
| static int udp_build_uncomp_udp |
( |
const struct rohc_decomp_ctxt *const |
context, |
|
|
const struct rohc_decoded_values *const |
decoded, |
|
|
uint8_t *const |
dest, |
|
|
const unsigned int |
payload_len | |
|
) |
| | [static] |
Build an uncompressed UDP header.
- Parameters:
-
| context | The decompression context |
| decoded | The values decoded from the ROHC header |
| dest | The buffer to store the UDP header (MUST be at least of sizeof(struct udphdr) length) |
| payload_len | The length of the UDP payload |
- Returns:
- The length of the next header (ie. the UDP header), -1 in case of error
Decode UDP values from extracted bits.
The following values are decoded:
- UDP source port
- UDP destination port
- UDP checksum
- Parameters:
-
| context | The decompression context |
| bits | The extracted bits |
| decoded | OUT: The corresponding decoded values |
- Returns:
- true if decoding is successful, false otherwise
| static int udp_parse_dynamic_udp |
( |
const struct rohc_decomp_ctxt *const |
context, |
|
|
const uint8_t * |
packet, |
|
|
const size_t |
length, |
|
|
struct rohc_extr_bits *const |
bits | |
|
) |
| | [static] |
Parse the UDP dynamic part of the ROHC packet.
- Parameters:
-
| context | The decompression context |
| packet | The ROHC packet to parse |
| length | The length of the ROHC packet |
| bits | OUT: The bits extracted from the ROHC header |
- Returns:
- The number of bytes read in the ROHC packet, -1 in case of failure
Parse the UDP static part of the ROHC packet.
- Parameters:
-
| context | The decompression context |
| packet | The ROHC packet to parse |
| length | The length of the ROHC packet |
| bits | OUT: The bits extracted from the ROHC header |
- Returns:
- The number of bytes read in the ROHC packet, -1 in case of failure
| static int udp_parse_uo_remainder |
( |
const struct rohc_decomp_ctxt *const |
context, |
|
|
const uint8_t * |
packet, |
|
|
unsigned int |
length, |
|
|
struct rohc_extr_bits *const |
bits | |
|
) |
| | [static] |
Parse the UDP tail of the UO* ROHC packets.
- Parameters:
-
| context | The decompression context |
| packet | The ROHC packet to parse |
| length | The length of the ROHC packet |
| bits | OUT: The bits extracted from the ROHC header |
- Returns:
- The number of bytes read in the ROHC packet, -1 in case of failure
Update context with decoded UDP values.
The following decoded values are updated in context:
- UDP source port
- UDP destination port
- UDP checksum present flag
- Parameters:
-
| context | The decompression context |
| decoded | The decoded values to update in the context |
Variable Documentation
Initial value:
{
.id = ROHC_PROFILE_UDP,
.msn_max_bits = 16,
.new_context = (rohc_decomp_new_context_t) d_udp_create,
.free_context = (rohc_decomp_free_context_t) d_udp_destroy,
.detect_pkt_type = ip_detect_packet_type,
.parse_pkt = (rohc_decomp_parse_pkt_t) rfc3095_decomp_parse_pkt,
.decode_bits = (rohc_decomp_decode_bits_t) rfc3095_decomp_decode_bits,
.build_hdrs = (rohc_decomp_build_hdrs_t) rfc3095_decomp_build_hdrs,
.update_ctxt = (rohc_decomp_update_ctxt_t) rfc3095_decomp_update_ctxt,
.attempt_repair = (rohc_decomp_attempt_repair_t) rfc3095_decomp_attempt_repair,
.get_sn = rohc_decomp_rfc3095_get_sn,
}
Define the decompression part of the UDP profile as described in the RFC 3095.