ROHC compression/decompression library
Functions
feedback.c File Reference

ROHC feedback routines. More...

#include "rohc.h"
#include "feedback.h"
#include "rohc_traces.h"
#include "rohc_debug.h"
#include <assert.h>
Include dependency graph for feedback.c:

Functions

int f_append_cid (struct d_feedback *feedback, const uint16_t cid, const rohc_cid_type_t cid_type)
 Append the CID to the feedback packet.
int f_feedback1 (int sn, struct d_feedback *feedback)
 Build a FEEDBACK-1 packet.
int f_feedback2 (int acktype, int mode, uint32_t sn, struct d_feedback *feedback)
 Build a FEEDBACK-2 packet.
int f_add_option (struct d_feedback *feedback, const uint8_t opt_type, const unsigned char *data, const size_t data_len)
 Add an option data to the FEEDBACK-2 packet.
unsigned char * f_wrap_feedback (struct d_feedback *feedback, const uint16_t cid, const rohc_cid_type_t cid_type, int with_crc, unsigned char *crc_table, int *final_size)
 Wrap the feedback packet and add a CRC option if specified.

Detailed Description

ROHC feedback routines.

Author:
Didier Barvaux <didier.barvaux@toulouse.viveris.com>
The hackers from ROHC for Linux

Function Documentation

int f_add_option ( struct d_feedback feedback,
const uint8_t  opt_type,
const unsigned char *  data,
const size_t  data_len 
)

Add an option data to the FEEDBACK-2 packet.

Parameters:
feedbackThe feedback packet to which the option must be added
opt_typeThe type of option to add
dataThe option data
data_lenThe length of option data (in bytes)
Returns:
ROHC_OK if the option is successfully added, ROHC_ERROR otherwise

References d_feedback::data, FEEDBACK_DATA_MAX_LEN, OPT_TYPE_CRC, ROHC_ERROR, ROHC_OK, d_feedback::size, and d_feedback::type.

Referenced by d_optimistic_feedback(), f_feedback2(), and f_wrap_feedback().

int f_append_cid ( struct d_feedback feedback,
const uint16_t  cid,
const rohc_cid_type_t  cid_type 
)

Append the CID to the feedback packet.

Parameters:
feedbackThe feedback packet to which the CID must be appended
cidThe Context ID (CID) to append
cid_typeThe type of CID used for the feedback
Returns:
Whether the CID is successfully appended or not

References c_bytesSdvl(), c_encodeSdvl(), d_feedback::data, rohc_debugf, ROHC_LARGE_CID, ROHC_LARGE_CID_MAX, ROHC_SMALL_CID_MAX, d_feedback::size, and zfree.

Referenced by f_wrap_feedback().

int f_feedback1 ( int  sn,
struct d_feedback feedback 
)

Build a FEEDBACK-1 packet.

Parameters:
snThe Sequence Number (SN) the feedback packet is associated with
feedbackThe feedback packet to build
Returns:
Whether the build is successful or not

References d_feedback::data, d_feedback::size, and d_feedback::type.

int f_feedback2 ( int  acktype,
int  mode,
uint32_t  sn,
struct d_feedback feedback 
)

Build a FEEDBACK-2 packet.

Parameters:
acktypeThe type of acknowledgement: ACK, NACK or S-NACK
modeThe mode in which ROHC operates: U_MODE, O_MODE or R_MODE
snThe Sequence Number (SN) the feedback packet is associated with
feedbackThe feedback packet to build
Returns:
ROHC_OK if the packet is successfully built, ROHC_ERROR otherwise

References d_feedback::data, f_add_option(), OPT_TYPE_SN, rohc_debugf, ROHC_ERROR, ROHC_OK, d_feedback::size, and d_feedback::type.

Referenced by d_change_mode_feedback(), and d_optimistic_feedback().

unsigned char* f_wrap_feedback ( struct d_feedback feedback,
const uint16_t  cid,
const rohc_cid_type_t  cid_type,
int  with_crc,
unsigned char *  crc_table,
int *  final_size 
)

Wrap the feedback packet and add a CRC option if specified.

Warning:
CID may be greater than MAX_CID if the context was not found and generated a No Context feedback; it must however respect CID type
Parameters:
feedbackThe feedback packet to which the CID must be appended
cidThe Context ID (CID) to append
cid_typeThe type of CID used for the feedback
with_crcWhether the CRC option must be added or not
crc_tableThe pre-computed table for fast CRC computation
final_sizeOUT: The final size of the feedback packet
Returns:
The feedback packet if successful, NULL otherwise

References crc_calculate(), CRC_INIT_8, d_feedback::data, f_add_option(), f_append_cid(), OPT_TYPE_CRC, ROHC_CRC_TYPE_8, rohc_debugf, ROHC_OK, and d_feedback::size.

Referenced by d_change_mode_feedback(), and d_optimistic_feedback().