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