Can we inject context info to libray?

Asked by bhat

Hi,

Is there any possibility that can we store the context to db, delete that context and once next packet comes inject stored context into rohc libray and proceed?

Question information

Language:
English Edit question
Status:
Answered
For:
rohc Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Didier Barvaux (didier-barvaux) said :
#1

Hello,

Would you like to implement some kind of hibernation? Record the library context on persistent storage (database, disk...), then later fetch that record back and initialize the library from it?

Regards,
Didier

Revision history for this message
bhat (hibhat) said :
#2

Hello,

Thanks for replying.

Yes, exactly. That is what i am looking for. Because my next packet for compression/decompression might come after long time, i do not want to keep things in-memory which could be used for other purposes.

Revision history for this message
bhat (hibhat) said :
#3

Hi,

Has someone implemented similar stuff already or no one has tried it? I thought it would be better if we could save that much memory if frequency of packets is less and source/destination pairs are more.

Revision history for this message
Launchpad Janitor (janitor) said :
#4

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Didier Barvaux (didier-barvaux) said :
#5

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

Can you help with this problem?

Provide an answer of your own, or ask bhat for more information if necessary.

To post a message you must log in.