Harrie Hazewinkel wrote: > > Hm, I am not so in favour of doing length definitions this hardcoded > way. But it seems, that many thing get all the time done via > MACROs and depending on the use the marco results in different code. > > This is more coding style, I guess.
I think Lars has made a real great job in defining thing in this .def macro style way. I admit it's a bit hard to understand what the code/macros do(es), but when you got this, it's great to see how easy PDU creation can be done. > > RCS file: /home/cvs/gateway/gw/smsc/smpp_pdu.c,v > > retrieving revision 1.1 > > diff -r1.1 smpp_pdu.c > > 136,138c136,147 > > < gw_assert(octstr_len(p->name) < max_octets); \ > > < if (p->name != NULL) octstr_append(os, p->name); \ > > < octstr_append_char(os, '\0'); > > --- > >> if (p->name != NULL) { \ > >> if (octstr_len(p->name) >= max_octets) { \ > >> warning(0, "SMPP: PDU element <%s> to long " \ > >> "(length is %d, 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'); > > This also means that you ignore the address part which goes beyond the > maximum length. Somehow, this feels not right, or do I miss something?? Hmmm, yes, but this is a semantical question I guess. If the address exceeds the specified maximum length, you only have to choices I guess a) ignore the PDU itself, which is not feasable in our inter-box communication environment, because bearerbox is unable to tell smsbox about such an problem of the given &from and &to variables. b) cut the Octstrs to the max. specified length and leave the problem to the user itself not to send to large data for the field. Stipe [EMAIL PROTECTED] ------------------------------------------------------------------- Wapme Systems AG Vogelsanger Weg 80 40470 Düsseldorf Tel: +49-211-74845-0 Fax: +49-211-74845-299 E-Mail: [EMAIL PROTECTED] Internet: http://www.wapme-systems.de ------------------------------------------------------------------- wapme.net - wherever you are