blob: 4ced331f72333a546ec0d21237018d799a8af37c [file] [log] [blame]
Brian Waters13d96012017-12-08 16:53:31 -06001/*
2* Copyright (c) 2017 Sprint
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*/
16
17/****************
18 Generated By: fdtool enhancements to diafuzzer
19 License: same as freeDiameter
20****************/
21
22
23/*
24 * Dictionary definitions of objects specified in ts29368_avps (e10).
25 */
26#include <freeDiameter/extension.h>
27
28#define PROTO_VER "e10"
29#define GEN_DATE 1506697146.83
30
31const char *ts29368_avps_proto_ver = PROTO_VER;
32const double ts29368_avps_gen_date = GEN_DATE;
33
34/* The content of this file follows the same structure as dict_base_proto.c */
35
36#define CHECK_dict_new( _type, _data, _parent, _ref ) \
37{ \
38 int _ret = fd_dict_new( fd_g_config->cnf_dict, (_type), (_data), (_parent), (_ref) ); \
39 if ( _ret != 0 && _ret != EEXIST ) \
40 return _ret; \
41}
42
43#define CHECK_dict_search( _type, _criteria, _what, _result ) \
44 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
45
46struct local_rules_definition {
47 struct dict_avp_request avp_vendor_plus_name;
48 enum rule_position position;
49 int min;
50 int max;
51};
52
53#define RULE_ORDER( _position ) ((((_position) == RULE_FIXED_HEAD) || ((_position) == RULE_FIXED_TAIL)) ? 1 : 0 )
54
55/* Attention! This version of the macro uses AVP_BY_NAME_AND_VENDOR, in contrast to most other copies! */
56#define PARSE_loc_rules( _rulearray, _parent) { \
57 int __ar; \
58 for (__ar=0; __ar < sizeof(_rulearray) / sizeof((_rulearray)[0]); __ar++) { \
59 struct dict_rule_data __data = { NULL, \
60 (_rulearray)[__ar].position, \
61 0, \
62 (_rulearray)[__ar].min, \
63 (_rulearray)[__ar].max}; \
64 __data.rule_order = RULE_ORDER(__data.rule_position); \
65 CHECK_FCT( fd_dict_search( \
66 fd_g_config->cnf_dict, \
67 DICT_AVP, \
68 AVP_BY_NAME_AND_VENDOR, \
69 &(_rulearray)[__ar].avp_vendor_plus_name, \
70 &__data.rule_avp, 0 ) ); \
71 if ( !__data.rule_avp ) { \
72 TRACE_DEBUG(INFO, "AVP Not found: '%s'", (_rulearray)[__ar].avp_vendor_plus_name.avp_name); \
73 return ENOENT; \
74 } \
75 { \
76 int _ret = fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &(__data), (_parent), NULL ); \
77 if ( _ret != 0 && _ret != EEXIST ) { \
78 TRACE_DEBUG(INFO, "Error on rule with AVP '%s'", \
79 (_rulearray)[__ar].avp_vendor_plus_name.avp_name); \
80 return EINVAL; \
81 } \
82 } \
83 } \
84}
85
86#define CHECK_vendor_new( _data ) { \
87 struct dict_object * vendor_found; \
88 if (fd_dict_search(fd_g_config->cnf_dict,DICT_VENDOR,VENDOR_BY_ID,&_data.vendor_id,&vendor_found,ENOENT) == ENOENT) { \
89 CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &_data, NULL, NULL)); \
90 } \
91}
92
93#define enumval_def_u32( _val_, _str_ ) \
94 { _str_, { .u32 = _val_ }}
95
96#define enumval_def_os( _len_, _val_, _str_ ) \
97 { _str_, { .os = { .data = (unsigned char *)_val_, .len = _len_ }}}
98
99
100static int dict_ts29368_avps_load_defs(char * conffile)
101{
102 TRACE_ENTRY("%p", conffile);
103 /* Application Section */
104 {
105 /* Create the vendors */ {
106 struct dict_vendor_data vendor_data = { 10415, "3GPP" };
107 CHECK_dict_new(DICT_VENDOR, &vendor_data, NULL, NULL)
108 }
109 }
110
111
112 /* AVP section */
113 {
114 struct dict_object * Address_type;
115 struct dict_object * UTF8String_type;
116 struct dict_object * DiameterIdentity_type;
117 struct dict_object * DiameterURI_type;
118 struct dict_object * Time_type;
119 struct dict_object * IPFilterRule_type;
120
121 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Address", &Address_type);
122 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "UTF8String", &UTF8String_type);
123 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterIdentity", &DiameterIdentity_type);
124 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterURI", &DiameterURI_type);
125 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Time", &Time_type);
126 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "IPFilterRule", &IPFilterRule_type);
127 /* Payload */
128 {
129 struct dict_avp_data data = {
130 3004, /* Code */
131 10415, /* Vendor */
132 "Payload", /* Name */
133 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
134 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
135 AVP_TYPE_OCTETSTRING /* base type of data */
136 };
137 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
138 };
139 /* Action-Type */
140 {
141 struct dict_avp_data data = {
142 3005, /* Code */
143 10415, /* Vendor */
144 "Action-Type", /* Name */
145 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
146 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
147 AVP_TYPE_INTEGER32 /* base type of data */
148 };
149 struct dict_object *type;
150 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "3GPP/Enumerated(Action-Type)", NULL, NULL, NULL };
151 struct dict_enumval_data t_1 = { "Non_Priority", { .i32=0 }};
152 struct dict_enumval_data t_2 = { "Priority", { .i32=1 }};
153 struct dict_enumval_data t_3 = { "Report", { .i32=2 }};
154 struct dict_enumval_data t_4 = { "Recall", { .i32=3 }};
155 struct dict_enumval_data t_5 = { "Replace", { .i32=4 }};
156 struct dict_enumval_data t_6 = { "Delivery", { .i32=5 }};
157 /* Create the Enumerated type, and then the AVP */
158 CHECK_dict_new( DICT_TYPE, &tdata, NULL, &type);
159 CHECK_dict_new( DICT_ENUMVAL, &t_1, type, NULL);
160 CHECK_dict_new( DICT_ENUMVAL, &t_2, type, NULL);
161 CHECK_dict_new( DICT_ENUMVAL, &t_3, type, NULL);
162 CHECK_dict_new( DICT_ENUMVAL, &t_4, type, NULL);
163 CHECK_dict_new( DICT_ENUMVAL, &t_5, type, NULL);
164 CHECK_dict_new( DICT_ENUMVAL, &t_6, type, NULL);
165 CHECK_dict_new( DICT_AVP, &data, type, NULL);
166 };
167 /* Priority-Indication */
168 {
169 struct dict_avp_data data = {
170 3006, /* Code */
171 10415, /* Vendor */
172 "Priority-Indication", /* Name */
173 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
174 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
175 AVP_TYPE_INTEGER32 /* base type of data */
176 };
177 struct dict_object *type;
178 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "3GPP/Enumerated(Priority-Indication)", NULL, NULL, NULL };
179 struct dict_enumval_data t_1 = { "Non-Priority", { .i32=0 }};
180 struct dict_enumval_data t_2 = { "Priority", { .i32=1 }};
181 /* Create the Enumerated type, and then the AVP */
182 CHECK_dict_new( DICT_TYPE, &tdata, NULL, &type);
183 CHECK_dict_new( DICT_ENUMVAL, &t_1, type, NULL);
184 CHECK_dict_new( DICT_ENUMVAL, &t_2, type, NULL);
185 CHECK_dict_new( DICT_AVP, &data, type, NULL);
186 };
187 /* Reference-Number */
188 {
189 struct dict_avp_data data = {
190 3007, /* Code */
191 10415, /* Vendor */
192 "Reference-Number", /* Name */
193 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
194 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
195 AVP_TYPE_UNSIGNED32 /* base type of data */
196 };
197 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
198 };
199 /* Request-Status */
200 {
201 struct dict_avp_data data = {
202 3008, /* Code */
203 10415, /* Vendor */
204 "Request-Status", /* Name */
205 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
206 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
207 AVP_TYPE_INTEGER32 /* base type of data */
208 };
209 struct dict_object *type;
210 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "3GPP/Enumerated(Request-Status)", NULL, NULL, NULL };
211 struct dict_enumval_data t_1 = { "SUCCESS", { .i32=0 }};
212 struct dict_enumval_data t_2 = { "INVPAYLOAD", { .i32=101 }};
213 struct dict_enumval_data t_3 = { "INVEXTID", { .i32=102 }};
214 struct dict_enumval_data t_4 = { "INVSCSID", { .i32=103 }};
215 struct dict_enumval_data t_5 = { "INVPERIOD", { .i32=104 }};
216 struct dict_enumval_data t_6 = { "NOTAUTHORIZED", { .i32=105 }};
217 struct dict_enumval_data t_7 = { "SERVICEUNAVAILABLE", { .i32=106 }};
218 struct dict_enumval_data t_8 = { "PERMANENTERROR", { .i32=107 }};
219 struct dict_enumval_data t_9 = { "QUOTAEXCEEDED", { .i32=108 }};
220 struct dict_enumval_data t_10 = { "RATEEXCEEDED", { .i32=109 }};
221 struct dict_enumval_data t_11 = { "REPLACEFAIL", { .i32=110 }};
222 struct dict_enumval_data t_12 = { "RECALLFAIL", { .i32=111 }};
223 struct dict_enumval_data t_13 = { "ORIGINALMESSAGESENT", { .i32=112 }};
224 struct dict_enumval_data t_14 = { "TEMPORARYERROR", { .i32=201 }};
225 /* Create the Enumerated type, and then the AVP */
226 CHECK_dict_new( DICT_TYPE, &tdata, NULL, &type);
227 CHECK_dict_new( DICT_ENUMVAL, &t_1, type, NULL);
228 CHECK_dict_new( DICT_ENUMVAL, &t_2, type, NULL);
229 CHECK_dict_new( DICT_ENUMVAL, &t_3, type, NULL);
230 CHECK_dict_new( DICT_ENUMVAL, &t_4, type, NULL);
231 CHECK_dict_new( DICT_ENUMVAL, &t_5, type, NULL);
232 CHECK_dict_new( DICT_ENUMVAL, &t_6, type, NULL);
233 CHECK_dict_new( DICT_ENUMVAL, &t_7, type, NULL);
234 CHECK_dict_new( DICT_ENUMVAL, &t_8, type, NULL);
235 CHECK_dict_new( DICT_ENUMVAL, &t_9, type, NULL);
236 CHECK_dict_new( DICT_ENUMVAL, &t_10, type, NULL);
237 CHECK_dict_new( DICT_ENUMVAL, &t_11, type, NULL);
238 CHECK_dict_new( DICT_ENUMVAL, &t_12, type, NULL);
239 CHECK_dict_new( DICT_ENUMVAL, &t_13, type, NULL);
240 CHECK_dict_new( DICT_ENUMVAL, &t_14, type, NULL);
241 CHECK_dict_new( DICT_AVP, &data, type, NULL);
242 };
243 /* Delivery-Outcome */
244 {
245 struct dict_avp_data data = {
246 3009, /* Code */
247 10415, /* Vendor */
248 "Delivery-Outcome", /* Name */
249 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
250 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
251 AVP_TYPE_INTEGER32 /* base type of data */
252 };
253 struct dict_object *type;
254 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "3GPP/Enumerated(Delivery-Outcome)", NULL, NULL, NULL };
255 struct dict_enumval_data t_1 = { "SUCCESS", { .i32=0 }};
256 struct dict_enumval_data t_2 = { "EXPIRED", { .i32=1 }};
257 struct dict_enumval_data t_3 = { "TEMPORARYERROR", { .i32=2 }};
258 struct dict_enumval_data t_4 = { "UNDELIVERABLE", { .i32=3 }};
259 struct dict_enumval_data t_5 = { "UNCONFIRMED", { .i32=4 }};
260 /* Create the Enumerated type, and then the AVP */
261 CHECK_dict_new( DICT_TYPE, &tdata, NULL, &type);
262 CHECK_dict_new( DICT_ENUMVAL, &t_1, type, NULL);
263 CHECK_dict_new( DICT_ENUMVAL, &t_2, type, NULL);
264 CHECK_dict_new( DICT_ENUMVAL, &t_3, type, NULL);
265 CHECK_dict_new( DICT_ENUMVAL, &t_4, type, NULL);
266 CHECK_dict_new( DICT_ENUMVAL, &t_5, type, NULL);
267 CHECK_dict_new( DICT_AVP, &data, type, NULL);
268 };
269 /* Application-Port-Identifier */
270 {
271 struct dict_avp_data data = {
272 3010, /* Code */
273 10415, /* Vendor */
274 "Application-Port-Identifier", /* Name */
275 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
276 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
277 AVP_TYPE_UNSIGNED32 /* base type of data */
278 };
279 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
280 };
281 /* Old-Reference-Number */
282 {
283 struct dict_avp_data data = {
284 3011, /* Code */
285 10415, /* Vendor */
286 "Old-Reference-Number", /* Name */
287 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
288 AVP_FLAG_VENDOR, /* Fixed flag values */
289 AVP_TYPE_UNSIGNED32 /* base type of data */
290 };
291 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
292 };
293 /* Feature-Supported-In-Final-Target */
294 {
295 struct dict_avp_data data = {
296 3012, /* Code */
297 10415, /* Vendor */
298 "Feature-Supported-In-Final-Target", /* Name */
299 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
300 AVP_FLAG_VENDOR, /* Fixed flag values */
301 AVP_TYPE_UNSIGNED32 /* base type of data */
302 };
303 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
304 };
305 /* Trigger-Data */
306 {
307 /* Grouped */
308 struct dict_object * avp;
309 struct dict_avp_data data = {
310 3003, /* Code */
311 10415, /* Vendor */
312 "Trigger-Data", /* Name */
313 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
314 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
315 AVP_TYPE_GROUPED /* base type of data */
316 };
317 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
318 }
319 /* Device-Notification */
320 {
321 /* Grouped */
322 struct dict_object * avp;
323 struct dict_avp_data data = {
324 3002, /* Code */
325 10415, /* Vendor */
326 "Device-Notification", /* Name */
327 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
328 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
329 AVP_TYPE_GROUPED /* base type of data */
330 };
331 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
332 }
333 /* Device-Action */
334 {
335 /* Grouped */
336 struct dict_object * avp;
337 struct dict_avp_data data = {
338 3001, /* Code */
339 10415, /* Vendor */
340 "Device-Action", /* Name */
341 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
342 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
343 AVP_TYPE_GROUPED /* base type of data */
344 };
345 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
346 }
347
348
349 }
350
351 /* Commands section */
352 {
353
354 }
355
356 return 0;
357}
358
359static int dict_ts29368_avps_load_rules(char * conffile)
360{
361 /* Grouped AVP section */
362 {
363 /* Trigger-Data */
364 {
365 /* Grouped */
366 struct dict_object * avp;
367 struct dict_avp_request avp_vendor_plus_name = { .avp_vendor = 10415, .avp_name = "Trigger-Data"};
368 CHECK_dict_search(DICT_AVP, AVP_BY_NAME_AND_VENDOR, &avp_vendor_plus_name, &avp)
369 struct local_rules_definition rules[] =
370 {
371 { { .avp_vendor = 10415, .avp_name = "Payload"}, RULE_REQUIRED, -1, -1 },
372 { { .avp_vendor = 10415, .avp_name = "Priority-Indication"}, RULE_OPTIONAL, -1, -1 },
373 { { .avp_vendor = 10415, .avp_name = "Application-Port-Identifier"}, RULE_OPTIONAL, -1, -1 }
374 };
375 PARSE_loc_rules( rules, avp );
376 }
377 /* Device-Notification */
378 {
379 /* Grouped */
380 struct dict_object * avp;
381 struct dict_avp_request avp_vendor_plus_name = { .avp_vendor = 10415, .avp_name = "Device-Notification"};
382 CHECK_dict_search(DICT_AVP, AVP_BY_NAME_AND_VENDOR, &avp_vendor_plus_name, &avp)
383 struct local_rules_definition rules[] =
384 {
385 { { .avp_vendor = 10415, .avp_name = "External-Identifier"}, RULE_OPTIONAL, -1, -1 },
386 { { .avp_vendor = 10415, .avp_name = "MSISDN"}, RULE_OPTIONAL, -1, -1 },
387 { { .avp_vendor = 10415, .avp_name = "SCS-Identity"}, RULE_OPTIONAL, -1, -1 },
388 { { .avp_vendor = 10415, .avp_name = "Reference-Number"}, RULE_REQUIRED, -1, -1 },
389 { { .avp_vendor = 10415, .avp_name = "Action-Type"}, RULE_REQUIRED, -1, -1 },
390 { { .avp_vendor = 10415, .avp_name = "Request-Status"}, RULE_OPTIONAL, -1, -1 },
391 { { .avp_vendor = 10415, .avp_name = "MTC-Error-Diagnostic"}, RULE_OPTIONAL, -1, -1 },
392 { { .avp_vendor = 10415, .avp_name = "Delivery-Outcome"}, RULE_OPTIONAL, -1, -1 },
393 { { .avp_vendor = 10415, .avp_name = "SM-RP-UI"}, RULE_OPTIONAL, -1, -1 },
394 { { .avp_vendor = 10415, .avp_name = "Application-Port-Identifier"}, RULE_OPTIONAL, -1, -1 }
395 };
396 PARSE_loc_rules( rules, avp );
397 }
398 /* Device-Action */
399 {
400 /* Grouped */
401 struct dict_object * avp;
402 struct dict_avp_request avp_vendor_plus_name = { .avp_vendor = 10415, .avp_name = "Device-Action"};
403 CHECK_dict_search(DICT_AVP, AVP_BY_NAME_AND_VENDOR, &avp_vendor_plus_name, &avp)
404 struct local_rules_definition rules[] =
405 {
406 { { .avp_vendor = 10415, .avp_name = "External-Identifier"}, RULE_OPTIONAL, -1, -1 },
407 { { .avp_vendor = 10415, .avp_name = "MSISDN"}, RULE_OPTIONAL, -1, -1 },
408 { { .avp_vendor = 10415, .avp_name = "SCS-Identity"}, RULE_OPTIONAL, -1, -1 },
409 { { .avp_vendor = 10415, .avp_name = "Reference-Number"}, RULE_REQUIRED, -1, -1 },
410 { { .avp_vendor = 10415, .avp_name = "Old-Reference-Number"}, RULE_OPTIONAL, -1, -1 },
411 { { .avp_vendor = 10415, .avp_name = "Action-Type"}, RULE_REQUIRED, -1, -1 },
412 { { .avp_vendor = 10415, .avp_name = "Trigger-Data"}, RULE_OPTIONAL, -1, -1 },
413 { { .avp_vendor = 0, .avp_name = "Validity-Time"}, RULE_OPTIONAL, -1, -1 }
414 };
415 PARSE_loc_rules( rules, avp );
416 }
417
418 }
419
420 /* Commands section */
421 {
422
423 }
424
425 LOG_D( "Extension 'Dictionary definitions for ts29368_avps (e10)' initialized");
426 return 0;
427}
428
429int dict_entry(char * conffile)
430{
431 dict_ts29368_avps_load_defs(conffile);
432 return dict_ts29368_avps_load_rules(conffile);
433}
434
435const char* dict_ts29368_avps_proto_ver(char * conffile) {
436 return ts29368_avps_proto_ver;
437}
438
439const double dict_ts29368_avps_gen_ts(char * conffile) {
440 return ts29368_avps_gen_date;
441}
442
443EXTENSION_ENTRY2("dict_ts29368_avps", dict_ts29368_avps_load_defs, dict_ts29368_avps_load_rules, "dict_ts29337_avps", "dict_ts29336_avps", "dict_ts29338_avps", "dict_ts29329_avps", "dict_ts29229_avps", "dict_draftload_avps", "dict_rfc4006bis_avps");
444
445
446