| 1 | /*	$NetBSD: ipsend.h,v 1.2 2018/04/29 15:59:07 christos Exp $	*/ | 
| 2 |  | 
| 3 | /* | 
| 4 |  * ipsend.h (C) 1997-1998 Darren Reed | 
| 5 |  * | 
| 6 |  * This was written to test what size TCP fragments would get through | 
| 7 |  * various TCP/IP packet filters, as used in IP firewalls.  In certain | 
| 8 |  * conditions, enough of the TCP header is missing for unpredictable | 
| 9 |  * results unless the filter is aware that this can happen. | 
| 10 |  * | 
| 11 |  * The author provides this program as-is, with no gaurantee for its | 
| 12 |  * suitability for any specific purpose.  The author takes no responsibility | 
| 13 |  * for the misuse/abuse of this program and provides it for the sole purpose | 
| 14 |  * of testing packet filter policies.  This file maybe distributed freely | 
| 15 |  * providing it is not modified and that this notice remains in tact. | 
| 16 |  * | 
| 17 |  */ | 
| 18 | #ifndef	__P | 
| 19 | # ifdef	__STDC__ | 
| 20 | #  define	__P(x)	x | 
| 21 | # else | 
| 22 | #  define	__P(x)	() | 
| 23 | # endif | 
| 24 | #endif | 
| 25 |  | 
| 26 | #include <net/if.h> | 
| 27 |  | 
| 28 | #include "ipf.h" | 
| 29 | #ifdef	linux | 
| 30 | #include <linux/sockios.h> | 
| 31 | #endif | 
| 32 | #include <netinet/tcp_timer.h> | 
| 33 | #include <netinet/tcp_var.h> | 
| 34 | #include <netinet/tcpip.h> | 
| 35 | #include "ipt.h" | 
| 36 |  | 
| 37 | extern	int	resolve __P((char *, char *)); | 
| 38 | extern	int	arp __P((char *, char *)); | 
| 39 | extern	u_short	chksum __P((u_short *, int)); | 
| 40 | extern	int	send_ether __P((int, char *, int, struct in_addr)); | 
| 41 | extern	int	send_ip __P((int, int, ip_t *, struct in_addr, int)); | 
| 42 | extern	int	send_tcp __P((int, int, ip_t *, struct in_addr)); | 
| 43 | extern	int	send_udp __P((int, int, ip_t *, struct in_addr)); | 
| 44 | extern	int	send_icmp __P((int, int, ip_t *, struct in_addr)); | 
| 45 | extern	int	send_packet __P((int, int, ip_t *, struct in_addr)); | 
| 46 | extern	int	send_packets __P((char *, int, ip_t *, struct in_addr)); | 
| 47 | extern	u_short	ipseclevel __P((char *)); | 
| 48 | extern	u_32_t	buildopts __P((char *, char *, int)); | 
| 49 | extern	int	addipopt __P((char *, struct ipopt_names *, int, char *)); | 
| 50 | extern	int	initdevice __P((char *, int)); | 
| 51 | extern	int	sendip __P((int, char *, int)); | 
| 52 | #ifdef	linux | 
| 53 | extern	struct	sock	*find_tcp __P((int, struct tcpiphdr *)); | 
| 54 | #else | 
| 55 | extern	struct	tcpcb	*find_tcp __P((int, struct tcpiphdr *)); | 
| 56 | #endif | 
| 57 | extern	int	ip_resend __P((char *, int, struct ipread *, struct in_addr, char *)); | 
| 58 |  | 
| 59 | extern	void	ip_test1 __P((char *, int, ip_t *, struct in_addr, int)); | 
| 60 | extern	void	ip_test2 __P((char *, int, ip_t *, struct in_addr, int)); | 
| 61 | extern	void	ip_test3 __P((char *, int, ip_t *, struct in_addr, int)); | 
| 62 | extern	void	ip_test4 __P((char *, int, ip_t *, struct in_addr, int)); | 
| 63 | extern	void	ip_test5 __P((char *, int, ip_t *, struct in_addr, int)); | 
| 64 | extern	void	ip_test6 __P((char *, int, ip_t *, struct in_addr, int)); | 
| 65 | extern	void	ip_test7 __P((char *, int, ip_t *, struct in_addr, int)); | 
| 66 | extern	int	do_socket __P((char *, int, struct tcpiphdr *, struct in_addr)); | 
| 67 | extern	int	kmemcpy __P((char *, void *, int)); | 
| 68 |  | 
| 69 | #define	KMCPY(a,b,c)	kmemcpy((char *)(a), (void *)(b), (int)(c)) | 
| 70 |  | 
| 71 | #ifndef	OPT_RAW | 
| 72 | #define	OPT_RAW	0x80000 | 
| 73 | #endif | 
| 74 |  |