diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2017-11-18 11:52:52 +0100 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2017-11-18 13:56:40 +0100 |
commit | 577621026df8d4a33a34d4e125f9ec964fc0e53c (patch) | |
tree | a25ed4b22461cbb115c9e112935c28bcd57406bc /print-lmp.c | |
parent | 0e854b0937199956478686ae610ff9f794aafc6b (diff) | |
download | tcpdump-577621026df8d4a33a34d4e125f9ec964fc0e53c.tar.gz |
Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()
It indicates clearly that these macros are used to extract big-endian
integral values.
Diffstat (limited to 'print-lmp.c')
-rw-r--r-- | print-lmp.c | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/print-lmp.c b/print-lmp.c index 5b7c0344..d8d9540e 100644 --- a/print-lmp.c +++ b/print-lmp.c @@ -399,16 +399,16 @@ lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr, "Unknown", EXTRACT_8BITS(obj_tptr + offset + 3)), EXTRACT_8BITS(obj_tptr + offset + 3))); - bw.i = EXTRACT_32BITS(obj_tptr+offset+4); + bw.i = EXTRACT_BE_32BITS(obj_tptr + offset + 4); ND_PRINT((ndo, "\n\t Min Reservable Bandwidth: %.3f Mbps", bw.f*8/1000000)); - bw.i = EXTRACT_32BITS(obj_tptr+offset+8); + bw.i = EXTRACT_BE_32BITS(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_32BITS(obj_tptr+offset+4))); + EXTRACT_BE_32BITS(obj_tptr + offset + 4))); break; default: /* Any Unknown Subobject ==> Exit loop */ @@ -462,7 +462,7 @@ lmp_print(netdissect_options *ndo, /* ok they seem to want to know everything - lets fully decode it */ - tlen=EXTRACT_16BITS(lmp_com_header->length); + tlen=EXTRACT_BE_16BITS(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]), @@ -486,7 +486,7 @@ lmp_print(netdissect_options *ndo, ND_TCHECK2(*tptr, sizeof(struct lmp_object_header)); lmp_obj_header = (const struct lmp_object_header *)tptr; - lmp_obj_len=EXTRACT_16BITS(lmp_obj_header->length); + lmp_obj_len=EXTRACT_BE_16BITS(lmp_obj_header->length); lmp_obj_ctype=(lmp_obj_header->ctype)&0x7f; ND_PRINT((ndo, "\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u", @@ -528,8 +528,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Control Channel ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr))); break; default: @@ -548,7 +548,7 @@ lmp_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t IPv4 Link ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr))); break; case LMP_CTYPE_IPV6_LOC: case LMP_CTYPE_IPV6_RMT: @@ -558,7 +558,7 @@ lmp_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t IPv6 Link ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr))); break; case LMP_CTYPE_UNMD_LOC: case LMP_CTYPE_UNMD_RMT: @@ -567,8 +567,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Link ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr))); break; default: hexdump=TRUE; @@ -583,8 +583,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Message ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr))); break; case LMP_CTYPE_2: if (obj_tlen != 4) { @@ -592,8 +592,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Message ID Ack: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr))); break; default: hexdump=TRUE; @@ -610,7 +610,7 @@ lmp_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t Node ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr))); break; default: @@ -626,8 +626,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Hello Interval: %u\n\t Hello Dead Interval: %u", - EXTRACT_16BITS(obj_tptr), - EXTRACT_16BITS(obj_tptr+2))); + EXTRACT_BE_16BITS(obj_tptr), + EXTRACT_BE_16BITS(obj_tptr + 2))); break; default: @@ -643,8 +643,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Tx Seq: %u, Rx Seq: %u", - EXTRACT_32BITS(obj_tptr), - EXTRACT_32BITS(obj_tptr+4))); + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr + 4))); break; default: @@ -667,9 +667,9 @@ lmp_print(netdissect_options *ndo, 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_32BITS(obj_tptr+4), + EXTRACT_BE_32BITS(obj_tptr + 4), ipaddr_string(ndo, obj_tptr+8), - EXTRACT_32BITS(obj_tptr+8))); + EXTRACT_BE_32BITS(obj_tptr + 8))); break; case LMP_CTYPE_IPV6: @@ -685,9 +685,9 @@ lmp_print(netdissect_options *ndo, 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_32BITS(obj_tptr+4), + EXTRACT_BE_32BITS(obj_tptr + 4), ip6addr_string(ndo, obj_tptr+20), - EXTRACT_32BITS(obj_tptr+20))); + EXTRACT_BE_32BITS(obj_tptr + 20))); break; case LMP_CTYPE_UNMD: @@ -702,10 +702,10 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Local Link-ID: %u (0x%08x)" "\n\t Remote Link-ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr+4), - EXTRACT_32BITS(obj_tptr+4), - EXTRACT_32BITS(obj_tptr+8), - EXTRACT_32BITS(obj_tptr+8))); + EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_32BITS(obj_tptr + 8), + EXTRACT_BE_32BITS(obj_tptr + 8))); break; default: @@ -727,9 +727,9 @@ lmp_print(netdissect_options *ndo, 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_32BITS(obj_tptr+4), + EXTRACT_BE_32BITS(obj_tptr + 4), ipaddr_string(ndo, obj_tptr+8), - EXTRACT_32BITS(obj_tptr+8))); + EXTRACT_BE_32BITS(obj_tptr + 8))); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12)) hexdump=TRUE; @@ -747,9 +747,9 @@ lmp_print(netdissect_options *ndo, 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_32BITS(obj_tptr+4), + EXTRACT_BE_32BITS(obj_tptr + 4), ip6addr_string(ndo, obj_tptr+20), - EXTRACT_32BITS(obj_tptr+20))); + EXTRACT_BE_32BITS(obj_tptr + 20))); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 36, 36)) hexdump=TRUE; @@ -766,10 +766,10 @@ lmp_print(netdissect_options *ndo, EXTRACT_8BITS(obj_tptr)))); ND_PRINT((ndo, "\n\t Local Interface ID: %u (0x%08x)" "\n\t Remote Interface ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr+4), - EXTRACT_32BITS(obj_tptr+4), - EXTRACT_32BITS(obj_tptr+8), - EXTRACT_32BITS(obj_tptr+8))); + EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_32BITS(obj_tptr + 8), + EXTRACT_BE_32BITS(obj_tptr + 8))); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12)) hexdump=TRUE; @@ -790,21 +790,21 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: %s", bittok2str(lmp_obj_begin_verify_flag_values, "none", - EXTRACT_16BITS(obj_tptr)))); + EXTRACT_BE_16BITS(obj_tptr)))); ND_PRINT((ndo, "\n\t Verify Interval: %u", - EXTRACT_16BITS(obj_tptr+2))); + EXTRACT_BE_16BITS(obj_tptr + 2))); ND_PRINT((ndo, "\n\t Data links: %u", - EXTRACT_32BITS(obj_tptr+4))); + EXTRACT_BE_32BITS(obj_tptr + 4))); ND_PRINT((ndo, "\n\t Encoding type: %s", tok2str(gmpls_encoding_values, "Unknown", *(obj_tptr+8)))); ND_PRINT((ndo, "\n\t Verify Transport Mechanism: %u (0x%x)%s", - EXTRACT_16BITS(obj_tptr+10), - EXTRACT_16BITS(obj_tptr+10), - EXTRACT_16BITS(obj_tptr+10)&8000 ? " (Payload test messages capable)" : "")); - bw.i = EXTRACT_32BITS(obj_tptr+12); + 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); ND_PRINT((ndo, "\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000)); ND_PRINT((ndo, "\n\t Wavelength: %u", - EXTRACT_32BITS(obj_tptr+16))); + EXTRACT_BE_32BITS(obj_tptr + 16))); break; default: @@ -821,8 +821,8 @@ lmp_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t Verify Dead Interval: %u" "\n\t Verify Transport Response: %u", - EXTRACT_16BITS(obj_tptr), - EXTRACT_16BITS(obj_tptr+2))); + EXTRACT_BE_16BITS(obj_tptr), + EXTRACT_BE_16BITS(obj_tptr + 2))); break; default: @@ -838,7 +838,7 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Verify ID: %u", - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr))); break; default: @@ -854,23 +854,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_32BITS(obj_tptr+offset))); + EXTRACT_BE_32BITS(obj_tptr + offset))); ND_PRINT((ndo, "\n\t\t Active: %s (%u)", - (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ? - "Allocated" : "Non-allocated", - (EXTRACT_32BITS(obj_tptr+offset+4)>>31))); + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31) ? + "Allocated" : "Non-allocated", + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31))); ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", - (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ? - "Transmit" : "Receive", - (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1)); + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1 ? + "Transmit" : "Receive", + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1)); ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF), - EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF)); + EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF), + EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF)); offset+=8; } break; @@ -881,23 +881,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_32BITS(obj_tptr+offset))); + EXTRACT_BE_32BITS(obj_tptr + offset))); ND_PRINT((ndo, "\n\t\t Active: %s (%u)", - (EXTRACT_32BITS(obj_tptr+offset+16)>>31) ? - "Allocated" : "Non-allocated", - (EXTRACT_32BITS(obj_tptr+offset+16)>>31))); + (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>31) ? + "Allocated" : "Non-allocated", + (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>31))); ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", - (EXTRACT_32BITS(obj_tptr+offset+16)>>30)&0x1 ? - "Transmit" : "Receive", - (EXTRACT_32BITS(obj_tptr+offset+16)>>30)&0x1)); + (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>30)&0x1 ? + "Transmit" : "Receive", + (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>30)&0x1)); ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_32BITS(obj_tptr+offset+16)&0x3FFFFFF), - EXTRACT_32BITS(obj_tptr+offset+16)&0x3FFFFFF)); + EXTRACT_BE_32BITS(obj_tptr + offset + 16)&0x3FFFFFF), + EXTRACT_BE_32BITS(obj_tptr + offset + 16)&0x3FFFFFF)); offset+=20; } break; @@ -907,24 +907,24 @@ lmp_print(netdissect_options *ndo, /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */ while (offset+8 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr+offset), - EXTRACT_32BITS(obj_tptr+offset))); + EXTRACT_BE_32BITS(obj_tptr + offset), + EXTRACT_BE_32BITS(obj_tptr + offset))); ND_PRINT((ndo, "\n\t\t Active: %s (%u)", - (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ? - "Allocated" : "Non-allocated", - (EXTRACT_32BITS(obj_tptr+offset+4)>>31))); + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31) ? + "Allocated" : "Non-allocated", + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31))); ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", - (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ? - "Transmit" : "Receive", - (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1)); + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1 ? + "Transmit" : "Receive", + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1)); ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF), - EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF)); + EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF), + EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF)); offset+=8; } break; @@ -941,7 +941,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_32BITS(obj_tptr+offset))); + EXTRACT_BE_32BITS(obj_tptr + offset))); offset+=4; } break; @@ -951,7 +951,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_32BITS(obj_tptr+offset))); + EXTRACT_BE_32BITS(obj_tptr + offset))); offset+=16; } break; @@ -960,8 +960,8 @@ lmp_print(netdissect_options *ndo, offset = 0; while (offset+4 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr+offset), - EXTRACT_32BITS(obj_tptr+offset))); + EXTRACT_BE_32BITS(obj_tptr + offset), + EXTRACT_BE_32BITS(obj_tptr + offset))); offset+=4; } break; @@ -981,7 +981,7 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Error Code: %s", bittok2str(lmp_obj_begin_verify_error_values, "none", - EXTRACT_32BITS(obj_tptr)))); + EXTRACT_BE_32BITS(obj_tptr)))); break; case LMP_CTYPE_LINK_SUMMARY_ERROR: @@ -992,7 +992,7 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Error Code: %s", bittok2str(lmp_obj_link_summary_error_values, "none", - EXTRACT_32BITS(obj_tptr)))); + EXTRACT_BE_32BITS(obj_tptr)))); break; default: hexdump=TRUE; @@ -1058,20 +1058,20 @@ lmp_print(netdissect_options *ndo, EXTRACT_8BITS(obj_tptr + 3)))); ND_PRINT((ndo, "\n\t Minimum NCC: %u", - EXTRACT_16BITS(obj_tptr+4))); + EXTRACT_BE_16BITS(obj_tptr + 4))); ND_PRINT((ndo, "\n\t Maximum NCC: %u", - EXTRACT_16BITS(obj_tptr+6))); + EXTRACT_BE_16BITS(obj_tptr + 6))); ND_PRINT((ndo, "\n\t Minimum NVC:%u", - EXTRACT_16BITS(obj_tptr+8))); + EXTRACT_BE_16BITS(obj_tptr + 8))); ND_PRINT((ndo, "\n\t Maximum NVC:%u", - EXTRACT_16BITS(obj_tptr+10))); + EXTRACT_BE_16BITS(obj_tptr + 10))); ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+12), - EXTRACT_32BITS(obj_tptr+12))); + EXTRACT_BE_32BITS(obj_tptr + 12))); break; @@ -1085,7 +1085,7 @@ lmp_print(netdissect_options *ndo, bittok2str( lmp_obj_service_config_nsa_transparency_flag_values, "none", - EXTRACT_32BITS(obj_tptr)))); + EXTRACT_BE_32BITS(obj_tptr)))); ND_PRINT((ndo, "\n\t TCM Monitoring Flags: %s", bittok2str( |