1999-03-23 03:14:46 +00:00
|
|
|
/* packet-ip.h
|
|
|
|
* Definitions for IP packet disassembly structures and routines
|
|
|
|
*
|
2001-12-29 22:01:11 +00:00
|
|
|
* $Id: packet-ip.h,v 1.23 2001/12/29 22:01:11 guy Exp $
|
1999-03-23 03:14:46 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
2001-04-23 17:51:37 +00:00
|
|
|
* By Gerald Combs <gerald@ethereal.com>
|
1999-03-23 03:14:46 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __PACKET_IP_H__
|
|
|
|
#define __PACKET_IP_H__
|
|
|
|
|
2001-11-20 21:59:18 +00:00
|
|
|
void capture_ip(const u_char *, int, int, packet_counts *);
|
2000-02-15 21:06:58 +00:00
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
typedef enum {
|
|
|
|
NO_LENGTH, /* option has no data, hence no length */
|
|
|
|
FIXED_LENGTH, /* option always has the same length */
|
|
|
|
VARIABLE_LENGTH /* option is variable-length - optlen is minimum */
|
|
|
|
} opt_len_type;
|
|
|
|
|
|
|
|
/* Member of table of IP or TCP options. */
|
1999-08-28 08:31:28 +00:00
|
|
|
typedef struct ip_tcp_opt {
|
1999-03-23 03:14:46 +00:00
|
|
|
int optcode; /* code for option */
|
1999-11-16 11:44:20 +00:00
|
|
|
char *name; /* name of option */
|
|
|
|
int *subtree_index; /* pointer to subtree index for option */
|
1999-03-23 03:14:46 +00:00
|
|
|
opt_len_type len_type; /* type of option length field */
|
|
|
|
int optlen; /* value length should be (minimum if VARIABLE) */
|
Add a "col_clear()" routine, to clear a column; it appears (and it
doesn't just seem to be a profiling artifact) that, at least on FreeBSD
3.4, it's significantly more efficient to clear out a column by stuffing
a '\0' into the first byte of the column data than to do so by copying a
null string (I guess when copying one byte, the fixed overhead of the
procedure call and of "strcpy()" is significant).
Have the TCP dissector set the Protocol column, and clear the Info
column, before doing anything that might cause an exception to be
thrown, so that if we *do* get an exception thrown, the frame at least
shows up as TCP.
Instead of, in the TCP dissector, constructing a string and then
stuffing it into the Info column, just append to the Info column, which
avoids one string copy.
Pass a "frame_data" pointer to dissectors for TCP and IP (and PPP)
options, so they can use it to append to the Info column.
svn path=/trunk/; revision=2744
2000-12-04 06:37:46 +00:00
|
|
|
void (*dissect)(const struct ip_tcp_opt *, tvbuff_t *, int, guint,
|
2001-12-10 00:26:21 +00:00
|
|
|
packet_info *, proto_tree *);
|
1999-03-23 03:14:46 +00:00
|
|
|
/* routine to dissect option */
|
|
|
|
} ip_tcp_opt;
|
|
|
|
|
|
|
|
/* Routine to dissect IP or TCP options. */
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
void dissect_ip_tcp_options(tvbuff_t *, int, guint,
|
2001-12-10 00:26:21 +00:00
|
|
|
const ip_tcp_opt *, int, int, packet_info *, proto_tree *);
|
1999-03-23 03:14:46 +00:00
|
|
|
|
2000-04-20 07:05:58 +00:00
|
|
|
/* Dissector table for "ip.proto"; used by IPv6 as well as IPv4 */
|
2000-04-25 08:55:11 +00:00
|
|
|
extern dissector_table_t ip_dissector_table;
|
2000-04-20 07:05:58 +00:00
|
|
|
|
2001-12-29 00:43:55 +00:00
|
|
|
/* Export the DSCP value-string table for other protocols */
|
2001-12-29 22:01:11 +00:00
|
|
|
extern const value_string dscp_vals[];
|
2001-12-29 00:43:55 +00:00
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
#endif
|