Home | History | Annotate | Line # | Download | only in dist
print-lmp.c revision 1.7
      1  1.1  christos /*
      2  1.1  christos  * Redistribution and use in source and binary forms, with or without
      3  1.1  christos  * modification, are permitted provided that: (1) source code
      4  1.1  christos  * distributions retain the above copyright notice and this paragraph
      5  1.1  christos  * in its entirety, and (2) distributions including binary code include
      6  1.1  christos  * the above copyright notice and this paragraph in its entirety in
      7  1.1  christos  * the documentation or other materials provided with the distribution.
      8  1.1  christos  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
      9  1.1  christos  * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
     10  1.1  christos  * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     11  1.1  christos  * FOR A PARTICULAR PURPOSE.
     12  1.1  christos  *
     13  1.1  christos  * Support for the Link Management Protocol as per rfc 4204.
     14  1.1  christos  *
     15  1.1  christos  * Original code by Hannes Gredler (hannes (at) juniper.net)
     16  1.1  christos  * Support for LMP service discovery extensions (defined by UNI 1.0) added
     17  1.1  christos  * by Manu Pathak (mapathak (at) cisco.com), May 2005
     18  1.1  christos  */
     19  1.1  christos 
     20  1.2  christos #include <sys/cdefs.h>
     21  1.1  christos #ifndef lint
     22  1.7  christos __RCSID("$NetBSD: print-lmp.c,v 1.7 2015/03/31 21:59:35 christos Exp $");
     23  1.1  christos #endif
     24  1.1  christos 
     25  1.6  christos #define NETDISSECT_REWORKED
     26  1.1  christos #ifdef HAVE_CONFIG_H
     27  1.1  christos #include "config.h"
     28  1.1  christos #endif
     29  1.1  christos 
     30  1.1  christos #include <tcpdump-stdinc.h>
     31  1.1  christos 
     32  1.1  christos #include "interface.h"
     33  1.1  christos #include "extract.h"
     34  1.1  christos #include "addrtoname.h"
     35  1.1  christos #include "gmpls.h"
     36  1.1  christos 
     37  1.1  christos /*
     38  1.1  christos  * LMP common header
     39  1.1  christos  *
     40  1.1  christos  *  0                   1                   2                   3
     41  1.1  christos  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     42  1.1  christos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     43  1.1  christos  * | Vers  |      (Reserved)       |    Flags      |    Msg Type   |
     44  1.1  christos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     45  1.1  christos  * |          LMP Length           |          (Reserved)           |
     46  1.1  christos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     47  1.1  christos  */
     48  1.1  christos 
     49  1.1  christos struct lmp_common_header {
     50  1.6  christos     uint8_t version_res[2];
     51  1.6  christos     uint8_t flags;
     52  1.6  christos     uint8_t msg_type;
     53  1.6  christos     uint8_t length[2];
     54  1.6  christos     uint8_t reserved[2];
     55  1.1  christos };
     56  1.1  christos 
     57  1.1  christos #define LMP_VERSION            1
     58  1.6  christos #define	LMP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
     59  1.1  christos 
     60  1.1  christos static const struct tok lmp_header_flag_values[] = {
     61  1.1  christos     { 0x01, "Control Channel Down"},
     62  1.1  christos     { 0x02, "LMP restart"},
     63  1.1  christos     { 0, NULL}
     64  1.1  christos };
     65  1.1  christos 
     66  1.1  christos static const struct tok lmp_obj_te_link_flag_values[] = {
     67  1.1  christos     { 0x01, "Fault Management Supported"},
     68  1.1  christos     { 0x02, "Link Verification Supported"},
     69  1.1  christos     { 0, NULL}
     70  1.1  christos };
     71  1.1  christos 
     72  1.1  christos static const struct tok lmp_obj_data_link_flag_values[] = {
     73  1.1  christos     { 0x01, "Data Link Port"},
     74  1.1  christos     { 0x02, "Allocated for user traffic"},
     75  1.1  christos     { 0x04, "Failed link"},
     76  1.1  christos     { 0, NULL}
     77  1.1  christos };
     78  1.1  christos 
     79  1.1  christos static const struct tok lmp_obj_channel_status_values[] = {
     80  1.1  christos     { 1, "Signal Okay"},
     81  1.1  christos     { 2, "Signal Degraded"},
     82  1.1  christos     { 3, "Signal Fail"},
     83  1.1  christos     { 0, NULL}
     84  1.1  christos };
     85  1.1  christos 
     86  1.1  christos static const struct tok lmp_obj_begin_verify_flag_values[] = {
     87  1.1  christos     { 0x0001, "Verify all links"},
     88  1.1  christos     { 0x0002, "Data link type"},
     89  1.1  christos     { 0, NULL}
     90  1.1  christos };
     91  1.1  christos 
     92  1.1  christos static const struct tok lmp_obj_begin_verify_error_values[] = {
     93  1.1  christos     { 0x01, "Link Verification Procedure Not supported"},
     94  1.1  christos     { 0x02, "Unwilling to verify"},
     95  1.1  christos     { 0x04, "Unsupported verification transport mechanism"},
     96  1.1  christos     { 0x08, "Link-Id configuration error"},
     97  1.1  christos     { 0x10, "Unknown object c-type"},
     98  1.1  christos     { 0, NULL}
     99  1.1  christos };
    100  1.1  christos 
    101  1.1  christos static const struct tok lmp_obj_link_summary_error_values[] = {
    102  1.1  christos     { 0x01, "Unacceptable non-negotiable LINK-SUMMARY parameters"},
    103  1.1  christos     { 0x02, "Renegotiate LINK-SUMMARY parameters"},
    104  1.1  christos     { 0x04, "Invalid TE-LINK Object"},
    105  1.1  christos     { 0x08, "Invalid DATA-LINK Object"},
    106  1.1  christos     { 0x10, "Unknown TE-LINK Object c-type"},
    107  1.1  christos     { 0x20, "Unknown DATA-LINK Object c-type"},
    108  1.1  christos     { 0, NULL}
    109  1.1  christos };
    110  1.1  christos 
    111  1.1  christos /* Service Config Supported Protocols Flags */
    112  1.1  christos static const struct tok lmp_obj_service_config_sp_flag_values[] = {
    113  1.1  christos     { 0x01, "RSVP Supported"},
    114  1.1  christos     { 0x02, "LDP Supported"},
    115  1.1  christos     { 0, NULL}
    116  1.1  christos };
    117  1.1  christos 
    118  1.1  christos /* Service Config Client Port Service Attribute Transparency Flags */
    119  1.1  christos static const struct tok lmp_obj_service_config_cpsa_tp_flag_values[] = {
    120  1.1  christos     { 0x01, "Path/VC Overhead Transparency Supported"},
    121  1.1  christos     { 0x02, "Line/MS Overhead Transparency Supported"},
    122  1.1  christos     { 0x04, "Section/RS Overhead Transparency Supported"},
    123  1.1  christos     { 0, NULL}
    124  1.1  christos };
    125  1.1  christos 
    126  1.1  christos /* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */
    127  1.1  christos static const struct tok lmp_obj_service_config_cpsa_cct_flag_values[] = {
    128  1.1  christos     { 0x01, "Contiguous Concatenation Types Supported"},
    129  1.1  christos     { 0, NULL}
    130  1.1  christos };
    131  1.1  christos 
    132  1.1  christos /* Service Config Network Service Attributes Transparency Flags */
    133  1.1  christos static const struct tok lmp_obj_service_config_nsa_transparency_flag_values[] = {
    134  1.1  christos     { 0x01, "Standard SOH/RSOH Transparency Supported"},
    135  1.1  christos     { 0x02, "Standard LOH/MSOH Transparency Supported"},
    136  1.1  christos     { 0, NULL}
    137  1.1  christos };
    138  1.1  christos 
    139  1.1  christos /* Service Config Network Service Attributes TCM Monitoring Flags */
    140  1.1  christos static const struct tok lmp_obj_service_config_nsa_tcm_flag_values[] = {
    141  1.1  christos     { 0x01, "Transparent Tandem Connection Monitoring Supported"},
    142  1.1  christos     { 0, NULL}
    143  1.1  christos };
    144  1.1  christos 
    145  1.1  christos /* Network Service Attributes Network Diversity Flags */
    146  1.1  christos static const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values[] = {
    147  1.1  christos     { 0x01, "Node Diversity Supported"},
    148  1.1  christos     { 0x02, "Link Diversity Supported"},
    149  1.1  christos     { 0x04, "SRLG Diversity Supported"},
    150  1.1  christos     { 0, NULL}
    151  1.1  christos };
    152  1.1  christos 
    153  1.1  christos #define	LMP_MSGTYPE_CONFIG                 1
    154  1.1  christos #define	LMP_MSGTYPE_CONFIG_ACK             2
    155  1.1  christos #define	LMP_MSGTYPE_CONFIG_NACK            3
    156  1.1  christos #define	LMP_MSGTYPE_HELLO                  4
    157  1.1  christos #define	LMP_MSGTYPE_VERIFY_BEGIN           5
    158  1.1  christos #define	LMP_MSGTYPE_VERIFY_BEGIN_ACK       6
    159  1.1  christos #define	LMP_MSGTYPE_VERIFY_BEGIN_NACK      7
    160  1.1  christos #define LMP_MSGTYPE_VERIFY_END             8
    161  1.1  christos #define LMP_MSGTYPE_VERIFY_END_ACK         9
    162  1.1  christos #define LMP_MSGTYPE_TEST                  10
    163  1.1  christos #define LMP_MSGTYPE_TEST_STATUS_SUCCESS   11
    164  1.1  christos #define	LMP_MSGTYPE_TEST_STATUS_FAILURE   12
    165  1.1  christos #define	LMP_MSGTYPE_TEST_STATUS_ACK       13
    166  1.1  christos #define	LMP_MSGTYPE_LINK_SUMMARY          14
    167  1.1  christos #define	LMP_MSGTYPE_LINK_SUMMARY_ACK      15
    168  1.1  christos #define	LMP_MSGTYPE_LINK_SUMMARY_NACK     16
    169  1.1  christos #define	LMP_MSGTYPE_CHANNEL_STATUS        17
    170  1.1  christos #define	LMP_MSGTYPE_CHANNEL_STATUS_ACK    18
    171  1.1  christos #define	LMP_MSGTYPE_CHANNEL_STATUS_REQ    19
    172  1.1  christos #define	LMP_MSGTYPE_CHANNEL_STATUS_RESP   20
    173  1.1  christos /* LMP Service Discovery message types defined by UNI 1.0 */
    174  1.1  christos #define LMP_MSGTYPE_SERVICE_CONFIG        50
    175  1.1  christos #define LMP_MSGTYPE_SERVICE_CONFIG_ACK    51
    176  1.1  christos #define LMP_MSGTYPE_SERVICE_CONFIG_NACK   52
    177  1.1  christos 
    178  1.1  christos static const struct tok lmp_msg_type_values[] = {
    179  1.1  christos     { LMP_MSGTYPE_CONFIG, "Config"},
    180  1.1  christos     { LMP_MSGTYPE_CONFIG_ACK, "Config ACK"},
    181  1.1  christos     { LMP_MSGTYPE_CONFIG_NACK, "Config NACK"},
    182  1.1  christos     { LMP_MSGTYPE_HELLO, "Hello"},
    183  1.1  christos     { LMP_MSGTYPE_VERIFY_BEGIN, "Begin Verify"},
    184  1.1  christos     { LMP_MSGTYPE_VERIFY_BEGIN_ACK, "Begin Verify ACK"},
    185  1.1  christos     { LMP_MSGTYPE_VERIFY_BEGIN_NACK, "Begin Verify NACK"},
    186  1.1  christos     { LMP_MSGTYPE_VERIFY_END, "End Verify"},
    187  1.1  christos     { LMP_MSGTYPE_VERIFY_END_ACK, "End Verify ACK"},
    188  1.1  christos     { LMP_MSGTYPE_TEST, "Test"},
    189  1.1  christos     { LMP_MSGTYPE_TEST_STATUS_SUCCESS, "Test Status Success"},
    190  1.1  christos     { LMP_MSGTYPE_TEST_STATUS_FAILURE, "Test Status Failure"},
    191  1.1  christos     { LMP_MSGTYPE_TEST_STATUS_ACK, "Test Status ACK"},
    192  1.1  christos     { LMP_MSGTYPE_LINK_SUMMARY, "Link Summary"},
    193  1.1  christos     { LMP_MSGTYPE_LINK_SUMMARY_ACK, "Link Summary ACK"},
    194  1.1  christos     { LMP_MSGTYPE_LINK_SUMMARY_NACK, "Link Summary NACK"},
    195  1.1  christos     { LMP_MSGTYPE_CHANNEL_STATUS, "Channel Status"},
    196  1.1  christos     { LMP_MSGTYPE_CHANNEL_STATUS_ACK, "Channel Status ACK"},
    197  1.1  christos     { LMP_MSGTYPE_CHANNEL_STATUS_REQ, "Channel Status Request"},
    198  1.1  christos     { LMP_MSGTYPE_CHANNEL_STATUS_RESP, "Channel Status Response"},
    199  1.1  christos     { LMP_MSGTYPE_SERVICE_CONFIG, "Service Config"},
    200  1.1  christos     { LMP_MSGTYPE_SERVICE_CONFIG_ACK, "Service Config ACK"},
    201  1.1  christos     { LMP_MSGTYPE_SERVICE_CONFIG_NACK, "Service Config NACK"},
    202  1.1  christos     { 0, NULL}
    203  1.1  christos };
    204  1.1  christos 
    205  1.6  christos /*
    206  1.1  christos  * LMP object header
    207  1.1  christos  *
    208  1.1  christos  *  0                   1                   2                   3
    209  1.1  christos  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    210  1.1  christos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    211  1.1  christos  * |N|   C-Type    |     Class     |            Length             |
    212  1.1  christos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    213  1.1  christos  * |                                                               |
    214  1.1  christos  * //                       (object contents)                     //
    215  1.1  christos  * |                                                               |
    216  1.6  christos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    217  1.1  christos  */
    218  1.1  christos 
    219  1.1  christos struct lmp_object_header {
    220  1.6  christos     uint8_t ctype;
    221  1.6  christos     uint8_t class_num;
    222  1.6  christos     uint8_t length[2];
    223  1.1  christos };
    224  1.1  christos 
    225  1.1  christos #define	LMP_OBJ_CC_ID                 1
    226  1.1  christos #define	LMP_OBJ_NODE_ID               2
    227  1.1  christos #define	LMP_OBJ_LINK_ID               3
    228  1.1  christos #define	LMP_OBJ_INTERFACE_ID          4
    229  1.6  christos #define	LMP_OBJ_MESSAGE_ID            5
    230  1.1  christos #define	LMP_OBJ_CONFIG                6
    231  1.1  christos #define	LMP_OBJ_HELLO                 7
    232  1.1  christos #define	LMP_OBJ_VERIFY_BEGIN          8
    233  1.1  christos #define LMP_OBJ_VERIFY_BEGIN_ACK      9
    234  1.1  christos #define LMP_OBJ_VERIFY_ID            10
    235  1.1  christos #define LMP_OBJ_TE_LINK              11
    236  1.1  christos #define LMP_OBJ_DATA_LINK            12
    237  1.1  christos #define LMP_OBJ_CHANNEL_STATUS       13
    238  1.1  christos #define LMP_OBJ_CHANNEL_STATUS_REQ   14
    239  1.1  christos #define LMP_OBJ_ERROR_CODE           20
    240  1.1  christos 
    241  1.1  christos #define LMP_OBJ_SERVICE_CONFIG       51 /* defined in UNI 1.0 */
    242  1.1  christos 
    243  1.1  christos static const struct tok lmp_obj_values[] = {
    244  1.1  christos     { LMP_OBJ_CC_ID, "Control Channel ID" },
    245  1.1  christos     { LMP_OBJ_NODE_ID, "Node ID" },
    246  1.1  christos     { LMP_OBJ_LINK_ID, "Link ID" },
    247  1.1  christos     { LMP_OBJ_INTERFACE_ID, "Interface ID" },
    248  1.1  christos     { LMP_OBJ_MESSAGE_ID, "Message ID" },
    249  1.1  christos     { LMP_OBJ_CONFIG, "Configuration" },
    250  1.1  christos     { LMP_OBJ_HELLO, "Hello" },
    251  1.1  christos     { LMP_OBJ_VERIFY_BEGIN, "Verify Begin" },
    252  1.1  christos     { LMP_OBJ_VERIFY_BEGIN_ACK, "Verify Begin ACK" },
    253  1.1  christos     { LMP_OBJ_VERIFY_ID, "Verify ID" },
    254  1.1  christos     { LMP_OBJ_TE_LINK, "TE Link" },
    255  1.1  christos     { LMP_OBJ_DATA_LINK, "Data Link" },
    256  1.1  christos     { LMP_OBJ_CHANNEL_STATUS, "Channel Status" },
    257  1.1  christos     { LMP_OBJ_CHANNEL_STATUS_REQ, "Channel Status Request" },
    258  1.1  christos     { LMP_OBJ_ERROR_CODE, "Error Code" },
    259  1.1  christos     { LMP_OBJ_SERVICE_CONFIG, "Service Config" },
    260  1.1  christos 
    261  1.1  christos     { 0, NULL}
    262  1.1  christos };
    263  1.1  christos 
    264  1.1  christos #define INT_SWITCHING_TYPE_SUBOBJ 1
    265  1.1  christos #define WAVELENGTH_SUBOBJ         2
    266  1.1  christos 
    267  1.1  christos static const struct tok lmp_data_link_subobj[] = {
    268  1.1  christos     { INT_SWITCHING_TYPE_SUBOBJ, "Interface Switching Type" },
    269  1.1  christos     { WAVELENGTH_SUBOBJ        , "Wavelength" },
    270  1.1  christos     { 0, NULL}
    271  1.1  christos };
    272  1.1  christos 
    273  1.1  christos #define	LMP_CTYPE_IPV4       1
    274  1.1  christos #define	LMP_CTYPE_IPV6       2
    275  1.1  christos 
    276  1.1  christos #define	LMP_CTYPE_LOC        1
    277  1.1  christos #define	LMP_CTYPE_RMT        2
    278  1.1  christos #define	LMP_CTYPE_UNMD       3
    279  1.6  christos 
    280  1.1  christos #define	LMP_CTYPE_IPV4_LOC   1
    281  1.1  christos #define	LMP_CTYPE_IPV4_RMT   2
    282  1.1  christos #define	LMP_CTYPE_IPV6_LOC   3
    283  1.1  christos #define	LMP_CTYPE_IPV6_RMT   4
    284  1.6  christos #define	LMP_CTYPE_UNMD_LOC   5
    285  1.6  christos #define	LMP_CTYPE_UNMD_RMT   6
    286  1.1  christos 
    287  1.1  christos #define	LMP_CTYPE_1          1
    288  1.1  christos #define	LMP_CTYPE_2          2
    289  1.1  christos 
    290  1.1  christos #define LMP_CTYPE_HELLO_CONFIG  1
    291  1.1  christos #define LMP_CTYPE_HELLO         1
    292  1.1  christos 
    293  1.1  christos #define LMP_CTYPE_BEGIN_VERIFY_ERROR 1
    294  1.1  christos #define LMP_CTYPE_LINK_SUMMARY_ERROR 2
    295  1.1  christos 
    296  1.1  christos /* C-Types for Service Config Object */
    297  1.1  christos #define LMP_CTYPE_SERVICE_CONFIG_SP                   1
    298  1.1  christos #define LMP_CTYPE_SERVICE_CONFIG_CPSA                 2
    299  1.1  christos #define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM     3
    300  1.1  christos #define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY    4
    301  1.1  christos 
    302  1.6  christos /*
    303  1.1  christos  * Different link types allowed in the Client Port Service Attributes
    304  1.1  christos  * subobject defined for LMP Service Discovery in the UNI 1.0 spec
    305  1.1  christos  */
    306  1.1  christos #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH     5 /* UNI 1.0 Sec 9.4.2 */
    307  1.1  christos #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET   6 /* UNI 1.0 Sec 9.4.2 */
    308  1.1  christos 
    309  1.1  christos /*
    310  1.1  christos  * the ctypes are not globally unique so for
    311  1.1  christos  * translating it to strings we build a table based
    312  1.1  christos  * on objects offsetted by the ctype
    313  1.1  christos  */
    314  1.1  christos 
    315  1.1  christos static const struct tok lmp_ctype_values[] = {
    316  1.1  christos     { 256*LMP_OBJ_CC_ID+LMP_CTYPE_LOC, "Local" },
    317  1.1  christos     { 256*LMP_OBJ_CC_ID+LMP_CTYPE_RMT, "Remote" },
    318  1.1  christos     { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_LOC, "Local" },
    319  1.1  christos     { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_RMT, "Remote" },
    320  1.1  christos     { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
    321  1.1  christos     { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
    322  1.1  christos     { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
    323  1.1  christos     { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
    324  1.1  christos     { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
    325  1.1  christos     { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
    326  1.1  christos     { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
    327  1.1  christos     { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
    328  1.1  christos     { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
    329  1.1  christos     { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
    330  1.1  christos     { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
    331  1.1  christos     { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
    332  1.1  christos     { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_1, "1" },
    333  1.1  christos     { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_2, "2" },
    334  1.1  christos     { 256*LMP_OBJ_CONFIG+LMP_CTYPE_1, "1" },
    335  1.1  christos     { 256*LMP_OBJ_HELLO+LMP_CTYPE_1, "1" },
    336  1.1  christos     { 256*LMP_OBJ_VERIFY_BEGIN+LMP_CTYPE_1, "1" },
    337  1.1  christos     { 256*LMP_OBJ_VERIFY_BEGIN_ACK+LMP_CTYPE_1, "1" },
    338  1.1  christos     { 256*LMP_OBJ_VERIFY_ID+LMP_CTYPE_1, "1" },
    339  1.1  christos     { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV4, "IPv4" },
    340  1.1  christos     { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV6, "IPv6" },
    341  1.1  christos     { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
    342  1.1  christos     { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV4, "IPv4" },
    343  1.1  christos     { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV6, "IPv6" },
    344  1.1  christos     { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
    345  1.1  christos     { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV4, "IPv4" },
    346  1.1  christos     { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV6, "IPv6" },
    347  1.1  christos     { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_UNMD, "Unnumbered" },
    348  1.1  christos     { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV4, "IPv4" },
    349  1.1  christos     { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV6, "IPv6" },
    350  1.1  christos     { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_UNMD, "Unnumbered" },
    351  1.1  christos     { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_1, "1" },
    352  1.1  christos     { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_2, "2" },
    353  1.1  christos     { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_SP, "1" },
    354  1.1  christos     { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_CPSA, "2" },
    355  1.1  christos     { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM, "3" },
    356  1.1  christos     { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY, "4" },
    357  1.1  christos     { 0, NULL}
    358  1.1  christos };
    359  1.1  christos 
    360  1.1  christos void
    361  1.6  christos lmp_print(netdissect_options *ndo,
    362  1.7  christos           register const u_char *pptr, register u_int len)
    363  1.7  christos {
    364  1.1  christos     const struct lmp_common_header *lmp_com_header;
    365  1.1  christos     const struct lmp_object_header *lmp_obj_header;
    366  1.1  christos     const u_char *tptr,*obj_tptr;
    367  1.1  christos     int tlen,lmp_obj_len,lmp_obj_ctype,obj_tlen;
    368  1.1  christos     int hexdump;
    369  1.1  christos     int offset,subobj_type,subobj_len,total_subobj_len;
    370  1.1  christos     int link_type;
    371  1.1  christos 
    372  1.1  christos     union { /* int to float conversion buffer */
    373  1.6  christos         float f;
    374  1.6  christos         uint32_t i;
    375  1.1  christos     } bw;
    376  1.1  christos 
    377  1.1  christos     tptr=pptr;
    378  1.1  christos     lmp_com_header = (const struct lmp_common_header *)pptr;
    379  1.6  christos     ND_TCHECK(*lmp_com_header);
    380  1.1  christos 
    381  1.1  christos     /*
    382  1.1  christos      * Sanity checking of the header.
    383  1.1  christos      */
    384  1.1  christos     if (LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]) != LMP_VERSION) {
    385  1.6  christos 	ND_PRINT((ndo, "LMP version %u packet not supported",
    386  1.6  christos                LMP_EXTRACT_VERSION(lmp_com_header->version_res[0])));
    387  1.1  christos 	return;
    388  1.1  christos     }
    389  1.1  christos 
    390  1.1  christos     /* in non-verbose mode just lets print the basic Message Type*/
    391  1.6  christos     if (ndo->ndo_vflag < 1) {
    392  1.6  christos         ND_PRINT((ndo, "LMPv%u %s Message, length: %u",
    393  1.1  christos                LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
    394  1.1  christos                tok2str(lmp_msg_type_values, "unknown (%u)",lmp_com_header->msg_type),
    395  1.6  christos                len));
    396  1.1  christos         return;
    397  1.1  christos     }
    398  1.1  christos 
    399  1.1  christos     /* ok they seem to want to know everything - lets fully decode it */
    400  1.1  christos 
    401  1.1  christos     tlen=EXTRACT_16BITS(lmp_com_header->length);
    402  1.1  christos 
    403  1.6  christos     ND_PRINT((ndo, "\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
    404  1.1  christos            LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
    405  1.1  christos            tok2str(lmp_msg_type_values, "unknown, type: %u",lmp_com_header->msg_type),
    406  1.1  christos            bittok2str(lmp_header_flag_values,"none",lmp_com_header->flags),
    407  1.6  christos            tlen));
    408  1.1  christos 
    409  1.1  christos     tptr+=sizeof(const struct lmp_common_header);
    410  1.1  christos     tlen-=sizeof(const struct lmp_common_header);
    411  1.1  christos 
    412  1.1  christos     while(tlen>0) {
    413  1.1  christos         /* did we capture enough for fully decoding the object header ? */
    414  1.6  christos         ND_TCHECK2(*tptr, sizeof(struct lmp_object_header));
    415  1.1  christos 
    416  1.1  christos         lmp_obj_header = (const struct lmp_object_header *)tptr;
    417  1.1  christos         lmp_obj_len=EXTRACT_16BITS(lmp_obj_header->length);
    418  1.1  christos         lmp_obj_ctype=(lmp_obj_header->ctype)&0x7f;
    419  1.1  christos 
    420  1.1  christos         if(lmp_obj_len % 4 || lmp_obj_len < 4)
    421  1.1  christos             return;
    422  1.1  christos 
    423  1.6  christos         ND_PRINT((ndo, "\n\t  %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
    424  1.1  christos                tok2str(lmp_obj_values,
    425  1.1  christos                        "Unknown",
    426  1.1  christos                        lmp_obj_header->class_num),
    427  1.1  christos                lmp_obj_header->class_num,
    428  1.1  christos                tok2str(lmp_ctype_values,
    429  1.1  christos                        "Unknown",
    430  1.1  christos                        ((lmp_obj_header->class_num)<<8)+lmp_obj_ctype),
    431  1.1  christos                lmp_obj_ctype,
    432  1.1  christos                (lmp_obj_header->ctype)&0x80 ? "" : "non-",
    433  1.6  christos                lmp_obj_len));
    434  1.1  christos 
    435  1.1  christos         obj_tptr=tptr+sizeof(struct lmp_object_header);
    436  1.1  christos         obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header);
    437  1.1  christos 
    438  1.1  christos         /* did we capture enough for fully decoding the object ? */
    439  1.6  christos         ND_TCHECK2(*tptr, lmp_obj_len);
    440  1.1  christos         hexdump=FALSE;
    441  1.1  christos 
    442  1.1  christos         switch(lmp_obj_header->class_num) {
    443  1.1  christos 
    444  1.1  christos         case LMP_OBJ_CC_ID:
    445  1.1  christos             switch(lmp_obj_ctype) {
    446  1.1  christos             case LMP_CTYPE_LOC:
    447  1.1  christos             case LMP_CTYPE_RMT:
    448  1.6  christos                 ND_PRINT((ndo, "\n\t    Control Channel ID: %u (0x%08x)",
    449  1.1  christos                        EXTRACT_32BITS(obj_tptr),
    450  1.6  christos                        EXTRACT_32BITS(obj_tptr)));
    451  1.1  christos                 break;
    452  1.1  christos 
    453  1.1  christos             default:
    454  1.1  christos                 hexdump=TRUE;
    455  1.1  christos             }
    456  1.1  christos             break;
    457  1.1  christos 
    458  1.1  christos         case LMP_OBJ_LINK_ID:
    459  1.1  christos         case LMP_OBJ_INTERFACE_ID:
    460  1.1  christos             switch(lmp_obj_ctype) {
    461  1.1  christos             case LMP_CTYPE_IPV4_LOC:
    462  1.1  christos             case LMP_CTYPE_IPV4_RMT:
    463  1.6  christos                 ND_PRINT((ndo, "\n\t    IPv4 Link ID: %s (0x%08x)",
    464  1.6  christos                        ipaddr_string(ndo, obj_tptr),
    465  1.6  christos                        EXTRACT_32BITS(obj_tptr)));
    466  1.1  christos                 break;
    467  1.1  christos #ifdef INET6
    468  1.1  christos             case LMP_CTYPE_IPV6_LOC:
    469  1.1  christos             case LMP_CTYPE_IPV6_RMT:
    470  1.6  christos                 ND_PRINT((ndo, "\n\t    IPv6 Link ID: %s (0x%08x)",
    471  1.6  christos                        ip6addr_string(ndo, obj_tptr),
    472  1.6  christos                        EXTRACT_32BITS(obj_tptr)));
    473  1.1  christos                 break;
    474  1.1  christos #endif
    475  1.1  christos             case LMP_CTYPE_UNMD_LOC:
    476  1.1  christos             case LMP_CTYPE_UNMD_RMT:
    477  1.6  christos                 ND_PRINT((ndo, "\n\t    Link ID: %u (0x%08x)",
    478  1.1  christos                        EXTRACT_32BITS(obj_tptr),
    479  1.6  christos                        EXTRACT_32BITS(obj_tptr)));
    480  1.1  christos                 break;
    481  1.1  christos             default:
    482  1.1  christos                 hexdump=TRUE;
    483  1.1  christos             }
    484  1.1  christos             break;
    485  1.1  christos 
    486  1.1  christos         case LMP_OBJ_MESSAGE_ID:
    487  1.1  christos             switch(lmp_obj_ctype) {
    488  1.1  christos             case LMP_CTYPE_1:
    489  1.6  christos                 ND_PRINT((ndo, "\n\t    Message ID: %u (0x%08x)",
    490  1.1  christos                        EXTRACT_32BITS(obj_tptr),
    491  1.6  christos                        EXTRACT_32BITS(obj_tptr)));
    492  1.1  christos                 break;
    493  1.1  christos             case LMP_CTYPE_2:
    494  1.6  christos                 ND_PRINT((ndo, "\n\t    Message ID Ack: %u (0x%08x)",
    495  1.1  christos                        EXTRACT_32BITS(obj_tptr),
    496  1.6  christos                        EXTRACT_32BITS(obj_tptr)));
    497  1.1  christos                 break;
    498  1.1  christos             default:
    499  1.1  christos                 hexdump=TRUE;
    500  1.1  christos             }
    501  1.1  christos             break;
    502  1.1  christos 
    503  1.1  christos         case LMP_OBJ_NODE_ID:
    504  1.1  christos             switch(lmp_obj_ctype) {
    505  1.1  christos             case LMP_CTYPE_LOC:
    506  1.1  christos             case LMP_CTYPE_RMT:
    507  1.6  christos                 ND_PRINT((ndo, "\n\t    Node ID: %s (0x%08x)",
    508  1.6  christos                        ipaddr_string(ndo, obj_tptr),
    509  1.6  christos                        EXTRACT_32BITS(obj_tptr)));
    510  1.1  christos                 break;
    511  1.1  christos 
    512  1.1  christos             default:
    513  1.1  christos                 hexdump=TRUE;
    514  1.1  christos             }
    515  1.1  christos             break;
    516  1.1  christos 
    517  1.1  christos         case LMP_OBJ_CONFIG:
    518  1.1  christos             switch(lmp_obj_ctype) {
    519  1.1  christos             case LMP_CTYPE_HELLO_CONFIG:
    520  1.6  christos                 ND_PRINT((ndo, "\n\t    Hello Interval: %u\n\t    Hello Dead Interval: %u",
    521  1.1  christos                        EXTRACT_16BITS(obj_tptr),
    522  1.6  christos                        EXTRACT_16BITS(obj_tptr+2)));
    523  1.1  christos                 break;
    524  1.1  christos 
    525  1.1  christos             default:
    526  1.1  christos                 hexdump=TRUE;
    527  1.1  christos             }
    528  1.1  christos             break;
    529  1.6  christos 
    530  1.1  christos         case LMP_OBJ_HELLO:
    531  1.1  christos             switch(lmp_obj_ctype) {
    532  1.1  christos 	    case LMP_CTYPE_HELLO:
    533  1.6  christos                 ND_PRINT((ndo, "\n\t    Tx Seq: %u, Rx Seq: %u",
    534  1.1  christos                        EXTRACT_32BITS(obj_tptr),
    535  1.6  christos                        EXTRACT_32BITS(obj_tptr+4)));
    536  1.1  christos                 break;
    537  1.1  christos 
    538  1.1  christos             default:
    539  1.1  christos                 hexdump=TRUE;
    540  1.1  christos             }
    541  1.6  christos             break;
    542  1.6  christos 
    543  1.1  christos         case LMP_OBJ_TE_LINK:
    544  1.6  christos 		ND_PRINT((ndo, "\n\t    Flags: [%s]",
    545  1.1  christos 		bittok2str(lmp_obj_te_link_flag_values,
    546  1.1  christos 			"none",
    547  1.6  christos 			EXTRACT_16BITS(obj_tptr)>>8)));
    548  1.6  christos 
    549  1.1  christos 	    switch(lmp_obj_ctype) {
    550  1.1  christos 	    case LMP_CTYPE_IPV4:
    551  1.6  christos 		ND_PRINT((ndo, "\n\t    Local Link-ID: %s (0x%08x)"
    552  1.5  christos 		       "\n\t    Remote Link-ID: %s (0x%08x)",
    553  1.6  christos                        ipaddr_string(ndo, obj_tptr+4),
    554  1.1  christos                        EXTRACT_32BITS(obj_tptr+4),
    555  1.6  christos                        ipaddr_string(ndo, obj_tptr+8),
    556  1.6  christos                        EXTRACT_32BITS(obj_tptr+8)));
    557  1.1  christos 		break;
    558  1.6  christos 
    559  1.1  christos #ifdef INET6
    560  1.1  christos 	    case LMP_CTYPE_IPV6:
    561  1.1  christos #endif
    562  1.1  christos 	    case LMP_CTYPE_UNMD:
    563  1.1  christos             default:
    564  1.1  christos                 hexdump=TRUE;
    565  1.1  christos             }
    566  1.1  christos             break;
    567  1.6  christos 
    568  1.1  christos         case LMP_OBJ_DATA_LINK:
    569  1.6  christos 		ND_PRINT((ndo, "\n\t    Flags: [%s]",
    570  1.1  christos 		bittok2str(lmp_obj_data_link_flag_values,
    571  1.1  christos 			"none",
    572  1.6  christos 			EXTRACT_16BITS(obj_tptr)>>8)));
    573  1.6  christos 
    574  1.1  christos 	    switch(lmp_obj_ctype) {
    575  1.1  christos 	    case LMP_CTYPE_IPV4:
    576  1.1  christos 	    case LMP_CTYPE_UNMD:
    577  1.6  christos                 ND_PRINT((ndo, "\n\t    Local Interface ID: %s (0x%08x)"
    578  1.5  christos                        "\n\t    Remote Interface ID: %s (0x%08x)",
    579  1.6  christos                        ipaddr_string(ndo, obj_tptr+4),
    580  1.1  christos                        EXTRACT_32BITS(obj_tptr+4),
    581  1.6  christos                        ipaddr_string(ndo, obj_tptr+8),
    582  1.6  christos                        EXTRACT_32BITS(obj_tptr+8)));
    583  1.6  christos 
    584  1.6  christos 		total_subobj_len = lmp_obj_len - 16;
    585  1.1  christos 		offset = 12;
    586  1.1  christos 		while (total_subobj_len > 0 && hexdump == FALSE ) {
    587  1.1  christos 			subobj_type = EXTRACT_16BITS(obj_tptr+offset)>>8;
    588  1.1  christos 			subobj_len  = EXTRACT_16BITS(obj_tptr+offset)&0x00FF;
    589  1.6  christos 			ND_PRINT((ndo, "\n\t    Subobject, Type: %s (%u), Length: %u",
    590  1.1  christos 				tok2str(lmp_data_link_subobj,
    591  1.1  christos 					"Unknown",
    592  1.1  christos 					subobj_type),
    593  1.1  christos 					subobj_type,
    594  1.6  christos 					subobj_len));
    595  1.1  christos 			switch(subobj_type) {
    596  1.1  christos 			case INT_SWITCHING_TYPE_SUBOBJ:
    597  1.6  christos 				ND_PRINT((ndo, "\n\t      Switching Type: %s (%u)",
    598  1.6  christos 					tok2str(gmpls_switch_cap_values,
    599  1.6  christos 						"Unknown",
    600  1.1  christos 						EXTRACT_16BITS(obj_tptr+offset+2)>>8),
    601  1.6  christos 					EXTRACT_16BITS(obj_tptr+offset+2)>>8));
    602  1.6  christos 				ND_PRINT((ndo, "\n\t      Encoding Type: %s (%u)",
    603  1.6  christos 					tok2str(gmpls_encoding_values,
    604  1.6  christos 						"Unknown",
    605  1.1  christos 						EXTRACT_16BITS(obj_tptr+offset+2)&0x00FF),
    606  1.6  christos 					EXTRACT_16BITS(obj_tptr+offset+2)&0x00FF));
    607  1.1  christos 				bw.i = EXTRACT_32BITS(obj_tptr+offset+4);
    608  1.6  christos 				ND_PRINT((ndo, "\n\t      Min Reservable Bandwidth: %.3f Mbps",
    609  1.6  christos                                        bw.f*8/1000000));
    610  1.1  christos 				bw.i = EXTRACT_32BITS(obj_tptr+offset+8);
    611  1.6  christos 				ND_PRINT((ndo, "\n\t      Max Reservable Bandwidth: %.3f Mbps",
    612  1.6  christos                                        bw.f*8/1000000));
    613  1.6  christos 				break;
    614  1.1  christos 			case WAVELENGTH_SUBOBJ:
    615  1.6  christos 				ND_PRINT((ndo, "\n\t      Wavelength: %u",
    616  1.6  christos 					EXTRACT_32BITS(obj_tptr+offset+4)));
    617  1.1  christos 				break;
    618  1.1  christos 			default:
    619  1.1  christos 				/* Any Unknown Subobject ==> Exit loop */
    620  1.1  christos 				hexdump=TRUE;
    621  1.1  christos 				break;
    622  1.1  christos 			}
    623  1.1  christos 			total_subobj_len-=subobj_len;
    624  1.1  christos 			offset+=subobj_len;
    625  1.1  christos 		}
    626  1.6  christos 
    627  1.1  christos 		break;
    628  1.6  christos #ifdef INET6
    629  1.1  christos 	    case LMP_CTYPE_IPV6:
    630  1.1  christos #endif
    631  1.1  christos             default:
    632  1.1  christos                 hexdump=TRUE;
    633  1.1  christos             }
    634  1.6  christos             break;
    635  1.6  christos 
    636  1.1  christos         case LMP_OBJ_VERIFY_BEGIN:
    637  1.1  christos 	    switch(lmp_obj_ctype) {
    638  1.1  christos             case LMP_CTYPE_1:
    639  1.6  christos 		ND_PRINT((ndo, "\n\t    Flags: %s",
    640  1.1  christos 		bittok2str(lmp_obj_begin_verify_flag_values,
    641  1.1  christos 			"none",
    642  1.6  christos 			EXTRACT_16BITS(obj_tptr))));
    643  1.6  christos 		ND_PRINT((ndo, "\n\t    Verify Interval: %u",
    644  1.6  christos 			EXTRACT_16BITS(obj_tptr+2)));
    645  1.6  christos 		ND_PRINT((ndo, "\n\t    Data links: %u",
    646  1.6  christos 			EXTRACT_32BITS(obj_tptr+4)));
    647  1.6  christos                 ND_PRINT((ndo, "\n\t    Encoding type: %s",
    648  1.6  christos 			tok2str(gmpls_encoding_values, "Unknown", *(obj_tptr+8))));
    649  1.6  christos                 ND_PRINT((ndo, "\n\t    Verify Transport Mechanism: %u (0x%x)%s",
    650  1.1  christos 			EXTRACT_16BITS(obj_tptr+10),
    651  1.1  christos 			EXTRACT_16BITS(obj_tptr+10),
    652  1.6  christos 			EXTRACT_16BITS(obj_tptr+10)&8000 ? " (Payload test messages capable)" : ""));
    653  1.1  christos                 bw.i = EXTRACT_32BITS(obj_tptr+12);
    654  1.6  christos 		ND_PRINT((ndo, "\n\t    Transmission Rate: %.3f Mbps",bw.f*8/1000000));
    655  1.6  christos 		ND_PRINT((ndo, "\n\t    Wavelength: %u",
    656  1.6  christos 			EXTRACT_32BITS(obj_tptr+16)));
    657  1.1  christos 		break;
    658  1.6  christos 
    659  1.1  christos             default:
    660  1.1  christos                 hexdump=TRUE;
    661  1.1  christos             }
    662  1.6  christos             break;
    663  1.6  christos 
    664  1.1  christos         case LMP_OBJ_VERIFY_BEGIN_ACK:
    665  1.1  christos 	    switch(lmp_obj_ctype) {
    666  1.1  christos             case LMP_CTYPE_1:
    667  1.6  christos                 ND_PRINT((ndo, "\n\t    Verify Dead Interval: %u"
    668  1.5  christos                        "\n\t    Verify Transport Response: %u",
    669  1.1  christos                        EXTRACT_16BITS(obj_tptr),
    670  1.6  christos                        EXTRACT_16BITS(obj_tptr+2)));
    671  1.1  christos                 break;
    672  1.6  christos 
    673  1.1  christos             default:
    674  1.1  christos                 hexdump=TRUE;
    675  1.1  christos             }
    676  1.6  christos             break;
    677  1.6  christos 
    678  1.1  christos 	case LMP_OBJ_VERIFY_ID:
    679  1.1  christos 	    switch(lmp_obj_ctype) {
    680  1.1  christos             case LMP_CTYPE_1:
    681  1.6  christos                 ND_PRINT((ndo, "\n\t    Verify ID: %u",
    682  1.6  christos                        EXTRACT_32BITS(obj_tptr)));
    683  1.1  christos                 break;
    684  1.6  christos 
    685  1.1  christos             default:
    686  1.1  christos                 hexdump=TRUE;
    687  1.1  christos             }
    688  1.6  christos             break;
    689  1.6  christos 
    690  1.1  christos 	case LMP_OBJ_CHANNEL_STATUS:
    691  1.1  christos             switch(lmp_obj_ctype) {
    692  1.1  christos 	    case LMP_CTYPE_IPV4:
    693  1.1  christos 	    case LMP_CTYPE_UNMD:
    694  1.1  christos 		offset = 0;
    695  1.1  christos 		/* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
    696  1.1  christos 		while (offset < (lmp_obj_len-(int)sizeof(struct lmp_object_header)) ) {
    697  1.6  christos 			ND_PRINT((ndo, "\n\t    Interface ID: %s (0x%08x)",
    698  1.6  christos 			ipaddr_string(ndo, obj_tptr+offset),
    699  1.6  christos 			EXTRACT_32BITS(obj_tptr+offset)));
    700  1.6  christos 
    701  1.6  christos 			ND_PRINT((ndo, "\n\t\t    Active: %s (%u)", 		(EXTRACT_32BITS(obj_tptr+offset+4)>>31) ?
    702  1.1  christos 						"Allocated" : "Non-allocated",
    703  1.6  christos 				(EXTRACT_32BITS(obj_tptr+offset+4)>>31)));
    704  1.6  christos 
    705  1.6  christos 			ND_PRINT((ndo, "\n\t\t    Direction: %s (%u)", (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ?
    706  1.1  christos 						"Transmit" : "Receive",
    707  1.6  christos 				(EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1));
    708  1.6  christos 
    709  1.6  christos 			ND_PRINT((ndo, "\n\t\t    Channel Status: %s (%u)",
    710  1.1  christos 					tok2str(lmp_obj_channel_status_values,
    711  1.1  christos 			 		"Unknown",
    712  1.1  christos 					EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF),
    713  1.6  christos 			EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF));
    714  1.1  christos 			offset+=8;
    715  1.1  christos 		}
    716  1.1  christos                 break;
    717  1.6  christos #ifdef INET6
    718  1.1  christos 	    case LMP_CTYPE_IPV6:
    719  1.1  christos #endif
    720  1.1  christos             default:
    721  1.1  christos                 hexdump=TRUE;
    722  1.1  christos             }
    723  1.6  christos             break;
    724  1.6  christos 
    725  1.1  christos 	case LMP_OBJ_CHANNEL_STATUS_REQ:
    726  1.1  christos             switch(lmp_obj_ctype) {
    727  1.1  christos 	    case LMP_CTYPE_IPV4:
    728  1.1  christos 	    case LMP_CTYPE_UNMD:
    729  1.1  christos 		offset = 0;
    730  1.1  christos 		while (offset < (lmp_obj_len-(int)sizeof(struct lmp_object_header)) ) {
    731  1.6  christos 			ND_PRINT((ndo, "\n\t    Interface ID: %s (0x%08x)",
    732  1.6  christos 			ipaddr_string(ndo, obj_tptr+offset),
    733  1.6  christos 			EXTRACT_32BITS(obj_tptr+offset)));
    734  1.1  christos 			offset+=4;
    735  1.1  christos 		}
    736  1.1  christos                 break;
    737  1.6  christos #ifdef INET6
    738  1.1  christos 	    case LMP_CTYPE_IPV6:
    739  1.1  christos #endif
    740  1.1  christos 	    default:
    741  1.1  christos                 hexdump=TRUE;
    742  1.1  christos             }
    743  1.6  christos             break;
    744  1.6  christos 
    745  1.1  christos         case LMP_OBJ_ERROR_CODE:
    746  1.1  christos 	    switch(lmp_obj_ctype) {
    747  1.1  christos             case LMP_CTYPE_BEGIN_VERIFY_ERROR:
    748  1.6  christos 		ND_PRINT((ndo, "\n\t    Error Code: %s",
    749  1.1  christos 		bittok2str(lmp_obj_begin_verify_error_values,
    750  1.1  christos 			"none",
    751  1.6  christos 			EXTRACT_32BITS(obj_tptr))));
    752  1.1  christos                 break;
    753  1.6  christos 
    754  1.1  christos             case LMP_CTYPE_LINK_SUMMARY_ERROR:
    755  1.6  christos 		ND_PRINT((ndo, "\n\t    Error Code: %s",
    756  1.1  christos 		bittok2str(lmp_obj_link_summary_error_values,
    757  1.1  christos 			"none",
    758  1.6  christos 			EXTRACT_32BITS(obj_tptr))));
    759  1.1  christos                 break;
    760  1.1  christos             default:
    761  1.1  christos                 hexdump=TRUE;
    762  1.1  christos             }
    763  1.6  christos             break;
    764  1.1  christos 
    765  1.1  christos 	case LMP_OBJ_SERVICE_CONFIG:
    766  1.1  christos 	    switch (lmp_obj_ctype) {
    767  1.1  christos 	    case LMP_CTYPE_SERVICE_CONFIG_SP:
    768  1.6  christos 
    769  1.6  christos 		ND_PRINT((ndo, "\n\t Flags: %s",
    770  1.1  christos 		       bittok2str(lmp_obj_service_config_sp_flag_values,
    771  1.6  christos 				  "none",
    772  1.6  christos 				  EXTRACT_16BITS(obj_tptr)>>8)));
    773  1.1  christos 
    774  1.6  christos 		ND_PRINT((ndo, "\n\t  UNI Version: %u",
    775  1.6  christos 		       EXTRACT_16BITS(obj_tptr) & 0x00FF));
    776  1.1  christos 
    777  1.1  christos 		break;
    778  1.6  christos 
    779  1.1  christos             case LMP_CTYPE_SERVICE_CONFIG_CPSA:
    780  1.6  christos 
    781  1.1  christos 		link_type = EXTRACT_16BITS(obj_tptr)>>8;
    782  1.6  christos 
    783  1.6  christos 		ND_PRINT((ndo, "\n\t Link Type: %s (%u)",
    784  1.1  christos 		       tok2str(lmp_sd_service_config_cpsa_link_type_values,
    785  1.1  christos 			       "Unknown", link_type),
    786  1.6  christos 		       link_type));
    787  1.6  christos 
    788  1.1  christos 		if (link_type == LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH) {
    789  1.6  christos 		    ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
    790  1.1  christos 			   tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values,
    791  1.1  christos 				   "Unknown",
    792  1.1  christos 				   EXTRACT_16BITS(obj_tptr) & 0x00FF),
    793  1.6  christos 			   EXTRACT_16BITS(obj_tptr) & 0x00FF));
    794  1.1  christos 		}
    795  1.6  christos 
    796  1.1  christos 		if (link_type == LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET) {
    797  1.6  christos 		    ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
    798  1.1  christos 			   tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values,
    799  1.1  christos 				   "Unknown",
    800  1.1  christos 				   EXTRACT_16BITS(obj_tptr) & 0x00FF),
    801  1.6  christos 			   EXTRACT_16BITS(obj_tptr) & 0x00FF));
    802  1.1  christos 		}
    803  1.6  christos 
    804  1.6  christos 		ND_PRINT((ndo, "\n\t Transparency: %s",
    805  1.1  christos 		       bittok2str(lmp_obj_service_config_cpsa_tp_flag_values,
    806  1.1  christos 				  "none",
    807  1.6  christos 				  EXTRACT_16BITS(obj_tptr+2)>>8)));
    808  1.6  christos 
    809  1.6  christos 		ND_PRINT((ndo, "\n\t Contiguous Concatenation Types: %s",
    810  1.1  christos 		       bittok2str(lmp_obj_service_config_cpsa_cct_flag_values,
    811  1.1  christos 				  "none",
    812  1.6  christos 				  EXTRACT_16BITS(obj_tptr+2)>>8 & 0x00FF)));
    813  1.6  christos 
    814  1.6  christos 		ND_PRINT((ndo, "\n\t Minimum NCC: %u",
    815  1.6  christos 		       EXTRACT_16BITS(obj_tptr+4)));
    816  1.6  christos 
    817  1.6  christos 		ND_PRINT((ndo, "\n\t Maximum NCC: %u",
    818  1.6  christos 		       EXTRACT_16BITS(obj_tptr+6)));
    819  1.6  christos 
    820  1.6  christos 		ND_PRINT((ndo, "\n\t Minimum NVC:%u",
    821  1.6  christos 		       EXTRACT_16BITS(obj_tptr+8)));
    822  1.6  christos 
    823  1.6  christos 		ND_PRINT((ndo, "\n\t Maximum NVC:%u",
    824  1.6  christos 		       EXTRACT_16BITS(obj_tptr+10)));
    825  1.6  christos 
    826  1.6  christos 		ND_PRINT((ndo, "\n\t    Local Interface ID: %s (0x%08x)",
    827  1.6  christos 		       ipaddr_string(ndo, obj_tptr+12),
    828  1.6  christos 		       EXTRACT_32BITS(obj_tptr+12)));
    829  1.6  christos 
    830  1.1  christos 		break;
    831  1.6  christos 
    832  1.1  christos 	    case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM:
    833  1.6  christos 
    834  1.6  christos 		ND_PRINT((ndo, "\n\t Transparency Flags: %s",
    835  1.1  christos 		       bittok2str(
    836  1.1  christos 			   lmp_obj_service_config_nsa_transparency_flag_values,
    837  1.1  christos 			   "none",
    838  1.6  christos 			   EXTRACT_32BITS(obj_tptr))));
    839  1.1  christos 
    840  1.6  christos 		ND_PRINT((ndo, "\n\t TCM Monitoring Flags: %s",
    841  1.1  christos 		       bittok2str(
    842  1.1  christos 			   lmp_obj_service_config_nsa_tcm_flag_values,
    843  1.1  christos 			   "none",
    844  1.6  christos 			   EXTRACT_16BITS(obj_tptr+6) & 0x00FF)));
    845  1.6  christos 
    846  1.1  christos 		break;
    847  1.6  christos 
    848  1.1  christos 	    case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY:
    849  1.6  christos 
    850  1.6  christos 		ND_PRINT((ndo, "\n\t Diversity: Flags: %s",
    851  1.1  christos 		       bittok2str(
    852  1.1  christos 			   lmp_obj_service_config_nsa_network_diversity_flag_values,
    853  1.1  christos 			   "none",
    854  1.6  christos 			   EXTRACT_16BITS(obj_tptr+2) & 0x00FF)));
    855  1.1  christos 		break;
    856  1.1  christos 
    857  1.1  christos 	    default:
    858  1.1  christos 		hexdump = TRUE;
    859  1.1  christos 	    };
    860  1.1  christos 
    861  1.1  christos 	break;
    862  1.1  christos 
    863  1.1  christos         default:
    864  1.6  christos             if (ndo->ndo_vflag <= 1)
    865  1.6  christos                 print_unknown_data(ndo,obj_tptr,"\n\t    ",obj_tlen);
    866  1.1  christos             break;
    867  1.1  christos         }
    868  1.1  christos         /* do we want to see an additionally hexdump ? */
    869  1.6  christos         if (ndo->ndo_vflag > 1 || hexdump==TRUE)
    870  1.6  christos             print_unknown_data(ndo,tptr+sizeof(struct lmp_object_header),"\n\t    ",
    871  1.1  christos                                lmp_obj_len-sizeof(struct lmp_object_header));
    872  1.1  christos 
    873  1.1  christos         tptr+=lmp_obj_len;
    874  1.1  christos         tlen-=lmp_obj_len;
    875  1.1  christos     }
    876  1.1  christos     return;
    877  1.1  christos trunc:
    878  1.6  christos     ND_PRINT((ndo, "\n\t\t packet exceeded snapshot"));
    879  1.1  christos }
    880  1.6  christos /*
    881  1.6  christos  * Local Variables:
    882  1.6  christos  * c-style: whitesmith
    883  1.6  christos  * c-basic-offset: 8
    884  1.6  christos  * End:
    885  1.6  christos  */
    886