1 /* packet-ses.h
2  *
3  * Routine to dissect ISO 8327-1 OSI Session Protocol packets
4  *
5  * Yuriy Sidelnikov <YSidelnikov@hotmail.com>
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * SPDX-License-Identifier: GPL-2.0-or-later
12  */
13 
14 #ifndef PACKET_SES_H
15 #define PACKET_SES_H
16 
17 #define PROTO_STRING_SES "ISO 8327-1 OSI Session Protocol"
18 #define PROTO_STRING_SES_INFO "ISO 8327-1 OSI Session Protocol."
19 
20 
21 
22 /*
23 * Dissect ses-encapsulated data in a TCP stream.
24 */
25 
26 /* session parms */
27 #define  SES_EXT_CONT           0x01
28 
29 /* protocol versions  */
30 #define  PROTOCOL_VERSION_1     0x01
31 #define  PROTOCOL_VERSION_2     0x02
32 
33 /* enclosure item */
34 #define BEGINNING_SPDU          0x01
35 #define END_SPDU                0x02
36 
37 #define DATA_TOKEN                              0x01
38 #define RELEASE_TOKEN                           0x40
39 #define SYNCHRONIZE_MINOR_TOKEN                 0x04
40 #define MAJOR_ACTIVITY_TOKEN                    0x10
41 
42 /* session user req  flag   */
43 #define HALF_DUPLEX_FUNCTION_UNIT               0x0001
44 #define DUPLEX_FUNCTION_UNIT                    0x0002
45 #define EXPEDITED_DATA_FUNCTION_UNIT            0x0004
46 #define MINOR_SYNCHRONIZE_FUNCTION_UNIT         0x0008
47 #define MAJOR_SYNCHRONIZE_FUNCTION_UNIT         0x0010
48 #define RESYNCHRONIZE_FUNCTION_UNIT             0x0020
49 #define ACTIVITY_MANAGEMENT_FUNCTION_UNIT       0x0040
50 #define NEGOTIATED_RELEASE_FUNCTION_UNIT        0x0080
51 #define CAPABILITY_DATA_FUNCTION_UNIT           0x0100
52 #define EXCEPTION_FUNCTION_UNIT                 0x0200
53 #define TYPED_DATA_FUNCTION_UNIT                0x0400
54 #define SYMMETRIC_SYNCHRONIZE_FUNCTION_UNIT     0x0800
55 #define DATA_SEPARATION_FUNCTION_UNIT           0x1000
56 
57 #define SES_EXCEPTION_REPORT                    0x2000
58 /*define SES_EXCEPTION_REPORT                    0    */
59 #define SES_DATA_TRANSFER                        1
60 #define SES_GIVE_TOKENS                          1
61 #define SES_PLEASE_TOKENS                        2
62 #define SES_EXPEDITED                            5
63 #define SES_PREPARE                              7
64 #define SES_NOT_FINISHED                         8
65 #define SES_FINISH                               9
66 #define SES_DISCONNECT                          10
67 #define SES_REFUSE                              12
68 #define SES_CONNECTION_REQUEST                  13
69 #define SES_CONNECTION_ACCEPT                   14
70 #define SES_CONNECTION_DATA_OVERFLOW            15
71 #define SES_OVERFLOW_ACCEPT                     16
72 #define SES_GIVE_TOKENS_CONFIRM                 21
73 #define SES_GIVE_TOKENS_ACK                     22
74 #define SES_ABORT                               25
75 #define SES_ABORT_ACCEPT                        26
76 /*#define SES_ACTIVITY_INTERRUPT                25
77 #define SES_ACTIVITY_INTERRUPT_ACK              26  */
78 #define SES_ACTIVITY_RESUME                     29
79 #define SES_TYPED_DATA                          33
80 #define SES_RESYNCHRONIZE_ACK                   34
81 #define SES_MAJOR_SYNC_POINT                    41
82 /*#define SES_MAJOR_SYNC_POINT                  41
83 #define SES_ACTIVITY_END                        41  */
84 #define SES_MAJOR_SYNC_ACK                      42
85 #define SES_ACTIVITY_START                      45
86 #define SES_EXCEPTION_DATA                      48
87 #define SES_MINOR_SYNC_POINT                    49
88 #define SES_MINOR_SYNC_ACK                      50
89 #define SES_RESYNCHRONIZE                       53
90 #define SES_ACTIVITY_DISCARD                    57
91 #define SES_ACTIVITY_DISCARD_ACK                58
92 #define SES_CAPABILITY                          61
93 #define SES_CAPABILITY_DATA_ACK                 62
94 #define CLSES_UNIT_DATA                         64
95 
96 /*
97 reason code
98     0:  Rejection by called SS-user; reason not specified.
99     1:  Rejection by called SS-user due to temporary congestion.
100     2:  Rejection by called SS-user. Subsequent octets may be used
101         for user data up to a length of 512 octets if Protocol
102         Version 1 has been selected, and up to a length such that
103         the total length (including SI and LI)  of the SPDU does
104         not exceed 65 539 octets if Protocol Version 2 has been
105         selected.
106     128 + 1:    Session Selector unknown.
107     128 + 2:    SS-user not attached to SSAP.
108     128 + 3:    SPM congestion at connect time.
109     128 + 4:    Proposed protocol versions not supported.
110     128 + 5:    Rejection by the SPM; reason not specified.
111     128 + 6:    Rejection by the SPM; implementation restriction stated in the
112                  PICS.
113 */
114 #define reason_not_specified            0
115 #define temporary_congestion            1
116 #define Subsequent                      2
117 #define Session_Selector_unknown        128+1
118 #define SS_user_not_attached_to_SSAP    128+2
119 #define SPM_congestion_at_connect_time  128+3
120 #define versions_not_supported          128+4
121 #define SPM_reason_not_specified        128+5
122 #define SPM_implementation_restriction  128+6
123 
124 #define         NON_TOKENS_SPDU                 FALSE
125 #define         TOKENS_SPDU                     TRUE
126 
127 #define         TWO_BYTE_LEN                    0xff
128 
129 /* PGI's */
130 
131 #define Connection_Identifier                   1
132 #define Connect_Accept_Item                     5
133 #define Linking_Information                     33
134 #define User_Data                               193
135 #define Extended_User_Data                      194
136 
137 /* PI's */
138 
139 #define Called_SS_user_Reference            9
140 #define Calling_SS_user_Reference           10
141 #define Common_Reference                    11
142 #define Additional_Reference_Information    12
143 
144 #define Sync_Type_Item                      15
145 #define Token_Item                          16
146 #define Transport_Disconnect                17
147 
148 #define Protocol_Options                    19
149 #define Session_Requirement                 20
150 #define TSDU_Maximum_Size                   21
151 #define Version_Number                      22
152 #define Initial_Serial_Number               23
153 #define Prepare_Type                        24
154 #define EnclosureItem                       25
155 #define Token_Setting_Item                  26
156 #define Resync_Type                         27
157 
158 #define Activity_Identifier                 41
159 #define Serial_Number                       42
160 
161 #define Reflect_Parameter                   49
162 
163 #define Reason_Code                         50
164 #define Calling_Session_Selector            51
165 #define Called_Session_Selector             52
166 #define Second_Resync_Type                  53
167 #define Second_Serial_Number                54
168 #define Second_Initial_Serial_Number        55
169 #define Upper_Limit_Serial_Number           56
170 #define Large_Initial_Serial_Number         57
171 #define Large_Second_Initial_Serial_Number  58
172 
173 #define Data_Overflow                       60
174 
175 /* transport disconnect values */
176 #define transport_connection_is_released    0x01
177 #define user_abort                          0x02
178 #define protocol_error                      0x04
179 #define no_reason                           0x08
180 #define implementation_restriction          0x10
181 
182 #define SESSION_NO_ABORT        0
183 #define SESSION_USER_ABORT      1
184 #define SESSION_PROVIDER_ABORT  2
185 
186 /* data for presentation selector      */
187 struct SESSION_DATA_STRUCTURE
188 {
189 	guint8   spdu_type;
190 	guint8   abort_type;
191 	guint8   pres_ctx_id;
192 	guint32  ros_op;
193 	gboolean rtse_reassemble;
194 };
195 
196 extern value_string_ext ses_vals_ext;
197 
198 #endif
199 
200 /*
201  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
202  *
203  * Local variables:
204  * c-basic-offset: 8
205  * tab-width: 8
206  * indent-tabs-mode: t
207  * End:
208  *
209  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
210  * :indentSize=8:tabSize=8:noTabs=false:
211  */
212