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 unsigned int no_policy:1,
43 netns_ok:1;
44};
45
46#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
47struct inet6_protocol
48{
49 int (*handler)(struct sk_buff *skb);
50
51 void (*err_handler)(struct sk_buff *skb,
52 struct inet6_skb_parm *opt,
53 int type, int code, int offset,
54 __be32 info);
55
56 int (*gso_send_check)(struct sk_buff *skb);
57 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
58 int features);
59
60 unsigned int flags;
61};
62
63#define INET6_PROTO_NOPOLICY 0x1
64#define INET6_PROTO_FINAL 0x2
65
66#define INET6_PROTO_GSO_EXTHDR 0x4
67#endif
68
69
70struct inet_protosw {
71 struct list_head list;
72
73
74 unsigned short type;
75 unsigned short protocol;
76
77 struct proto *prot;
78 const struct proto_ops *ops;
79
80 int capability;
81
82
83
84 char no_check;
85 unsigned char flags;
86};
87#define INET_PROTOSW_REUSE 0x01
88#define INET_PROTOSW_PERMANENT 0x02
89#define INET_PROTOSW_ICSK 0x04
90
91extern struct net_protocol *inet_protocol_base;
92extern struct net_protocol *inet_protos[MAX_INET_PROTOS];
93
94#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
95extern struct inet6_protocol *inet6_protos[MAX_INET_PROTOS];
96#endif
97
98extern int inet_add_protocol(struct net_protocol *prot, unsigned char num);
99extern int inet_del_protocol(struct net_protocol *prot, unsigned char num);
100extern void inet_register_protosw(struct inet_protosw *p);
101extern void inet_unregister_protosw(struct inet_protosw *p);
102
103#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
104extern int inet6_add_protocol(struct inet6_protocol *prot, unsigned char num);
105extern int inet6_del_protocol(struct inet6_protocol *prot, unsigned char num);
106extern int inet6_register_protosw(struct inet_protosw *p);
107extern void inet6_unregister_protosw(struct inet_protosw *p);
108#endif
109
110#endif
111