rohc_comp_new2 − Create a new ROHC compressor.
#include <rohc/rohc_comp.h>
struct
rohc_comp * rohc_comp_new2(
const rohc_cid_type_t cid_type,
const rohc_cid_t max_cid,
const rohc_comp_random_cb_t rand_cb,
void *const rand_priv
);
Create a new ROHC compressor with the given type of CIDs and MAX_CID.
The user−defined callback for random numbers is called by the ROHC library every time a new random number is required. It currently happens only to initiate the Sequence Number (SN) of new IP−only, IP/UDP, or IP/UDP−Lite streams to a random value as defined by RFC 3095.
cid_type
The type of Context IDs (CID) that the ROHC compressor shall operate with. Accepted values are:
• ROHC_SMALL_CID for small CIDs
• ROHC_LARGE_CID for large CIDs
max_cid
The maximum value that the ROHC
compressor should use for context IDs (CID). As CIDs starts
with value 0, the number of contexts is max_cid + 1.
Accepted values are:
• [0, ROHC_SMALL_CID_MAX] if cid_type is ROHC_SMALL_CID
• [0, ROHC_LARGE_CID_MAX] if cid_type is ROHC_LARGE_CID
rand_cb
The random callback to set
rand_priv
Private data that will be given to the callback, may be used as a context by user
The created compressor if successful, NULL if creation failed
Don’t forget to free compressor memory with rohc_comp_free if rohc_comp_new2 succeeded
struct rohc_comp *compressor; /* the ROHC compressor */
compressor =
rohc_comp_new2(ROHC_SMALL_CID, ROHC_SMALL_CID_MAX,
gen_random_num, NULL);
if(compressor == NULL)
{
fprintf(stderr, "failed create the ROHC compressor0);
goto error;
}
rohc_comp_free(compressor);
rohc_comp.h(3), ROHC_SMALL_CID(3), ROHC_LARGE_CID(3), ROHC_SMALL_CID_MAX(3), ROHC_LARGE_CID_MAX(3), rohc_comp_free(3), rohc_compress4(3), rohc_comp_set_traces_cb2(3), rohc_comp_enable_profiles(3), rohc_comp_enable_profile(3), rohc_comp_disable_profiles(3), rohc_comp_disable_profile(3), rohc_comp_set_mrru(3), rohc_comp_set_wlsb_window_width(3), rohc_comp_set_periodic_refreshes(3), rohc_comp_set_rtp_detection_cb(3)