(1)获取网络接口名字和掩码等信息
(2)捕获数据包(单个数据包和多个数据包两种情况)
(3)以太网数据报捕获
(4)ARP数据包捕获
(5)IP数据包捕获
(6)TCP数据包捕获
(7)UDP数据包捕获
(8)ICMP数据包捕获
环境fedora13,vim,gcc
#include<stdio.h>
#include<string.h>
#include<pcap.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<netinet/if_ether.h>
#include<netinet/ip.h>
#include<netinet/udp.h>
#include<netinet/tcp.h>
#include<netinet/ip_icmp.h>
#define max 1024
/*
typedef u_int32_t int_addr_t;
struct in_addr
{
int_addr_t s_addr;
};*/
int call(u_char *argument,const struct pcap_pkthdr* pack,const u_char *content)
{
int m=0,n;
const u_char *buf,*iphead;
u_char *p;
struct ether_header *ethernet;
struct iphdr *ip;
struct tcphdr *tcp;
struct udphdr *udp;
struct icmphdr *icmp;
buf=content;
printf("==================================================\n");
printf("The Frame is \n");
w