📄 ip.h
字号:
/* This file is part of sniffer, a packet capture utility and network moniter The author can be contacted at <mistral@stev.org> the lastest version is avilable from http://stev.org 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., 675 Mass Ave, Cambridge, MA 02139, USA.*/#ifndef _SNIFF_IP_H#define _SNIFF_IP_H#include <sys/socket.h>#include "sniff.h"#include "stat.h"#define IP_DF 0x4000#define IP_MF 0x2000#define IP_OFFSET 0x1FFF/* define different ip protocols */#define IP_ICMP 1 /* Internet Control Message Protocol */#define IP_IGMP 2 /* Internet Group Management Protocol */#define IP_IPIP 4 /* IPIP tunnels (older KA9Q tunnels use 94) */#define IP_TCP 6 /* Transmission Control Protocol */#define IP_EGP 8 /* Exterior Gateway Protocol */#define IP_PUP 12 /* PUP protocol */#define IP_UDP 17 /* User Datagram Protocol */#define IP_IDP 22 /* XNS IDP protocol */#define IP_RSVP 46 /* RSVP protocol */#define IP_GRE 47 /* Cisco GRE tunnels (rfc 1701,1702) */#define IP_IPV6 41 /* IPv6-in-IPv4 tunnelling */#define IP_PIM 103 /* Protocol Independent Multicast */#define IP_ESP 50 /* Encapsulation Security Payload protocol */#define IP_AH 51 /* Authentication Header protocol */#define IP_COMP 108 /* Compression Header protocol */struct pkt_ip {#if defined(LITTLE_ENDIAN) unsigned char ihl:4, version:4;#elif defined (BIG_ENDIAN) unsigned char version:4, ihl:4;#else#error "Please define LITTLE_ENDIAN OR BIG_ENDIAN"#endif unsigned char tos; unsigned short tot_len; unsigned short id; unsigned short frag_off; unsigned char ttl; unsigned char protocol; unsigned short check; unsigned long saddr; unsigned long daddr; /*The options start here. */};extern struct gen_stat ip_stat;extern int ip_handle (struct sniff_pkt *pkt, struct pkt_ip *ip);extern inline unsigned short ip_cksum(unsigned short *buff, int len);#endif /* _SNIFF_IP_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -