Wireshark  4.3.0
The Wireshark network protocol analyzer
packet-dccp.h
1 /* packet-dccp.h
2  * Definitions for Datagram Congestion Control Protocol, "DCCP" dissection:
3  * it should conform to RFC 4340
4  *
5  * Copyright 2005 _FF_
6  *
7  * Francesco Fondelli <francesco dot fondelli, gmail dot com>
8  *
9  * Copyright 2020-2021 by Thomas Dreibholz <dreibh [AT] simula.no>
10  *
11  * template taken from packet-udp.c
12  *
13  * Wireshark - Network traffic analyzer
14  * By Gerald Combs <gerald@wireshark.org>
15  * Copyright 1998 Gerald Combs
16  *
17  * SPDX-License-Identifier: GPL-2.0-or-later
18  */
19 
20 #ifndef __PACKET_DCCP_H__
21 #define __PACKET_DCCP_H__
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26 
27 /* DCCP structs and definitions */
28 typedef struct _e_dccphdr {
29  guint16 sport;
30  guint16 dport;
31  guint8 data_offset;
32  guint8 cscov; /* 4 bits */
33  guint8 ccval; /* 4 bits */
34  guint16 checksum;
35  guint8 reserved1; /* 3 bits */
36  guint8 type; /* 4 bits */
37  gboolean x; /* 1 bits */
38  guint8 reserved2; /* if x == 1 */
39  guint64 seq; /* 48 or 24 bits sequence number */
40 
41  guint16 ack_reserved; /*
42  * for all defined packet types except DCCP-Request
43  * and DCCP-Data
44  */
45  guint64 ack; /* 48 or 24 bits acknowledgement sequence number */
46 
47  guint32 service_code;
48  guint8 reset_code;
49  guint8 data1;
50  guint8 data2;
51  guint8 data3;
52 
53  guint32 stream; /* this stream index field is included to help differentiate when address/port pairs are reused */
54 
55  address ip_src;
56  address ip_dst;
57 } e_dccphdr;
58 
59 typedef struct _dccp_flow_t {
60  guint8 static_flags; /* flags */
61  guint64 base_seq; /* base seq number (used by relative sequence numbers) */
62 } dccp_flow_t;
63 
64 struct dccp_analysis {
65  /* These two structs are managed based on comparing the source
66  * and destination addresses and, if they're equal, comparing
67  * the source and destination ports.
68  *
69  * If the source is greater than the destination, then stuff
70  * sent from src is in ual1.
71  *
72  * If the source is less than the destination, then stuff
73  * sent from src is in ual2.
74  *
75  * XXX - if the addresses and ports are equal, we don't guarantee
76  * the behavior.
77  */
78  dccp_flow_t flow1;
79  dccp_flow_t flow2;
80 
81  /* These pointers are set by get_dccp_conversation_data()
82  * fwd point in the same direction as the current packet
83  * and rev in the reverse direction
84  */
85  dccp_flow_t *fwd;
86  dccp_flow_t *rev;
87 
88  /* Keep track of dccp stream numbers instead of using the conversation
89  * index (as how it was done before). This prevents gaps in the
90  * stream index numbering
91  */
92  guint32 stream;
93 
94  /* Remember the timestamp of the first frame seen in this dccp
95  * conversation to be able to calculate a relative time compared
96  * to the start of this conversation
97  */
98  nstime_t ts_first;
99 
100  /* Remember the timestamp of the frame that was last seen in this
101  * dccp conversation to be able to calculate a delta time compared
102  * to previous frame in this conversation
103  */
104  nstime_t ts_prev;
105 };
106 
111 WS_DLL_PUBLIC guint32 get_dccp_stream_count(void);
112 
113 #ifdef __cplusplus
114 }
115 #endif /* __cplusplus */
116 
117 #endif /* __PACKET_DCCP_H__ */
118 
119 /*
120  * Editor modelines - https://www.wireshark.org/tools/modelines.html
121  *
122  * Local variables:
123  * c-basic-offset: 4
124  * tab-width: 8
125  * indent-tabs-mode: nil
126  * End:
127  *
128  * vi: set shiftwidth=4 tabstop=8 expandtab:
129  * :indentSize=4:tabSize=8:noTabs=true:
130  */
Definition: address.h:56
Definition: packet-dccp.h:59
Definition: packet-dccp.h:28
Definition: packet-dccp.h:64
Definition: nstime.h:26
Definition: stream.c:41