-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefine.h
296 lines (266 loc) · 10.3 KB
/
define.h
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
#ifndef _CWMPACS_CWMP_DEFINE_H_
#define _CWMPACS_CWMP_DEFINE_H_
#define CWMP_VERSION_1_1 0x00010001
#define CWMP_VERSION_1_2 0x00010002
#define CWMP_MAX_ENVELOPES 1
#define CWMP_CPE_UNIQUE_MODE_OUI_SERIAL 0
#define CWMP_CPE_UNIQUE_MODE_OUI_PRODUCT_SERIAL 1
#define MAX_CPE_OUI_SIZE 32
#define MAX_CPE_PRODCLASS_SIZE 64
#define MAX_CPE_SERIALNUM_SIZE 64
#define MAX_CPE_MANUFACTURER_SIZE 64
typedef struct _CACpe {
char tag[32];
int id;
char oui[MAX_CPE_OUI_SIZE];
char serial_number[MAX_CPE_SERIALNUM_SIZE];
char manufacturer[MAX_CPE_MANUFACTURER_SIZE];
char product_class[MAX_CPE_PRODCLASS_SIZE];
int unique_mode;
} CACpe;
#define CPE_FMT "cpe(%s-%s) "
#define CPE_PARAMS(cpe) (cpe)->oui, (cpe)->serial_number
typedef enum {
CWMP_MSG_NONE = 0,
CWMP_MSG_FAULT,
CWMP_MSG_GET_RPCMETHODS_REQ,
CWMP_MSG_GET_RPCMETHODS_RSP,
CWMP_MSG_EMPTY_REQ,
CWMP_MSG_EMPTY_RSP,
CWMP_MSG_INFROM_REQ,
CWMP_MSG_INFROM_RSP,
CWMP_MSG_TRANSFER_COMPLETE_REQ,
CWMP_MSG_TRANSFER_COMPLETE_RSP,
CWMP_MSG_AUTONOMOUS_TRANSFER_COMPLETE_REQ,
CWMP_MSG_AUTONOMOUS_TRANSFER_COMPLETE_RSP,
CWMP_MSG_DUSTATE_CHANGE_COMPLETE_REQ,
CWMP_MSG_DUSTATE_CHANGE_COMPLETE_RSP,
CWMP_MSG_AUTONOMOUS_DUSTATE_CHANGE_COMPLETE_REQ,
CWMP_MSG_AUTONOMOUS_DUSTATE_CHANGE_COMPLETE_RSP,
CWMP_MSG_REQUEST_DOWNLOAD_REQ,
CWMP_MSG_REQUEST_DOWNLOAD_RSP,
CWMP_MSG_KICKED_REQ,
CWMP_MSG_KICKED_RSP,
CWMP_MSG_SET_PARAM_VALUES_REQ,
CWMP_MSG_SET_PARAM_VALUES_RSP,
CWMP_MSG_GET_PARAM_VALUES_REQ,
CWMP_MSG_GET_PARAM_VALUES_RSP,
CWMP_MSG_GET_PARAM_NAMES_REQ,
CWMP_MSG_GET_PARAM_NAMES_RSP,
CWMP_MSG_SET_PARAM_ATTRIBUTES_REQ,
CWMP_MSG_SET_PARAM_ATTRIBUTES_RSP,
CWMP_MSG_GET_PARAM_ATTRIBUTES_REQ,
CWMP_MSG_GET_PARAM_ATTRIBUTES_RSP,
CWMP_MSG_ADD_OBJECT_REQ,
CWMP_MSG_ADD_OBJECT_RSP,
CWMP_MSG_DELETE_OBJECT_REQ,
CWMP_MSG_DELETE_OBJECT_RSP,
CWMP_MSG_REBOOT_REQ,
CWMP_MSG_REBOOT_RSP,
CWMP_MSG_DOWNLOAD_REQ,
CWMP_MSG_DOWNLOAD_RSP,
CWMP_MSG_SCHEDULE_DOWNLOAD_REQ,
CWMP_MSG_SCHEDULE_DOWNLOAD_RSP,
CWMP_MSG_UPLOAD_REQ,
CWMP_MSG_UPLOAD_RSP,
CWMP_MSG_FACTORY_RESET_REQ,
CWMP_MSG_FACTORY_RESET_RSP,
CWMP_MSG_GET_QUEUED_TRANSFERS_REQ,
CWMP_MSG_GET_QUEUED_TRANSFERS_RSP,
CWMP_MSG_GET_ALL_QUEUED_TRANSFERS_REQ,
CWMP_MSG_GET_ALL_QUEUED_TRANSFERS_RSP,
CWMP_MSG_CANCEL_TRANSFERS_REQ,
CWMP_MSG_CANCEL_TRANSFERS_RSP,
CWMP_MSG_SCHEDULE_INFORM_REQ,
CWMP_MSG_SCHEDULE_INFORM_RSP,
CWMP_MSG_CHANGE_DUSTATE_REQ,
CWMP_MSG_CHANGE_DUSTATE_RSP,
CWMP_MSG_MAX,
} CACwmpMsgType;
static char _CWMP_MSG_TYPE_STRING[CWMP_MSG_MAX][100] = {
"none",
"Fault",
"GetRpcMethods",
"GetRpcMethodsResponse",
// CPE >> ACS
"Empty",
"EmptyResponse",
"Inform",
"InformResponse",
"TransferComplete",
"TransferCompleteResponse",
"AutonomousTransferComplete",
"AutonomousTransferCompleteResponse",
"DUStateChangeComplete",
"DUStateChangeCompleteResponse",
"AutonomousDUStateChangeComplete",
"AutonomousDUStateChangeCompleteResponse",
"RequestDownload",
"RequestDownloadResponse",
"Kicked",
"KickedResponse",
// ACS >> CPE
"SetParameterValues",
"SetParameterValuesResponse",
"GetParameterValues",
"GetParameterValuesResponse",
"GetParameterNames",
"GetParameterNamesResponse",
"SetParameterAttributes",
"SetParameterAttributesResponse",
"GetParameterAttributes",
"GetParameterAttributesResponse",
"AddObject",
"AddObjectResponse",
"DeleteObject",
"DeleteObjectResponse",
"Reboot",
"RebootResponse",
"Download",
"DownloadResponse",
"ScheduleDownload",
"ScheduleDownloadResponse",
"Upload",
"UploadResponse",
"FactoryReset",
"FactoryResetResponse",
"GetQueuedTransfers",
"GetQueuedTransfersResponse",
"GetAllQueuedTransfers",
"GetAllQueuedTransfersResponse",
"CancelTransfer",
"CancelTransferResponse",
"ScheduleInform",
"ScheduleInformResponse",
"ChangeDUState",
"ChangeDUStateResponse",
};
#define CWMP_MSG_TYPE_STRING(x) _CWMP_MSG_TYPE_STRING[x]
#define MAX_PARAM_NAME_SIZE 256
#define MAX_PARAM_VALUE_SIZE 1024
#define SOAP_FAULT_CODE_SERVER "Server"
#define SOAP_FAULT_STRING_CWMP "CWMP fault"
#define CWMP_RPC_METHOD_SUPPORT_NUM 8
static char *CWMP_RPC_METHOD_SUPPORT_LIST[CWMP_RPC_METHOD_SUPPORT_NUM] = {
"GetRPCMethods",
"Inform",
"TransferComplete",
"AutonomousTransferComplete",
"DuStateChangeComplete",
"AutonomousDuStateChangeComplete",
"RequestDownload",
"Kicked",
};
#define CWMP_CPE_FAULT_9000_CODE 9000 // "Method not supported"
#define CWMP_CPE_FAULT_9001_CODE 9001 // "Request denied (no reason specified)"
#define CWMP_CPE_FAULT_9002_CODE 9002 // "Internal error"
#define CWMP_CPE_FAULT_9003_CODE 9003 // "Invalid arguments"
#define CWMP_CPE_FAULT_9004_CODE 9004 // "Resources exceeded (when used in association with SetParameterValues, this MUST not be used to indicate parameters in error)"
#define CWMP_CPE_FAULT_9005_CODE 9005 // "Invalid parameter name (associated with Set/GetParameterValues, GetParameterNames, Set/GetParameterAttributes)"
#define CWMP_CPE_FAULT_9006_CODE 9006 // "Invalid parameter type (associated with SetParameterValues)"
#define CWMP_CPE_FAULT_9007_CODE 9007 // "Invalid parameter value (associated with SetParameterValues)"
#define CWMP_CPE_FAULT_9008_CODE 9008 // "Attempt to set a non-writable parameter (associated with SetParameterValues)"
#define CWMP_CPE_FAULT_9009_CODE 9009 // "Notification request rejected (associated with SetParameterAttributes method)."
#define CWMP_CPE_FAULT_9010_CODE 9010 // "Download failure (associated with Download or TransferComplete methods)."
#define CWMP_CPE_FAULT_9011_CODE 9011 // "Upload failure (associated with Upload or TransferComplete methods)."
#define CWMP_CPE_FAULT_9012_CODE 9012 // "File transfer server authentication failure (associated with Upload, Download, or TransferComplete methods)."
#define CWMP_CPE_FAULT_9013_CODE 9013 // "Unsupported protocol for file transfer (associated with Upload and Download methods)."
#define CWMP_CPE_FAULT_9014_CODE 9014 // "Download failure: unable to join multicast group"
#define CWMP_CPE_FAULT_9015_CODE 9015 // "Download failure: unable to contact file"
#define CWMP_CPE_FAULT_9016_CODE 9016 // "Download failure: unable to access file"
#define CWMP_CPE_FAULT_9017_CODE 9017 // "Download failure: unable to complete download"
#define CWMP_CPE_FAULT_9018_CODE 9018 // "Download failure: file corrupted"
#define CWMP_CPE_FAULT_9019_CODE 9019 // "Download failure: file authentication failure"
#define CWMP_CPE_FAULT_98XX_CODE(x) (9800+x) // "Vendor defined fault codes"
static char _CWMP_CPE_FAULT_STRING[20][128] = {
"Method not supported",
"Request denied (no reason specified)",
"Internal error",
"Invalid arguments",
"Resources exceeded (when used in association with SetParameterValues, this MUST not be used to indicate parameters in error)",
"Invalid parameter name (associated with Set/GetParameterValues, GetParameterNames, Set/GetParameterAttributes)",
"Invalid parameter type (associated with SetParameterValues)",
"Invalid parameter value (associated with SetParameterValues)",
"Attempt to set a non-writable parameter (associated with SetParameterValues)",
"Notification request rejected (associated with SetParameterAttributes method).",
"Download failure (associated with Download or TransferComplete methods).",
"Upload failure (associated with Upload or TransferComplete methods).",
"File transfer server authentication failure (associated with Upload, Download, or TransferComplete methods).",
"Unsupported protocol for file transfer (associated with Upload and Download methods).",
"Download failure: unable to join multicast group",
"Download failure: unable to contact file",
"Download failure: unable to access file",
"Download failure: unable to complete download",
"Download failure: file corrupted",
"Download failure: file authentication failure",
};
#define CWMP_CPE_FAULT_STRING(x) (_CWMP_CPE_FAULT_STRING[x-9000])
#define CWMP_ACS_FAULT_8000_CODE 8000
#define CWMP_ACS_FAULT_8001_CODE 8001
#define CWMP_ACS_FAULT_8002_CODE 8002
#define CWMP_ACS_FAULT_8003_CODE 8003
#define CWMP_ACS_FAULT_8004_CODE 8004
#define CWMP_ACS_FAULT_8005_CODE 8005
#define CWMP_ACS_FAULT_88XX_CODE(x) (8800+x)
static char _CWMP_ACS_FAULT_STRING[20][128] = {
"Method not supported",
"Request denied (no reason specified)",
"Internal error",
"Invalid arguments",
"Resources exceeded",
"Retry request",
};
#define CWMP_ACS_FAULT_STRING(x) (_CWMP_ACS_FAULT_STRING[x-8000])
typedef enum {
CWMP_INFORM_EVENT_NONE = 0,
CWMP_INFORM_EVENT_0_BOOTSTRAP,
CWMP_INFORM_EVENT_1_BOOT,
CWMP_INFORM_EVENT_2_PERIODIC,
CWMP_INFORM_EVENT_3_SCHEDULED,
CWMP_INFORM_EVENT_4_VALUE_CHANGE,
CWMP_INFORM_EVENT_5_KICKED,
CWMP_INFORM_EVENT_6_CONNECTION_REQUEST,
CWMP_INFORM_EVENT_7_TRANSFER_COMPLETE,
CWMP_INFORM_EVENT_8_DIAGNOSTICS_COMPLETE,
CWMP_INFORM_EVENT_9_REQUEST_DOWNLOAD,
CWMP_INFORM_EVENT_10_AUTONOMOUS_TRANSFER_COMPLETE,
CWMP_INFORM_EVENT_11_DU_STATE_CHANGE_COMPLETE,
CWMP_INFORM_EVENT_12_AUTONOMOUS_DU_STATE_CHANGE_COMPLETE,
CWMP_INFORM_EVENT_MAX,
} CAInformEventType;
static char _CWMP_INFORM_EVENT_STRING[CWMP_INFORM_EVENT_MAX][64] = {
"NONE",
"0 BOOTSTRAP",
"1 BOOT",
"2 PERIODIC",
"3 SCHEDULE",
"4 VALUE CHANGE",
"5 KICKED",
"6 CONNECTION REQUEST",
"7 TRANSFER COMPLETE",
"8 DIAGNOSTICS COMPLETE",
"9 REQUEST DOWNLOAD",
"10 AUTONOMOUS TRANSFER COMPLETE",
"11 DU STATE CHANGE COMPLETE",
"12 AUTONOMOUS DU STATE CHANGE COMPLETE",
};
#define CWMP_INFORM_EVENT_STRING(x) _CWMP_INFORM_EVENT_STRING[x]
typedef enum {
CWMP_INFORM_MEVENT_NONE = 0,
CWMP_INFORM_MEVENT_REBOOT,
CWMP_INFORM_MEVENT_SCHEDULEINFORM,
CWMP_INFORM_MEVENT_DOWNLOAD,
CWMP_INFORM_MEVENT_UPLOAD,
CWMP_INFORM_MEVENT_CHANGE_DU_STATE,
CWMP_INFORM_MEVENT_MAX,
} CAInformEventMType;
static char CWMP_INFORM_MEVENT_STRING[CWMP_INFORM_MEVENT_MAX][32] = {
"M NONE",
"M Reboot",
"M ScheduleInform",
"M Download",
"M Upload",
"M ChangeDUState",
};
#define CWMP_INFORM_MEVENT_STRING(x) _CWMP_INFORM_MEVENT_STRING[x]
#endif