Xenomai  3.1
rtcfg_chrdev.h
1 /***
2  *
3  * include/rtcfg.h
4  *
5  * Real-Time Configuration Distribution Protocol
6  *
7  * Copyright (C) 2004, 2005 Jan Kiszka <jan.kiszka@web.de>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  */
24 
25 #ifndef __RTCFG_H_
26 #define __RTCFG_H_
27 
28 #include <rtnet_chrdev.h>
29 
30 #define ERTCFG_START 0x0F00
31 #define ESTAGE1SIZE ERTCFG_START
32 
33 #define FLAG_STAGE_2_DATA 0x0001
34 #define FLAG_READY 0x0002
35 #define FLAG_ASSIGN_ADDR_BY_MAC 0x0100
36 
37 #define RTCFG_ADDR_MAC 0x00
38 #define RTCFG_ADDR_IP 0x01
39 #define RTCFG_ADDR_MASK 0xFF
40 
41 typedef enum {
42  RTCFG_CMD_SERVER,
43  RTCFG_CMD_ADD,
44  RTCFG_CMD_DEL,
45  RTCFG_CMD_WAIT,
46  RTCFG_CMD_CLIENT,
47  RTCFG_CMD_ANNOUNCE,
48  RTCFG_CMD_READY,
49  RTCFG_CMD_DETACH,
50 
51  /* internal usage only */
52  RTCFG_TIMER,
53  RTCFG_FRM_STAGE_1_CFG,
54  RTCFG_FRM_ANNOUNCE_NEW,
55  RTCFG_FRM_ANNOUNCE_REPLY,
56  RTCFG_FRM_STAGE_2_CFG,
57  RTCFG_FRM_STAGE_2_CFG_FRAG,
58  RTCFG_FRM_ACK_CFG,
59  RTCFG_FRM_READY,
60  RTCFG_FRM_HEARTBEAT,
61  RTCFG_FRM_DEAD_STATION
62 } RTCFG_EVENT;
63 
64 struct rtskb;
65 struct rtcfg_station;
66 struct rtcfg_connection;
67 struct rtcfg_file;
68 
69 struct rtcfg_cmd {
70  struct rtnet_ioctl_head head;
71 
72  union {
73  struct {
74  __u32 period;
75  __u32 burstrate;
76  __u32 heartbeat;
77  __u32 threshold;
78  __u32 flags;
79  } server;
80 
81  struct {
82  __u32 addr_type;
83  __u32 ip_addr;
84  __u8 mac_addr[DEV_ADDR_LEN];
85  __u32 timeout;
86  __u16 stage1_size;
87  __u16 __padding;
88  void *stage1_data;
89  const char *stage2_filename;
90 
91  /* internal usage only */
92  struct rtcfg_connection *conn_buf;
93  struct rtcfg_file *stage2_file;
94  } add;
95 
96  struct {
97  __u32 addr_type;
98  __u32 ip_addr;
99  __u8 mac_addr[DEV_ADDR_LEN];
100 
101  /* internal usage only */
102  struct rtcfg_connection *conn_buf;
103  struct rtcfg_file *stage2_file;
104  } del;
105 
106  struct {
107  __u32 timeout;
108  } wait;
109 
110  struct {
111  __u32 timeout;
112  __u32 max_stations;
113  __u64 buffer_size;
114  void *buffer;
115 
116  /* internal usage only */
117  struct rtcfg_station *station_buf;
118  struct rtskb *rtskb;
119  } client;
120 
121  struct {
122  __u32 timeout;
123  __u32 flags;
124  __u32 burstrate;
125  __u32 __padding;
126  __u64 buffer_size;
127  void *buffer;
128 
129  /* internal usage only */
130  struct rtskb *rtskb;
131  } announce;
132 
133  struct {
134  __u32 timeout;
135  } ready;
136 
137  struct {
138  /* internal usage only */
139  struct rtcfg_connection *conn_buf;
140  struct rtcfg_file *stage2_file;
141  struct rtcfg_station *station_addr_list;
142  struct rtskb *stage2_chain;
143  } detach;
144 
145  __u64 __padding[16];
146  } args;
147 
148  /* internal usage only */
149  union {
150  struct {
151  int ifindex;
152  RTCFG_EVENT event_id;
153  } data;
154 
155  __u64 __padding[2];
156  } internal;
157 };
158 
159 #define RTCFG_IOC_SERVER \
160  _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_SERVER, struct rtcfg_cmd)
161 #define RTCFG_IOC_ADD \
162  _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_ADD, struct rtcfg_cmd)
163 #define RTCFG_IOC_DEL \
164  _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_DEL, struct rtcfg_cmd)
165 #define RTCFG_IOC_WAIT \
166  _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_WAIT, struct rtcfg_cmd)
167 #define RTCFG_IOC_CLIENT \
168  _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_CLIENT, struct rtcfg_cmd)
169 #define RTCFG_IOC_ANNOUNCE \
170  _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_ANNOUNCE, struct rtcfg_cmd)
171 #define RTCFG_IOC_READY \
172  _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_READY, struct rtcfg_cmd)
173 #define RTCFG_IOC_DETACH \
174  _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_DETACH, struct rtcfg_cmd)
175 
176 #endif /* __RTCFG_H_ */