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 "rohc_comp_rfc3095.h"
#include "protocols/udp.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
 | 
| static bool  | c_udp_create (struct rohc_comp_ctxt *const context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs) | 
|   | Create a new UDP context and initialize it thanks to the given IP/UDP packet.  More...
  | 
|   | 
| static rohc_packet_t  | c_udp_decide_FO_packet (const struct rohc_comp_ctxt *const context) | 
|   | Decide which packet to send when in First Order (FO) state.  More...
  | 
|   | 
| static rohc_packet_t  | c_udp_decide_SO_packet (const struct rohc_comp_ctxt *const context) | 
|   | Decide which packet to send when in Second Order (SO) state.  More...
  | 
|   | 
| static int  | c_udp_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/UDP packet according to a pattern decided by several different factors.  More...
  | 
|   | 
| static size_t  | udp_code_dynamic_udp_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 UDP header.  More...
  | 
|   | 
| static void  | udp_detect_udp_changes (const struct rohc_comp_ctxt *const context, const struct udphdr *const udp, struct udp_tmp_vars *const tmp) | 
|   | Detect changes in the UDP header.  More...
  | 
|   | 
| size_t  | udp_code_uo_remainder (const struct rohc_comp_ctxt *const context, const uint8_t *const next_header, uint8_t *const dest, const size_t counter) | 
|   | Build UDP-related fields in the tail of the UO packets.  More...
  | 
|   | 
| size_t  | udp_code_static_udp_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 UDP header.  More...
  | 
|   | 
◆ c_udp_create()
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.
- Parameters
 - 
  
    | context | The compression context  | 
    | uncomp_pkt_hdrs | The uncompressed headers to initialize the new context  | 
  
   
- Returns
 - true if successful, false otherwise 
 
 
 
◆ c_udp_decide_FO_packet()
Decide which packet to send when in First Order (FO) state. 
Packets that can be used are the IR-DYN and UO-2 packets.
- See also
 - decide_packet
 
- Parameters
 - 
  
    | context | The compression context  | 
  
   
- Returns
 - The packet type among ROHC_PACKET_IR_DYN and ROHC_PACKET_UOR_2 
 
 
 
◆ c_udp_decide_SO_packet()
Decide which packet to send when in Second Order (SO) state. 
Packets that can be used are the UO-0, UO-1 and UO-2 (with or without extensions) packets.
- See also
 - decide_packet
 
- Parameters
 - 
  
    | context | The compression context  | 
  
   
- Returns
 - The packet type among ROHC_PACKET_UO_0, ROHC_PACKET_UO_1 and ROHC_PACKET_UOR_2 
 
 
 
◆ c_udp_encode()
  
  
      
        
          | static int c_udp_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/UDP packet according to a pattern decided by several different factors. 
- Parameters
 - 
  
    | context | The compression context  | 
    | uncomp_pkt_hdrs | The uncompressed headers 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  | 
  
   
- Returns
 - The length of the ROHC packet if successful, -1 otherwise 
 
 
 
◆ udp_code_dynamic_udp_part()
  
  
      
        
          | static size_t udp_code_dynamic_udp_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 UDP header. 
 Dynamic part of UDP header (5.7.7.5):
    +---+---+---+---+---+---+---+---+
 1  /           Checksum            /   2 octets
    +---+---+---+---+---+---+---+---+- Parameters
 - 
  
    | 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  | 
  
   
- Returns
 - The new position in the rohc-packet-under-build buffer 
 
 
 
◆ udp_code_static_udp_part()
      
        
          | size_t udp_code_static_udp_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 UDP header. 
 Static part of UDP header (5.7.7.5):
    +---+---+---+---+---+---+---+---+
 1  /          Source Port          /   2 octets
    +---+---+---+---+---+---+---+---+
 2  /       Destination Port        /   2 octets
    +---+---+---+---+---+---+---+---+- Parameters
 - 
  
    | 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  | 
  
   
- Returns
 - The new position in the rohc-packet-under-build buffer 
 
 
 
◆ udp_code_uo_remainder()
      
        
          | size_t udp_code_uo_remainder  | 
          ( | 
          const struct rohc_comp_ctxt *const  | 
          context,  | 
        
        
           | 
           | 
          const uint8_t *const  | 
          next_header,  | 
        
        
           | 
           | 
          uint8_t *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
     --- --- --- --- --- --- --- ---- Parameters
 - 
  
    | 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  | 
  
   
- Returns
 - The new position in the rohc-packet-under-build buffer 
 
 
 
◆ udp_detect_udp_changes()
Detect changes in the UDP header. 
- Parameters
 - 
  
     | context | The compression context  | 
     | udp | The UDP header  | 
    | [out] | tmp | The changes detected in the UDP header  | 
  
   
 
 
◆ c_udp_profile
Initial value:=
{
}
void rohc_comp_rfc3095_destroy(struct rohc_comp_ctxt *const context)
Destroy the context. 
Definition: rohc_comp_rfc3095.c:649
 
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 int c_udp_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/UDP packet according to a pattern decided by several different factors. 
Definition: c_udp.c:189
 
static bool c_udp_create(struct rohc_comp_ctxt *const context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs)
Create a new UDP context and initialize it thanks to the given IP/UDP packet. 
Definition: c_udp.c:118
 
Definition: rohc_profiles.h:87
 
 
Define the compression part of the UDP profile as described in the RFC 3095.