📄 mps.h
字号:
#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <assert.h>#include <netinet/in.h>#include <linux/socket.h>#include <linux/types.h>#include <arpa/inet.h>#include <linux/if.h>#include <string.h>#include <signal.h>#include <sys/ioctl.h>typedef char Boolean;#define MACHDRSIZE 14#define TRUE 0#define FALSE -1#define SENDTCPSEQ 123456#define IPTOSTR(addr) \ ((unsigned char *)&addr)[0], \ ((unsigned char *)&addr)[1], \ ((unsigned char *)&addr)[2], \ ((unsigned char *)&addr)[3]typedef struct iphdr{ unsigned char h_verlen; unsigned char tos; unsigned short total_len; unsigned short ident; unsigned short frag_and_flags; unsigned char ttl; unsigned char proto; unsigned short checksum; unsigned int sourceIP; unsigned int destIP;} _iphdr;typedef struct st_psdhdr{ unsigned long saddr; unsigned long daddr; char mbz; char ptcl; unsigned short tcpl;} psdhdr; typedef struct tcphdr{ __u16 th_sport; __u16 th_dport; unsigned int th_seq; unsigned int th_ack; unsigned char th_lenres; unsigned char th_flag; __u16 th_win; __u16 th_sum; __u16 th_urp;} _tcphdr; typedef struct udphdr { __u16 sport; __u16 dport; __u16 len; __u16 checksum;} _udphdr;typedef struct icmphdr{ __u8 type; __u8 code; __u16 checksum; __u16 id; __u16 seq;} _icmphdr;static inline void set_signal(int signo, void (*handler)(int)){ struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = (void (*)(int))handler;#ifdef SA_INTERRUPT sa.sa_flags = SA_INTERRUPT;#endif sigaction(signo, &sa, NULL);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -