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