Xenomai  3.1
protocol.h
1 /***
2  *
3  * include/ipv4/protocol.h
4  *
5  * RTnet - real-time networking subsystem
6  * Copyright (C) 1999, 2000 Zentropic Computing, LLC
7  * 2002 Ulrich Marx <marx@kammer.uni-hannover.de>
8  * 2004, 2005 Jan Kiszka <jan.kiszka@web.de>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  *
24  */
25 
26 #ifndef __RTNET_PROTOCOL_H_
27 #define __RTNET_PROTOCOL_H_
28 
29 #include <rtnet_socket.h>
30 #include <rtskb.h>
31 
32 #define MAX_RT_INET_PROTOCOLS 32
33 
34 /***
35  * transport layer protocol
36  */
37 struct rtinet_protocol {
38  char *name;
39  unsigned short protocol;
40 
41  struct rtsocket *(*dest_socket)(struct rtskb *);
42  void (*rcv_handler)(struct rtskb *);
43  void (*err_handler)(struct rtskb *);
44  int (*init_socket)(struct rtdm_fd *);
45 };
46 
47 extern struct rtinet_protocol *rt_inet_protocols[];
48 
49 #define rt_inet_hashkey(id) (id & (MAX_RT_INET_PROTOCOLS - 1))
50 extern void rt_inet_add_protocol(struct rtinet_protocol *prot);
51 extern void rt_inet_del_protocol(struct rtinet_protocol *prot);
52 extern int rt_inet_socket(struct rtdm_fd *fd, int protocol);
53 
54 #endif /* __RTNET_PROTOCOL_H_ */