Xenomai  3.0.8
rtnet_chrdev.h
1 /***
2  *
3  * include/rtnet_chrdev.h
4  *
5  * RTnet - real-time networking subsystem
6  * Copyright (C) 1999 Lineo, Inc
7  * 1999,2002 David A. Schleef <ds@schleef.org>
8  * 2002 Ulrich Marx <marx@fet.uni-hannover.de>
9  * 2003,2004 Jan Kiszka <jan.kiszka@web.de>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  *
25  */
26 
27 #ifndef __RTNET_CHRDEV_H_
28 #define __RTNET_CHRDEV_H_
29 
30 #include <rtdev.h>
31 
32 
33 #ifdef __KERNEL__
34 
35 #include <linux/list.h>
36 #include <linux/init.h>
37 #include <linux/ioctl.h>
38 #include <linux/netdevice.h>
39 #include <linux/types.h>
40 
41 
42 /* new extensible interface */
43 struct rtnet_ioctls {
44  /* internal usage only */
45  struct list_head entry;
46  atomic_t ref_count;
47 
48  /* provider specification */
49  const char *service_name;
50  unsigned int ioctl_type;
51  int (*handler)(struct rtnet_device *rtdev,
52  unsigned int request, unsigned long arg);
53 };
54 
55 extern int rtnet_register_ioctls(struct rtnet_ioctls *ioctls);
56 extern void rtnet_unregister_ioctls(struct rtnet_ioctls *ioctls);
57 
58 extern int __init rtnet_chrdev_init(void);
59 extern void rtnet_chrdev_release(void);
60 
61 #else /* ifndef __KERNEL__ */
62 
63 #include <net/if.h> /* IFNAMSIZ */
64 #include <linux/types.h>
65 
66 #endif /* __KERNEL__ */
67 
68 
69 #define RTNET_MINOR 240 /* user interface for /dev/rtnet */
70 #define DEV_ADDR_LEN 32 /* avoids inconsistent MAX_ADDR_LEN */
71 
72 
73 struct rtnet_ioctl_head {
74  char if_name[IFNAMSIZ];
75 };
76 
77 struct rtnet_core_cmd {
78  struct rtnet_ioctl_head head;
79 
80  union {
81  /*** rtifconfig **/
82  struct {
83  __u32 ip_addr;
84  __u32 broadcast_ip;
85  __u32 set_dev_flags;
86  __u32 clear_dev_flags;
87  __u32 dev_addr_type;
88  __u32 __padding;
89  __u8 dev_addr[DEV_ADDR_LEN];
90  } up;
91 
92  struct {
93  __u32 ifindex;
94  __u32 type;
95  __u32 ip_addr;
96  __u32 broadcast_ip;
97  __u32 mtu;
98  __u32 flags;
99  __u8 dev_addr[DEV_ADDR_LEN];
100  } info;
101 
102  __u64 __padding[8];
103  } args;
104 };
105 
106 
107 #define RTNET_IOC_NODEV_PARAM 0x80
108 
109 #define RTNET_IOC_TYPE_CORE 0
110 #define RTNET_IOC_TYPE_RTCFG 1
111 #define RTNET_IOC_TYPE_IPV4 2
112 #define RTNET_IOC_TYPE_RTMAC_NOMAC 100
113 #define RTNET_IOC_TYPE_RTMAC_TDMA 110
114 
115 #define IOC_RT_IFUP _IOW(RTNET_IOC_TYPE_CORE, 0, \
116  struct rtnet_core_cmd)
117 #define IOC_RT_IFDOWN _IOW(RTNET_IOC_TYPE_CORE, 1, \
118  struct rtnet_core_cmd)
119 #define IOC_RT_IFINFO _IOWR(RTNET_IOC_TYPE_CORE, 2 | \
120  RTNET_IOC_NODEV_PARAM, \
121  struct rtnet_core_cmd)
122 
123 #endif /* __RTNET_CHRDEV_H_ */
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition: atomic.h:24