X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/b54ff914a1ea5c40da3687b52a508748ecb801b0..refs/heads/tcpdump-4.1:/print-lmp.c diff --git a/print-lmp.c b/print-lmp.c index 9aa9d2c3..556db173 100644 --- a/print-lmp.c +++ b/print-lmp.c @@ -10,6 +10,8 @@ * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE. * + * Support for the Link Management Protocol as per rfc 4204. + * * Original code by Hannes Gredler (hannes@juniper.net) * Support for LMP service discovery extensions (defined by UNI 1.0) added * by Manu Pathak (mapathak@cisco.com), May 2005 @@ -17,7 +19,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-lmp.c,v 1.6 2005-05-19 06:40:00 guy Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-lmp.c,v 1.11 2007-08-02 17:32:49 hannes Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -59,7 +61,7 @@ struct lmp_common_header { #define LMP_EXTRACT_VERSION(x) (((x)&0xf0)>>4) static const struct tok lmp_header_flag_values[] = { - { 0x00, "Control Channel Down"}, + { 0x01, "Control Channel Down"}, { 0x02, "LMP restart"}, { 0, NULL} }; @@ -91,21 +93,21 @@ static const struct tok lmp_obj_begin_verify_flag_values[] = { }; static const struct tok lmp_obj_begin_verify_error_values[] = { - { 0x01, "\n\t\tLink Verification Procedure Not supported"}, - { 0x02, "\n\t\tUnwilling to verify"}, - { 0x04, "\n\t\tUnsupported verification transport mechanism"}, - { 0x08, "\n\t\tLink_Id configuration error"}, - { 0x10, "\n\t\tUnknown object c-type"}, + { 0x01, "Link Verification Procedure Not supported"}, + { 0x02, "Unwilling to verify"}, + { 0x04, "Unsupported verification transport mechanism"}, + { 0x08, "Link-Id configuration error"}, + { 0x10, "Unknown object c-type"}, { 0, NULL} }; static const struct tok lmp_obj_link_summary_error_values[] = { - { 0x01, "\n\t\tUnacceptable non-negotiable LINK_SUMMARY parameters"}, - { 0x02, "\n\t\tRenegotiate LINK_SUMMARY parameters"}, - { 0x04, "\n\t\tInvalid TE-LINK Object"}, - { 0x08, "\n\t\tInvalid DATA-LINK Object"}, - { 0x10, "\n\t\tUnknown TE-LINK Object c-type"}, - { 0x20, "\n\t\tUnknown DATA-LINK Object c-type"}, + { 0x01, "Unacceptable non-negotiable LINK-SUMMARY parameters"}, + { 0x02, "Renegotiate LINK-SUMMARY parameters"}, + { 0x04, "Invalid TE-LINK Object"}, + { 0x08, "Invalid DATA-LINK Object"}, + { 0x10, "Unknown TE-LINK Object c-type"}, + { 0x20, "Unknown DATA-LINK Object c-type"}, { 0, NULL} }; @@ -307,9 +309,6 @@ static const struct tok lmp_data_link_subobj[] = { #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH 5 /* UNI 1.0 Sec 9.4.2 */ #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET 6 /* UNI 1.0 Sec 9.4.2 */ -#define FALSE 0 -#define TRUE 1 - /* * the ctypes are not globally unique so for * translating it to strings we build a table based @@ -535,7 +534,7 @@ lmp_print(register const u_char *pptr, register u_int len) { case LMP_OBJ_HELLO: switch(lmp_obj_ctype) { case LMP_CTYPE_HELLO: - printf("\n\t TxSeqNum: %u\n\t RcvSeqNum: %u", + printf("\n\t Tx Seq: %u, Rx Seq: %u", EXTRACT_32BITS(obj_tptr), EXTRACT_32BITS(obj_tptr+4)); break; @@ -599,25 +598,25 @@ lmp_print(register const u_char *pptr, register u_int len) { subobj_len); switch(subobj_type) { case INT_SWITCHING_TYPE_SUBOBJ: - printf("\n\t\t Switching Type: %s (%u)", + printf("\n\t Switching Type: %s (%u)", tok2str(gmpls_switch_cap_values, "Unknown", EXTRACT_16BITS(obj_tptr+offset+2)>>8), EXTRACT_16BITS(obj_tptr+offset+2)>>8); - printf("\n\t\t Encoding Type: %s (%u)", + printf("\n\t Encoding Type: %s (%u)", tok2str(gmpls_encoding_values, "Unknown", EXTRACT_16BITS(obj_tptr+offset+2)&0x00FF), EXTRACT_16BITS(obj_tptr+offset+2)&0x00FF); bw.i = EXTRACT_32BITS(obj_tptr+offset+4); - printf("\n\t\t Min Reservable Bandwidth: %.3f Mbps", - bw.f); + printf("\n\t Min Reservable Bandwidth: %.3f Mbps", + bw.f*8/1000000); bw.i = EXTRACT_32BITS(obj_tptr+offset+8); - printf("\n\t\t Max Reservable Bandwidth: %.3f Mbps", - bw.f); + printf("\n\t Max Reservable Bandwidth: %.3f Mbps", + bw.f*8/1000000); break; case WAVELENGTH_SUBOBJ: - printf("\n\t\t Wavelength: %u", + printf("\n\t Wavelength: %u", EXTRACT_32BITS(obj_tptr+offset+4)); break; default: @@ -656,7 +655,7 @@ lmp_print(register const u_char *pptr, register u_int len) { EXTRACT_16BITS(obj_tptr+10), EXTRACT_16BITS(obj_tptr+10)&8000 ? "(Payload test messages capable)" : ""); bw.i = EXTRACT_32BITS(obj_tptr+12); - printf("\n\t Transmission Rate: %.3f Mbps",bw.f); + printf("\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000); printf("\n\t Wavelength: %u", EXTRACT_32BITS(obj_tptr+16)); break;