Minor spelling etc updates.
[metze/wireshark/wip.git] / packet-tcp.h
1 /* packet-tcp.h
2  *
3  * $Id: packet-tcp.h,v 1.13 2002/12/17 11:49:32 sahlberg Exp $
4  *
5  * Ethereal - Network traffic analyzer
6  * By Gerald Combs <gerald@ethereal.com>
7  * Copyright 1998 Gerald Combs
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22  */
23
24 #ifndef __PACKET_TCP_H__
25 #define __PACKET_TCP_H__
26
27 /* TCP flags */
28 #define TH_FIN  0x01
29 #define TH_SYN  0x02
30 #define TH_RST  0x04
31 #define TH_PUSH 0x08
32 #define TH_ACK  0x10
33 #define TH_URG  0x20
34 #define TH_ECN  0x40
35 #define TH_CWR  0x80
36
37
38 /* the tcp header structure, passed to tap listeners */
39 struct tcpheader {
40         guint32 th_seq;
41         guint32 th_ack;
42         guint32 th_seglen;
43         guint16 th_win;
44         guint16 th_sport;
45         guint16 th_dport;
46         guint8  th_hlen;
47         guint8  th_flags;
48 };
49
50 /*
51  * Private data passed from the TCP dissector to subdissectors.
52  */
53 struct tcpinfo {
54         guint32 seq;             /* Sequence number of first byte in the data */
55         gboolean is_reassembled; /* This is reassembled data. */
56         gboolean urgent;         /* TRUE if "urgent_pointer" is valid */
57         guint16 urgent_pointer;  /* Urgent pointer value for the current packet. */
58 };
59
60 /*
61  * Loop for dissecting PDUs within a TCP stream; assumes that a PDU
62  * consists of a fixed-length chunk of data that contains enough information
63  * to determine the length of the PDU, followed by rest of the PDU.
64  *
65  * The first three arguments are the arguments passed to the dissector
66  * that calls this routine.
67  *
68  * "proto_desegment" is the dissector's flag controlling whether it should
69  * desegment PDUs that cross TCP segment boundaries.
70  *
71  * "fixed_len" is the length of the fixed-length part of the PDU.
72  *
73  * "get_pdu_len()" is a routine called to get the length of the PDU from
74  * the fixed-length part of the PDU; it's passed "tvb" and "offset".
75  *
76  * "dissect_pdu()" is the routine to dissect a PDU.
77  */
78 extern void
79 tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
80                  gboolean proto_desegment, guint fixed_len,
81                  guint (*get_pdu_len)(tvbuff_t *, int),
82                  void (*dissect_pdu)(tvbuff_t *, packet_info *, proto_tree *));
83
84 extern void decode_tcp_ports(tvbuff_t *, int, packet_info *,
85         proto_tree *, int, int);
86
87 #endif