#include <string.h> and/or #include <stdio.h> not needed.
[obnox/wireshark/wip.git] / epan / dissectors / 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  * $Id$
13  *
14  * Wireshark - Network traffic analyzer
15  * By Gerald Combs <gerald@wireshark.org>
16  * Copyright 1998 Gerald Combs
17  *
18  * This program is free software; you can redistribute it and/or
19  * modify it under the terms of the GNU General Public License
20  * as published by the Free Software Foundation; either version 2
21  * of the License, or (at your option) any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
31  */
32
33 /* TCP Convergence Layer - Message Types */
34 #define TCP_CONV_MSG_TYPE_DATA          0x01
35 #define TCP_CONV_MSG_TYPE_ACK           0x02
36 #define TCP_CONV_MSG_TYPE_KEEP_ALIVE    0x03
37 #define TCP_CONV_MSG_TYPE_SHUTDOWN      0x04
38
39 /* TCP Convergence Layer (3) - Message Types */
40 #define TCP_CONVERGENCE_TYPE_MASK       0xf0
41 #define TCP_CONVERGENCE_DATA_SEGMENT    0x10
42 #define TCP_CONVERGENCE_ACK_SEGMENT     0x20
43 #define TCP_CONVERGENCE_REFUSE_BUNDLE   0x30
44 #define TCP_CONVERGENCE_KEEP_ALIVE      0x40
45 #define TCP_CONVERGENCE_SHUTDOWN        0x50
46
47 /* TCP Convergence Layer - Contact Header Flags */
48 #define TCP_CONV_BUNDLE_ACK_FLAG        0x01
49 #define TCP_CONV_REACTIVE_FRAG_FLAG     0x02
50 #define TCP_CONV_CONNECTOR_RCVR_FLAG    0x04
51
52 /* TCP Convergence Layer - Data Segment Flags */
53 #define TCP_CONVERGENCE_DATA_FLAGS      0x03
54 #define TCP_CONVERGENCE_DATA_END_FLAG   0x01
55 #define TCP_CONVERGENCE_DATA_START_FLAG 0x02
56
57 /* TCP Convergence Layer - Shutdown Segment Flags */
58 #define TCP_CONVERGENCE_SHUTDOWN_FLAGS  0x03
59 #define TCP_CONVERGENCE_SHUTDOWN_REASON 0x02
60 #define TCP_CONVERGENCE_SHUTDOWN_DELAY  0x01
61
62 /*
63  * TCP Convergence Layer - Minimum buffer sizes
64  * For Data Packet require 5 bytes fixed plus
65  * up to 4 additional for length SDV
66  */
67
68 #define TCP_CONV_MIN_DATA_BUFFER        9
69
70
71 #define BUNDLE_PROCFLAGS_FRAG_MASK      0x01
72 #define BUNDLE_PROCFLAGS_ADMIN_MASK     0x02
73 #define BUNDLE_PROCFLAGS_DONTFRAG_MASK  0x04
74 #define BUNDLE_PROCFLAGS_XFERREQ_MASK   0x08
75 #define BUNDLE_PROCFLAGS_SINGLETON_MASK 0x10
76 #define BUNDLE_PROCFLAGS_APP_ACK_MASK   0x20
77
78 #define BUNDLE_COSFLAGS_PRIORITY_MASK   0x03
79 #define BUNDLE_COSFLAGS_PRIORITY_BULK   0x00
80 #define BUNDLE_COSFLAGS_PRIORITY_NORMAL 0x01
81 #define BUNDLE_COSFLAGS_PRIORITY_EXP    0x02
82
83 #define BUNDLE_SRRFLAGS_REPORT_MASK     0x01
84 #define BUNDLE_SRRFLAGS_CUSTODY_MASK    0x02
85 #define BUNDLE_SRRFLAGS_FORWARD_MASK    0x04
86 #define BUNDLE_SRRFLAGS_DELIVERY_MASK   0x08
87 #define BUNDLE_SRRFLAGS_DELETION_MASK   0x10
88 #define BUNDLE_SRRFLAGS_ACK_MASK        0x20
89
90 /* Header Processing Flags (non-primary) */
91 #define HEADER_PROCFLAGS_REPLICATE      0x01
92 #define HEADER_PROCFLAGS_XMIT_STATUS    0x02
93 #define HEADER_PROCFLAGS_DISCARD        0x04
94 #define HEADER_PROCFLAGS_LAST_HEADER    0x08
95
96 /* Header Types (excluding Primary Header) */
97 #define PAYLOAD_HEADER_TYPE             0x01
98
99 /* Payload Header Processing Flags */
100 #define PAYLOAD_PROCFLAGS_REPLICATE_MASK        0x01
101 #define PAYLOAD_PROCFLAGS_XMIT_STATUS           0x02
102 #define PAYLOAD_PROCFLAGS_DISCARD_FAILURE       0x04
103 #define PAYLOAD_PROCFLAGS_LAST_HEADER           0x08
104
105 /* Header Fixed Sizes */
106 #define TCP_CONV_HDR_DATA_FIXED_LENGTH  5
107 #define TCP_CONV_HDR_ACK_LENGTH         9
108 #define TCP_CONV_HDR_KEEP_ALIVE_LENGTH  1
109 #define TCP_CONV_HDR_SHUTDOWN_LENGTH    1
110
111 /* Administrative Record Definitions */
112 #define ADMIN_REC_TYPE_STATUS_REPORT    0x01
113 #define ADMIN_REC_TYPE_CUSTODY_SIGNAL   0x02
114
115 #define ADMIN_REC_FLAGS_FRAGMENT        0x01
116 #define ADMIN_REC_CUSTODY_REASON_MASK   0x7f
117
118 /* Bundle Status Report Flags */
119 #define ADMIN_STATUS_FLAGS_RECEIVED     0x01
120 #define ADMIN_STATUS_FLAGS_ACCEPTED     0x02
121 #define ADMIN_STATUS_FLAGS_FORWARDED    0x04
122 #define ADMIN_STATUS_FLAGS_DELIVERED    0x08
123 #define ADMIN_STATUS_FLAGS_DELETED      0x10
124 #define ADMIN_STATUS_FLAGS_ACKNOWLEDGED 0x20
125
126 /* Block Processing Control Flags (Version 5) */
127 #define BLOCK_CONTROL_REPLICATE         0x01
128 #define BLOCK_CONTROL_TRANSMIT_STATUS   0x02
129 #define BLOCK_CONTROL_DELETE_BUNDLE     0x04
130 #define BLOCK_CONTROL_LAST_BLOCK        0x08
131 #define BLOCK_CONTROL_DISCARD_BLOCK     0x10
132 #define BLOCK_CONTROL_NOT_PROCESSED     0x20
133 #define BLOCK_CONTROL_EID_REFERENCE     0x40
134
135 #define IPN_SCHEME_STR                  "ipn"
136
137 int evaluate_sdnv(tvbuff_t *tvb, int offset, int *bytecount);
138 gint64 evaluate_sdnv_64(tvbuff_t *tvb, int offset, int *bytecount);
139 int dissect_complete_bundle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
140
141