blob: e791f1f4c271b55afcd86ab9dba85eb8447a60fd [file] [log] [blame]
Brian Waters13d96012017-12-08 16:53:31 -06001/*
2 * Dictionary definitions of objects specified in DCCA by Starent.
3 */
4#include <freeDiameter/extension.h>
5
6
7/* The content of this file follows the same structure as dict_base_proto.c */
8
9#define CHECK_dict_new( _type, _data, _parent, _ref ) \
10 CHECK_FCT( fd_dict_new( fd_g_config->cnf_dict, (_type), (_data), (_parent), (_ref)) );
11
12#define CHECK_dict_search( _type, _criteria, _what, _result ) \
13 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
14
15struct local_rules_definition {
16 char *avp_name;
17 enum rule_position position;
18 int min;
19 int max;
20};
21
22#define RULE_ORDER( _position ) ((((_position) == RULE_FIXED_HEAD) || ((_position) == RULE_FIXED_TAIL)) ? 1 : 0 )
23
24/* Attention! This version of the macro uses AVP_BY_NAME_ALL_VENDORS, in contrast to most other copies! */
25#define PARSE_loc_rules( _rulearray, _parent) { \
26 int __ar; \
27 for (__ar=0; __ar < sizeof(_rulearray) / sizeof((_rulearray)[0]); __ar++) { \
28 struct dict_rule_data __data = { NULL, \
29 (_rulearray)[__ar].position, \
30 0, \
31 (_rulearray)[__ar].min, \
32 (_rulearray)[__ar].max}; \
33 __data.rule_order = RULE_ORDER(__data.rule_position); \
34 CHECK_FCT( fd_dict_search( \
35 fd_g_config->cnf_dict, \
36 DICT_AVP, \
37 AVP_BY_NAME_ALL_VENDORS, \
38 (_rulearray)[__ar].avp_name, \
39 &__data.rule_avp, 0 ) ); \
40 if ( !__data.rule_avp ) { \
41 TRACE_DEBUG(INFO, "AVP Not found: '%s'", (_rulearray)[__ar].avp_name ); \
42 return ENOENT; \
43 } \
44 CHECK_FCT_DO( fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &__data, _parent, NULL), \
45 { \
46 TRACE_DEBUG(INFO, "Error on rule with AVP '%s'", \
47 (_rulearray)[__ar].avp_name ); \
48 return EINVAL; \
49 } ); \
50 } \
51}
52
53#define enumval_def_u32( _val_, _str_ ) \
54 { _str_, { .u32 = _val_ }}
55
56#define enumval_def_os( _len_, _val_, _str_ ) \
57 { _str_, { .os = { .data = (unsigned char *)_val_, .len = _len_ }}}
58
59
60static int dict_dcca_starent_entry(char * conffile)
61{
62 /* Applications section */
63 {
64 /* Create the vendors */
65 {
66 struct dict_vendor_data vendor_data = { 8164, "Starent" };
67 CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, NULL));
68 }
69
70 }
71
72
73 struct dict_object * Address_type;
74 struct dict_object * DiameterIdentity_type;
75 struct dict_object * DiameterURI_type;
76 struct dict_object * IPFilterRule_type;
77 struct dict_object * Time_type;
78 struct dict_object * UTF8String_type;
79
80 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Address", &Address_type);
81 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterIdentity", &DiameterIdentity_type);
82 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterURI", &DiameterURI_type);
83 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "IPFilterRule", &IPFilterRule_type);
84 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Time", &Time_type);
85 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "UTF8String", &UTF8String_type);
86
87 /* The following is created automatically. Do not modify. */
88 /* Changes will be lost during the next update. Modify the source org file instead. */
89
90 /* Cisco ASR 5000 Series AAA Interface */
91 /* Administration and Reference */
92 /* Release 8.x and 9.0 */
93 /* Last Updated June 30, 2010 */
94 /* updated using v15 docs from Jan 2014 */
95 /* www.cisco.com/c/dam/en/us/td/docs/wireless/asr_5000/15-0/15-0-AAA-Reference.pdf */
96 /* SN-Volume-Quota-Threshold */
97 {
98 struct dict_avp_data data = {
99 501, /* Code */
100 8164, /* Vendor */
101 "SN-Volume-Quota-Threshold", /* Name */
102 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flags */
103 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flag values */
104 AVP_TYPE_UNSIGNED32 /* base type of data */
105 };
106 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
107 };
108
109 /* SN-Unit-Quota-Threshold */
110 {
111 struct dict_avp_data data = {
112 502, /* Code */
113 8164, /* Vendor */
114 "SN-Unit-Quota-Threshold", /* Name */
115 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flags */
116 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flag values */
117 AVP_TYPE_UNSIGNED32 /* base type of data */
118 };
119 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
120 };
121
122 /* SN-Time-Quota-Threshold */
123 {
124 struct dict_avp_data data = {
125 503, /* Code */
126 8164, /* Vendor */
127 "SN-Time-Quota-Threshold", /* Name */
128 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flags */
129 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flag values */
130 AVP_TYPE_UNSIGNED32 /* base type of data */
131 };
132 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
133 };
134
135 /* SN-Total-Used-Service-Unit */
136 {
137 struct dict_avp_data data = {
138 504, /* Code */
139 8164, /* Vendor */
140 "SN-Total-Used-Service-Unit", /* Name */
141 AVP_FLAG_VENDOR, /* Fixed flags */
142 AVP_FLAG_VENDOR, /* Fixed flag values */
143 AVP_TYPE_GROUPED /* base type of data */
144 };
145 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
146 };
147
148 /* SN-Absolute-Validity-Time */
149 {
150 struct dict_avp_data data = {
151 505, /* Code */
152 8164, /* Vendor */
153 "SN-Absolute-Validity-Time", /* Name */
154 AVP_FLAG_VENDOR, /* Fixed flags */
155 AVP_FLAG_VENDOR, /* Fixed flag values */
156 AVP_TYPE_OCTETSTRING /* base type of data */
157 };
158 CHECK_dict_new(DICT_AVP, &data, Time_type, NULL);
159 };
160
161 /* SN-Bandwidth-Control */
162 {
163 struct dict_avp_data data = {
164 512, /* Code */
165 8164, /* Vendor */
166 "SN-Bandwidth-Control", /* Name */
167 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flags */
168 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flag values */
169 AVP_TYPE_INTEGER32 /* base type of data */
170 };
171 struct dict_object *type;
172 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Starent/Enumerated(SN-Bandwidth-Control)", NULL, NULL, NULL };
173 CHECK_dict_new(DICT_TYPE, &tdata, NULL, &type);
174 CHECK_dict_new(DICT_AVP, &data, type, NULL);
175 };
176
177 /* SN-Transparent-Data */
178 {
179 struct dict_avp_data data = {
180 513, /* Code */
181 8164, /* Vendor */
182 "SN-Transparent-Data", /* Name */
183 AVP_FLAG_VENDOR, /* Fixed flags */
184 AVP_FLAG_VENDOR, /* Fixed flag values */
185 AVP_TYPE_OCTETSTRING /* base type of data */
186 };
187 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
188 };
189
190 /* SN-Traffic-Policy */
191 {
192 struct dict_avp_data data = {
193 514, /* Code */
194 8164, /* Vendor */
195 "SN-Traffic-Policy", /* Name */
196 AVP_FLAG_VENDOR, /* Fixed flags */
197 AVP_FLAG_VENDOR, /* Fixed flag values */
198 AVP_TYPE_OCTETSTRING /* base type of data */
199 };
200 CHECK_dict_new(DICT_AVP, &data, UTF8String_type, NULL);
201 };
202
203 /* SN-Firewall-Policy */
204 {
205 struct dict_avp_data data = {
206 515, /* Code */
207 8164, /* Vendor */
208 "SN-Firewall-Policy", /* Name */
209 AVP_FLAG_VENDOR, /* Fixed flags */
210 AVP_FLAG_VENDOR, /* Fixed flag values */
211 AVP_TYPE_OCTETSTRING /* base type of data */
212 };
213 CHECK_dict_new(DICT_AVP, &data, UTF8String_type, NULL);
214 };
215
216 /* SN-Usage-Monitoring-Control */
217 {
218 struct dict_avp_data data = {
219 517, /* Code */
220 8164, /* Vendor */
221 "SN-Usage-Monitoring-Control", /* Name */
222 AVP_FLAG_VENDOR, /* Fixed flags */
223 AVP_FLAG_VENDOR, /* Fixed flag values */
224 AVP_TYPE_GROUPED /* base type of data */
225 };
226 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
227 };
228
229 /* SN-Monitoring-Key */
230 {
231 struct dict_avp_data data = {
232 518, /* Code */
233 8164, /* Vendor */
234 "SN-Monitoring-Key", /* Name */
235 AVP_FLAG_VENDOR, /* Fixed flags */
236 AVP_FLAG_VENDOR, /* Fixed flag values */
237 AVP_TYPE_UNSIGNED32 /* base type of data */
238 };
239 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
240 };
241
242 /* SN-Usage-Volume */
243 {
244 struct dict_avp_data data = {
245 519, /* Code */
246 8164, /* Vendor */
247 "SN-Usage-Volume", /* Name */
248 AVP_FLAG_VENDOR, /* Fixed flags */
249 AVP_FLAG_VENDOR, /* Fixed flag values */
250 AVP_TYPE_UNSIGNED64 /* base type of data */
251 };
252 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
253 };
254
255 /* SN-Service-Flow-Detection */
256 {
257 struct dict_avp_data data = {
258 520, /* Code */
259 8164, /* Vendor */
260 "SN-Service-Flow-Detection", /* Name */
261 AVP_FLAG_VENDOR, /* Fixed flags */
262 AVP_FLAG_VENDOR, /* Fixed flag values */
263 AVP_TYPE_INTEGER32 /* base type of data */
264 };
265 struct dict_object *type;
266 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Starent/Enumerated(SN-Service-Flow-Detection)", NULL, NULL, NULL };
267 CHECK_dict_new(DICT_TYPE, &tdata, NULL, &type);
268 CHECK_dict_new(DICT_AVP, &data, type, NULL);
269 };
270
271 /* SN-Usage-Monitoring */
272 {
273 struct dict_avp_data data = {
274 521, /* Code */
275 8164, /* Vendor */
276 "SN-Usage-Monitoring", /* Name */
277 AVP_FLAG_VENDOR, /* Fixed flags */
278 AVP_FLAG_VENDOR, /* Fixed flag values */
279 AVP_TYPE_INTEGER32 /* base type of data */
280 };
281 struct dict_object *type;
282 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Starent/Enumerated(SN-Usage-Monitoring)", NULL, NULL, NULL };
283 CHECK_dict_new(DICT_TYPE, &tdata, NULL, &type);
284 CHECK_dict_new(DICT_AVP, &data, type, NULL);
285 };
286
287 /* SN-Session-Start-Indicator */
288 {
289 struct dict_avp_data data = {
290 522, /* Code */
291 8164, /* Vendor */
292 "SN-Session-Start-Indicator", /* Name */
293 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flags */
294 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flag values */
295 AVP_TYPE_OCTETSTRING /* base type of data */
296 };
297 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
298 };
299
300 /* SN-Phase0-PSAPName */
301 {
302 struct dict_avp_data data = {
303 523, /* Code */
304 8164, /* Vendor */
305 "SN-Phase0-PSAPName", /* Name */
306 AVP_FLAG_VENDOR, /* Fixed flags */
307 AVP_FLAG_VENDOR, /* Fixed flag values */
308 AVP_TYPE_OCTETSTRING /* base type of data */
309 };
310 CHECK_dict_new(DICT_AVP, &data, UTF8String_type, NULL);
311 };
312
313 /* SN-Charging-Id */
314 {
315 struct dict_avp_data data = {
316 525, /* Code */
317 8164, /* Vendor */
318 "SN-Charging-Id", /* Name */
319 AVP_FLAG_VENDOR, /* Fixed flags */
320 AVP_FLAG_VENDOR, /* Fixed flag values */
321 AVP_TYPE_OCTETSTRING /* base type of data */
322 };
323 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
324 };
325
326 /* SN-Remaining-Service-Unit */
327 {
328 struct dict_avp_data data = {
329 526, /* Code */
330 8164, /* Vendor */
331 "SN-Remaining-Service-Unit", /* Name */
332 AVP_FLAG_VENDOR, /* Fixed flags */
333 AVP_FLAG_VENDOR, /* Fixed flag values */
334 AVP_TYPE_GROUPED /* base type of data */
335 };
336 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
337 };
338
339 /* SN-Service-Start-Timestamp */
340 {
341 struct dict_avp_data data = {
342 527, /* Code */
343 8164, /* Vendor */
344 "SN-Service-Start-Timestamp", /* Name */
345 AVP_FLAG_VENDOR, /* Fixed flags */
346 AVP_FLAG_VENDOR, /* Fixed flag values */
347 AVP_TYPE_OCTETSTRING /* base type of data */
348 };
349 CHECK_dict_new(DICT_AVP, &data, Time_type, NULL);
350 };
351
352 /* SN-Rulebase-Id */
353 {
354 struct dict_avp_data data = {
355 528, /* Code */
356 8164, /* Vendor */
357 "SN-Rulebase-Id", /* Name */
358 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flags */
359 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flag values */
360 AVP_TYPE_OCTETSTRING /* base type of data */
361 };
362 CHECK_dict_new(DICT_AVP, &data, UTF8String_type, NULL);
363 };
364
365 /* SN-CF-Policy-ID */
366 {
367 struct dict_avp_data data = {
368 529, /* Code */
369 8164, /* Vendor */
370 "SN-CF-Policy-ID", /* Name */
371 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flags */
372 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flag values */
373 AVP_TYPE_UNSIGNED32 /* base type of data */
374 };
375 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
376 };
377
378 /* SN-Charging-Collection-Function-Name */
379 {
380 struct dict_avp_data data = {
381 530, /* Code */
382 8164, /* Vendor */
383 "SN-Charging-Collection-Function-Name", /* Name */
384 AVP_FLAG_VENDOR, /* Fixed flags */
385 AVP_FLAG_VENDOR, /* Fixed flag values */
386 AVP_TYPE_OCTETSTRING /* base type of data */
387 };
388 CHECK_dict_new(DICT_AVP, &data, UTF8String_type, NULL);
389 };
390
391 /* SN-Fast-Reauth-Username */
392 {
393 struct dict_avp_data data = {
394 11010, /* Code */
395 8164, /* Vendor */
396 "SN-Fast-Reauth-Username", /* Name */
397 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flags */
398 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flag values */
399 AVP_TYPE_OCTETSTRING /* base type of data */
400 };
401 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
402 };
403
404 /* SN-Pseudonym-Username */
405 {
406 struct dict_avp_data data = {
407 11011, /* Code */
408 8164, /* Vendor */
409 "SN-Pseudonym-Username", /* Name */
410 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flags */
411 AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, /* Fixed flag values */
412 AVP_TYPE_OCTETSTRING /* base type of data */
413 };
414 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
415 };
416
417
418
419 /* Rules section */
420
421 /* SN-Remaining-Service-Unit */
422 {
423 struct dict_object *rule_avp;
424 struct dict_avp_request vpa;
425 vpa.avp_vendor = 8164;
426 vpa.avp_name = "SN-Remaining-Service-Unit";
427 CHECK_dict_search(DICT_AVP, AVP_BY_NAME_AND_VENDOR, &vpa, &rule_avp);
428 struct local_rules_definition rules[] = {
429 { "Tariff-Change-Usage", RULE_OPTIONAL, -1, 1 },
430 { "CC-Time", RULE_OPTIONAL, -1, 1 },
431 { "CC-Total-Octets", RULE_OPTIONAL, -1, 1 },
432 { "CC-Input-Octets", RULE_OPTIONAL, -1, 1 },
433 { "CC-Output-Octets", RULE_OPTIONAL, -1, 1 },
434 { "CC-Service-Specific-Units", RULE_OPTIONAL, -1, 1 },
435 { "Reporting-Reason", RULE_OPTIONAL, -1, 1 }
436 };
437 PARSE_loc_rules( rules, rule_avp );
438 }
439
440 /* SN-Total-Used-Service-Unit */
441 {
442 struct dict_object *rule_avp;
443 struct dict_avp_request vpa;
444 vpa.avp_vendor = 8164;
445 vpa.avp_name = "SN-Total-Used-Service-Unit";
446 CHECK_dict_search(DICT_AVP, AVP_BY_NAME_AND_VENDOR, &vpa, &rule_avp);
447 struct local_rules_definition rules[] = {
448 { "Tariff-Change-Usage", RULE_OPTIONAL, -1, 1 },
449 { "CC-Time", RULE_OPTIONAL, -1, 1 },
450 { "CC-Total-Octets", RULE_OPTIONAL, -1, 1 },
451 { "CC-Input-Octets", RULE_OPTIONAL, -1, 1 },
452 { "CC-Output-Octets", RULE_OPTIONAL, -1, 1 },
453 { "CC-Service-Specific-Units", RULE_OPTIONAL, -1, 1 },
454 { "Reporting-Reason", RULE_OPTIONAL, -1, 1 }
455 };
456 PARSE_loc_rules( rules, rule_avp );
457 }
458
459 /* SN-Usage-Monitoring-Control */
460 {
461 struct dict_object *rule_avp;
462 struct dict_avp_request vpa;
463 vpa.avp_vendor = 8164;
464 vpa.avp_name = "SN-Usage-Monitoring-Control";
465 CHECK_dict_search(DICT_AVP, AVP_BY_NAME_AND_VENDOR, &vpa, &rule_avp);
466 struct local_rules_definition rules[] = {
467 { "SN-Monitoring-Key", RULE_OPTIONAL, -1, 1 },
468 { "SN-Usage-Monitoring", RULE_OPTIONAL, -1, 1 },
469 { "SN-Usage-Volume", RULE_OPTIONAL, -1, 1 },
470 };
471 PARSE_loc_rules( rules, rule_avp );
472 }
473
474 LOG_D( "Extension 'Dictionary definitions for DCCA Starent' initialized");
475 return 0;
476}
477
478EXTENSION_ENTRY("dict_dcca_starent", dict_dcca_starent_entry, "dict_dcca_3gpp");