Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-do-irp.c
blob7b3637186369657721bfd43ef8b0ad7f19d9f547
1 /* packet-do-irp.c
2 * Dissector for Digital Object Identifier Resolution Protocol (DO-IRP)
4 * Copyright (c) 2023 by Martin Mayer <martin.mayer@m2-it-solutions.de>
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
14 * This dissector is based on:
16 * - Title: Digital Object Identifier Resolution Protocol Specification
17 * Version: 3.0 (June 30, 2022)
18 * Author: DONA Foundation (https://www.dona.net)
21 #include "config.h"
22 #include <epan/packet.h>
23 #include <epan/expert.h>
24 #include <epan/unit_strings.h>
25 #include "packet-tcp.h"
27 /* N.B. IANA has these ports registered for hdl-srv (name from original RFC) */
28 #define DO_IRP_UDP_PORT 2641
29 #define DO_IRP_TCP_PORT 2641
31 #define DO_IRP_ENVELOPE_LEN 20
32 #define DO_IRP_MAX_UDP_SIZE 512
34 void proto_register_do_irp(void);
35 void proto_reg_handoff_do_irp(void);
37 static dissector_handle_t do_irp_handle_udp;
38 static dissector_handle_t do_irp_handle_tcp;
40 static int proto_do_irp;
42 /* Fields Generic */
43 static int hf_do_irp_string_len;
44 static int hf_do_irp_string_value;
45 static int hf_do_irp_data_len;
46 static int hf_do_irp_data_value;
48 /* Fields Message Envelope */
49 static int hf_do_irp_envelope;
50 static int hf_do_irp_version_major;
51 static int hf_do_irp_version_minor;
52 static int hf_do_irp_flags;
53 static int hf_do_irp_flag_cp;
54 static int hf_do_irp_flag_ec;
55 static int hf_do_irp_flag_tc;
56 static int hf_do_irp_version_major_sugg;
57 static int hf_do_irp_version_minor_sugg;
58 static int hf_do_irp_sessid;
59 static int hf_do_irp_reqid;
60 static int hf_do_irp_seq;
61 static int hf_do_irp_msglen;
63 /* Fields Message Header */
64 static int hf_do_irp_header;
65 static int hf_do_irp_opcode;
66 static int hf_do_irp_responsecode;
67 static int hf_do_irp_opflags;
68 static int hf_do_irp_opflags_at;
69 static int hf_do_irp_opflags_ct;
70 static int hf_do_irp_opflags_enc;
71 static int hf_do_irp_opflags_rec;
72 static int hf_do_irp_opflags_ca;
73 static int hf_do_irp_opflags_cn;
74 static int hf_do_irp_opflags_kc;
75 static int hf_do_irp_opflags_po;
76 static int hf_do_irp_opflags_rd;
77 static int hf_do_irp_opflags_owe;
78 static int hf_do_irp_opflags_mns;
79 static int hf_do_irp_opflags_dnr;
80 static int hf_do_irp_sisn;
81 static int hf_do_irp_rcount;
82 static int hf_do_irp_expiration;
83 static int hf_do_irp_bodylen;
85 /* Fields Message Body */
86 static int hf_do_irp_body;
87 static int hf_do_irp_digest_algo;
88 static int hf_do_irp_digest;
89 static int hf_do_irp_error_msg;
90 static int hf_do_irp_error_idxcount;
91 static int hf_do_irp_error_idx;
92 static int hf_do_irp_ident;
93 static int hf_do_irp_idxcount;
94 static int hf_do_irp_idx;
95 static int hf_do_irp_typecount;
96 static int hf_do_irp_type;
97 static int hf_do_irp_identcount;
98 static int hf_do_irp_identrecord;
99 static int hf_do_irp_identrecord_idx;
100 static int hf_do_irp_identrecord_type;
101 static int hf_do_irp_identrecord_value;
102 static int hf_do_irp_identrecord_value_string;
103 static int hf_do_irp_identrecord_value_len;
104 static int hf_do_irp_identrecord_perm;
105 static int hf_do_irp_identrecord_perm_pw;
106 static int hf_do_irp_identrecord_perm_pr;
107 static int hf_do_irp_identrecord_perm_aw;
108 static int hf_do_irp_identrecord_perm_ar;
109 static int hf_do_irp_identrecord_ttl_type;
110 static int hf_do_irp_identrecord_ttl;
111 static int hf_do_irp_identrecord_ttl_absolute;
112 static int hf_do_irp_identrecord_ts;
113 static int hf_do_irp_identrecord_ts_utc;
114 static int hf_do_irp_identrecord_refcount;
115 static int hf_do_irp_identrecord_ref;
116 static int hf_do_irp_hsadmin_perm;
117 static int hf_do_irp_hsadmin_perm_ai;
118 static int hf_do_irp_hsadmin_perm_di;
119 static int hf_do_irp_hsadmin_perm_adp;
120 static int hf_do_irp_hsadmin_perm_me;
121 static int hf_do_irp_hsadmin_perm_de;
122 static int hf_do_irp_hsadmin_perm_ae;
123 static int hf_do_irp_hsadmin_perm_ma;
124 static int hf_do_irp_hsadmin_perm_ra;
125 static int hf_do_irp_hsadmin_perm_aa;
126 static int hf_do_irp_hsadmin_perm_ar;
127 static int hf_do_irp_hsadmin_perm_li;
128 static int hf_do_irp_hsadmin_perm_ldp;
129 static int hf_do_irp_hsadmin_idx;
130 static int hf_do_irp_hsadmin_ident;
131 static int hf_do_irp_body_hssite_version;
132 static int hf_do_irp_hssite_protoversion_major;
133 static int hf_do_irp_hssite_protoversion_minor;
134 static int hf_do_irp_hssite_serial;
135 static int hf_do_irp_hssite_primask;
136 static int hf_do_irp_hssite_primask_pri;
137 static int hf_do_irp_hssite_primask_multi;
138 static int hf_do_irp_hssite_hashoption;
139 static int hf_do_irp_hssite_hashfilter;
140 static int hf_do_irp_hssite_attr_count;
141 static int hf_do_irp_hssite_attr;
142 static int hf_do_irp_hssite_attr_key;
143 static int hf_do_irp_hssite_attr_value;
144 static int hf_do_irp_hssite_srvcount;
145 static int hf_do_irp_hssite_srv;
146 static int hf_do_irp_hssite_srv_id;
147 static int hf_do_irp_hssite_srv_addr;
148 static int hf_do_irp_pkrec;
149 static int hf_do_irp_pkrec_len;
150 static int hf_do_irp_pkrec_type;
151 static int hf_do_irp_pkrec_dsa_q;
152 static int hf_do_irp_pkrec_dsa_p;
153 static int hf_do_irp_pkrec_dsa_g;
154 static int hf_do_irp_pkrec_dsa_y;
155 static int hf_do_irp_pkrec_rsa_exp;
156 static int hf_do_irp_pkrec_rsa_mod;
157 static int hf_do_irp_pkrec_dh_p;
158 static int hf_do_irp_pkrec_dh_g;
159 static int hf_do_irp_pkrec_dh_y;
160 static int hf_do_irp_hssite_srv_if;
161 static int hf_do_irp_hssite_srv_ifcount;
162 static int hf_do_irp_hssite_srv_if_type;
163 static int hf_do_irp_hssite_srv_if_type_admin;
164 static int hf_do_irp_hssite_srv_if_type_res;
165 static int hf_do_irp_hssite_srv_if_proto;
166 static int hf_do_irp_hssite_srv_if_port;
167 static int hf_do_irp_hsserv_ident;
168 static int hf_do_irp_hsvlist_count;
169 static int hf_do_irp_hsvlist_ref;
170 static int hf_do_irp_hsalias;
171 static int hf_do_irp_hsnamespace;
172 static int hf_do_irp_hscert_jwt;
173 static int hf_do_irp_hssignature_jwt;
174 static int hf_do_irp_refident;
175 static int hf_do_irp_nonce;
176 static int hf_do_irp_authtype;
177 static int hf_do_irp_keyident;
178 static int hf_do_irp_keyidx;
179 static int hf_do_irp_challresp;
180 static int hf_do_irp_veri_result;
181 static int hf_do_irp_ignoredident;
182 static int hf_do_irp_keyexmode;
183 static int hf_do_irp_timeout;
185 /* Fields Message Credential */
186 static int hf_do_irp_credential;
187 static int hf_do_irp_credential_len;
188 static int hf_do_irp_credential_sesscounter;
189 static int hf_do_irp_credential_type;
190 static int hf_do_irp_credential_signedinfo;
191 static int hf_do_irp_credential_signedinfo_len;
192 static int hf_do_irp_credential_signedinfo_algo;
193 static int hf_do_irp_credential_signedinfo_sig;
195 /* Conversation */
196 static int hf_do_irp_response_in;
197 static int hf_do_irp_response_to;
199 /* Fragment handling */
200 static int hf_msg_fragments;
201 static int hf_msg_fragment;
202 static int hf_msg_fragment_overlap;
203 static int hf_msg_fragment_overlap_conflicts;
204 static int hf_msg_fragment_multiple_tails;
205 static int hf_msg_fragment_too_long_fragment;
206 static int hf_msg_fragment_error;
207 static int hf_msg_fragment_count;
208 static int hf_msg_reassembled_in;
209 static int hf_msg_reassembled_len;
210 static int hf_msg_reassembled_data;
212 /* Expert fields */
213 static expert_field ei_do_irp_digest_unknown;
214 static expert_field ei_do_irp_frag_wo_tc;
216 /* Trees */
217 static int ett_do_irp;
218 static int ett_do_irp_string;
219 static int ett_do_irp_envelope;
220 static int ett_do_irp_envelope_flags;
221 static int ett_do_irp_header;
222 static int ett_do_irp_header_flags;
223 static int ett_do_irp_body;
224 static int ett_do_irp_credential;
225 static int ett_do_irp_credential_signedinfo;
226 static int ett_do_irp_identifier_record;
227 static int ett_do_irp_element_permission_flags;
228 static int ett_do_irp_element_hsadmin_permission_flags;
229 static int ett_do_irp_element_hsadmin_primary_flags;
230 static int ett_do_irp_hsadmin;
231 static int ett_do_irp_hssite;
232 static int ett_do_irp_hssite_attribute;
233 static int ett_do_irp_hssite_server;
234 static int ett_do_irp_hssite_server_if;
235 static int ett_do_irp_hssite_server_if_flags;
236 static int ett_do_irp_pk;
237 static int ett_msg_fragment;
238 static int ett_msg_fragments;
240 static const fragment_items msg_frag_items = {
241 &ett_msg_fragment,
242 &ett_msg_fragments,
243 &hf_msg_fragments,
244 &hf_msg_fragment,
245 &hf_msg_fragment_overlap,
246 &hf_msg_fragment_overlap_conflicts,
247 &hf_msg_fragment_multiple_tails,
248 &hf_msg_fragment_too_long_fragment,
249 &hf_msg_fragment_error,
250 &hf_msg_fragment_count,
251 &hf_msg_reassembled_in,
252 &hf_msg_reassembled_len,
253 &hf_msg_reassembled_data,
254 "Message fragments"
257 /* Request Hashmap Key */
258 struct do_irp_request_hash_key {
259 uint32_t conv_index;
260 uint32_t reqid;
262 /* Request Hashmap Val */
263 struct do_irp_request_hash_val {
264 uint32_t pnum;
265 uint32_t pnum_resp;
266 uint32_t opcode;
268 static wmem_map_t *do_irp_request_hash_map;
270 #define DO_IRP_OC_RESERVED 0
271 #define DO_IRP_OC_RESOLUTION 1
272 #define DO_IRP_OC_GET_SITEINFO 2
273 #define DO_IRP_OC_CREATE_ID 100
274 #define DO_IRP_OC_DELETE_ID 101
275 #define DO_IRP_OC_ADD_ELEMENT 102
276 #define DO_IRP_OC_REMOVE_ELEMENT 103
277 #define DO_IRP_OC_MODIFY_ELEMENT 104
278 #define DO_IRP_OC_LIST_IDS 105
279 #define DO_IRP_OC_LIST_DERIVED_PREFIXES 106
280 #define DO_IRP_OC_CHALLENGE_RESPONSE 200
281 #define DO_IRP_OC_VERIFY_RESPONSE 201
282 #define DO_IRP_OC_HOME_PREFIX 300
283 #define DO_IRP_OC_UNHOME_PREFIX 301
284 #define DO_IRP_OC_LIST_HOMED_PREFIXES 302
285 #define DO_IRP_OC_SESSION_SETUP 400
286 #define DO_IRP_OC_SESSION_TERMINATE 401
289 static const value_string opcode_vals[] = {
290 { DO_IRP_OC_RESERVED, "RESERVED" },
291 { DO_IRP_OC_RESOLUTION, "RESOLUTION" },
292 { DO_IRP_OC_GET_SITEINFO, "GET_SITEINFO" },
293 { DO_IRP_OC_CREATE_ID, "CREATE_ID" },
294 { DO_IRP_OC_DELETE_ID, "DELETE_ID" },
295 { DO_IRP_OC_ADD_ELEMENT, "ADD_ELEMENT" },
296 { DO_IRP_OC_REMOVE_ELEMENT, "REMOVE_ELEMENT" },
297 { DO_IRP_OC_MODIFY_ELEMENT, "MODIFY_ELEMENT" },
298 { DO_IRP_OC_LIST_IDS, "LIST_IDS" },
299 { DO_IRP_OC_LIST_DERIVED_PREFIXES, "LIST_DERIVED_PREFIXES" },
300 { DO_IRP_OC_CHALLENGE_RESPONSE, "CHALLENGE_RESPONSE" },
301 { DO_IRP_OC_VERIFY_RESPONSE, "VERIFY_RESPONSE" },
302 { DO_IRP_OC_HOME_PREFIX, "HOME_PREFIX" },
303 { DO_IRP_OC_UNHOME_PREFIX, "UNHOME_PREFIX" },
304 { DO_IRP_OC_LIST_HOMED_PREFIXES, "LIST_HOMED_PREFIXES" },
305 { DO_IRP_OC_SESSION_SETUP, "SESSION_SETUP" },
306 { DO_IRP_OC_SESSION_TERMINATE, "SESSION_TERMINATE" },
307 { 0, NULL },
310 #define DO_IRP_RC_RESERVED 0
311 #define DO_IRP_RC_SUCCESS 1
312 #define DO_IRP_RC_ERROR 2
313 #define DO_IRP_RC_SERVER_BUSY 3
314 #define DO_IRP_RC_PROTOCOL_ERROR 4
315 #define DO_IRP_RC_OPERATION_DENIED 5
316 #define DO_IRP_RC_RECUR_LIMIT_EXCEEDED 6
317 #define DO_IRP_RC_SERVER_BACKUP 7
318 #define DO_IRP_RC_ID_NOT_FOUND 100
319 #define DO_IRP_RC_ID_ALREADY_EXIST 101
320 #define DO_IRP_RC_INVALID_ID 102
321 #define DO_IRP_RC_ELEMENT_NOT_FOUND 200
322 #define DO_IRP_RC_ELEMENT_ALREADY_EXIST 201
323 #define DO_IRP_RC_ELEMENT_INVALID 202
324 #define DO_IRP_RC_EXPIRED_SITE_INFO 300
325 #define DO_IRP_RC_SERVER_NOT_RESP 301
326 #define DO_IRP_RC_SERVICE_REFERRAL 302
327 #define DO_IRP_RC_PREFIX_REFERRAL 303
328 #define DO_IRP_RC_INVALID_ADMIN 400
329 #define DO_IRP_RC_ACCESS_DENIED 401
330 #define DO_IRP_RC_AUTHEN_NEEDED 402
331 #define DO_IRP_RC_AUTHEN_FAILED 403
332 #define DO_IRP_RC_INVALID_CREDENTIAL 404
333 #define DO_IRP_RC_AUTHEN_TIMEOUT 405
334 #define DO_IRP_RC_UNABLE_TO_AUTHEN 406
335 #define DO_IRP_RC_SESSION_TIMEOUT 500
336 #define DO_IRP_RC_SESSION_FAILED 501
337 #define DO_IRP_RC_SESSION_KEY_INVALID 502
338 #define DO_IRP_RC_SESSION_MSG_REJECTED 505
341 static const value_string responsecode_vals[] = {
342 { DO_IRP_RC_RESERVED, "RESERVED" },
343 { DO_IRP_RC_SUCCESS, "SUCCESS" },
344 { DO_IRP_RC_ERROR, "ERROR" },
345 { DO_IRP_RC_SERVER_BUSY, "SERVER_BUSY" },
346 { DO_IRP_RC_PROTOCOL_ERROR, "PROTOCOL_ERROR" },
347 { DO_IRP_RC_OPERATION_DENIED, "OPERATION_DENIED" },
348 { DO_IRP_RC_RECUR_LIMIT_EXCEEDED, "RECUR_LIMIT_EXCEEDED" },
349 { DO_IRP_RC_SERVER_BACKUP, "SERVER_BACKUP" },
350 { DO_IRP_RC_ID_NOT_FOUND, "ID_NOT_FOUND" },
351 { DO_IRP_RC_ID_ALREADY_EXIST, "ID_ALREADY_EXIST" },
352 { DO_IRP_RC_INVALID_ID, "INVALID_ID" },
353 { DO_IRP_RC_ELEMENT_NOT_FOUND, "ELEMENT_NOT_FOUND" },
354 { DO_IRP_RC_ELEMENT_ALREADY_EXIST, "ELEMENT_ALREADY_EXIST" },
355 { DO_IRP_RC_ELEMENT_INVALID, "ELEMENT_INVALID" },
356 { DO_IRP_RC_EXPIRED_SITE_INFO, "EXPIRED_SITE_INFO" },
357 { DO_IRP_RC_SERVER_NOT_RESP, "SERVER_NOT_RESP" },
358 { DO_IRP_RC_SERVICE_REFERRAL, "SERVICE_REFERRAL" },
359 { DO_IRP_RC_PREFIX_REFERRAL, "PREFIX_REFERRAL" },
360 { DO_IRP_RC_INVALID_ADMIN, "INVALID_ADMIN" },
361 { DO_IRP_RC_ACCESS_DENIED, "ACCESS_DENIED" },
362 { DO_IRP_RC_AUTHEN_NEEDED, "AUTHEN_NEEDED" },
363 { DO_IRP_RC_AUTHEN_FAILED, "AUTHEN_FAILED" },
364 { DO_IRP_RC_INVALID_CREDENTIAL, "INVALID_CREDENTIAL" },
365 { DO_IRP_RC_AUTHEN_TIMEOUT, "AUTHEN_TIMEOUT" },
366 { DO_IRP_RC_UNABLE_TO_AUTHEN, "UNABLE_TO_AUTHEN" },
367 { DO_IRP_RC_SESSION_TIMEOUT, "SESSION_TIMEOUT" },
368 { DO_IRP_RC_SESSION_FAILED, "SESSION_FAILED" },
369 { DO_IRP_RC_SESSION_KEY_INVALID, "SESSION_KEY_INVALID" },
370 { DO_IRP_RC_SESSION_MSG_REJECTED, "SESSION_MSG_REJECTED" },
371 { 0, NULL },
374 #define DO_IRP_DIGEST_ALGO_MD5 1
375 #define DO_IRP_DIGEST_ALGO_SHA1 2
376 #define DO_IRP_DIGEST_ALGO_SHA256 3
378 static const value_string digest_algo_vals[] = {
379 { DO_IRP_DIGEST_ALGO_MD5, "MD5" },
380 { DO_IRP_DIGEST_ALGO_SHA1, "SHA-1" },
381 { DO_IRP_DIGEST_ALGO_SHA256, "SHA-256" },
382 { 0, NULL },
385 #define DO_IRP_TTL_RELATIVE 0
386 #define DO_IRP_TTL_ABSOLUTE 1
388 static const value_string ttl_vals[] = {
389 { DO_IRP_TTL_RELATIVE, "relative" },
390 { DO_IRP_TTL_ABSOLUTE, "absolute" },
391 { 0, NULL },
394 static const value_string hashoption_vals[] = {
395 { 0x0, "HASH_BY_PREFIX" },
396 { 0x1, "HASH_BY_SUFFIX" },
397 { 0x2, "HASH_BY_IDENTIFIER" },
398 { 0, NULL },
401 static const value_string transportproto_vals[] = {
402 { 0x0, "UDP" },
403 { 0x1, "TCP" },
404 { 0x2, "HTTP" },
405 { 0x3, "HTTPS" },
406 { 0, NULL },
409 static const value_string verification_resp_vals[] = {
410 { 0x0, "Fail" },
411 { 0x1, "Match" },
412 { 0, NULL },
415 static const value_string key_exchange_vals[] = {
416 { 0x4, "Diffie-Hellman" },
417 { 0, NULL },
420 static reassembly_table do_irp_reassemble_table;
422 /* wmem hash/equal funcs */
423 static unsigned
424 do_irp_handle_hash (const void *v)
426 const struct do_irp_request_hash_key *key = (const struct do_irp_request_hash_key *)v;
427 unsigned val;
429 val = key->conv_index + key->reqid;
431 return val;
434 static int
435 do_irp_handle_equal(const void *v, const void *w)
437 const struct do_irp_request_hash_key *v1 = (const struct do_irp_request_hash_key *)v;
438 const struct do_irp_request_hash_key *v2 = (const struct do_irp_request_hash_key *)w;
440 if (
441 v1->conv_index == v2->conv_index &&
442 v1->reqid == v2->reqid
445 return 1;
448 return 0;
452 * Decodes a string to the given hf and adds it to a tree
453 * All "strings" are defined as 4 octets representing the length of of the actual string,
454 * followed by the octets representing the actual string.
456 * Passed hf must be of any FT_STRING type
458 * Returns length of the dissected string
459 * length, value_of_string and string_tree can be used by the calling function.
461 static int
462 decode_string(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int hf, const char **value_of_string)
464 uint32_t len = tvb_get_int32(tvb, offset, ENC_BIG_ENDIAN);
465 proto_item *ti;
467 const char *text = tvb_get_string_enc(pinfo->pool, tvb, offset+4, len, ENC_UTF_8);
469 if(len) {
470 ti = proto_tree_add_string_format_value(tree, hf, tvb, offset, len + 4, text, "%s, Len: %u", text, len);
471 } else {
472 ti = proto_tree_add_string_format_value(tree, hf, tvb, offset, len + 4, text, "empty, Len: %u", len);
475 proto_tree *string_tree = proto_item_add_subtree(ti, ett_do_irp_string);
477 proto_tree_add_item(string_tree, hf_do_irp_string_len, tvb, offset, 4, ENC_BIG_ENDIAN);
478 proto_tree_add_item(string_tree, hf_do_irp_string_value, tvb, offset + 4, len, ENC_UTF_8);
480 if(value_of_string != NULL) {
481 *value_of_string = text;
484 return len + 4;
488 * Decodes generic byte-values to the given hf and adds it to a tree
490 * Returns length of the dissected value
492 static int
493 decode_generic_data(tvbuff_t *tvb, proto_tree *tree, int offset, int hf)
495 uint32_t len = tvb_get_int32(tvb, offset, ENC_BIG_ENDIAN);
497 proto_item *ti = proto_tree_add_item(tree, hf, tvb, offset, len + 4, ENC_NA);
498 proto_tree *string_tree = proto_item_add_subtree(ti, ett_do_irp_string);
500 proto_tree_add_item(string_tree, hf_do_irp_data_len, tvb, offset, 4, ENC_BIG_ENDIAN);
501 proto_tree_add_item(string_tree, hf_do_irp_data_value, tvb, offset + 4, len, ENC_NA);
503 return len + 4;
507 * Decodes public key data (e.g. in HS_SITE, HS_PUBKEY)
509 * Returns length of the dissected data
511 static int
512 decode_pk_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
514 int len = 0;
516 uint32_t pk_len = tvb_get_uint32(tvb, offset + len, ENC_BIG_ENDIAN);
518 proto_item *ti = proto_tree_add_item(tree, hf_do_irp_pkrec, tvb, offset, pk_len + 4, ENC_NA);
519 proto_tree *pk_tree = proto_item_add_subtree(ti, ett_do_irp_pk);
521 proto_tree_add_item(pk_tree, hf_do_irp_pkrec_len, tvb, offset + len, 4, ENC_BIG_ENDIAN);
522 len += 4;
524 const char *pk_type;
525 int pk_type_len = decode_string(tvb, pinfo, pk_tree, offset + len, hf_do_irp_pkrec_type, &pk_type);
526 len += pk_type_len;
528 len += 2; /* Reserved */
530 proto_item_append_text(pk_tree, " (%s)", pk_type);
532 if(!strcmp("DSA_PUB_KEY", pk_type)) {
533 len += decode_generic_data(tvb, pk_tree, offset + len, hf_do_irp_pkrec_dsa_q);
534 len += decode_generic_data(tvb, pk_tree, offset + len, hf_do_irp_pkrec_dsa_p);
535 len += decode_generic_data(tvb, pk_tree, offset + len, hf_do_irp_pkrec_dsa_g);
536 decode_generic_data(tvb, pk_tree, offset + len, hf_do_irp_pkrec_dsa_y);
538 else if(!strcmp("RSA_PUB_KEY", pk_type)) {
539 len += decode_generic_data(tvb, pk_tree, offset + len, hf_do_irp_pkrec_rsa_exp);
540 decode_generic_data(tvb, pk_tree, offset + len, hf_do_irp_pkrec_rsa_mod);
541 /* len += 4; */ /* unused, 4 empty bytes */
543 else if(!strcmp("DH_PUB_KEY", pk_type)) {
544 len += decode_generic_data(tvb, pk_tree, offset + len, hf_do_irp_pkrec_dh_y);
545 len += decode_generic_data(tvb, pk_tree, offset + len, hf_do_irp_pkrec_dh_p);
546 decode_generic_data(tvb, pk_tree, offset + len, hf_do_irp_pkrec_dh_g);
548 /* else: undefined, not dissectable */
550 return pk_len + 4;
554 * Decodes a HS_ADMIN element
556 * Returns length of the dissected data
558 static int
559 decode_hsadmin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
561 int len = 0;
563 proto_tree *ti_hsadmin = proto_tree_add_item(tree, hf_do_irp_identrecord_value, tvb, offset + len, -1, ENC_NA);
564 proto_tree *do_irp_hsadmin_tree = proto_item_add_subtree(ti_hsadmin, ett_do_irp_hsadmin);
566 proto_tree_add_item(do_irp_hsadmin_tree, hf_do_irp_identrecord_value_len, tvb, offset + len, 4, ENC_BIG_ENDIAN);
567 len += 4;
569 static int* const hsadmin_permission_bits[] = {
570 &hf_do_irp_hsadmin_perm_ldp,
571 &hf_do_irp_hsadmin_perm_li,
572 &hf_do_irp_hsadmin_perm_ar,
573 &hf_do_irp_hsadmin_perm_aa,
574 &hf_do_irp_hsadmin_perm_ra,
575 &hf_do_irp_hsadmin_perm_ma,
576 &hf_do_irp_hsadmin_perm_ae,
577 &hf_do_irp_hsadmin_perm_de,
578 &hf_do_irp_hsadmin_perm_me,
579 &hf_do_irp_hsadmin_perm_adp,
580 &hf_do_irp_hsadmin_perm_di,
581 &hf_do_irp_hsadmin_perm_ai,
582 NULL
585 proto_tree_add_bitmask(do_irp_hsadmin_tree, tvb, offset + len, hf_do_irp_hsadmin_perm, ett_do_irp_element_hsadmin_permission_flags, hsadmin_permission_bits, ENC_BIG_ENDIAN);
586 len += 2;
588 const char *admin_identifier;
589 len += decode_string(tvb, pinfo, do_irp_hsadmin_tree, offset + len, hf_do_irp_hsadmin_ident, &admin_identifier);
591 proto_tree_add_item(do_irp_hsadmin_tree, hf_do_irp_hsadmin_idx, tvb, offset + len, 4, ENC_BIG_ENDIAN);
592 proto_item_append_text(ti_hsadmin, " %s, Index: %u", admin_identifier, tvb_get_uint32(tvb, offset + len, ENC_BIG_ENDIAN));
593 len += 4;
595 proto_item_set_len(ti_hsadmin, len);
596 return len;
600 * Decodes a HS_SITE element
602 * Returns length of the dissected data
604 static int
605 decode_hssite(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
607 int len = 0;
609 proto_tree *ti_hssite = proto_tree_add_item(tree, hf_do_irp_identrecord_value, tvb, offset + len, -1, ENC_NA);
610 proto_tree *do_irp_hssite_tree = proto_item_add_subtree(ti_hssite, ett_do_irp_hssite);
612 proto_tree_add_item(do_irp_hssite_tree, hf_do_irp_identrecord_value_len, tvb, offset + len, 4, ENC_BIG_ENDIAN);
613 len += 4;
615 proto_tree_add_item(do_irp_hssite_tree, hf_do_irp_body_hssite_version, tvb, offset + len, 2, ENC_BIG_ENDIAN);
616 len += 2;
618 proto_tree_add_item(do_irp_hssite_tree, hf_do_irp_hssite_protoversion_major, tvb, offset + len, 1, ENC_BIG_ENDIAN);
619 len += 1;
621 proto_tree_add_item(do_irp_hssite_tree, hf_do_irp_hssite_protoversion_minor, tvb, offset + len, 1, ENC_BIG_ENDIAN);
622 len += 1;
624 proto_tree_add_item(do_irp_hssite_tree, hf_do_irp_hssite_serial, tvb, offset + len, 2, ENC_BIG_ENDIAN);
625 len += 2;
627 static int* const hssite_primary_bits[] = {
628 &hf_do_irp_hssite_primask_pri,
629 &hf_do_irp_hssite_primask_multi,
630 NULL
633 proto_tree_add_bitmask(do_irp_hssite_tree, tvb, offset + len, hf_do_irp_hssite_primask, ett_do_irp_element_hsadmin_primary_flags, hssite_primary_bits, ENC_BIG_ENDIAN);
634 len += 1;
636 proto_tree_add_item(do_irp_hssite_tree, hf_do_irp_hssite_hashoption, tvb, offset + len, 1, ENC_BIG_ENDIAN);
637 len += 1;
639 len += decode_string(tvb, pinfo, do_irp_hssite_tree, offset + len, hf_do_irp_hssite_hashfilter, NULL);
641 uint32_t attr = tvb_get_uint32(tvb, offset + len, ENC_BIG_ENDIAN);
642 proto_tree_add_item(do_irp_hssite_tree, hf_do_irp_hssite_attr_count, tvb, offset + len, 4, ENC_BIG_ENDIAN);
643 len += 4;
645 for(uint32_t i = 0; i < attr; i++) {
646 proto_tree *ti_hssite_attr = proto_tree_add_item(do_irp_hssite_tree, hf_do_irp_hssite_attr, tvb, offset + len, -1, ENC_NA);
647 proto_tree *do_irp_hssite_attr_tree = proto_item_add_subtree(ti_hssite_attr, ett_do_irp_hssite_attribute);
648 int attr_len = 0;
650 const char *attr_name;
652 attr_len += decode_string(tvb, pinfo, do_irp_hssite_attr_tree, offset + len + attr_len, hf_do_irp_hssite_attr_key, &attr_name);
653 attr_len += decode_string(tvb, pinfo, do_irp_hssite_attr_tree, offset + len + attr_len, hf_do_irp_hssite_attr_value, NULL);
654 len += attr_len;
655 proto_item_append_text(do_irp_hssite_attr_tree, " (%s)", attr_name);
656 proto_item_set_len(ti_hssite_attr, attr_len);
659 uint32_t serv = tvb_get_uint32(tvb, offset + len, ENC_BIG_ENDIAN);
660 proto_tree_add_item(do_irp_hssite_tree, hf_do_irp_hssite_srvcount, tvb, offset + len, 4, ENC_BIG_ENDIAN);
661 len += 4;
663 for(uint32_t i = 0; i < serv; i++) {
665 proto_tree *ti_hssite_serv = proto_tree_add_item(do_irp_hssite_tree, hf_do_irp_hssite_srv, tvb, offset + len, -1, ENC_NA);
666 proto_tree *do_irp_hssite_serv_tree = proto_item_add_subtree(ti_hssite_serv, ett_do_irp_hssite_server);
667 int serv_len = 0;
669 proto_tree_add_item(do_irp_hssite_serv_tree, hf_do_irp_hssite_srv_id, tvb, offset + len + serv_len, 4, ENC_BIG_ENDIAN);
670 proto_item_append_text(do_irp_hssite_serv_tree, " (ID: %u)", tvb_get_uint32(tvb, offset + len + serv_len, ENC_BIG_ENDIAN));
671 serv_len += 4;
673 proto_tree_add_item(do_irp_hssite_serv_tree, hf_do_irp_hssite_srv_addr, tvb, offset + len + serv_len, 16, ENC_NA);
674 serv_len += 16;
676 serv_len += decode_pk_data(tvb, pinfo, do_irp_hssite_serv_tree, offset + len + serv_len);
678 uint32_t servif = tvb_get_uint32(tvb, offset + len + serv_len, ENC_BIG_ENDIAN);
679 proto_tree_add_item(do_irp_hssite_serv_tree, hf_do_irp_hssite_srv_ifcount, tvb, offset + len + serv_len, 4, ENC_BIG_ENDIAN);
680 serv_len += 4;
682 for(uint32_t j = 0; j < servif; j++) {
684 proto_tree *ti_hssite_serv_if = proto_tree_add_item(do_irp_hssite_serv_tree, hf_do_irp_hssite_srv_if, tvb, offset + len + serv_len, 6, ENC_NA);
685 proto_tree *do_irp_hssite_serv_if_tree = proto_item_add_subtree(ti_hssite_serv_if, ett_do_irp_hssite_server_if);
687 static int* const hsadmin_srv_if_type_bits[] = {
688 &hf_do_irp_hssite_srv_if_type_res,
689 &hf_do_irp_hssite_srv_if_type_admin,
690 NULL
693 proto_tree_add_bitmask(do_irp_hssite_serv_if_tree, tvb, offset + len + serv_len, hf_do_irp_hssite_srv_if_type, ett_do_irp_hssite_server_if_flags, hsadmin_srv_if_type_bits, ENC_BIG_ENDIAN);
694 serv_len += 1;
696 uint8_t serv_if_proto = tvb_get_uint8(tvb, offset + len + serv_len);
697 proto_tree_add_item(do_irp_hssite_serv_if_tree, hf_do_irp_hssite_srv_if_proto, tvb, offset + len + serv_len, 1, ENC_BIG_ENDIAN);
698 serv_len += 1;
700 uint32_t serv_if_port = tvb_get_uint32(tvb, offset + len + serv_len, ENC_BIG_ENDIAN);
701 proto_tree_add_item(do_irp_hssite_serv_if_tree, hf_do_irp_hssite_srv_if_port, tvb, offset + len + serv_len, 4, ENC_BIG_ENDIAN);
702 serv_len += 4;
704 proto_item_append_text(do_irp_hssite_serv_if_tree, " (%s:%u)",
705 val_to_str_const(serv_if_proto, transportproto_vals, "Unknown"),
706 serv_if_port
710 proto_item_set_len(ti_hssite_serv, serv_len);
711 len += serv_len;
714 proto_item_set_len(ti_hssite, len);
715 return len;
719 * Decodes an identifier record
721 * Returns length of the dissected record
723 static int
724 decode_identifier_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
726 int len = 0;
728 const char *type_string;
730 proto_item *ti = proto_tree_add_item(tree, hf_do_irp_identrecord, tvb, offset, -1, ENC_NA);
731 proto_tree *do_irp_record_tree = proto_item_add_subtree(ti, ett_do_irp_identifier_record);
733 proto_tree_add_item(do_irp_record_tree, hf_do_irp_identrecord_idx, tvb, offset + len, 4, ENC_BIG_ENDIAN);
734 len += 4;
736 proto_tree_add_item(do_irp_record_tree, hf_do_irp_identrecord_ts, tvb, offset + len, 4, ENC_BIG_ENDIAN);
737 proto_item *ts = proto_tree_add_item(do_irp_record_tree, hf_do_irp_identrecord_ts_utc, tvb, offset + len, 4, ENC_TIME_SECS);
738 proto_item_set_generated(ts);
739 len += 4;
741 uint8_t ttl_type = tvb_get_uint8(tvb, offset + len);
742 proto_tree_add_item(do_irp_record_tree, hf_do_irp_identrecord_ttl_type, tvb, offset + len, 1, ENC_BIG_ENDIAN);
743 len += 1;
745 proto_tree_add_item(do_irp_record_tree, hf_do_irp_identrecord_ttl, tvb, offset + len, 4, ENC_BIG_ENDIAN);
746 if(ttl_type == DO_IRP_TTL_ABSOLUTE) {
747 proto_item *ttl = proto_tree_add_item(do_irp_record_tree, hf_do_irp_identrecord_ttl_absolute, tvb, offset + len, 4, ENC_TIME_SECS);
748 proto_item_set_generated(ttl);
750 len += 4;
752 static int* const permission_bits[] = {
753 &hf_do_irp_identrecord_perm_ar,
754 &hf_do_irp_identrecord_perm_aw,
755 &hf_do_irp_identrecord_perm_pr,
756 &hf_do_irp_identrecord_perm_pw,
757 NULL
760 proto_tree_add_bitmask(do_irp_record_tree, tvb, offset + len, hf_do_irp_identrecord_perm, ett_do_irp_element_permission_flags, permission_bits, ENC_BIG_ENDIAN);
761 len += 1;
763 len += decode_string(tvb, pinfo, do_irp_record_tree, offset + len, hf_do_irp_identrecord_type, &type_string);
764 proto_item_append_text(do_irp_record_tree, " (%s)", type_string);
766 if(!strcmp("HS_ADMIN", type_string)) {
767 len += decode_hsadmin(tvb, pinfo, do_irp_record_tree, offset + len);
769 else if(!strcmp("HS_SITE", type_string) || !strcmp("HS_SITE.PREFIX", type_string)) {
770 len += decode_hssite(tvb, pinfo, do_irp_record_tree, offset + len);
772 else if(!strcmp("HS_SERV", type_string) || !strcmp("HS_SERV.PREFIX", type_string)) {
773 len += decode_string(tvb, pinfo, do_irp_record_tree, offset + len, hf_do_irp_hsserv_ident, NULL);
775 else if(!strcmp("HS_PUBKEY", type_string)) {
776 len += decode_pk_data(tvb, pinfo, do_irp_record_tree, offset + len);
778 else if(!strcmp("HS_VLIST", type_string)) {
779 uint32_t refs = tvb_get_uint32(tvb, offset + len, ENC_BIG_ENDIAN);
780 proto_tree_add_item(do_irp_record_tree, hf_do_irp_hsvlist_count, tvb, offset + len, 4, ENC_BIG_ENDIAN);
781 len += 4;
783 for(uint32_t i = 0; i < refs; i++) {
784 len += decode_string(tvb, pinfo, do_irp_record_tree, offset + len, hf_do_irp_hsvlist_ref, NULL);
787 else if(!strcmp("HS_NAMESPACE", type_string)) {
788 len += decode_string(tvb, pinfo, do_irp_record_tree, offset + len, hf_do_irp_hsnamespace, NULL);
790 else if(!strcmp("HS_ALIAS", type_string)) {
791 len += decode_string(tvb, pinfo, do_irp_record_tree, offset + len, hf_do_irp_hsalias, NULL);
793 else if(!strcmp("HS_CERT", type_string)) {
794 len += decode_string(tvb, pinfo, do_irp_record_tree, offset + len, hf_do_irp_hscert_jwt, NULL);
796 else if(!strcmp("HS_SIGNATURE", type_string)) {
797 len += decode_string(tvb, pinfo, do_irp_record_tree, offset + len, hf_do_irp_hssignature_jwt, NULL);
799 else if(
800 !strcmp("DESC", type_string) ||
801 !strcmp("EMAIL", type_string) ||
802 !strcmp("URL", type_string)
804 /* generic string */
805 len += decode_string(tvb, pinfo, do_irp_record_tree, offset + len, hf_do_irp_identrecord_value_string, NULL);
807 else {
808 /* generic data */
809 len += decode_generic_data(tvb, do_irp_record_tree, offset + len, hf_do_irp_identrecord_value);
812 uint32_t references = tvb_get_uint32(tvb, offset + len, ENC_BIG_ENDIAN);
813 proto_tree_add_item(do_irp_record_tree, hf_do_irp_identrecord_refcount, tvb, offset + len, 4, ENC_BIG_ENDIAN);
814 len += 4;
816 for(uint32_t i = 0; i < references; i++) {
817 len += decode_string(tvb, pinfo, do_irp_record_tree, offset + len, hf_do_irp_identrecord_ref, NULL);
820 proto_item_set_len(ti, len);
822 return len;
826 * Decodes message envelope
828 * Returns length of the dissected record
829 * It also sets reqid (Request ID) and encrypted (the encrypted bit)
831 static int
832 decode_envelope(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t *reqid, bool *encrypted)
835 col_set_str(pinfo->cinfo, COL_PROTOCOL, "DO-IRP");
836 col_clear(pinfo->cinfo,COL_INFO);
838 int offset = 0;
840 /* Message Envelope */
841 proto_item *ti_envelope = proto_tree_add_item(tree, hf_do_irp_envelope, tvb, offset, 20, ENC_NA);
842 proto_tree *do_irp_envelope_tree = proto_item_add_subtree(ti_envelope, ett_do_irp_envelope);
844 proto_tree_add_item(do_irp_envelope_tree, hf_do_irp_version_major, tvb, offset, 1, ENC_BIG_ENDIAN);
845 offset += 1;
847 proto_tree_add_item(do_irp_envelope_tree, hf_do_irp_version_minor, tvb, offset, 1, ENC_BIG_ENDIAN);
848 offset += 1;
850 static int* const envelope_flag_bits[] = {
851 &hf_do_irp_flag_cp,
852 &hf_do_irp_flag_ec,
853 &hf_do_irp_flag_tc,
854 NULL
857 *encrypted = (bool)tvb_get_bits8(tvb, offset*8 + 1, 1);
858 proto_tree_add_bitmask(do_irp_envelope_tree, tvb, offset, hf_do_irp_flags, ett_do_irp_envelope_flags, envelope_flag_bits, ENC_BIG_ENDIAN);
859 proto_tree_add_bits_item(do_irp_envelope_tree, hf_do_irp_version_major_sugg, tvb, offset*8+3, 5, ENC_BIG_ENDIAN);
860 offset += 1;
862 proto_tree_add_item(do_irp_envelope_tree, hf_do_irp_version_minor_sugg, tvb, offset, 1, ENC_BIG_ENDIAN);
863 offset += 1;
865 proto_tree_add_item(do_irp_envelope_tree, hf_do_irp_sessid, tvb, offset, 4, ENC_BIG_ENDIAN);
866 offset += 4;
868 *reqid = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
869 proto_tree_add_item(do_irp_envelope_tree, hf_do_irp_reqid, tvb, offset, 4, ENC_BIG_ENDIAN);
870 col_append_fstr(pinfo->cinfo, COL_INFO, "ReqID=%u", tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN));
871 offset += 4;
873 proto_tree_add_item(do_irp_envelope_tree, hf_do_irp_seq, tvb, offset, 4, ENC_BIG_ENDIAN);
874 offset += 4;
876 proto_tree_add_item(do_irp_envelope_tree, hf_do_irp_msglen, tvb, offset, 4, ENC_BIG_ENDIAN);
877 offset += 4;
879 return offset;
883 * Decodes message header, body and credential record
885 * Returns length of the dissected record
887 static int
888 decode_header_body_credential(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t reqid)
890 conversation_t *conversation;
891 struct do_irp_request_hash_key request_key, *new_request_key;
892 struct do_irp_request_hash_val *request_val = NULL;
893 proto_item *r_pkt;
895 /* Message Header */
896 proto_item *ti_header = proto_tree_add_item(tree, hf_do_irp_header, tvb, 0, 24, ENC_NA);
897 proto_tree *do_irp_header_tree = proto_item_add_subtree(ti_header, ett_do_irp_header);
899 int offset = 0;
901 uint32_t opcode = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
902 proto_tree_add_item(do_irp_header_tree, hf_do_irp_opcode, tvb, offset, 4, ENC_BIG_ENDIAN);
903 const char *opcode_text = val_to_str_const(tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN), opcode_vals, "Unknown OpCode");
904 offset += 4;
906 uint32_t respcode = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
907 proto_tree_add_item(do_irp_header_tree, hf_do_irp_responsecode, tvb, offset, 4, ENC_BIG_ENDIAN);
908 const char *respcode_text = val_to_str_const(tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN), responsecode_vals, "Unknown RespCode");
909 offset += 4;
911 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s, %s]", opcode_text, respcode_text);
913 static int* const header_flag_bits[] = {
914 &hf_do_irp_opflags_at,
915 &hf_do_irp_opflags_ct,
916 &hf_do_irp_opflags_enc,
917 &hf_do_irp_opflags_rec,
918 &hf_do_irp_opflags_ca,
919 &hf_do_irp_opflags_cn,
920 &hf_do_irp_opflags_kc,
921 &hf_do_irp_opflags_po,
922 &hf_do_irp_opflags_rd,
923 &hf_do_irp_opflags_owe,
924 &hf_do_irp_opflags_mns,
925 &hf_do_irp_opflags_dnr,
926 NULL
929 proto_tree_add_bitmask(do_irp_header_tree, tvb, offset, hf_do_irp_opflags, ett_do_irp_header_flags, header_flag_bits, ENC_BIG_ENDIAN);
930 uint32_t header_opflags = tvb_get_ntohl(tvb, offset);
931 offset += 4;
933 proto_tree_add_item(do_irp_header_tree, hf_do_irp_sisn, tvb, offset, 2, ENC_BIG_ENDIAN);
934 offset += 2;
936 proto_tree_add_item(do_irp_header_tree, hf_do_irp_rcount, tvb, offset, 1, ENC_BIG_ENDIAN);
937 offset += 2; /* One byte empty */
939 proto_tree_add_item(do_irp_header_tree, hf_do_irp_expiration, tvb, offset, 4, ENC_TIME_SECS);
940 offset += 4;
942 proto_tree_add_item(do_irp_header_tree, hf_do_irp_bodylen, tvb, offset, 4, ENC_BIG_ENDIAN);
943 uint32_t body_len = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
944 offset += 4;
946 /* Message Body */
947 if(tvb_captured_length_remaining(tvb, offset) > 0 && body_len > 0) {
949 proto_item *ti_body = proto_tree_add_item(tree, hf_do_irp_body, tvb, offset, body_len, ENC_NA);
950 proto_tree *do_irp_body_tree = proto_item_add_subtree(ti_body, ett_do_irp_body);
952 int body_start_offset = offset;
954 /* If RD bit is set, body must start with message digest (response only) */
955 if(header_opflags & 0x800000 && respcode > DO_IRP_RC_RESERVED) {
957 proto_tree_add_item(do_irp_body_tree, hf_do_irp_digest_algo, tvb, offset, 1, ENC_NA);
958 offset += 1;
960 switch (tvb_get_uint8(tvb, offset-1)) {
962 case DO_IRP_DIGEST_ALGO_MD5:
963 proto_tree_add_item(do_irp_body_tree, hf_do_irp_digest, tvb, offset, 16, ENC_NA);
964 offset += 16;
965 break;
967 case DO_IRP_DIGEST_ALGO_SHA1:
968 proto_tree_add_item(do_irp_body_tree, hf_do_irp_digest, tvb, offset, 20, ENC_NA);
969 offset += 20;
970 break;
972 case DO_IRP_DIGEST_ALGO_SHA256:
973 proto_tree_add_item(do_irp_body_tree, hf_do_irp_digest, tvb, offset, 32, ENC_NA);
974 offset += 32;
975 break;
977 default:
978 expert_add_info(pinfo, do_irp_body_tree, &ei_do_irp_digest_unknown);
979 /* We are now unable to dissect further because the fields now have variable length */
980 call_data_dissector(
981 tvb_new_subset_length(tvb, offset, -1), pinfo, do_irp_body_tree);
982 return tvb_captured_length(tvb);
987 if(opcode == DO_IRP_OC_RESOLUTION && respcode == DO_IRP_RC_RESERVED) { /* Query */
989 const char *identifier_text;
990 offset += decode_string(tvb, pinfo, do_irp_body_tree, offset, hf_do_irp_ident, &identifier_text);
992 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", identifier_text);
994 uint32_t index_entries = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
995 proto_tree_add_item(do_irp_body_tree, hf_do_irp_idxcount, tvb, offset, 4, ENC_BIG_ENDIAN);
996 offset += 4;
998 for(uint32_t i = 0; i < index_entries; i++) {
999 proto_tree_add_item(do_irp_body_tree, hf_do_irp_idx, tvb, offset, 4, ENC_BIG_ENDIAN);
1000 offset += 4;
1003 uint32_t type_entries = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1004 proto_tree_add_item(do_irp_body_tree, hf_do_irp_typecount, tvb, offset, 4, ENC_BIG_ENDIAN);
1005 offset += 4;
1007 for(uint32_t i = 0; i < type_entries; i++) {
1008 offset += decode_string(tvb, pinfo, do_irp_body_tree, offset, hf_do_irp_type, NULL);
1012 else if(
1013 (opcode == DO_IRP_OC_RESOLUTION && respcode == DO_IRP_RC_SUCCESS) || /* Successful query response */
1014 (opcode == DO_IRP_OC_ADD_ELEMENT && respcode == DO_IRP_RC_RESERVED) || /* Add elements request */
1015 (opcode == DO_IRP_OC_MODIFY_ELEMENT && respcode == DO_IRP_RC_RESERVED) || /* Modify elements request */
1016 (opcode == DO_IRP_OC_CREATE_ID && respcode == DO_IRP_RC_RESERVED) /* Create identifier request */
1019 const char *identifier_text;
1020 offset += decode_string(tvb, pinfo, do_irp_body_tree, offset, hf_do_irp_ident, &identifier_text);
1022 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", identifier_text);
1024 uint32_t element_entries = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1025 proto_tree_add_item(do_irp_body_tree, hf_do_irp_identcount, tvb, offset, 4, ENC_BIG_ENDIAN);
1026 offset += 4;
1028 for(uint32_t i = 0; i < element_entries; i++) {
1029 offset += decode_identifier_record(tvb, pinfo, do_irp_body_tree, offset);
1034 if(opcode == DO_IRP_OC_REMOVE_ELEMENT && respcode == DO_IRP_RC_RESERVED) { /* Remove elements request */
1036 const char *identifier_text;
1037 offset += decode_string(tvb, pinfo, do_irp_body_tree, offset, hf_do_irp_ident, &identifier_text);
1039 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", identifier_text);
1041 uint32_t index_entries = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1042 proto_tree_add_item(do_irp_body_tree, hf_do_irp_idxcount, tvb, offset, 4, ENC_BIG_ENDIAN);
1043 offset += 4;
1045 for(uint32_t i = 0; i < index_entries; i++) {
1046 proto_tree_add_item(do_irp_body_tree, hf_do_irp_idx, tvb, offset, 4, ENC_BIG_ENDIAN);
1047 offset += 4;
1051 else if( /* Referral response */
1052 (opcode == DO_IRP_OC_RESOLUTION && respcode == DO_IRP_RC_SERVICE_REFERRAL) ||
1053 (opcode == DO_IRP_OC_RESOLUTION && respcode == DO_IRP_RC_PREFIX_REFERRAL)
1056 const char *refident;
1057 offset += decode_string(tvb, pinfo, do_irp_body_tree, offset, hf_do_irp_refident, &refident);
1059 /* The following identifier records only exist if ReferralIdentifier is not provided, otherwise it must be empty */
1060 if(strlen(refident) == 0) {
1062 uint32_t element_entries = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1063 proto_tree_add_item(do_irp_body_tree, hf_do_irp_identcount, tvb, offset, 4, ENC_BIG_ENDIAN);
1064 offset += 4;
1066 for(uint32_t i = 0; i < element_entries; i++) {
1067 offset += decode_identifier_record(tvb, pinfo, do_irp_body_tree, offset);
1073 else if(opcode == DO_IRP_OC_VERIFY_RESPONSE && respcode == DO_IRP_RC_SUCCESS) { /* Challenge response verification response */
1075 proto_tree_add_item(do_irp_body_tree, hf_do_irp_veri_result, tvb, offset, 1, ENC_BIG_ENDIAN);
1076 offset += 1;
1079 else if(opcode == DO_IRP_OC_VERIFY_RESPONSE && respcode == DO_IRP_RC_RESERVED) { /* Challenge response verification */
1081 offset += decode_string(tvb, pinfo, do_irp_body_tree, offset, hf_do_irp_keyident, NULL);
1083 proto_tree_add_item(do_irp_body_tree, hf_do_irp_keyidx, tvb, offset, 4, ENC_BIG_ENDIAN);
1084 offset += 4;
1086 offset += decode_generic_data(tvb, do_irp_body_tree, offset, hf_do_irp_nonce);
1088 offset += decode_generic_data(tvb, do_irp_body_tree, offset, hf_do_irp_digest);
1090 offset += decode_generic_data(tvb, do_irp_body_tree, offset, hf_do_irp_challresp);
1093 else if(opcode == DO_IRP_OC_CHALLENGE_RESPONSE && respcode == DO_IRP_RC_RESERVED) { /* Challenge response (client -> server) */
1095 offset += decode_string(tvb, pinfo, do_irp_body_tree, offset, hf_do_irp_authtype, NULL);
1097 offset += decode_string(tvb, pinfo, do_irp_body_tree, offset, hf_do_irp_keyident, NULL);
1099 proto_tree_add_item(do_irp_body_tree, hf_do_irp_keyidx, tvb, offset, 4, ENC_BIG_ENDIAN);
1100 offset += 4;
1102 offset += decode_generic_data(tvb, do_irp_body_tree, offset, hf_do_irp_challresp);
1105 else if(respcode == DO_IRP_RC_AUTHEN_NEEDED) { /* Challenge (server -> client) */
1107 offset += decode_generic_data(tvb, do_irp_body_tree, offset, hf_do_irp_nonce);
1110 else if(
1111 (opcode == DO_IRP_OC_GET_SITEINFO && respcode == DO_IRP_RC_RESERVED) || /* GetSiteInfo request */
1112 (opcode == DO_IRP_OC_LIST_HOMED_PREFIXES && respcode == DO_IRP_RC_RESERVED) /* List homed prefixes request */
1115 offset += decode_string(tvb, pinfo, do_irp_body_tree, offset, hf_do_irp_ignoredident, NULL);
1118 else if(opcode == DO_IRP_OC_GET_SITEINFO && respcode == DO_IRP_RC_SUCCESS) { /* GetSiteInfo response */
1120 offset += decode_hssite(tvb, pinfo, do_irp_body_tree, offset);
1123 else if(
1124 (opcode == DO_IRP_OC_CREATE_ID && respcode == DO_IRP_RC_SUCCESS) || /* Create identifier response */
1125 (opcode == DO_IRP_OC_DELETE_ID && respcode == DO_IRP_RC_RESERVED) || /* Delete identifier request */
1126 (opcode == DO_IRP_OC_LIST_IDS && respcode == DO_IRP_RC_RESERVED) || /* List IDs request */
1127 (opcode == DO_IRP_OC_LIST_DERIVED_PREFIXES && respcode == DO_IRP_RC_RESERVED) || /* List der. prefixes request */
1128 (opcode == DO_IRP_OC_HOME_PREFIX && respcode == DO_IRP_RC_RESERVED) || /* Home prefix request */
1129 (opcode == DO_IRP_OC_UNHOME_PREFIX && respcode == DO_IRP_RC_RESERVED) /* Unhome prefix request */
1132 offset += decode_string(tvb, pinfo, do_irp_body_tree, offset, hf_do_irp_ident, NULL);
1135 else if(
1136 (opcode == DO_IRP_OC_LIST_IDS && respcode == DO_IRP_RC_SUCCESS) || /* List IDs response */
1137 (opcode == DO_IRP_OC_LIST_DERIVED_PREFIXES && respcode == DO_IRP_RC_SUCCESS) || /* List der. prefixes response */
1138 (opcode == DO_IRP_OC_LIST_HOMED_PREFIXES && respcode == DO_IRP_RC_SUCCESS) /* List homed prefixes response */
1141 uint32_t element_entries = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1142 proto_tree_add_item(do_irp_body_tree, hf_do_irp_identcount, tvb, offset, 4, ENC_BIG_ENDIAN);
1143 offset += 4;
1145 for(uint32_t i = 0; i < element_entries; i++) {
1146 offset += decode_string(tvb, pinfo, do_irp_body_tree, offset, hf_do_irp_ident, NULL);
1150 else if(opcode == DO_IRP_OC_SESSION_SETUP && respcode == DO_IRP_RC_RESERVED) { /* Session setup request */
1152 proto_tree_add_item(do_irp_body_tree, hf_do_irp_keyexmode, tvb, offset, 2, ENC_BIG_ENDIAN);
1153 offset += 2;
1155 proto_tree_add_item(do_irp_body_tree, hf_do_irp_timeout, tvb, offset, 4, ENC_BIG_ENDIAN);
1156 offset += 4;
1158 offset += decode_string(tvb, pinfo, do_irp_body_tree, offset, hf_do_irp_ident, NULL);
1160 proto_tree_add_item(do_irp_body_tree, hf_do_irp_idx, tvb, offset, 4, ENC_BIG_ENDIAN);
1161 offset += 4;
1163 offset += decode_pk_data(tvb, pinfo, do_irp_body_tree, offset);
1166 else if(opcode == DO_IRP_OC_SESSION_SETUP && respcode == DO_IRP_RC_SUCCESS) { /* Session setup response */
1168 proto_tree_add_item(do_irp_body_tree, hf_do_irp_keyexmode, tvb, offset, 2, ENC_BIG_ENDIAN);
1169 offset += 2;
1171 offset += decode_pk_data(tvb, pinfo, do_irp_body_tree, offset);
1174 /* All error responses */
1175 else if(
1176 (respcode >= DO_IRP_RC_ERROR && respcode <= DO_IRP_RC_SERVER_NOT_RESP) ||
1177 (respcode >= DO_IRP_RC_INVALID_ADMIN && respcode <= DO_IRP_RC_ACCESS_DENIED) ||
1178 (respcode >= DO_IRP_RC_AUTHEN_FAILED && respcode <= DO_IRP_RC_SESSION_MSG_REJECTED)
1181 if(tvb_ensure_captured_length_remaining(tvb, offset) >= 4 ) {
1182 offset += decode_string(tvb, pinfo, do_irp_body_tree, offset, hf_do_irp_error_msg, NULL);
1185 /* If body length has not been reached, there must be error indices*/
1186 if((uint32_t)(offset - body_start_offset) < body_len) {
1188 uint32_t err_indices = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1189 proto_tree_add_item(do_irp_body_tree, hf_do_irp_error_idxcount, tvb, offset, 4, ENC_BIG_ENDIAN);
1190 offset += 4;
1192 for(uint32_t i = 0; i < err_indices; i++) {
1193 proto_tree_add_item(do_irp_body_tree, hf_do_irp_error_idx, tvb, offset, 4, ENC_BIG_ENDIAN);
1194 offset += 4;
1198 else {
1199 /* unsupported codes */
1200 int unhandled_bytes = body_len - (offset - body_start_offset);
1201 call_data_dissector(
1202 tvb_new_subset_length(tvb, offset, unhandled_bytes),
1203 pinfo, do_irp_body_tree
1205 offset += unhandled_bytes;
1209 /* Message Credential */
1210 if(tvb_captured_length_remaining(tvb, offset) >= 4) {
1212 uint32_t cred_len = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1214 proto_item *ti_cred = proto_tree_add_item(tree, hf_do_irp_credential, tvb, offset, cred_len + 4, ENC_NA);
1215 proto_tree *do_irp_cred_tree = proto_item_add_subtree(ti_cred, ett_do_irp_credential);
1217 proto_tree_add_item(do_irp_cred_tree, hf_do_irp_credential_len, tvb, offset, 4, ENC_BIG_ENDIAN);
1218 offset += 4;
1220 if(cred_len > 0) { /* If credential length is 0, is ends here */
1222 offset += 8; /* Reserved */
1224 proto_tree_add_item(do_irp_cred_tree, hf_do_irp_credential_sesscounter, tvb, offset, 4, ENC_BIG_ENDIAN);
1225 offset += 4;
1227 offset += decode_string(tvb, pinfo, do_irp_cred_tree, offset, hf_do_irp_credential_type, NULL);
1229 uint32_t sig_len = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1231 if(sig_len) {
1233 proto_item *ti_signedinfo = proto_tree_add_item(do_irp_cred_tree, hf_do_irp_credential_signedinfo, tvb, offset, sig_len + 4, ENC_NA);
1234 proto_tree *do_irp_signedinfo_tree = proto_item_add_subtree(ti_signedinfo, ett_do_irp_credential_signedinfo);
1236 proto_tree_add_item(do_irp_signedinfo_tree, hf_do_irp_credential_signedinfo_len, tvb, offset, 4, ENC_BIG_ENDIAN);
1237 offset += 4;
1239 const char *algo;
1240 offset += decode_string(tvb, pinfo, do_irp_signedinfo_tree, offset, hf_do_irp_credential_signedinfo_algo, &algo);
1241 proto_item_append_text(do_irp_signedinfo_tree, " (%s)", algo);
1243 offset += decode_generic_data(tvb, do_irp_signedinfo_tree, offset, hf_do_irp_credential_signedinfo_sig);
1248 /* Conversation Handling */
1249 conversation = find_or_create_conversation(pinfo);
1250 request_key.conv_index = conversation->conv_index;
1251 request_key.reqid = reqid;
1253 request_val = (struct do_irp_request_hash_val *) wmem_map_lookup(do_irp_request_hash_map, &request_key);
1255 /* If this packet is a request WITHOUT a registered request */
1256 if(respcode == DO_IRP_RC_RESERVED && !request_val) {
1258 new_request_key = wmem_new(wmem_file_scope(), struct do_irp_request_hash_key);
1259 *new_request_key = request_key;
1261 request_val = wmem_new(wmem_file_scope(), struct do_irp_request_hash_val);
1262 request_val->pnum = pinfo->num;
1263 request_val->pnum_resp = 0;
1264 request_val->opcode = opcode;
1266 wmem_map_insert(do_irp_request_hash_map, new_request_key, request_val);
1269 /* If this packet is a request WITH a registered request */
1270 else if(respcode == DO_IRP_RC_RESERVED && request_val) {
1272 if(request_val->pnum_resp > 0) {
1273 r_pkt = proto_tree_add_uint(tree , hf_do_irp_response_in, tvb, 0, 0, request_val->pnum_resp);
1274 proto_item_set_generated(r_pkt);
1278 /* If this packet is a response to a registered request */
1279 else if(respcode != DO_IRP_RC_RESERVED && request_val) {
1281 request_val->pnum_resp = pinfo->num;
1283 r_pkt = proto_tree_add_uint(tree , hf_do_irp_response_to, tvb, 0, 0, request_val->pnum);
1284 proto_item_set_generated(r_pkt);
1287 return offset;
1290 static bool
1291 test_do_irp(tvbuff_t *tvb)
1293 /* Minimum length (envelope must be present) */
1294 if(tvb_captured_length(tvb) < DO_IRP_ENVELOPE_LEN)
1295 return false;
1297 /* Supported versions (2, 3) */
1298 uint8_t majorversion = tvb_get_uint8(tvb, 0);
1299 if(majorversion < 2 || majorversion > 3)
1300 return false;
1302 /* Message Length must not be 0 */
1303 if(tvb_get_uint32(tvb, 16, ENC_BIG_ENDIAN) == 0)
1304 return false;
1306 return true;
1309 static unsigned
1310 get_do_irp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
1312 return (tvb_get_uint32(tvb, offset + 16, ENC_BIG_ENDIAN) + DO_IRP_ENVELOPE_LEN);
1315 static int
1316 dissect_do_irp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1319 /* Do some basic tests */
1320 if(!test_do_irp(tvb))
1321 return 0;
1323 proto_item *ti = proto_tree_add_item(tree, proto_do_irp, tvb, 0, -1, ENC_NA);
1324 proto_tree *do_irp_tree = proto_item_add_subtree(ti, ett_do_irp);
1326 uint32_t reqid;
1327 bool encrypted;
1328 tvbuff_t *new_tvb = NULL;
1329 int offset = 0;
1332 * RFC 3652 defines `<MessageFlag>` in 2.2.1.2 as two octets containing three flags.
1333 * | MessageFlag (3 bits) | Reserved (13 bits) |
1335 * DO-IRP v3.0 divided this field into three fields in 6.2.1 ff. while maintaining backward compatibility.
1336 * | Flag (3 bits) | SuggMajor (5 bits) | SuggMinor (8 bits) |
1338 * Both documents state that in case of fragmentation, each fragment must contain an envelope with the truncated bit (TC) set.
1339 * In the wild the TC-flag is often ignored or not set. Therefore, reassembly is not (only) based on the TC-bit here,
1340 * to be able to generate expert info when protocol specs are violated.
1343 uint32_t msg_len = tvb_get_uint32(tvb, 16, ENC_BIG_ENDIAN); /* Length of over-all message, excluding envelope */
1344 uint8_t env_flags = tvb_get_uint8(tvb, 2);
1346 /* Envelope is always present */
1347 offset += decode_envelope(tvb, pinfo, do_irp_tree, &reqid, &encrypted);
1349 if (
1350 msg_len > (DO_IRP_MAX_UDP_SIZE - DO_IRP_ENVELOPE_LEN) || /* Message does not fit into one packet */
1351 env_flags & 0x20 /* TC-bit set */
1353 /* fragmented */
1355 fragment_head *frag_msg = NULL;
1356 bool first_frag = false;
1358 uint16_t msg_reqid = tvb_get_uint32(tvb, 8, ENC_BIG_ENDIAN);
1359 uint16_t msg_seqid = tvb_get_uint32(tvb, 12, ENC_BIG_ENDIAN);
1361 if( !(env_flags & 0x20) ) {
1362 expert_add_info(pinfo, do_irp_tree, &ei_do_irp_frag_wo_tc);
1365 /* Check if it's the first fragment, to set expected packets after first fragment_add */
1366 if(fragment_get_tot_len(&do_irp_reassemble_table, pinfo, msg_reqid, NULL) == 0) {
1367 first_frag = true;
1370 pinfo->fragmented = true;
1371 frag_msg = fragment_add_seq_check(&do_irp_reassemble_table, tvb, offset, pinfo,
1372 msg_reqid, NULL,
1373 msg_seqid,
1374 tvb_captured_length_remaining(tvb, offset),
1375 true /* Expected packet count set */
1378 if(first_frag) {
1380 uint32_t expected_packets = msg_len / (DO_IRP_MAX_UDP_SIZE - DO_IRP_ENVELOPE_LEN);
1381 if ((msg_len % (DO_IRP_MAX_UDP_SIZE - DO_IRP_ENVELOPE_LEN)) != 0) expected_packets++;
1383 fragment_set_tot_len(&do_irp_reassemble_table, pinfo, msg_reqid, NULL, expected_packets-1); /* Set expected packet count (0-index) */
1386 new_tvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled Message", frag_msg, &msg_frag_items, NULL, do_irp_tree);
1389 if (new_tvb) { /* Packet reassembled */
1391 if(!encrypted) {
1392 offset += decode_header_body_credential(new_tvb, pinfo, do_irp_tree, reqid);
1393 } else {
1394 /* Encrypted message can't be decoded */
1395 col_append_str(pinfo->cinfo, COL_INFO, " (encrypted)");
1396 call_data_dissector(new_tvb, pinfo, do_irp_tree);
1397 offset = tvb_captured_length(tvb);
1399 col_append_fstr(pinfo->cinfo, COL_INFO, " (Frag=%u, Reassembled)", msg_seqid+1);
1401 } else { /* Packet fragment */
1403 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, do_irp_tree);
1404 col_append_fstr(pinfo->cinfo, COL_INFO, " (Frag=%u)", msg_seqid+1);
1405 offset = tvb_captured_length(tvb);
1409 else {
1411 /* No fragmentation */
1412 new_tvb = tvb_new_subset_remaining(tvb, offset);
1414 if(!encrypted) {
1415 offset += decode_header_body_credential(new_tvb, pinfo, do_irp_tree, reqid);
1416 } else {
1417 /* Encrypted message can't be decoded */
1418 col_append_str(pinfo->cinfo, COL_INFO, " (encrypted)");
1419 call_data_dissector(new_tvb, pinfo, do_irp_tree);
1420 offset = tvb_captured_length(tvb);
1425 return offset;
1428 static int
1429 dissect_do_irp_tcp_full_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1431 proto_item *ti = proto_tree_add_item(tree, proto_do_irp, tvb, 0, -1, ENC_NA);
1432 proto_tree *do_irp_tree = proto_item_add_subtree(ti, ett_do_irp);
1434 uint32_t reqid;
1435 bool enc;
1436 int offset = 0;
1438 offset += decode_envelope(tvb, pinfo, do_irp_tree, &reqid, &enc);
1439 offset += decode_header_body_credential(tvb_new_subset_remaining(tvb, offset), pinfo, do_irp_tree, reqid);
1441 return offset;
1444 static int
1445 dissect_do_irp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1447 /* Do some basic tests */
1448 if(!test_do_irp(tvb))
1449 return 0;
1451 tcp_dissect_pdus(tvb, pinfo, tree, true, DO_IRP_ENVELOPE_LEN, get_do_irp_message_len, dissect_do_irp_tcp_full_message, data);
1452 return tvb_reported_length(tvb);
1455 void
1456 proto_register_do_irp(void)
1458 static hf_register_info hf[] = {
1460 /* Fragment handling */
1461 {&hf_msg_fragments,
1462 { "Message fragments", "do-irp.fragments",
1463 FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }
1465 {&hf_msg_fragment,
1466 { "Message fragment", "do-irp.fragment",
1467 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
1469 {&hf_msg_fragment_overlap,
1470 { "Message fragment overlap", "do-irp.fragment.overlap",
1471 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
1473 {&hf_msg_fragment_overlap_conflicts,
1474 { "Message fragment overlapping with conflicting data", "do-irp.fragment.overlap.conflicts",
1475 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
1477 {&hf_msg_fragment_multiple_tails,
1478 { "Message has multiple tail fragments", "do-irp.fragment.multiple_tails",
1479 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
1481 {&hf_msg_fragment_too_long_fragment,
1482 { "Message fragment too long", "do-irp.fragment.too_long_fragment",
1483 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
1485 {&hf_msg_fragment_error,
1486 { "Message defragmentation error", "do-irp.fragment.error",
1487 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
1489 {&hf_msg_fragment_count,
1490 { "Message fragment count", "do-irp.fragment.count",
1491 FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }
1493 {&hf_msg_reassembled_in,
1494 { "Reassembled in", "do-irp.reassembled.in",
1495 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
1497 {&hf_msg_reassembled_len,
1498 { "Reassembled length", "do-irp.reassembled.len",
1499 FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }
1501 {&hf_msg_reassembled_data,
1502 { "Reassembled data", "do-irp.reassembled.data",
1503 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL }
1506 /* Generic */
1507 { &hf_do_irp_string_len,
1508 { "Length", "do-irp.string.len",
1509 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1511 { &hf_do_irp_string_value,
1512 { "Value", "do-irp.string.value",
1513 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1515 { &hf_do_irp_data_len,
1516 { "Length", "do-irp.data.len",
1517 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1519 { &hf_do_irp_data_value,
1520 { "Value", "do-irp.data.value",
1521 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
1524 /* Message Envelope */
1525 { &hf_do_irp_envelope,
1526 { "Message Envelope", "do-irp.envelope",
1527 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1529 { &hf_do_irp_version_major,
1530 { "Version (Major)", "do-irp.version.major",
1531 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1533 { &hf_do_irp_version_minor,
1534 { "Version (Minor)", "do-irp.version.minor",
1535 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1537 { &hf_do_irp_flags,
1538 { "Flags", "do-irp.flags",
1539 FT_UINT8, BASE_HEX, NULL, 0xE0, NULL, HFILL }
1541 { &hf_do_irp_flag_cp,
1542 { "Compressed", "do-irp.flags.cp",
1543 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }
1545 { &hf_do_irp_flag_ec,
1546 { "Encrypted", "do-irp.flags.ec",
1547 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }
1549 { &hf_do_irp_flag_tc,
1550 { "Truncated", "do-irp.flags.tc",
1551 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }
1553 { &hf_do_irp_version_major_sugg,
1554 { "Version (Major, suggested)", "do-irp.version.major_sugg",
1555 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1557 { &hf_do_irp_version_minor_sugg,
1558 { "Version (Minor, suggested)", "do-irp.version.minor_sugg",
1559 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1561 { &hf_do_irp_sessid,
1562 { "Session ID", "do-irp.sessid",
1563 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1565 { &hf_do_irp_reqid,
1566 { "Request ID", "do-irp.reqid",
1567 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1569 { &hf_do_irp_seq,
1570 { "Sequence No.", "do-irp.seq",
1571 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1573 { &hf_do_irp_msglen,
1574 { "Message Length", "do-irp.msglen",
1575 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1578 /* Message Header */
1579 { &hf_do_irp_header,
1580 { "Message Header", "do-irp.header",
1581 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1583 { &hf_do_irp_opcode,
1584 { "Operation Code", "do-irp.opcode",
1585 FT_UINT32, BASE_DEC, VALS(opcode_vals), 0x0, NULL, HFILL }
1587 { &hf_do_irp_responsecode,
1588 { "Response Code", "do-irp.responsecode",
1589 FT_UINT32, BASE_DEC, VALS(responsecode_vals), 0x0, NULL, HFILL }
1591 { &hf_do_irp_opflags,
1592 { "Flags", "do-irp.opflags",
1593 FT_UINT32, BASE_HEX, NULL, 0xFFF00000, NULL, HFILL }
1595 { &hf_do_irp_opflags_at,
1596 { "Authoritative", "do-irp.opflags.at",
1597 FT_BOOLEAN, 32, NULL, 0x80000000, NULL, HFILL }
1599 { &hf_do_irp_opflags_ct,
1600 { "Certified", "do-irp.opflags.ct",
1601 FT_BOOLEAN, 32, NULL, 0x40000000, NULL, HFILL }
1603 { &hf_do_irp_opflags_enc,
1604 { "Encryption", "do-irp.opflags.enc",
1605 FT_BOOLEAN, 32, NULL, 0x20000000, NULL, HFILL }
1607 { &hf_do_irp_opflags_rec,
1608 { "Recursive", "do-irp.opflags.rec",
1609 FT_BOOLEAN, 32, NULL, 0x10000000, NULL, HFILL }
1611 { &hf_do_irp_opflags_ca,
1612 { "Cache Authentication", "do-irp.opflags.ca",
1613 FT_BOOLEAN, 32, NULL, 0x08000000, NULL, HFILL }
1615 { &hf_do_irp_opflags_cn,
1616 { "Continuous", "do-irp.opflags.cn",
1617 FT_BOOLEAN, 32, NULL, 0x04000000, NULL, HFILL }
1619 { &hf_do_irp_opflags_kc,
1620 { "Keep Connection", "do-irp.opflags.kc",
1621 FT_BOOLEAN, 32, NULL, 0x02000000, NULL, HFILL }
1623 { &hf_do_irp_opflags_po,
1624 { "Public Only", "do-irp.opflags.po",
1625 FT_BOOLEAN, 32, NULL, 0x01000000, NULL, HFILL }
1627 { &hf_do_irp_opflags_rd,
1628 { "Request-Digest", "do-irp.opflags.rd",
1629 FT_BOOLEAN, 32, NULL, 0x00800000, NULL, HFILL }
1631 { &hf_do_irp_opflags_owe,
1632 { "Overwrite when exists", "do-irp.opflags.owe",
1633 FT_BOOLEAN, 32, NULL, 0x00400000, NULL, HFILL }
1635 { &hf_do_irp_opflags_mns,
1636 { "Mint new suffix", "do-irp.opflags.mns",
1637 FT_BOOLEAN, 32, NULL, 0x00200000, NULL, HFILL }
1639 { &hf_do_irp_opflags_dnr,
1640 { "Do not refer", "do-irp.opflags.dnr",
1641 FT_BOOLEAN, 32, NULL, 0x00100000, NULL, HFILL }
1643 { &hf_do_irp_sisn,
1644 { "Site Info Serial No.", "do-irp.sisn",
1645 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1647 { &hf_do_irp_rcount,
1648 { "Recursion Count", "do-irp.recursioncount",
1649 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1651 { &hf_do_irp_expiration,
1652 { "Expiration Time", "do-irp.exp",
1653 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL }
1655 { &hf_do_irp_bodylen,
1656 { "Body Length", "do-irp.bodylen",
1657 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1660 /* Message Body */
1661 { &hf_do_irp_body,
1662 { "Message Body", "do-irp.body",
1663 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1665 { &hf_do_irp_digest_algo,
1666 { "Message Digest Algorithm", "do-irp.digest_algo",
1667 FT_UINT8, BASE_DEC, VALS(digest_algo_vals), 0x0, NULL, HFILL }
1669 { &hf_do_irp_digest,
1670 { "Message Digest", "do-irp.digest",
1671 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
1673 { &hf_do_irp_error_msg,
1674 { "Error Message", "do-irp.error.msg",
1675 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1677 { &hf_do_irp_error_idxcount,
1678 { "Error Indices", "do-irp.error.idxcount",
1679 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1681 { &hf_do_irp_error_idx,
1682 { "Error Index", "do-irp.error.idx",
1683 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1685 { &hf_do_irp_ident,
1686 { "Identifier", "do-irp.ident",
1687 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1689 { &hf_do_irp_idxcount,
1690 { "Index Count", "do-irp.idxcount",
1691 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1693 { &hf_do_irp_idx,
1694 { "Index", "do-irp.idx",
1695 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1697 { &hf_do_irp_typecount,
1698 { "Type Count", "do-irp.typecount",
1699 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1701 { &hf_do_irp_type,
1702 { "Type Entry", "do-irp.type",
1703 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1705 { &hf_do_irp_identcount,
1706 { "Identifier Records", "do-irp.identcount",
1707 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1709 { &hf_do_irp_identrecord,
1710 { "Identifier Record", "do-irp.identrecord",
1711 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1713 { &hf_do_irp_identrecord_idx,
1714 { "Index", "do-irp.identrecord.idx",
1715 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1717 { &hf_do_irp_identrecord_type,
1718 { "Type", "do-irp.identrecord.type",
1719 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1721 { &hf_do_irp_identrecord_value,
1722 { "Value", "do-irp.identrecord.value",
1723 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1725 { &hf_do_irp_identrecord_value_string,
1726 { "Value", "do-irp.identrecord.value.string",
1727 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1729 { &hf_do_irp_identrecord_value_len,
1730 { "Length", "do-irp.identrecord.value.len",
1731 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1733 { &hf_do_irp_identrecord_perm,
1734 { "Permission", "do-irp.identrecord.perm",
1735 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1737 { &hf_do_irp_identrecord_perm_ar,
1738 { "ADMIN_READ", "do-irp.identrecord.perm.ar",
1739 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }
1741 { &hf_do_irp_identrecord_perm_aw,
1742 { "ADMIN_WRITE", "do-irp.identrecord.perm.aw",
1743 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }
1745 { &hf_do_irp_identrecord_perm_pr,
1746 { "PUBLIC_READ", "do-irp.identrecord.perm.pr",
1747 FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }
1749 { &hf_do_irp_identrecord_perm_pw,
1750 { "PUBLIC_WRITE", "do-irp.identrecord.perm.pw",
1751 FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }
1753 { &hf_do_irp_identrecord_ts,
1754 { "Timestamp", "do-irp.identrecord.ts",
1755 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1757 { &hf_do_irp_identrecord_ts_utc,
1758 { "Timestamp (UTC)", "do-irp.identrecord.ts_utc",
1759 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
1761 { &hf_do_irp_identrecord_ttl_type,
1762 { "TTL Type", "do-irp.identrecord.ttl_type",
1763 FT_UINT8, BASE_DEC, VALS(ttl_vals), 0x0, NULL, HFILL }
1765 { &hf_do_irp_identrecord_ttl,
1766 { "TTL", "do-irp.identrecord.ttl",
1767 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1769 { &hf_do_irp_identrecord_ttl_absolute,
1770 { "TTL (until)", "do-irp.identrecord.ttl_absolute",
1771 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL }
1773 { &hf_do_irp_identrecord_refcount,
1774 { "Reference Count", "do-irp.identrecord.refcount",
1775 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1777 { &hf_do_irp_identrecord_ref,
1778 { "Reference", "do-irp.identrecord.ref",
1779 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1781 { &hf_do_irp_hsadmin_perm,
1782 { "Permission", "do-irp.hsadmin.perm",
1783 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
1785 { &hf_do_irp_hsadmin_perm_ai,
1786 { "Add Identifier", "do-irp.hsadmin.perm.ai",
1787 FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL }
1789 { &hf_do_irp_hsadmin_perm_di,
1790 { "Delete Identifier", "do-irp.hsadmin.perm.di",
1791 FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL }
1793 { &hf_do_irp_hsadmin_perm_adp,
1794 { "Add Derived Prefix", "do-irp.hsadmin.perm.adp",
1795 FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL }
1797 { &hf_do_irp_hsadmin_perm_me,
1798 { "Modify Element", "do-irp.hsadmin.perm.me",
1799 FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL }
1801 { &hf_do_irp_hsadmin_perm_de,
1802 { "Delete Element", "do-irp.hsadmin.perm.de",
1803 FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL }
1805 { &hf_do_irp_hsadmin_perm_ae,
1806 { "Add Element", "do-irp.hsadminp.perm.ae",
1807 FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL }
1809 { &hf_do_irp_hsadmin_perm_ma,
1810 { "Modify Admin", "do-irp.hsadmin.perm.ma",
1811 FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL }
1813 { &hf_do_irp_hsadmin_perm_ra,
1814 { "Remove Admin", "do-irp.hsadmin.perm.ra",
1815 FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL }
1817 { &hf_do_irp_hsadmin_perm_aa,
1818 { "Add Admin", "do-irp.hsadmin.perm.aa",
1819 FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL }
1821 { &hf_do_irp_hsadmin_perm_ar,
1822 { "Authorized Read", "do-irp.hsadmin.perm.ar",
1823 FT_BOOLEAN, 16, NULL, 0x0400, NULL, HFILL }
1825 { &hf_do_irp_hsadmin_perm_li,
1826 { "List Identifiers", "do-irp.hsadmin.perm.li",
1827 FT_BOOLEAN, 16, NULL, 0x0800, NULL, HFILL }
1829 { &hf_do_irp_hsadmin_perm_ldp,
1830 { "List Derived Prefixes", "do-irp.hsadmin.perm.ldp",
1831 FT_BOOLEAN, 16, NULL, 0x1000, NULL, HFILL }
1833 { &hf_do_irp_hsadmin_idx,
1834 { "Index", "do-irp.hsadmin.idx",
1835 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1837 { &hf_do_irp_hsadmin_ident,
1838 { "Identifier", "do-irp.hsadmin.ident",
1839 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1841 { &hf_do_irp_body_hssite_version,
1842 { "Version", "do-irp.hssite.version",
1843 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1845 { &hf_do_irp_hssite_protoversion_major,
1846 { "Protocol Version (Major)", "do-irp.hssite.protoversion.major",
1847 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1849 { &hf_do_irp_hssite_protoversion_minor,
1850 { "Protocol Version (Minor)", "do-irp.hssite.protoversion.minor",
1851 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1853 { &hf_do_irp_hssite_serial,
1854 { "Serial", "do-irp.hssite.serial",
1855 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1857 { &hf_do_irp_hssite_primask,
1858 { "Primary Mask", "do-irp.hssite.primask",
1859 FT_UINT8, BASE_HEX, NULL, 0xFF, NULL, HFILL }
1861 { &hf_do_irp_hssite_primask_pri,
1862 { "Primary Site", "do-irp.hssite.primask.pri",
1863 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }
1865 { &hf_do_irp_hssite_primask_multi,
1866 { "Multi Primary", "do-irp.hssite.primask.multi",
1867 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }
1869 { &hf_do_irp_hssite_hashoption,
1870 { "Hash Option", "do-irp.hssite.hashoption",
1871 FT_UINT8, BASE_HEX, VALS(hashoption_vals), 0x0, NULL, HFILL }
1873 { &hf_do_irp_hssite_hashfilter,
1874 { "Hash Filter", "do-irp.hssite.hashfilter",
1875 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1877 { &hf_do_irp_hssite_attr_count,
1878 { "Attributes", "do-irp.hssite.attr.num",
1879 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1881 { &hf_do_irp_hssite_attr,
1882 { "Attribute", "do-irp.hssite.attr",
1883 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1885 { &hf_do_irp_hssite_attr_key,
1886 { "Key", "do-irp.hssite.attr.key",
1887 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1889 { &hf_do_irp_hssite_attr_value,
1890 { "Value", "do-irp.hssite.attr.value",
1891 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1893 { &hf_do_irp_hssite_srvcount,
1894 { "Server Count", "do-irp.hssite.srvcount",
1895 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1897 { &hf_do_irp_hssite_srv,
1898 { "Server", "do-irp.hssite.srv",
1899 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1901 { &hf_do_irp_hssite_srv_id,
1902 { "ID", "do-irp.hssite.srv.id",
1903 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1905 { &hf_do_irp_hssite_srv_addr,
1906 { "Address", "do-irp.hssite.srv.addr",
1907 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }
1909 { &hf_do_irp_hssite_srv_ifcount,
1910 { "Interface Count", "do-irp.hssite.srv.ifcount",
1911 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1913 { &hf_do_irp_hssite_srv_if,
1914 { "Interface", "do-irp.hssite.srv.if",
1915 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1917 { &hf_do_irp_hssite_srv_if_type,
1918 { "Type", "do-irp.hssite.srv.if.type",
1919 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1921 { &hf_do_irp_hssite_srv_if_type_admin,
1922 { "Administration", "do-irp.hssite.srv.if.type.admin",
1923 FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }
1925 { &hf_do_irp_hssite_srv_if_type_res,
1926 { "Resolution", "do-irp.hssite.srv.if.type.res",
1927 FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }
1929 { &hf_do_irp_hssite_srv_if_proto,
1930 { "Protocol", "do-irp.hssite.srv.if.proto",
1931 FT_UINT8, BASE_HEX, VALS(transportproto_vals), 0x0, NULL, HFILL }
1933 { &hf_do_irp_hssite_srv_if_port,
1934 { "Port", "do-irp.hssite.srv.if.port",
1935 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1937 { &hf_do_irp_pkrec,
1938 { "Public Key Data", "do-irp.pk",
1939 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1941 { &hf_do_irp_pkrec_len,
1942 { "Public Key Length", "do-irp.pk.len",
1943 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1945 { &hf_do_irp_pkrec_type,
1946 { "Public Key Type", "do-irp.pk.type",
1947 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1949 { &hf_do_irp_pkrec_dsa_q,
1950 { "DSA (q)", "do-irp.pk.dsa.q",
1951 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1953 { &hf_do_irp_pkrec_dsa_p,
1954 { "DSA (p)", "do-irp.pk.dsa.p",
1955 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1957 { &hf_do_irp_pkrec_dsa_g,
1958 { "DSA (g)", "do-irp.pk.dsa.g",
1959 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1961 { &hf_do_irp_pkrec_dsa_y,
1962 { "DSA (y)", "do-irp.pk.dsa.y",
1963 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1965 { &hf_do_irp_pkrec_dh_p,
1966 { "DH (p)", "do-irp.pk.dh.p",
1967 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1969 { &hf_do_irp_pkrec_dh_g,
1970 { "DH (g)", "do-irp.pk.dh.g",
1971 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1973 { &hf_do_irp_pkrec_dh_y,
1974 { "DH (y)", "do-irp.pk.dh.y",
1975 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1977 { &hf_do_irp_pkrec_rsa_exp,
1978 { "RSA (Exponent)", "do-irp.pk.rsa.exp",
1979 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1981 { &hf_do_irp_pkrec_rsa_mod,
1982 { "RSA (Modulo)", "do-irp.pk.rsa.mod",
1983 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1985 { &hf_do_irp_hsserv_ident,
1986 { "Identifier", "do-irp.hsserv.ident",
1987 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1989 { &hf_do_irp_hsvlist_count,
1990 { "Reference Count", "do-irp.vlist.count",
1991 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1993 { &hf_do_irp_hsvlist_ref,
1994 { "Reference", "do-irp.vlist.ref",
1995 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1997 { &hf_do_irp_hsalias,
1998 { "Alias", "do-irp.hsalias",
1999 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2001 { &hf_do_irp_hsnamespace,
2002 { "Namespace", "do-irp.hsnamespace",
2003 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2005 { &hf_do_irp_hscert_jwt,
2006 { "JWT", "do-irp.hscert.jwt",
2007 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2009 { &hf_do_irp_hssignature_jwt,
2010 { "JWT", "do-irp.hssignature.jwt",
2011 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2013 { &hf_do_irp_refident,
2014 { "Referral Identifier", "do-irp.refident",
2015 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2017 { &hf_do_irp_nonce,
2018 { "Nonce", "do-irp.nonce",
2019 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2021 { &hf_do_irp_authtype,
2022 { "Authentication Type", "do-irp.authtype",
2023 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2025 { &hf_do_irp_keyident,
2026 { "Key Identifier", "do-irp.keyident",
2027 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2029 { &hf_do_irp_keyidx,
2030 { "Key Index", "do-irp.keyidx",
2031 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2033 { &hf_do_irp_challresp,
2034 { "Challenge Response", "do-irp.challresp",
2035 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2037 { &hf_do_irp_veri_result,
2038 { "Verification Result", "do-irp.veri_result",
2039 FT_UINT8, BASE_DEC, VALS(verification_resp_vals), 0x0, NULL, HFILL }
2041 { &hf_do_irp_ignoredident,
2042 { "Ignored Identifier", "do-irp.ignoredident",
2043 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2045 { &hf_do_irp_keyexmode,
2046 { "Key Exchange Mode", "do-irp.keyexmode",
2047 FT_UINT16, BASE_DEC, VALS(key_exchange_vals), 0x0, NULL, HFILL }
2049 { &hf_do_irp_timeout,
2050 { "Timeout", "do-irp.timeout",
2051 FT_UINT32, BASE_DEC | BASE_UNIT_STRING, UNS(&units_seconds), 0x0, NULL, HFILL }
2054 /* Message Credential */
2055 { &hf_do_irp_credential,
2056 { "Message Credential", "do-irp.credential",
2057 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2059 { &hf_do_irp_credential_len,
2060 { "Length", "do-irp.credential.len",
2061 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2063 { &hf_do_irp_credential_sesscounter,
2064 { "Session Counter", "do-irp.credential.sesscounter",
2065 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2067 { &hf_do_irp_credential_type,
2068 { "Type", "do-irp.credential.type",
2069 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2071 { &hf_do_irp_credential_signedinfo,
2072 { "SignedInfo", "do-irp.credential.signedinfo",
2073 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2075 { &hf_do_irp_credential_signedinfo_len,
2076 { "Length", "do-irp.credential.signedinfo.len",
2077 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2079 { &hf_do_irp_credential_signedinfo_algo,
2080 { "Algorithm", "do-irp.credential.signedinfo.algo",
2081 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2083 { &hf_do_irp_credential_signedinfo_sig,
2084 { "Signature", "do-irp.credential.signedinfo.sig",
2085 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2088 /* Conversation */
2089 { &hf_do_irp_response_in,
2090 { "Response in", "do-irp.response_in",
2091 FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0x0, NULL, HFILL }
2093 { &hf_do_irp_response_to,
2094 { "Request in", "do-irp.response_to",
2095 FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0x0, NULL, HFILL }
2099 static ei_register_info ei[] = {
2100 { &ei_do_irp_digest_unknown,
2101 { "do-irp.header.digest.unknown", PI_MALFORMED, PI_WARN,
2102 "Invalid digest algorithm", EXPFILL }
2104 { &ei_do_irp_frag_wo_tc,
2105 { "do-irp.envelope.tc_missing", PI_MALFORMED, PI_ERROR,
2106 "Fragmentation without TC bit set", EXPFILL }
2110 static int *ett[] = {
2111 &ett_msg_fragment,
2112 &ett_msg_fragments,
2113 &ett_do_irp,
2114 &ett_do_irp_string,
2115 &ett_do_irp_envelope,
2116 &ett_do_irp_envelope_flags,
2117 &ett_do_irp_header,
2118 &ett_do_irp_header_flags,
2119 &ett_do_irp_body,
2120 &ett_do_irp_credential,
2121 &ett_do_irp_credential_signedinfo,
2122 &ett_do_irp_identifier_record,
2123 &ett_do_irp_element_permission_flags,
2124 &ett_do_irp_element_hsadmin_permission_flags,
2125 &ett_do_irp_element_hsadmin_primary_flags,
2126 &ett_do_irp_hsadmin,
2127 &ett_do_irp_hssite,
2128 &ett_do_irp_hssite_attribute,
2129 &ett_do_irp_hssite_server,
2130 &ett_do_irp_hssite_server_if,
2131 &ett_do_irp_hssite_server_if_flags,
2132 &ett_do_irp_pk
2135 expert_module_t* expert_do_irp;
2137 do_irp_request_hash_map = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), do_irp_handle_hash, do_irp_handle_equal);
2139 proto_do_irp = proto_register_protocol("Digital Object Identifier Resolution Protocol", "DO-IRP", "do-irp");
2140 expert_do_irp = expert_register_protocol(proto_do_irp);
2142 proto_register_field_array(proto_do_irp, hf, array_length(hf));
2143 proto_register_subtree_array(ett, array_length(ett));
2144 expert_register_field_array(expert_do_irp, ei, array_length(ei));
2146 reassembly_table_register(&do_irp_reassemble_table, &addresses_ports_reassembly_table_functions);
2148 do_irp_handle_udp = register_dissector("do-irp_udp", dissect_do_irp_udp, proto_do_irp);
2149 do_irp_handle_tcp = register_dissector("do-irp_tcp", dissect_do_irp_tcp, proto_do_irp);
2152 void
2153 proto_reg_handoff_do_irp(void)
2155 dissector_add_uint_with_preference("udp.port", DO_IRP_UDP_PORT, do_irp_handle_udp);
2156 dissector_add_uint_with_preference("tcp.port", DO_IRP_TCP_PORT, do_irp_handle_tcp);
2160 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2162 * Local variables:
2163 * c-basic-offset: 4
2164 * tab-width: 8
2165 * indent-tabs-mode: nil
2166 * End:
2168 * vi: set shiftwidth=4 tabstop=8 expandtab:
2169 * :indentSize=4:tabSize=8:noTabs=true: