Re: Encoding-Version support

Vjacheslav Chekushin <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization LMT
Message-ID <[email protected]>
Hi, Stipe.

Stipe Tolj wrote:
> Vjacheslav Chekushin schrieb:
> 
>>Hi, Stipe.
>>Cookies wsp packing/unpacking is the secondary problem.
>>The primary problem for me now is Encoding-Version support.
>>In wsp_headers.c Version-Encodning handled in some places, but not handled in
>>another impotent places. This is for example parameter packing, accept packing
>>and others. There is used hardcoded WSP_1_2 instead of real one.
> 
> 
> ok, AFAIR, the state machine has the encoding version handled and we
> pass this to wsp_headers_pack() as argument and that one uses
> wsp_string_to_versioned_header() to select the right binary
> representation for the header, right?!
> 
> I see that the problem is that the information about the
> encoding-version is not available at places where it is needed to pass
> the argument, since the state machine isn't present there. This is the
> main "problem" about it, IMO.
> 
> Checking on how to elaborate this.
> 
> 
>>So Version-Encoding support is started but not completed. Is it planed to be
>>completed? Which way? Can I help?
> 
> 
> Yes, please verify in how the state machine "attached"
> encoding-version information can be "passed/used" within the calling
> places where the specific encoding-version has to be passed into the
> packing/unpacking routines.

First approach.
The easy way is to add parameter wsp_version for every pack funcions.
So in struct wsp_headers.h we need to change
typedef int header_pack_func_t(Octstr *packed, Octstr *value);
to
typedef int header_pack_func_t(Octstr *packed, Octstr *value, int wsp_version);

And after that add this parameter to all packing functions.

Question: what to do with packing functions that doesn't need version
information at all (like wsp_pack_text())?

And for public packing functions (like the same wsp_pack_text) all calls for
these functions from other modules must be modified as well.

Second approach.
If we want to keep public functions untouched, we can do it, adding
to headerinfo structure additonal function like:
typedef int header_versioned_pack_func_t(Octstr *packed, Octstr *value, int 
wsp_version);

And than, if it is defined, call this function with wsp_version, else call
header_pack_func_t

What do you think?

-- 
Vjacheslav Chekushin                                mailto:[email protected]
Latvian Mobile Phone Company                        http://www.lmt.lv
VAS Technologies Division
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.