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