3 * Routine to dissect ITU-T Rec. X.225 (1995 E)/ISO 8327-1 OSI Session Protocol packets
5 * Yuriy Sidelnikov <YSidelnikov@hotmail.com>
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/expert.h>
18 #include <epan/prefs.h>
19 #include <epan/conversation.h>
20 #include <epan/reassemble.h>
21 #include <epan/proto_data.h>
23 #include <wsutil/array.h>
24 #include <wsutil/str_util.h>
26 #include "packet-ber.h"
27 #include "packet-ses.h"
29 void proto_register_ses(void);
30 void proto_reg_handoff_ses(void);
32 void proto_register_clses(void);
33 void proto_reg_handoff_clses(void);
35 /* ses header fields */
37 static int hf_ses_type
;
38 static int hf_ses_type_0
;
39 static int hf_ses_length
;
40 /* static int hf_ses_version; */
41 /* static int hf_ses_reserved; */
43 static int hf_ses_segment_data
;
44 static int hf_ses_segments
;
45 static int hf_ses_segment
;
46 static int hf_ses_segment_overlap
;
47 static int hf_ses_segment_overlap_conflicts
;
48 static int hf_ses_segment_multiple_tails
;
49 static int hf_ses_segment_too_long_segment
;
50 static int hf_ses_segment_error
;
51 static int hf_ses_segment_count
;
52 static int hf_ses_reassembled_in
;
53 static int hf_ses_reassembled_length
;
55 /* ses fields defining a sub tree */
57 static int ett_ses_param
;
59 static int ett_ses_segment
;
60 static int ett_ses_segments
;
64 static int hf_connect_protocol_options_flags
;
65 static int hf_version_number_options_flags
;
66 static int hf_enclosure_item_options_flags
;
67 static int hf_token_item_options_flags
;
69 static int ett_connect_protocol_options_flags
;
70 static int ett_transport_options_flags
;
71 static int ett_protocol_version_flags
;
72 static int ett_enclosure_item_flags
;
73 static int ett_token_item_flags
;
74 static int ett_ses_req_options_flags
;
76 /* called SS user reference */
77 static int hf_called_ss_user_reference
;
79 /* calling SS user reference */
80 static int hf_calling_ss_user_reference
;
82 /* common reference */
83 static int hf_common_reference
;
85 /* additional reference information */
86 static int hf_additional_reference_information
;
89 static int hf_release_token
;
90 static int hf_major_activity_token
;
91 static int hf_synchronize_minor_token
;
92 static int hf_data_token
;
94 /* protocol options */
95 static int hf_able_to_receive_extended_concatenated_SPDU
;
97 /* session requirement */
98 static int hf_session_user_req_flags
;
99 static int hf_session_exception_report
;
100 static int hf_data_separation_function_unit
;
101 static int hf_symmetric_synchronize_function_unit
;
102 static int hf_typed_data_function_unit
;
103 static int hf_exception_function_unit
;
104 static int hf_capability_function_unit
;
105 static int hf_negotiated_release_function_unit
;
106 static int hf_activity_management_function_unit
;
107 static int hf_resynchronize_function_unit
;
108 static int hf_major_resynchronize_function_unit
;
109 static int hf_minor_resynchronize_function_unit
;
110 static int hf_expedited_data_resynchronize_function_unit
;
111 static int hf_duplex_function_unit
;
112 static int hf_half_duplex_function_unit
;
114 /* TSDU maximum size */
115 static int hf_proposed_tsdu_maximum_size_i2r
;
116 static int hf_proposed_tsdu_maximum_size_r2i
;
118 /* protocol version */
119 static int hf_protocol_version_1
;
120 static int hf_protocol_version_2
;
122 /* initial serial number */
123 static int hf_initial_serial_number
;
126 static int hf_beginning_of_SSDU
;
127 static int hf_end_of_SSDU
;
129 /* token setting item */
131 static const value_string token_setting_vals
[] = {
132 { 0x00, "initiator's side" },
133 { 0x01, "responder's side" },
134 { 0x02, "called SS user's choice" },
135 { 0x03, "reserved" },
139 static const true_false_string tfs_released_kept
= { "Released", "Kept" };
141 static int hf_release_token_setting
;
142 static int hf_major_activity_token_setting
;
143 static int hf_synchronize_minor_token_setting
;
144 static int hf_data_token_setting
;
146 /* calling session selector */
147 static int hf_calling_session_selector
;
149 /* called session selector */
150 static int hf_called_session_selector
;
153 static int hf_activity_identifier
;
156 static int hf_serial_number
;
158 /* second serial number */
159 static int hf_second_serial_number
;
161 /* second initial serial number */
162 static int hf_second_initial_serial_number
;
164 /* large initial serial number */
165 static int hf_large_initial_serial_number
;
167 /* large second initial serial number */
168 static int hf_large_second_initial_serial_number
;
170 /* Generated from convert_proto_tree_add_text.pl */
171 static int hf_ses_reason_code
;
172 static int hf_ses_transport_implementation_restriction
;
173 static int hf_ses_transport_no_reason
;
174 static int hf_ses_parameter_group_inside_parameter_group
;
175 static int hf_ses_user_data
;
176 static int hf_ses_parameter_type
;
177 static int hf_ses_transport_protocol_error
;
178 static int hf_ses_transport_user_abort
;
179 static int hf_ses_parameter_length
;
180 static int hf_ses_transport_connection
;
181 static int hf_ses_transport_option_flags
;
183 /* clses header fields */
184 static int proto_clses
;
186 static expert_field ei_ses_bad_length
;
187 static expert_field ei_ses_bad_parameter_length
;
189 #define PROTO_STRING_CLSES "ISO 9548-1 OSI Connectionless Session Protocol"
191 static dissector_handle_t pres_handle
;
193 static reassembly_table ses_reassembly_table
;
195 static const fragment_items ses_frag_items
= {
196 /* Segment subtrees */
202 &hf_ses_segment_overlap
,
203 &hf_ses_segment_overlap_conflicts
,
204 &hf_ses_segment_multiple_tails
,
205 &hf_ses_segment_too_long_segment
,
206 &hf_ses_segment_error
,
207 &hf_ses_segment_count
,
208 /* Reassembled in field */
209 &hf_ses_reassembled_in
,
210 /* Reassembled length field */
211 &hf_ses_reassembled_length
,
212 /* Reassembled data field */
219 static const value_string ses_vals
[] =
221 {SES_DATA_TRANSFER
, "DATA TRANSFER (DT) SPDU" }, /* 1 */
222 {SES_PLEASE_TOKENS
, "PLEASE TOKENS (PT) SPDU" }, /* 2 */
223 {SES_EXPEDITED
, "EXPEDITED (EX) SPDU" }, /* 5 */
224 {SES_PREPARE
, "PREPARE (PR) SPDU" }, /* 7 */
225 {SES_NOT_FINISHED
, "NOT FINISHED (NF) SPDU" }, /* 8 */
226 {SES_FINISH
, "FINISH (FN) SPDU" }, /* 9 */
227 {SES_DISCONNECT
, "DISCONNECT (DN) SPDU" }, /* 10 */
228 {SES_REFUSE
, "REFUSE (RF) SPDU" }, /* 12 */
229 {SES_CONNECTION_REQUEST
, "CONNECT (CN) SPDU" }, /* 13 */
230 {SES_CONNECTION_ACCEPT
, "ACCEPT (AC) SPDU" }, /* 14 */
231 {SES_CONNECTION_DATA_OVERFLOW
, "CONNECT DATA OVERFLOW (CDO) SPDU"}, /* 15 */
232 {SES_OVERFLOW_ACCEPT
, "OVERFLOW ACCEPT (OA) SPDU" }, /* 16 */
233 {SES_GIVE_TOKENS_CONFIRM
, "GIVE TOKENS CONFIRM (GTC) SPDU"}, /* 21 */
234 {SES_GIVE_TOKENS_ACK
, "GIVE TOKENS ACK (GTA) SPDU" }, /* 22 */
235 {SES_ABORT
, "ABORT (AB) SPDU" }, /* 25 */
236 {SES_ABORT_ACCEPT
, "ABORT ACCEPT (AA) SPDU" }, /* 26 */
237 {SES_ACTIVITY_RESUME
, "ACTIVITY RESUME (AR) SPDU" }, /* 29 */
238 {SES_TYPED_DATA
, "TYPED DATA (TD) SPDU" }, /* 33 */
239 {SES_RESYNCHRONIZE_ACK
, "RESYNCHRONIZE ACK (RA) SPDU" }, /* 34 */
240 {SES_MAJOR_SYNC_POINT
, "MAJOR SYNC POINT (MAP) SPDU" }, /* 41 */
241 {SES_MAJOR_SYNC_ACK
, "MAJOR SYNC ACK (MAA) SPDU" }, /* 42 */
242 {SES_ACTIVITY_START
, "ACTIVITY START (AS) SPDU" }, /* 45 */
243 {SES_EXCEPTION_DATA
, "EXCEPTION DATA (ED) SPDU" }, /* 48 */
244 {SES_MINOR_SYNC_POINT
, "MINOR SYNC POINT (MIP) SPDU" }, /* 49 */
245 {SES_MINOR_SYNC_ACK
, "MINOR SYNC ACK (MIA) SPDU" }, /* 50 */
246 {SES_RESYNCHRONIZE
, "RESYNCHRONIZE (RS) SPDU" }, /* 53 */
247 {SES_ACTIVITY_DISCARD
, "ACTIVITY DISCARD (AD) SPDU" }, /* 57 */
248 {SES_ACTIVITY_DISCARD_ACK
, "ACTIVITY DISCARD ACK (ADA) SPDU" }, /* 58 */
249 {SES_CAPABILITY
, "CAPABILITY DATA (CD) SPDU" }, /* 61 */
250 {SES_CAPABILITY_DATA_ACK
, "CAPABILITY DATA ACK (CDA) SPDU" }, /* 62 */
251 {CLSES_UNIT_DATA
, "UNIT DATA (UD) SPDU" }, /* 64 */
252 {SES_EXCEPTION_REPORT
, "EXCEPTION REPORT (ER) SPDU" }, /* 0x2000 */
255 value_string_ext ses_vals_ext
= VALUE_STRING_EXT_INIT(ses_vals
);
257 static const value_string ses_category0_vals
[] =
259 {SES_PLEASE_TOKENS
, "Please tokens PDU" },
260 {SES_GIVE_TOKENS
, "Give tokens PDU" },
265 static const value_string param_vals
[] =
267 {Connection_Identifier
, "Connection Identifier"}, /* 1 */
268 {Connect_Accept_Item
, "Connect Accept Item"}, /* 5 */
269 {Called_SS_user_Reference
, "Called SS user Reference"}, /* 9 */
270 {Calling_SS_user_Reference
, "Calling SS user Reference"}, /* 10 */
271 {Common_Reference
, "Common Reference"}, /* 11 */
272 {Additional_Reference_Information
, "Additional Reference Information"}, /* 12 */
273 {Sync_Type_Item
, "Sync Type Item"}, /* 15 */
274 {Token_Item
, "Token Item"}, /* 16 */
275 {Transport_Disconnect
, "Transport_Disconnect"}, /* 17 */
276 {Protocol_Options
, "Protocol Options"}, /* 19 */
277 {Session_Requirement
, "Session Requirement"}, /* 20 */
278 {TSDU_Maximum_Size
, "TSDU Maximum Size"}, /* 21 */
279 {Version_Number
, "Version Number"}, /* 22 */
280 {Initial_Serial_Number
, "Initial Serial Number"}, /* 23 */
281 {Prepare_Type
, "Prepare Type"}, /* 24 */
282 {EnclosureItem
, "Enclosure Item"}, /* 25 */
283 {Token_Setting_Item
, "Token Setting Item"}, /* 26 */
284 {Resync_Type
, "Resync Type"}, /* 27 */
285 {Linking_Information
, "Linking Information"}, /* 33 */
286 {Activity_Identifier
, "Activity Identifier"}, /* 41 */
287 {Serial_Number
, "Serial Number"}, /* 42 */
288 {Reflect_Parameter
, "Reflect Parameter"}, /* 49 */
289 {Reason_Code
, "Reason Code"}, /* 50 */
290 {Calling_Session_Selector
, "Calling Session Selector"}, /* 51 */
291 {Called_Session_Selector
, "Called Session Selector"}, /* 52 */
292 {Second_Resync_Type
, "Second Resync Type"}, /* 53 */
293 {Second_Serial_Number
, "Second Serial Number"}, /* 54 */
294 {Second_Initial_Serial_Number
, "Second Initial Serial Number"}, /* 55 */
295 {Upper_Limit_Serial_Number
, "Upper Limit Serial Number"}, /* 56 */
296 {Large_Initial_Serial_Number
, "Large Initial Serial Number"}, /* 57 */
297 {Large_Second_Initial_Serial_Number
, "Large Second Initial Serial Number"}, /* 58 */
298 {Data_Overflow
, "Data Overflow"}, /* 60 */
299 {User_Data
, "Session user data"}, /* 193 */
300 {Extended_User_Data
, "Session extended user data"}, /* 194 */
303 static value_string_ext param_vals_ext
= VALUE_STRING_EXT_INIT(param_vals
);
305 static const value_string reason_vals
[] =
307 {reason_not_specified
, "Rejection by called SS-user; reason not specified" },
308 {temporary_congestion
, "Rejection by called SS-user due to temporary congestion" },
309 {Subsequent
, "Rejection by called SS-user." },
310 {SES_DISCONNECT
, "Rejection by the SPM; implementation restriction stated in the PICS" },
311 {Session_Selector_unknown
, "Session Selector unknown" },
312 {SS_user_not_attached_to_SSAP
, "SS-user not attached to SSAP" },
313 {SPM_congestion_at_connect_time
, "SPM congestion at connect time" },
314 {versions_not_supported
, "Proposed protocol versions not supported" },
315 {SPM_reason_not_specified
, "Rejection by the SPM; reason not specified" },
316 {SPM_implementation_restriction
, "Finish PDU" },
319 static value_string_ext reason_vals_ext
= VALUE_STRING_EXT_INIT(reason_vals
);
321 /* desegmentation of OSI over ses */
322 static bool ses_desegment
= true;
324 /* RTSE reassembly data */
325 static unsigned ses_pres_ctx_id
;
326 static bool ses_rtse_reassemble
;
329 call_pres_dissector(tvbuff_t
*tvb
, int offset
, uint16_t param_len
,
330 packet_info
*pinfo
, proto_tree
*tree
,
331 proto_tree
*param_tree
,
332 struct SESSION_DATA_STRUCTURE
*session
)
334 /* do we have OSI presentation packet dissector ? */
337 /* No - display as data */
340 proto_tree_add_item(param_tree
, hf_ses_user_data
, tvb
, offset
, param_len
, ENC_NA
);
345 /* Yes - call presentation dissector */
348 next_tvb
= tvb_new_subset_length(tvb
, offset
, param_len
);
349 /* Pass the session pdu to the presentation dissector */
350 call_dissector_with_data(pres_handle
, next_tvb
, pinfo
, tree
, session
);
354 /* this routine returns length of parameter field, parameter group,
357 get_item_len(tvbuff_t
*tvb
, int offset
, int *len_len
)
361 len
= tvb_get_uint8(tvb
, offset
);
362 if(len
== TWO_BYTE_LEN
)
364 len
= tvb_get_ntohs(tvb
, offset
+1);
373 dissect_parameter(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
,
374 proto_tree
*param_tree
, packet_info
*pinfo
, uint8_t param_type
,
375 uint16_t param_len
, proto_item
*param_len_item
, uint8_t *enclosure_item_flags
,
376 struct SESSION_DATA_STRUCTURE
*session
)
378 bool has_user_information
= true;
381 static int * const item_option_flags
[] = {
383 &hf_major_activity_token
,
384 &hf_synchronize_minor_token
,
388 static int * const transport_option_flags
[] = {
389 &hf_ses_transport_connection
,
390 &hf_ses_transport_user_abort
,
391 &hf_ses_transport_protocol_error
,
392 &hf_ses_transport_no_reason
,
393 &hf_ses_transport_implementation_restriction
,
396 static int * const protocol_options_flags
[] = {
397 &hf_able_to_receive_extended_concatenated_SPDU
,
400 static int * const req_options_flags
[] = {
401 &hf_session_exception_report
,
402 &hf_data_separation_function_unit
,
403 &hf_symmetric_synchronize_function_unit
,
404 &hf_typed_data_function_unit
,
405 &hf_exception_function_unit
,
406 &hf_capability_function_unit
,
407 &hf_negotiated_release_function_unit
,
408 &hf_activity_management_function_unit
,
409 &hf_resynchronize_function_unit
,
410 &hf_major_resynchronize_function_unit
,
411 &hf_minor_resynchronize_function_unit
,
412 &hf_expedited_data_resynchronize_function_unit
,
413 &hf_duplex_function_unit
,
414 &hf_half_duplex_function_unit
,
417 static int * const version_flags
[] = {
418 &hf_protocol_version_2
,
419 &hf_protocol_version_1
,
422 static int * const enclosure_flags
[] = {
424 &hf_beginning_of_SSDU
,
428 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_BER
, true, pinfo
);
432 case Called_SS_user_Reference
:
436 proto_tree_add_item(param_tree
,
437 hf_called_ss_user_reference
,
438 tvb
, offset
, param_len
, ENC_NA
);
441 case Calling_SS_user_Reference
:
445 proto_tree_add_item(param_tree
,
446 hf_calling_ss_user_reference
,
447 tvb
, offset
, param_len
, ENC_NA
);
450 case Common_Reference
:
454 proto_tree_add_item(param_tree
,
456 tvb
, offset
, param_len
, ENC_NA
);
459 case Additional_Reference_Information
:
463 proto_tree_add_item(param_tree
,
464 hf_additional_reference_information
,
465 tvb
, offset
, param_len
, ENC_NA
);
471 expert_add_info_format(pinfo
, param_len_item
, &ei_ses_bad_length
,
472 "Length is %u, should be 1", param_len
);
476 proto_tree_add_bitmask(param_tree
, tvb
, offset
, hf_token_item_options_flags
, ett_token_item_flags
, item_option_flags
, ENC_NA
);
479 case Transport_Disconnect
:
482 expert_add_info_format(pinfo
, param_len_item
, &ei_ses_bad_length
,
483 "Length is %u, should be 1", param_len
);
486 proto_tree_add_bitmask(param_tree
, tvb
, offset
, hf_ses_transport_option_flags
, ett_transport_options_flags
, transport_option_flags
, ENC_NA
);
488 if(tvb_get_uint8(tvb
, offset
) & user_abort
)
490 session
->abort_type
= SESSION_USER_ABORT
;
494 session
->abort_type
= SESSION_PROVIDER_ABORT
;
498 case Protocol_Options
:
501 expert_add_info_format(pinfo
, param_len_item
, &ei_ses_bad_length
,
502 "Length is %u, should be 1", param_len
);
506 proto_tree_add_bitmask(param_tree
, tvb
, offset
, hf_connect_protocol_options_flags
, ett_connect_protocol_options_flags
, protocol_options_flags
, ENC_NA
);
509 case Session_Requirement
:
512 expert_add_info_format(pinfo
, param_len_item
, &ei_ses_bad_length
,
513 "Length is %u, should be 2", param_len
);
516 proto_tree_add_bitmask(param_tree
, tvb
, offset
, hf_session_user_req_flags
, ett_ses_req_options_flags
, req_options_flags
, ENC_BIG_ENDIAN
);
519 case TSDU_Maximum_Size
:
522 expert_add_info_format(pinfo
, param_len_item
, &ei_ses_bad_length
,
523 "Length is %u, should be 4", param_len
);
528 proto_tree_add_item(param_tree
,
529 hf_proposed_tsdu_maximum_size_i2r
,
530 tvb
, offset
, 2, ENC_BIG_ENDIAN
);
531 proto_tree_add_item(param_tree
,
532 hf_proposed_tsdu_maximum_size_r2i
,
533 tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
540 expert_add_info_format(pinfo
, param_len_item
, &ei_ses_bad_length
,
541 "Length is %u, should be 1", param_len
);
544 proto_tree_add_bitmask(param_tree
, tvb
, offset
, hf_version_number_options_flags
, ett_protocol_version_flags
, version_flags
, ENC_BIG_ENDIAN
);
547 case Initial_Serial_Number
:
551 proto_tree_add_item(param_tree
,
552 hf_initial_serial_number
,
553 tvb
, offset
, param_len
, ENC_ASCII
);
559 expert_add_info_format(pinfo
, param_len_item
, &ei_ses_bad_length
,
560 "Length is %u, should be 1", param_len
);
563 flags
= tvb_get_uint8(tvb
, offset
);
564 *enclosure_item_flags
= (uint8_t) flags
;
565 proto_tree_add_bitmask(param_tree
, tvb
, offset
, hf_enclosure_item_options_flags
, ett_enclosure_item_flags
, enclosure_flags
, ENC_BIG_ENDIAN
);
567 if (flags
& END_SPDU
) {
569 * In Data Transfer and Typed Data SPDUs, (X.225: 8.3.{11,13}.4)
570 * "The User Information Field shall be present
571 * if the Enclosure Item is not present, or has
572 * bit 2 = 0", which presumably means it shall
573 * *not* be present if the Enclosure item *is*
574 * present and has bit 2 = 1.
577 if(!(flags
& BEGINNING_SPDU
)) {
578 /* X.225 7.11.2 also states:
579 * "All DATA TRANSFER SPDUs, except the last DATA TRANSFER SPDU in a sequence greater than one, must have user information"
580 * So if BEGINNING_SPDU and END_SPDU are set in the enclosure item, then this is presumably a sequence of one and
581 * consequently there must be user information.
583 * So, there is only no user information if *only* END_SPDU is set.
586 has_user_information
= false;
591 case Token_Setting_Item
:
594 expert_add_info_format(pinfo
, param_len_item
, &ei_ses_bad_length
,
595 "Length is %u, should be 1", param_len
);
600 proto_tree_add_item(param_tree
,
601 hf_release_token_setting
,
602 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
603 proto_tree_add_item(param_tree
,
604 hf_major_activity_token_setting
,
605 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
606 proto_tree_add_item(param_tree
,
607 hf_synchronize_minor_token_setting
,
608 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
609 proto_tree_add_item(param_tree
,
610 hf_data_token_setting
,
611 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
615 case Activity_Identifier
:
619 /* 8.3.29.2 The parameter fields shall be as specified in Table 37.
620 * Activity Identifier m 41 6 octets maximum
622 proto_tree_add_item(param_tree
,
623 hf_activity_identifier
,
624 tvb
, offset
, param_len
, ENC_NA
);
631 proto_tree_add_item(param_tree
,
633 tvb
, offset
, param_len
, ENC_ASCII
);
638 0: Rejection by called SS-user; reason not specified.
639 1: Rejection by called SS-user due to temporary congestion.
640 2: Rejection by called SS-user. Subsequent octets may be used for user data
641 up to a length of 512 octets if Protocol Version 1 has been selected, and up
642 to a length such that the total length (including SI and LI) of the SPDU
643 does not exceed 65 539 octets if Protocol Version 2 has been selected.
644 128 + 1: Session Selector unknown.
645 128 + 2: SS-user not attached to SSAP.
646 128 + 3: SPM congestion at connect time.
647 128 + 4: Proposed protocol versions not supported.
648 128 + 5: Rejection by the SPM; reason not specified.
649 128 + 6: Rejection by the SPM; implementation restriction stated in the
653 expert_add_info_format(pinfo
, param_len_item
, &ei_ses_bad_length
,
654 "Length is %u, should be >= 1", param_len
);
658 proto_tree_add_item(param_tree
, hf_ses_reason_code
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
663 call_pres_dissector(tvb
, offset
, param_len
,
664 pinfo
, tree
, param_tree
, session
);
668 case Calling_Session_Selector
:
672 proto_tree_add_item(param_tree
,
673 hf_calling_session_selector
,
674 tvb
, offset
, param_len
, ENC_NA
);
677 case Called_Session_Selector
:
681 proto_tree_add_item(param_tree
,
682 hf_called_session_selector
,
683 tvb
, offset
, param_len
, ENC_NA
);
686 case Second_Serial_Number
:
690 proto_tree_add_item(param_tree
,
691 hf_second_serial_number
,
692 tvb
, offset
, param_len
, ENC_ASCII
);
695 case Second_Initial_Serial_Number
:
699 proto_tree_add_item(param_tree
,
700 hf_second_initial_serial_number
,
701 tvb
, offset
, param_len
, ENC_ASCII
);
704 case Large_Initial_Serial_Number
:
708 proto_tree_add_item(param_tree
,
709 hf_large_initial_serial_number
,
710 tvb
, offset
, param_len
, ENC_ASCII
);
713 case Large_Second_Initial_Serial_Number
:
717 proto_tree_add_item(param_tree
,
718 hf_large_second_initial_serial_number
,
719 tvb
, offset
, param_len
, ENC_ASCII
);
725 return has_user_information
;
729 dissect_parameter_group(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
,
730 proto_tree
*pg_tree
, packet_info
*pinfo
, uint16_t pg_len
,
731 uint8_t *enclosure_item_flags
, struct SESSION_DATA_STRUCTURE
*session
)
733 bool has_user_information
= true;
734 proto_item
*ti
, *param_len_item
;
735 proto_tree
*param_tree
;
737 const char *param_str
;
743 param_type
= tvb_get_uint8(tvb
, offset
);
744 param_tree
= proto_tree_add_subtree(pg_tree
, tvb
, offset
, -1,
746 val_to_str_ext(param_type
, ¶m_vals_ext
, "Unknown parameter type (0x%02x)"));
747 param_str
= val_to_str_ext_const(param_type
, ¶m_vals_ext
, "Unknown");
748 proto_tree_add_item(param_tree
, hf_ses_parameter_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
751 param_len
= get_item_len(tvb
, offset
, &len_len
);
752 if (len_len
> pg_len
) {
753 proto_item_set_len(ti
, pg_len
+ 1);
754 proto_tree_add_expert_format(param_tree
, pinfo
, &ei_ses_bad_parameter_length
, tvb
, offset
, pg_len
, "Parameter length doesn't fit in parameter");
755 return has_user_information
;
758 if (param_len
> pg_len
) {
759 proto_item_set_len(ti
, pg_len
+ 1 + len_len
);
760 proto_tree_add_expert_format(param_tree
, pinfo
, &ei_ses_bad_parameter_length
, tvb
, offset
, pg_len
, "Parameter length: %u, should be <= %u", param_len
, pg_len
);
761 return has_user_information
;
763 proto_item_set_len(ti
, 1 + len_len
+ param_len
);
764 param_len_item
= proto_tree_add_uint(param_tree
, hf_ses_parameter_length
, tvb
, offset
, len_len
, param_len
);
767 if (param_str
!= NULL
)
771 /* PG's in PG's are invalid, presumably */
772 case Extended_User_Data
:
774 case Connect_Accept_Item
:
775 case Connection_Identifier
:
776 case Linking_Information
:
777 proto_tree_add_item(param_tree
, hf_ses_parameter_group_inside_parameter_group
, tvb
, offset
, param_len
, ENC_NA
);
781 if (!dissect_parameter(tvb
, offset
, tree
,
782 param_tree
, pinfo
, param_type
, param_len
, param_len_item
,
783 enclosure_item_flags
, session
))
784 has_user_information
= false;
791 return has_user_information
;
795 * Returns true if there's a User Information field in this SPDU, false
799 dissect_parameters(tvbuff_t
*tvb
, int offset
, uint16_t len
, proto_tree
*tree
,
800 proto_tree
*ses_tree
, packet_info
*pinfo
,
801 uint8_t *enclosure_item_flags
, struct SESSION_DATA_STRUCTURE
*session
)
803 bool has_user_information
= true;
804 proto_item
*ti
, *param_len_item
;
805 proto_tree
*param_tree
;
807 const char *param_str
;
813 param_type
= tvb_get_uint8(tvb
, offset
);
814 param_tree
= proto_tree_add_subtree(ses_tree
, tvb
, offset
, -1, ett_ses_param
, &ti
,
815 val_to_str_ext(param_type
, ¶m_vals_ext
,
816 "Unknown parameter type (0x%02x)"));
817 param_str
= val_to_str_ext_const(param_type
, ¶m_vals_ext
, "Unknown");
818 proto_tree_add_item(param_tree
, hf_ses_parameter_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
821 param_len
= get_item_len(tvb
, offset
, &len_len
);
823 proto_item_set_len(ti
, len
+ 1 );
824 proto_tree_add_expert_format(param_tree
, pinfo
, &ei_ses_bad_parameter_length
, tvb
, offset
, len
, "Parameter length doesn't fit in parameter");
825 return has_user_information
;
828 if (param_len
> len
) {
829 proto_item_set_len(ti
, len
+ 1 + len_len
);
830 proto_tree_add_expert_format(param_tree
, pinfo
, &ei_ses_bad_parameter_length
, tvb
, offset
, len
, "Parameter length: %u, should be <= %u", param_len
, len
);
831 return has_user_information
;
833 proto_item_set_len(ti
, 1 + len_len
+ param_len
);
834 param_len_item
= proto_tree_add_uint(param_tree
, hf_ses_parameter_length
, tvb
, offset
, len_len
, param_len
);
837 if (param_str
!= NULL
)
841 case Extended_User_Data
:
842 call_pres_dissector(tvb
, offset
, param_len
,
843 pinfo
, tree
, param_tree
, session
);
847 call_pres_dissector(tvb
, offset
, param_len
,
848 pinfo
, tree
, param_tree
, session
);
852 case Connect_Accept_Item
:
853 case Connection_Identifier
:
854 case Linking_Information
:
856 if (!dissect_parameter_group(tvb
, offset
, tree
,
857 param_tree
, pinfo
, param_len
, enclosure_item_flags
, session
))
858 has_user_information
= false;
861 /* everything else is a PI */
863 if (!dissect_parameter(tvb
, offset
, tree
,
864 param_tree
, pinfo
, param_type
, param_len
, param_len_item
,
865 enclosure_item_flags
, session
))
866 has_user_information
= false;
873 return has_user_information
;
880 dissect_spdu(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo
, proto_tree
*tree
,
881 bool tokens
, bool connectionless
)
883 bool has_user_information
= false;
885 proto_item
*ti
= NULL
;
886 proto_tree
*ses_tree
= NULL
;
888 uint16_t parameters_len
;
889 tvbuff_t
*next_tvb
= NULL
;
890 uint32_t *pres_ctx_id
= NULL
;
891 uint8_t enclosure_item_flags
= BEGINNING_SPDU
|END_SPDU
;
892 struct SESSION_DATA_STRUCTURE session
;
897 type
= tvb_get_uint8(tvb
, offset
);
898 session
.spdu_type
= type
;
899 session
.abort_type
= SESSION_NO_ABORT
;
900 session
.pres_ctx_id
= 0;
902 session
.rtse_reassemble
= false;
905 col_add_str(pinfo
->cinfo
, COL_INFO
,
906 val_to_str_ext(type
, &ses_vals_ext
, "Unknown SPDU type (0x%02x)"));
908 ti
= proto_tree_add_item(tree
, proto_clses
, tvb
, offset
,
910 ses_tree
= proto_item_add_subtree(ti
, ett_ses
);
911 proto_tree_add_uint(ses_tree
, hf_ses_type
, tvb
,
914 has_user_information
= true;
917 col_add_str(pinfo
->cinfo
, COL_INFO
,
918 val_to_str(type
, ses_category0_vals
, "Unknown SPDU type (0x%02x)"));
920 ti
= proto_tree_add_item(tree
, proto_ses
, tvb
, offset
,
922 ses_tree
= proto_item_add_subtree(ti
, ett_ses
);
923 proto_tree_add_uint(ses_tree
, hf_ses_type_0
, tvb
,
927 col_add_str(pinfo
->cinfo
, COL_INFO
,
928 val_to_str_ext(type
, &ses_vals_ext
, "Unknown SPDU type (0x%02x)"));
930 ti
= proto_tree_add_item(tree
, proto_ses
, tvb
, offset
,
932 ses_tree
= proto_item_add_subtree(ti
, ett_ses
);
933 proto_tree_add_uint(ses_tree
, hf_ses_type
, tvb
,
938 * Might this SPDU have a User Information field?
941 case SES_DATA_TRANSFER
:
944 has_user_information
= true;
946 case SES_MAJOR_SYNC_POINT
:
947 pres_ctx_id
= (uint32_t *)p_get_proto_data(wmem_file_scope(), pinfo
, proto_ses
, 0);
948 if (ses_rtse_reassemble
!= 0 && !pres_ctx_id
) {
949 /* First time visited - save pres_ctx_id */
950 pres_ctx_id
= wmem_new(wmem_file_scope(), uint32_t);
951 *pres_ctx_id
= ses_pres_ctx_id
;
952 p_add_proto_data(wmem_file_scope(), pinfo
, proto_ses
, 0, pres_ctx_id
);
955 session
.pres_ctx_id
= *pres_ctx_id
;
956 session
.rtse_reassemble
= true;
957 has_user_information
= true;
959 ses_rtse_reassemble
= false;
965 /* get length of SPDU parameter field */
966 parameters_len
= get_item_len(tvb
, offset
, &len_len
);
968 proto_tree_add_uint(ses_tree
, hf_ses_length
, tvb
, offset
,
969 len_len
, parameters_len
);
972 /* Dissect parameters. */
973 if (!dissect_parameters(tvb
, offset
, parameters_len
, tree
, ses_tree
,
974 pinfo
, &enclosure_item_flags
, &session
))
975 has_user_information
= false;
976 offset
+= parameters_len
;
978 proto_item_set_end(ti
, tvb
, offset
);
980 /* Dissect user information, if present */
981 if (!ses_desegment
|| enclosure_item_flags
== (BEGINNING_SPDU
|END_SPDU
)) {
982 if (has_user_information
) {
983 /* Not desegment or only one segment */
984 if (tvb_reported_length_remaining(tvb
, offset
) > 0 || type
== SES_MAJOR_SYNC_POINT
) {
985 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
989 conversation_t
*conversation
= NULL
;
990 fragment_head
*frag_msg
= NULL
;
994 /* Use conversation index as segment id */
995 conversation
= find_conversation_pinfo(pinfo
, 0);
996 if (conversation
!= NULL
) {
997 ses_id
= conversation
->conv_index
;
999 fragment_len
= tvb_reported_length_remaining (tvb
, offset
);
1000 ti
= proto_tree_add_item (ses_tree
, hf_ses_segment_data
, tvb
, offset
,
1001 fragment_len
, ENC_NA
);
1002 proto_item_append_text (ti
, " (%d byte%s)", fragment_len
, plurality (fragment_len
, "", "s"));
1003 frag_msg
= fragment_add_seq_next (&ses_reassembly_table
,
1005 pinfo
, ses_id
, NULL
,
1007 (enclosure_item_flags
& END_SPDU
) ? false : true);
1008 next_tvb
= process_reassembled_data (tvb
, offset
, pinfo
, "Reassembled SES",
1009 frag_msg
, &ses_frag_items
, NULL
,
1010 (enclosure_item_flags
& END_SPDU
) ? tree
: ses_tree
);
1012 has_user_information
= true;
1013 offset
+= fragment_len
;
1016 if (has_user_information
&& next_tvb
) {
1018 call_data_dissector(next_tvb
, pinfo
, tree
);
1020 /* Pass the session pdu to the presentation dissector */
1021 call_dissector_with_data(pres_handle
, next_tvb
, pinfo
, tree
, &session
);
1025 * No more SPDUs to dissect. Set the offset to the
1026 * end of the tvbuff.
1028 offset
= tvb_captured_length(tvb
);
1029 if (session
.rtse_reassemble
&& type
== SES_DATA_TRANSFER
) {
1030 ses_pres_ctx_id
= session
.pres_ctx_id
;
1031 ses_rtse_reassemble
= true;
1038 * Dissect SPDUs inside a TSDU.
1041 dissect_ses(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
1045 bool is_clsp
= false;
1047 type
= tvb_get_uint8(tvb
, offset
);
1048 if(type
== CLSES_UNIT_DATA
)
1052 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, is_clsp
? "CLSES" : "SES");
1053 col_clear(pinfo
->cinfo
, COL_INFO
);
1057 * Do we have a category 0 SPDU (GIVE_TOKENS/PLEASE_TOKENS) as
1060 * If so, dissect it as such (GIVE_TOKENS and DATA_TRANSFER have
1061 * the same SPDU type value).
1063 if ((type
== SES_PLEASE_TOKENS
) || (type
== SES_GIVE_TOKENS
))
1064 offset
= dissect_spdu(tvb
, offset
, pinfo
, tree
, TOKENS_SPDU
, false);
1067 /* Dissect the remaining SPDUs. */
1068 while (tvb_reported_length_remaining(tvb
, offset
) > 0)
1069 offset
= dissect_spdu(tvb
, offset
, pinfo
, tree
, NON_TOKENS_SPDU
, is_clsp
);
1070 return tvb_captured_length(tvb
);
1074 dissect_ses_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
, void *data
)
1076 /* must check that this really is a ses packet */
1082 /* first, check do we have at least 4 bytes (type+length) */
1083 if (tvb_captured_length(tvb
) < 2)
1084 return false; /* no */
1086 /* can we recognize session PDU ? Return false if not */
1088 type
= tvb_get_uint8(tvb
, offset
);
1089 /* check SPDU type */
1090 if (try_val_to_str_ext(type
, &ses_vals_ext
) == NULL
)
1092 return false; /* no, it isn't a session PDU */
1095 /* can we recognize the second session PDU if the first one was
1096 * a Give Tokens PDU? Return false if not */
1097 if(tvb_bytes_exist(tvb
, 2, 2) && type
== SES_GIVE_TOKENS
) {
1099 type
= tvb_get_uint8(tvb
, offset
+2);
1100 /* check SPDU type */
1101 if (try_val_to_str_ext(type
, &ses_vals_ext
) == NULL
)
1103 return false; /* no, it isn't a session PDU */
1107 /* some Siemens SIMATIC protocols also use COTP, and shouldn't be
1108 * misinterpreted as SES.
1109 * the starter in this case is fixed to 0x32 (SES_MINOR_SYNC_ACK for SES),
1110 * so if the parameter type is unknown, it's probably SIMATIC */
1111 if(type
== 0x32 && tvb_captured_length(tvb
) >= 3) {
1112 type
= tvb_get_uint8(tvb
, offset
+2);
1113 if (try_val_to_str_ext(type
, ¶m_vals_ext
) == NULL
) {
1114 return false; /* it's probably a SIMATIC protocol */
1118 /* OK,let's check SPDU length */
1119 /* get length of SPDU */
1120 len
= get_item_len(tvb
, offset
+1, &len_len
);
1122 /* add header length */
1124 /* do we have enough bytes ? */
1125 if (tvb_reported_length(tvb
) < len
)
1126 return false; /* no */
1128 /* final check to see if the next SPDU, if present, is also valid */
1129 if (tvb_captured_length(tvb
) > 1+(unsigned) len
) {
1130 type
= tvb_get_uint8(tvb
, offset
+ len
+ 1);
1131 /* check SPDU type */
1132 if (try_val_to_str_ext(type
, &ses_vals_ext
) == NULL
) {
1133 return false; /* no, it isn't a session PDU */
1137 dissect_ses(tvb
, pinfo
, parent_tree
, data
);
1142 proto_register_ses(void)
1144 static hf_register_info hf
[] =
1152 BASE_DEC
| BASE_EXT_STRING
,
1165 VALS(ses_category0_vals
),
1212 &hf_called_ss_user_reference
,
1214 "Called SS User Reference",
1215 "ses.called_ss_user_reference",
1216 FT_BYTES
, BASE_NONE
,
1224 &hf_calling_ss_user_reference
,
1226 "Calling SS User Reference",
1227 "ses.calling_ss_user_reference",
1228 FT_BYTES
, BASE_NONE
,
1236 &hf_common_reference
,
1239 "ses.common_reference",
1240 FT_BYTES
, BASE_NONE
,
1248 &hf_additional_reference_information
,
1250 "Additional Reference Information",
1251 "ses.additional_reference_information",
1252 FT_BYTES
, BASE_NONE
,
1263 "ses.release_token",
1272 &hf_major_activity_token
,
1274 "major/activity token",
1278 MAJOR_ACTIVITY_TOKEN
,
1284 &hf_synchronize_minor_token
,
1286 "synchronize minor token",
1287 "ses.synchronize_token",
1290 SYNCHRONIZE_MINOR_TOKEN
,
1308 &hf_able_to_receive_extended_concatenated_SPDU
,
1310 "Able to receive extended concatenated SPDU",
1320 &hf_session_user_req_flags
,
1333 &hf_session_exception_report
,
1335 "Session exception report",
1336 "ses.exception_report",
1339 SES_EXCEPTION_REPORT
,
1345 &hf_data_separation_function_unit
,
1347 "Data separation function unit",
1351 DATA_SEPARATION_FUNCTION_UNIT
,
1357 &hf_symmetric_synchronize_function_unit
,
1359 "Symmetric synchronize function unit",
1363 SYMMETRIC_SYNCHRONIZE_FUNCTION_UNIT
,
1369 &hf_typed_data_function_unit
,
1371 "Typed data function unit",
1375 TYPED_DATA_FUNCTION_UNIT
,
1381 &hf_exception_function_unit
,
1383 "Exception function unit",
1384 "ses.exception_data",
1387 EXCEPTION_FUNCTION_UNIT
,
1393 &hf_capability_function_unit
,
1395 "Capability function unit",
1396 "ses.capability_data",
1399 CAPABILITY_DATA_FUNCTION_UNIT
,
1405 &hf_negotiated_release_function_unit
,
1407 "Negotiated release function unit",
1408 "ses.negotiated_release",
1411 NEGOTIATED_RELEASE_FUNCTION_UNIT
,
1417 &hf_activity_management_function_unit
,
1419 "Activity management function unit",
1420 "ses.activity_management",
1423 ACTIVITY_MANAGEMENT_FUNCTION_UNIT
,
1429 &hf_resynchronize_function_unit
,
1431 "Resynchronize function unit",
1432 "ses.resynchronize",
1435 RESYNCHRONIZE_FUNCTION_UNIT
,
1441 &hf_major_resynchronize_function_unit
,
1443 "Major resynchronize function unit",
1444 "ses.major_resynchronize",
1447 MAJOR_SYNCHRONIZE_FUNCTION_UNIT
,
1453 &hf_minor_resynchronize_function_unit
,
1455 "Minor resynchronize function unit",
1456 "ses.minor_resynchronize",
1459 MINOR_SYNCHRONIZE_FUNCTION_UNIT
,
1465 &hf_expedited_data_resynchronize_function_unit
,
1467 "Expedited data function unit",
1468 "ses.expedited_data",
1471 EXPEDITED_DATA_FUNCTION_UNIT
,
1477 &hf_duplex_function_unit
,
1479 "Duplex functional unit",
1483 DUPLEX_FUNCTION_UNIT
,
1489 &hf_half_duplex_function_unit
,
1491 "Half-duplex functional unit",
1495 HALF_DUPLEX_FUNCTION_UNIT
,
1501 &hf_proposed_tsdu_maximum_size_i2r
,
1503 "Proposed TSDU Maximum Size, Initiator to Responder",
1504 "ses.proposed_tsdu_maximum_size_i2r",
1514 &hf_proposed_tsdu_maximum_size_r2i
,
1516 "Proposed TSDU Maximum Size, Responder to Initiator",
1517 "ses.proposed_tsdu_maximum_size_r2i",
1527 &hf_protocol_version_1
,
1529 "Protocol Version 1",
1530 "ses.protocol_version1",
1539 &hf_protocol_version_2
,
1541 "Protocol Version 2",
1542 "ses.protocol_version2",
1551 &hf_initial_serial_number
,
1553 "Initial Serial Number",
1554 "ses.initial_serial_number",
1555 FT_STRING
, BASE_NONE
,
1563 &hf_beginning_of_SSDU
,
1565 "beginning of SSDU",
1566 "ses.beginning_of_SSDU",
1587 &hf_release_token_setting
,
1589 "release token setting",
1590 "ses.release_token_setting",
1592 VALS(token_setting_vals
),
1599 &hf_major_activity_token_setting
,
1601 "major/activity setting",
1602 "ses.major_activity_token_setting",
1604 VALS(token_setting_vals
),
1606 "major/activity token setting",
1611 &hf_synchronize_minor_token_setting
,
1613 "synchronize-minor token setting",
1614 "ses.synchronize_minor_token_setting",
1616 VALS(token_setting_vals
),
1623 &hf_data_token_setting
,
1625 "data token setting",
1626 "ses.data_token_setting",
1628 VALS(token_setting_vals
),
1635 &hf_activity_identifier
,
1637 "Activity Identifier",
1638 "ses.activity_identifier",
1639 FT_BYTES
, BASE_NONE
,
1650 "ses.serial_number",
1651 FT_STRING
, BASE_NONE
,
1659 &hf_calling_session_selector
,
1661 "Calling Session Selector",
1662 "ses.calling_session_selector",
1663 FT_BYTES
, BASE_NONE
,
1671 &hf_called_session_selector
,
1673 "Called Session Selector",
1674 "ses.called_session_selector",
1675 FT_BYTES
, BASE_NONE
,
1683 &hf_second_serial_number
,
1685 "Second Serial Number",
1686 "ses.second_serial_number",
1687 FT_STRING
, BASE_NONE
,
1695 &hf_second_initial_serial_number
,
1697 "Second Initial Serial Number",
1698 "ses.second_initial_serial_number",
1699 FT_STRING
, BASE_NONE
,
1707 &hf_large_initial_serial_number
,
1709 "Large Initial Serial Number",
1710 "ses.large_initial_serial_number",
1711 FT_STRING
, BASE_NONE
,
1719 &hf_large_second_initial_serial_number
,
1721 "Large Second Initial Serial Number",
1722 "ses.large_second_initial_serial_number",
1723 FT_STRING
, BASE_NONE
,
1731 &hf_connect_protocol_options_flags
,
1734 "ses.connect.flags",
1744 &hf_version_number_options_flags
,
1748 "ses.version.flags",
1759 &hf_token_item_options_flags
,
1763 "ses.tken_item.flags",
1774 &hf_enclosure_item_options_flags
,
1778 "ses.enclosure.flags",
1788 { &hf_ses_segment_data
,
1789 { "SES segment data", "ses.segment.data", FT_NONE
, BASE_NONE
,
1790 NULL
, 0x00, NULL
, HFILL
} },
1792 { "SES segments", "ses.segments", FT_NONE
, BASE_NONE
,
1793 NULL
, 0x00, NULL
, HFILL
} },
1795 { "SES segment", "ses.segment", FT_FRAMENUM
, BASE_NONE
,
1796 NULL
, 0x00, NULL
, HFILL
} },
1797 { &hf_ses_segment_overlap
,
1798 { "SES segment overlap", "ses.segment.overlap", FT_BOOLEAN
,
1799 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
1800 { &hf_ses_segment_overlap_conflicts
,
1801 { "SES segment overlapping with conflicting data",
1802 "ses.segment.overlap.conflicts", FT_BOOLEAN
, BASE_NONE
,
1803 NULL
, 0x0, NULL
, HFILL
} },
1804 { &hf_ses_segment_multiple_tails
,
1805 { "SES has multiple tail segments",
1806 "ses.segment.multiple_tails", FT_BOOLEAN
, BASE_NONE
,
1807 NULL
, 0x0, NULL
, HFILL
} },
1808 { &hf_ses_segment_too_long_segment
,
1809 { "SES segment too long", "ses.segment.too_long_segment",
1810 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
1811 { &hf_ses_segment_error
,
1812 { "SES desegmentation error", "ses.segment.error", FT_FRAMENUM
,
1813 BASE_NONE
, NULL
, 0x00, NULL
, HFILL
} },
1814 { &hf_ses_segment_count
,
1815 { "SES segment count", "ses.segment.count", FT_UINT32
, BASE_DEC
,
1816 NULL
, 0x00, NULL
, HFILL
} },
1817 { &hf_ses_reassembled_in
,
1818 { "Reassembled SES in frame", "ses.reassembled.in", FT_FRAMENUM
, BASE_NONE
,
1819 NULL
, 0x00, "This SES packet is reassembled in this frame", HFILL
} },
1820 { &hf_ses_reassembled_length
,
1821 { "Reassembled SES length", "ses.reassembled.length", FT_UINT32
, BASE_DEC
,
1822 NULL
, 0x00, "The total length of the reassembled payload", HFILL
} },
1824 /* Generated from convert_proto_tree_add_text.pl */
1825 { &hf_ses_user_data
, { "User data", "ses.user_data", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
1826 { &hf_ses_transport_option_flags
, { "Flags", "ses.transport_flags", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
1827 { &hf_ses_transport_connection
, { "Transport connection", "ses.transport_flags.connection", FT_BOOLEAN
, 8, TFS(&tfs_released_kept
), transport_connection_is_released
, NULL
, HFILL
}},
1828 { &hf_ses_transport_user_abort
, { "User abort", "ses.transport_flags.user_abort", FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), user_abort
, NULL
, HFILL
}},
1829 { &hf_ses_transport_protocol_error
, { "Protocol error", "ses.transport_flags.protocol_error", FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), protocol_error
, NULL
, HFILL
}},
1830 { &hf_ses_transport_no_reason
, { "No reason", "ses.transport_flags.no_reason", FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), no_reason
, NULL
, HFILL
}},
1831 { &hf_ses_transport_implementation_restriction
, { "Implementation restriction", "ses.transport_flags.implementation_restriction", FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), implementation_restriction
, NULL
, HFILL
}},
1832 { &hf_ses_reason_code
, { "Reason Code", "ses.reason_code", FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &reason_vals_ext
, 0x0, NULL
, HFILL
}},
1833 { &hf_ses_parameter_type
, { "Parameter type", "ses.parameter_type", FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, ¶m_vals_ext
, 0x0, NULL
, HFILL
}},
1834 { &hf_ses_parameter_length
, { "Parameter length", "ses.parameter_length", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
1835 { &hf_ses_parameter_group_inside_parameter_group
, { "Parameter group inside parameter group", "ses.parameter_group_inside_parameter_group", FT_NONE
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
1842 &ett_connect_protocol_options_flags
,
1843 &ett_transport_options_flags
,
1844 &ett_protocol_version_flags
,
1845 &ett_enclosure_item_flags
,
1846 &ett_token_item_flags
,
1847 &ett_ses_req_options_flags
,
1852 static ei_register_info ei
[] = {
1853 { &ei_ses_bad_length
, { "ses.bad_length", PI_MALFORMED
, PI_ERROR
, "Bad length", EXPFILL
}},
1854 { &ei_ses_bad_parameter_length
, { "ses.bad_parameter_length", PI_MALFORMED
, PI_ERROR
, "Bad parameter length", EXPFILL
}},
1857 module_t
*ses_module
;
1858 expert_module_t
* expert_ses
;
1860 proto_ses
= proto_register_protocol(PROTO_STRING_SES
, "SES", "ses");
1861 proto_register_field_array(proto_ses
, hf
, array_length(hf
));
1862 proto_register_subtree_array(ett
, array_length(ett
));
1863 expert_ses
= expert_register_protocol(proto_ses
);
1864 expert_register_field_array(expert_ses
, ei
, array_length(ei
));
1866 reassembly_table_register (&ses_reassembly_table
,
1867 &addresses_reassembly_table_functions
);
1869 ses_module
= prefs_register_protocol(proto_ses
, NULL
);
1871 prefs_register_bool_preference(ses_module
, "desegment",
1872 "Reassemble session packets ",
1873 "Whether the session dissector should reassemble messages spanning multiple SES segments",
1877 * Register the dissector by name, so other dissectors can
1878 * grab it by name rather than just referring to it directly
1879 * (you can't refer to it directly from a plugin dissector
1880 * on Windows without stuffing it into the Big Transfer Vector).
1882 register_dissector("ses", dissect_ses
, proto_ses
);
1886 proto_reg_handoff_ses(void)
1888 /* define sub dissector */
1889 pres_handle
= find_dissector_add_dependency("pres", proto_ses
);
1891 /* add our session dissector to cotp dissector list
1892 * and cotp_is dissector list*/
1893 heur_dissector_add("cotp", dissect_ses_heur
, "SES over COTP", "ses_cotp", proto_ses
, HEURISTIC_ENABLE
);
1894 heur_dissector_add("cotp_is", dissect_ses_heur
, "SES over COTP (inactive subset)", "ses_cotp_is", proto_ses
, HEURISTIC_ENABLE
);
1899 void proto_register_clses(void)
1901 proto_clses
= proto_register_protocol(PROTO_STRING_CLSES
, "CLSP", "clsp");
1905 proto_reg_handoff_clses(void)
1907 /* add our session dissector to cltp dissector list */
1908 heur_dissector_add("cltp", dissect_ses_heur
, "CLSP over COTP", "clses_cotp", proto_clses
, HEURISTIC_ENABLE
);
1912 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1917 * indent-tabs-mode: t
1920 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1921 * :indentSize=8:tabSize=8:noTabs=false: