ROHC compression/decompression library
Functions | Variables
c_esp.c File Reference

ROHC ESP compression profile. More...

#include "rohc_comp_rfc3095.h"
#include "c_ip.h"
#include "rohc_traces_internal.h"
#include "crc.h"
#include "protocols/esp.h"
#include "rohc_utils.h"
#include <stdbool.h>
#include <string.h>
#include <assert.h>
Include dependency graph for c_esp.c:

Functions

static bool c_esp_create (struct rohc_comp_ctxt *const context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs)
 Create a new ESP context and initialize it thanks to the given IP/ESP packet. More...
 
static uint32_t c_esp_get_next_sn (const struct rohc_comp_ctxt *const context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs)
 Determine the SN value for the next packet. More...
 
static size_t esp_code_static_esp_part (const struct rohc_comp_ctxt *const context, const uint8_t *const next_header, uint8_t *const dest, const size_t counter)
 Build the static part of the ESP header. More...
 
static size_t esp_code_dynamic_esp_part (const struct rohc_comp_ctxt *const context, const uint8_t *const next_header, uint8_t *const dest, const size_t counter)
 Build the dynamic part of the ESP header. More...
 

Variables

const struct rohc_comp_profile c_esp_profile
 Define the compression part of the ESP profile as described in the RFC 3095. More...
 

Detailed Description

ROHC ESP compression profile.

Author
FWX rohc_.nosp@m.team.nosp@m.@dial.nosp@m.ine..nosp@m.fr
Didier Barvaux didie.nosp@m.r@ba.nosp@m.rvaux.nosp@m..org

Function Documentation

◆ c_esp_create()

static bool c_esp_create ( struct rohc_comp_ctxt *const  context,
const struct rohc_pkt_hdrs *const  uncomp_pkt_hdrs 
)
static

Create a new ESP context and initialize it thanks to the given IP/ESP packet.

This function is one of the functions that must exist in one profile for the framework to work.

Parameters
contextThe compression context
uncomp_pkt_hdrsThe uncompressed headers to initialize the new context
Returns
true if successful, false otherwise

◆ c_esp_get_next_sn()

static uint32_t c_esp_get_next_sn ( const struct rohc_comp_ctxt *const  context,
const struct rohc_pkt_hdrs *const  uncomp_pkt_hdrs 
)
static

Determine the SN value for the next packet.

Profile SN is the ESP SN.

Parameters
contextThe compression context
uncomp_pkt_hdrsThe uncompressed headers to encode
Returns
The SN

◆ esp_code_dynamic_esp_part()

static size_t esp_code_dynamic_esp_part ( const struct rohc_comp_ctxt *const  context,
const uint8_t *const  next_header,
uint8_t *const  dest,
const size_t  counter 
)
static

Build the dynamic part of the ESP header.

 Dynamic part of ESP header (5.7.7.7):

    +---+---+---+---+---+---+---+---+
 1  /       Sequence Number         /   4 octets
    +---+---+---+---+---+---+---+---+
Parameters
contextThe compression context
next_headerThe ESP header
destThe rohc-packet-under-build buffer
counterThe current position in the rohc-packet-under-build buffer
Returns
The new position in the rohc-packet-under-build buffer

◆ esp_code_static_esp_part()

static size_t esp_code_static_esp_part ( const struct rohc_comp_ctxt *const  context,
const uint8_t *const  next_header,
uint8_t *const  dest,
const size_t  counter 
)
static

Build the static part of the ESP header.

 Static part of ESP header (5.7.7.7):

    +---+---+---+---+---+---+---+---+
 1  /              SPI              /   4 octets
    +---+---+---+---+---+---+---+---+

 SPI = Security Parameters Index
Parameters
contextThe compression context
next_headerThe ESP header
destThe rohc-packet-under-build buffer
counterThe current position in the rohc-packet-under-build buffer
Returns
The new position in the rohc-packet-under-build buffer

Variable Documentation

◆ c_esp_profile

const struct rohc_comp_profile c_esp_profile
Initial value:
=
{
.create = c_esp_create,
}
void rohc_comp_rfc3095_destroy(struct rohc_comp_ctxt *const context)
Destroy the context.
Definition: rohc_comp_rfc3095.c:649
int rohc_comp_rfc3095_encode(struct rohc_comp_ctxt *const context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, uint8_t *const rohc_pkt, const size_t rohc_pkt_max_len, rohc_packet_t *const packet_type)
Encode an IP packet according to a pattern decided by several different factors.
Definition: rohc_comp_rfc3095.c:691
bool rohc_comp_rfc3095_feedback(struct rohc_comp_ctxt *const context, const enum rohc_feedback_type feedback_type, const uint8_t *const packet, const size_t packet_len, const uint8_t *const feedback_data, const size_t feedback_data_len)
Update the profile when feedback is received.
Definition: rohc_comp_rfc3095.c:756
static bool c_esp_create(struct rohc_comp_ctxt *const context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs)
Create a new ESP context and initialize it thanks to the given IP/ESP packet.
Definition: c_esp.c:80
Definition: rohc_profiles.h:91

Define the compression part of the ESP profile as described in the RFC 3095.