📄 kernelenv.h
字号:
/* socket.h */#define AF_INET 2 /* Internet IP Protocol */#define PF_INET AF_INET#define NPROTO 3/* stat.h */#define S_IFMT 00170000#define S_IFSOCK 0140000#define S_IFLNK 0120000#define S_IFREG 0100000#define S_IFBLK 0060000#define S_IFDIR 0040000#define S_IFCHR 0020000#define S_IFIFO 0010000#define S_ISUID 0004000#define S_ISGID 0002000#define S_ISVTX 0001000#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)#define S_IRWXU 00700#define S_IRUSR 00400#define S_IWUSR 00200#define S_IXUSR 00100#define S_IRWXG 00070#define S_IRGRP 00040#define S_IWGRP 00020#define S_IXGRP 00010#define S_IRWXO 00007#define S_IROTH 00004#define S_IWOTH 00002#define S_IXOTH 00001#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)#define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)#define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)#define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)#define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)/* if.h */#define IFNAMSIZ 16#define PACKET_HOST 0 /* To us */#define PACKET_BROADCAST 1 /* To all */#define PACKET_MULTICAST 2 /* To group */#define PACKET_OTHERHOST 3 /* To someone else */#define PACKET_OUTGOING 4 /* Outgoing of any type *//* These ones are invisible by user level */#define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */#define PACKET_FASTROUTE 6 /* if_ether.h */#define ETH_ALEN 6 /* Octets in one ethernet addr */#define ETH_HLEN 14 /* Total octets in header. */#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */#define ETH_DATA_LEN 1500 /* Max. octets in payload */#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */#define ETH_P_IP 0x0800 /* Internet Protocol packet */struct ethhdr { unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ unsigned char h_source[ETH_ALEN]; /* source ether addr */ unsigned short h_proto; /* packet type ID field */};/* netdevice.h */struct net_device_stats { unsigned long rx_packets; unsigned long tx_packets; unsigned long rx_dropped; unsigned long tx_dropped; unsigned long rx_errors; unsigned long tx_errors; unsigned long rx_bytes; unsigned long tx_bytes;};struct net_device { struct list_head entry; char name[IFNAMSIZ]; int ifindex; /* external protocol data for this interface */ void *ip_ptr; /* private pointer for the device to play with */ void *priv; /* hardware header length (?) */ unsigned short hard_header_len; struct net_device_stats stats; unsigned int mtu;};#define dev_hold(x)#define dev_put(x)#define HH_DATA_MOD 16#define LL_RESERVED_SPACE(dev) \ (((dev)->hard_header_len&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)extern struct net_device *__dev_get_by_name(const char *name);/* skbuff */#define CHECKSUM_NONE 0#define CHECKSUM_HW 1#define CHECKSUM_UNNECESSARY 2struct sk_buff { struct net_device *dev; unsigned int seq; struct sock *sk; int (*destructor)(struct sk_buff *); union { struct ethhdr *ethernet; unsigned char *raw; } mac; union { struct iphdr *iph; struct ipv6hdr *ipv6h; struct arphdr *arph; unsigned char *raw; } nh; union { struct tcphdr *th; struct udphdr *uh; struct icmphdr *icmph; struct igmphdr *igmph; struct iphdr *ipiph; unsigned char *raw; } h; unsigned short protocol; struct dst_entry *dst; unsigned char local_df, pkt_type; __u32 priority; unsigned int len, data_len, mac_len, csum; atomic_t users; unsigned char ip_summed, cloned; unsigned long nfmark; __u32 nfcache; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) struct nf_ct_info *nfct;#else struct nf_conntrack *nfct;#endif __u32 nfctinfo; unsigned int nf_debug; char cb[40]; unsigned char *head, /* beginning of buffer */ *data, /* beginning of interesting data */ *tail, /* end of interesting data */ *end; /* end of buffer */};struct sk_buff_head { /* These two members must be first. */ struct sk_buff *next; struct sk_buff *prev; __u32 qlen; spinlock_t lock;};struct skb_shared_info { unsigned int tso_size;};/* net/protocol.h */struct net_protocol { int (*handler)(struct sk_buff *skb); void (*err_handler)(struct sk_buff *skb, u32 info); int no_policy;};#define inet_protocol net_protocol/* forward reference */struct hh_cache;int skb_cloned(const struct sk_buff *skb);int skb_shared(const struct sk_buff *skb);struct nf_conntrack { atomic_t use; void (*destroy)(struct nf_conntrack *);};struct nf_ct_info { struct nf_conntrack *master;};#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)void nf_conntrack_put(struct nf_ct_info *nfct);void nf_conntrack_get(struct nf_ct_info *nfct);extern void (*ip_ct_attach)(struct sk_buff *, struct nf_ct_info *);#elsevoid nf_conntrack_put(struct nf_conntrack *nfct);void nf_conntrack_get(struct nf_conntrack *nfct);extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);#endif /* 2.6.9 */void nf_reset(struct sk_buff *skb);void nf_reset_debug(struct sk_buff *skb);extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);struct sk_buff *alloc_skb(unsigned int size, int priority);void kfree_skb(struct sk_buff *skb);unsigned int skb_headroom(const struct sk_buff *skb);unsigned int skb_tailroom(const struct sk_buff *skb);unsigned char *skb_put(struct sk_buff *skb, unsigned int len);unsigned char *skb_push(struct sk_buff *skb, unsigned int len);unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);extern unsigned int skb_cow(struct sk_buff *skb, unsigned int headroom);int pskb_may_pull(struct sk_buff *skb, unsigned int len);#define __skb_put skb_put#define __skb_push skb_pushvoid __skb_trim(struct sk_buff *skb, unsigned int len);void skb_trim(struct sk_buff *skb, unsigned int len);#define SKB_LINEAR_ASSERT(x)void skb_reserve(struct sk_buff *skb, unsigned int len);void copy_skb_header(struct sk_buff *new, const struct sk_buff *old);int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len);struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom, int newtailroom, int gfp_mask);void skb_orphan(struct sk_buff *skb);int skb_is_nonlinear(const struct sk_buff *skb);extern int skb_linearize(struct sk_buff *skb, int gfp);#define skb_copy(skb, gfp) \ skb_copy_expand(skb, skb_headroom(skb), skb_tailroom(skb), gfp)#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)extern int skb_checksum_help(struct sk_buff *skb);#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)extern int skb_checksum_help(struct sk_buff **pskb, int inward);#elseextern int skb_checksum_help(struct sk_buff *skb, int inward);#endifextern struct skb_shared_info *skb_shinfo(struct sk_buff *skb);void *skb_header_pointer(const struct sk_buff *skb, int offset, int len, void *buffer);/* net/sock.h */#define sk_for_each(__sk, node, list) \ hlist_for_each_entry(__sk, node, list, sk_node)struct proto { char name[32];};struct sock_common { unsigned short skc_family; volatile unsigned char skc_state; unsigned char skc_reuse; int skc_bound_dev_if; struct hlist_node skc_node; struct hlist_node skc_bind_node; atomic_t skc_refcnt;};/* LOG wants to log UID... sk_socket pointer is NULL, but needs to compile */struct socket_file_dummy{ unsigned int f_uid;};struct socket{ struct socket_file_dummy *file;};struct sock {#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) atomic_t sk_refcnt; __u32 rcv_saddr; __u32 daddr; __u16 sport, dport; struct proto *prot; int bound_dev_if; #else struct sock_common __sk_common;#define sk_family __sk_common.skc_family#define sk_state __sk_common.skc_state#define sk_reuse __sk_common.skc_reuse#define sk_bound_dev_if __sk_common.skc_bound_dev_if#define sk_node __sk_common.skc_node#define sk_bind_node __sk_common.skc_bind_node#define sk_refcnt __sk_common.skc_refcnt rwlock_t sk_callback_lock; struct socket *sk_socket; struct proto *sk_prot;#endif unsigned short sk_type; void (*sk_data_ready)(struct sock *sk, int bytes);};void sock_hold(struct sock *sk);void sock_put(struct sock *sk);void skb_set_owner_w(struct sk_buff *skb, struct sock *sk);struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, unsigned int headroom);int skb_ip_make_writable(struct sk_buff **pskb, unsigned int writable_len);/* netfilter.c's version: unused. */int __unused_skb_ip_make_writable(struct sk_buff **, unsigned int);/* net.h */#define net_ratelimit() 1/* in.h */struct in_addr { __u32 s_addr;};typedef unsigned short sa_family_t;#define __SOCK_SIZE__ 16 struct sockaddr_in { sa_family_t sin_family; /* Address family */ unsigned short int sin_port; /* Port number */ struct in_addr sin_addr; /* Internet address */ /* Pad to size of `struct sockaddr'. */ unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) - sizeof(unsigned short int) - sizeof(struct in_addr)];};#define INADDR_ANY 0#define INADDR_BROADCAST 0xffffffff/* route.h */#define RTO_CONN 0#define ip_rt_put(rt)/* notifier.h */struct notifier_block{ int (*notifier_call)(struct notifier_block *self, unsigned long, void *); struct notifier_block *next; int priority;};int notifier_chain_register(struct notifier_block **list, struct notifier_block *n);int notifier_chain_unregister(struct notifier_block **nl, struct notifier_block *n);int notifier_call_chain(struct notifier_block **n, unsigned long val, void *v);#define NOTIFY_DONE 0x0000 /* Don't care */#define NOTIFY_OK 0x0001 /* Suits me */#define NOTIFY_STOP_MASK 0x8000 /* Don't call further */#define NOTIFY_BAD (NOTIFY_STOP_MASK|0x0002) /* Bad/Veto action */#define NETDEV_UP 0x0001 /* For now you can't veto a device up/down */#define NETDEV_DOWN 0x0002#define NETDEV_REBOOT 0x0003 /* Tell a protocol stack a network interface detected a hardware crash and restarted - we can use this eg to kick tcp sessions once done */#define NETDEV_CHANGE 0x0004 /* Notify device state change */#define NETDEV_REGISTER 0x0005#define NETDEV_UNREGISTER 0x0006
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -