Xenomai  3.0.8
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 
31 #define ERTCFG_START 0x0F00
32 #define ESTAGE1SIZE ERTCFG_START
33 
34 #define FLAG_STAGE_2_DATA 0x0001
35 #define FLAG_READY 0x0002
36 #define FLAG_ASSIGN_ADDR_BY_MAC 0x0100
37 
38 #define RTCFG_ADDR_MAC 0x00
39 #define RTCFG_ADDR_IP 0x01
40 #define RTCFG_ADDR_MASK 0xFF
41 
42 
43 typedef enum {
44  RTCFG_CMD_SERVER,
45  RTCFG_CMD_ADD,
46  RTCFG_CMD_DEL,
47  RTCFG_CMD_WAIT,
48  RTCFG_CMD_CLIENT,
49  RTCFG_CMD_ANNOUNCE,
50  RTCFG_CMD_READY,
51  RTCFG_CMD_DETACH,
52 
53  /* internal usage only */
54  RTCFG_TIMER,
55  RTCFG_FRM_STAGE_1_CFG,
56  RTCFG_FRM_ANNOUNCE_NEW,
57  RTCFG_FRM_ANNOUNCE_REPLY,
58  RTCFG_FRM_STAGE_2_CFG,
59  RTCFG_FRM_STAGE_2_CFG_FRAG,
60  RTCFG_FRM_ACK_CFG,
61  RTCFG_FRM_READY,
62  RTCFG_FRM_HEARTBEAT,
63  RTCFG_FRM_DEAD_STATION
64 } RTCFG_EVENT;
65 
66 struct rtskb;
67 struct rtcfg_station;
68 struct rtcfg_connection;
69 struct rtcfg_file;
70 
71 struct rtcfg_cmd {
72  struct rtnet_ioctl_head head;
73 
74  union {
75  struct {
76  __u32 period;
77  __u32 burstrate;
78  __u32 heartbeat;
79  __u32 threshold;
80  __u32 flags;
81  } server;
82 
83  struct {
84  __u32 addr_type;
85  __u32 ip_addr;
86  __u8 mac_addr[DEV_ADDR_LEN];
87  __u32 timeout;
88  __u16 stage1_size;
89  __u16 __padding;
90  void *stage1_data;
91  const char *stage2_filename;
92 
93  /* internal usage only */
94  struct rtcfg_connection *conn_buf;
95  struct rtcfg_file *stage2_file;
96  } add;
97 
98  struct {
99  __u32 addr_type;
100  __u32 ip_addr;
101  __u8 mac_addr[DEV_ADDR_LEN];
102 
103  /* internal usage only */
104  struct rtcfg_connection *conn_buf;
105  struct rtcfg_file *stage2_file;
106  } del;
107 
108  struct {
109  __u32 timeout;
110  } wait;
111 
112  struct {
113  __u32 timeout;
114  __u32 max_stations;
115  __u64 buffer_size;
116  void *buffer;
117 
118  /* internal usage only */
119  struct rtcfg_station *station_buf;
120  struct rtskb *rtskb;
121  } client;
122 
123  struct {
124  __u32 timeout;
125  __u32 flags;
126  __u32 burstrate;
127  __u32 __padding;
128  __u64 buffer_size;
129  void *buffer;
130 
131  /* internal usage only */
132  struct rtskb *rtskb;
133  } announce;
134 
135  struct {
136  __u32 timeout;
137  } ready;
138 
139  struct {
140  /* internal usage only */
141  struct rtcfg_connection *conn_buf;
142  struct rtcfg_file *stage2_file;
143  struct rtcfg_station *station_addr_list;
144  struct rtskb *stage2_chain;
145  } detach;
146 
147  __u64 __padding[16];
148  } args;
149 
150  /* internal usage only */
151  union {
152  struct {
153  int ifindex;
154  RTCFG_EVENT event_id;
155  } data;
156 
157  __u64 __padding[2];
158  } internal;
159 };
160 
161 
162 #define RTCFG_IOC_SERVER _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_SERVER, \
163  struct rtcfg_cmd)
164 #define RTCFG_IOC_ADD _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_ADD, \
165  struct rtcfg_cmd)
166 #define RTCFG_IOC_DEL _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_DEL, \
167  struct rtcfg_cmd)
168 #define RTCFG_IOC_WAIT _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_WAIT, \
169  struct rtcfg_cmd)
170 #define RTCFG_IOC_CLIENT _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_CLIENT, \
171  struct rtcfg_cmd)
172 #define RTCFG_IOC_ANNOUNCE _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_ANNOUNCE,\
173  struct rtcfg_cmd)
174 #define RTCFG_IOC_READY _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_READY, \
175  struct rtcfg_cmd)
176 #define RTCFG_IOC_DETACH _IOW(RTNET_IOC_TYPE_RTCFG, RTCFG_CMD_DETACH, \
177  struct rtcfg_cmd)
178 
179 #endif /* __RTCFG_H_ */