Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-isis-snp.c
blob3d4f13328b96effb67f8798dfc54619a70534d25
1 /* packet-isis-snp.c
2 * Routines for decoding isis complete & partial SNP and their payload
4 * Stuart Stanley <stuarts@mxmail.net>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include "config.h"
15 #include <epan/packet.h>
16 #include <epan/expert.h>
17 #include "packet-osi.h"
18 #include "packet-isis.h"
19 #include "packet-isis-clv.h"
21 void proto_register_isis_csnp(void);
22 void proto_reg_handoff_isis_csnp(void);
23 void proto_register_isis_psnp(void);
24 void proto_reg_handoff_isis_psnp(void);
25 void proto_register_isis_lsp(void);
26 void proto_reg_handoff_isis_lsp(void);
27 void proto_register_isis_hello(void);
28 void proto_reg_handoff_isis_hello(void);
30 static int proto_isis_csnp;
31 static int proto_isis_psnp;
33 /* csnp packets */
34 static int hf_isis_csnp_pdu_length;
35 static int hf_isis_csnp_source_id;
36 static int hf_isis_csnp_source_circuit;
37 static int hf_isis_csnp_start_lsp_id;
38 static int hf_isis_csnp_end_lsp_id;
39 static int hf_isis_csnp_lsp_id;
40 static int hf_isis_csnp_lsp_seq_num;
41 static int hf_isis_csnp_lsp_remain_life;
42 static int hf_isis_csnp_lsp_checksum;
43 static int hf_isis_csnp_checksum;
44 static int hf_isis_csnp_checksum_status;
45 static int hf_isis_csnp_clv_type;
46 static int hf_isis_csnp_clv_length;
47 static int hf_isis_csnp_ip_authentication;
48 static int hf_isis_csnp_authentication;
49 static int hf_isis_csnp_instance_identifier;
50 static int hf_isis_csnp_supported_itid;
51 static int ett_isis_csnp;
52 static int ett_isis_csnp_clv_lsp_entries;
53 static int ett_isis_csnp_lsp_entry;
54 static int ett_isis_csnp_clv_authentication;
55 static int ett_isis_csnp_clv_ip_authentication;
56 static int ett_isis_csnp_clv_instance_identifier;
57 static int ett_isis_csnp_clv_checksum;
58 static int ett_isis_csnp_clv_unknown;
60 static expert_field ei_isis_csnp_short_pdu;
61 static expert_field ei_isis_csnp_long_pdu;
62 static expert_field ei_isis_csnp_bad_checksum;
63 static expert_field ei_isis_csnp_authentication;
64 static expert_field ei_isis_csnp_short_clv;
65 static expert_field ei_isis_csnp_clv_unknown;
67 /* psnp packets */
68 static int hf_isis_psnp_pdu_length;
69 static int hf_isis_psnp_source_id;
70 static int hf_isis_psnp_source_circuit;
71 static int hf_isis_psnp_clv_type;
72 static int hf_isis_psnp_clv_length;
73 static int hf_isis_psnp_ip_authentication;
74 static int ett_isis_psnp;
75 static int ett_isis_psnp_clv_lsp_entries;
76 static int ett_isis_psnp_lsp_entry;
77 static int ett_isis_psnp_clv_authentication;
78 static int ett_isis_psnp_clv_ip_authentication;
79 static int ett_isis_psnp_clv_checksum;
80 static int ett_isis_psnp_clv_unknown;
82 static expert_field ei_isis_psnp_short_pdu;
83 static expert_field ei_isis_psnp_long_pdu;
84 static expert_field ei_isis_psnp_short_clv;
85 static expert_field ei_isis_psnp_clv_unknown;
87 static void
88 dissect_snp_authentication_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
89 isis_data_t *isis _U_, int length)
91 isis_dissect_authentication_clv(tree, pinfo, tvb, hf_isis_csnp_authentication, hf_isis_clv_key_id, &ei_isis_csnp_authentication, offset, length);
94 static void
95 dissect_csnp_ip_authentication_clv(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, int offset,
96 isis_data_t *isis _U_, int length)
98 if ( length != 0 ) {
99 proto_tree_add_item(tree, hf_isis_csnp_ip_authentication, tvb, offset, length, ENC_ASCII);
103 static void
104 dissect_psnp_ip_authentication_clv(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, int offset,
105 isis_data_t *isis _U_, int length)
107 if ( length != 0 ) {
108 proto_tree_add_item(tree, hf_isis_psnp_ip_authentication, tvb, offset, length, ENC_ASCII);
113 * Name: dissect_snp_checksum_clv()
115 * Description:
116 * dump and verify the optional checksum in TLV 12
118 static void
119 dissect_snp_checksum_clv(tvbuff_t *tvb, packet_info* pinfo,
120 proto_tree *tree, int offset, isis_data_t *isis, int length) {
122 uint16_t checksum, cacl_checksum=0;
124 if ( length != 2 ) {
125 proto_tree_add_expert_format(tree, pinfo, &ei_isis_csnp_short_clv, tvb, offset, -1,
126 "incorrect checksum length (%u), should be (2)", length );
127 return;
131 checksum = tvb_get_ntohs(tvb, offset);
133 if (checksum == 0) {
134 /* No checksum present */
135 proto_tree_add_checksum(tree, tvb, offset, hf_isis_csnp_checksum, hf_isis_csnp_checksum_status, &ei_isis_csnp_bad_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT);
136 } else {
137 if (osi_check_and_get_checksum(tvb, 0, isis->pdu_length, offset, &cacl_checksum)) {
138 /* Successfully processed checksum, verify it */
139 proto_tree_add_checksum(tree, tvb, offset, hf_isis_csnp_checksum, hf_isis_csnp_checksum_status, &ei_isis_csnp_bad_checksum, pinfo, cacl_checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
140 } else {
141 /* We didn't capture the entire packet, so we can't verify it */
142 proto_tree_add_checksum(tree, tvb, offset, hf_isis_csnp_checksum, hf_isis_csnp_checksum_status, &ei_isis_csnp_bad_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
148 * Name: dissect_snp_lsp_entries_clv()
150 * Description:
151 * All the snp packets use a common payload format. We have up
152 * to n entries (based on length), which are made of:
153 * 2 : remaining life time
154 * isis->system_id_len : lsp id
155 * 4 : sequence number
156 * 2 : checksum
158 static void
159 dissect_snp_lsp_entries_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
160 isis_data_t *isis, int length)
162 proto_tree *subtree;
164 while ( length > 0 ) {
165 if ( length < 2+isis->system_id_len+2+4+2 ) {
166 proto_tree_add_expert_format(tree, pinfo, &ei_isis_csnp_short_clv, tvb, offset, -1,
167 "Short SNP header entry (%d vs %d)", length, 2+isis->system_id_len+2+4+2 );
168 return;
171 subtree = proto_tree_add_subtree(tree, tvb, offset, 2+isis->system_id_len+2+4+2,
172 ett_isis_csnp_lsp_entry, NULL, "LSP Entry");
174 proto_tree_add_item(tree, hf_isis_csnp_lsp_id, tvb, offset+2, isis->system_id_len+2, ENC_NA);
176 proto_tree_add_item(subtree, hf_isis_csnp_lsp_seq_num, tvb, offset+2+isis->system_id_len+2, 4, ENC_BIG_ENDIAN);
177 proto_tree_add_item(subtree, hf_isis_csnp_lsp_remain_life, tvb, offset, 2, ENC_BIG_ENDIAN);
178 proto_tree_add_item(subtree, hf_isis_csnp_lsp_checksum, tvb, offset+2+isis->system_id_len+2+4, 2, ENC_BIG_ENDIAN);
180 length -= 2+isis->system_id_len+2+4+2;
181 offset += 2+isis->system_id_len+2+4+2;
187 * Name: dissect_snp_instance_identifier_clv()
189 * Description:
190 * Decode for a snp packets Instance Identifier clv.
191 * Calls into the CLV common one.
193 * Input:
194 * tvbuff_t * : tvbuffer for packet data
195 * proto_tree * : proto tree to build on (may be null)
196 * int : current offset into packet data
197 * int : length of IDs in packet.
198 * int : length of this clv
200 * Output:
201 * void, will modify proto_tree if not null.
203 static void
204 dissect_snp_instance_identifier_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
205 proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
207 isis_dissect_instance_identifier_clv(tree, pinfo, tvb, &ei_isis_csnp_short_clv, hf_isis_csnp_instance_identifier, hf_isis_csnp_supported_itid, offset, length);
210 static const isis_clv_handle_t clv_l1_csnp_opts[] = {
212 ISIS_CLV_INSTANCE_IDENTIFIER,
213 "Instance Identifier",
214 &ett_isis_csnp_clv_instance_identifier,
215 dissect_snp_instance_identifier_clv
218 ISIS_CLV_LSP_ENTRIES,
219 "LSP entries",
220 &ett_isis_csnp_clv_lsp_entries,
221 dissect_snp_lsp_entries_clv
224 ISIS_CLV_AUTHENTICATION,
225 "Authentication",
226 &ett_isis_csnp_clv_authentication,
227 dissect_snp_authentication_clv
230 ISIS_CLV_IP_AUTHENTICATION,
231 "IP Authentication",
232 &ett_isis_csnp_clv_ip_authentication,
233 dissect_csnp_ip_authentication_clv
236 ISIS_CLV_CHECKSUM,
237 "Checksum",
238 &ett_isis_csnp_clv_checksum,
239 dissect_snp_checksum_clv
242 0, "", NULL, NULL
246 static const isis_clv_handle_t clv_l2_csnp_opts[] = {
248 ISIS_CLV_INSTANCE_IDENTIFIER,
249 "Instance Identifier",
250 &ett_isis_csnp_clv_instance_identifier,
251 dissect_snp_instance_identifier_clv
254 ISIS_CLV_LSP_ENTRIES,
255 "LSP entries",
256 &ett_isis_csnp_clv_lsp_entries,
257 dissect_snp_lsp_entries_clv
260 ISIS_CLV_AUTHENTICATION,
261 "Authentication",
262 &ett_isis_csnp_clv_authentication,
263 dissect_snp_authentication_clv
266 ISIS_CLV_IP_AUTHENTICATION,
267 "IP Authentication",
268 &ett_isis_csnp_clv_ip_authentication,
269 dissect_csnp_ip_authentication_clv
272 ISIS_CLV_CHECKSUM,
273 "Checksum",
274 &ett_isis_csnp_clv_checksum,
275 dissect_snp_checksum_clv
278 0, "", NULL, NULL
282 static const isis_clv_handle_t clv_l1_psnp_opts[] = {
284 ISIS_CLV_INSTANCE_IDENTIFIER,
285 "Instance Identifier",
286 &ett_isis_csnp_clv_instance_identifier,
287 dissect_snp_instance_identifier_clv
290 ISIS_CLV_LSP_ENTRIES,
291 "LSP entries",
292 &ett_isis_psnp_clv_lsp_entries,
293 dissect_snp_lsp_entries_clv
296 ISIS_CLV_AUTHENTICATION,
297 "Authentication",
298 &ett_isis_psnp_clv_authentication,
299 dissect_snp_authentication_clv
302 ISIS_CLV_IP_AUTHENTICATION,
303 "IP Authentication",
304 &ett_isis_psnp_clv_ip_authentication,
305 dissect_psnp_ip_authentication_clv
308 ISIS_CLV_CHECKSUM,
309 "Checksum",
310 &ett_isis_psnp_clv_checksum,
311 dissect_snp_checksum_clv
314 0, "", NULL, NULL
318 static const isis_clv_handle_t clv_l2_psnp_opts[] = {
320 ISIS_CLV_INSTANCE_IDENTIFIER,
321 "Instance Identifier",
322 &ett_isis_csnp_clv_instance_identifier,
323 dissect_snp_instance_identifier_clv
326 ISIS_CLV_LSP_ENTRIES,
327 "LSP entries",
328 &ett_isis_psnp_clv_lsp_entries,
329 dissect_snp_lsp_entries_clv
332 ISIS_CLV_AUTHENTICATION,
333 "Authentication",
334 &ett_isis_psnp_clv_authentication,
335 dissect_snp_authentication_clv
338 ISIS_CLV_IP_AUTHENTICATION,
339 "IP Authentication",
340 &ett_isis_psnp_clv_ip_authentication,
341 dissect_psnp_ip_authentication_clv
344 ISIS_CLV_CHECKSUM,
345 "Checksum",
346 &ett_isis_psnp_clv_checksum,
347 dissect_snp_checksum_clv
350 0, "", NULL, NULL
354 static void
355 dissect_isis_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
356 const isis_clv_handle_t *opts, isis_data_t *isis)
358 proto_item *ti;
359 proto_tree *csnp_tree = NULL;
360 uint16_t pdu_length;
361 bool pdu_length_too_short = false;
364 * We are passed a tvbuff for the entire ISIS PDU, because some ISIS
365 * PDUs may contain a checksum CLV, and that's a checksum covering
366 * the entire PDU. Skip the part of the header that's already been
367 * dissected.
369 offset += 8;
371 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISIS CSNP");
373 ti = proto_tree_add_item(tree, proto_isis_csnp, tvb, offset, -1, ENC_NA);
374 csnp_tree = proto_item_add_subtree(ti, ett_isis_csnp);
376 if (isis->header_length < 8 + 2) {
377 /* Not large enough to include the part of the header that
378 we dissect here. */
379 expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
380 return;
382 pdu_length = tvb_get_ntohs(tvb, offset);
383 ti = proto_tree_add_uint(csnp_tree, hf_isis_csnp_pdu_length, tvb,
384 offset, 2, pdu_length);
385 if (pdu_length < isis->header_length) {
386 expert_add_info(pinfo, ti, &ei_isis_csnp_short_pdu);
387 pdu_length_too_short = true;
388 } else if (pdu_length > tvb_reported_length(tvb) + isis->header_length) {
389 expert_add_info(pinfo, ti, &ei_isis_csnp_long_pdu);
391 offset += 2;
393 if (isis->header_length < 8 + 2 + isis->system_id_len + 1) {
394 /* Not large enough to include the part of the header that
395 we dissect here. */
396 expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
397 return;
399 /* ISO 10589:2002 9.10 "Source ID – the system ID of Intermediate System (with zero Circuit ID)" */
400 proto_tree_add_item(csnp_tree, hf_isis_csnp_source_id, tvb, offset, isis->system_id_len, ENC_NA);
401 col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", tvb_print_system_id( pinfo->pool, tvb, offset, isis->system_id_len+1 ));
402 offset += isis->system_id_len;
403 proto_tree_add_item(csnp_tree, hf_isis_csnp_source_circuit, tvb, offset, 1, ENC_NA);
404 offset++;
406 if (isis->header_length < 8 + 2 + isis->system_id_len + 1 + isis->system_id_len + 2) {
407 /* Not large enough to include the part of the header that
408 we dissect here. */
409 expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
410 return;
412 proto_tree_add_item(csnp_tree, hf_isis_csnp_start_lsp_id, tvb, offset, isis->system_id_len + 2, ENC_NA);
413 col_append_fstr(pinfo->cinfo, COL_INFO, ", Start LSP-ID: %s",
414 tvb_print_system_id( pinfo->pool, tvb, offset, isis->system_id_len+2 ));
415 offset += isis->system_id_len + 2;
417 proto_tree_add_item(csnp_tree, hf_isis_csnp_end_lsp_id, tvb, offset, isis->system_id_len + 2, ENC_NA);
418 col_append_fstr(pinfo->cinfo, COL_INFO, ", End LSP-ID: %s",
419 tvb_print_system_id( pinfo->pool, tvb, offset, isis->system_id_len+2 ));
420 offset += isis->system_id_len + 2;
422 if (pdu_length_too_short) {
423 return;
425 isis->pdu_length = pdu_length;
426 isis_dissect_clvs(tvb, pinfo, csnp_tree, offset,
427 opts, &ei_isis_csnp_short_clv, isis, ett_isis_csnp_clv_unknown,
428 hf_isis_csnp_clv_type, hf_isis_csnp_clv_length,
429 &ei_isis_csnp_clv_unknown);
433 static int
434 dissect_isis_l1_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
436 isis_data_t* isis = (isis_data_t*)data;
437 dissect_isis_csnp(tvb, pinfo, tree, 0, clv_l1_csnp_opts, isis);
438 return tvb_captured_length(tvb);
441 static int
442 dissect_isis_l2_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
444 isis_data_t* isis = (isis_data_t*)data;
445 dissect_isis_csnp(tvb, pinfo, tree, 0, clv_l2_csnp_opts, isis);
446 return tvb_captured_length(tvb);
449 static void
450 dissect_isis_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
451 const isis_clv_handle_t *opts, isis_data_t *isis)
453 proto_item *ti;
454 proto_tree *psnp_tree;
455 uint16_t pdu_length;
456 bool pdu_length_too_short = false;
459 * We are passed a tvbuff for the entire ISIS PDU, because some ISIS
460 * PDUs may contain a checksum CLV, and that's a checksum covering
461 * the entire PDU. Skip the part of the header that's already been
462 * dissected.
464 offset += 8;
466 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISIS PSNP");
468 ti = proto_tree_add_item(tree, proto_isis_psnp, tvb, offset, -1, ENC_NA);
469 psnp_tree = proto_item_add_subtree(ti, ett_isis_psnp);
471 if (isis->header_length < 8 + 2) {
472 /* Not large enough to include the part of the header that
473 we dissect here. */
474 expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
475 return;
477 pdu_length = tvb_get_ntohs(tvb, offset);
478 ti = proto_tree_add_uint(psnp_tree, hf_isis_psnp_pdu_length, tvb,
479 offset, 2, pdu_length);
480 if (pdu_length < isis->header_length) {
481 expert_add_info(pinfo, ti, &ei_isis_psnp_short_pdu);
482 pdu_length_too_short = true;
483 } else if (pdu_length > tvb_reported_length(tvb) + isis->header_length) {
484 expert_add_info(pinfo, ti, &ei_isis_psnp_long_pdu);
486 offset += 2;
488 if (isis->header_length < 8 + 2 + isis->system_id_len + 1) {
489 /* Not large enough to include the part of the header that
490 we dissect here. */
491 expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
492 return;
494 /* ISO 10589:2002 9.10 "Source ID – the system ID of Intermediate System (with zero Circuit ID)" */
495 proto_tree_add_item(psnp_tree, hf_isis_psnp_source_id, tvb, offset, isis->system_id_len, ENC_NA);
496 col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", tvb_print_system_id( pinfo->pool, tvb, offset, isis->system_id_len+1 ));
497 offset += isis->system_id_len;
498 proto_tree_add_item(psnp_tree, hf_isis_psnp_source_circuit, tvb, offset, 1, ENC_NA);
499 offset++;
501 if (pdu_length_too_short) {
502 return;
504 isis->pdu_length = pdu_length;
505 isis_dissect_clvs(tvb, pinfo, psnp_tree, offset,
506 opts, &ei_isis_psnp_short_clv, isis, ett_isis_psnp_clv_unknown,
507 hf_isis_psnp_clv_type, hf_isis_psnp_clv_length,
508 &ei_isis_psnp_clv_unknown);
511 static int
512 dissect_isis_l1_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
514 isis_data_t* isis = (isis_data_t*)data;
515 dissect_isis_psnp(tvb, pinfo, tree, 0, clv_l1_psnp_opts, isis);
516 return tvb_captured_length(tvb);
519 static int
520 dissect_isis_l2_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
522 isis_data_t* isis = (isis_data_t*)data;
523 dissect_isis_psnp(tvb, pinfo, tree, 0, clv_l2_psnp_opts, isis);
524 return tvb_captured_length(tvb);
527 void
528 proto_register_isis_csnp(void)
530 static hf_register_info hf[] = {
531 { &hf_isis_csnp_pdu_length,
532 { "PDU length", "isis.csnp.pdu_length", FT_UINT16,
533 BASE_DEC, NULL, 0x0, NULL, HFILL }},
534 { &hf_isis_csnp_source_id,
535 { "Source-ID", "isis.csnp.source_id",
536 FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
537 { &hf_isis_csnp_source_circuit,
538 { "Source-ID-Circuit", "isis.csnp.source_circuit",
539 FT_BYTES, BASE_NONE, NULL, 0x0, "Must be Zero", HFILL }},
540 { &hf_isis_csnp_start_lsp_id,
541 { "Start LSP-ID", "isis.csnp.start_lsp_id",
542 FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
543 { &hf_isis_csnp_end_lsp_id,
544 { "End LSP-ID", "isis.csnp.end_lsp_id",
545 FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
546 { &hf_isis_csnp_lsp_id,
547 { "LSP-ID", "isis.csnp.lsp_id",
548 FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
549 { &hf_isis_csnp_lsp_seq_num,
550 { "LSP Sequence Number", "isis.csnp.lsp_seq_num", FT_UINT32,
551 BASE_HEX, NULL, 0x0, NULL, HFILL }},
552 { &hf_isis_csnp_lsp_remain_life,
553 { "Remaining Lifetime", "isis.csnp.lsp_remain_life", FT_UINT16,
554 BASE_DEC, NULL, 0x0, NULL, HFILL }},
555 { &hf_isis_csnp_lsp_checksum,
556 { "LSP checksum", "isis.csnp.lsp_checksum", FT_UINT16,
557 BASE_HEX, NULL, 0x0, NULL, HFILL }},
558 { &hf_isis_csnp_checksum,
559 { "Checksum", "isis.csnp.checksum", FT_UINT16,
560 BASE_HEX, NULL, 0x0, NULL, HFILL }},
561 { &hf_isis_csnp_checksum_status,
562 { "Checksum Status", "isis.csnp.checksum.status", FT_UINT8,
563 BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }},
564 { &hf_isis_csnp_clv_type,
565 { "Type", "isis.csnp.clv.type", FT_UINT8,
566 BASE_DEC, NULL, 0x0, NULL, HFILL }},
567 { &hf_isis_csnp_clv_length,
568 { "Length", "isis.csnp.clv.length", FT_UINT8,
569 BASE_DEC, NULL, 0x0, NULL, HFILL }},
570 { &hf_isis_csnp_ip_authentication,
571 { "IP Authentication", "isis.csnp.ip_authentication", FT_STRING,
572 BASE_NONE, NULL, 0x0, NULL, HFILL }},
573 { &hf_isis_csnp_authentication,
574 { "Authentication", "isis.csnp.authentication", FT_BYTES,
575 BASE_NONE, NULL, 0x0, NULL, HFILL }},
576 { &hf_isis_csnp_instance_identifier,
577 { "Instance Identifier", "isis.csnp.iid", FT_UINT16,
578 BASE_DEC, NULL, 0x0, NULL, HFILL } },
579 { &hf_isis_csnp_supported_itid,
580 { "Supported ITID", "isis.csnp.supported_itid", FT_UINT16,
581 BASE_DEC, NULL, 0x0, NULL, HFILL }},
584 static int *ett[] = {
585 &ett_isis_csnp,
586 &ett_isis_csnp_clv_lsp_entries,
587 &ett_isis_csnp_lsp_entry,
588 &ett_isis_csnp_clv_authentication,
589 &ett_isis_csnp_clv_ip_authentication,
590 &ett_isis_csnp_clv_instance_identifier,
591 &ett_isis_csnp_clv_checksum,
592 &ett_isis_csnp_clv_unknown,
595 static ei_register_info ei[] = {
596 { &ei_isis_csnp_short_pdu, { "isis.csnp.short_pdu", PI_MALFORMED, PI_ERROR, "PDU length less than header length", EXPFILL }},
597 { &ei_isis_csnp_long_pdu, { "isis.csnp.long_pdu", PI_MALFORMED, PI_ERROR, "PDU length greater than packet length", EXPFILL }},
598 { &ei_isis_csnp_bad_checksum, { "isis.csnp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
599 { &ei_isis_csnp_short_clv, { "isis.csnp.short_clv", PI_MALFORMED, PI_ERROR, "Short packet", EXPFILL }},
600 { &ei_isis_csnp_authentication, { "isis.csnp.authentication.unknown", PI_PROTOCOL, PI_WARN, "Unknown authentication type", EXPFILL }},
601 { &ei_isis_csnp_clv_unknown, { "isis.csnp.clv.unknown", PI_UNDECODED, PI_NOTE, "Unknown option", EXPFILL }},
603 expert_module_t* expert_isis_csnp;
605 /* Register the protocol name and description */
606 proto_isis_csnp = proto_register_protocol(PROTO_STRING_CSNP, "ISIS CSNP", "isis.csnp");
608 proto_register_field_array(proto_isis_csnp, hf, array_length(hf));
609 proto_register_subtree_array(ett, array_length(ett));
610 expert_isis_csnp = expert_register_protocol(proto_isis_csnp);
611 expert_register_field_array(expert_isis_csnp, ei, array_length(ei));
614 void
615 proto_reg_handoff_isis_csnp(void)
617 dissector_add_uint("isis.type", ISIS_TYPE_L1_CSNP, create_dissector_handle(dissect_isis_l1_csnp, proto_isis_csnp));
618 dissector_add_uint("isis.type", ISIS_TYPE_L2_CSNP, create_dissector_handle(dissect_isis_l2_csnp, proto_isis_csnp));
621 void
622 proto_register_isis_psnp(void)
624 static hf_register_info hf[] = {
625 { &hf_isis_psnp_pdu_length,
626 { "PDU length", "isis.psnp.pdu_length", FT_UINT16,
627 BASE_DEC, NULL, 0x0, NULL, HFILL }},
628 { &hf_isis_psnp_source_id,
629 { "Source-ID", "isis.psnp.source_id",
630 FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
631 { &hf_isis_psnp_source_circuit,
632 { "Source-ID-Circuit", "isis.psnp.source_circuit",
633 FT_BYTES, BASE_NONE, NULL, 0x0, "Must be Zero", HFILL }},
634 { &hf_isis_psnp_clv_type,
635 { "Type", "isis.psnp.clv.type", FT_UINT8,
636 BASE_DEC, NULL, 0x0, NULL, HFILL }},
637 { &hf_isis_psnp_clv_length,
638 { "Length", "isis.psnp.clv.length", FT_UINT8,
639 BASE_DEC, NULL, 0x0, NULL, HFILL }},
640 { &hf_isis_psnp_ip_authentication,
641 { "IP Authentication", "isis.csnp.ip_authentication", FT_STRING,
642 BASE_NONE, NULL, 0x0, NULL, HFILL }},
645 static int *ett[] = {
646 &ett_isis_psnp,
647 &ett_isis_psnp_clv_lsp_entries,
648 &ett_isis_psnp_lsp_entry,
649 &ett_isis_psnp_clv_authentication,
650 &ett_isis_psnp_clv_ip_authentication,
651 &ett_isis_psnp_clv_checksum,
652 &ett_isis_psnp_clv_unknown,
654 static ei_register_info ei[] = {
655 { &ei_isis_psnp_short_pdu, { "isis.psnp.short_pdu", PI_MALFORMED, PI_ERROR, "PDU length less than header length", EXPFILL }},
656 { &ei_isis_psnp_long_pdu, { "isis.psnp.long_pdu", PI_MALFORMED, PI_ERROR, "PDU length greater than packet length", EXPFILL }},
657 { &ei_isis_psnp_short_clv, { "isis.psnp.short_clv", PI_MALFORMED, PI_ERROR, "Short CLV", EXPFILL }},
658 { &ei_isis_psnp_clv_unknown, { "isis.psnp.clv.unknown", PI_UNDECODED, PI_NOTE, "Unknown option", EXPFILL }},
660 expert_module_t* expert_isis_psnp;
662 /* Register the protocol name and description */
663 proto_isis_psnp = proto_register_protocol(PROTO_STRING_PSNP, "ISIS PSNP", "isis.psnp");
665 proto_register_field_array(proto_isis_psnp, hf, array_length(hf));
666 proto_register_subtree_array(ett, array_length(ett));
667 expert_isis_psnp = expert_register_protocol(proto_isis_psnp);
668 expert_register_field_array(expert_isis_psnp, ei, array_length(ei));
671 void
672 proto_reg_handoff_isis_psnp(void)
674 dissector_add_uint("isis.type", ISIS_TYPE_L1_PSNP, create_dissector_handle(dissect_isis_l1_psnp, proto_isis_psnp));
675 dissector_add_uint("isis.type", ISIS_TYPE_L2_PSNP, create_dissector_handle(dissect_isis_l2_psnp, proto_isis_psnp));
679 * Editor modelines - https://www.wireshark.org/tools/modelines.html
681 * Local variables:
682 * c-basic-offset: 4
683 * tab-width: 8
684 * indent-tabs-mode: nil
685 * End:
687 * vi: set shiftwidth=4 tabstop=8 expandtab:
688 * :indentSize=4:tabSize=8:noTabs=true: