/*
 * author: Darren Bounds <dbounds@intrusense.com>
 * copyright: Copyright (C) 2002 by Darren Bounds
 * license: This software is under GPL version 2 of license
 *
 * 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
 *
 * packit official page at http://packit.sourceforge.net
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <libnet.h>
#include <pcap.h>
#include <sys/types.h>
#include <net/bpf.h>
#include <signal.h>

#include "config.h"

#define MAX_CMDOPT_LEN           32

#ifndef _PACKIT_HEADERS
#define _PACKIT_HEADERS

#define PACKIT_ARP_H             0x1c    /* ARP header:          28 bytes */
#define PACKIT_DNS_H             0xc     /* DNS header base:     12 bytes */
#define PACKIT_DHCPV4_H          0xf0    /* DHCP v4 header:     240 bytes */
#define PACKIT_ETH_H             0xe     /* Etherner header:     14 bytes */
#define PACKIT_ICMPV4_H          0x4     /* ICMP header base:     4 bytes */
#define PACKIT_ICMPV6_H          0x08    /* ICMP6 header base:    8 bytes */
#define PACKIT_ICMPV4_ECHO_H     0x8     /* ICMP_ECHO header:     8 bytes */
#define PACKIT_ICMPV4_MASK_H     0xc     /* ICMP_MASK header:    12 bytes */
#define PACKIT_ICMPV4_UNREACH_H  0x8     /* ICMP_UNREACH header:  8 bytes */
#define PACKIT_ICMPV4_TIMXCEED_H 0x8     /* ICMP_TIMXCEED header: 8 bytes */
#define PACKIT_ICMPV4_REDIRECT_H 0x8     /* ICMP_REDIRECT header: 8 bytes */
#define PACKIT_ICMPV4_TS_H       0x14    /* ICMP_TIMESTAMP headr:20 bytes */
#define PACKIT_IPV4_H            0x14    /* IP header:           20 bytes */
#define PACKIT_IPV6_H            0x28    /* IPv6 header:         40 bytes */
#define PACKIT_RIP_H	   	 0x18
#define PACKIT_TCP_H             0x14    /* TCP header:          20 bytes */
#define PACKIT_UDP_H             0x8     /* UDP header:           8 bytes */

#ifdef __DARWIN 
#define PACKIT_ETHERTYPE_IP      0x0800
#else
#define PACKIT_ETHERTYPE_IP      0x08
#endif

#endif /* _PACKIT_HEADERS */

int     header_len;
int     layer4;
char 	*device;

void 	print_usage();
void 	enter_packet_foundry(short init_type, unsigned int count);
void    parse_capture_options(int argc, char *argv[]);
void    parse_inject_options(int argc, char *argv[], unsigned short ip_version);
int     start_packet_capture(char *p_filter, unsigned int count);
