1 /*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the protocol dispatcher.
7 *
8 * Version: @(#)protocol.h 1.0.2 05/07/93
9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 *
17 * Changes:
18 * Alan Cox : Added a name field and a frag handler
19 * field for later.
20 * Alan Cox : Cleaned up, and sorted types.
21 */
22
23 #ifndef _PROTOCOL_H
24 #define _PROTOCOL_H
25
26
27 #define MAX_INET_PROTOS 32 /* Must be a power of 2 */
28
29
30 /* This is used to register protocols. */
31 struct inet_protocol {
32 int (*handler)(struct sk_buff *skb, struct device *dev,
33 struct options *opt, __u32 daddr,
34 unsigned short len, __u32 saddr,
35 int redo, struct inet_protocol *protocol);
36 void (*err_handler)(int type, int code, unsigned char *buff,
37 __u32 daddr,
38 __u32 saddr,
39 struct inet_protocol *protocol);
40 struct inet_protocol *next;
41 unsigned char protocol;
42 unsigned char copy:1;
43 void *data;
44 const char *name;
45 };
46
47
48 extern struct inet_protocol *inet_protocol_base;
49 extern struct inet_protocol *inet_protos[MAX_INET_PROTOS];
50
51
52 extern void inet_add_protocol(struct inet_protocol *prot);
53 extern int inet_del_protocol(struct inet_protocol *prot);
54
55
56 #endif /* _PROTOCOL_H */