xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop.h (revision 0990bc30bb018eab2d35d33f1f635e6ae0ee3ca1)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
545916cd2Sjpk  * Common Development and Distribution License (the "License").
645916cd2Sjpk  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
2161961e0fSrobinson 
227c478bd9Sstevel@tonic-gate /*
2345916cd2Sjpk  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_SNOOP_H
287c478bd9Sstevel@tonic-gate #define	_SNOOP_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SunOS	*/
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include <rpc/types.h>
337c478bd9Sstevel@tonic-gate #include <sys/pfmod.h>
347c478bd9Sstevel@tonic-gate #include <sys/time.h>
357c478bd9Sstevel@tonic-gate #include <sys/types.h>
367c478bd9Sstevel@tonic-gate #include <sys/socket.h>
3745916cd2Sjpk #include <sys/bufmod.h>
387c478bd9Sstevel@tonic-gate #include <net/if.h>
397c478bd9Sstevel@tonic-gate #include <netinet/in.h>
407c478bd9Sstevel@tonic-gate #include <netinet/if_ether.h>
417c478bd9Sstevel@tonic-gate #include <netinet/in_systm.h>
427c478bd9Sstevel@tonic-gate #include <netinet/ip.h>
437c478bd9Sstevel@tonic-gate #include <netinet/ip6.h>
447c478bd9Sstevel@tonic-gate #include <netinet/ip_icmp.h>
457c478bd9Sstevel@tonic-gate #include <netinet/icmp6.h>
467c478bd9Sstevel@tonic-gate #include <net/pppoe.h>
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate #ifdef __cplusplus
497c478bd9Sstevel@tonic-gate extern "C" {
507c478bd9Sstevel@tonic-gate #endif
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate /*
537c478bd9Sstevel@tonic-gate  * Flags to control packet info display
547c478bd9Sstevel@tonic-gate  */
557c478bd9Sstevel@tonic-gate #define	F_NOW		0x00000001	/* display in realtime */
567c478bd9Sstevel@tonic-gate #define	F_SUM		0x00000002	/* display summary line */
577c478bd9Sstevel@tonic-gate #define	F_ALLSUM	0x00000004	/* display all summary lines */
587c478bd9Sstevel@tonic-gate #define	F_DTAIL		0x00000008	/* display detail lines */
597c478bd9Sstevel@tonic-gate #define	F_TIME		0x00000010	/* display time */
607c478bd9Sstevel@tonic-gate #define	F_ATIME		0x00000020	/* display absolute time */
617c478bd9Sstevel@tonic-gate #define	F_RTIME		0x00000040	/* display relative time */
627c478bd9Sstevel@tonic-gate #define	F_DROPS		0x00000080	/* display drops */
637c478bd9Sstevel@tonic-gate #define	F_LEN		0x00000100	/* display pkt length */
647c478bd9Sstevel@tonic-gate #define	F_NUM		0x00000200	/* display pkt number */
657c478bd9Sstevel@tonic-gate #define	F_WHO		0x00000400	/* display src/dst */
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate #define	MAXLINE		(1088)		/* max len of detail line */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #define	MAX_HDRTRAILER	(64)		/* max hdr/trailer packet slack */
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate /*
727c478bd9Sstevel@tonic-gate  * The RPC XID cache structure.
737c478bd9Sstevel@tonic-gate  * When analyzing RPC protocols we
747c478bd9Sstevel@tonic-gate  * have to cache the xid of the RPC
757c478bd9Sstevel@tonic-gate  * request together with the program
767c478bd9Sstevel@tonic-gate  * number, proc, version etc since this
777c478bd9Sstevel@tonic-gate  * information is missing in the reply
787c478bd9Sstevel@tonic-gate  * packet.  Using the xid in the reply
797c478bd9Sstevel@tonic-gate  * we can lookup this previously stashed
807c478bd9Sstevel@tonic-gate  * information in the cache.
817c478bd9Sstevel@tonic-gate  *
827c478bd9Sstevel@tonic-gate  * For RPCSEC_GSS flavor, some special processing is
837c478bd9Sstevel@tonic-gate  * needed for the argument interpretation based on its
847c478bd9Sstevel@tonic-gate  * control procedure and service type.  This information
857c478bd9Sstevel@tonic-gate  * is stored in the cache table during interpretation of
867c478bd9Sstevel@tonic-gate  * the rpc header and will be referenced later when the rpc
877c478bd9Sstevel@tonic-gate  * argument is interpreted.
887c478bd9Sstevel@tonic-gate  */
897c478bd9Sstevel@tonic-gate #define	XID_CACHE_SIZE 256
907c478bd9Sstevel@tonic-gate struct cache_struct {
917c478bd9Sstevel@tonic-gate 	int xid_num;	/* RPC transaction id */
927c478bd9Sstevel@tonic-gate 	int xid_frame;	/* Packet number */
937c478bd9Sstevel@tonic-gate 	int xid_prog;	/* RPC program number */
947c478bd9Sstevel@tonic-gate 	int xid_vers;	/* RPC version number */
957c478bd9Sstevel@tonic-gate 	int xid_proc;	/* RPC procedure number */
967c478bd9Sstevel@tonic-gate 	unsigned int xid_gss_proc; /* control procedure */
977c478bd9Sstevel@tonic-gate 	int xid_gss_service; /* none, integ, priv */
987c478bd9Sstevel@tonic-gate } xid_cache[XID_CACHE_SIZE];
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate /*
1027c478bd9Sstevel@tonic-gate  * The following macros advance the pointer passed to them.  They
1037c478bd9Sstevel@tonic-gate  * assume they are given a char *.
1047c478bd9Sstevel@tonic-gate  */
1057c478bd9Sstevel@tonic-gate #define	GETINT8(v, ptr) { \
1067c478bd9Sstevel@tonic-gate 	(v) = (*(ptr)++); \
1077c478bd9Sstevel@tonic-gate }
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate #define	GETINT16(v, ptr) { \
1107c478bd9Sstevel@tonic-gate 	(v) = *(ptr)++ << 8; \
1117c478bd9Sstevel@tonic-gate 	(v) |= *(ptr)++; \
1127c478bd9Sstevel@tonic-gate }
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate #define	GETINT32(v, ptr) { \
1157c478bd9Sstevel@tonic-gate 	(v) = *(ptr)++ << 8; \
1167c478bd9Sstevel@tonic-gate 	(v) |= *(ptr)++; (v) <<= 8; \
1177c478bd9Sstevel@tonic-gate 	(v) |= *(ptr)++; (v) <<= 8; \
1187c478bd9Sstevel@tonic-gate 	(v) |= *(ptr)++; \
1197c478bd9Sstevel@tonic-gate }
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate /*
1227c478bd9Sstevel@tonic-gate  * Used to print nested protocol layers.  For example, an ip datagram included
1237c478bd9Sstevel@tonic-gate  * in an icmp error, or a PPP packet included in an LCP protocol reject..
1247c478bd9Sstevel@tonic-gate  */
1257c478bd9Sstevel@tonic-gate extern char *prot_nest_prefix;
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate extern char *get_sum_line(void);
1287c478bd9Sstevel@tonic-gate extern char *get_detail_line(int, int);
129605445d5Sdg extern void set_vlan_id(int);
1307c478bd9Sstevel@tonic-gate extern struct timeval prev_time;
13145916cd2Sjpk extern void process_pkt(struct sb_hdr *, char *, int, int);
1327c478bd9Sstevel@tonic-gate extern char *getflag(int, int, char *, char *);
1337c478bd9Sstevel@tonic-gate extern void show_header(char *, char *, int);
1347c478bd9Sstevel@tonic-gate extern void xdr_init(char *, int);
1357c478bd9Sstevel@tonic-gate extern char *get_line(int, int);
1367c478bd9Sstevel@tonic-gate extern int get_line_remain(void);
1377c478bd9Sstevel@tonic-gate extern char getxdr_char(void);
1387c478bd9Sstevel@tonic-gate extern char showxdr_char(char *);
1397c478bd9Sstevel@tonic-gate extern uchar_t getxdr_u_char(void);
1407c478bd9Sstevel@tonic-gate extern uchar_t showxdr_u_char(char *);
1417c478bd9Sstevel@tonic-gate extern short getxdr_short(void);
1427c478bd9Sstevel@tonic-gate extern short showxdr_short(char *);
1437c478bd9Sstevel@tonic-gate extern ushort_t getxdr_u_short(void);
1447c478bd9Sstevel@tonic-gate extern ushort_t showxdr_u_short(char *);
1457c478bd9Sstevel@tonic-gate extern long getxdr_long(void);
1467c478bd9Sstevel@tonic-gate extern long showxdr_long(char *);
1477c478bd9Sstevel@tonic-gate extern ulong_t getxdr_u_long(void);
1487c478bd9Sstevel@tonic-gate extern ulong_t showxdr_u_long(char *);
1497c478bd9Sstevel@tonic-gate extern longlong_t getxdr_longlong(void);
1507c478bd9Sstevel@tonic-gate extern longlong_t showxdr_longlong(char *);
15161961e0fSrobinson extern u_longlong_t getxdr_u_longlong(void);
15261961e0fSrobinson extern u_longlong_t showxdr_u_longlong(char *);
1537c478bd9Sstevel@tonic-gate extern char *getxdr_opaque(char *, int);
1547c478bd9Sstevel@tonic-gate extern char *getxdr_string(char *, int);
1557c478bd9Sstevel@tonic-gate extern char *showxdr_string(int, char *);
1567c478bd9Sstevel@tonic-gate extern char *getxdr_bytes(uint_t *);
1577c478bd9Sstevel@tonic-gate extern void xdr_skip(int);
1587c478bd9Sstevel@tonic-gate extern int getxdr_pos(void);
1597c478bd9Sstevel@tonic-gate extern void setxdr_pos(int);
1607c478bd9Sstevel@tonic-gate extern char *getxdr_context(char *, int);
1617c478bd9Sstevel@tonic-gate extern char *showxdr_context(char *);
1627c478bd9Sstevel@tonic-gate extern enum_t getxdr_enum(void);
1637c478bd9Sstevel@tonic-gate extern void show_space(void);
1647c478bd9Sstevel@tonic-gate extern void show_trailer(void);
1657c478bd9Sstevel@tonic-gate extern char *getxdr_date(void);
1667c478bd9Sstevel@tonic-gate extern char *showxdr_date(char *);
1677c478bd9Sstevel@tonic-gate extern char *getxdr_date_ns(void);
1687c478bd9Sstevel@tonic-gate char *format_time(int64_t sec, uint32_t nsec);
1697c478bd9Sstevel@tonic-gate extern char *showxdr_date_ns(char *);
1707c478bd9Sstevel@tonic-gate extern char *getxdr_hex(int);
1717c478bd9Sstevel@tonic-gate extern char *showxdr_hex(int, char *);
1727c478bd9Sstevel@tonic-gate extern bool_t getxdr_bool(void);
1737c478bd9Sstevel@tonic-gate extern bool_t showxdr_bool(char *);
1747c478bd9Sstevel@tonic-gate extern char *concat_args(char **, int);
1757c478bd9Sstevel@tonic-gate extern int pf_compile(char *, int);
1767c478bd9Sstevel@tonic-gate extern void compile(char *, int);
1777c478bd9Sstevel@tonic-gate extern void load_names(char *);
17845916cd2Sjpk extern void cap_write(struct sb_hdr *, char *, int, int);
1797c478bd9Sstevel@tonic-gate extern void cap_open_read(char *);
1807c478bd9Sstevel@tonic-gate extern void cap_open_write(char *);
1817c478bd9Sstevel@tonic-gate extern void cap_read(int, int, int, void (*)(), int);
1827c478bd9Sstevel@tonic-gate extern void cap_close(void);
1832e3b6467Skcpoon extern boolean_t check_device(char **, int *);
1847c478bd9Sstevel@tonic-gate extern void initdevice(char *, ulong_t, ulong_t, struct timeval *,
1857c478bd9Sstevel@tonic-gate     struct Pf_ext_packetfilt *, int);
1867c478bd9Sstevel@tonic-gate extern void net_read(int, int, void (*)(), int);
1877c478bd9Sstevel@tonic-gate extern void click(int);
1887c478bd9Sstevel@tonic-gate extern void show_pktinfo(int, int, char *, char *, struct timeval *,
1897c478bd9Sstevel@tonic-gate 		struct timeval *, int, int);
1907c478bd9Sstevel@tonic-gate extern void show_line(char *);
1917c478bd9Sstevel@tonic-gate extern char *getxdr_time(void);
1927c478bd9Sstevel@tonic-gate extern char *showxdr_time(char *);
19345916cd2Sjpk extern char *addrtoname(int, const void *);
1947c478bd9Sstevel@tonic-gate extern char *show_string(const char *, int, int);
19545916cd2Sjpk extern void pr_err(const char *, ...);
1967c478bd9Sstevel@tonic-gate extern void check_retransmit(char *, ulong_t);
1977c478bd9Sstevel@tonic-gate extern char *nameof_prog(int);
1987c478bd9Sstevel@tonic-gate extern char *getproto(int);
1997c478bd9Sstevel@tonic-gate extern uint8_t print_ipv6_extensions(int, uint8_t **, uint8_t *, int *, int *);
2007c478bd9Sstevel@tonic-gate extern void protoprint(int, int, ulong_t, int, int, int, char *, int);
2017c478bd9Sstevel@tonic-gate extern char *getportname(int, in_port_t);
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate extern void interpret_arp(int, struct arphdr *, int);
2047c478bd9Sstevel@tonic-gate extern void interpret_bparam(int, int, int, int, int, char *, int);
2057c478bd9Sstevel@tonic-gate extern void interpret_dns(int, int, const uchar_t *, int);
2067c478bd9Sstevel@tonic-gate extern void interpret_mount(int, int, int, int, int, char *, int);
2077c478bd9Sstevel@tonic-gate extern void interpret_nfs(int, int, int, int, int, char *, int);
2087c478bd9Sstevel@tonic-gate extern void interpret_nfs3(int, int, int, int, int, char *, int);
2097c478bd9Sstevel@tonic-gate extern void interpret_nfs4(int, int, int, int, int, char *, int);
2107c478bd9Sstevel@tonic-gate extern void interpret_nfs4_cb(int, int, int, int, int, char *, int);
2117c478bd9Sstevel@tonic-gate extern void interpret_nfs_acl(int, int, int, int, int, char *, int);
2127c478bd9Sstevel@tonic-gate extern void interpret_nis(int, int, int, int, int, char *, int);
2137c478bd9Sstevel@tonic-gate extern void interpret_nisbind(int, int, int, int, int, char *, int);
2147c478bd9Sstevel@tonic-gate extern void interpret_nisp_cb(int, int, int, int, int, char *, int);
2157c478bd9Sstevel@tonic-gate extern void interpret_nisplus(int, int, int, int, int, char *, int);
2167c478bd9Sstevel@tonic-gate extern void interpret_nlm(int, int, int, int, int, char *, int);
2177c478bd9Sstevel@tonic-gate extern void interpret_pmap(int, int, int, int, int, char *, int);
2187c478bd9Sstevel@tonic-gate extern int interpret_reserved(int, int, in_port_t, in_port_t, char *, int);
2197c478bd9Sstevel@tonic-gate extern void interpret_rquota(int, int, int, int, int, char *, int);
2207c478bd9Sstevel@tonic-gate extern void interpret_rstat(int, int, int, int, int, char *, int);
2217c478bd9Sstevel@tonic-gate extern void interpret_solarnet_fw(int, int, int, int, int, char *, int);
2227c478bd9Sstevel@tonic-gate extern void interpret_ldap(int, char *, int, int, int);
2237c478bd9Sstevel@tonic-gate extern void interpret_icmp(int, struct icmp *, int, int);
2247c478bd9Sstevel@tonic-gate extern void interpret_icmpv6(int, icmp6_t *, int, int);
22545916cd2Sjpk extern int interpret_ip(int, const struct ip *, int);
22645916cd2Sjpk extern int interpret_ipv6(int, const ip6_t *, int);
2277c478bd9Sstevel@tonic-gate extern int interpret_ppp(int, uchar_t *, int);
2287c478bd9Sstevel@tonic-gate extern int interpret_pppoe(int, poep_t *, int);
22945916cd2Sjpk struct tcphdr;
23045916cd2Sjpk extern int interpret_tcp(int, struct tcphdr *, int, int);
23145916cd2Sjpk struct udphdr;
23245916cd2Sjpk extern int interpret_udp(int, struct udphdr *, int, int);
23345916cd2Sjpk extern int interpret_esp(int, uint8_t *, int, int);
23445916cd2Sjpk extern int interpret_ah(int, uint8_t *, int, int);
23545916cd2Sjpk struct sctp_hdr;
23645916cd2Sjpk extern void interpret_sctp(int, struct sctp_hdr *, int, int);
23745916cd2Sjpk extern void interpret_mip_cntrlmsg(int, uchar_t *, int);
23845916cd2Sjpk struct dhcp;
23945916cd2Sjpk extern int interpret_dhcp(int, struct dhcp *, int);
24045916cd2Sjpk struct tftphdr;
24145916cd2Sjpk extern int interpret_tftp(int, struct tftphdr *, int);
24245916cd2Sjpk extern int interpret_http(int, char *, int);
24345916cd2Sjpk struct ntpdata;
24445916cd2Sjpk extern int interpret_ntp(int, struct ntpdata *, int);
24545916cd2Sjpk extern void interpret_netbios_ns(int, uchar_t *, int);
24645916cd2Sjpk extern void interpret_netbios_datagram(int, uchar_t *, int);
24745916cd2Sjpk extern void interpret_netbios_ses(int, uchar_t *, int);
24845916cd2Sjpk extern void interpret_slp(int, char *, int);
24945916cd2Sjpk struct rip;
25045916cd2Sjpk extern int interpret_rip(int, struct rip *, int);
25145916cd2Sjpk struct rip6;
25245916cd2Sjpk extern int interpret_rip6(int, struct rip6 *, int);
25345916cd2Sjpk extern int interpret_socks_call(int, char *, int);
25445916cd2Sjpk extern int interpret_socks_reply(int, char *, int);
2557c478bd9Sstevel@tonic-gate extern void init_ldap(void);
2567c478bd9Sstevel@tonic-gate extern boolean_t arp_for_ether(char *, struct ether_addr *);
2577c478bd9Sstevel@tonic-gate extern char *ether_ouiname(uint32_t);
25845916cd2Sjpk extern char *tohex(char *p, int len);
2597c478bd9Sstevel@tonic-gate extern char *printether(struct ether_addr *);
2607c478bd9Sstevel@tonic-gate extern char *print_ethertype(int);
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate /*
2637c478bd9Sstevel@tonic-gate  * Describes characteristics of the Media Access Layer.
2647c478bd9Sstevel@tonic-gate  * The mac_type is one of the supported DLPI media
2657c478bd9Sstevel@tonic-gate  * types (see <sys/dlpi.h>).
2667c478bd9Sstevel@tonic-gate  * The mtu_size is the size of the largest frame.
267605445d5Sdg  * network_type_offset is where the network type
268605445d5Sdg  * is located in the link layer header.
2697c478bd9Sstevel@tonic-gate  * The header length is returned by a function to
2707c478bd9Sstevel@tonic-gate  * allow for variable header size - for ethernet it's
2717c478bd9Sstevel@tonic-gate  * just a constant 14 octets.
2727c478bd9Sstevel@tonic-gate  * The interpreter is the function that "knows" how
2737c478bd9Sstevel@tonic-gate  * to interpret the frame.
274605445d5Sdg  * try_kernel_filter tells snoop to first try a kernel
275605445d5Sdg  * filter (because the header size is fixed, or if it could
276605445d5Sdg  * be of variable size where the variable size is easy for a kernel
277605445d5Sdg  * filter to handle, for example, Ethernet and VLAN tags)
278605445d5Sdg  * and only use a user space filter if the filter expression
279605445d5Sdg  * cannot be expressed in kernel space.
2807c478bd9Sstevel@tonic-gate  */
2817c478bd9Sstevel@tonic-gate typedef struct interface {
2827c478bd9Sstevel@tonic-gate 	uint_t	mac_type;
2837c478bd9Sstevel@tonic-gate 	uint_t	mtu_size;
284605445d5Sdg 	uint_t  network_type_offset;
2857c478bd9Sstevel@tonic-gate 	uint_t	(*header_len)(char *);
2867c478bd9Sstevel@tonic-gate 	uint_t 	(*interpreter)(int, char *, int, int);
287605445d5Sdg 	uint_t	try_kernel_filter;
2887c478bd9Sstevel@tonic-gate } interface_t;
2897c478bd9Sstevel@tonic-gate 
2907c478bd9Sstevel@tonic-gate extern interface_t INTERFACES[], *interface;
2917c478bd9Sstevel@tonic-gate extern char *device;
2927c478bd9Sstevel@tonic-gate 
2937c478bd9Sstevel@tonic-gate extern char *dlc_header;
2947c478bd9Sstevel@tonic-gate 
29545916cd2Sjpk extern char *src_name, *dst_name;
29645916cd2Sjpk 
29745916cd2Sjpk extern char *prot_prefix;
29845916cd2Sjpk extern char *prot_nest_prefix;
29945916cd2Sjpk extern char *prot_title;
30045916cd2Sjpk 
30145916cd2Sjpk /* Keep track of how many nested IP headers we have. */
30245916cd2Sjpk extern unsigned int encap_levels, total_encap_levels;
30345916cd2Sjpk 
30445916cd2Sjpk extern int quitting;
30545916cd2Sjpk 
3067c478bd9Sstevel@tonic-gate /*
3077c478bd9Sstevel@tonic-gate  * Global error recovery routine: used to reset snoop variables after
3087c478bd9Sstevel@tonic-gate  * catastrophic failure.
3097c478bd9Sstevel@tonic-gate  */
3107c478bd9Sstevel@tonic-gate void snoop_recover(void);
3117c478bd9Sstevel@tonic-gate 
3127c478bd9Sstevel@tonic-gate /*
3137c478bd9Sstevel@tonic-gate  * Global alarm handler structure for managing multiple alarms within
3147c478bd9Sstevel@tonic-gate  * snoop.
3157c478bd9Sstevel@tonic-gate  */
3167c478bd9Sstevel@tonic-gate typedef struct snoop_handler {
3177c478bd9Sstevel@tonic-gate 	struct snoop_handler *s_next;		/* next alarm handler */
3187c478bd9Sstevel@tonic-gate 	time_t s_time;				/* time to fire */
3197c478bd9Sstevel@tonic-gate 	void (*s_handler)();			/* alarm handler */
3207c478bd9Sstevel@tonic-gate } snoop_handler_t;
3217c478bd9Sstevel@tonic-gate 
3227c478bd9Sstevel@tonic-gate #define	SNOOP_MAXRECOVER	20	/* maxium number of recoveries */
3237c478bd9Sstevel@tonic-gate #define	SNOOP_ALARM_GRAN	3	/* alarm() timeout multiplier */
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate /*
3267c478bd9Sstevel@tonic-gate  * Global alarm handler management routine.
3277c478bd9Sstevel@tonic-gate  */
3287c478bd9Sstevel@tonic-gate extern int snoop_alarm(int s_sec, void (*s_handler)());
3297c478bd9Sstevel@tonic-gate 
330*0990bc30Sdg /*
331*0990bc30Sdg  * The next two definitions do not take into account the length
332*0990bc30Sdg  * of the underlying link header.  In order to use them, you must
333*0990bc30Sdg  * add link_header_len to them.  The reason it is not done here is
334*0990bc30Sdg  * that later these macros are used to initialize a table.
335*0990bc30Sdg  */
336*0990bc30Sdg #define	IPV4_TYPE_HEADER_OFFSET 9
337*0990bc30Sdg #define	IPV6_TYPE_HEADER_OFFSET 6
338*0990bc30Sdg 
3397c478bd9Sstevel@tonic-gate #ifdef __cplusplus
3407c478bd9Sstevel@tonic-gate }
3417c478bd9Sstevel@tonic-gate #endif
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate #endif	/* _SNOOP_H */
344