Xenomai  3.1
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 #ifdef __KERNEL__
33 
34 #include <linux/list.h>
35 #include <linux/init.h>
36 #include <linux/ioctl.h>
37 #include <linux/netdevice.h>
38 #include <linux/types.h>
39 
40 /* new extensible interface */
41 struct rtnet_ioctls {
42  /* internal usage only */
43  struct list_head entry;
44  atomic_t ref_count;
45 
46  /* provider specification */
47  const char *service_name;
48  unsigned int ioctl_type;
49  int (*handler)(struct rtnet_device *rtdev, unsigned int request,
50  unsigned long arg);
51 };
52 
53 extern int rtnet_register_ioctls(struct rtnet_ioctls *ioctls);
54 extern void rtnet_unregister_ioctls(struct rtnet_ioctls *ioctls);
55 
56 extern int __init rtnet_chrdev_init(void);
57 extern void rtnet_chrdev_release(void);
58 
59 #else /* ifndef __KERNEL__ */
60 
61 #include <net/if.h> /* IFNAMSIZ */
62 #include <linux/types.h>
63 
64 #endif /* __KERNEL__ */
65 
66 #define RTNET_MINOR 240 /* user interface for /dev/rtnet */
67 #define DEV_ADDR_LEN 32 /* avoids inconsistent MAX_ADDR_LEN */
68 
69 struct rtnet_ioctl_head {
70  char if_name[IFNAMSIZ];
71 };
72 
73 struct rtnet_core_cmd {
74  struct rtnet_ioctl_head head;
75 
76  union {
77  /*** rtifconfig **/
78  struct {
79  __u32 ip_addr;
80  __u32 broadcast_ip;
81  __u32 set_dev_flags;
82  __u32 clear_dev_flags;
83  __u32 dev_addr_type;
84  __u32 __padding;
85  __u8 dev_addr[DEV_ADDR_LEN];
86  } up;
87 
88  struct {
89  __u32 ifindex;
90  __u32 type;
91  __u32 ip_addr;
92  __u32 broadcast_ip;
93  __u32 mtu;
94  __u32 flags;
95  __u8 dev_addr[DEV_ADDR_LEN];
96  } info;
97 
98  __u64 __padding[8];
99  } args;
100 };
101 
102 #define RTNET_IOC_NODEV_PARAM 0x80
103 
104 #define RTNET_IOC_TYPE_CORE 0
105 #define RTNET_IOC_TYPE_RTCFG 1
106 #define RTNET_IOC_TYPE_IPV4 2
107 #define RTNET_IOC_TYPE_RTMAC_NOMAC 100
108 #define RTNET_IOC_TYPE_RTMAC_TDMA 110
109 
110 #define IOC_RT_IFUP _IOW(RTNET_IOC_TYPE_CORE, 0, struct rtnet_core_cmd)
111 #define IOC_RT_IFDOWN _IOW(RTNET_IOC_TYPE_CORE, 1, struct rtnet_core_cmd)
112 #define IOC_RT_IFINFO \
113  _IOWR(RTNET_IOC_TYPE_CORE, 2 | RTNET_IOC_NODEV_PARAM, \
114  struct rtnet_core_cmd)
115 
116 #endif /* __RTNET_CHRDEV_H_ */
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition: atomic.h:24