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

Functions to create ROHC feedback. More...

#include <rohc/rohc.h>
#include <rohc/rohc_buf.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include "dllexport.h"
Include dependency graph for feedback_create.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 FEEDBACK_DATA_MAX_LEN   30
 The maximum length (in bytes) of the feedback data.

Enumerations

enum  rohc_feedback_opt_t {
  ROHC_FEEDBACK_OPT_CRC = 1, ROHC_FEEDBACK_OPT_REJECT = 2, ROHC_FEEDBACK_OPT_SN_NOT_VALID = 3, ROHC_FEEDBACK_OPT_SN = 4,
  ROHC_FEEDBACK_OPT_CLOCK = 5, ROHC_FEEDBACK_OPT_JITTER = 6, ROHC_FEEDBACK_OPT_LOSS = 7
}
 The different feedback options. More...
enum  rohc_ack_type_t { ROHC_ACK_TYPE_ACK = 0, ROHC_ACK_TYPE_NACK = 1, ROHC_ACK_TYPE_STATIC_NACK = 2 }
 The different types of feedback acknowledgements. More...
enum  rohc_feedback_crc_t { ROHC_FEEDBACK_NO_CRC = false, ROHC_FEEDBACK_WITH_CRC = true }
 Whether the feedback is protected by a CRC or not. More...

Functions

bool ROHC_EXPORT rohc_decomp_feedback_size (const struct rohc_buf rohc_data, size_t *const feedback_hdr_len, size_t *const feedback_data_len)
void f_feedback1 (const uint32_t sn, struct d_feedback *const feedback)
 Build a FEEDBACK-1 packet.
bool f_feedback2 (const rohc_ack_type_t ack_type, const rohc_mode_t mode, const uint32_t sn, struct d_feedback *const feedback)
 Build a FEEDBACK-2 packet.
bool f_add_option (struct d_feedback *const feedback, const rohc_feedback_opt_t opt_type, const unsigned char *const data, const size_t data_len)
 Add an option data to the FEEDBACK-2 packet.
uint8_t * f_wrap_feedback (struct d_feedback *feedback, const uint16_t cid, const rohc_cid_type_t cid_type, const rohc_feedback_crc_t protect_with_crc, const uint8_t *const crc_table, size_t *const final_size)
 Wrap the feedback packet and add a CRC option if specified.

Detailed Description

Functions to create ROHC feedback.

Author:
Didier Barvaux <didier.barvaux@toulouse.viveris.com>
Didier Barvaux <didier@barvaux.org>

Define Documentation

#define FEEDBACK_DATA_MAX_LEN   30

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


Enumeration Type Documentation

The different types of feedback acknowledgements.

Enumerator:
ROHC_ACK_TYPE_ACK 

positive ACKnowledgement (ACK)

ROHC_ACK_TYPE_NACK 

Negative ACKnowledgement (NACK)

ROHC_ACK_TYPE_STATIC_NACK 

static Negative ACK (STATIC-NACK)

Whether the feedback is protected by a CRC or not.

Enumerator:
ROHC_FEEDBACK_NO_CRC 

No CRC option protects the feedback

ROHC_FEEDBACK_WITH_CRC 

A CRC option protects the feedback

The different feedback options.

Enumerator:
ROHC_FEEDBACK_OPT_CRC 

FEEDBACK-2 CRC option

ROHC_FEEDBACK_OPT_REJECT 

FEEDBACK-2 Reject option

ROHC_FEEDBACK_OPT_SN_NOT_VALID 

FEEDBACK-2 SN-not-valid option

ROHC_FEEDBACK_OPT_SN 

FEEDBACK-2 SN option

ROHC_FEEDBACK_OPT_CLOCK 

FEEDBACK-2 Clock option

ROHC_FEEDBACK_OPT_JITTER 

FEEDBACK-2 Jitter option

ROHC_FEEDBACK_OPT_LOSS 

FEEDBACK-2 Loss option


Function Documentation

bool f_add_option ( struct d_feedback *const  feedback,
const rohc_feedback_opt_t  opt_type,
const unsigned char *const  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:
true if the option is successfully added, false otherwise
void f_feedback1 ( const uint32_t  sn,
struct d_feedback *const  feedback 
)

Build a FEEDBACK-1 packet.

Parameters:
snThe Sequence Number (SN) the feedback packet is associated with
feedbackThe feedback packet to build
bool f_feedback2 ( const rohc_ack_type_t  ack_type,
const rohc_mode_t  mode,
const uint32_t  sn,
struct d_feedback *const  feedback 
)

Build a FEEDBACK-2 packet.

Parameters:
ack_typeThe type of acknowledgement:
modeThe mode in which ROHC operates:
snThe Sequence Number (SN) the feedback packet is associated with, zero if unknown
feedbackThe feedback packet to build
Returns:
true if the packet is successfully built, false otherwise
uint8_t* f_wrap_feedback ( struct d_feedback *const  feedback,
const uint16_t  cid,
const rohc_cid_type_t  cid_type,
const rohc_feedback_crc_t  protect_with_crc,
const uint8_t *const  crc_table,
size_t *const  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
protect_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
bool ROHC_EXPORT rohc_decomp_feedback_size ( const struct rohc_buf  rohc_data,
size_t *const  feedback_hdr_len,
size_t *const  feedback_data_len 
)