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

ROHC compression context for the uncompressed profile. More...

#include "rohc_comp_internals.h"
#include "rohc_traces.h"
#include "rohc_traces_internal.h"
#include "rohc_debug.h"
#include "schemes/cid.h"
#include "crc.h"
#include <assert.h>
Include dependency graph for c_uncompressed.c:

Functions

static bool c_uncompressed_create (struct rohc_comp_ctxt *const context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs)
 Create a new Uncompressed context and initialize it thanks to the given IP packet. More...
 
static void c_uncompressed_destroy (struct rohc_comp_ctxt *const context)
 Destroy the Uncompressed context. More...
 
static int c_uncompressed_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. More...
 
static int uncompressed_code_packet (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)
 Build the ROHC packet to send. More...
 
static int uncompressed_code_IR_packet (const struct rohc_comp_ctxt *context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, uint8_t *const rohc_pkt, const size_t rohc_pkt_max_len)
 Build the IR packet. More...
 
static int uncompressed_code_normal_packet (const struct rohc_comp_ctxt *context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, uint8_t *const rohc_pkt, const size_t rohc_pkt_max_len)
 Build the Normal packet. More...
 
static bool uncomp_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. More...
 

Variables

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

Detailed Description

ROHC compression context for the uncompressed profile.

Author
Didier Barvaux didie.nosp@m.r.ba.nosp@m.rvaux.nosp@m.@tou.nosp@m.louse.nosp@m..viv.nosp@m.eris..nosp@m.com
Didier Barvaux didie.nosp@m.r@ba.nosp@m.rvaux.nosp@m..org

Function Documentation

◆ c_uncompressed_create()

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

Create a new Uncompressed context and initialize it thanks to the given IP 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_uncompressed_destroy()

static void c_uncompressed_destroy ( struct rohc_comp_ctxt *const  context)
static

Destroy the Uncompressed context.

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

Parameters
contextThe compression context

◆ c_uncompressed_encode()

static int c_uncompressed_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 
)
static

Encode an IP packet according to a pattern decided by several different factors.

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 encode
rohc_pktOUT: The ROHC packet
rohc_pkt_max_lenThe maximum length of the ROHC packet
packet_typeOUT: The type of ROHC packet that is created
Returns
The length of the ROHC packet if successful, -1 otherwise

◆ uncomp_feedback()

static bool uncomp_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 
)
static

Update the profile when feedback is received.

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

Parameters
contextThe compression context
feedback_typeThe feedback type among ROHC_FEEDBACK_1 and ROHC_FEEDBACK_2
packetThe whole feedback packet with CID bits
packet_lenThe length of the whole feedback packet with CID bits
feedback_dataThe feedback data without the CID bits
feedback_data_lenThe length of the feedback data without the CID bits
Returns
true if the feedback was successfully handled, false if the feedback could not be taken into account

◆ uncompressed_code_IR_packet()

static int uncompressed_code_IR_packet ( const struct rohc_comp_ctxt context,
const struct rohc_pkt_hdrs *const  uncomp_pkt_hdrs,
uint8_t *const  rohc_pkt,
const size_t  rohc_pkt_max_len 
)
static

Build the IR packet.

 IR packet (5.10.1)

     0   1   2   3   4   5   6   7
    --- --- --- --- --- --- --- ---
 1 :         Add-CID octet         : if for small CIDs and (CID != 0)
   +---+---+---+---+---+---+---+---+
 2 | 1   1   1   1   1   1   0 |res|
   +---+---+---+---+---+---+---+---+
   :                               :
 3 /    0-2 octets of CID info     / 1-2 octets if for large CIDs
   :                               :
   +---+---+---+---+---+---+---+---+
 4 |          Profile = 0          | 1 octet
   +---+---+---+---+---+---+---+---+
 5 |              CRC              | 1 octet
   +---+---+---+---+---+---+---+---+
   :                               : (optional)
 6 /           IP packet           / variable length
   :                               :
    --- --- --- --- --- --- --- ---

Part 6 is not managed by this function.

Parameters
contextThe compression context
uncomp_pkt_hdrsThe uncompressed headers to encode
rohc_pktOUT: The ROHC packet
rohc_pkt_max_lenThe maximum length of the ROHC packet
Returns
The length of the ROHC packet if successful, -1 otherwise

◆ uncompressed_code_normal_packet()

static int uncompressed_code_normal_packet ( const struct rohc_comp_ctxt context,
const struct rohc_pkt_hdrs *const  uncomp_pkt_hdrs,
uint8_t *const  rohc_pkt,
const size_t  rohc_pkt_max_len 
)
static

Build the Normal packet.

 Normal packet (5.10.2)

     0   1   2   3   4   5   6   7
    --- --- --- --- --- --- --- ---
 1 :         Add-CID octet         : if for small CIDs and (CID != 0)
   +---+---+---+---+---+---+---+---+
 2 |   first octet of IP packet    |
   +---+---+---+---+---+---+---+---+
   :                               :
 3 /    0-2 octets of CID info     / 1-2 octets if for large CIDs
   :                               :
   +---+---+---+---+---+---+---+---+
   |                               |
 4 /      rest of IP packet        / variable length
   |                               |
   +---+---+---+---+---+---+---+---+

Part 4 is not managed by this function.

Parameters
contextThe compression context
uncomp_pkt_hdrsThe uncompressed headers to encode
rohc_pktOUT: The ROHC packet
rohc_pkt_max_lenThe maximum length of the ROHC packet
Returns
The length of the ROHC packet if successful, -1 otherwise

◆ uncompressed_code_packet()

static int uncompressed_code_packet ( 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 
)
static

Build the ROHC packet to send.

Parameters
contextThe compression context
uncomp_pkt_hdrsThe uncompressed headers to encode
rohc_pktOUT: The ROHC packet
rohc_pkt_max_lenThe maximum length of the ROHC packet
packet_typeOUT: The type of ROHC packet that is created
Returns
The length of the ROHC packet if successful, -1 otherwise

Variable Documentation

◆ c_uncompressed_profile

const struct rohc_comp_profile c_uncompressed_profile
Initial value:
=
{
.feedback = uncomp_feedback,
}
static bool c_uncompressed_create(struct rohc_comp_ctxt *const context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs)
Create a new Uncompressed context and initialize it thanks to the given IP packet.
Definition: c_uncompressed.c:99
static bool uncomp_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: c_uncompressed.c:171
static void c_uncompressed_destroy(struct rohc_comp_ctxt *const context)
Destroy the Uncompressed context.
Definition: c_uncompressed.c:118
Definition: rohc_profiles.h:79
static int c_uncompressed_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: c_uncompressed.c:139

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