ROHC compression/decompression library
Data Structures | Defines | Functions
feedback.h File Reference

ROHC feedback routines. More...

#include <string.h>
#include "sdvl.h"
#include "crc.h"
Include dependency graph for feedback.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  d_feedback
 Defines a ROHC feedback. More...

Defines

#define OPT_TYPE_CRC   1
 CRC option for the FEEDBACK-2 packet.
#define OPT_TYPE_REJECT   2
 Reject option for the FEEDBACK-2 packet.
#define OPT_TYPE_SN_NOT_VALID   3
 SN-not-valid option for the FEEDBACK-2 packet.
#define OPT_TYPE_SN   4
 SN option for the FEEDBACK-2 packet.
#define OPT_TYPE_CLOCK   5
 Clock option for the FEEDBACK-2 packet (not used)
#define OPT_TYPE_JITTER   6
 Jitter option for the FEEDBACK-2 packet (not used)
#define OPT_TYPE_LOSS   7
 Loss option for the FEEDBACK-2 packet.
#define ACKTYPE_ACK   0
 Feedback ACK.
#define ACKTYPE_NACK   1
 Feedback Negative ACK.
#define ACKTYPE_STATIC_NACK   2
 Feedback Satic Negative ACK.
#define NO_CRC   0
 Do not add a CRC option in Feedback packet.
#define WITH_CRC   1
 Do add a CRC option in Feedback packet.
#define FEEDBACK_DATA_MAX_LEN   30
 The maximum length (in bytes) of the feedback data.

Functions

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

Define Documentation

#define ACKTYPE_ACK   0

Feedback ACK.

Referenced by d_change_mode_feedback(), and d_optimistic_feedback().

#define ACKTYPE_NACK   1

Feedback Negative ACK.

Referenced by d_optimistic_feedback().

#define ACKTYPE_STATIC_NACK   2

Feedback Satic Negative ACK.

Referenced by d_optimistic_feedback().

#define FEEDBACK_DATA_MAX_LEN   30

The maximum length (in bytes) of the feedback data.

Referenced by f_add_option().

#define NO_CRC   0

Do not add a CRC option in Feedback packet.

Referenced by d_optimistic_feedback().

#define OPT_TYPE_CLOCK   5

Clock option for the FEEDBACK-2 packet (not used)

#define OPT_TYPE_CRC   1

CRC option for the FEEDBACK-2 packet.

Referenced by f_add_option(), and f_wrap_feedback().

#define OPT_TYPE_JITTER   6

Jitter option for the FEEDBACK-2 packet (not used)

#define OPT_TYPE_LOSS   7

Loss option for the FEEDBACK-2 packet.

#define OPT_TYPE_REJECT   2

Reject option for the FEEDBACK-2 packet.

#define OPT_TYPE_SN   4

SN option for the FEEDBACK-2 packet.

Referenced by f_feedback2().

#define OPT_TYPE_SN_NOT_VALID   3

SN-not-valid option for the FEEDBACK-2 packet.

Referenced by d_optimistic_feedback().

#define WITH_CRC   1

Do add a CRC option in Feedback packet.

Referenced by d_change_mode_feedback(), and d_optimistic_feedback().


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_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().