2 * Routines for Realm Specific IP (RSIP) Protocol dissection
3 * Brian Ginsbach <ginsbach@cray.com>
5 * Copyright (c) 2006, 2010 Cray Inc. All Rights Reserved.
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
16 #include <epan/packet.h>
17 #include <epan/to_str.h>
19 void proto_register_rsip(void);
21 /* Forward declaration we need below */
22 void proto_reg_handoff_rsip(void);
24 static dissector_handle_t rsip_handle
;
26 /* Initialize the protocol and registered fields */
27 static int proto_rsip
;
28 static int hf_rsip_version
;
29 static int hf_rsip_message_type
;
30 static int hf_rsip_message_length
;
31 static int hf_rsip_parameter_type
;
32 static int hf_rsip_parameter_length
;
33 static int hf_rsip_parameter_value
;
34 static int hf_rsip_parameter_address_type
;
35 static int hf_rsip_parameter_address_ipv4
;
36 static int hf_rsip_parameter_address_ipv4_netmask
;
37 static int hf_rsip_parameter_address_ipv6
;
38 static int hf_rsip_parameter_address_fqdn
;
39 static int hf_rsip_parameter_ports_number
;
40 static int hf_rsip_parameter_ports_port_number
;
41 static int hf_rsip_parameter_lease_time
;
42 static int hf_rsip_parameter_client_id
;
43 static int hf_rsip_parameter_bind_id
;
44 static int hf_rsip_parameter_tunnel_type
;
45 static int hf_rsip_parameter_method
;
46 static int hf_rsip_parameter_error
;
47 static int hf_rsip_parameter_flow_policy_local
;
48 static int hf_rsip_parameter_flow_policy_remote
;
49 static int hf_rsip_parameter_indicator
;
50 static int hf_rsip_parameter_message_counter
;
51 static int hf_rsip_parameter_vendor_specific_vendor_id
;
52 static int hf_rsip_parameter_vendor_specific_subtype
;
53 static int hf_rsip_parameter_vendor_specific_value
;
54 static int hf_rsip_parameter_spi_number
;
55 static int hf_rsip_parameter_spi
;
57 /* Initialize the subtree pointers */
59 static int ett_rsip_param
;
60 static int ett_rsip_param_val
;
62 #define UDP_PORT_RSIP 4555
63 #define TCP_PORT_RSIP 4555
65 /* Message Types in RFC 3103 Appendix B / RFC 3104 Appendix C style */
66 static const value_string msg_type_appendix_vals
[] = {
67 { 1, "ERROR_RESPONSE" },
68 { 2, "REGISTER_REQUEST" },
69 { 3, "REGISTER_RESPONSE" },
70 { 4, "DE-REGISTER_REQUEST" },
71 { 5, "DE-REGISTER_RESPONSE" },
72 { 6, "ASSIGN_REQUEST_RSA-IP" },
73 { 7, "ASSIGN_RESPONSE_RSA-IP" },
74 { 8, "ASSIGN_REQUEST_RSAP-IP" },
75 { 9, "ASSIGN_RESPONSE_RSAP-IP" },
76 { 10, "EXTEND_REQUEST" },
77 { 11, "EXTEND_RESPONSE" },
78 { 12, "FREE_REQUEST" },
79 { 13, "FREE_RESPONSE" },
80 { 14, "QUERY_REQUEST" },
81 { 15, "QUERY_RESPONSE" },
82 { 16, "LISTEN_REQUEST" },
83 { 17, "LISTEN_RESPONSE" },
84 { 22, "ASSIGN_REQUEST_RSIPSEC" },
85 { 23, "ASSIGN_RESPONSE_RSIPEC" },
89 static const value_string msg_type_vals
[] = {
90 { 1, "Error Response" },
91 { 2, "Register Request" },
92 { 3, "Register Response" },
93 { 4, "Deregister Request" },
94 { 5, "Deregister Response" },
95 { 6, "Assign Request RSA-IP" },
96 { 7, "Assign Response RSA-IP" },
97 { 8, "Assign Request RSAP-IP" },
98 { 9, "Assign Response RSAP-IP" },
99 { 10, "Extend Request" },
100 { 11, "Extend Response" },
101 { 12, "Free Request" },
102 { 13, "Free Response" },
103 { 14, "Query Request" },
104 { 15, "Query Response" },
105 { 16, "Listen Request" },
106 { 17, "Listen Response" },
107 { 22, "Assign Request RSIPsec" },
108 { 23, "Assign Response RSIPsec" },
112 static const value_string param_type_vals
[] = {
118 { 6, "Tunnel Type" },
119 { 7, "RSIP Method" },
121 { 9, "Flow Policy" },
123 { 11, "Message Counter" },
124 { 12, "Vendor Specific" },
129 static const value_string addr_type_vals
[] = {
132 { 2, "IPv4 Netmask" },
134 { 4, "Fully Qualified Domain Name" },
138 static const value_string tunnel_type_vals
[] = {
139 { 1, "IP-IP Tunnel" },
145 static const value_string method_vals
[] = {
152 /* Error Numbers in RFC 3103 Appendix A / RFC 3104 Appendix B style */
153 static const value_string error_number_appendix_vals
[] = {
154 { 101, "UNKNOWN_ERROR" },
156 { 103, "FLOW_POLICY_VIOLATION" },
157 { 104, "INTERNAL_SERVER_ERROR" },
158 { 105, "MESSAGE_COUNTER_REQUIRED" },
159 { 106, "UNSUPPORTED_RSIP_VERSION" },
160 { 201, "MISSING_PARAM" },
161 { 202, "DUPLICATE_PARAM" },
162 { 203, "EXTRA_PARAM" },
163 { 204, "ILLEGAL_PARAM" },
164 { 205, "BAD_PARAM" },
165 { 206, "ILLEGAL_MESSAGE" },
166 { 207, "BAD_MESSAGE" },
167 { 208, "UNSUPPORTED_MESSAGE" },
168 { 301, "REGISTER_FIRST" },
169 { 302, "ALREADY_REGISTERED" },
170 { 303, "ALREADY_UNREGISTERED" },
171 { 304, "REGISTRATION_DENIED" },
172 { 305, "BAD_CLIENT_ID" },
173 { 306, "BAD_BIND_ID" },
174 { 307, "BAD_TUNNEL_TYPE" },
175 { 308, "LOCAL_ADDR_UNAVAILABLE" },
176 { 309, "LOCAL_ADDRPORT_UNAVAILABLE" },
177 { 310, "LOCAL_ADDR_INUSE" },
178 { 311, "LOCAL_ADDRPORT_INUSE" },
179 { 312, "LOCAL_ADDR_UNALlOWED" },
180 { 313, "LOCAL_ADDRPORT_UNALLOWED" },
181 { 314, "REMOTE_ADDR_UNALLOWED" },
182 { 315, "REMOTE_ADDRPORT_UNALLOWED" },
183 { 400, "IPSEC_UNALLOWED" },
184 { 401, "IPSEC_SPI_UNAVAILABLE" },
185 { 402, "IPSEC_SPI_INUSE" },
190 static const value_string error_number_vals
[] = {
191 { 101, "Unknown Error" },
193 { 103, "Flow Policy Violation" },
194 { 104, "Internal Server Error" },
195 { 105, "Message Counter Required" },
196 { 106, "Unsupported RSIP Version" },
197 { 201, "Missing Parameter" },
198 { 202, "Duplicate Parameter" },
199 { 203, "Extra Parameter" },
200 { 204, "Illegal Parameter" },
201 { 205, "Bad Parameter" },
202 { 206, "Illegal Message" },
203 { 207, "Bad Message" },
204 { 208, "Unsupported Message" },
205 { 301, "Register First" },
206 { 302, "Already Registered" },
207 { 303, "Already Unregistered" },
208 { 304, "Registration Denied" },
209 { 305, "Bad Client ID" },
210 { 306, "Bad Bind ID" },
211 { 307, "Bad Tunnel Type" },
212 { 308, "Local Address Unavailable" },
213 { 309, "Local Address Port Unavailable" },
214 { 310, "Local Address Inuse" },
215 { 311, "Local Address Port Inuse" },
216 { 312, "Local Address Unallowed" },
217 { 313, "Local Address Port Unallowed" },
218 { 314, "Remote Address Unallowed" },
219 { 315, "Remote Address Port Unallowed" },
220 { 400, "IPsec Unallowed" },
221 { 401, "IPsec SPI Unavailable" },
222 { 402, "IPsec SPI Inuse" },
226 static const value_string lcl_flow_policy_vals
[] = {
227 { 1, "Macro Flows" },
228 { 2, "Micro Flows " },
232 static const value_string rmt_flow_policy_vals
[] = {
233 { 1, "Macro Flows" },
234 { 2, "Micro Flows" },
239 /* Code to actually dissect the packets */
241 rsip_parameter(tvbuff_t
*tvb
, proto_tree
*rsip_tree
, int off
, int eoff
)
243 int consumed
, i
, paramleft
;
244 uint8_t addrtype
, flowpolicy
, method
, number
, paramtype
, tuntype
;
245 uint16_t error
, ind
, paramlen
, portnum
;
246 uint32_t bid
, cid
, leasetm
, msgc
;
247 proto_tree
*p_tree
, *v_tree
;
248 proto_item
*pti
, *vti
;
254 paramtype
= tvb_get_uint8(tvb
, off
);
255 paramlen
= tvb_get_ntohs(tvb
, off
+ 1);
257 p_tree
= proto_tree_add_subtree(rsip_tree
, tvb
, off
, 3 + paramlen
,
258 ett_rsip_param
, &pti
,
259 val_to_str(paramtype
, param_type_vals
, "Unknown (%d)"));
261 proto_tree_add_item(p_tree
, hf_rsip_parameter_type
, tvb
,
262 off
, 1, ENC_BIG_ENDIAN
);
263 proto_tree_add_item(p_tree
, hf_rsip_parameter_length
, tvb
,
264 off
+ 1, 2, ENC_BIG_ENDIAN
);
270 vti
= proto_tree_add_item(p_tree
, hf_rsip_parameter_value
,
271 tvb
, off
+ 3, paramlen
, ENC_NA
);
272 v_tree
= proto_item_add_subtree(vti
, ett_rsip_param_val
);
275 case 1: /* Address */
276 proto_tree_add_item(v_tree
, hf_rsip_parameter_address_type
,
277 tvb
, off
+ 3, 1, ENC_BIG_ENDIAN
);
279 addrtype
= tvb_get_uint8(tvb
, off
+ 3);
282 case 0: /* Reserved */
285 if (paramlen
- 1 > 0) {
286 proto_tree_add_item(v_tree
,
287 hf_rsip_parameter_address_ipv4
, tvb
,
288 off
+ 4, paramlen
- 1, ENC_BIG_ENDIAN
);
289 proto_item_append_text(pti
, ": %s",
290 tvb_ip_to_str(wmem_packet_scope(), tvb
, off
+ 4));
292 proto_item_append_text(pti
,
293 ": Any IPv4 Address");
295 case 2: /* IPv4 netmask */
296 if (paramlen
- 1 > 0) {
297 proto_tree_add_item(v_tree
,
298 hf_rsip_parameter_address_ipv4_netmask
,
299 tvb
, off
+ 4, paramlen
- 1, ENC_BIG_ENDIAN
);
300 proto_item_append_text(pti
, "(netmask): %s",
301 tvb_ip_to_str(wmem_packet_scope(), tvb
, off
+ 4));
303 proto_item_append_text(pti
,
304 ": Any IPv4 Netmask");
307 if (paramlen
- 1 > 0) {
308 proto_tree_add_item(v_tree
,
309 hf_rsip_parameter_address_ipv6
, tvb
,
310 off
+ 4, paramlen
- 1, ENC_NA
);
311 proto_item_append_text(pti
, ": %s",
312 tvb_ip6_to_str(wmem_packet_scope(), tvb
, off
+ 4));
314 proto_item_append_text(pti
,
315 ": Any IPv6 Address");
318 if (paramlen
- 1 > 0) {
319 proto_tree_add_item(v_tree
,
320 hf_rsip_parameter_address_fqdn
, tvb
,
321 off
+ 4, paramlen
- 1, ENC_ASCII
);
322 proto_item_append_text(pti
, ": %s",
323 tvb_format_text(wmem_packet_scope(), tvb
, off
+ 4, paramlen
- 1));
325 proto_item_append_text(pti
,
326 ": Any Fully Qualified Domain Name");
329 proto_item_append_text(pti
, ": Unknown Address Type");
334 proto_tree_add_item(v_tree
, hf_rsip_parameter_ports_number
,
335 tvb
, off
+ 3, 1, ENC_BIG_ENDIAN
);
336 number
= tvb_get_uint8(tvb
, off
+ 3);
340 proto_item_append_text(pti
, ": Unspecified");
343 proto_item_append_text(pti
, ": Any port");
346 proto_item_append_text(pti
, ": Any %d ports",
351 portnum
= tvb_get_ntohs(tvb
, off
+ 4);
353 proto_tree_add_item(v_tree
,
354 hf_rsip_parameter_ports_port_number
,
355 tvb
, off
+ 4, 2, ENC_BIG_ENDIAN
);
357 paramleft
= paramlen
- 1;
358 if (paramleft
== 2) {
359 proto_tree_add_uint_format_value(v_tree
,
360 hf_rsip_parameter_ports_port_number
,
361 tvb
, off
+ 4, 2, portnum
, "%d - %d",
362 portnum
, portnum
+ number
);
363 proto_item_append_text(pti
,
364 ": %d - %d", portnum
,
369 i
+= 2, paramleft
-= 2)
370 proto_tree_add_item(v_tree
,
371 hf_rsip_parameter_ports_port_number
,
372 tvb
, i
, 2, ENC_BIG_ENDIAN
);
373 proto_item_append_text(pti
,
374 ": List of %d Ports", number
);
379 case 3: /* Lease Time */
380 /* XXX if paramlen != 4 we've got a protocol violation */
381 proto_tree_add_item(v_tree
, hf_rsip_parameter_lease_time
,
382 tvb
, off
+ 3, paramlen
, ENC_BIG_ENDIAN
);
383 leasetm
= tvb_get_ntohl(tvb
, off
+ 3);
384 proto_item_append_text(pti
, ": %d seconds", leasetm
);
386 case 4: /* Client ID */
387 /* XXX if paramlen != 4 we've got a protocol violation */
388 proto_tree_add_item(v_tree
, hf_rsip_parameter_client_id
,
389 tvb
, off
+ 3, paramlen
, ENC_BIG_ENDIAN
);
390 cid
= tvb_get_ntohl(tvb
, off
+ 3);
391 proto_item_append_text(pti
, ": %d", cid
);
393 case 5: /* Bind ID */
394 /* XXX if paramlen != 4 we've got a protocol violation */
395 proto_tree_add_item(v_tree
, hf_rsip_parameter_bind_id
,
396 tvb
, off
+ 3, paramlen
, ENC_BIG_ENDIAN
);
397 bid
= tvb_get_ntohl(tvb
, off
+ 3);
398 proto_item_append_text(pti
, ": %d", bid
);
400 case 6: /* Tunnel Type */
401 /* XXX if paramlen != 1 we've got a protocol violation */
402 proto_tree_add_item(v_tree
, hf_rsip_parameter_tunnel_type
,
403 tvb
, off
+ 3, paramlen
, ENC_BIG_ENDIAN
);
404 tuntype
= tvb_get_uint8(tvb
, off
+ 3);
405 proto_item_append_text(pti
, ": %s",
406 val_to_str(tuntype
, tunnel_type_vals
,
407 "Unknown Tunnel Type (%d)"));
409 case 7: /* RSIP Method */
410 /* XXX if paramlen != 1 we've got a protocol violation */
411 proto_tree_add_item(v_tree
, hf_rsip_parameter_method
,
412 tvb
, off
+ 3, paramlen
, ENC_BIG_ENDIAN
);
413 method
= tvb_get_uint8(tvb
, off
+ 3);
414 proto_item_append_text(pti
, ": %s",
415 val_to_str(method
, method_vals
,
416 "Unknown RSIP Method (%d)"));
419 /* XXX if paramlen != 2 we've got a protocol violation */
420 proto_tree_add_item(v_tree
, hf_rsip_parameter_error
,
421 tvb
, off
+ 3, paramlen
, ENC_BIG_ENDIAN
);
422 error
= tvb_get_ntohs(tvb
, off
+ 3);
423 proto_item_append_text(pti
, ": %s",
424 val_to_str(error
, error_number_vals
, "Undefined Error (%d)"));
426 case 9: /* Flow Policy */
427 /* XXX if paramlen != 2 we've got a protocol violation */
428 proto_tree_add_item(v_tree
,
429 hf_rsip_parameter_flow_policy_local
, tvb
, off
+ 3, 1, ENC_BIG_ENDIAN
);
430 flowpolicy
= tvb_get_uint8(tvb
, off
+ 3);
431 proto_item_append_text(pti
, ": %s",
432 val_to_str(flowpolicy
, lcl_flow_policy_vals
,
433 "Undefined Local Flow Policy (%d)"));
434 proto_tree_add_item(v_tree
,
435 hf_rsip_parameter_flow_policy_remote
, tvb
, off
+ 4, 1,
437 flowpolicy
= tvb_get_uint8(tvb
, off
+ 4);
438 proto_item_append_text(pti
, "/%s",
439 val_to_str(flowpolicy
, rmt_flow_policy_vals
,
440 "Undefined Remote Flow Policy (%d)"));
442 case 10: /* Indicator */
443 /* XXX if paramlen != 2 we've got a protocol violation */
444 proto_tree_add_item(v_tree
, hf_rsip_parameter_indicator
, tvb
,
445 off
+ 3, 2, ENC_BIG_ENDIAN
);
446 ind
= tvb_get_ntohs(tvb
, off
+ 3);
447 proto_item_append_text(pti
, ": %d", ind
);
449 case 11: /* Message Counter */
450 /* XXX if paramlen != 4 we've got a protocol violation */
451 proto_tree_add_item(v_tree
, hf_rsip_parameter_message_counter
,
452 tvb
, off
+ 3, 4, ENC_BIG_ENDIAN
);
453 msgc
= tvb_get_ntohl(tvb
, off
+ 3);
454 proto_item_append_text(pti
, ": %d", msgc
);
456 case 12: /* Vendor Specific */
457 proto_tree_add_item(v_tree
,
458 hf_rsip_parameter_vendor_specific_vendor_id
, tvb
, off
+ 3,
460 proto_tree_add_item(v_tree
,
461 hf_rsip_parameter_vendor_specific_subtype
, tvb
, off
+ 5,
463 proto_tree_add_item(v_tree
,
464 hf_rsip_parameter_vendor_specific_value
, tvb
, off
+ 9,
465 paramlen
- 4, ENC_NA
);
468 proto_tree_add_item(v_tree
, hf_rsip_parameter_spi_number
, tvb
,
469 off
+ 3, 2, ENC_BIG_ENDIAN
);
471 proto_tree_add_item(v_tree
, hf_rsip_parameter_spi
, tvb
,
472 off
+ 5, 4, ENC_BIG_ENDIAN
);
478 consumed
+= paramlen
;
484 rsip_message_error_response(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
485 int offset
, int eoffset
)
487 int consumed
, offset_delta
;
490 [Message Counter] UDP required
498 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
499 offset
+= offset_delta
;
500 consumed
+= offset_delta
;
501 } while ((offset_delta
> 0) && (offset
< eoffset
));
507 rsip_message_register_request(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
508 int offset
, int eoffset
)
510 int consumed
, offset_delta
;
512 [Message Counter] UDP required
518 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
519 offset
+= offset_delta
;
520 consumed
+= offset_delta
;
521 } while ((offset_delta
> 0) && (offset
< eoffset
));
527 rsip_message_register_response(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
528 int offset
, int eoffset
)
530 int consumed
, offset_delta
;
535 [Message Counter] UDP required
543 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
544 offset
+= offset_delta
;
545 consumed
+= offset_delta
;
546 } while ((offset_delta
> 0) && (offset
< eoffset
));
552 rsip_message_deregister_request(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
553 int offset
, int eoffset
)
555 int consumed
, offset_delta
;
558 [Message Counter] UDP required
564 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
565 offset
+= offset_delta
;
566 consumed
+= offset_delta
;
567 } while ((offset_delta
> 0) && (offset
< eoffset
));
573 rsip_message_deregister_response(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
574 int offset
, int eoffset
)
576 return rsip_message_deregister_request(tvb
, rsip_tree
, offset
, eoffset
);
580 rsip_message_assign_request_rsaip(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
581 int offset
, int eoffset
)
583 int consumed
, offset_delta
;
589 [Message Counter] UDP required
597 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
598 offset
+= offset_delta
;
599 consumed
+= offset_delta
;
600 } while ((offset_delta
> 0) && (offset
< eoffset
));
606 rsip_message_assign_response_rsaip(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
607 int offset
, int eoffset
)
609 int consumed
, offset_delta
;
618 [Message Counter] UDP required
619 [Address (tunnel endpoint)]
625 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
626 offset
+= offset_delta
;
627 consumed
+= offset_delta
;
628 } while ((offset_delta
> 0) && (offset
< eoffset
));
634 rsip_message_assign_request_rsapip(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
635 int offset
, int eoffset
)
637 int consumed
, offset_delta
;
644 [Message Counter] UDP required
652 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
653 offset
+= offset_delta
;
654 consumed
+= offset_delta
;
655 } while ((offset_delta
> 0) && (offset
< eoffset
));
661 rsip_message_assign_response_rsapip(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
662 int offset
, int eoffset
)
664 int consumed
, offset_delta
;
674 [Address (tunnel endpoint)]
675 [Message Counter] UDP required
681 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
682 offset
+= offset_delta
;
683 consumed
+= offset_delta
;
684 } while ((offset_delta
> 0) && (offset
< eoffset
));
690 rsip_message_extend_request(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
691 int offset
, int eoffset
)
693 int consumed
, offset_delta
;
698 [Message Counter] UDP required
704 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
705 offset
+= offset_delta
;
706 consumed
+= offset_delta
;
707 } while ((offset_delta
> 0) && (offset
< eoffset
));
713 rsip_message_extend_response(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
714 int offset
, int eoffset
)
716 int consumed
, offset_delta
;
721 [Message Counter] UDP required
727 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
728 offset
+= offset_delta
;
729 consumed
+= offset_delta
;
730 } while ((offset_delta
> 0) && (offset
< eoffset
));
736 rsip_message_free_request(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
737 int offset
, int eoffset
)
739 int consumed
, offset_delta
;
743 [Message Counter] UDP required
749 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
750 offset
+= offset_delta
;
751 consumed
+= offset_delta
;
752 } while ((offset_delta
> 0) && (offset
< eoffset
));
758 rsip_message_free_response(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
759 int offset
, int eoffset
)
761 int consumed
, offset_delta
;
765 [Message Counter] UDP required
771 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
772 offset
+= offset_delta
;
773 consumed
+= offset_delta
;
774 } while ((offset_delta
> 0) && (offset
< eoffset
));
780 rsip_message_query_request(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
781 int offset
, int eoffset
)
783 int consumed
, offset_delta
;
786 [Message Counter] UDP required
790 <Address Tuple> ::= <Indicator (address)>
793 <Network Tuple> ::= <Indicator (network)>
801 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
802 offset
+= offset_delta
;
803 consumed
+= offset_delta
;
804 } while ((offset_delta
> 0) && (offset
< eoffset
));
810 rsip_message_query_response(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
811 int offset
, int eoffset
)
813 int consumed
, offset_delta
;
816 [Message Counter] UDP required
817 [Local Address Tuple]...
818 [Local Network Tuple]...
819 [Remote Address Tuple]...
820 [Remote Network Tuple]...
822 <Local Address Tuple> ::= <Indicator (local address)>
825 <Local Network Tuple> ::= <Indicator (local network)>
829 <Remote Address Tuple> ::= <Indicator (remote address)>
832 <Remote Network Tuple> ::= <Indicator (remote network)>
840 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
841 offset
+= offset_delta
;
842 consumed
+= offset_delta
;
843 } while ((offset_delta
> 0) && (offset
< eoffset
));
849 rsip_message_listen_request(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
850 int offset
, int eoffset
)
852 int consumed
, offset_delta
;
859 [Message Counter] UDP required
867 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
868 offset
+= offset_delta
;
869 consumed
+= offset_delta
;
870 } while ((offset_delta
> 0) && (offset
< eoffset
));
876 rsip_message_listen_response(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
877 int offset
, int eoffset
)
879 int consumed
, offset_delta
;
889 [Address (tunnel endpoint)]
890 [Message Counter] UDP required
896 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
897 offset
+= offset_delta
;
898 consumed
+= offset_delta
;
899 } while ((offset_delta
> 0) && (offset
< eoffset
));
905 rsip_message_assign_request_rsipsec(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
906 int offset
, int eoffset
)
908 int consumed
, offset_delta
;
915 [Message Counter] UDP required
923 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
924 offset
+= offset_delta
;
925 consumed
+= offset_delta
;
926 } while ((offset_delta
> 0) && (offset
< eoffset
));
932 rsip_message_assign_response_rsipsec(tvbuff_t
*tvb
, proto_tree
*rsip_tree
,
933 int offset
, int eoffset
)
935 int consumed
, offset_delta
;
945 [Address (tunnel endpoint)]
946 [Message Counter] UDP required
952 rsip_parameter(tvb
, rsip_tree
, offset
, eoffset
);
953 offset
+= offset_delta
;
954 consumed
+= offset_delta
;
955 } while ((offset_delta
> 0) && (offset
< eoffset
));
961 dissect_rsip(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
964 proto_tree
*rsip_tree
;
966 /*bool msgcnt_required;*/
969 msgtype
= tvb_get_uint8(tvb
, 1);
971 /*msgcnt_required = (pinfo->ipproto == IP_PROTO_UDP)? true : false;*/
973 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "RSIP");
975 col_add_str(pinfo
->cinfo
, COL_INFO
,
976 val_to_str(msgtype
, msg_type_vals
,
977 "Unknown Message Type (0x%0x)"));
980 ti
= proto_tree_add_item(tree
, proto_rsip
, tvb
, 0, -1, ENC_NA
);
982 rsip_tree
= proto_item_add_subtree(ti
, ett_rsip
);
984 proto_tree_add_item(rsip_tree
,
985 hf_rsip_version
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
986 proto_tree_add_item(rsip_tree
,
987 hf_rsip_message_type
, tvb
, 1, 1, ENC_BIG_ENDIAN
);
988 proto_tree_add_item(rsip_tree
,
989 hf_rsip_message_length
, tvb
, 2, 2, ENC_BIG_ENDIAN
);
991 eoff
= tvb_reported_length(tvb
);
994 case 1: /* Error Response */
995 rsip_message_error_response(tvb
, rsip_tree
, 4, eoff
);
997 case 2: /* Register Request */
998 rsip_message_register_request(tvb
, rsip_tree
, 4, eoff
);
1000 case 3: /* Register Response */
1001 rsip_message_register_response(tvb
, rsip_tree
, 4, eoff
);
1003 case 4: /* De-register Request */
1004 rsip_message_deregister_request(tvb
, rsip_tree
, 4, eoff
);
1006 case 5: /* De-register Response */
1007 rsip_message_deregister_response(tvb
, rsip_tree
, 4, eoff
);
1009 case 6: /* Assign Request RSA-IP */
1010 rsip_message_assign_request_rsaip(tvb
, rsip_tree
, 4, eoff
);
1012 case 7: /* Assign Response RSA-IP */
1013 rsip_message_assign_response_rsaip(tvb
, rsip_tree
, 4, eoff
);
1015 case 8: /* Assign Request RSAP-IP */
1016 rsip_message_assign_request_rsapip(tvb
, rsip_tree
, 4, eoff
);
1018 case 9: /* Assign Response RSAP-IP */
1019 rsip_message_assign_response_rsapip(tvb
, rsip_tree
, 4, eoff
);
1021 case 10: /* Extend Request */
1022 rsip_message_extend_request(tvb
, rsip_tree
, 4, eoff
);
1024 case 11: /* Extend Response */
1025 rsip_message_extend_response(tvb
, rsip_tree
, 4, eoff
);
1027 case 12: /* Free Request */
1028 rsip_message_free_request(tvb
, rsip_tree
, 4, eoff
);
1030 case 13: /* Free Response */
1031 rsip_message_free_response(tvb
, rsip_tree
, 4, eoff
);
1033 case 14: /* Query Request */
1034 rsip_message_query_request(tvb
, rsip_tree
, 4, eoff
);
1036 case 15: /* Query Response */
1037 rsip_message_query_response(tvb
, rsip_tree
, 4, eoff
);
1039 case 16: /* Listen Request */
1040 rsip_message_listen_request(tvb
, rsip_tree
, 4, eoff
);
1042 case 17: /* Listen Response */
1043 rsip_message_listen_response(tvb
, rsip_tree
, 4, eoff
);
1045 case 22: /* Assign Request RSIPsec */
1046 rsip_message_assign_request_rsipsec(tvb
, rsip_tree
, 4, eoff
);
1048 case 23: /* Assign Response RSIPsec */
1049 rsip_message_assign_response_rsipsec(tvb
, rsip_tree
, 4, eoff
);
1053 return tvb_captured_length(tvb
);
1057 /* Register the protocol with Wireshark */
1059 proto_register_rsip(void)
1062 static hf_register_info hf
[] = {
1064 { "Protocol version", "rsip.version",
1065 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1068 { &hf_rsip_message_type
,
1069 { "Message type", "rsip.message_type",
1070 FT_UINT8
, BASE_DEC
, VALS(msg_type_appendix_vals
), 0x0,
1073 { &hf_rsip_message_length
,
1074 { "Message length", "rsip.message_length",
1075 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1079 { &hf_rsip_parameter_type
,
1080 { "Type", "rsip.parameter.type",
1081 FT_UINT8
, BASE_DEC
, VALS(param_type_vals
), 0x0,
1084 { &hf_rsip_parameter_length
,
1085 { "Length", "rsip.parameter.length",
1086 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1089 { &hf_rsip_parameter_value
,
1090 { "Value", "rsip.parameter.value",
1091 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1094 { &hf_rsip_parameter_address_type
,
1095 { "Address type", "rsip.parameter.address_type",
1096 FT_UINT8
, BASE_DEC
, VALS(addr_type_vals
), 0x0,
1099 { &hf_rsip_parameter_address_ipv4
,
1100 { "IPv4 Address", "rsip.parameter.address",
1101 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
1104 { &hf_rsip_parameter_address_ipv4_netmask
,
1105 { "IPv4 Netmask", "rsip.parameter.netmask",
1106 FT_IPv4
, BASE_NETMASK
, NULL
, 0x0,
1109 { &hf_rsip_parameter_address_ipv6
,
1110 { "IPv6 Address", "rsip.parameter.address.ipv6",
1111 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
1114 { &hf_rsip_parameter_address_fqdn
,
1115 { "Fully Qualified Domain Name", "rsip.parameter.fqdn",
1116 FT_STRING
, BASE_NONE
, NULL
, 0x0,
1120 { &hf_rsip_parameter_ports_number
,
1121 { "Number", "rsip.parameter.ports.number",
1122 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1125 { &hf_rsip_parameter_ports_port_number
,
1126 { "Port", "rsip.parameter.ports.port_number",
1127 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1131 { &hf_rsip_parameter_lease_time
,
1132 { "Lease time", "rsip.parameter.lease_time",
1133 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1137 { &hf_rsip_parameter_client_id
,
1138 { "Client ID", "rsip.parameter.client_id",
1139 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1143 { &hf_rsip_parameter_bind_id
,
1144 { "Bind ID", "rsip.parameter.bind_id",
1145 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1149 { &hf_rsip_parameter_tunnel_type
,
1150 { "Tunnel type", "rsip.parameter.tunnel_type",
1151 FT_UINT8
, BASE_DEC
, VALS(tunnel_type_vals
), 0x0,
1155 { &hf_rsip_parameter_method
,
1156 { "Method", "rsip.method_param.method",
1157 FT_UINT8
, BASE_DEC
, VALS(method_vals
), 0x0,
1161 { &hf_rsip_parameter_error
,
1162 { "Error", "rsip.parameter.error",
1163 FT_UINT16
, BASE_DEC
, VALS(error_number_vals
), 0x0,
1167 { &hf_rsip_parameter_flow_policy_local
,
1168 { "Local Flow Policy", "rsip.parameter.local_flow_policy",
1169 FT_UINT8
, BASE_DEC
, VALS(lcl_flow_policy_vals
), 0x0,
1172 { &hf_rsip_parameter_flow_policy_remote
,
1173 { "Remote Flow Policy", "rsip.parameter.remote_flow_policy",
1174 FT_UINT8
, BASE_DEC
, VALS(rmt_flow_policy_vals
), 0x0,
1178 { &hf_rsip_parameter_indicator
,
1179 { "Value", "rsip.parameter.indicator",
1180 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
1184 { &hf_rsip_parameter_message_counter
,
1185 { "Counter", "rsip.parameter.message_counter",
1186 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1190 { &hf_rsip_parameter_vendor_specific_vendor_id
,
1191 { "Vendor ID", "rsip.parameter.vendor_specific.vendor_id",
1192 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1195 { &hf_rsip_parameter_vendor_specific_subtype
,
1196 { "Subtype", "rsip.parameter.vendor_specific.subtype",
1197 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1200 { &hf_rsip_parameter_vendor_specific_value
,
1201 { "Value", "rsip.parameter.vendor_specific.value",
1202 FT_NONE
, BASE_NONE
, NULL
, 0x0,
1206 { &hf_rsip_parameter_spi_number
,
1207 { "Number", "rsip.parameter.spi_number",
1208 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1211 { &hf_rsip_parameter_spi
,
1212 { "SPI", "rsip.parameter.spi",
1213 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
1218 static int *ett
[] = {
1224 proto_rsip
= proto_register_protocol("Realm Specific IP Protocol",
1227 proto_register_field_array(proto_rsip
, hf
, array_length(hf
));
1228 proto_register_subtree_array(ett
, array_length(ett
));
1230 rsip_handle
= register_dissector("rsip", dissect_rsip
, proto_rsip
);
1234 proto_reg_handoff_rsip(void)
1236 dissector_add_uint_with_preference("udp.port", UDP_PORT_RSIP
, rsip_handle
);
1237 dissector_add_uint_with_preference("tcp.port", TCP_PORT_RSIP
, rsip_handle
);
1241 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1246 * indent-tabs-mode: t
1249 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1250 * :indentSize=8:tabSize=8:noTabs=false: