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