HTTPS (almost) everywhere.
[metze/wireshark/wip.git] / epan / dissectors / packet-idrp.c
1 /* packet-idrp.c
2  * ISO 10747 Inter Domain Routing Protocol
3  * Routines for IDRP packet dissection.
4  * Copyright 2013, Mathias Guettler <guettler@web.de>
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * SPDX-License-Identifier: GPL-2.0-or-later
11  */
12 /* Supports:
13  * ISO 10747 Inter Domain Routing Protocol October 18, 1993
14  * TODO:
15  * Validation checksum calculation
16  *
17  */
18
19 #include "config.h"
20
21 #include <math.h>
22
23 #include <epan/packet.h>
24 #include <epan/expert.h>
25 #include <epan/nlpid.h>
26
27 #define IDRP_PROTO "ISO/IEC 10747 (1993): Inter Domain Routing Protocol "
28
29 void proto_register_idrp(void);
30
31 static int proto_idrp = -1;
32 static gint ett_idrp = -1;
33 static gint ett_idrp_sub = -1;
34
35 /* static header */
36 static int hf_idrp_li = -1;
37 static int hf_idrp_type = -1;
38 static int hf_idrp_sequence = -1;
39 static int hf_idrp_ack = -1;
40 static int hf_idrp_credit_offered = -1;
41 static int hf_idrp_credit_avail = -1;
42 static int hf_idrp_validation_pattern = -1;
43 /* OPEN BISPDU */
44 static int hf_idrp_open_version = -1;
45 static int hf_idrp_open_hold_time = -1;
46 static int hf_idrp_open_max_pdu_size = -1;
47 static int hf_idrp_open_src_rdi = -1;
48 static int hf_idrp_open_rib_attr_locally_defined_qos_nsap = -1;
49 static int hf_idrp_open_rib_attr_locally_defined_qos_value = -1;
50 static int hf_idrp_open_rib_attr_locally_defined_qos_metric = -1;
51 static int hf_idrp_open_rib_attr_security_reg_id = -1;
52 static int hf_idrp_open_rib_attr_security_info = -1;
53 static int hf_idrp_open_number_of_confederations = -1;
54 static int hf_idrp_open_confederation = -1;
55 static int hf_idrp_open_authentication_code = -1;
56 static int hf_idrp_open_authentication_data = -1;
57 /* UPDATE BISPDU */
58 static int hf_idrp_update_number_of_unfeasible_routes = -1;
59 static int hf_idrp_update_withdrawn_route = -1;
60 static int hf_idrp_update_path_attr_flag = -1;
61 static int hf_idrp_update_path_attr_type = -1;
62 static int hf_idrp_update_path_attr_length = -1;
63 static int hf_idrp_update_path_attr_route_separator_id = -1;
64 static int hf_idrp_update_path_attr_route_separator_localpref = -1;
65 static int hf_idrp_update_path_attr_ext_info = -1;
66 static int hf_idrp_update_path_attr_rd_path_type = -1;
67 static int hf_idrp_update_path_attr_rd_path_segment_length = -1;
68 static int hf_idrp_update_path_attr_rd_path_rdi = -1;
69 static int hf_idrp_update_path_attr_next_hop_idrp_server = -1;
70 static int hf_idrp_update_path_attr_next_hop_proto_type = -1;
71 static int hf_idrp_update_path_attr_next_hop_proto = -1;
72 static int hf_idrp_update_path_attr_next_hop_rdi = -1;
73 static int hf_idrp_update_path_attr_next_hop_nb_snpa = -1;
74 static int hf_idrp_update_path_attr_next_hop_snpa = -1;
75 static int hf_idrp_update_path_attr_dist_list_incl_nb_rdi = -1;
76 static int hf_idrp_update_path_attr_dist_list_incl_rdi = -1;
77 static int hf_idrp_update_path_attr_dist_list_excl_nb_rdi = -1;
78 static int hf_idrp_update_path_attr_dist_list_excl_rdi = -1;
79 static int hf_idrp_update_path_attr_multi_exit_disc = -1;
80 static int hf_idrp_update_path_attr_transit_delay = -1;
81 static int hf_idrp_update_path_attr_residual_error = -1;
82 static int hf_idrp_update_path_attr_expense = -1;
83 static int hf_idrp_update_path_attr_locally_defined_qos_nsap = -1;
84 static int hf_idrp_update_path_attr_locally_defined_qos_value = -1;
85 static int hf_idrp_update_path_attr_locally_defined_qos_metric = -1;
86 static int hf_idrp_update_path_attr_hierarchicaldecoding = -1;
87 static int hf_idrp_update_path_attr_rd_hop_count = -1;
88 static int hf_idrp_update_path_attr_security_reg_id = -1;
89 static int hf_idrp_update_path_attr_security_info = -1;
90 static int hf_idrp_update_path_attr_capacity = -1;
91 static int hf_idrp_update_path_attr_priority = -1;
92 static int hf_idrp_update_nlri_proto_type = -1;
93 static int hf_idrp_update_nlri_proto_id = -1;
94 static int hf_idrp_update_nlri_addr_length = -1;
95 static int hf_idrp_update_nlri_addr_info_nb_bits = -1;
96 static int hf_idrp_update_nlri_addr_info = -1;
97 /* ERROR BISPDU */
98 static int hf_idrp_error_code = -1;
99 static int hf_idrp_error_open_subcode = -1;
100 static int hf_idrp_error_update_subcode = -1;
101 static int hf_idrp_error_hold_timer_subcode = -1;
102 static int hf_idrp_error_fsm_subcode = -1;
103 static int hf_idrp_error_rib_refresh_subcode = -1;
104 static int hf_idrp_error_data = -1;
105 /* RIB-REFRESH BISPDU */
106 static int hf_idrp_rib_refresh_opcode = -1;
107 static int hf_idrp_rib_refresh_rib_attr_locally_defined_qos_nsap = -1;
108 static int hf_idrp_rib_refresh_rib_attr_locally_defined_qos_value = -1;
109 static int hf_idrp_rib_refresh_rib_attr_locally_defined_qos_metric = -1;
110 static int hf_idrp_rib_refresh_rib_attr_security_reg_id = -1;
111 static int hf_idrp_rib_refresh_rib_attr_security_info = -1;
112
113 static expert_field ei_idrp_no_path_attributes = EI_INIT;
114
115 /* flags */
116 #define IDRP_UPDATE_PATH_FLAG_OPTIONAL                    0x80
117 #define IDRP_UPDATE_PATH_FLAG_OPTIONAL_TRANSITIVE         0xc0
118 #define IDRP_UPDATE_PATH_FLAG_OPTIONAL_TRANSITIVE_PARTIAL 0xe0
119 #define IDRP_UPDATE_PATH_FLAG_TRANSITIVE                  0x40
120 #define IDRP_UPDATE_PATH_FLAG_PARTIAL                     0x20
121 static const value_string idrp_path_attr_flags[] = {
122     {IDRP_UPDATE_PATH_FLAG_OPTIONAL,
123      "Optional"},
124     {IDRP_UPDATE_PATH_FLAG_TRANSITIVE,
125      "Transitive"},
126     {IDRP_UPDATE_PATH_FLAG_PARTIAL,
127      "Partial"},
128     {IDRP_UPDATE_PATH_FLAG_OPTIONAL_TRANSITIVE,
129      "Optional, Transitive"},
130     {IDRP_UPDATE_PATH_FLAG_OPTIONAL_TRANSITIVE_PARTIAL,
131      "Optional, Transitive, Partial"},
132     {0, NULL}
133 };
134
135   /* BISPDU Type Codes */
136 #define IDRP_TYPE_OPEN        1
137 #define IDRP_TYPE_UPDATE      2
138 #define IDRP_TYPE_ERROR       3
139 #define IDRP_TYPE_KEEPALIVE   4
140 #define IDRP_TYPE_CEASE       5
141 #define IDRP_TYPE_RIB_REFRESH 6
142 static const value_string idrp_pdu_types[] = {
143     {IDRP_TYPE_OPEN,        "OPEN"},
144     {IDRP_TYPE_UPDATE,      "UPDATE"},
145     {IDRP_TYPE_ERROR,       "ERROR"},
146     {IDRP_TYPE_KEEPALIVE,   "KEEPALIVE"},
147     {IDRP_TYPE_CEASE,       "CEASE"},
148     {IDRP_TYPE_RIB_REFRESH, "RIB REFRESH"},
149     {0, NULL}
150 };
151
152 #define IDRP_OPEN_AUTHENTICATION_CODE_INTEGRITY_ONLY                0
153 #define IDRP_OPEN_AUTHENTICATION_CODE_INTEGRITY_PLUS_AUTHENTICATION 1
154 #define IDRP_OPEN_AUTHENTICATION_CODE_INTEGRITY_PLUS_SECRET_TEXT    2
155 static const value_string idrp_pdu_open_authentication_codes[] = {
156     {IDRP_OPEN_AUTHENTICATION_CODE_INTEGRITY_ONLY,
157         "Integrity Only"},
158     {IDRP_OPEN_AUTHENTICATION_CODE_INTEGRITY_PLUS_AUTHENTICATION,
159         "Integrity plus authentication"},
160     {IDRP_OPEN_AUTHENTICATION_CODE_INTEGRITY_PLUS_SECRET_TEXT,
161         "Integrity plus secret text"},
162     {0, NULL}
163 };
164
165
166 #define IDRP_PATH_ATTR_TYPE_ROUTE_SEPARATOR        1
167 #define IDRP_PATH_ATTR_TYPE_EXT_INFO               2
168 #define IDRP_PATH_ATTR_TYPE_RD_PATH                3
169 #define IDRP_PATH_ATTR_TYPE_NEXT_HOP               4
170 #define IDRP_PATH_ATTR_TYPE_DIST_LIST_INCL         5
171 #define IDRP_PATH_ATTR_TYPE_DIST_LIST_EXCL         6
172 #define IDRP_PATH_ATTR_TYPE_MULTI_EXIT_DISC        7
173 #define IDRP_PATH_ATTR_TYPE_TRANSIT_DELAY          8
174 #define IDRP_PATH_ATTR_TYPE_RESIDUAL_ERROR         9
175 #define IDRP_PATH_ATTR_TYPE_EXPENSE               10
176 #define IDRP_PATH_ATTR_TYPE_LOCALLY_DEFINED_QOS   11
177 #define IDRP_PATH_ATTR_TYPE_HIERARCHICALRECORDING 12
178 #define IDRP_PATH_ATTR_TYPE_RD_HOP_COUNT          13
179 #define IDRP_PATH_ATTR_TYPE_SECURITY              14
180 #define IDRP_PATH_ATTR_TYPE_CAPACITY              15
181 #define IDRP_PATH_ATTR_TYPE_PRIORITY              16
182 static const value_string path_attr_types[] = {
183     {IDRP_PATH_ATTR_TYPE_ROUTE_SEPARATOR,       "Route Separator"},
184     {IDRP_PATH_ATTR_TYPE_EXT_INFO,              "Ext Info"},
185     {IDRP_PATH_ATTR_TYPE_RD_PATH,               "RD Path"},
186     {IDRP_PATH_ATTR_TYPE_NEXT_HOP,              "Next Hop"},
187     {IDRP_PATH_ATTR_TYPE_DIST_LIST_INCL,        "Dist List Incl"},
188     {IDRP_PATH_ATTR_TYPE_DIST_LIST_EXCL,        "Dist List Excl"},
189     {IDRP_PATH_ATTR_TYPE_MULTI_EXIT_DISC,       "Multi Exit Disc"},
190     {IDRP_PATH_ATTR_TYPE_TRANSIT_DELAY,         "Transit Delay"},
191     {IDRP_PATH_ATTR_TYPE_RESIDUAL_ERROR,        "Residual Error"},
192     {IDRP_PATH_ATTR_TYPE_EXPENSE,               "Expense"},
193     {IDRP_PATH_ATTR_TYPE_LOCALLY_DEFINED_QOS,   "Locally Ddefined Qos"},
194     {IDRP_PATH_ATTR_TYPE_HIERARCHICALRECORDING, "Hierarchical Recording"},
195     {IDRP_PATH_ATTR_TYPE_RD_HOP_COUNT,          "RD Hop Count"},
196     {IDRP_PATH_ATTR_TYPE_SECURITY,              "Security"},
197     {IDRP_PATH_ATTR_TYPE_CAPACITY,              "Capacity"},
198     {IDRP_PATH_ATTR_TYPE_PRIORITY,              "Priority"},
199     {0, NULL}
200 };
201
202 #define IDRP_RD_PATH_RD_SET    1
203 #define IDRP_RD_PATH_RD_SEQ    2
204 #define IDRP_RD_PATH_ENTRY_SEQ 3
205 #define IDRP_RD_PATH_ENTRY_SET 4
206 static const value_string path_rd_segment_types[] = {
207     {IDRP_RD_PATH_RD_SET,    "RD_SET"},
208     {IDRP_RD_PATH_RD_SEQ,    "RD_SEQ"},
209     {IDRP_RD_PATH_ENTRY_SEQ, "ENTRY_SEQ"},
210     {IDRP_RD_PATH_ENTRY_SET, "ENTRY_SET"},
211     {0, NULL}
212 };
213
214 #define IDRP_PROTO_TYPE_TR_9577 1
215 #define IDRP_PROTO_TYPE_8802 2
216 static const value_string idrp_proto_type[] = {
217     {IDRP_PROTO_TYPE_TR_9577, "ISO TR 9577 IPI/SPI"},
218     {IDRP_PROTO_TYPE_8802,    "ISO 8802 LSAP"},
219     {0, NULL}
220 };
221
222
223 /* ERROR PDU error codes: */
224 #define IDRP_ERROR_OPEN        1
225 #define IDRP_ERROR_UPDATE      2
226 #define IDRP_ERROR_HOLD_TIMER  3
227 #define IDRP_ERROR_FSM         4
228 #define IDRP_ERROR_RIB_REFRESH 5
229 static const value_string idrp_error_codes[] = {
230     {IDRP_ERROR_OPEN,        "OPEN PDU_Error"},
231     {IDRP_ERROR_UPDATE,      "UPDATE PDU_Error"},
232     {IDRP_ERROR_HOLD_TIMER,  "Hold Timer_Expired"},
233     {IDRP_ERROR_FSM,         "FSM Error"},
234     {IDRP_ERROR_RIB_REFRESH, "RIB REFRESH PDU Error"},
235     {0, NULL}
236 };
237
238 /* ERROR PDU sub error codes: OPEN */
239 #define IDRP_ERROR_OPEN_UNSUPPORTED_VERSION_NUMBER      1
240 #define IDRP_ERROR_OPEN_BAD_MAXPDU_SIZE                 2
241 #define IDRP_ERROR_OPEN_BAD_PEER_RD                     3
242 #define IDRP_ERROR_OPEN_UNSUPPORTED_AUTHENTICATION_CODE 4
243 #define IDRP_ERROR_OPEN_AUTHENTICATION_FAILURE          5
244 #define IDRP_ERROR_OPEN_BAD_RIB_ATTRSSET                6
245 #define IDRP_ERROR_RDC_MISMATCH                         7
246 static const value_string idrp_error_open_subcodes[] = {
247     {IDRP_ERROR_OPEN_UNSUPPORTED_VERSION_NUMBER,
248      "Unsupported Version Number"},
249     {IDRP_ERROR_OPEN_BAD_MAXPDU_SIZE,
250      "Bad Maximum PDU Size"},
251     {IDRP_ERROR_OPEN_BAD_PEER_RD,
252      "Bad Peer RD"},
253     {IDRP_ERROR_OPEN_UNSUPPORTED_AUTHENTICATION_CODE,
254      "Unsupported Authentication Code"},
255     {IDRP_ERROR_OPEN_AUTHENTICATION_FAILURE,
256      "Authentication Failure"},
257     {IDRP_ERROR_OPEN_BAD_RIB_ATTRSSET,
258      "Bad RIB Attribute Set"},
259     {IDRP_ERROR_RDC_MISMATCH,
260      "RDC Mismatch"},
261     {0, NULL}
262 };
263
264 /* ERROR PDU sub error codes: UPDATE */
265 #define IDRP_ERROR_UPDATE_MALFORMED_ATTRIBUTE_LIST           1
266 #define IDRP_ERROR_UPDATE_UNRECOGNIZED_WELL_KNOWN_ATTRIBUTE  2
267 #define IDRP_ERROR_UPDATE_MISSING_WELL_KNOWN_ATTRIBUTE       3
268 #define IDRP_ERROR_UPDATE_ATTRIBUTE_FLAGS_ERROR              4
269 #define IDRP_ERROR_UPDATE_ATTRIBUTE_LENGTH_ERROR             5
270 #define IDRP_ERROR_UPDATE_RD_ROUTEING_LOOP                   6
271 #define IDRP_ERROR_UPDATE_INVALID_NEXT_HOP_ATTRIBUTE         7
272 #define IDRP_ERROR_UPDATE_OPTIONAL_ATTRIBUTE_ERROR           8
273 #define IDRP_ERROR_UPDATE_INVALID_REACHABILITY_INFORMATION   9
274 #define IDRP_ERROR_UPDATE_MISCONFIGURED_RDCS                10
275 #define IDRP_ERROR_UPDATE_MALFORMED_NLRI                    11
276 #define IDRP_ERROR_UPDATE_DUPLICATED_ATTRIBUTES             12
277 #define IDRP_ERROR_UPDATE_ILLEGAL_RD_PATH_SEGMENT           13
278 static const value_string idrp_error_update_subcodes[] = {
279     {IDRP_ERROR_UPDATE_MALFORMED_ATTRIBUTE_LIST,
280      "Malformed Attribute List"},
281     {IDRP_ERROR_UPDATE_UNRECOGNIZED_WELL_KNOWN_ATTRIBUTE,
282      "Unrecognized Well-known Attribute"},
283     {IDRP_ERROR_UPDATE_MISSING_WELL_KNOWN_ATTRIBUTE,
284      "Missing Well-known Attribute"},
285     {IDRP_ERROR_UPDATE_ATTRIBUTE_FLAGS_ERROR,
286      "Attribute Flags Error"},
287     {IDRP_ERROR_UPDATE_ATTRIBUTE_LENGTH_ERROR,
288      "Attribute Length Error"},
289     {IDRP_ERROR_UPDATE_RD_ROUTEING_LOOP,
290      "RD Routing Loop"},
291     {IDRP_ERROR_UPDATE_INVALID_NEXT_HOP_ATTRIBUTE,
292      "Invalid NEXT HOP Attribute"},
293     {IDRP_ERROR_UPDATE_OPTIONAL_ATTRIBUTE_ERROR,
294      "Optional Attribute error"},
295     {IDRP_ERROR_UPDATE_INVALID_REACHABILITY_INFORMATION,
296      "Invalid Reachability Information"},
297     {IDRP_ERROR_UPDATE_MISCONFIGURED_RDCS,
298      "Misconfigured RDCs"},
299     {IDRP_ERROR_UPDATE_MALFORMED_NLRI,
300      "Malformed NLRI"},
301     {IDRP_ERROR_UPDATE_DUPLICATED_ATTRIBUTES,
302      "Duplicated_Attributes"},
303     {IDRP_ERROR_UPDATE_ILLEGAL_RD_PATH_SEGMENT,
304      "Illegal RD Path Segment"},
305     {0, NULL}
306 };
307
308 #define IDRP_ERROR_HOLD_TIMER_NONE 0
309 static const value_string idrp_error_hold_timer_subcodes[] = {
310     {IDRP_ERROR_HOLD_TIMER_NONE, "None"},
311     {0, NULL}
312 };
313
314 /* ERROR PDU sub error codes: FSM */
315 #define IDRP_ERROR_FSM_CLOSED      1
316 #define IDRP_ERROR_FSM_OPEN_RCVD   2
317 #define IDRP_ERROR_FSM_OPEN_SENT   3
318 #define IDRP_ERROR_FSM_CLOSE_WAIT  4
319 #define IDRP_ERROR_FSM_ESTABLISHED 5
320 static const value_string idrp_error_fsm_subcodes[] = {
321     {IDRP_ERROR_FSM_CLOSED,      "CLOSED"},
322     {IDRP_ERROR_FSM_OPEN_RCVD,   "OPEN-RCVD"},
323     {IDRP_ERROR_FSM_OPEN_SENT,   "OPEN-SENT"},
324     {IDRP_ERROR_FSM_CLOSE_WAIT,  "CLOSE-WAIT"},
325     {IDRP_ERROR_FSM_ESTABLISHED, "ESTABLISHED"},
326     {0, NULL}
327 };
328
329
330 #define IDRP_ERROR_RIB_REFRESH_INVALID_OPCODE       1
331 #define IDRP_ERROR_RIB_REFRESH_UNSUPPORTED_RIB_ATTS 2
332 static const value_string idrp_error_rib_refresh_subcodes[] = {
333     {IDRP_ERROR_RIB_REFRESH_INVALID_OPCODE, "Invalid OpCode"},
334     {IDRP_ERROR_RIB_REFRESH_UNSUPPORTED_RIB_ATTS,
335         "Unsupported RIB-Attributes"},
336     {0, NULL}
337 };
338
339
340 #if 0
341 #define IDRP_RIB_REFRESH_REQUEST 1
342 #define IDRP_RIB_REFRESH_START 2
343 #define IDRP_RIB_REFRESH_END 3
344 static const value_string idrp_rib_refresh_opcodes[] = {
345     {IDRP_RIB_REFRESH_REQUEST, "RIB Refresh Request"},
346     {IDRP_RIB_REFRESH_START,   "RIB Refresh Start"},
347     {IDRP_RIB_REFRESH_END,     "RIB Refresh End"},
348     {0, NULL}
349 };
350 #endif
351
352
353 static int dissect_BISPDU_OPEN(tvbuff_t * tvb, int offset, proto_tree * tree)
354 {
355     guint8 rdi_len;
356     guint8 number_of_non_empty_rib_attributes;
357     guint8 number_of_distinguishing_attributes;
358     guint8 rib_attribute_type;
359     guint8 number_of_rdcs;
360     guint8 length_indicator_guint8;
361     gint   i;
362     gint   j;
363
364     /* 1 octet idrp version */
365     proto_tree_add_item(tree, hf_idrp_open_version, tvb, offset,1, ENC_BIG_ENDIAN);
366     offset += 1;
367
368     /* Hold Time (2 octets) */
369     proto_tree_add_item(tree, hf_idrp_open_hold_time, tvb, offset, 2, ENC_BIG_ENDIAN);
370     offset += 2;
371
372     /* Maximum PDU Size (2 octets) */
373     proto_tree_add_item(tree, hf_idrp_open_max_pdu_size, tvb, offset, 2, ENC_BIG_ENDIAN);
374     offset += 2;
375
376     /* Source RDI Length Indicator (1 octet) */
377     rdi_len = tvb_get_guint8(tvb, offset);
378     offset += 1;
379
380     /* Source RDI */
381     proto_tree_add_item(tree, hf_idrp_open_src_rdi, tvb, offset, rdi_len, ENC_NA);
382     offset += rdi_len;
383
384     /* Number of Non-empty RIB-Atts */
385     number_of_non_empty_rib_attributes = tvb_get_guint8(tvb, offset);
386     offset += 1;
387
388     /* process Nth non-empty RIB-Atts */
389     for (i = number_of_non_empty_rib_attributes; i > 0; i--) {
390         /* 1 octet number of distinguishing attributes that are contained in
391            the Nth RIB-Att. */
392         number_of_distinguishing_attributes = tvb_get_guint8(tvb, offset);
393         offset += 1;
394
395         /* process Nth RIB-Att */
396         for (j = number_of_distinguishing_attributes; j > 0; j--) {
397             /* 1 octet Type of RIB-Att */
398             rib_attribute_type = tvb_get_guint8(tvb, offset);
399             offset += 1;
400
401             switch (rib_attribute_type) {
402                 case IDRP_PATH_ATTR_TYPE_ROUTE_SEPARATOR:
403                 case IDRP_PATH_ATTR_TYPE_EXT_INFO:
404                 case IDRP_PATH_ATTR_TYPE_RD_PATH:
405                 case IDRP_PATH_ATTR_TYPE_NEXT_HOP:
406                 case IDRP_PATH_ATTR_TYPE_DIST_LIST_EXCL:
407                 case IDRP_PATH_ATTR_TYPE_DIST_LIST_INCL:
408                 case IDRP_PATH_ATTR_TYPE_MULTI_EXIT_DISC:
409                 case IDRP_PATH_ATTR_TYPE_RESIDUAL_ERROR:
410                 case IDRP_PATH_ATTR_TYPE_EXPENSE:
411                 case IDRP_PATH_ATTR_TYPE_HIERARCHICALRECORDING:
412                 case IDRP_PATH_ATTR_TYPE_RD_HOP_COUNT:
413                 case IDRP_PATH_ATTR_TYPE_CAPACITY:
414                 case IDRP_PATH_ATTR_TYPE_PRIORITY:
415                     break;
416                 case IDRP_PATH_ATTR_TYPE_LOCALLY_DEFINED_QOS:
417                     /* 1 octet Nsap prefix length */
418                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
419                     offset += 1;
420                     /* process Nsap prefix */
421                     proto_tree_add_item(
422                             tree,
423                             hf_idrp_open_rib_attr_locally_defined_qos_nsap,
424                             tvb,
425                             offset,
426                             length_indicator_guint8,
427                             ENC_NA);
428                     offset += length_indicator_guint8;
429
430                     /* 1 octet Qos length */
431                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
432                     offset += 1;
433                     /* process Qos */
434                     proto_tree_add_item(
435                             tree,
436                             hf_idrp_open_rib_attr_locally_defined_qos_value,
437                             tvb,
438                             offset,
439                             length_indicator_guint8,
440                             ENC_NA);
441                     offset += length_indicator_guint8;
442
443                     /* 1 octet Metric length */
444                     /* note: metric  always absent in OPEN BISPDU */
445                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
446                     offset += 1;
447                     /* process Metric */
448                     proto_tree_add_item(
449                             tree,
450                             hf_idrp_open_rib_attr_locally_defined_qos_metric,
451                             tvb,
452                             offset,
453                             length_indicator_guint8,
454                             ENC_NA);
455                     offset += length_indicator_guint8;
456                     break;
457                 case IDRP_PATH_ATTR_TYPE_SECURITY:
458                     /* length of Security Registration ID and Security Information */
459                     offset += 2;
460
461                     /* length of Security Registration ID */
462                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
463                     offset += 1;
464                     /* value of Security Registration ID */
465                     proto_tree_add_item(
466                             tree,
467                             hf_idrp_open_rib_attr_security_reg_id,
468                             tvb,
469                             offset,
470                             length_indicator_guint8,
471                             ENC_NA);
472                     offset += length_indicator_guint8;
473
474                     /* length of Security Information */
475                     /* note: always absent for OPEN BISPDU*/
476                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
477                     offset += 1;
478                     /* value of Security Information */
479                     proto_tree_add_item(
480                             tree,
481                             hf_idrp_open_rib_attr_security_info,
482                             tvb,
483                             offset,
484                             length_indicator_guint8,
485                             ENC_NA);
486                     offset += length_indicator_guint8;
487
488                     break;
489                 default:
490                     break;
491             } /* switch (path_attr_type) */
492         }
493     } /* process Nth non-empty RIB-Atts */
494
495     /* Confed-ID's */
496     /* Number of RDCs */
497     number_of_rdcs = tvb_get_guint8(tvb, offset);
498     proto_tree_add_item(tree, hf_idrp_open_number_of_confederations, tvb,
499             offset, 1, ENC_BIG_ENDIAN);
500     offset += 1;
501
502     /* process Nth Confederation RDI */
503     for (i = number_of_rdcs; i > 0; i--) {
504         /* 1 octet of RDI length */
505         length_indicator_guint8 = tvb_get_guint8(tvb, offset);
506         offset += 1;
507
508         /* process Nth RDI */
509         proto_tree_add_item(tree, hf_idrp_open_confederation, tvb,
510                 offset, length_indicator_guint8, ENC_NA);
511         offset += length_indicator_guint8;
512     }
513
514     /* Authentication Code */
515     proto_tree_add_item(tree, hf_idrp_open_authentication_code, tvb, offset, 1,
516             ENC_BIG_ENDIAN);
517     offset += 1;
518
519     /* Authentication Data */
520     proto_tree_add_item(tree, hf_idrp_open_authentication_data, tvb, offset,
521             tvb_reported_length_remaining(tvb, offset), ENC_NA);
522     offset += tvb_reported_length_remaining(tvb, offset);
523
524     return offset;
525 }
526
527 static int dissect_BISPDU_UPDATE(tvbuff_t * tvb, int offset, proto_tree * tree)
528 {
529     guint16 nb_unfeasible_routes;
530     guint16 path_attrs_len;
531     int     path_attrs_start_offset;
532     guint8  path_attr_type;
533     guint16 path_attr_len;
534     int     start_offset;
535     guint16 rdi_len;
536     guint8  proto_len;
537     guint16 net_len;
538     int     path_segment_rdi_offset;
539     guint16 length_indicator_guint16;
540     guint8  length_indicator_guint8;
541     guint8  nb_of_snpa;
542     guint8  dist_list_count;
543     int     i;
544
545     /* 2 octet withdrawn ("Unfeasible") Route Count */
546     nb_unfeasible_routes = tvb_get_ntohs(tvb, offset);
547     proto_tree_add_item(tree, hf_idrp_update_number_of_unfeasible_routes,
548             tvb, offset, 2, ENC_BIG_ENDIAN);
549     offset += 2;
550
551     /* process Nth unfeasible route ID */
552     for (i = nb_unfeasible_routes; i > 0; i--) {
553         proto_tree_add_item(tree, hf_idrp_update_withdrawn_route, tvb, offset,
554                 4, ENC_BIG_ENDIAN);
555         offset += 4;
556     }
557
558     /* 2 octets path attributes length */
559     path_attrs_len = tvb_get_ntohs(tvb, offset);
560     offset += 2;
561
562     path_attrs_start_offset = offset;
563     /* process Nth path attribute */
564     while (offset < (path_attrs_start_offset + path_attrs_len)) {
565         /* Path attribute flag */
566         proto_tree_add_item(tree, hf_idrp_update_path_attr_flag, tvb,
567                 offset, 1, ENC_BIG_ENDIAN);
568         offset += 1;
569         /* Path attribute type */
570         path_attr_type = tvb_get_guint8(tvb, offset);
571         proto_tree_add_item(tree, hf_idrp_update_path_attr_type, tvb,
572                 offset, 1, ENC_BIG_ENDIAN);
573         offset += 1;
574         /* Path attribute length */
575         path_attr_len = tvb_get_ntohs(tvb, offset);
576         proto_tree_add_item(tree, hf_idrp_update_path_attr_length, tvb,
577                 offset, 2, ENC_BIG_ENDIAN);
578         offset += 2;
579         /* Path attribute value */
580         switch (path_attr_type) {
581             case IDRP_PATH_ATTR_TYPE_ROUTE_SEPARATOR:
582                 proto_tree_add_item(tree,
583                         hf_idrp_update_path_attr_route_separator_id,
584                         tvb,
585                         offset,
586                         4,
587                         ENC_BIG_ENDIAN);
588                 offset += 4;
589                 proto_tree_add_item(tree,
590                         hf_idrp_update_path_attr_route_separator_localpref,
591                         tvb,
592                         offset,
593                         1,
594                         ENC_BIG_ENDIAN);
595                 offset ++ ;
596                 break;
597             case IDRP_PATH_ATTR_TYPE_EXT_INFO:
598                 proto_tree_add_item(tree,
599                         hf_idrp_update_path_attr_ext_info,
600                         tvb,
601                         offset,
602                         0,
603                         ENC_BIG_ENDIAN);
604                 break;
605             case IDRP_PATH_ATTR_TYPE_RD_PATH:
606                 start_offset = offset;
607
608                 /* process Nth path segment */
609                 while (offset < (start_offset + path_attr_len)) {
610                     /* print path segment type */
611                     proto_tree_add_item(tree,
612                             hf_idrp_update_path_attr_rd_path_type,
613                             tvb,
614                             offset,
615                             1,
616                             ENC_BIG_ENDIAN);
617                     offset += 1;
618
619                     /* 2 octets of path segment length */
620                     length_indicator_guint16 = tvb_get_ntohs(tvb, offset);
621                     proto_tree_add_item(tree,
622                             hf_idrp_update_path_attr_rd_path_segment_length,
623                             tvb,
624                             offset,
625                             2,
626                             ENC_BIG_ENDIAN);
627                     offset += 2;
628
629                     /* one path segment may contain one or more RDI */
630                     path_segment_rdi_offset = offset;
631                     while (offset < (path_segment_rdi_offset + length_indicator_guint16)) {
632                         /* 1 octet rdi length */
633                         length_indicator_guint8 = tvb_get_guint8(tvb, offset);
634                         offset += 1;
635                         /* print N times path RDI */
636                         proto_tree_add_item(tree,
637                                 hf_idrp_update_path_attr_rd_path_rdi,
638                                 tvb,
639                                 offset,
640                                 length_indicator_guint8,
641                                 ENC_NA);
642                         offset += length_indicator_guint8;
643                     }
644                 }
645                 break;
646             case IDRP_PATH_ATTR_TYPE_NEXT_HOP:
647                 /* 1 octet idrp server flag */
648                 proto_tree_add_item(tree,
649                         hf_idrp_update_path_attr_next_hop_idrp_server,
650                         tvb,
651                         offset,
652                         1,
653                         ENC_BIG_ENDIAN);
654                 offset += 1;
655
656                 start_offset = offset;
657                 /* process Nth next hop */
658                 while (offset < (start_offset + path_attr_len)) {
659                     /* 1 octet Proto type */
660                     proto_tree_add_item(tree,
661                             hf_idrp_update_path_attr_next_hop_proto_type,
662                             tvb,
663                             offset,
664                             1,
665                             ENC_BIG_ENDIAN);
666                     offset += 1;
667                     /* 1 octet Proto len */
668                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
669                     offset += 1;
670                     /* N octets Proto: in case of ISO 8473 one octet with the value 0x81 */
671                     proto_tree_add_item(tree,
672                             hf_idrp_update_path_attr_next_hop_proto,
673                             tvb,
674                             offset,
675                             length_indicator_guint8,
676                             ENC_ASCII | ENC_NA);
677                     offset += length_indicator_guint8;
678
679                     /* length of NET of Next HOP */
680                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
681                     offset += 1;
682                     /* NET of Next HOP */
683                     proto_tree_add_item(tree,
684                             hf_idrp_update_path_attr_next_hop_rdi,
685                             tvb,
686                             offset,
687                             length_indicator_guint8,
688                             ENC_NA);
689                     offset +=  length_indicator_guint8;
690
691                     /* number of SNPA */
692                     nb_of_snpa = tvb_get_guint8(tvb, offset);
693                     proto_tree_add_item(tree,
694                             hf_idrp_update_path_attr_next_hop_nb_snpa,
695                             tvb,
696                             offset,
697                             1,
698                             ENC_BIG_ENDIAN);
699                     offset += 1;
700                     /* process Nth SNPA */
701                     for (i = nb_of_snpa; i > 0; i--) {
702                         /* SNPS length in multiples of 4 bit */
703                         length_indicator_guint8 =
704                             /* length = half the length in semi-octets rounded up */
705                             (tvb_get_guint8(tvb, offset) + 1) / 2;
706                         offset += 1;
707                         proto_tree_add_item(tree,
708                                 hf_idrp_update_path_attr_next_hop_snpa,
709                                 tvb,
710                                 offset,
711                                 length_indicator_guint8 ,
712                                 ENC_NA);
713                         offset += length_indicator_guint8;
714                     }
715                 } /* while: process Nth next hop */
716                 break;
717             case IDRP_PATH_ATTR_TYPE_DIST_LIST_EXCL:
718                 /* 1 octet number of RDI's/Confed's in DIST list */
719                 dist_list_count = tvb_get_guint8(tvb, offset);
720                 proto_tree_add_item(tree,
721                         hf_idrp_update_path_attr_dist_list_excl_nb_rdi,
722                         tvb,
723                         offset,
724                         1 ,
725                         ENC_BIG_ENDIAN);
726                 offset += 1;
727
728                 /* process RDI's/Confederations's in DIST list */
729                 for (i = dist_list_count; i > 0; i--) {
730                     /* 1 octet RDI/Confed length indicator */
731                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
732                     offset += 1;
733                     /* variable size RDI/Conderation */
734                     proto_tree_add_item(tree,
735                             hf_idrp_update_path_attr_dist_list_excl_rdi ,
736                             tvb,
737                             offset,
738                             length_indicator_guint8 ,
739                             ENC_NA);
740                     offset += length_indicator_guint8;
741                 }
742                 break;
743             case IDRP_PATH_ATTR_TYPE_DIST_LIST_INCL:
744                 /* 1 octet number of RDI's/Confed's in DIST list */
745                 dist_list_count = tvb_get_guint8(tvb, offset);
746                 proto_tree_add_item(tree,
747                         hf_idrp_update_path_attr_dist_list_incl_nb_rdi,
748                         tvb,
749                         offset,
750                         1 ,
751                         ENC_BIG_ENDIAN);
752                 offset += 1;
753
754                 /* process RDI's/Confederations's in DIST list */
755                 for (i = dist_list_count; i > 0; i--) {
756                     /* 1 octet RDI/Confed length indicator */
757                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
758                     offset += 1;
759                     /* variable size RDI/Conderation */
760                     proto_tree_add_item(tree,
761                             hf_idrp_update_path_attr_dist_list_incl_rdi ,
762                             tvb,
763                             offset,
764                             length_indicator_guint8 ,
765                             ENC_NA);
766                     offset += length_indicator_guint8;
767                 }
768                 break;
769             case IDRP_PATH_ATTR_TYPE_MULTI_EXIT_DISC:
770                 /* 1 octet Multi Exit Discriminator */
771                 proto_tree_add_item(tree,
772                         hf_idrp_update_path_attr_multi_exit_disc ,
773                         tvb,
774                         offset,
775                         1 ,
776                         ENC_BIG_ENDIAN);
777                 offset += 1;
778                 break;
779             case IDRP_PATH_ATTR_TYPE_TRANSIT_DELAY:
780                 /* 2 octets of transit delay */
781                 proto_tree_add_item(tree,
782                         hf_idrp_update_path_attr_transit_delay ,
783                         tvb,
784                         offset,
785                         2 ,
786                         ENC_BIG_ENDIAN);
787                 offset += 2;
788                 break;
789             case IDRP_PATH_ATTR_TYPE_RESIDUAL_ERROR:
790                 /* 4 octets of residual error */
791                 proto_tree_add_item(tree,
792                         hf_idrp_update_path_attr_residual_error ,
793                         tvb,
794                         offset,
795                         4 ,
796                         ENC_BIG_ENDIAN);
797                 offset += 4;
798                 break;
799             case IDRP_PATH_ATTR_TYPE_EXPENSE:
800                 /* 2 octets of Expense */
801                 proto_tree_add_item(tree,
802                         hf_idrp_update_path_attr_expense ,
803                         tvb,
804                         offset,
805                         2 ,
806                         ENC_BIG_ENDIAN);
807                 offset += 2;
808                 break;
809             case IDRP_PATH_ATTR_TYPE_LOCALLY_DEFINED_QOS:
810                 /* 1 octet Nsap prefix length */
811                 length_indicator_guint8 = tvb_get_guint8(tvb, offset);
812                 offset += 1;
813                 /* process Nsap prefix */
814                 proto_tree_add_item(tree,
815                         hf_idrp_update_path_attr_locally_defined_qos_nsap ,
816                         tvb,
817                         offset,
818                         length_indicator_guint8 ,
819                         ENC_NA);
820                 offset += length_indicator_guint8;
821                 /* 1 octet Qoslength */
822                 length_indicator_guint8 = tvb_get_guint8(tvb, offset);
823                 offset += 1;
824                 /* process Qos */
825                 proto_tree_add_item(tree,
826                         hf_idrp_update_path_attr_locally_defined_qos_value,
827                         tvb,
828                         offset,
829                         length_indicator_guint8 ,
830                         ENC_NA);
831                 offset += length_indicator_guint8;
832                 /* 1 octet Metric length */
833                 length_indicator_guint8  = tvb_get_guint8(tvb, offset);
834                 offset += 1;
835                 /* process Metric */
836                 proto_tree_add_item(tree,
837                         hf_idrp_update_path_attr_locally_defined_qos_metric,
838                         tvb,
839                         offset,
840                         length_indicator_guint8 ,
841                         ENC_NA);
842                 offset += length_indicator_guint8;
843                 break;
844             case IDRP_PATH_ATTR_TYPE_HIERARCHICALRECORDING:
845                 /* 1 octet flag hierarchical recording */
846                 proto_tree_add_item(tree,
847                         hf_idrp_update_path_attr_hierarchicaldecoding,
848                         tvb,
849                         offset,
850                         1 ,
851                         ENC_BIG_ENDIAN);
852                 offset += 1;
853                 break;
854             case IDRP_PATH_ATTR_TYPE_RD_HOP_COUNT:
855                 proto_tree_add_item(tree,
856                         hf_idrp_update_path_attr_rd_hop_count,
857                         tvb,
858                         offset,
859                         1 ,
860                         ENC_BIG_ENDIAN);
861                 offset += 1;
862                 break;
863             case IDRP_PATH_ATTR_TYPE_SECURITY:
864                 /* length of Security Registration ID */
865                 length_indicator_guint8 = tvb_get_guint8(tvb, offset);
866                 offset += 1;
867
868                 /* value of Security Registration ID */
869                 proto_tree_add_item(tree,
870                         hf_idrp_update_path_attr_security_reg_id,
871                         tvb,
872                         offset,
873                         length_indicator_guint8 ,
874                         ENC_NA);
875                 offset += length_indicator_guint8;
876
877                 /* length of Security Information */
878                 length_indicator_guint8 = tvb_get_guint8(tvb, offset);
879                 offset += 1;
880                 /* value of Security Information */
881                 proto_tree_add_item(tree,
882                         hf_idrp_update_path_attr_security_info,
883                         tvb,
884                         offset,
885                         length_indicator_guint8,
886                         ENC_NA);
887                 offset += length_indicator_guint8;
888                 break;
889             case IDRP_PATH_ATTR_TYPE_CAPACITY:
890                 proto_tree_add_item(tree,
891                         hf_idrp_update_path_attr_capacity,
892                         tvb,
893                         offset,
894                         1 ,
895                         ENC_BIG_ENDIAN);
896                 offset += 1;
897                 break;
898             case IDRP_PATH_ATTR_TYPE_PRIORITY:
899                 proto_tree_add_item(tree,
900                         hf_idrp_update_path_attr_priority,
901                         tvb,
902                         offset,
903                         1 ,
904                         ENC_BIG_ENDIAN);
905                 offset += 1;
906                 break;
907             default:
908                 break;
909         }
910     }
911
912     /* 1 octet Proto type */
913     proto_tree_add_item(tree, hf_idrp_update_nlri_proto_type, tvb, offset,
914             1, ENC_BIG_ENDIAN);
915     offset += 1;
916
917     /* 1 octet Proto len */
918     proto_len = tvb_get_guint8(tvb, offset);
919     offset += 1;
920
921     /* N octets Proto identity: in case of ISO 8473 one octet with the value 0x81 */
922     proto_tree_add_item(tree, hf_idrp_update_nlri_proto_id, tvb, offset,
923             proto_len, ENC_NA);
924     offset += proto_len;
925
926     /* 2 octets length of address */
927     net_len = tvb_get_ntohs(tvb, offset);
928     proto_tree_add_item(tree, hf_idrp_update_nlri_addr_length, tvb, offset,
929             2, ENC_BIG_ENDIAN);
930     offset += 2;
931
932     /* process N address info sets */
933     start_offset = offset;
934     while (offset < (start_offset + net_len)) {
935         /* 1 octet address length in bits */
936         rdi_len = tvb_get_guint8(tvb, offset) / 8;
937         proto_tree_add_item(tree, hf_idrp_update_nlri_addr_info_nb_bits, tvb,
938                 offset, 1, ENC_BIG_ENDIAN);
939         offset += 1;
940
941         proto_tree_add_item(tree, hf_idrp_update_nlri_addr_info, tvb,
942                 offset, rdi_len, ENC_NA);
943         offset += rdi_len;
944     }
945     return offset;
946 }
947
948 static int dissect_BISPDU_ERROR(tvbuff_t * tvb, int offset, proto_tree * tree)
949 {
950     guint8 error_code = 0;
951     gint   data_length;
952
953     /* Error Code (1 octet) */
954     error_code = tvb_get_guint8(tvb, offset);
955     proto_tree_add_item(tree, hf_idrp_error_code, tvb, offset, 1, ENC_BIG_ENDIAN);
956     offset += 1;
957
958     switch (error_code) {
959         case IDRP_ERROR_OPEN:
960             proto_tree_add_item(tree, hf_idrp_error_open_subcode, tvb, offset, 1,
961                     ENC_BIG_ENDIAN);
962             break;
963         case IDRP_ERROR_UPDATE:
964             proto_tree_add_item(tree, hf_idrp_error_update_subcode, tvb, offset, 1,
965                     ENC_BIG_ENDIAN);
966             break;
967         case IDRP_ERROR_HOLD_TIMER:
968             proto_tree_add_item(tree, hf_idrp_error_hold_timer_subcode, tvb,
969                     offset, 1, ENC_BIG_ENDIAN);
970             break;
971         case IDRP_ERROR_FSM:
972             proto_tree_add_item(tree, hf_idrp_error_fsm_subcode, tvb, offset, 1,
973                     ENC_BIG_ENDIAN);
974             break;
975         case IDRP_ERROR_RIB_REFRESH:
976             proto_tree_add_item(tree, hf_idrp_error_rib_refresh_subcode, tvb,
977                     offset, 1, ENC_BIG_ENDIAN);
978             break;
979         default:
980             break;
981     }
982     offset += 1;
983
984     /* data : zero or more octets of data to be used in diagnosing the reason
985        for the IDRP ERROR PDU. The contents of the Data field depends upon the
986        error code and error subcode. */
987     data_length = tvb_reported_length_remaining(tvb, offset);
988     if (data_length>0) {
989         proto_tree_add_item(tree, hf_idrp_error_data, tvb, offset, data_length,
990                 ENC_NA);
991         offset += data_length;
992     }
993
994     return offset;
995 }
996
997 static int dissect_BISPDU_RIB_REFRESH(tvbuff_t * tvb, packet_info *pinfo, int offset, proto_tree * tree)
998 {
999     proto_tree *sub_tree;
1000     proto_item *sub_item;
1001     guint8      number_of_non_empty_rib_attributes;
1002     guint8      number_of_distinguishing_attributes;
1003     guint8      rib_attribute_type;
1004     guint8      length_indicator_guint8;
1005     int         i;
1006     int         j;
1007
1008     /* 1 octet Opcode */
1009     proto_tree_add_item(tree, hf_idrp_rib_refresh_opcode, tvb, offset, 1,
1010             ENC_BIG_ENDIAN);
1011     offset += 1;
1012
1013     /* Path Attributes subtree */
1014     sub_tree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_idrp_sub, &sub_item, "Path Attributes");
1015
1016     /* Number of Non-empty RIB-Atts */
1017     number_of_non_empty_rib_attributes = tvb_get_guint8(tvb, offset);
1018     offset += 1;
1019
1020     if (!number_of_non_empty_rib_attributes)
1021         expert_add_info(pinfo, sub_item, &ei_idrp_no_path_attributes);
1022
1023     /* process Nth RIB-Atts */
1024     for (i = number_of_non_empty_rib_attributes; i > 0; i--) {
1025
1026         /* 1 octet number of distinguishing attributes that are contained in
1027            the Nth RIB-Att. */
1028         number_of_distinguishing_attributes = tvb_get_guint8(tvb, offset);
1029         offset += 1;
1030
1031         /* process Nth RIB-Att */
1032         for (j = number_of_distinguishing_attributes; j > 0; j--) {
1033             /* 1 octet Type of RIB-Att */
1034             rib_attribute_type = tvb_get_guint8(tvb, offset);
1035             offset += 1;
1036
1037             switch (rib_attribute_type) {
1038                 case IDRP_PATH_ATTR_TYPE_ROUTE_SEPARATOR:
1039                 case IDRP_PATH_ATTR_TYPE_EXT_INFO:
1040                 case IDRP_PATH_ATTR_TYPE_RD_PATH:
1041                 case IDRP_PATH_ATTR_TYPE_NEXT_HOP:
1042                 case IDRP_PATH_ATTR_TYPE_DIST_LIST_EXCL:
1043                 case IDRP_PATH_ATTR_TYPE_DIST_LIST_INCL:
1044                 case IDRP_PATH_ATTR_TYPE_MULTI_EXIT_DISC:
1045                 case IDRP_PATH_ATTR_TYPE_RESIDUAL_ERROR:
1046                 case IDRP_PATH_ATTR_TYPE_EXPENSE:
1047                 case IDRP_PATH_ATTR_TYPE_HIERARCHICALRECORDING:
1048                 case IDRP_PATH_ATTR_TYPE_RD_HOP_COUNT:
1049                 case IDRP_PATH_ATTR_TYPE_CAPACITY:
1050                 case IDRP_PATH_ATTR_TYPE_PRIORITY:
1051                     break;
1052                 case IDRP_PATH_ATTR_TYPE_LOCALLY_DEFINED_QOS:
1053                     /* 1 octet Nsap prefix length */
1054                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
1055                     offset += 1;
1056                     /* process Nsap prefix */
1057                     proto_tree_add_item(
1058                             sub_tree,
1059                             hf_idrp_rib_refresh_rib_attr_locally_defined_qos_nsap,
1060                             tvb,
1061                             offset,
1062                             length_indicator_guint8,
1063                             ENC_NA);
1064                     offset += length_indicator_guint8;
1065
1066                     /* 1 octet Qos length */
1067                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
1068                     offset += 1;
1069                     /* process Qos */
1070                     proto_tree_add_item(
1071                             sub_tree,
1072                             hf_idrp_rib_refresh_rib_attr_locally_defined_qos_value,
1073                             tvb,
1074                             offset,
1075                             length_indicator_guint8,
1076                             ENC_NA);
1077                     offset += length_indicator_guint8;
1078
1079                     /* 1 octet Metric length */
1080                     /* note: metric  always absent in OPEN BISPDU */
1081                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
1082                     offset += 1;
1083                     /* process Metric */
1084                     proto_tree_add_item(
1085                             sub_tree,
1086                             hf_idrp_rib_refresh_rib_attr_locally_defined_qos_metric,
1087                             tvb,
1088                             offset,
1089                             length_indicator_guint8,
1090                             ENC_NA);
1091                     offset += length_indicator_guint8;
1092                     break;
1093                 case IDRP_PATH_ATTR_TYPE_SECURITY:
1094                     /* length of Security Registration ID and Security Information */
1095                     offset += 2;
1096
1097                     /* length of Security Registration ID */
1098                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
1099                     offset += 1;
1100                     /* value of Security Registration ID */
1101                     proto_tree_add_item(
1102                             sub_tree,
1103                             hf_idrp_rib_refresh_rib_attr_security_reg_id,
1104                             tvb,
1105                             offset,
1106                             length_indicator_guint8,
1107                             ENC_NA);
1108                     offset += length_indicator_guint8;
1109
1110                     /* length of Security Information */
1111                     /* note: always absent for OPEN BISPDU*/
1112                     length_indicator_guint8 = tvb_get_guint8(tvb, offset);
1113                     offset += 1;
1114                     /* value of Security Information */
1115                     proto_tree_add_item(
1116                             sub_tree,
1117                             hf_idrp_rib_refresh_rib_attr_security_info,
1118                             tvb,
1119                             offset,
1120                             length_indicator_guint8,
1121                             ENC_NA);
1122                     offset += length_indicator_guint8;
1123
1124                     break;
1125                 default:
1126                     break;
1127             } /* switch (path_attr_type) */
1128         }
1129     }
1130     return offset;
1131 }
1132
1133 static int
1134 dissect_idrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1135 {
1136     proto_item *ti;
1137     proto_tree *idrp_tree;
1138     guint8      pdu_type;
1139     gint        offset = 0;
1140
1141
1142     if (tvb_get_guint8(tvb, offset) != NLPID_ISO10747_IDRP)
1143         return 0;  /* no idrp packet */
1144     offset += 1;
1145
1146     col_set_str(pinfo->cinfo, COL_PROTOCOL, "IDRP");
1147     col_clear(pinfo->cinfo, COL_INFO);
1148
1149     ti = proto_tree_add_item(tree, proto_idrp, tvb, 0, -1, ENC_NA);
1150     idrp_tree = proto_item_add_subtree(ti, ett_idrp);
1151
1152     /* 2 octets BISPDU Length */
1153     proto_tree_add_item(idrp_tree, hf_idrp_li,
1154             tvb, offset, 2, ENC_BIG_ENDIAN);
1155     offset += 2;
1156
1157     /* 1 octet BISPDU Type */
1158     pdu_type = tvb_get_guint8(tvb, offset);
1159     proto_tree_add_item(idrp_tree, hf_idrp_type,
1160             tvb, offset, 1, ENC_BIG_ENDIAN);
1161     offset += 1;
1162
1163     /* 4 octets Sequence */
1164     proto_tree_add_item(idrp_tree, hf_idrp_sequence,
1165             tvb, offset, 4, ENC_BIG_ENDIAN);
1166     offset += 4;
1167
1168     /* 4 octets Acknowledge */
1169     proto_tree_add_item(idrp_tree, hf_idrp_ack,
1170             tvb, offset, 4, ENC_BIG_ENDIAN);
1171     offset += 4;
1172
1173     /* 1 octets credits offered */
1174     proto_tree_add_item(idrp_tree, hf_idrp_credit_offered,
1175             tvb, offset, 1, ENC_BIG_ENDIAN);
1176     offset += 1;
1177
1178     /* 1 octets credits offered */
1179     proto_tree_add_item(idrp_tree, hf_idrp_credit_avail,
1180             tvb, offset, 1, ENC_BIG_ENDIAN);
1181     offset += 1;
1182
1183     /* 16 octets validation */
1184     proto_tree_add_item(idrp_tree, hf_idrp_validation_pattern,
1185             tvb, offset, 16, ENC_NA);
1186     offset += 16;
1187
1188     switch (pdu_type) {
1189         case IDRP_TYPE_OPEN:
1190             offset = dissect_BISPDU_OPEN(tvb, offset, idrp_tree);
1191             break;
1192         case IDRP_TYPE_UPDATE:
1193             offset = dissect_BISPDU_UPDATE(tvb, offset, idrp_tree);
1194             break;
1195         case IDRP_TYPE_ERROR:
1196             offset = dissect_BISPDU_ERROR(tvb, offset, idrp_tree);
1197             break;
1198         case IDRP_TYPE_KEEPALIVE:
1199             /* KEEPALIVE PDU consists of only a PDU header and has a length of 30
1200                octets */
1201             offset += 30;
1202             break;
1203         case IDRP_TYPE_CEASE:
1204             /* CEASE is composed a PDU header and has length of 30 octets */
1205             offset += 30;
1206             break;
1207         case IDRP_TYPE_RIB_REFRESH:
1208             offset = dissect_BISPDU_RIB_REFRESH(tvb, pinfo, offset, idrp_tree);
1209             break;
1210         default:
1211             break;
1212     }
1213
1214     col_append_str(pinfo->cinfo, COL_INFO,
1215             val_to_str(pdu_type, idrp_pdu_types, "Unknown (%u)"));
1216
1217     return offset;
1218 }
1219
1220
1221 void proto_register_idrp(void)
1222 {
1223     static hf_register_info hf_idrp[] = {
1224         {&hf_idrp_li,
1225             {"BISPDU Length", "idrp.li", FT_UINT16, BASE_DEC, NULL, 0x0,
1226                 "BISPDU Length Indicator, length of this PDU", HFILL}},
1227         {&hf_idrp_type,
1228             {"BISPDU Type", "idrp.type", FT_UINT8, BASE_DEC,
1229                 VALS(idrp_pdu_types), 0xff, NULL, HFILL}},
1230         {&hf_idrp_sequence,
1231             {"Sequence Number", "idrp.seq", FT_UINT32, BASE_DEC, NULL, 0x0,
1232                 "Sequence number, Sequence number of current BISPDU ", HFILL}},
1233         {&hf_idrp_ack,
1234             {"Acknowledgment number", "idrp.ack", FT_UINT32, BASE_DEC, NULL, 0x0,
1235                 "Acknowledgment number, Sequence number of the PDU that the sender last received correctly and in sequence number order",
1236                 HFILL}},
1237         {&hf_idrp_credit_offered,
1238             {"Credits Offered", "idrp.credits-offered", FT_UINT8, BASE_DEC,
1239                 NULL, 0,
1240                 "Number of additional BISPDUs that the sender is willing to accept from the remote BIS",
1241                 HFILL}},
1242         {&hf_idrp_credit_avail,
1243             {"Credits Available", "idrp.credits-avail", FT_UINT8, BASE_DEC,
1244                 NULL, 0,
1245                 "Number of additional BISPDUs that the sender is able to send to the remote BIS",
1246                 HFILL}},
1247         {&hf_idrp_validation_pattern,
1248             {"Validation", "idrp.validation", FT_BYTES, BASE_NONE,
1249                 NULL, 0,
1250                 "16-octet field which provides a validation function for the BISPDU",
1251                 HFILL}},
1252         {&hf_idrp_open_version,
1253             {"Version", "idrp.open.version", FT_UINT8, BASE_DEC,
1254                 NULL, 0, "Version number of the protocol.", HFILL}},
1255         {&hf_idrp_open_hold_time,
1256             {"Hold Time", "idrp.open.hold-time", FT_UINT16, BASE_DEC,
1257                 NULL, 0, "Max number of seconds to remain in the ESTABLISHED state",
1258                 HFILL}},
1259         {&hf_idrp_open_max_pdu_size,
1260             {"Max PDU Size", "idrp.open.max-pdu-size", FT_UINT16, BASE_DEC,
1261                 NULL, 0,
1262                 "Maximum number of octets that this BIS will accept in an incoming UPDATE PDU, IDRP ERROR PDU, or RIB REFRESH PDU",
1263                 HFILL}},
1264         {&hf_idrp_open_src_rdi,
1265             {"Source RDI", "idrp.open.src-rdi", FT_BYTES, BASE_NONE,
1266                 NULL, 0,
1267                 "RDI of the routing domain in which the BIS that is sending this BISPDU is located",
1268                 HFILL}},
1269         {&hf_idrp_open_rib_attr_locally_defined_qos_nsap,
1270             {"Rib Attribute Value Locally Defined Qos NSAP",
1271                 "idrp.open.rib-attr.locally-defined-qos.nsap", FT_BYTES, BASE_NONE,
1272                 NULL, 0, "Locally Defined Qos NSAP" ,
1273                 HFILL}},
1274         {&hf_idrp_open_rib_attr_locally_defined_qos_value,
1275             {"Rib Attribute Value Locally Defined Qos",
1276                 "idrp.open.rib-attr.locally-defined-qos.qos", FT_BYTES, BASE_NONE,
1277                 NULL, 0, "Locally Defined Qos Value" ,
1278                 HFILL}},
1279         {&hf_idrp_open_rib_attr_locally_defined_qos_metric,
1280             {"Rib Attribute Value Locally Defined Qos Metric",
1281                 "idrp.open.rib-attr.locally-defined-qos.metric", FT_BYTES, BASE_NONE,
1282                 NULL, 0, "Locally Defined Metric" ,
1283                 HFILL}},
1284         {&hf_idrp_open_rib_attr_security_reg_id,
1285             {"Rib Attribute Value Security Registration ID",
1286                 "idrp.open.rib-attr.security.reg-id", FT_BYTES, BASE_NONE,
1287                 NULL, 0, "Identifies the Security Authority" ,
1288                 HFILL}},
1289         {&hf_idrp_open_rib_attr_security_info,
1290             {"Rib Attribute Value Security Registration ID",
1291                 "idrp.open.rib-attr.security.info", FT_BYTES, BASE_NONE,
1292                 NULL, 0, "Additional security related information" ,
1293                 HFILL}},
1294         {&hf_idrp_open_number_of_confederations,
1295             {"Number of Routing Confederations",
1296                 "idrp.open.number-of-confederations", FT_UINT8, BASE_DEC,
1297                 NULL, 0,
1298                 "Number of Routing Domain Identifiers (Routing Domain Confederation) that this BIS is a member of",
1299                 HFILL}},
1300         {&hf_idrp_open_confederation,
1301             {"Routing Confederation", "idrp.open.confederation", FT_BYTES,
1302                 BASE_NONE,
1303                 NULL, 0,
1304                 "Routing Domain Identifier of Routing Domain Confederation that this BIS is a member of",
1305                 HFILL}},
1306         {&hf_idrp_open_authentication_code,
1307             {"Authentication Code", "idrp.open.authentication-code", FT_UINT8,
1308                 BASE_DEC,
1309                 VALS(idrp_pdu_open_authentication_codes), 0,
1310                 "Indicates the authentication mechanism being used",
1311                 HFILL}},
1312         {&hf_idrp_open_authentication_data,
1313             {"Authentication Data", "idrp.open.authentication-data", FT_BYTES,
1314                 BASE_NONE,
1315                 NULL, 0, "Datat used for optional authentication of a peer BIS", HFILL}},
1316         {&hf_idrp_update_number_of_unfeasible_routes,
1317             {"Number of Unfeasible Routes",
1318                 "idrp.update.number-of-unfeasible-routes", FT_UINT16, BASE_DEC,
1319                 NULL, 0,
1320                 "Number of RDIs that are included in the subsequent withdrawn routes field",
1321                 HFILL}},
1322         {&hf_idrp_update_withdrawn_route,
1323             {"Unfeasible Route", "idrp.update.unfeasible-route", FT_UINT32,
1324                 BASE_DEC,
1325                 NULL, 0,
1326                 "Route-ID for the route that id being withdrawn from service",
1327                 HFILL}},
1328         {&hf_idrp_update_path_attr_flag,
1329             {"Path Attribute Flag", "idrp.update.path-attribute-flag", FT_UINT8,
1330                 BASE_HEX,
1331                 VALS(idrp_path_attr_flags), 0, NULL, HFILL}},
1332         {&hf_idrp_update_path_attr_type,
1333             {"Path Attribute Type", "idrp.update.path-attribute-type", FT_UINT8,
1334                 BASE_DEC,
1335                 VALS(path_attr_types), 0, NULL, HFILL}},
1336         {&hf_idrp_update_path_attr_length,
1337             {"Path Attribute Length", "idrp.update.path-attribute-length", FT_UINT16,
1338                 BASE_DEC,
1339                 NULL, 0, NULL, HFILL}},
1340         {&hf_idrp_update_path_attr_route_separator_id,
1341             {"Path Attribute Value Route Separator Id",
1342                 "idrp.update.path-attr.route-separator.id", FT_UINT32, BASE_DEC,
1343                 NULL, 0,",Route identifier for the advertised route",
1344                 HFILL}},
1345         {&hf_idrp_update_path_attr_route_separator_localpref,
1346             {"Path Attribute Value Route Separator Local Pref",
1347                 "idrp.update.path-attr.route-separator.local-pref", FT_UINT8, BASE_DEC,
1348                 NULL, 0,"Contains the local preference value for route",
1349                 HFILL}},
1350         {&hf_idrp_update_path_attr_ext_info,
1351             {"Path Attribute Value External Info",
1352                 "idrp.update.path-attr.ext-info",  FT_BOOLEAN, 8,
1353                 NULL, 0,"Flag indicates if routes have been discovered by means of IDRP",
1354                 HFILL}},
1355         {&hf_idrp_update_path_attr_rd_path_type,
1356             {"Path Attribute Value RD Path Segment Type",
1357                 "idrp.update.path-attr.rd-path.segment-type",  FT_UINT8, BASE_HEX,
1358                 VALS(path_rd_segment_types), 0, NULL,
1359                 HFILL}},
1360         {&hf_idrp_update_path_attr_rd_path_segment_length,
1361             {"Path Attribute Value RD Path Segment Length",
1362                 "idrp.update.path-attr.rd-path.segment-length",  FT_UINT16, BASE_DEC,
1363                 NULL, 0, NULL,
1364                 HFILL}},
1365         {&hf_idrp_update_path_attr_rd_path_rdi,
1366             {"Path Attribute Value RD Path Segment RDI",
1367                 "idrp.update.path-attr.rd-path.segment-rdi",  FT_BYTES, BASE_NONE,
1368                 NULL, 0,"RD Path Segment Routing Identifier or Confederation" ,
1369                 HFILL}},
1370         {&hf_idrp_update_path_attr_next_hop_idrp_server,
1371             {"Path Attribute Value Next Hop Idrp Server",
1372                 "idrp.update.path-attr.next-hop.idrp-server", FT_UINT8, BASE_DEC,
1373                 NULL, 0, "Permit a BIS to advertise a different or local BISs NET" ,
1374                 HFILL}},
1375         {&hf_idrp_update_path_attr_next_hop_proto_type,
1376             {"Path Attribute Value Next Hop Segment Protocol Type",
1377                 "idrp.update.path-attr.next-hop.segment-protp-type",  FT_UINT8, BASE_DEC,
1378                 VALS(idrp_proto_type), 0, NULL ,
1379                 HFILL}},
1380         {&hf_idrp_update_path_attr_next_hop_proto,
1381             {"Path Attribute Value Next Hop Segment Protocol",
1382                 "idrp.update.path-attr.next-hop.segment-proto",  FT_UINT8, BASE_DEC,
1383                 NULL, 0, NULL ,
1384                 HFILL}},
1385         {&hf_idrp_update_path_attr_next_hop_rdi,
1386             {"Path Attribute Value Next Hop RDI",
1387                 "idrp.update.path-attr.next-hop.rdi", FT_BYTES, BASE_NONE,
1388                 NULL, 0, "NET to advertise as next hop segment" ,
1389                 HFILL}},
1390         {&hf_idrp_update_path_attr_next_hop_nb_snpa,
1391             {"Path Attribute Value Next Hop Number of SNPA",
1392                 "idrp.update.path-attr.next-hop.number-snpa", FT_UINT8, BASE_DEC,
1393                 NULL, 0, "Number of SNPA's on next hop segment" ,
1394                 HFILL}},
1395         {&hf_idrp_update_path_attr_next_hop_snpa,
1396             {"Path Attribute Value Next Hop SNPA",
1397                 "idrp.update.path-attr.next-hop.snpa", FT_BYTES, BASE_NONE,
1398                 NULL, 0, "SNPA on next hop segment" ,
1399                 HFILL}},
1400         {&hf_idrp_update_path_attr_dist_list_incl_nb_rdi,
1401             {"Path Attribute Value Dist List Incl Number of RDIs",
1402                 "idrp.update.path-attr.dist-list-incl.number-rdi", FT_UINT8, BASE_DEC,
1403                 NULL, 0, "Number of RDIs which NLRI information may be distributed" ,
1404                 HFILL}},
1405         {&hf_idrp_update_path_attr_dist_list_incl_rdi,
1406             {"Path Attribute Value Dist List Incl RDI",
1407                 "idrp.update.path-attr.dist-list-incl.rdi", FT_BYTES, BASE_NONE,
1408                 NULL, 0, "RDI which NLRI information may be distributed" ,
1409                 HFILL}},
1410         {&hf_idrp_update_path_attr_dist_list_excl_nb_rdi,
1411             {"Path Attribute Value Dist List Excl Number of RDIs",
1412                 "idrp.update.path-attr.dist-list-excl.number-rdi", FT_UINT8, BASE_DEC,
1413                 NULL, 0, "Number of RDIs which NLRI information may not be distributed" ,
1414                 HFILL}},
1415         {&hf_idrp_update_path_attr_dist_list_excl_rdi,
1416             {"Path Attribute Value Dist List Excl RDI",
1417                 "idrp.update.path-attr.dist-list-excl.rdi", FT_BYTES, BASE_NONE,
1418                 NULL, 0, "RDI which NLRI information may be distributed" ,
1419                 HFILL}},
1420         {&hf_idrp_update_path_attr_multi_exit_disc,
1421             {"Path Attribute Value Multi Exit Disc",
1422                 "idrp.update.path-attr.multi-exit-disc", FT_UINT8, BASE_DEC,
1423                 NULL, 0, "Number of exit points to an adjacent domain" ,
1424                 HFILL}},
1425         {&hf_idrp_update_path_attr_transit_delay,
1426             {"Path Attribute Value Transit Delay",
1427                 "idrp.update.path-attr.transit-delay", FT_UINT16, BASE_DEC,
1428                 NULL, 0, "Transit Delay" ,
1429                 HFILL}},
1430         {&hf_idrp_update_path_attr_residual_error,
1431             {"Path Attribute Value Residual Error",
1432                 "idrp.update.path-attr.residual-error", FT_UINT32, BASE_DEC,
1433                 NULL, 0, "Residual error probability to destination" ,
1434                 HFILL}},
1435         {&hf_idrp_update_path_attr_expense,
1436             {"Path Attribute Value Expense",
1437                 "idrp.update.path-attr.expense", FT_UINT16, BASE_DEC,
1438                 NULL, 0, "Expense to destination" ,
1439                 HFILL}},
1440         {&hf_idrp_update_path_attr_locally_defined_qos_nsap,
1441             {"Path Attribute Value Locally Defined Qos NSAP",
1442                 "idrp.update.path-attr.locally-defined-qos.nsap", FT_BYTES, BASE_NONE,
1443                 NULL, 0, "Locally Defined Qos NSAP" ,
1444                 HFILL}},
1445         {&hf_idrp_update_path_attr_locally_defined_qos_value,
1446             {"Path Attribute Value Locally Defined Qos",
1447                 "idrp.update.path-attr.locally-defined-qos.qos", FT_BYTES, BASE_NONE,
1448                 NULL, 0, "Locally Defined Qos Value" ,
1449                 HFILL}},
1450         {&hf_idrp_update_path_attr_locally_defined_qos_metric,
1451             {"Path Attribute Value Locally Defined Qos Metric",
1452                 "idrp.update.path-attr.locally-defined-qos.metric", FT_BYTES, BASE_NONE,
1453                 NULL, 0, "Locally Defined Metric" ,
1454                 HFILL}},
1455         {&hf_idrp_update_path_attr_hierarchicaldecoding,
1456             {"Path Attribute Value Hierarchical Decoding",
1457                 "idrp.update.path-attr.hierarchical-decoding", FT_UINT8, BASE_HEX,
1458                 NULL, 0, "Controls the transitivity of NPDUs through the confederation" ,
1459                 HFILL}},
1460         {&hf_idrp_update_path_attr_rd_hop_count,
1461             {"Path Attribute Value RD Hop Count",
1462                 "idrp.update.path-attr.rd-hop-count", FT_UINT8, BASE_DEC,
1463                 NULL, 0, "Maximum Hop Count for this Routing Information to travel" ,
1464                 HFILL}},
1465         {&hf_idrp_update_path_attr_security_reg_id,
1466             {"Path Attribute Value Security Registration ID",
1467                 "idrp.update.path-attr.security.reg-id", FT_BYTES, BASE_NONE,
1468                 NULL, 0, "Identifies the Security Authority" ,
1469                 HFILL}},
1470         {&hf_idrp_update_path_attr_security_info,
1471             {"Path Attribute Value Security Registration ID",
1472                 "idrp.update.path-attr.security.info", FT_BYTES, BASE_NONE,
1473                 NULL, 0, "Additional security related information" ,
1474                 HFILL}},
1475         {&hf_idrp_update_path_attr_capacity,
1476             {"Path Attribute Value Capacity",
1477                 "idrp.update.path-attr.capacity", FT_UINT8, BASE_DEC,
1478                 NULL, 0, "Capacity of the RD_PATH for handling traffic" ,
1479                 HFILL}},
1480         {&hf_idrp_update_path_attr_priority,
1481             {"Path Attribute Value Capacity",
1482                 "idrp.update.path-attr.capacity", FT_UINT8, BASE_DEC,
1483                 NULL, 0, "Capacity of the RD_PATH for handling traffic" ,
1484                 HFILL}},
1485         {&hf_idrp_update_nlri_proto_type,
1486             {"NLRI Protocol Type", "idrp.update.nlri.proto-type", FT_UINT8,
1487                 BASE_DEC,
1488                 VALS(idrp_proto_type), 0, NULL, HFILL}},
1489         {&hf_idrp_update_nlri_proto_id,
1490             {"NLRI Protocol Identity", "idrp.update.nlri.proto-id", FT_BYTES,
1491                 BASE_NONE,
1492                 NULL, 0,
1493                 "Identity of the protocol associated with the NLRI address information",
1494                 HFILL}},
1495         {&hf_idrp_update_nlri_addr_length,
1496             {"NLRI Address Length",
1497                 "idrp.update.nlri.addr-length", FT_UINT16, BASE_DEC,
1498                 NULL, 0, NULL ,
1499                 HFILL}},
1500         {&hf_idrp_update_nlri_addr_info_nb_bits,
1501             {"NLRI Address Info Bits",
1502                 "idrp.update.nlri.addr-info-bits", FT_UINT8, BASE_DEC,
1503                 NULL, 0, NULL ,
1504                 HFILL}},
1505         {&hf_idrp_update_nlri_addr_info,
1506             {"NLRI Address Info", "idrp.update.nlri.addr-info", FT_BYTES,
1507                 BASE_NONE,
1508                 NULL, 0, "Network Layer Reachability Information Protocol", HFILL}},
1509         {&hf_idrp_error_code,
1510             {"Error Code", "idrp.error.code", FT_UINT8, BASE_DEC,
1511                 VALS(idrp_error_codes), 0,
1512                 NULL, HFILL}},
1513         {&hf_idrp_error_open_subcode,
1514             {"Error Subcode (Open Message)", "idrp.error.subcode", FT_UINT8,
1515                 BASE_DEC, VALS(idrp_error_open_subcodes),
1516                 0, NULL, HFILL}},
1517         {&hf_idrp_error_update_subcode,
1518             {"Error Subcode (Update Message)", "idrp.error.subcode", FT_UINT8,
1519                 BASE_DEC, VALS(idrp_error_update_subcodes),
1520                 0, NULL, HFILL}},
1521         {&hf_idrp_error_hold_timer_subcode,
1522             {"Error Subcode (Hold Timer)", "idrp.error.subcode", FT_UINT8,
1523                 BASE_DEC, VALS(idrp_error_hold_timer_subcodes),
1524                 0, NULL, HFILL}},
1525         {&hf_idrp_error_fsm_subcode,
1526             {"Error Subcode (Fsm State)", "idrp.error.subcode", FT_UINT8,
1527                 BASE_DEC, VALS(idrp_error_fsm_subcodes),
1528                 0, NULL, HFILL}},
1529         {&hf_idrp_error_rib_refresh_subcode,
1530             {"Error Subcode (Rib-Refresh Message)", "idrp.error.subcode",
1531                 FT_UINT8, BASE_DEC, VALS(idrp_error_rib_refresh_subcodes),
1532                 0xff, NULL, HFILL}},
1533         {&hf_idrp_error_data,
1534             {"Error Data", "idrp.error.data", FT_BYTES, BASE_NONE, NULL, 0,
1535                 "Diagnosis data that depends upon the error code and error subcode",
1536                 HFILL}},
1537         {&hf_idrp_rib_refresh_opcode,
1538             {"Rib Refresh opcode", "idrp.rib-refresh.opcode", FT_UINT8, BASE_DEC,
1539                 VALS(idrp_error_rib_refresh_subcodes),
1540                 0xff, NULL, HFILL}},
1541         {&hf_idrp_rib_refresh_rib_attr_locally_defined_qos_nsap,
1542             {"Rib Attribute Value Locally Defined Qos NSAP",
1543                 "idrp.rib-refresh.rib-attr.locally-defined-qos.nsap",
1544                 FT_BYTES, BASE_NONE,
1545                 NULL, 0, "Locally Defined Qos NSAP" ,
1546                 HFILL}},
1547         {&hf_idrp_rib_refresh_rib_attr_locally_defined_qos_value,
1548             {"Rib Attribute Value Locally Defined Qos",
1549                 "idrp.rib-refresh.rib-attr.locally-defined-qos.qos",
1550                 FT_BYTES, BASE_NONE,
1551                 NULL, 0, "Locally Defined Qos Value" ,
1552                 HFILL}},
1553         {&hf_idrp_rib_refresh_rib_attr_locally_defined_qos_metric,
1554             {"Rib Attribute Value Locally Defined Qos Metric",
1555                 "idrp.rib-refresh.rib-attr.locally-defined-qos.metric",
1556                 FT_BYTES, BASE_NONE,
1557                 NULL, 0, "Locally Defined Metric" ,
1558                 HFILL}},
1559         {&hf_idrp_rib_refresh_rib_attr_security_reg_id,
1560             {"Rib Attribute Value Security Registration ID",
1561                 "idrp.rib-refresh.rib-attr.security.reg-id", FT_BYTES, BASE_NONE,
1562                 NULL, 0, "Identifies the Security Authority" ,
1563                 HFILL}},
1564         {&hf_idrp_rib_refresh_rib_attr_security_info,
1565             {"Rib Attribute Value Security Registration ID",
1566                 "idrp.rib-refresh.rib-attr.security.info", FT_BYTES, BASE_NONE,
1567                 NULL, 0, "Additional security related information" ,
1568                 HFILL}},
1569     };
1570
1571     /* List of subtrees */
1572     static gint *ett[] = {
1573         &ett_idrp,
1574         &ett_idrp_sub
1575     };
1576
1577     static ei_register_info ei[] = {
1578         { &ei_idrp_no_path_attributes, { "idrp.no_path_attributes", PI_PROTOCOL, PI_NOTE, "No path attributes", EXPFILL }},
1579     };
1580
1581     expert_module_t* expert_idrp;
1582
1583     proto_idrp = proto_register_protocol(IDRP_PROTO, "IDRP", "idrp");
1584     proto_register_field_array(proto_idrp, hf_idrp, array_length(hf_idrp));
1585     proto_register_subtree_array(ett, array_length(ett));
1586     expert_idrp = expert_register_protocol(proto_idrp);
1587     expert_register_field_array(expert_idrp, ei, array_length(ei));
1588     register_dissector("idrp", dissect_idrp, proto_idrp);
1589
1590 }
1591
1592 /*
1593  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
1594  *
1595  * Local variables:
1596  * c-basic-offset: 4
1597  * tab-width: 8
1598  * indent-tabs-mode: nil
1599  * End:
1600  *
1601  * vi: set shiftwidth=4 tabstop=8 expandtab:
1602  * :indentSize=4:tabSize=8:noTabs=true:
1603  */