← Back to team overview

rohc team mailing list archive

Re: [Question #369673]: Can we inject context info to libray?

 

Question #369673 on rohc changed:
https://answers.launchpad.net/rohc/+question/369673

    Status: Expired => Answered

Didier Barvaux changed the question status:
Hello,

Sorry for the answer delay. I was away on holidays. I hope my answer
doesn't come too late...

Some kind of hibernation for context seems possible. You cannot blindly
save the memory pointed by the (de)compressor pointer however. The
memory allocated for the (de)compressor and its contexts is indeed not
contiguous.

IMO, the easiest way would be to add some new functions to the (de)compressor API:
* we start by creating a compressor as usual:
   struct rohc_comp * rohc_comp_new2(...)
* at any time, the compressor and its contexts could be saved into a given memory location:
   bool rohc_comp_save(const struct rohc_comp *const comp, void *const buf, const size_t max_buf_len, size_t *const buf_len)
* then, rohc_comp_free(comp) could be called on the compressor to free some memory
* then, later, the compressor and its contexts could be restored from a given memory location:
   struct rohc_comp * rohc_comp_restore(const void *const buf, const size_t buf_len)
* finally, rohc_comp_free(comp) shall be called on the compressor when the program stops

The weird part is related to the format used for the serialization
format. The format will be closely related to the internal structures of
the ROHC library, so it cannot considered as portable across different
library versions or platforms. However, for the a given library version
on one single machine, it should work fine.

What do you think of ?

Regards,
Didier

-- 
You received this question notification because your team ROHC Team is
an answer contact for rohc.