#if 0 out the stuff to set the reported length, as it'd throw an
[obnox/wireshark/wip.git] / packet-tcp.h
1 /* packet-tcp.h
2  *
3  * $Id: packet-tcp.h,v 1.18 2003/09/12 05:52:38 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         gboolean th_have_seglen;        /* TRUE if th_seglen is valid */
43         guint32 th_seglen;
44         guint32 th_win;   /* make it 32 bits so we can handle some scaling */
45         guint16 th_sport;
46         guint16 th_dport;
47         guint8  th_hlen;
48         guint8  th_flags;
49         address ip_src;
50         address ip_dst;
51 };
52
53 /*
54  * Private data passed from the TCP dissector to subdissectors.
55  */
56 struct tcpinfo {
57         guint32 seq;             /* Sequence number of first byte in the data */
58         gboolean is_reassembled; /* This is reassembled data. */
59         gboolean urgent;         /* TRUE if "urgent_pointer" is valid */
60         guint16 urgent_pointer;  /* Urgent pointer value for the current packet. */
61 };
62
63 /*
64  * Loop for dissecting PDUs within a TCP stream; assumes that a PDU
65  * consists of a fixed-length chunk of data that contains enough information
66  * to determine the length of the PDU, followed by rest of the PDU.
67  *
68  * The first three arguments are the arguments passed to the dissector
69  * that calls this routine.
70  *
71  * "proto_desegment" is the dissector's flag controlling whether it should
72  * desegment PDUs that cross TCP segment boundaries.
73  *
74  * "fixed_len" is the length of the fixed-length part of the PDU.
75  *
76  * "get_pdu_len()" is a routine called to get the length of the PDU from
77  * the fixed-length part of the PDU; it's passed "tvb" and "offset".
78  *
79  * "dissect_pdu()" is the routine to dissect a PDU.
80  */
81 extern void
82 tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
83                  gboolean proto_desegment, guint fixed_len,
84                  guint (*get_pdu_len)(tvbuff_t *, int),
85                  void (*dissect_pdu)(tvbuff_t *, packet_info *, proto_tree *));
86
87 extern void decode_tcp_ports(tvbuff_t *, int, packet_info *,
88         proto_tree *, int, int, guint32);
89
90 #endif