ROHC compression/decompression library
Functions
c_udp.h File Reference

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

#include "rohc_comp_internals.h"
#include <stdint.h>
#include <stdbool.h>
Include dependency graph for c_udp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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. More...
 
bool c_udp_check_context (const struct rohc_comp_ctxt *context, const struct net_pkt *const packet)
 Check if the IP/UDP packet belongs to the context. More...
 
size_t udp_code_uo_remainder (const struct rohc_comp_ctxt *context, const uint8_t *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...
 

Detailed Description

ROHC compression context for the UDP 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

Function Documentation

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:

  • the number of IP headers must be the same as in context
  • IP version of the two IP headers must be the same as in context
  • IP packets must not be fragmented
  • the source and destination addresses of the two IP headers must match the ones in the context
  • the transport protocol must be UDP
  • the source and destination ports of the UDP header must match the ones in the context
  • IPv6 only: the Flow Label of the two IP headers must match the ones the context

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

Parameters
contextThe compression context
packetThe IP/UDP packet to check
Returns
true if the IP/UDP packet belongs to the context false if it does not belong to the context
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:

  • the transport protocol is UDP
  • the version of the outer IP header is 4 or 6
  • the outer IP header is not an IP fragment
  • if there are at least 2 IP headers, the version of the inner IP header is 4 or 6
  • if there are at least 2 IP headers, the inner IP header is not an IP fragment
  • the inner IP payload is at least 8-byte long for UDP header
  • the UDP Length field and the UDP payload match
See also
rohc_comp_rfc3095_check_profile

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

Parameters
compThe ROHC compressor
packetThe packet to check
Returns
Whether the IP packet corresponds to the profile:
  • true if the IP packet corresponds to the profile,
  • false if the IP packet does not correspond to the profile
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
contextThe compression context
next_headerThe UDP 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
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
contextThe compression context
next_headerThe UDP 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