blob: 2dad78a01777c01224d9eddb34643d06fcbe7eb7 [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 ts29128_avps (e20).
25 */
26#include <freeDiameter/extension.h>
27
28#define PROTO_VER "e20"
29#define GEN_DATE 1506697139.86
30
31const char *ts29128_avps_proto_ver = PROTO_VER;
32const double ts29128_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_ts29128_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 /* Cause-Type */
128 {
129 struct dict_avp_data data = {
130 4301, /* Code */
131 10415, /* Vendor */
132 "Cause-Type", /* Name */
133 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
134 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
135 AVP_TYPE_UNSIGNED32 /* base type of data */
136 };
137 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
138 };
139 /* S1AP-Cause */
140 {
141 struct dict_avp_data data = {
142 4302, /* Code */
143 10415, /* Vendor */
144 "S1AP-Cause", /* Name */
145 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
146 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
147 AVP_TYPE_UNSIGNED32 /* base type of data */
148 };
149 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
150 };
151 /* RANAP-Cause */
152 {
153 struct dict_avp_data data = {
154 4303, /* Code */
155 10415, /* Vendor */
156 "RANAP-Cause", /* Name */
157 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
158 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
159 AVP_TYPE_UNSIGNED32 /* base type of data */
160 };
161 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
162 };
163 /* BSSGP-Cause */
164 {
165 struct dict_avp_data data = {
166 4309, /* Code */
167 10415, /* Vendor */
168 "BSSGP-Cause", /* Name */
169 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
170 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
171 AVP_TYPE_UNSIGNED32 /* base type of data */
172 };
173 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
174 };
175 /* GMM-Cause */
176 {
177 struct dict_avp_data data = {
178 4304, /* Code */
179 10415, /* Vendor */
180 "GMM-Cause", /* Name */
181 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
182 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
183 AVP_TYPE_UNSIGNED32 /* base type of data */
184 };
185 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
186 };
187 /* SM-Cause */
188 {
189 struct dict_avp_data data = {
190 4305, /* Code */
191 10415, /* Vendor */
192 "SM-Cause", /* 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 /* UE-Count */
200 {
201 struct dict_avp_data data = {
202 4308, /* Code */
203 10415, /* Vendor */
204 "UE-Count", /* Name */
205 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
206 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
207 AVP_TYPE_UNSIGNED32 /* base type of data */
208 };
209 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
210 };
211 /* Connection-Action */
212 {
213 struct dict_avp_data data = {
214 4314, /* Code */
215 10415, /* Vendor */
216 "Connection-Action", /* Name */
217 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
218 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
219 AVP_TYPE_UNSIGNED32 /* base type of data */
220 };
221 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
222 };
223 /* Non-IP-Data */
224 {
225 struct dict_avp_data data = {
226 4315, /* Code */
227 10415, /* Vendor */
228 "Non-IP-Data", /* Name */
229 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
230 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
231 AVP_TYPE_OCTETSTRING /* base type of data */
232 };
233 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
234 };
235 /* Uplink-Rate-Limit */
236 {
237 struct dict_avp_data data = {
238 4311, /* Code */
239 10415, /* Vendor */
240 "Uplink-Rate-Limit", /* Name */
241 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
242 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
243 AVP_TYPE_UNSIGNED32 /* base type of data */
244 };
245 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
246 };
247 /* Downlink-Rate-Limit */
248 {
249 struct dict_avp_data data = {
250 4312, /* Code */
251 10415, /* Vendor */
252 "Downlink-Rate-Limit", /* Name */
253 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
254 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
255 AVP_TYPE_UNSIGNED32 /* base type of data */
256 };
257 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
258 };
259 /* Extended-PCO */
260 {
261 struct dict_avp_data data = {
262 4313, /* Code */
263 10415, /* Vendor */
264 "Extended-PCO", /* Name */
265 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
266 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
267 AVP_TYPE_OCTETSTRING /* base type of data */
268 };
269 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
270 };
271 /* SCEF-Wait-Time */
272 {
273 struct dict_avp_data data = {
274 4316, /* Code */
275 10415, /* Vendor */
276 "SCEF-Wait-Time", /* Name */
277 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
278 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
279 AVP_TYPE_OCTETSTRING /* base type of data */
280 };
281 CHECK_dict_new( DICT_AVP, &data, Time_type, NULL);
282 };
283 /* CMR-Flags */
284 {
285 struct dict_avp_data data = {
286 4317, /* Code */
287 10415, /* Vendor */
288 "CMR-Flags", /* Name */
289 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
290 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
291 AVP_TYPE_UNSIGNED32 /* base type of data */
292 };
293 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
294 };
295 /* Counter-Value */
296 {
297 struct dict_avp_data data = {
298 4319, /* Code */
299 10415, /* Vendor */
300 "Counter-Value", /* Name */
301 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
302 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
303 AVP_TYPE_UNSIGNED32 /* base type of data */
304 };
305 CHECK_dict_new( DICT_AVP, &data, NULL, NULL);
306 };
307 /* RRC-Counter-Timestamp */
308 {
309 struct dict_avp_data data = {
310 4320, /* Code */
311 10415, /* Vendor */
312 "RRC-Counter-Timestamp", /* Name */
313 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
314 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
315 AVP_TYPE_OCTETSTRING /* base type of data */
316 };
317 CHECK_dict_new( DICT_AVP, &data, Time_type, NULL);
318 };
319 /* Communication-Failure-Information */
320 {
321 /* Grouped */
322 struct dict_object * avp;
323 struct dict_avp_data data = {
324 4300, /* Code */
325 10415, /* Vendor */
326 "Communication-Failure-Information", /* 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 /* RRC-Cause-Counter */
334 {
335 /* Grouped */
336 struct dict_object * avp;
337 struct dict_avp_data data = {
338 4318, /* Code */
339 10415, /* Vendor */
340 "RRC-Cause-Counter", /* 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 /* Serving-PLMN-Rate-Control */
348 {
349 /* Grouped */
350 struct dict_object * avp;
351 struct dict_avp_data data = {
352 4310, /* Code */
353 10415, /* Vendor */
354 "Serving-PLMN-Rate-Control", /* Name */
355 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
356 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
357 AVP_TYPE_GROUPED /* base type of data */
358 };
359 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
360 }
361 /* Number-Of-UE-Per-Location-Report */
362 {
363 /* Grouped */
364 struct dict_object * avp;
365 struct dict_avp_data data = {
366 4307, /* Code */
367 10415, /* Vendor */
368 "Number-Of-UE-Per-Location-Report", /* Name */
369 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
370 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
371 AVP_TYPE_GROUPED /* base type of data */
372 };
373 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
374 }
375 /* Number-Of-UE-Per-Location-Configuration */
376 {
377 /* Grouped */
378 struct dict_object * avp;
379 struct dict_avp_data data = {
380 4306, /* Code */
381 10415, /* Vendor */
382 "Number-Of-UE-Per-Location-Configuration", /* Name */
383 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
384 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
385 AVP_TYPE_GROUPED /* base type of data */
386 };
387 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
388 }
389
390
391 }
392
393 /* Commands section */
394 {
395
396 }
397
398 return 0;
399}
400
401static int dict_ts29128_avps_load_rules(char * conffile)
402{
403 /* Grouped AVP section */
404 {
405 /* Communication-Failure-Information */
406 {
407 /* Grouped */
408 struct dict_object * avp;
409 struct dict_avp_request avp_vendor_plus_name = { .avp_vendor = 10415, .avp_name = "Communication-Failure-Information"};
410 CHECK_dict_search(DICT_AVP, AVP_BY_NAME_AND_VENDOR, &avp_vendor_plus_name, &avp)
411 struct local_rules_definition rules[] =
412 {
413 { { .avp_vendor = 10415, .avp_name = "Cause-Type"}, RULE_OPTIONAL, -1, -1 },
414 { { .avp_vendor = 10415, .avp_name = "S1AP-Cause"}, RULE_OPTIONAL, -1, -1 },
415 { { .avp_vendor = 10415, .avp_name = "RANAP-Cause"}, RULE_OPTIONAL, -1, -1 },
416 { { .avp_vendor = 10415, .avp_name = "BSSGP-Cause"}, RULE_OPTIONAL, -1, -1 },
417 { { .avp_vendor = 10415, .avp_name = "GMM-Cause"}, RULE_OPTIONAL, -1, -1 },
418 { { .avp_vendor = 10415, .avp_name = "SM-Cause"}, RULE_OPTIONAL, -1, -1 }
419 };
420 PARSE_loc_rules( rules, avp );
421 }
422 /* RRC-Cause-Counter */
423 {
424 /* Grouped */
425 struct dict_object * avp;
426 struct dict_avp_request avp_vendor_plus_name = { .avp_vendor = 10415, .avp_name = "RRC-Cause-Counter"};
427 CHECK_dict_search(DICT_AVP, AVP_BY_NAME_AND_VENDOR, &avp_vendor_plus_name, &avp)
428 struct local_rules_definition rules[] =
429 {
430 { { .avp_vendor = 10415, .avp_name = "Counter-Value"}, RULE_OPTIONAL, -1, -1 },
431 { { .avp_vendor = 10415, .avp_name = "RRC-Counter-Timestamp"}, RULE_OPTIONAL, -1, -1 }
432 };
433 PARSE_loc_rules( rules, avp );
434 }
435 /* Serving-PLMN-Rate-Control */
436 {
437 /* Grouped */
438 struct dict_object * avp;
439 struct dict_avp_request avp_vendor_plus_name = { .avp_vendor = 10415, .avp_name = "Serving-PLMN-Rate-Control"};
440 CHECK_dict_search(DICT_AVP, AVP_BY_NAME_AND_VENDOR, &avp_vendor_plus_name, &avp)
441 struct local_rules_definition rules[] =
442 {
443 { { .avp_vendor = 10415, .avp_name = "Uplink-Rate-Limit"}, RULE_OPTIONAL, -1, -1 },
444 { { .avp_vendor = 10415, .avp_name = "Downlink-Rate-Limit"}, RULE_OPTIONAL, -1, -1 }
445 };
446 PARSE_loc_rules( rules, avp );
447 }
448 /* Number-Of-UE-Per-Location-Report */
449 {
450 /* Grouped */
451 struct dict_object * avp;
452 struct dict_avp_request avp_vendor_plus_name = { .avp_vendor = 10415, .avp_name = "Number-Of-UE-Per-Location-Report"};
453 CHECK_dict_search(DICT_AVP, AVP_BY_NAME_AND_VENDOR, &avp_vendor_plus_name, &avp)
454 struct local_rules_definition rules[] =
455 {
456 { { .avp_vendor = 10415, .avp_name = "EPS-Location-Information"}, RULE_REQUIRED, -1, -1 },
457 { { .avp_vendor = 10415, .avp_name = "UE-Count"}, RULE_REQUIRED, -1, -1 }
458 };
459 PARSE_loc_rules( rules, avp );
460 }
461 /* Number-Of-UE-Per-Location-Configuration */
462 {
463 /* Grouped */
464 struct dict_object * avp;
465 struct dict_avp_request avp_vendor_plus_name = { .avp_vendor = 10415, .avp_name = "Number-Of-UE-Per-Location-Configuration"};
466 CHECK_dict_search(DICT_AVP, AVP_BY_NAME_AND_VENDOR, &avp_vendor_plus_name, &avp)
467 struct local_rules_definition rules[] =
468 {
469 { { .avp_vendor = 10415, .avp_name = "EPS-Location-Information"}, RULE_REQUIRED, -1, -1 }
470 };
471 PARSE_loc_rules( rules, avp );
472 }
473
474 }
475
476 /* Commands section */
477 {
478
479 }
480
481 LOG_D( "Extension 'Dictionary definitions for ts29128_avps (e20)' initialized");
482 return 0;
483}
484
485int dict_entry(char * conffile)
486{
487 dict_ts29128_avps_load_defs(conffile);
488 return dict_ts29128_avps_load_rules(conffile);
489}
490
491const char* dict_ts29128_avps_proto_ver(char * conffile) {
492 return ts29128_avps_proto_ver;
493}
494
495const double dict_ts29128_avps_gen_ts(char * conffile) {
496 return ts29128_avps_gen_date;
497}
498
499EXTENSION_ENTRY2("dict_ts29128_avps", dict_ts29128_avps_load_defs, dict_ts29128_avps_load_rules, "dict_ts32299_avps", "dict_ts29272_avps", "dict_ts29336_avps", "dict_ts29212_avps", "dict_ts29338_avps", "dict_ts29229_avps", "dict_ts29061_avps", "dict_draftload_avps", "dict_rfc7683_avps", "dict_rfc5778_avps", "dict_rfc7944_avps");
500
501
502