| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
packet-tcpcl.h
1/* packet-tcpcl.h
2 * References:
3 * RFC 7242: https://tools.ietf.org/html/rfc7242
4 * RFC 9174: https://www.rfc-editor.org/rfc/rfc9174.html
5 *
6 * TCPCLv4 portions copyright 2019-2021, Brian Sipos <brian.sipos@gmail.com>
7 * TCPCLv3 portions copyright 2006-2007 The MITRE Corporation.
8 * All Rights Reserved.
9 * Approved for Public Release; Distribution Unlimited.
10 * Tracking Number 07-0090.
11 *
12 * The US Government will not be charged any license fee and/or royalties
13 * related to this software. Neither name of The MITRE Corporation; nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * Wireshark - Network traffic analyzer
18 * By Gerald Combs <gerald@wireshark.org>
19 * Copyright 1998 Gerald Combs
20 *
21 * SPDX-License-Identifier: GPL-2.0-or-later
22 */
23#ifndef PACKET_TCPCL_H
24#define PACKET_TCPCL_H
25
26#include <ws_symbol_export.h>
27#include <epan/tvbuff.h>
28#include <epan/proto.h>
29
30#ifdef __cplusplus
31 extern "C" {
32#endif
33
42
43/* TCP Convergence Layer v3 - Message Types */
44 typedef enum {
45 TCPCLV3_TYPE_MASK = 0xf0,
46 TCPCLV3_DATA_SEGMENT = 0x10,
47 TCPCLV3_ACK_SEGMENT = 0x20,
48 TCPCLV3_REFUSE_BUNDLE = 0x30,
49 TCPCLV3_KEEP_ALIVE = 0x40,
50 TCPCLV3_SHUTDOWN = 0x50,
51 TCPCLV3_LENGTH = 0x60,
52} Tcpclv3MessageType;
53
54/* TCP Convergence Layer - Contact Header Flags */
55 typedef enum {
56 TCPCLV3_BUNDLE_ACK_FLAG = 0x01,
57 TCPCLV3_REACTIVE_FRAG_FLAG = 0x02,
58 TCPCLV3_CONNECTOR_RCVR_FLAG = 0x04,
59} Tcpclv3ContactFlag;
60
61/* TCP Convergence Layer - Data Segment Flags */
62 typedef enum {
63 TCPCLV3_DATA_FLAGS = 0x03,
64 TCPCLV3_DATA_END_FLAG = 0x01,
65 TCPCLV3_DATA_START_FLAG = 0x02,
66} Tcpclv3DataSegmentFlag;
67
68/* TCP Convergence Layer - Shutdown Segment Flags */
69 typedef enum {
70 TCPCLV3_SHUTDOWN_FLAGS = 0x03,
71 TCPCLV3_SHUTDOWN_REASON = 0x02,
72 TCPCLV3_SHUTDOWN_DELAY = 0x01,
73} Tcpclv3ShutdownFlag;
74
75/* REFUSE-BUNDLE Reason-Codes */
76 typedef enum {
77 TCPCLV3_REFUSE_REASON_UNKNOWN = 0x00,
78 TCPCLV3_REFUSE_REASON_RX_COMPLETE = 0x01,
79 TCPCLV3_REFUSE_REASON_RX_EXHAUSTED = 0x02,
80 TCPCLV3_REFUSE_REASON_RX_RETRANSMIT = 0x03,
81 /* 0x4-0x7 - Unassigned
82 * 0x8-0xf - Reserved for future Use */
83} Tcpclv3RefuseType;
84
85 typedef enum {
86 TCPCLV4_MSGTYPE_INVALID = 0x00,
87 TCPCLV4_MSGTYPE_XFER_SEGMENT = 0x01,
88 TCPCLV4_MSGTYPE_XFER_ACK = 0x02,
89 TCPCLV4_MSGTYPE_XFER_REFUSE = 0x03,
90 TCPCLV4_MSGTYPE_KEEPALIVE = 0x04,
91 TCPCLV4_MSGTYPE_SESS_TERM = 0x05,
92 TCPCLV4_MSGTYPE_MSG_REJECT = 0x06,
93 TCPCLV4_MSGTYPE_SESS_INIT = 0x07,
94} Tcpclv4MessageType;
95
96 typedef enum {
97 TCPCLV4_SESSEXT_INVALID = 0x00,
98} Tcpclv4SessExtenionType;
99
100 typedef enum {
101 TCPCLV4_XFEREXT_INVALID = 0x00,
102 TCPCLV4_XFEREXT_TRANSFER_LEN = 0x01,
103} Tcpclv4XferExtenionType;
104
105 typedef enum {
106 TCPCLV4_CONTACT_FLAG_CANTLS = 0x01,
107} Tcpclv4ContactFlag;
108
109 typedef enum {
110 TCPCLV4_SESS_TERM_FLAG_REPLY = 0x01,
111} Tcpclv4SessTermFlag;
112
113 typedef enum {
114 TCPCLV4_TRANSFER_FLAG_START = 0x02,
115 TCPCLV4_TRANSFER_FLAG_END = 0x01,
116} Tcpclv4TransferFlag;
117
118 typedef enum {
119 TCPCLV4_EXTENSION_FLAG_CRITICAL = 0x01,
120} Tcpclv4ExtensionFlag;
121
125 typedef struct {
127 uint32_t frame_num;
128
130 int32_t ds_idx;
132 unsigned raw_offset;
133} tcpcl_frame_loc_t;
134
135 typedef struct {
137 wmem_list_t *seg_list;
138
140 wmem_list_t *ack_list;
141
143 uint64_t *total_length;
144} tcpcl_transfer_t;
145
146 typedef struct {
148 address addr;
150 uint32_t port;
151
153 bool chdr_missing;
155 tcpcl_frame_loc_t *chdr_seen;
157 uint8_t version;
159 bool can_tls;
160
162 tcpcl_frame_loc_t *sess_init_seen;
164 uint16_t keepalive;
166 uint64_t segment_mru;
168 uint64_t transfer_mru;
169
171 tcpcl_frame_loc_t *sess_term_seen;
173 uint8_t sess_term_reason;
174
176 wmem_map_t *frame_loc_to_transfer;
177
179 wmem_map_t *transfers;
180} tcpcl_peer_t;
181
183 typedef struct {
185 tcpcl_peer_t *active;
187 tcpcl_peer_t *passive;
188
191 uint8_t *version;
193 bool contact_negotiated;
195 bool session_use_tls;
197 tcpcl_frame_loc_t *session_tls_start;
198
200 bool sess_negotiated;
202 uint16_t sess_keepalive;
203} tcpcl_conversation_t;
204
206 typedef struct {
207 tcpcl_conversation_t *convo;
209 tcpcl_frame_loc_t *cur_loc;
211 bool is_contact;
213 tcpcl_peer_t *tx_peer;
215 tcpcl_peer_t *rx_peer;
217 tvbuff_t *xferload;
218} tcpcl_dissect_ctx_t;
219
227WS_DLL_PUBLIC
228 tcpcl_dissect_ctx_t * tcpcl_dissect_ctx_get(tvbuff_t *tvb, packet_info *pinfo, const int offset);
229
230#ifdef __cplusplus
231}
232#endif
233
234#endif /* PACKET_TCPCL_H */
235
236/*
237 * Editor modelines - https://www.wireshark.org/tools/modelines.html
238 *
239 * Local variables:
240 * c-basic-offset: 4
241 * tab-width: 8
242 * indent-tabs-mode: nil
243 * End:
244 *
245 * vi: set shiftwidth=4 tabstop=8 expandtab:
246 * :indentSize=4:tabSize=8:noTabs=true:
247 */
address
struct _address address
Holds a network or link-layer address of any supported type.
packet_info
struct _packet_info packet_info
Represents the metadata and indexing information for a single captured frame.
wmem_list_t
struct _wmem_list_t wmem_list_t
Opaque type representing a scoped, doubly-linked list in the wmem system.
Definition wmem_list.h:42
wmem_map_t
struct _wmem_map_t wmem_map_t
Opaque type representing a wmem-managed hash map.
Definition wmem_map.h:46
proto.h
tcpcl_conversation_t
Persistent state associated with a TCP conversation.
Definition packet-tcpcl.h:183
tcpcl_conversation_t::contact_negotiated
bool contact_negotiated
True when contact negotiation is finished.
Definition packet-tcpcl.h:193
tcpcl_conversation_t::passive
tcpcl_peer_t * passive
Information for the passive side of the session.
Definition packet-tcpcl.h:187
tcpcl_conversation_t::active
tcpcl_peer_t * active
Information for the active side of the session.
Definition packet-tcpcl.h:185
tcpcl_conversation_t::session_tls_start
tcpcl_frame_loc_t * session_tls_start
The last frame before TLS handshake.
Definition packet-tcpcl.h:197
tcpcl_conversation_t::version
uint8_t * version
Definition packet-tcpcl.h:191
tcpcl_conversation_t::sess_negotiated
bool sess_negotiated
True when session negotiation is finished.
Definition packet-tcpcl.h:200
tcpcl_conversation_t::sess_keepalive
uint16_t sess_keepalive
Negotiated session keepalive.
Definition packet-tcpcl.h:202
tcpcl_conversation_t::session_use_tls
bool session_use_tls
Negotiated use of TLS from can_tls of the peers.
Definition packet-tcpcl.h:195
tcpcl_dissect_ctx_t
Context for a single packet dissection.
Definition packet-tcpcl.h:206
tcpcl_dissect_ctx_t::cur_loc
tcpcl_frame_loc_t * cur_loc
Dissection cursor.
Definition packet-tcpcl.h:209
tcpcl_dissect_ctx_t::is_contact
bool is_contact
True if the dissection is on a contact header.
Definition packet-tcpcl.h:211
tcpcl_dissect_ctx_t::rx_peer
tcpcl_peer_t * rx_peer
The receiving peer.
Definition packet-tcpcl.h:215
tcpcl_dissect_ctx_t::tx_peer
tcpcl_peer_t * tx_peer
The sending peer.
Definition packet-tcpcl.h:213
tcpcl_dissect_ctx_t::xferload
tvbuff_t * xferload
Possible transfer payload.
Definition packet-tcpcl.h:217
tcpcl_frame_loc_t
Definition packet-tcpcl.h:125
tcpcl_frame_loc_t::frame_num
uint32_t frame_num
Index of the frame.
Definition packet-tcpcl.h:127
tcpcl_frame_loc_t::raw_offset
unsigned raw_offset
Offset within the source TVB.
Definition packet-tcpcl.h:132
tcpcl_frame_loc_t::ds_idx
int32_t ds_idx
Data source index within the frame.
Definition packet-tcpcl.h:130
tcpcl_peer_t
Definition packet-tcpcl.h:146
tcpcl_peer_t::version
uint8_t version
TCPCL version seen from this peer.
Definition packet-tcpcl.h:157
tcpcl_peer_t::port
uint32_t port
Port for the this peer.
Definition packet-tcpcl.h:150
tcpcl_peer_t::chdr_missing
bool chdr_missing
True if a contact header was not seen at the start of connection.
Definition packet-tcpcl.h:153
tcpcl_peer_t::chdr_seen
tcpcl_frame_loc_t * chdr_seen
Frame number in which the contact header starts.
Definition packet-tcpcl.h:155
tcpcl_peer_t::addr
address addr
Address for this peer.
Definition packet-tcpcl.h:148
tcpcl_peer_t::keepalive
uint16_t keepalive
Keepalive duration (s) from v4 SESS_INIT.
Definition packet-tcpcl.h:164
tcpcl_peer_t::can_tls
bool can_tls
CAN_TLS flag from the contact header.
Definition packet-tcpcl.h:159
tcpcl_peer_t::transfers
wmem_map_t * transfers
Map from transfer ID uint64_t* to tcpcl_transfer_t* sent from this peer.
Definition packet-tcpcl.h:179
tcpcl_peer_t::transfer_mru
uint64_t transfer_mru
Transfer MRU.
Definition packet-tcpcl.h:168
tcpcl_peer_t::segment_mru
uint64_t segment_mru
Segment MRU.
Definition packet-tcpcl.h:166
tcpcl_peer_t::frame_loc_to_transfer
wmem_map_t * frame_loc_to_transfer
Map from tcpcl_frame_loc_t* to possible associated transfer ID uint64_t*.
Definition packet-tcpcl.h:176
tcpcl_peer_t::sess_term_reason
uint8_t sess_term_reason
SESS_TERM reason.
Definition packet-tcpcl.h:173
tcpcl_peer_t::sess_term_seen
tcpcl_frame_loc_t * sess_term_seen
Frame number in which the SESS_TERM message starts.
Definition packet-tcpcl.h:171
tcpcl_peer_t::sess_init_seen
tcpcl_frame_loc_t * sess_init_seen
Frame number in which the v4 SESS_INIT message starts.
Definition packet-tcpcl.h:162
tcpcl_transfer_t
Definition packet-tcpcl.h:135
tcpcl_transfer_t::ack_list
wmem_list_t * ack_list
Ordered list of ack_meta_t* for XFER_ACK as seen in the first scan.
Definition packet-tcpcl.h:140
tcpcl_transfer_t::total_length
uint64_t * total_length
Optional Transfer Length extension.
Definition packet-tcpcl.h:143
tcpcl_transfer_t::seg_list
wmem_list_t * seg_list
Ordered list of seg_meta_t* for XFER_SEGMENT as seen in the first scan.
Definition packet-tcpcl.h:137
tvbuff.h