/*
 * Copyright 1995 Sun Microsystems, Inc. All Rights Reserved
 *
 * ident "@(#)pfldefs.h	3.2 98/08/02 Sun Microsystems"
 *
 */

#include <screen_actions.h>

/* These will be replaced by things in the header files later */

/* Ethernet packet types */

#define ETHERTYPE_ARP		0x0806
#define ETHERTYPE_IP		0x0800

/*
 * Protocols
 */
#define	IPPROTO_IP		0		/* dummy for IP */
#define	IPPROTO_ICMP		1		/* control message protocol */
#define	IPPROTO_IGMP		2		/* group control protocol */
#define	IPPROTO_GGP		3		/* gateway^2 (deprecated) */
#define	IPPROTO_ENCAP		4		/* IP in IP encapsulation */
#define	IPPROTO_TCP		6		/* tcp */
#define	IPPROTO_EGP		8		/* exterior gateway protocol */
#define	IPPROTO_PUP		12		/* pup */
#define	IPPROTO_UDP		17		/* user datagram protocol */
#define	IPPROTO_IDP		22		/* xns idp */
#define	IPPROTO_HELLO		63		/* "hello" routing protocol */
#define	IPPROTO_ND		77		/* UNOFFICIAL net disk proto */
#define	IPPROTO_EON		80		/* ISO clnp */

#define	IPPROTO_RAW		255		/* raw IP packet */
#define	IPPROTO_MAX		256

/* ICMP types */

#define ICMP_REDIRECT		5
#define ICMP_routerDiscovery9	9
#define ICMP_routerDiscovery10	10

/* End of stuff in the header files */

/* The following are normally stored in /etc/services */

#define TCP_ECHO_port		7
#define TCP_DISCARD_port	9
#define TCP_DAYTIME_port	13
#define CHARGEN_port		19
#define TCP_FTPDATA_port	20
#define TCP_FTP_port		21
#define TELNET_port		23
#define SMTP_port		25
#define TIME_port		37
#define DOMAIN_port		53
#define TFTP_port		69
#define WWW_port		80
#define PORTMAP_port		111
#define AUTH_port		113
#define NNTP_port		119
#define NTP_port		123
#define RIP_port		520
#define XWIN_port		6000

#define LASTRESERVED_port	1023
#define ARCHIE_port		1525
#define INGRESLOCK_port		1524
#define NEWS_port		2000
#define NFSD_port		2049
#define LISTEN_port		2766
#define LOCKD_port		4045
#define X_port			6000
#define X1_port			6001

/* End of stuff in /etc/services */

#define TESTBIT1(offset)	@(offset), MATCHMASK_1BIT,  0
#define TESTBIT2(offset)	@(offset), MATCHMASK_1BIT,  1
#define TESTBIT3(offset)	@(offset), MATCHMASK_1BIT,  2
#define TESTBIT4(offset)	@(offset), MATCHMASK_1BIT,  3
#define TESTBIT5(offset)	@(offset), MATCHMASK_1BIT,  4
#define TESTBIT6(offset)	@(offset), MATCHMASK_1BIT,  5
#define TESTBIT7(offset)	@(offset), MATCHMASK_1BIT,  6
#define TESTBIT8(offset)	@(offset), MATCHMASK_1BIT,  7
#define CHAR(offset)		@(offset), MATCHMASK_1BYTE, 0
#define SHORT(offset)		@(offset), MATCHMASK_2BYTE, 0
#define LONG(offset)		@(offset), MATCHMASK_4BYTE, 0
#define TEST48(offset)		@(offset), MATCHMASK_6BYTE, 0

#define IP_type			CHAR(9)
#define IP_srcaddr		LONG(12)
#define IP_dstaddr		LONG(16)

#define IP_HDR_SIZE		(@0, MATCHMASK_4BIT, 0) * 4

#define ICMP_type		CHAR(IP_HDR_SIZE)

#define UDP_srcport		SHORT(IP_HDR_SIZE)
#define UDP_dstport		SHORT(IP_HDR_SIZE + 2)

#define TCP_srcport		SHORT(IP_HDR_SIZE)
#define TCP_dstport		SHORT(IP_HDR_SIZE + 2)
#define TCP_syn			TESTBIT2(IP_HDR_SIZE + 13)
#define TCP_ack			TESTBIT5(IP_HDR_SIZE + 13)

/*
 WARNING...these defs must match those in screen_actions
*/

#define decrypted	#4, 0xffffffffffffffff, 0
#define packet_length	#5, 0x00000000ffffffff, 0
#define boxid		#7, 0x00000000ffffffff, 0

