Xenomai  3.0.8
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 
33 #define MAX_RT_INET_PROTOCOLS 32
34 
35 /***
36  * transport layer protocol
37  */
38 struct rtinet_protocol {
39  char *name;
40  unsigned short protocol;
41 
42  struct rtsocket *(*dest_socket)(struct rtskb *);
43  void (*rcv_handler)(struct rtskb *);
44  void (*err_handler)(struct rtskb *);
45  int (*init_socket)(struct rtdm_fd *);
46 };
47 
48 
49 extern struct rtinet_protocol *rt_inet_protocols[];
50 
51 #define rt_inet_hashkey(id) (id & (MAX_RT_INET_PROTOCOLS-1))
52 extern void rt_inet_add_protocol(struct rtinet_protocol *prot);
53 extern void rt_inet_del_protocol(struct rtinet_protocol *prot);
54 extern int rt_inet_socket(struct rtdm_fd *fd, int protocol);
55 
56 #endif /* __RTNET_PROTOCOL_H_ */