hi,
 
here is one issue that stopped me today:
 
sometimes l3 message headers includes protocol header: see struct gsm48_imm_ass
and sometimes it is just the information element part: see struct gsm48_loc_upd_req
 
since i work with layer 3 messages, i need a uniform way to define these headers. i will add new headers for messages i implement to gsm_04_08.h.
 
therefore i need a decision. i prefer that the headers (like gsm48_imm_ass or gsm48_loc_upd_req) consists of the information elements parts only. i must put gsm48_hdr in front of it whenever i create a l3 message. when parsing that message, i must skip the information element part in the decoding function. when creating the message, i always add the l3 header (with it's content) and the information elements.
 
creation would look like this
        struct msgb *msg = gsm48_msgb_alloc();
        struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
        struct gsm48_imm_ass *ia = (struct gsm48_imm_ass *) msgb_put(msg, sizeof(*ia))
;
 
        gh->protocol = ....
        gh->msg_type = ....
 
 
parsing would look like this:
 
        struct gsm48_hdr *gh = msgb_l3(msg);
        struct gsm48_imm_ass *ia = gh->data;
        unsigned int payload_len = msgb_l3len(msg) - sizeof(*gh) - sizeof(ia);
 
        tlv_parse(&tp, &rsl_att_tlvdef, ia->data, payload_len, 0, 0);
 
note: payload_len is where the TLV part of the information elements start.

 
any suggestions?
 
 
andreas