← Back to team overview

rohc team mailing list archive

Re: [Question #235855]: There is a bug in function c_find_context maybe

 

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

    Status: Open => Answered

Didier Barvaux proposed the following answer:
Hello,

> If c->profile->check_context(c, ip) returns -1, it doesn't mean that
> the profile is unable to compress the packet, it means that the profile
> in this context is unable to compress the packet, 

No, it doesn't mean that. Please check the code and the description of
the c_ip_check_context() or c_esp_check_context() functions for example.
Return code 1 means that profile and context match. Return code 0 means
that profile matches but context don't. Return code -1 means that
profile and context do not match.

Snippet of code:
 * @return        1 if the IP/ESP packet belongs to the context,
 *                         0 if it does not belong to the context and
 *                         -1 if the profile cannot compress it or an error occurs

> but there may be the same profile in another context can compress
> the ip packet. eg.function c_esp_check_context will return -1 because
> the number of ip headers is not the same as in the context, but you
> can't say there isn't another context which has the fit profile has the
> same number of ip headers as in the ip packet.

That's true for return code 0 (goto bad_context), not for return code -1
(goto error).

Regards,
Didier

-- 
You received this question notification because you are a member of ROHC
Team, which is an answer contact for rohc.