TLVs for different operators

"fred" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <012101c6892e$378c7290$64e0110a@FRED4>
different operators eg mblox, m-qube need different TLV parameters.
I really dislike maintaining a different version kannel for each,
Ideally if I had the time, this whole kannel be written in c++,then these issues are
taken care of by inheritance.

but as it is my solution is for example

#define TLV_NULTERMINATED(vendor, name, max_len)

eg
void smpp_pdu_dump(SMPP_PDU *pdu)
{
..............................
    #define TLV_NULTERMINATED(vendor, name, max_len) \
        if ((p->name._vendor ==_VENDOR_NA || p->name._vendor==g_vendorId ) && p->name._name != NULL) { \
   octstr_dump_short(p->name._name, 2, #name);\
        }
........................
in smpp_pdu.def there is like
.....
    TLV_NULTERMINATED(_VENDOR_MQUBE,mqube_carrierId, 45)
    TLV_NULTERMINATED(_VENDOR_MBLOX,mblox_operator,100)
    TLV_NULTERMINATED(_VENDOR_NA,receipted_message_id, 65)         << applicable to all vendors







so there is a global variable g_vendorId  which is configured.

In practice this is working out well I think.....

any comments please? bag it or whatever............. J
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.