Re: Fw: Help with setting sm_length!

Yury Mikhienko <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Mobicom-Kavkaz
Message-ID <[email protected]>
On Mon, 14 Apr 2003 14:07:41 +0200
Alexander Malysh <[email protected]> wrote:

> cc-ing list please..
> 
> Am Montag, 14. April 2003 14:33 schrieb Yury Mikhienko:
> > On Mon, 14 Apr 2003 13:37:47 +0200
> >
> > Alexander Malysh <[email protected]> wrote:
> > > As I said , It is not a bug in kannel ... this is bug in smsc ...
> > > just contact your operator, sorry...
> > >
> > > if you want to write workaround for this (I believe that will not be
> > > accepted in official kannel cvs) then look in smpp_pdu_pack funtion and
> > > fix this for you (smpp_pdu.c line ~135).
> >
> > Do you send me real point (snip the code) where the  smpp_pdu_pack funtion
> > set the sm_length parameter ? (in my smpp_pdu.c I shift the code after
> > insert into smpp_pdu.c future to using the its_session_info optional
> > parameter)
> >
> > Thanks!
> 
> just search for p->field_given_octets in smpp_pdu_pack function...
> 
> Good luck...
> 

May be I'm stupib, but in smpp_pdu_pack function I dont see the point of calculating size of message and placing value into sm_length.
In my opinion, sm_length is the INTEGER field in pdu.submit_sm structure, and I found defenition length of fields and packing into PDU only:
...
    switch (pdu->type) {
    #define OPTIONAL_BEGIN(num_expected)
    #define TLV(tag_id, min_len, max_len)
    #define OPTIONAL_END
    #define INTEGER(name, octets) p = *(&p);
    #define NULTERMINATED(name, max_octets) p = *(&p);
    #define OCTETS(name, field_giving_octets) \
        p->field_giving_octets = octstr_len(p->name);          //<----------- this is definition  length of OCTETS only, not initializing INTEGER(sm_length,1) field. Right?
    #define PDU(name, id, fields) \
        case id: { struct name *p = &pdu->u.name; fields } break;
    #include "smpp_pdu.def"
    default:
        error(0, "Unknown SMPP_PDU type, internal error while packing.");
    }
...

    #define OPTIONAL_END
    #define INTEGER(name, octets)                             \
        append_encoded_integer(os, p->name, octets);     //<-------------- in this section, the INTEGER(sm_length,1) field stored in PDU and have the value==length of OCTETS(name, field_giving_octets)
    #define NULTERMINATED(name, max_octets) \
        gw_assert(octstr_len(p->name) < max_octets); \
        if (p->name != NULL) { \
            if (octstr_len(p->name) >= max_octets) { \
                warning(0, "SMPP: PDU element <%s> to long " \
                        "(length is %ld, should be %d)", \
                        #name, octstr_len(p->name), max_octets); \
                temp = octstr_copy(p->name, 0, max_octets-1); \
            } else \
                temp = octstr_duplicate(p->name); \
            octstr_append(os, temp); \
            octstr_destroy(temp); \
        } \
        octstr_append_char(os, '\0');
    #define OCTETS(name, field_giving_octets) \
        octstr_append(os, p->name);
    #define PDU(name, id, fields) \
        case id: { struct name *p = &pdu->u.name; fields } break;
    #include "smpp_pdu.def"
    default:
        error(0, "Unknown SMPP_PDU type, internal error while packing.");
    }
....

WHERE the  INTEGER(sm_length,1) field calculated???



-- 
 
Best regards,
Yury Mikhienko.
IT engineer, ZAO "Mobicom-Kavkaz"
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.