ipsend.h revision 145510
11541Srgrimes/*	$NetBSD$	*/
21541Srgrimes
31541Srgrimes/*
41541Srgrimes * ipsend.h (C) 1997-1998 Darren Reed
51541Srgrimes *
61541Srgrimes * This was written to test what size TCP fragments would get through
71541Srgrimes * various TCP/IP packet filters, as used in IP firewalls.  In certain
81541Srgrimes * conditions, enough of the TCP header is missing for unpredictable
91541Srgrimes * results unless the filter is aware that this can happen.
101541Srgrimes *
111541Srgrimes * The author provides this program as-is, with no gaurantee for its
121541Srgrimes * suitability for any specific purpose.  The author takes no responsibility
131541Srgrimes * for the misuse/abuse of this program and provides it for the sole purpose
141541Srgrimes * of testing packet filter policies.  This file maybe distributed freely
151541Srgrimes * providing it is not modified and that this notice remains in tact.
161541Srgrimes *
171541Srgrimes */
181541Srgrimes#ifndef	__P
191541Srgrimes# ifdef	__STDC__
201541Srgrimes#  define	__P(x)	x
211541Srgrimes# else
221541Srgrimes#  define	__P(x)	()
231541Srgrimes# endif
241541Srgrimes#endif
251541Srgrimes
261541Srgrimes#include <net/if.h>
271541Srgrimes
281541Srgrimes#include "ipf.h"
291541Srgrimes#ifdef	linux
301541Srgrimes#include <linux/sockios.h>
311541Srgrimes#endif
321541Srgrimes#include "tcpip.h"
331541Srgrimes#include "ipt.h"
3444078Sdfr
351541Srgrimesextern	int	resolve __P((char *, char *));
361541Srgrimesextern	int	arp __P((char *, char *));
371541Srgrimesextern	u_short	chksum __P((u_short *, int));
381541Srgrimesextern	int	send_ether __P((int, char *, int, struct in_addr));
391541Srgrimesextern	int	send_ip __P((int, int, ip_t *, struct in_addr, int));
401541Srgrimesextern	int	send_tcp __P((int, int, ip_t *, struct in_addr));
411541Srgrimesextern	int	send_udp __P((int, int, ip_t *, struct in_addr));
421541Srgrimesextern	int	send_icmp __P((int, int, ip_t *, struct in_addr));
4332350Seivindextern	int	send_packet __P((int, int, ip_t *, struct in_addr));
4441793Sluigiextern	int	send_packets __P((char *, int, ip_t *, struct in_addr));
4532350Seivindextern	u_short	ipseclevel __P((char *));
461541Srgrimesextern	u_32_t	buildopts __P((char *, char *, int));
4712693Sphkextern	int	addipopt __P((char *, struct ipopt_names *, int, char *));
4844078Sdfrextern	int	initdevice __P((char *, int));
4912693Sphkextern	int	sendip __P((int, char *, int));
501541Srgrimes#ifdef	linux
5112693Sphkextern	struct	sock	*find_tcp __P((int, struct tcpiphdr *));
521541Srgrimes#else
5318892Sbdeextern	struct	tcpcb	*find_tcp __P((int, struct tcpiphdr *));
541541Srgrimes#endif
551541Srgrimesextern	int	ip_resend __P((char *, int, struct ipread *, struct in_addr, char *));
561541Srgrimes
571541Srgrimesextern	void	ip_test1 __P((char *, int, ip_t *, struct in_addr, int));
581541Srgrimesextern	void	ip_test2 __P((char *, int, ip_t *, struct in_addr, int));
598426Swollmanextern	void	ip_test3 __P((char *, int, ip_t *, struct in_addr, int));
601541Srgrimesextern	void	ip_test4 __P((char *, int, ip_t *, struct in_addr, int));
611541Srgrimesextern	void	ip_test5 __P((char *, int, ip_t *, struct in_addr, int));
621541Srgrimesextern	void	ip_test6 __P((char *, int, ip_t *, struct in_addr, int));
631541Srgrimesextern	void	ip_test7 __P((char *, int, ip_t *, struct in_addr, int));
641541Srgrimesextern	int	do_socket __P((char *, int, struct tcpiphdr *, struct in_addr));
651541Srgrimesextern	int	kmemcpy __P((char *, void *, int));
661541Srgrimes
671541Srgrimes#define	KMCPY(a,b,c)	kmemcpy((char *)(a), (void *)(b), (int)(c))
6844078Sdfr
6912942Swollman#ifndef	OPT_RAW
701541Srgrimes#define	OPT_RAW	0x80000
7112693Sphk#endif
7212942Swollman