📄 block.h
字号:
#ifndef _BLOCK_H#define _BLOCK_H#ifdef __cplusplusextern "C" {#endif#include <stdio.h>#include <pthread.h>#include <linux/types.h>#include <syslog.h>#include <sys/ioctl.h>#include <sys/types.h>#include <sys/socket.h>#include <sys/stat.h>#include <string.h>#include <stdlib.h>#include <errno.h>#include <unistd.h>#include <fcntl.h>#include <signal.h>#include <net/ethernet.h>#include <net/if_arp.h>#include <linux/ppp_defs.h>#include <net/if.h>#include <sys/ioctl.h>#include <netinet/ip.h>#include <netinet/tcp.h>#include <netinet/udp.h>#define udpLen 48/*// __BIG_ENDIANstruct rtp_g723{ u_int16_t ver:2; u_int16_t pad:1; u_int16_t ext:1; u_int16_t csrc_count:4; u_int16_t mark:1; u_int16_t payload:7; u_int16_t seq; u_int32_t stamp; u_int32_t ssrc;};*///__LITTLE_ENDIANstruct rtp_g723{ u_int16_t csrc_count:4; u_int16_t ext:1; u_int16_t pad:1; u_int16_t ver:2; u_int16_t payload:7; u_int16_t mark:1; u_int16_t seq; u_int32_t stamp; u_int32_t ssrc;};typedef struct PPPoE_PacketStruct { struct ethhdr ethHdr; /* Ethernet header */ unsigned int ver:4; /* PPPoE Version (must be 1) */ unsigned int type:4; /* PPPoE Type (must be 1) */ u_char code; /* PPPoE code */ u_short session; /* PPPoE session */ u_short length; /* Payload length */ u_short p_proto;} PPPoE_Packet;struct pseudo_hdr { /* See RFC 793 Pseudo Header */ u_long saddr, daddr;/* source and dest address */ u_char mbz, ptcl; /* zero and protocol */ u_short tcpl; /* tcp length */};struct cksum { struct pseudo_hdr pseudo; struct tcphdr tcp;};struct cksum_udp { struct pseudo_hdr pseudo; struct udphdr udp; struct rtp_g723 rtp; u_char data[udpLen];};inline u_short in_cksum(u_short *addr, int len);static void InitTcp();void MakeTcp();void MakePoe();int BlockPoeTcp();int BlockEthTcp();#ifdef __cplusplus}#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -