X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/577621026df8d4a33a34d4e125f9ec964fc0e53c..32d1d15c5412b3a708ae2b45ed2016bdab9bb58b:/print-lmp.c diff --git a/print-lmp.c b/print-lmp.c index d8d9540e..94cb934c 100644 --- a/print-lmp.c +++ b/print-lmp.c @@ -44,15 +44,15 @@ */ struct lmp_common_header { - uint8_t version_res[2]; - uint8_t flags; - uint8_t msg_type; - uint8_t length[2]; - uint8_t reserved[2]; + nd_uint16_t version_res; + nd_uint8_t flags; + nd_uint8_t msg_type; + nd_uint16_t length; + nd_byte reserved[2]; }; #define LMP_VERSION 1 -#define LMP_EXTRACT_VERSION(x) (((x)&0xf0)>>4) +#define LMP_EXTRACT_VERSION(x) (((x)&0xf000)>>12) static const struct tok lmp_header_flag_values[] = { { 0x01, "Control Channel Down"}, @@ -214,9 +214,9 @@ static const struct tok lmp_msg_type_values[] = { */ struct lmp_object_header { - uint8_t ctype; - uint8_t class_num; - uint8_t length[2]; + nd_uint8_t ctype; + nd_uint8_t class_num; + nd_uint16_t length; }; #define LMP_OBJ_CC_ID 1 @@ -367,8 +367,8 @@ lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr, } bw; while (total_subobj_len > 0 && hexdump == FALSE ) { - subobj_type = EXTRACT_8BITS(obj_tptr + offset); - subobj_len = EXTRACT_8BITS(obj_tptr + offset + 1); + subobj_type = EXTRACT_U_1(obj_tptr + offset); + subobj_len = EXTRACT_U_1(obj_tptr + offset + 1); ND_PRINT((ndo, "\n\t Subobject, Type: %s (%u), Length: %u", tok2str(lmp_data_link_subobj, "Unknown", @@ -392,23 +392,23 @@ lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr, ND_PRINT((ndo, "\n\t Switching Type: %s (%u)", tok2str(gmpls_switch_cap_values, "Unknown", - EXTRACT_8BITS(obj_tptr + offset + 2)), - EXTRACT_8BITS(obj_tptr + offset + 2))); + EXTRACT_U_1(obj_tptr + offset + 2)), + EXTRACT_U_1(obj_tptr + offset + 2))); ND_PRINT((ndo, "\n\t Encoding Type: %s (%u)", tok2str(gmpls_encoding_values, "Unknown", - EXTRACT_8BITS(obj_tptr + offset + 3)), - EXTRACT_8BITS(obj_tptr + offset + 3))); - bw.i = EXTRACT_BE_32BITS(obj_tptr + offset + 4); + EXTRACT_U_1(obj_tptr + offset + 3)), + EXTRACT_U_1(obj_tptr + offset + 3))); + bw.i = EXTRACT_BE_U_4(obj_tptr + offset + 4); ND_PRINT((ndo, "\n\t Min Reservable Bandwidth: %.3f Mbps", bw.f*8/1000000)); - bw.i = EXTRACT_BE_32BITS(obj_tptr + offset + 8); + bw.i = EXTRACT_BE_U_4(obj_tptr + offset + 8); ND_PRINT((ndo, "\n\t Max Reservable Bandwidth: %.3f Mbps", bw.f*8/1000000)); break; case WAVELENGTH_SUBOBJ: ND_PRINT((ndo, "\n\t Wavelength: %u", - EXTRACT_BE_32BITS(obj_tptr + offset + 4))); + EXTRACT_BE_U_4(obj_tptr + offset + 4))); break; default: /* Any Unknown Subobject ==> Exit loop */ @@ -423,12 +423,12 @@ lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr, void lmp_print(netdissect_options *ndo, - register const u_char *pptr, register u_int len) + const u_char *pptr, u_int len) { const struct lmp_common_header *lmp_com_header; const struct lmp_object_header *lmp_obj_header; const u_char *tptr,*obj_tptr; - u_int tlen,lmp_obj_len,lmp_obj_ctype,obj_tlen; + u_int version_res, tlen, lmp_obj_len, lmp_obj_ctype, obj_tlen; int hexdump; u_int offset; u_int link_type; @@ -442,32 +442,34 @@ lmp_print(netdissect_options *ndo, lmp_com_header = (const struct lmp_common_header *)pptr; ND_TCHECK(*lmp_com_header); + version_res = EXTRACT_BE_U_2(lmp_com_header->version_res); + /* * Sanity checking of the header. */ - if (LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]) != LMP_VERSION) { + if (LMP_EXTRACT_VERSION(version_res) != LMP_VERSION) { ND_PRINT((ndo, "LMP version %u packet not supported", - LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]))); + LMP_EXTRACT_VERSION(version_res))); return; } /* in non-verbose mode just lets print the basic Message Type*/ if (ndo->ndo_vflag < 1) { ND_PRINT((ndo, "LMPv%u %s Message, length: %u", - LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]), - tok2str(lmp_msg_type_values, "unknown (%u)",lmp_com_header->msg_type), + LMP_EXTRACT_VERSION(version_res), + tok2str(lmp_msg_type_values, "unknown (%u)",EXTRACT_U_1(lmp_com_header->msg_type)), len)); return; } /* ok they seem to want to know everything - lets fully decode it */ - tlen=EXTRACT_BE_16BITS(lmp_com_header->length); + tlen=EXTRACT_BE_U_2(lmp_com_header->length); ND_PRINT((ndo, "\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u", - LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]), - tok2str(lmp_msg_type_values, "unknown, type: %u",lmp_com_header->msg_type), - bittok2str(lmp_header_flag_values,"none",lmp_com_header->flags), + LMP_EXTRACT_VERSION(version_res), + tok2str(lmp_msg_type_values, "unknown, type: %u",EXTRACT_U_1(lmp_com_header->msg_type)), + bittok2str(lmp_header_flag_values,"none",EXTRACT_U_1(lmp_com_header->flags)), tlen)); if (tlen < sizeof(struct lmp_common_header)) { ND_PRINT((ndo, " (too short)")); @@ -483,22 +485,22 @@ lmp_print(netdissect_options *ndo, while(tlen>0) { /* did we capture enough for fully decoding the object header ? */ - ND_TCHECK2(*tptr, sizeof(struct lmp_object_header)); + ND_TCHECK_LEN(tptr, sizeof(struct lmp_object_header)); lmp_obj_header = (const struct lmp_object_header *)tptr; - lmp_obj_len=EXTRACT_BE_16BITS(lmp_obj_header->length); - lmp_obj_ctype=(lmp_obj_header->ctype)&0x7f; + lmp_obj_len=EXTRACT_BE_U_2(lmp_obj_header->length); + lmp_obj_ctype=EXTRACT_U_1(lmp_obj_header->ctype)&0x7f; ND_PRINT((ndo, "\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u", tok2str(lmp_obj_values, "Unknown", - lmp_obj_header->class_num), - lmp_obj_header->class_num, + EXTRACT_U_1(lmp_obj_header->class_num)), + EXTRACT_U_1(lmp_obj_header->class_num), tok2str(lmp_ctype_values, "Unknown", - ((lmp_obj_header->class_num)<<8)+lmp_obj_ctype), + (EXTRACT_U_1(lmp_obj_header->class_num)<<8)+lmp_obj_ctype), lmp_obj_ctype, - (lmp_obj_header->ctype)&0x80 ? "" : "non-", + EXTRACT_U_1(lmp_obj_header->ctype)&0x80 ? "" : "non-", lmp_obj_len)); if (lmp_obj_len < 4) { @@ -514,10 +516,10 @@ lmp_print(netdissect_options *ndo, obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header); /* did we capture enough for fully decoding the object ? */ - ND_TCHECK2(*tptr, lmp_obj_len); + ND_TCHECK_LEN(tptr, lmp_obj_len); hexdump=FALSE; - switch(lmp_obj_header->class_num) { + switch(EXTRACT_U_1(lmp_obj_header->class_num)) { case LMP_OBJ_CC_ID: switch(lmp_obj_ctype) { @@ -528,8 +530,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Control Channel ID: %u (0x%08x)", - EXTRACT_BE_32BITS(obj_tptr), - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_4(obj_tptr))); break; default: @@ -548,7 +550,7 @@ lmp_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t IPv4 Link ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr), - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr))); break; case LMP_CTYPE_IPV6_LOC: case LMP_CTYPE_IPV6_RMT: @@ -558,7 +560,7 @@ lmp_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t IPv6 Link ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr), - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr))); break; case LMP_CTYPE_UNMD_LOC: case LMP_CTYPE_UNMD_RMT: @@ -567,8 +569,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Link ID: %u (0x%08x)", - EXTRACT_BE_32BITS(obj_tptr), - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_4(obj_tptr))); break; default: hexdump=TRUE; @@ -583,8 +585,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Message ID: %u (0x%08x)", - EXTRACT_BE_32BITS(obj_tptr), - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_4(obj_tptr))); break; case LMP_CTYPE_2: if (obj_tlen != 4) { @@ -592,8 +594,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Message ID Ack: %u (0x%08x)", - EXTRACT_BE_32BITS(obj_tptr), - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_4(obj_tptr))); break; default: hexdump=TRUE; @@ -610,7 +612,7 @@ lmp_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t Node ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr), - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr))); break; default: @@ -626,8 +628,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Hello Interval: %u\n\t Hello Dead Interval: %u", - EXTRACT_BE_16BITS(obj_tptr), - EXTRACT_BE_16BITS(obj_tptr + 2))); + EXTRACT_BE_U_2(obj_tptr), + EXTRACT_BE_U_2(obj_tptr + 2))); break; default: @@ -643,8 +645,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Tx Seq: %u, Rx Seq: %u", - EXTRACT_BE_32BITS(obj_tptr), - EXTRACT_BE_32BITS(obj_tptr + 4))); + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_4(obj_tptr + 4))); break; default: @@ -662,14 +664,14 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: [%s]", bittok2str(lmp_obj_te_link_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)" "\n\t Remote Link-ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+4), - EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 4), ipaddr_string(ndo, obj_tptr+8), - EXTRACT_BE_32BITS(obj_tptr + 8))); + EXTRACT_BE_U_4(obj_tptr + 8))); break; case LMP_CTYPE_IPV6: @@ -680,14 +682,14 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: [%s]", bittok2str(lmp_obj_te_link_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)" "\n\t Remote Link-ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr+4), - EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 4), ip6addr_string(ndo, obj_tptr+20), - EXTRACT_BE_32BITS(obj_tptr + 20))); + EXTRACT_BE_U_4(obj_tptr + 20))); break; case LMP_CTYPE_UNMD: @@ -698,14 +700,14 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: [%s]", bittok2str(lmp_obj_te_link_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); ND_PRINT((ndo, "\n\t Local Link-ID: %u (0x%08x)" "\n\t Remote Link-ID: %u (0x%08x)", - EXTRACT_BE_32BITS(obj_tptr + 4), - EXTRACT_BE_32BITS(obj_tptr + 4), - EXTRACT_BE_32BITS(obj_tptr + 8), - EXTRACT_BE_32BITS(obj_tptr + 8))); + EXTRACT_BE_U_4(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 8), + EXTRACT_BE_U_4(obj_tptr + 8))); break; default: @@ -723,13 +725,13 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: [%s]", bittok2str(lmp_obj_data_link_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)" "\n\t Remote Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+4), - EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 4), ipaddr_string(ndo, obj_tptr+8), - EXTRACT_BE_32BITS(obj_tptr + 8))); + EXTRACT_BE_U_4(obj_tptr + 8))); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12)) hexdump=TRUE; @@ -743,13 +745,13 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: [%s]", bittok2str(lmp_obj_data_link_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)" "\n\t Remote Interface ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr+4), - EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 4), ip6addr_string(ndo, obj_tptr+20), - EXTRACT_BE_32BITS(obj_tptr + 20))); + EXTRACT_BE_U_4(obj_tptr + 20))); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 36, 36)) hexdump=TRUE; @@ -763,13 +765,13 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: [%s]", bittok2str(lmp_obj_data_link_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); ND_PRINT((ndo, "\n\t Local Interface ID: %u (0x%08x)" "\n\t Remote Interface ID: %u (0x%08x)", - EXTRACT_BE_32BITS(obj_tptr + 4), - EXTRACT_BE_32BITS(obj_tptr + 4), - EXTRACT_BE_32BITS(obj_tptr + 8), - EXTRACT_BE_32BITS(obj_tptr + 8))); + EXTRACT_BE_U_4(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 8), + EXTRACT_BE_U_4(obj_tptr + 8))); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12)) hexdump=TRUE; @@ -790,21 +792,21 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: %s", bittok2str(lmp_obj_begin_verify_flag_values, "none", - EXTRACT_BE_16BITS(obj_tptr)))); + EXTRACT_BE_U_2(obj_tptr)))); ND_PRINT((ndo, "\n\t Verify Interval: %u", - EXTRACT_BE_16BITS(obj_tptr + 2))); + EXTRACT_BE_U_2(obj_tptr + 2))); ND_PRINT((ndo, "\n\t Data links: %u", - EXTRACT_BE_32BITS(obj_tptr + 4))); + EXTRACT_BE_U_4(obj_tptr + 4))); ND_PRINT((ndo, "\n\t Encoding type: %s", - tok2str(gmpls_encoding_values, "Unknown", *(obj_tptr+8)))); + tok2str(gmpls_encoding_values, "Unknown", EXTRACT_U_1((obj_tptr + 8))))); ND_PRINT((ndo, "\n\t Verify Transport Mechanism: %u (0x%x)%s", - EXTRACT_BE_16BITS(obj_tptr + 10), - EXTRACT_BE_16BITS(obj_tptr + 10), - EXTRACT_BE_16BITS(obj_tptr + 10)&8000 ? " (Payload test messages capable)" : "")); - bw.i = EXTRACT_BE_32BITS(obj_tptr + 12); + EXTRACT_BE_U_2(obj_tptr + 10), + EXTRACT_BE_U_2(obj_tptr + 10), + EXTRACT_BE_U_2(obj_tptr + 10)&8000 ? " (Payload test messages capable)" : "")); + bw.i = EXTRACT_BE_U_4(obj_tptr + 12); ND_PRINT((ndo, "\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000)); ND_PRINT((ndo, "\n\t Wavelength: %u", - EXTRACT_BE_32BITS(obj_tptr + 16))); + EXTRACT_BE_U_4(obj_tptr + 16))); break; default: @@ -821,8 +823,8 @@ lmp_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t Verify Dead Interval: %u" "\n\t Verify Transport Response: %u", - EXTRACT_BE_16BITS(obj_tptr), - EXTRACT_BE_16BITS(obj_tptr + 2))); + EXTRACT_BE_U_2(obj_tptr), + EXTRACT_BE_U_2(obj_tptr + 2))); break; default: @@ -838,7 +840,7 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Verify ID: %u", - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr))); break; default: @@ -854,23 +856,23 @@ lmp_print(netdissect_options *ndo, while (offset+8 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+offset), - EXTRACT_BE_32BITS(obj_tptr + offset))); + EXTRACT_BE_U_4(obj_tptr + offset))); ND_PRINT((ndo, "\n\t\t Active: %s (%u)", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31) ? + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31) ? "Allocated" : "Non-allocated", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31))); + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31))); ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1 ? + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ? "Transmit" : "Receive", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1)); + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1)); ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF), - EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF)); + EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF), + EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF)); offset+=8; } break; @@ -881,23 +883,23 @@ lmp_print(netdissect_options *ndo, while (offset+20 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr+offset), - EXTRACT_BE_32BITS(obj_tptr + offset))); + EXTRACT_BE_U_4(obj_tptr + offset))); ND_PRINT((ndo, "\n\t\t Active: %s (%u)", - (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>31) ? + (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>31) ? "Allocated" : "Non-allocated", - (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>31))); + (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>31))); ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", - (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>30)&0x1 ? + (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>30)&0x1 ? "Transmit" : "Receive", - (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>30)&0x1)); + (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>30)&0x1)); ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_BE_32BITS(obj_tptr + offset + 16)&0x3FFFFFF), - EXTRACT_BE_32BITS(obj_tptr + offset + 16)&0x3FFFFFF)); + EXTRACT_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF), + EXTRACT_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF)); offset+=20; } break; @@ -907,24 +909,24 @@ lmp_print(netdissect_options *ndo, /* Decode pairs: */ while (offset+8 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)", - EXTRACT_BE_32BITS(obj_tptr + offset), - EXTRACT_BE_32BITS(obj_tptr + offset))); + EXTRACT_BE_U_4(obj_tptr + offset), + EXTRACT_BE_U_4(obj_tptr + offset))); ND_PRINT((ndo, "\n\t\t Active: %s (%u)", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31) ? + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31) ? "Allocated" : "Non-allocated", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31))); + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31))); ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1 ? + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ? "Transmit" : "Receive", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1)); + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1)); ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF), - EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF)); + EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF), + EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF)); offset+=8; } break; @@ -941,7 +943,7 @@ lmp_print(netdissect_options *ndo, while (offset+4 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+offset), - EXTRACT_BE_32BITS(obj_tptr + offset))); + EXTRACT_BE_U_4(obj_tptr + offset))); offset+=4; } break; @@ -951,7 +953,7 @@ lmp_print(netdissect_options *ndo, while (offset+16 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr+offset), - EXTRACT_BE_32BITS(obj_tptr + offset))); + EXTRACT_BE_U_4(obj_tptr + offset))); offset+=16; } break; @@ -960,8 +962,8 @@ lmp_print(netdissect_options *ndo, offset = 0; while (offset+4 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)", - EXTRACT_BE_32BITS(obj_tptr + offset), - EXTRACT_BE_32BITS(obj_tptr + offset))); + EXTRACT_BE_U_4(obj_tptr + offset), + EXTRACT_BE_U_4(obj_tptr + offset))); offset+=4; } break; @@ -981,7 +983,7 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Error Code: %s", bittok2str(lmp_obj_begin_verify_error_values, "none", - EXTRACT_BE_32BITS(obj_tptr)))); + EXTRACT_BE_U_4(obj_tptr)))); break; case LMP_CTYPE_LINK_SUMMARY_ERROR: @@ -992,7 +994,7 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Error Code: %s", bittok2str(lmp_obj_link_summary_error_values, "none", - EXTRACT_BE_32BITS(obj_tptr)))); + EXTRACT_BE_U_4(obj_tptr)))); break; default: hexdump=TRUE; @@ -1009,10 +1011,10 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: %s", bittok2str(lmp_obj_service_config_sp_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); ND_PRINT((ndo, "\n\t UNI Version: %u", - EXTRACT_8BITS(obj_tptr + 1))); + EXTRACT_U_1(obj_tptr + 1))); break; @@ -1022,7 +1024,7 @@ lmp_print(netdissect_options *ndo, break; } - link_type = EXTRACT_8BITS(obj_tptr); + link_type = EXTRACT_U_1(obj_tptr); ND_PRINT((ndo, "\n\t Link Type: %s (%u)", tok2str(lmp_sd_service_config_cpsa_link_type_values, @@ -1034,44 +1036,44 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Signal Type: %s (%u)", tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values, "Unknown", - EXTRACT_8BITS(obj_tptr + 1)), - EXTRACT_8BITS(obj_tptr + 1))); + EXTRACT_U_1(obj_tptr + 1)), + EXTRACT_U_1(obj_tptr + 1))); break; case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET: ND_PRINT((ndo, "\n\t Signal Type: %s (%u)", tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values, "Unknown", - EXTRACT_8BITS(obj_tptr + 1)), - EXTRACT_8BITS(obj_tptr + 1))); + EXTRACT_U_1(obj_tptr + 1)), + EXTRACT_U_1(obj_tptr + 1))); break; } ND_PRINT((ndo, "\n\t Transparency: %s", bittok2str(lmp_obj_service_config_cpsa_tp_flag_values, "none", - EXTRACT_8BITS(obj_tptr + 2)))); + EXTRACT_U_1(obj_tptr + 2)))); ND_PRINT((ndo, "\n\t Contiguous Concatenation Types: %s", bittok2str(lmp_obj_service_config_cpsa_cct_flag_values, "none", - EXTRACT_8BITS(obj_tptr + 3)))); + EXTRACT_U_1(obj_tptr + 3)))); ND_PRINT((ndo, "\n\t Minimum NCC: %u", - EXTRACT_BE_16BITS(obj_tptr + 4))); + EXTRACT_BE_U_2(obj_tptr + 4))); ND_PRINT((ndo, "\n\t Maximum NCC: %u", - EXTRACT_BE_16BITS(obj_tptr + 6))); + EXTRACT_BE_U_2(obj_tptr + 6))); ND_PRINT((ndo, "\n\t Minimum NVC:%u", - EXTRACT_BE_16BITS(obj_tptr + 8))); + EXTRACT_BE_U_2(obj_tptr + 8))); ND_PRINT((ndo, "\n\t Maximum NVC:%u", - EXTRACT_BE_16BITS(obj_tptr + 10))); + EXTRACT_BE_U_2(obj_tptr + 10))); ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+12), - EXTRACT_BE_32BITS(obj_tptr + 12))); + EXTRACT_BE_U_4(obj_tptr + 12))); break; @@ -1085,13 +1087,13 @@ lmp_print(netdissect_options *ndo, bittok2str( lmp_obj_service_config_nsa_transparency_flag_values, "none", - EXTRACT_BE_32BITS(obj_tptr)))); + EXTRACT_BE_U_4(obj_tptr)))); ND_PRINT((ndo, "\n\t TCM Monitoring Flags: %s", bittok2str( lmp_obj_service_config_nsa_tcm_flag_values, "none", - EXTRACT_8BITS(obj_tptr + 7)))); + EXTRACT_U_1(obj_tptr + 7)))); break; @@ -1105,7 +1107,7 @@ lmp_print(netdissect_options *ndo, bittok2str( lmp_obj_service_config_nsa_network_diversity_flag_values, "none", - EXTRACT_8BITS(obj_tptr + 3)))); + EXTRACT_U_1(obj_tptr + 3)))); break; default: