Explicitly request literal mode after .Xr.
[netbsd-mini2440.git] / dist / tcpdump / dccp.h
blob1ae5ba4ab1797117a45c0a6682104975d0965105
1 /* $NetBSD$ */
3 /* @(#) Header: /tcpdump/master/tcpdump/dccp.h,v 1.1.2.4 2006/05/12 01:46:17 guy Exp (LBL) */
4 /*
5 * Copyright (C) Arnaldo Carvalho de Melo 2004
6 * Copyright (C) Ian McDonald 2005 <iam4@cs.waikato.ac.nz>
7 * Copyright (C) Yoshifumi Nishida 2005
9 * This software may be distributed either under the terms of the
10 * BSD-style license that accompanies tcpdump or the GNU GPL version 2
13 #ifndef __DCCP_HDR__
14 #define __DCCP_HDR__
16 /**
17 * struct dccp_hdr - generic part of DCCP packet header
19 * @dccph_sport - Relevant port on the endpoint that sent this packet
20 * @dccph_dport - Relevant port on the other endpoint
21 * @dccph_doff - Data Offset from the start of the DCCP header, in 32-bit words
22 * @dccph_ccval - Used by the HC-Sender CCID
23 * @dccph_cscov - Parts of the packet that are covered by the Checksum field
24 * @dccph_checksum - Internet checksum, depends on dccph_cscov
25 * @dccph_x - 0 = 24 bit sequence number, 1 = 48
26 * @dccph_type - packet type, see DCCP_PKT_ prefixed macros
27 * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x
29 struct dccp_hdr {
30 u_int16_t dccph_sport,
31 dccph_dport;
32 u_int8_t dccph_doff;
33 u_int8_t dccph_ccval_cscov;
34 u_int16_t dccph_checksum;
35 union {
36 u_int8_t dccph_xtr;
37 u_int32_t dccph_seq;
38 } dccph_xtrs;
41 #define DCCPH_CCVAL(dh) (((dh)->dccph_ccval_cscov) & 0x0F)
42 #define DCCPH_CSCOV(dh) (((dh)->dccph_ccval_cscov >> 4) & 0x0F)
44 #define DCCPH_X(dh) ((dh)->dccph_xtrs.dccph_xtr & 1)
45 #define DCCPH_TYPE(dh) (((dh)->dccph_xtrs.dccph_xtr >> 1) & 0xF)
46 #define DCCPH_SEQ(dh) (((dh)->dccph_xtrs.dccph_seq) >> 8)
48 /**
49 * struct dccp_hdr_ext - the low bits of a 48 bit seq packet
51 * @dccph_seq_low - low 24 bits of a 48 bit seq packet
53 struct dccp_hdr_ext {
54 u_int32_t dccph_seq_low;
57 /**
58 * struct dccp_hdr_request - Conection initiation request header
60 * @dccph_req_service - Service to which the client app wants to connect
62 struct dccp_hdr_request {
63 u_int32_t dccph_req_service;
66 /**
67 * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets
69 * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR
70 * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR
72 struct dccp_hdr_ack_bits {
73 u_int32_t dccph_ra;
74 u_int32_t dccph_ack_nr_low;
77 #define DCCPH_ACK(dh_ack) ((dh_ack)->dccph_ra >> 8)
79 /**
80 * struct dccp_hdr_response - Conection initiation response header
82 * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR
83 * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR
84 * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request
86 struct dccp_hdr_response {
87 struct dccp_hdr_ack_bits dccph_resp_ack;
88 u_int32_t dccph_resp_service;
91 #if 0
92 static inline struct dccp_hdr_data *dccp_hdr_data(struct dccp_hdr *hdrg)
94 const int ext = DCCPH_X(hdrg) ? sizeof(struct dccp_hdr_ext) : 0;
96 return (struct dccp_hdr_data *)(((u_char *)hdrg) + sizeof(hdrg) + ext);
98 #endif
101 * struct dccp_hdr_reset - Unconditionally shut down a connection
103 * @dccph_reset_service - Echoes the Service Code on a received DCCP-Request
105 struct dccp_hdr_reset {
106 struct dccp_hdr_ack_bits dccph_reset_ack;
107 u_int8_t dccph_reset_code,
108 dccph_reset_data[3];
111 enum dccp_pkt_type {
112 DCCP_PKT_REQUEST = 0,
113 DCCP_PKT_RESPONSE,
114 DCCP_PKT_DATA,
115 DCCP_PKT_ACK,
116 DCCP_PKT_DATAACK,
117 DCCP_PKT_CLOSEREQ,
118 DCCP_PKT_CLOSE,
119 DCCP_PKT_RESET,
120 DCCP_PKT_SYNC,
121 DCCP_PKT_SYNCACK,
122 DCCP_PKT_INVALID
125 enum dccp_reset_codes {
126 DCCP_RESET_CODE_UNSPECIFIED = 0,
127 DCCP_RESET_CODE_CLOSED,
128 DCCP_RESET_CODE_ABORTED,
129 DCCP_RESET_CODE_NO_CONNECTION,
130 DCCP_RESET_CODE_PACKET_ERROR,
131 DCCP_RESET_CODE_OPTION_ERROR,
132 DCCP_RESET_CODE_MANDATORY_ERROR,
133 DCCP_RESET_CODE_CONNECTION_REFUSED,
134 DCCP_RESET_CODE_BAD_SERVICE_CODE,
135 DCCP_RESET_CODE_TOO_BUSY,
136 DCCP_RESET_CODE_BAD_INIT_COOKIE,
137 DCCP_RESET_CODE_AGGRESSION_PENALTY,
138 __DCCP_RESET_CODE_LAST
141 #endif /* __DCCP_HDR__ */