1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#ifndef _PROTOCOL_H
25#define _PROTOCOL_H
26
27#include <linux/in6.h>
28#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
29#include <linux/ipv6.h>
30#endif
31
32#define MAX_INET_PROTOS 256
33
34
35
36struct net_protocol {
37 int (*handler)(struct sk_buff *skb);
38 void (*err_handler)(struct sk_buff *skb, u32 info);
39 int (*gso_send_check)(struct sk_buff *skb);
40 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
41 int features);
42 struct sk_buff **(*gro_receive)(struct sk_buff **head,
43 struct sk_buff *skb);
44 int (*gro_complete)(struct sk_buff *skb);
45 unsigned int no_policy:1,
46 netns_ok:1;
47};
48
49#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
50struct inet6_protocol
51{
52 int (*handler)(struct sk_buff *skb);
53
54 void (*err_handler)(struct sk_buff *skb,
55 struct inet6_skb_parm *opt,
56 u8 type, u8 code, int offset,
57 __be32 info);
58
59 int (*gso_send_check)(struct sk_buff *skb);
60 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
61 int features);
62 struct sk_buff **(*gro_receive)(struct sk_buff **head,
63 struct sk_buff *skb);
64 int (*gro_complete)(struct sk_buff *skb);
65
66 unsigned int flags;
67};
68
69#define INET6_PROTO_NOPOLICY 0x1
70#define INET6_PROTO_FINAL 0x2
71
72#define INET6_PROTO_GSO_EXTHDR 0x4
73#endif
74
75
76struct inet_protosw {
77 struct list_head list;
78
79
80 unsigned short type;
81 unsigned short protocol;
82
83 struct proto *prot;
84 const struct proto_ops *ops;
85
86 int capability;
87
88
89
90 char no_check;
91 unsigned char flags;
92};
93#define INET_PROTOSW_REUSE 0x01
94#define INET_PROTOSW_PERMANENT 0x02
95#define INET_PROTOSW_ICSK 0x04
96
97extern const struct net_protocol *inet_protos[MAX_INET_PROTOS];
98
99#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
100extern const struct inet6_protocol *inet6_protos[MAX_INET_PROTOS];
101#endif
102
103extern int inet_add_protocol(const struct net_protocol *prot, unsigned char num);
104extern int inet_del_protocol(const struct net_protocol *prot, unsigned char num);
105extern void inet_register_protosw(struct inet_protosw *p);
106extern void inet_unregister_protosw(struct inet_protosw *p);
107
108#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
109extern int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char num);
110extern int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char num);
111extern int inet6_register_protosw(struct inet_protosw *p);
112extern void inet6_unregister_protosw(struct inet_protosw *p);
113#endif
114
115#endif
116