Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
packet-dtn.h
1 /*
2  * Copyright 2006-2007 The MITRE Corporation.
3  * All Rights Reserved.
4  * Approved for Public Release; Distribution Unlimited.
5  * Tracking Number 07-0090.
6  *
7  * The US Government will not be charged any license fee and/or royalties
8  * related to this software. Neither name of The MITRE Corporation; nor the
9  * names of its contributors may be used to endorse or promote products
10  * derived from this software without specific prior written permission.
11  *
12  * Wireshark - Network traffic analyzer
13  * By Gerald Combs <gerald@wireshark.org>
14  * Copyright 1998 Gerald Combs
15  *
16  * SPDX-License-Identifier: GPL-2.0-or-later
17  */
18 
19 /* TCP Convergence Layer - Message Types */
20 #define TCP_CONV_MSG_TYPE_DATA 0x01
21 #define TCP_CONV_MSG_TYPE_ACK 0x02
22 #define TCP_CONV_MSG_TYPE_KEEP_ALIVE 0x03
23 #define TCP_CONV_MSG_TYPE_SHUTDOWN 0x04
24 
25 /* TCP Convergence Layer (3) - Message Types */
26 #define TCP_CONVERGENCE_TYPE_MASK 0xf0
27 #define TCP_CONVERGENCE_DATA_SEGMENT 0x10
28 #define TCP_CONVERGENCE_ACK_SEGMENT 0x20
29 #define TCP_CONVERGENCE_REFUSE_BUNDLE 0x30
30 #define TCP_CONVERGENCE_KEEP_ALIVE 0x40
31 #define TCP_CONVERGENCE_SHUTDOWN 0x50
32 
33 /* TCP Convergence Layer - Contact Header Flags */
34 #define TCP_CONV_BUNDLE_ACK_FLAG 0x01
35 #define TCP_CONV_REACTIVE_FRAG_FLAG 0x02
36 #define TCP_CONV_CONNECTOR_RCVR_FLAG 0x04
37 
38 /* TCP Convergence Layer - Data Segment Flags */
39 #define TCP_CONVERGENCE_DATA_FLAGS 0x03
40 #define TCP_CONVERGENCE_DATA_END_FLAG 0x01
41 #define TCP_CONVERGENCE_DATA_START_FLAG 0x02
42 
43 /* TCP Convergence Layer - Shutdown Segment Flags */
44 #define TCP_CONVERGENCE_SHUTDOWN_FLAGS 0x03
45 #define TCP_CONVERGENCE_SHUTDOWN_REASON 0x02
46 #define TCP_CONVERGENCE_SHUTDOWN_DELAY 0x01
47 
48 /*
49  * TCP Convergence Layer - Minimum buffer sizes
50  * For Data Packet require 5 bytes fixed plus
51  * up to 4 additional for length SDV
52  */
53 
54 #define TCP_CONV_MIN_DATA_BUFFER 9
55 
56 
57 #define BUNDLE_PROCFLAGS_FRAG_MASK 0x01
58 #define BUNDLE_PROCFLAGS_ADMIN_MASK 0x02
59 #define BUNDLE_PROCFLAGS_DONTFRAG_MASK 0x04
60 #define BUNDLE_PROCFLAGS_XFERREQ_MASK 0x08
61 #define BUNDLE_PROCFLAGS_SINGLETON_MASK 0x10
62 #define BUNDLE_PROCFLAGS_APP_ACK_MASK 0x20
63 
64 #define BUNDLE_COSFLAGS_PRIORITY_MASK 0x03
65 #define BUNDLE_COSFLAGS_PRIORITY_BULK 0x00
66 #define BUNDLE_COSFLAGS_PRIORITY_NORMAL 0x01
67 #define BUNDLE_COSFLAGS_PRIORITY_EXP 0x02
68 
69 #define BUNDLE_SRRFLAGS_REPORT_MASK 0x01
70 #define BUNDLE_SRRFLAGS_CUSTODY_MASK 0x02
71 #define BUNDLE_SRRFLAGS_FORWARD_MASK 0x04
72 #define BUNDLE_SRRFLAGS_DELIVERY_MASK 0x08
73 #define BUNDLE_SRRFLAGS_DELETION_MASK 0x10
74 #define BUNDLE_SRRFLAGS_ACK_MASK 0x20
75 
76 /* Header Processing Flags (non-primary) */
77 #define HEADER_PROCFLAGS_REPLICATE 0x01
78 #define HEADER_PROCFLAGS_XMIT_STATUS 0x02
79 #define HEADER_PROCFLAGS_DISCARD 0x04
80 #define HEADER_PROCFLAGS_LAST_HEADER 0x08
81 
82 /* Header Types (excluding Primary Header) */
83 #define BUNDLE_BLOCK_TYPE_PAYLOAD 0x01 /* RFC5050 */
84 #define BUNDLE_BLOCK_TYPE_AUTHENTICATION 0x02 /* RFC6257 */
85 #define BUNDLE_BLOCK_TYPE_INTEGRITY 0x03 /* RFC6257 */
86 #define BUNDLE_BLOCK_TYPE_CONFIDENTIALITY 0x04 /* RFC6257 */
87 #define BUNDLE_BLOCK_TYPE_PREVIOUS_HOP_INSERT 0x05 /* RFC6259 */
88 #define BUNDLE_BLOCK_TYPE_METADATA_EXTENSION 0x08 /* RFC6258 */
89 #define BUNDLE_BLOCK_TYPE_EXTENSION_SECURITY 0x09 /* RFC6257 */
90 #define BUNDLE_BLOCK_TYPE_CUSTODY_TRANSFER 0x0a /* http://bioserve.colorado.edu/bp-acs/ */
91 #define BUNDLE_BLOCK_TYPE_EXTENDED_COS 0x13 /* http://tools.ietf.org/html/draft-irtf-dtnrg-ecos-02 */
92 #define BUNDLE_BLOCK_TYPE_BUNDLE_AGE_EXTENSION 0x14 /* ION NASA specific */
93 
94 /* Payload Header Processing Flags */
95 #define PAYLOAD_PROCFLAGS_REPLICATE_MASK 0x01
96 #define PAYLOAD_PROCFLAGS_XMIT_STATUS 0x02
97 #define PAYLOAD_PROCFLAGS_DISCARD_FAILURE 0x04
98 #define PAYLOAD_PROCFLAGS_LAST_HEADER 0x08
99 
100 /* Header Fixed Sizes */
101 #define TCP_CONV_HDR_DATA_FIXED_LENGTH 5
102 #define TCP_CONV_HDR_ACK_LENGTH 9
103 #define TCP_CONV_HDR_KEEP_ALIVE_LENGTH 1
104 #define TCP_CONV_HDR_SHUTDOWN_LENGTH 1
105 
106 /* Administrative Record Definitions */
107 #define ADMIN_REC_TYPE_STATUS_REPORT 0x01
108 #define ADMIN_REC_TYPE_CUSTODY_SIGNAL 0x02
109 #define ADMIN_REC_TYPE_AGGREGATE_CUSTODY_SIGNAL 0x04
110 #define ADMIN_REC_TYPE_ANNOUNCE_BUNDLE 0x05
111 
112 #define ADMIN_REC_FLAGS_FRAGMENT 0x01
113 #define ADMIN_REC_CUSTODY_REASON_MASK 0x7f
114 
115 /* Bundle Status Report Flags */
116 #define ADMIN_STATUS_FLAGS_RECEIVED 0x01
117 #define ADMIN_STATUS_FLAGS_ACCEPTED 0x02
118 #define ADMIN_STATUS_FLAGS_FORWARDED 0x04
119 #define ADMIN_STATUS_FLAGS_DELIVERED 0x08
120 #define ADMIN_STATUS_FLAGS_DELETED 0x10
121 #define ADMIN_STATUS_FLAGS_ACKNOWLEDGED 0x20
122 
123 /* Block Processing Control Flags (Version 5) */
124 #define BLOCK_CONTROL_REPLICATE 0x01
125 #define BLOCK_CONTROL_TRANSMIT_STATUS 0x02
126 #define BLOCK_CONTROL_DELETE_BUNDLE 0x04
127 #define BLOCK_CONTROL_LAST_BLOCK 0x08
128 #define BLOCK_CONTROL_DISCARD_BLOCK 0x10
129 #define BLOCK_CONTROL_NOT_PROCESSED 0x20
130 #define BLOCK_CONTROL_EID_REFERENCE 0x40
131 
132 /* ECOS Flags */
133 #define ECOS_FLAGS_CRITICAL 0x01
134 #define ECOS_FLAGS_STREAMING 0x02
135 #define ECOS_FLAGS_FLOWLABEL 0x04
136 #define ECOS_FLAGS_RELIABLE 0x08
137 
138 #define DTN_SCHEME_STR "dtn"
139 #define IPN_SCHEME_STR "ipn"
140 
141 int evaluate_sdnv(tvbuff_t *tvb, int offset, int *bytecount);
142 gint64 evaluate_sdnv_64(tvbuff_t *tvb, int offset, int *bytecount);
143 
144 
145 /* Special Functions to evaluate unsigned SDNVs with error indication
146  * bytecount returns the number bytes consumed
147  * value returns the actual value
148  *
149  * result is TRUE (1) on success else FALSE (0)
150  */
151 int evaluate_sdnv32(tvbuff_t *tvb, int offset, int *bytecount, guint32 *value);
152 int evaluate_sdnv64(tvbuff_t *tvb, int offset, int *bytecount, guint64 *value);
153 
154 /*
155  * Editor modelines - http://www.wireshark.org/tools/modelines.html
156  *
157  * Local variables:
158  * c-basic-offset: 4
159  * tab-width: 8
160  * indent-tabs-mode: nil
161  * End:
162  *
163  * vi: set shiftwidth=4 tabstop=8 expandtab:
164  * :indentSize=4:tabSize=8:noTabs=true:
165  */
Definition: tvbuff-int.h:35