Go to the source code of this file.
|
#define | PDU(name, docstring, fields, is_valid) name, |
|
#define | PDU(name, docstring, fields, is_valid) struct name { fields } name; |
|
#define | UINT(field, docstring, bits) unsigned long field; |
|
#define | UINTVAR(field, docstring) unsigned long field; |
|
#define | OCTSTR(field, docstring, lengthfield) Octstr *field; |
|
#define | REST(field, docstring) Octstr *field; |
|
#define | TYPE(bits, value) |
|
#define | RESERVED(bits) |
|
#define | TPI(confield) |
|
◆ OCTSTR
#define OCTSTR |
( |
|
field, |
|
|
|
docstring, |
|
|
|
lengthfield |
|
) |
| Octstr *field; |
◆ PDU [1/2]
#define PDU |
( |
|
name, |
|
|
|
docstring, |
|
|
|
fields, |
|
|
|
is_valid |
|
) |
| name, |
◆ PDU [2/2]
#define PDU |
( |
|
name, |
|
|
|
docstring, |
|
|
|
fields, |
|
|
|
is_valid |
|
) |
| struct name { fields } name; |
◆ RESERVED
◆ REST
#define REST |
( |
|
field, |
|
|
|
docstring |
|
) |
| Octstr *field; |
◆ TPI
◆ TYPE
#define TYPE |
( |
|
bits, |
|
|
|
value |
|
) |
| |
◆ UINT
#define UINT |
( |
|
field, |
|
|
|
docstring, |
|
|
|
bits |
|
) |
| unsigned long field; |
◆ UINTVAR
#define UINTVAR |
( |
|
field, |
|
|
|
docstring |
|
) |
| unsigned long field; |
◆ WTP_PDU
◆ WTP_TPI
◆ wtp_pdu_types
Definition at line 77 of file wtp_pdu.h.
78 #define PDU(name, docstring, fields, is_valid) name,
◆ wtp_pdu_append_tpi()
void wtp_pdu_append_tpi |
( |
WTP_PDU * |
pdu, |
|
|
int |
type, |
|
|
Octstr * |
data |
|
) |
| |
◆ wtp_pdu_create()
WTP_PDU* wtp_pdu_create |
( |
int |
type | ) |
|
Definition at line 67 of file wtp_pdu.c.
References wtp_pdu::options, wtp_pdu::type, type, and warning().
Referenced by wtp_pack_abort(), wtp_pack_ack(), wtp_pack_invoke(), wtp_pack_result(), wtp_pack_sar_ack(), and wtp_pack_sar_result().
70 pdu = gw_malloc(
sizeof(*pdu));
75 #define PDU(name, docstring, fields, is_valid) \ 77 struct name *p; p = &pdu->u.name; \ 80 #define UINT(field, docstring, bits) p->field = 0; 81 #define UINTVAR(field, docstring) p->field = 0; 82 #define OCTSTR(field, docstring, lengthfield) p->field = NULL; 83 #define REST(field, docstring) p->field = NULL; 84 #define TYPE(bits, value) 85 #define RESERVED(bits) 97 warning(0,
"Cannot create unknown WTP PDU type %d", pdu->
type);
void warning(int err, const char *fmt,...)
◆ wtp_pdu_destroy()
void wtp_pdu_destroy |
( |
WTP_PDU * |
pdu | ) |
|
Definition at line 104 of file wtp_pdu.c.
References gwlist_consume(), gwlist_destroy(), gwlist_len(), wtp_pdu::options, wtp_pdu::type, warning(), and wtp_tpi_destroy().
Referenced by main(), unpack_wdp_datagram_real(), wtp_pack_abort(), wtp_pack_ack(), wtp_pack_invoke(), wtp_pack_result(), wtp_pack_sar_ack(), and wtp_pack_sar_result().
109 #define PDU(name, docstring, fields, is_valid) \ 111 struct name *p; p = &pdu->u.name; \ 114 #define UINT(field, docstring, bits) 115 #define UINTVAR(field, docstring) 116 #define OCTSTR(field, docstring, lengthfield) octstr_destroy(p->field); 117 #define REST(field, docstring) octstr_destroy(p->field); 118 #define TYPE(bits, value) 119 #define RESERVED(bits) 120 #define TPI(confield) 131 warning(0,
"Cannot destroy unknown WTP PDU type %d", pdu->
type);
void wtp_tpi_destroy(WTP_TPI *p)
long gwlist_len(List *list)
void warning(int err, const char *fmt,...)
void * gwlist_consume(List *list)
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)
◆ wtp_pdu_dump()
void wtp_pdu_dump |
( |
WTP_PDU * |
pdu, |
|
|
int |
level |
|
) |
| |
Definition at line 446 of file wtp_pdu.c.
References debug(), and wtp_pdu::type.
Referenced by main().
447 char *dbg =
"wap.wtp";
450 #define PDU(name, docstring, fields, is_valid) \ 452 struct name *p = &pdu->u.name; \ 453 debug(dbg, 0, "%*sWTP %s PDU at %p:", \ 454 level, "", #name, (void *)pdu); \ 457 #define UINT(field, docstring, bits) \ 458 debug(dbg, 0, "%*s %s: %lu", level, "", docstring, p->field); 459 #define UINTVAR(field, docstring) \ 460 debug(dbg, 0, "%*s %s: %lu", level, "", docstring, p->field); 461 #define OCTSTR(field, docstring, lengthfield) \ 462 debug(dbg, 0, "%*s %s:", level, "", docstring); \ 463 octstr_dump(p->field, level + 1); 464 #define REST(field, docstring) \ 465 debug(dbg, 0, "%*s %s:", level, "", docstring); \ 466 octstr_dump(p->field, level + 1); 467 #define TYPE(bits, value) 468 #define RESERVED(bits) 469 #define TPI(confield) dump_tpis(pdu->options, level); 480 debug(dbg, 0,
"%*sWTP PDU at %p:", level,
"", (
void *)pdu);
481 debug(dbg, 0,
"%*s unknown type %u", level,
"", pdu->
type);
void debug(const char *place, int err, const char *fmt,...)
◆ wtp_pdu_pack()
Definition at line 388 of file wtp_pdu.c.
References fixup_length_fields(), octstr_create, panic, and wtp_pdu::type.
Referenced by main(), wtp_pack_abort(), wtp_pack_ack(), wtp_pack_invoke(), wtp_pack_result(), wtp_pack_sar_ack(), and wtp_pack_sar_result().
399 #define PDU(name, docstring, fields, is_valid) \ 401 struct name *p = &pdu->u.name; \ 403 gw_assert(bitpos % 8 == 0); \ 405 #define UINT(field, docstring, bits) \ 406 octstr_set_bits(data, bitpos, (bits), p->field); \ 408 #define UINTVAR(field, docstring) \ 409 gw_assert(bitpos % 8 == 0); \ 410 octstr_append_uintvar(data, p->field); \ 411 bitpos = 8 * octstr_len(data); 412 #define OCTSTR(field, docstring, lengthfield) \ 413 gw_assert(bitpos % 8 == 0); \ 414 if (p->field != NULL) \ 415 octstr_append(data, p->field); \ 416 bitpos += 8 * octstr_len(p->field); 417 #define REST(field, docstring) \ 418 gw_assert(bitpos % 8 == 0); \ 419 if (p->field != NULL) \ 420 octstr_append(data, p->field); \ 421 bitpos += 8 * octstr_len(p->field); 422 #define TYPE(bits, value) \ 423 octstr_set_bits(data, bitpos, (bits), (value)); \ 425 #define RESERVED(bits) bitpos += (bits); 426 #define TPI(confield) \ 428 bitpos = pack_tpis(data, bitpos, pdu->options); \ 440 panic(0,
"Packing unknown WTP PDU type %ld", (
long) pdu->
type);
static void fixup_length_fields(WTP_PDU *pdu)
#define octstr_create(cstr)
◆ wtp_pdu_unpack()
Definition at line 284 of file wtp_pdu.c.
References gw_assert(), wtp_pdu::options, wtp_pdu::type, warning(), and wtp_pdu_type().
Referenced by main(), and unpack_wdp_datagram_real().
290 pdu = gw_malloc(
sizeof(*pdu));
296 #define PDU(name, docstring, fields, is_valid) \ 298 struct name *p = &pdu->u.name; \ 300 gw_assert(bitpos % 8 == 0); \ 301 if (bitpos / 8 != octstr_len(data)) { \ 302 warning(0, "Bad length for " #name " PDU, " \ 303 "expected %ld", bitpos / 8); \ 306 warning(0, #name " PDU failed %s", #is_valid); \ 310 #define UINT(field, docstring, bits) \ 311 p->field = octstr_get_bits(data, bitpos, (bits)); \ 313 #define UINTVAR(field, docstring) \ 314 gw_assert(bitpos % 8 == 0); \ 315 p->field = octstr_get_bits(data, bitpos + 1, 7); \ 316 while (octstr_get_bits(data, bitpos, 1)) { \ 319 p->field |= octstr_get_bits(data, bitpos + 1, 7); \ 322 #define OCTSTR(field, docstring, lengthfield) \ 323 gw_assert(bitpos % 8 == 0); \ 324 p->field = octstr_copy(data, bitpos / 8, p->lengthfield); \ 325 bitpos += 8 * p->lengthfield; 326 #define REST(field, docstring) \ 327 gw_assert(bitpos % 8 == 0); \ 328 if (bitpos / 8 <= octstr_len(data)) { \ 329 p->field = octstr_copy(data, bitpos / 8, \ 330 octstr_len(data) - bitpos / 8); \ 331 bitpos = octstr_len(data) * 8; \ 333 p->field = octstr_create(""); \ 335 #define TYPE(bits, value) bitpos += (bits); 336 #define RESERVED(bits) bitpos += (bits); 337 #define TPI(confield) \ 339 pdu->options = gwlist_create(); \ 340 bitpos = unpack_tpis(data, bitpos, pdu); \ 352 warning(0,
"WTP PDU with unknown type %d", pdu->
type);
gw_assert(wtls_machine->packet_to_send !=NULL)
static int wtp_pdu_type(Octstr *data)
void warning(int err, const char *fmt,...)
◆ wtp_tpi_destroy()
void wtp_tpi_destroy |
( |
WTP_TPI * |
tpi | ) |
|