blob: 5d9460319539b7d43bfcc8730fc05348281d0533 [file] [log] [blame]
Brian Waters13d96012017-12-08 16:53:31 -06001/****************
2 Contributed by: Konstantin Chekushin <koch@lmt.lv> and Thomas Klausner <tk@giga.or.at>
3 License: same as freeDiameter
4****************/
5
6
7/*
8 * Dictionary definitions of objects specified in DCCA (rfc4006).
9 */
10#include <freeDiameter/extension.h>
11
12
13/* The content of this file follows the same structure as dict_base_proto.c */
14
15#define CHECK_dict_new( _type, _data, _parent, _ref ) \
16 CHECK_FCT( fd_dict_new( fd_g_config->cnf_dict, (_type), (_data), (_parent), (_ref)) );
17
18#define CHECK_dict_search( _type, _criteria, _what, _result ) \
19 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
20
21struct local_rules_definition {
22 char *avp_name;
23 enum rule_position position;
24 int min;
25 int max;
26};
27
28#define RULE_ORDER( _position ) ((((_position) == RULE_FIXED_HEAD) || ((_position) == RULE_FIXED_TAIL)) ? 1 : 0 )
29
30#define PARSE_loc_rules( _rulearray, _parent) { \
31 int __ar; \
32 for (__ar=0; __ar < sizeof(_rulearray) / sizeof((_rulearray)[0]); __ar++) { \
33 struct dict_rule_data __data = { NULL, \
34 (_rulearray)[__ar].position, \
35 0, \
36 (_rulearray)[__ar].min, \
37 (_rulearray)[__ar].max}; \
38 __data.rule_order = RULE_ORDER(__data.rule_position); \
39 CHECK_FCT( fd_dict_search( \
40 fd_g_config->cnf_dict, \
41 DICT_AVP, \
42 AVP_BY_NAME, \
43 (_rulearray)[__ar].avp_name, \
44 &__data.rule_avp, 0 ) ); \
45 if ( !__data.rule_avp ) { \
46 TRACE_DEBUG(INFO, "AVP Not found: '%s'", (_rulearray)[__ar].avp_name ); \
47 return ENOENT; \
48 } \
49 CHECK_FCT_DO( fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &__data, _parent, NULL), \
50 { \
51 TRACE_DEBUG(INFO, "Error on rule with AVP '%s'", \
52 (_rulearray)[__ar].avp_name ); \
53 return EINVAL; \
54 } ); \
55 } \
56 }
57
58#define enumval_def_u32( _val_, _str_ ) \
59 { _str_, { .u32 = _val_ }}
60
61#define enumval_def_os( _len_, _val_, _str_ ) \
62 { _str_, { .os = { .data = (unsigned char *)_val_, .len = _len_ }}}
63
64
65static int dict_dcca_entry(char * conffile)
66{
67 struct dict_object * dcca;
68 TRACE_ENTRY("%p", conffile);
69
70 /* Applications section */
71 {
72 /* DCCA */
73 {
74 struct dict_application_data data = { 4, "Diameter Credit Control Application" };
75 CHECK_dict_new( DICT_APPLICATION, &data, NULL, &dcca);
76 }
77 }
78
79 /* Result codes */
80 {
81 struct dict_object *ResultCodeType;
82 CHECK_dict_search(DICT_TYPE, TYPE_BY_NAME, "Enumerated(Result-Code)", &ResultCodeType);
83
84 {
85 struct dict_enumval_data error_code = {"END_USER_SERVICE_DENIED",
86 { .u32 = 4010}};
87 CHECK_dict_new(DICT_ENUMVAL, &error_code, ResultCodeType, NULL);
88 }
89 {
90 struct dict_enumval_data error_code = {"CREDIT_CONTROL_NOT_APPLICABLE",
91 { .u32 = 4011}};
92 CHECK_dict_new(DICT_ENUMVAL, &error_code, ResultCodeType, NULL);
93 }
94 {
95 struct dict_enumval_data error_code = {"CREDIT_LIMIT_REACHED",
96 { .u32 = 4012}};
97 CHECK_dict_new(DICT_ENUMVAL, &error_code, ResultCodeType, NULL);
98 }
99 {
100 struct dict_enumval_data error_code = {"USER_UNKNOWN",
101 { .u32 = 5030}};
102 CHECK_dict_new(DICT_ENUMVAL, &error_code, ResultCodeType, NULL);
103 }
104 {
105 struct dict_enumval_data error_code = {"RATING_FAILED",
106 { .u32 = 5031}};
107 CHECK_dict_new(DICT_ENUMVAL, &error_code, ResultCodeType, NULL);
108 }
109
110 }
111
112
113
114 /* AVP section */
115 {
116 struct dict_object * Address_type;
117 struct dict_object * UTF8String_type;
118 struct dict_object * DiameterIdentity_type;
119 struct dict_object * DiameterURI_type;
120 struct dict_object * Time_type;
121 struct dict_object * IPFilterRule_type;
122
123 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Address", &Address_type);
124 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "UTF8String", &UTF8String_type);
125 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterIdentity", &DiameterIdentity_type);
126 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterURI", &DiameterURI_type);
127 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Time", &Time_type);
128 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "IPFilterRule", &IPFilterRule_type);
129
130
131 /* CC-Correlation-Id */
132 {
133 /*
134 OctetString.
135 */
136 struct dict_avp_data data = {
137 411, /* Code */
138 0, /* Vendor */
139 "CC-Correlation-Id", /* Name */
140 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
141 AVP_FLAG_MANDATORY, /* Fixed flag values */
142 AVP_TYPE_OCTETSTRING /* base type of data */
143 };
144
145 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
146 }
147
148 /* CC-Input-Octets */
149 {
150 /*
151 Unsigned64.
152 */
153 struct dict_avp_data data = {
154 412, /* Code */
155 0, /* Vendor */
156 "CC-Input-Octets", /* Name */
157 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
158 AVP_FLAG_MANDATORY, /* Fixed flag values */
159 AVP_TYPE_UNSIGNED64 /* base type of data */
160 };
161 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
162 }
163
164 /* CC-Output-Octets */
165 {
166 /*
167 Unsigned64.
168 */
169 struct dict_avp_data data = {
170 414, /* Code */
171 0, /* Vendor */
172 "CC-Output-Octets", /* Name */
173 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
174 AVP_FLAG_MANDATORY, /* Fixed flag values */
175 AVP_TYPE_UNSIGNED64 /* base type of data */
176 };
177 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
178 }
179
180 /* CC-Request-Number */
181 {
182 /*
183 Unsigned32.
184 */
185 struct dict_avp_data data = {
186 415, /* Code */
187 0, /* Vendor */
188 "CC-Request-Number", /* Name */
189 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
190 AVP_FLAG_MANDATORY, /* Fixed flag values */
191 AVP_TYPE_UNSIGNED32 /* base type of data */
192 };
193 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
194 }
195
196 /* CC-Request-Type */
197 {
198 /*
199 Enumerated.
200 */
201
202 struct dict_object *type;
203 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(CC-Request-Type)", NULL, NULL, NULL };
204 struct dict_enumval_data t_1 = { "INITIAL_REQUEST", { .i32 = 1 }};
205 struct dict_enumval_data t_2 = { "UPDATE_REQUEST", { .i32 = 2 }};
206 struct dict_enumval_data t_3 = { "TERMINATION_REQUEST", { .i32 = 3 }};
207 struct dict_enumval_data t_4 = { "EVENT_REQUEST", { .i32 = 4 }};
208
209
210 struct dict_avp_data data = {
211 416, /* Code */
212 0, /* Vendor */
213 "CC-Request-Type", /* Name */
214 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
215 AVP_FLAG_MANDATORY, /* Fixed flag values */
216 AVP_TYPE_INTEGER32 /* base type of data */
217 };
218 /* Create the Enumerated type, and then the AVP */
219 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
220 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL);
221 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL);
222 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL);
223 CHECK_dict_new( DICT_ENUMVAL, &t_4 , type, NULL);
224 CHECK_dict_new( DICT_AVP, &data , type, NULL);
225 }
226
227
228 /* CC-Service-Specific-Units */
229 {
230 /*
231 Unsigned64.
232 */
233 struct dict_avp_data data = {
234 417, /* Code */
235 0, /* Vendor */
236 "CC-Service-Specific-Units", /* Name */
237 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
238 AVP_FLAG_MANDATORY, /* Fixed flag values */
239 AVP_TYPE_UNSIGNED64 /* base type of data */
240 };
241 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
242 }
243
244 /* CC-Session-Failover */
245 {
246 /*
247 Enumerated.
248 */
249
250 struct dict_object *type;
251 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(CC-Session-Failover)" , NULL, NULL, NULL };
252 struct dict_enumval_data t_1 = { "FAILOVER_NOT_SUPPORTED", { .i32 = 0 }};
253 struct dict_enumval_data t_2 = { "FAILOVER_SUPPORTED", { .i32 = 1 }};
254
255
256 struct dict_avp_data data = {
257 418, /* Code */
258 0, /* Vendor */
259 "CC-Session-Failover", /* Name */
260 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
261 AVP_FLAG_MANDATORY, /* Fixed flag values */
262 AVP_TYPE_INTEGER32 /* base type of data */
263 };
264 /* Create the Enumerated type, and then the AVP */
265 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
266 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL);
267 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL);
268 CHECK_dict_new( DICT_AVP, &data , type, NULL);
269 }
270
271 /* CC-Sub-Session-Id */
272 {
273 /*
274 Unsigned64.
275 */
276 struct dict_avp_data data = {
277 419, /* Code */
278 0, /* Vendor */
279 "CC-Sub-Session-Id", /* Name */
280 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
281 AVP_FLAG_MANDATORY, /* Fixed flag values */
282 AVP_TYPE_UNSIGNED64 /* base type of data */
283 };
284 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
285 }
286
287 /* CC-Time */
288 {
289 /*
290 Unsigned32.
291 */
292 struct dict_avp_data data = {
293 420, /* Code */
294 0, /* Vendor */
295 "CC-Time", /* Name */
296 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
297 AVP_FLAG_MANDATORY, /* Fixed flag values */
298 AVP_TYPE_UNSIGNED32 /* base type of data */
299 };
300 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
301 }
302
303 /* CC-Total-Octets */
304 {
305 /*
306 Unsigned64.
307 */
308 struct dict_avp_data data = {
309 421, /* Code */
310 0, /* Vendor */
311 "CC-Total-Octets", /* Name */
312 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
313 AVP_FLAG_MANDATORY, /* Fixed flag values */
314 AVP_TYPE_UNSIGNED64 /* base type of data */
315 };
316 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
317 }
318
319 /* CC-Unit-Type */
320 {
321 /*
322 Enumerated.
323 */
324
325 struct dict_object *type;
326 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(CC-Unit-Type)" , NULL, NULL, NULL };
327 struct dict_enumval_data t_1 = { "TIME", { .i32 = 0 }};
328 struct dict_enumval_data t_2 = { "MONEY", { .i32 = 1 }};
329 struct dict_enumval_data t_3 = { "TOTAL-OCTETS", { .i32 = 2 }};
330 struct dict_enumval_data t_4 = { "INPUT-OCTETS", { .i32 = 3 }};
331 struct dict_enumval_data t_5 = { "OUTPUT-OCTETS", { .i32 = 4 }};
332 struct dict_enumval_data t_6 = { "SERVICE-SPECIFIC-UNITS", { .i32 = 5 }};
333
334
335 struct dict_avp_data data = {
336 454, /* Code */
337 0, /* Vendor */
338 "CC-Unit-Type", /* Name */
339 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
340 AVP_FLAG_MANDATORY, /* Fixed flag values */
341 AVP_TYPE_INTEGER32 /* base type of data */
342 };
343 /* Create the Enumerated type, and then the AVP */
344 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
345 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL);
346 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL);
347 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL);
348 CHECK_dict_new( DICT_ENUMVAL, &t_4 , type, NULL);
349 CHECK_dict_new( DICT_ENUMVAL, &t_5 , type, NULL);
350 CHECK_dict_new( DICT_ENUMVAL, &t_6 , type, NULL);
351 CHECK_dict_new( DICT_AVP, &data , type, NULL);
352 }
353
354 /* Check-Balance-Result */
355 {
356 /*
357 Enumerated.
358 */
359
360 struct dict_object *type;
361 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Check-Balance-Result)" , NULL, NULL, NULL };
362 struct dict_enumval_data t_1 = { "ENOUGH_CREDIT", { .i32 = 0 }};
363 struct dict_enumval_data t_2 = { "NO_CREDIT", { .i32 = 1 }};
364
365
366 struct dict_avp_data data = {
367 422, /* Code */
368 0, /* Vendor */
369 "Check-Balance-Result", /* Name */
370 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
371 AVP_FLAG_MANDATORY, /* Fixed flag values */
372 AVP_TYPE_INTEGER32 /* base type of data */
373 };
374 /* Create the Enumerated type, and then the AVP */
375 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
376 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL);
377 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL);
378 CHECK_dict_new( DICT_AVP, &data , type, NULL);
379 }
380
381 /* Cost-Unit */
382 {
383 /*
384 UTF8String.
385 */
386 struct dict_avp_data data = {
387 424, /* Code */
388 0, /* Vendor */
389 "Cost-Unit", /* Name */
390 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
391 AVP_FLAG_MANDATORY, /* Fixed flag values */
392 AVP_TYPE_OCTETSTRING /* base type of data */
393 };
394 CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL);
395 }
396
397 /* Credit-Control */
398 {
399 /*
400 Enumerated.
401 */
402
403 struct dict_object *type;
404 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Credit-Control)" , NULL, NULL, NULL };
405 struct dict_enumval_data t_1 = { "CREDIT_AUTHORIZATION", { .i32 = 0 }};
406 struct dict_enumval_data t_2 = { "RE_AUTHORIZATION", { .i32 = 1 }};
407
408 struct dict_avp_data data = {
409 426, /* Code */
410 0, /* Vendor */
411 "Credit-Control", /* Name */
412 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
413 AVP_FLAG_MANDATORY, /* Fixed flag values */
414 AVP_TYPE_INTEGER32 /* base type of data */
415 };
416 /* Create the Enumerated type, and then the AVP */
417 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
418 CHECK_dict_new( DICT_ENUMVAL, &t_1, type, NULL);
419 CHECK_dict_new( DICT_ENUMVAL, &t_2, type, NULL);
420 CHECK_dict_new( DICT_AVP, &data , type, NULL);
421 }
422
423 /* Credit-Control-Failure-Handling */
424 {
425 /*
426 Enumerated.
427 */
428
429 struct dict_object *type;
430 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Credit-Control-Failure-Handling)" , NULL, NULL, NULL };
431 struct dict_enumval_data t_1 = { "TERMINATE", { .i32 = 0 }};
432 struct dict_enumval_data t_2 = { "CONTINUE", { .i32 = 1 }};
433 struct dict_enumval_data t_3 = { "RETRY_AND_TERMINATE", { .i32 = 2 }};
434
435 struct dict_avp_data data = {
436 427, /* Code */
437 0, /* Vendor */
438 "Credit-Control-Failure-Handling", /* Name */
439 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
440 AVP_FLAG_MANDATORY, /* Fixed flag values */
441 AVP_TYPE_INTEGER32 /* base type of data */
442 };
443 /* Create the Enumerated type, and then the AVP */
444 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
445 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL);
446 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL);
447 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL);
448 CHECK_dict_new( DICT_AVP, &data , type, NULL);
449 }
450
451 /* Currency-Code */
452 {
453 /*
454 Unsigned32.
455 */
456 struct dict_avp_data data = {
457 425, /* Code */
458 0, /* Vendor */
459 "Currency-Code", /* Name */
460 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
461 AVP_FLAG_MANDATORY, /* Fixed flag values */
462 AVP_TYPE_UNSIGNED32 /* base type of data */
463 };
464 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
465 }
466
467 /* Direct-Debiting-Failure-Handling */
468 {
469 /*
470 Enumerated.
471 */
472
473 struct dict_object *type;
474 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Direct-Debiting-Failure-Handling)" , NULL, NULL, NULL };
475 struct dict_enumval_data t_1 = { "TERMINATE_OR_BUFFER", { .i32 = 0 }};
476 struct dict_enumval_data t_2 = { "CONTINUE", { .i32 = 1 }};
477
478 struct dict_avp_data data = {
479 428, /* Code */
480 0, /* Vendor */
481 "Direct-Debiting-Failure-Handling", /* Name */
482 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
483 AVP_FLAG_MANDATORY, /* Fixed flag values */
484 AVP_TYPE_INTEGER32 /* base type of data */
485 };
486 /* Create the Enumerated type, and then the AVP */
487 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
488 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL);
489 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL);
490 CHECK_dict_new( DICT_AVP, &data , type, NULL);
491 }
492
493 /* Exponent */
494 {
495 /*
496 Integer32.
497 */
498 struct dict_avp_data data = {
499 429, /* Code */
500 0, /* Vendor */
501 "Exponent", /* Name */
502 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
503 AVP_FLAG_MANDATORY, /* Fixed flag values */
504 AVP_TYPE_INTEGER32 /* base type of data */
505 };
506 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
507 }
508
509 /* Final-Unit-Action */
510 {
511 /*
512 Enumerated.
513 */
514
515 struct dict_object *type;
516 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Final-Unit-Action)" , NULL, NULL, NULL };
517 struct dict_enumval_data t_1 = { "TERMINATE", { .i32 = 0 }};
518 struct dict_enumval_data t_2 = { "REDIRECT", { .i32 = 1 }};
519 struct dict_enumval_data t_3 = { "RESTRICT_ACCESS", { .i32 = 2 }};
520
521 struct dict_avp_data data = {
522 449, /* Code */
523 0, /* Vendor */
524 "Final-Unit-Action", /* Name */
525 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
526 AVP_FLAG_MANDATORY, /* Fixed flag values */
527 AVP_TYPE_INTEGER32 /* base type of data */
528 };
529 /* Create the Enumerated type, and then the AVP */
530 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
531 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL);
532 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL);
533 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL);
534 CHECK_dict_new( DICT_AVP, &data , type, NULL);
535 }
536
537 /* G-S-U-Pool-Identifier */
538 {
539 /*
540 Unsigned32.
541 */
542 struct dict_avp_data data = {
543 453, /* Code */
544 0, /* Vendor */
545 "G-S-U-Pool-Identifier", /* Name */
546 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
547 AVP_FLAG_MANDATORY, /* Fixed flag values */
548 AVP_TYPE_UNSIGNED32 /* base type of data */
549 };
550 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
551 }
552
553 /* Multiple-Services-Indicator */
554 {
555 /*
556 Enumerated.
557 */
558
559 struct dict_object *type;
560 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Multiple-Services-Indicator)" , NULL, NULL, NULL };
561 struct dict_enumval_data t_1 = { "MULTIPLE_SERVICES_NOT_SUPPORTED", { .i32 = 0 }};
562 struct dict_enumval_data t_2 = { "MULTIPLE_SERVICES_SUPPORTED", { .i32 = 1 }};
563
564 struct dict_avp_data data = {
565 455, /* Code */
566 0, /* Vendor */
567 "Multiple-Services-Indicator", /* Name */
568 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
569 AVP_FLAG_MANDATORY, /* Fixed flag values */
570 AVP_TYPE_INTEGER32 /* base type of data */
571 };
572 /* Create the Enumerated type, and then the AVP */
573 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
574 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL);
575 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL);
576 CHECK_dict_new( DICT_AVP, &data , type, NULL);
577 }
578
579 /* Rating-Group */
580 {
581 /*
582 Unsigned32.
583 */
584 struct dict_avp_data data = {
585 432, /* Code */
586 0, /* Vendor */
587 "Rating-Group", /* Name */
588 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
589 AVP_FLAG_MANDATORY, /* Fixed flag values */
590 AVP_TYPE_UNSIGNED32 /* base type of data */
591 };
592 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
593 }
594
595 /* Redirect-Address-Type */
596 {
597 /*
598 Enumerated.
599 */
600
601 struct dict_object *type;
602 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Redirect-Address-Type)" , NULL, NULL, NULL };
603 struct dict_enumval_data t_1 = { "IPV4_ADDRESS", { .i32 = 0 }};
604 struct dict_enumval_data t_2 = { "IPV6_ADDRESS", { .i32 = 1 }};
605 struct dict_enumval_data t_3 = { "URL", { .i32 = 2 }};
606 struct dict_enumval_data t_4 = { "SIP_URI", { .i32 = 3 }};
607
608 struct dict_avp_data data = {
609 433, /* Code */
610 0, /* Vendor */
611 "Redirect-Address-Type", /* Name */
612 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
613 AVP_FLAG_MANDATORY, /* Fixed flag values */
614 AVP_TYPE_INTEGER32 /* base type of data */
615 };
616 /* Create the Enumerated type, and then the AVP */
617 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
618 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL);
619 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL);
620 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL);
621 CHECK_dict_new( DICT_ENUMVAL, &t_4 , type, NULL);
622 CHECK_dict_new( DICT_AVP, &data , type, NULL);
623 }
624
625 /* Redirect-Server-Address */
626 {
627 /*
628 UTF8String.
629 */
630 struct dict_avp_data data = {
631 435, /* Code */
632 0, /* Vendor */
633 "Redirect-Server-Address", /* Name */
634 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
635 AVP_FLAG_MANDATORY, /* Fixed flag values */
636 AVP_TYPE_OCTETSTRING /* base type of data */
637 };
638 CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL);
639 }
640
641 /* Requested-Action */
642 {
643 /*
644 Enumerated.
645 */
646
647 struct dict_object *type;
648 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Requested-Action)" , NULL, NULL, NULL };
649 struct dict_enumval_data t_1 = { "DIRECT_DEBITING", { .i32 = 0 }};
650 struct dict_enumval_data t_2 = { "REFUND_ACCOUNT", { .i32 = 1 }};
651 struct dict_enumval_data t_3 = { "CHECK_BALANCE", { .i32 = 2 }};
652 struct dict_enumval_data t_4 = { "PRICE_ENQUIRY", { .i32 = 3 }};
653
654 struct dict_avp_data data = {
655 436, /* Code */
656 0, /* Vendor */
657 "Requested-Action", /* Name */
658 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
659 AVP_FLAG_MANDATORY, /* Fixed flag values */
660 AVP_TYPE_INTEGER32 /* base type of data */
661 };
662 /* Create the Enumerated type, and then the AVP */
663 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
664 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL);
665 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL);
666 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL);
667 CHECK_dict_new( DICT_ENUMVAL, &t_4 , type, NULL);
668 CHECK_dict_new( DICT_AVP, &data , type, NULL);
669 }
670
671 /* Restriction-Filter-Rule */
672 {
673 /*
674 IPFiltrRule.
675 */
676 struct dict_avp_data data = {
677 438, /* Code */
678 0, /* Vendor */
679 "Restriction-Filter-Rule", /* Name */
680 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
681 AVP_FLAG_MANDATORY, /* Fixed flag values */
682 AVP_TYPE_OCTETSTRING /* base type of data */
683 };
684 CHECK_dict_new( DICT_AVP, &data , IPFilterRule_type, NULL);
685 }
686 /*Service-Context-Id */
687 {
688 /*
689 UTF8String.
690 */
691 struct dict_avp_data data = {
692 461, /* Code */
693 0, /* Vendor */
694 "Service-Context-Id", /* Name */
695 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
696 AVP_FLAG_MANDATORY, /* Fixed flag values */
697 AVP_TYPE_OCTETSTRING /* base type of data */
698 };
699 CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL);
700 }
701
702 /* Service-Identifier */
703 {
704 /*
705 Unsigned32.
706 */
707 struct dict_avp_data data = {
708 439, /* Code */
709 0, /* Vendor */
710 "Service-Identifier", /* Name */
711 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
712 AVP_FLAG_MANDATORY, /* Fixed flag values */
713 AVP_TYPE_UNSIGNED32 /* base type of data */
714 };
715 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
716 }
717
718 /* Service-Parameter-Type */
719 {
720 /*
721 Unsigned32.
722 */
723 struct dict_avp_data data = {
724 441, /* Code */
725 0, /* Vendor */
726 "Service-Parameter-Type", /* Name */
727 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
728 AVP_FLAG_MANDATORY, /* Fixed flag values */
729 AVP_TYPE_UNSIGNED32 /* base type of data */
730 };
731 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
732 }
733
734 /* Service-Parameter-Value */
735 {
736 /*
737 OctetString.
738 */
739 struct dict_avp_data data = {
740 442, /* Code */
741 0, /* Vendor */
742 "Service-Parameter-Value", /* Name */
743 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
744 AVP_FLAG_MANDATORY, /* Fixed flag values */
745 AVP_TYPE_OCTETSTRING /* base type of data */
746 };
747 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
748 }
749
750 /* Subscription-Id-Data */
751 {
752 /*
753 UTF8String.
754 */
755 struct dict_avp_data data = {
756 444, /* Code */
757 0, /* Vendor */
758 "Subscription-Id-Data", /* Name */
759 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
760 AVP_FLAG_MANDATORY, /* Fixed flag values */
761 AVP_TYPE_OCTETSTRING /* base type of data */
762 };
763 CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL);
764 }
765
766 /* Subscription-Id-Type */
767 {
768 /*
769 Enumerated.
770 */
771
772 struct dict_object *type;
773 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Subscription-Id-Type)" , NULL, NULL, NULL };
774 struct dict_enumval_data t_1 = { "END_USER_E164", { .i32 = 0 }};
775 struct dict_enumval_data t_2 = { "END_USER_IMSI", { .i32 = 1 }};
776 struct dict_enumval_data t_3 = { "END_USER_SIP_URI", { .i32 = 2 }};
777 struct dict_enumval_data t_4 = { "END_USER_NAI", { .i32 = 3 }};
778
779 struct dict_avp_data data = {
780 450, /* Code */
781 0, /* Vendor */
782 "Subscription-Id-Type", /* Name */
783 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
784 AVP_FLAG_MANDATORY, /* Fixed flag values */
785 AVP_TYPE_INTEGER32 /* base type of data */
786 };
787 /* Create the Enumerated type, and then the AVP */
788 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
789 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL);
790 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL);
791 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL);
792 CHECK_dict_new( DICT_ENUMVAL, &t_4 , type, NULL);
793 CHECK_dict_new( DICT_AVP, &data , type, NULL);
794 }
795
796 /* Tariff-Change-Usage */
797 {
798 /*
799 Enumerated.
800 */
801
802 struct dict_object *type;
803 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Tariff-Change-Usage)" , NULL, NULL, NULL };
804 struct dict_enumval_data t_1 = { "UNIT_BEFORE_TARIFF_CHANGE", { .i32 = 0 }};
805 struct dict_enumval_data t_2 = { "UNIT_AFTER_TARIFF_CHANGE", { .i32 = 1 }};
806 struct dict_enumval_data t_3 = { "UNIT_INDETERMINATE", { .i32 = 2 }};
807
808 struct dict_avp_data data = {
809 452, /* Code */
810 0, /* Vendor */
811 "Tariff-Change-Usage", /* Name */
812 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
813 AVP_FLAG_MANDATORY, /* Fixed flag values */
814 AVP_TYPE_INTEGER32 /* base type of data */
815 };
816 /* Create the Enumerated type, and then the AVP */
817 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
818 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL);
819 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL);
820 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL);
821 CHECK_dict_new( DICT_AVP, &data , type, NULL);
822 }
823
824 /* Tariff-Time-Change */
825 {
826 /*
827 Time.
828 */
829 struct dict_avp_data data = {
830 451, /* Code */
831 0, /* Vendor */
832 "Tariff-Time-Change", /* Name */
833 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
834 AVP_FLAG_MANDATORY, /* Fixed flag values */
835 AVP_TYPE_OCTETSTRING /* base type of data */
836 };
837 CHECK_dict_new( DICT_AVP, &data , Time_type, NULL);
838 }
839
840 /* User-Equipment-Info-Type */
841 {
842 /*
843 Enumerated.
844 */
845
846 struct dict_object *type;
847 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(User-Equipment-Info-Type)" , NULL, NULL, NULL };
848 struct dict_enumval_data t_1 = { "IMEISV", { .i32 = 0 }};
849 struct dict_enumval_data t_2 = { "MAC", { .i32 = 1 }};
850 struct dict_enumval_data t_3 = { "EUI64", { .i32 = 2 }};
851
852 struct dict_avp_data data = {
853 459, /* Code */
854 0, /* Vendor */
855 "User-Equipment-Info-Type", /* Name */
856 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
857 AVP_FLAG_MANDATORY, /* Fixed flag values */
858 AVP_TYPE_INTEGER32 /* base type of data */
859 };
860 /* Create the Enumerated type, and then the AVP */
861 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type);
862 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL);
863 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL);
864 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL);
865 CHECK_dict_new( DICT_AVP, &data , type, NULL);
866 }
867
868 /* User-Equipment-Info-Value */
869 {
870 /*
871 OctetString.
872 */
873 struct dict_avp_data data = {
874 460, /* Code */
875 0, /* Vendor */
876 "User-Equipment-Info-Value", /* Name */
877 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
878 AVP_FLAG_MANDATORY, /* Fixed flag values */
879 AVP_TYPE_OCTETSTRING /* base type of data */
880 };
881 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
882 }
883
884 /* Value-Digits */
885 {
886 /*
887 Integer64.
888 */
889 struct dict_avp_data data = {
890 447, /* Code */
891 0, /* Vendor */
892 "Value-Digits", /* Name */
893 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
894 AVP_FLAG_MANDATORY, /* Fixed flag values */
895 AVP_TYPE_INTEGER64 /* base type of data */
896 };
897 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
898 }
899
900 /* Validity-Time */
901 {
902 /*
903 Unsigned32.
904 */
905 struct dict_avp_data data = {
906 448, /* Code */
907 0, /* Vendor */
908 "Validity-Time", /* Name */
909 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
910 AVP_FLAG_MANDATORY, /* Fixed flag values */
911 AVP_TYPE_UNSIGNED32 /* base type of data */
912 };
913 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
914 }
915
916
917 /* Grouped AVPs below since they have dependencies on types above */
918
919 /* Redirect-Server */
920 {
921 /*
922 Grouped
923 */
924 struct dict_object * avp;
925 struct dict_avp_data data = {
926 434, /* Code */
927 0, /* Vendor */
928 "Redirect-Server", /* Name */
929 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
930 AVP_FLAG_MANDATORY, /* Fixed flag values */
931 AVP_TYPE_GROUPED /* base type of data */
932 };
933 struct local_rules_definition rules[] = {
934 { "Redirect-Address-Type", RULE_REQUIRED, -1, 1 },
935 { "Redirect-Server-Address", RULE_REQUIRED, -1, 1 }
936 };
937 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
938 PARSE_loc_rules( rules, avp );
939 }
940
941 /* Service-Parameter-Info */
942 {
943 /*
944 Grouped
945 */
946 struct dict_object * avp;
947 struct dict_avp_data data = {
948 440, /* Code */
949 0, /* Vendor */
950 "Service-Parameter-Info", /* Name */
951 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
952 AVP_FLAG_MANDATORY, /* Fixed flag values */
953 AVP_TYPE_GROUPED /* base type of data */
954 };
955 struct local_rules_definition rules[] = {
956 { "Service-Parameter-Type", RULE_REQUIRED, -1, 1 },
957 { "Service-Parameter-Value", RULE_REQUIRED, -1, 1 }
958 };
959 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
960 PARSE_loc_rules( rules, avp );
961 }
962
963 /* Subscription-Id */
964 {
965 /*
966 Grouped
967 */
968 struct dict_object * avp;
969 struct dict_avp_data data = {
970 443, /* Code */
971 0, /* Vendor */
972 "Subscription-Id", /* Name */
973 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
974 AVP_FLAG_MANDATORY, /* Fixed flag values */
975 AVP_TYPE_GROUPED /* base type of data */
976 };
977 struct local_rules_definition rules[] = {
978 { "Subscription-Id-Type", RULE_REQUIRED, -1, 1 },
979 { "Subscription-Id-Data", RULE_REQUIRED, -1, 1 }
980 };
981 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
982 PARSE_loc_rules( rules, avp );
983 }
984
985 /* Unit-Value */
986 {
987 /*
988 Grouped
989 */
990 struct dict_object * avp;
991 struct dict_avp_data data = {
992 445, /* Code */
993 0, /* Vendor */
994 "Unit-Value", /* Name */
995 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
996 AVP_FLAG_MANDATORY, /* Fixed flag values */
997 AVP_TYPE_GROUPED /* base type of data */
998 };
999 struct local_rules_definition rules[] = {
1000 { "Value-Digits", RULE_REQUIRED, -1, 1 },
1001 { "Exponent", RULE_OPTIONAL, -1, 1 }
1002 };
1003 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
1004 PARSE_loc_rules( rules, avp );
1005 }
1006
1007 /* User-Equipment-Info */
1008 {
1009 /*
1010 Grouped
1011 */
1012 struct dict_object * avp;
1013 struct dict_avp_data data = {
1014 458, /* Code */
1015 0, /* Vendor */
1016 "User-Equipment-Info", /* Name */
1017 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
1018 AVP_FLAG_MANDATORY, /* Fixed flag values */
1019 AVP_TYPE_GROUPED /* base type of data */
1020 };
1021 struct local_rules_definition rules[] = {
1022 { "User-Equipment-Info-Type", RULE_REQUIRED, -1, 1 },
1023 { "User-Equipment-Info-Value", RULE_REQUIRED, -1, 1 }
1024 };
1025 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
1026 PARSE_loc_rules( rules, avp );
1027 }
1028
1029 /* grouped AVPs using grouped AVPs */
1030
1031 /* CC-Money */
1032 {
1033 /*
1034 Grouped
1035 */
1036 struct dict_object * avp;
1037 struct dict_avp_data data = {
1038 413, /* Code */
1039 0, /* Vendor */
1040 "CC-Money", /* Name */
1041 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
1042 AVP_FLAG_MANDATORY, /* Fixed flag values */
1043 AVP_TYPE_GROUPED /* base type of data */
1044 };
1045 struct local_rules_definition rules[] = {
1046 { "Unit-Value", RULE_REQUIRED, -1, 1 },
1047 { "Currency-Code", RULE_OPTIONAL, -1, 1 }
1048 };
1049 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
1050 PARSE_loc_rules( rules, avp );
1051 }
1052
1053 /* Cost-Information */
1054 {
1055 /*
1056 Grouped
1057 */
1058 struct dict_object * avp;
1059 struct dict_avp_data data = {
1060 423, /* Code */
1061 0, /* Vendor */
1062 "Cost-Information", /* Name */
1063 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
1064 AVP_FLAG_MANDATORY, /* Fixed flag values */
1065 AVP_TYPE_GROUPED /* base type of data */
1066 };
1067 struct local_rules_definition rules[] = {
1068 { "Unit-Value", RULE_REQUIRED, -1, 1 },
1069 { "Currency-Code", RULE_REQUIRED, -1, 1 },
1070 { "Cost-Unit", RULE_OPTIONAL, -1, 1 }
1071 };
1072 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
1073 PARSE_loc_rules( rules, avp );
1074 }
1075
1076 /* Final-Unit-Indication */
1077 {
1078 /*
1079 Grouped
1080 */
1081 struct dict_object * avp;
1082 struct dict_avp_data data = {
1083 430, /* Code */
1084 0, /* Vendor */
1085 "Final-Unit-Indication", /* Name */
1086 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
1087 AVP_FLAG_MANDATORY, /* Fixed flag values */
1088 AVP_TYPE_GROUPED /* base type of data */
1089 };
1090 struct local_rules_definition rules[] = {
1091 { "Final-Unit-Action", RULE_REQUIRED, -1, 1 },
1092 { "Restriction-Filter-Rule", RULE_OPTIONAL, -1, -1 },
1093 { "Filter-Id", RULE_OPTIONAL, -1, -1 },
1094 { "Redirect-Server", RULE_OPTIONAL, -1, 1 },
1095 };
1096 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
1097 PARSE_loc_rules( rules, avp );
1098 }
1099
1100 /* Granted-Service-Unit */
1101 {
1102 /*
1103 Grouped
1104 */
1105 struct dict_object * avp;
1106 struct dict_avp_data data = {
1107 431, /* Code */
1108 0, /* Vendor */
1109 "Granted-Service-Unit", /* Name */
1110 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
1111 AVP_FLAG_MANDATORY, /* Fixed flag values */
1112 AVP_TYPE_GROUPED /* base type of data */
1113 };
1114 struct local_rules_definition rules[] = {
1115 { "Tariff-Time-Change", RULE_OPTIONAL, -1, 1 },
1116 { "CC-Time", RULE_OPTIONAL, -1, 1 },
1117 { "CC-Money", RULE_OPTIONAL, -1, 1 },
1118 { "CC-Total-Octets", RULE_OPTIONAL, -1, 1 },
1119 { "CC-Input-Octets", RULE_OPTIONAL, -1, 1 },
1120 { "CC-Output-Octets", RULE_OPTIONAL, -1, 1 },
1121 { "CC-Service-Specific-Units", RULE_OPTIONAL, -1, 1 }
1122 /* plus any additional AVPs { "AVP", RULE_OPTIONAL, -1, -1 } */
1123 };
1124 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
1125 PARSE_loc_rules( rules, avp );
1126 }
1127
1128 /* G-S-U-Pool-Reference */
1129 {
1130 /*
1131 Grouped
1132 */
1133 struct dict_object * avp;
1134 struct dict_avp_data data = {
1135 457, /* Code */
1136 0, /* Vendor */
1137 "G-S-U-Pool-Reference", /* Name */
1138 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
1139 AVP_FLAG_MANDATORY, /* Fixed flag values */
1140 AVP_TYPE_GROUPED /* base type of data */
1141 };
1142 struct local_rules_definition rules[] = {
1143 { "G-S-U-Pool-Identifier", RULE_REQUIRED, -1, 1 },
1144 { "CC-Unit-Type", RULE_REQUIRED, -1, 1 },
1145 { "Unit-Value", RULE_REQUIRED, -1, 1 }
1146 };
1147 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
1148 PARSE_loc_rules( rules, avp );
1149 }
1150
1151 /* Requested-Service-Unit */
1152 {
1153 /*
1154 Grouped
1155 */
1156 struct dict_object * avp;
1157 struct dict_avp_data data = {
1158 437, /* Code */
1159 0, /* Vendor */
1160 "Requested-Service-Unit", /* Name */
1161 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
1162 AVP_FLAG_MANDATORY, /* Fixed flag values */
1163 AVP_TYPE_GROUPED /* base type of data */
1164 };
1165 struct local_rules_definition rules[] = {
1166 { "CC-Time", RULE_OPTIONAL, -1, 1 },
1167 { "CC-Money", RULE_OPTIONAL, -1, 1 },
1168 { "CC-Total-Octets", RULE_OPTIONAL, -1, 1 },
1169 { "CC-Input-Octets", RULE_OPTIONAL, -1, 1 },
1170 { "CC-Output-Octets", RULE_OPTIONAL, -1, 1 },
1171 { "CC-Service-Specific-Units", RULE_OPTIONAL, -1, 1 }
1172 /* plus any additional AVPs { "AVP", RULE_OPTIONAL, -1, -1 } */
1173 };
1174 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
1175 PARSE_loc_rules( rules, avp );
1176 }
1177
1178 /* Used-Service-Unit */
1179 {
1180 /*
1181 Grouped
1182 */
1183 struct dict_object * avp;
1184 struct dict_avp_data data = {
1185 446, /* Code */
1186 0, /* Vendor */
1187 "Used-Service-Unit", /* Name */
1188 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
1189 AVP_FLAG_MANDATORY, /* Fixed flag values */
1190 AVP_TYPE_GROUPED /* base type of data */
1191 };
1192 struct local_rules_definition rules[] = {
1193 { "Tariff-Change-Usage", RULE_OPTIONAL, -1, 1 },
1194 { "CC-Time", RULE_OPTIONAL, -1, 1 },
1195 { "CC-Money", RULE_OPTIONAL, -1, 1 },
1196 { "CC-Total-Octets", RULE_OPTIONAL, -1, 1 },
1197 { "CC-Input-Octets", RULE_OPTIONAL, -1, 1 },
1198 { "CC-Output-Octets", RULE_OPTIONAL, -1, 1 },
1199 { "CC-Service-Specific-Units", RULE_OPTIONAL, -1, 1 }
1200 /* plus any additional AVPs { "AVP", RULE_OPTIONAL, -1, -1 } */
1201 };
1202 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
1203 PARSE_loc_rules( rules, avp );
1204 }
1205
1206 /* at least three levels of grouping */
1207 /* Multiple-Services-Credit-Control */
1208 {
1209 /*
1210 Grouped
1211 */
1212 struct dict_object * avp;
1213 struct dict_avp_data data = {
1214 456, /* Code */
1215 0, /* Vendor */
1216 "Multiple-Services-Credit-Control", /* Name */
1217 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
1218 AVP_FLAG_MANDATORY, /* Fixed flag values */
1219 AVP_TYPE_GROUPED /* base type of data */
1220 };
1221 struct local_rules_definition rules[] = {
1222 { "Granted-Service-Unit", RULE_OPTIONAL, -1, 1 },
1223 { "Requested-Service-Unit", RULE_OPTIONAL, -1, 1 },
1224 { "Used-Service-Unit", RULE_OPTIONAL, -1, -1 },
1225 { "Tariff-Change-Usage", RULE_OPTIONAL, -1, 1 },
1226 { "Service-Identifier", RULE_OPTIONAL, -1, -1 },
1227 { "Rating-Group", RULE_OPTIONAL, -1, 1 },
1228 { "G-S-U-Pool-Reference", RULE_OPTIONAL, -1, -1 },
1229 { "Validity-Time", RULE_OPTIONAL, -1, 1 },
1230 { "Result-Code", RULE_OPTIONAL, -1, 1 },
1231 { "Final-Unit-Indication", RULE_OPTIONAL, -1, 1 }
1232 /* plus any additional AVPs { "AVP", RULE_OPTIONAL, -1, -1 } */
1233 };
1234 CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
1235 PARSE_loc_rules( rules, avp );
1236 }
1237
1238
1239 }
1240
1241
1242 /* Commands section */
1243 {
1244 /* Credit-Control-Request (CCR) Command */
1245 {
1246 /*
1247 From RFC 4006:
1248
1249 3.1. Credit-Control-Request (CCR) Command
1250
1251 The Credit-Control-Request message (CCR) is indicated by the
1252 command-code field being set to 272 and the 'R' bit being set in the
1253 Command Flags field. It is used between the Diameter credit-control
1254 client and the credit-control server to request credit authorization
1255 for a given service.
1256
1257 The Auth-Application-Id MUST be set to the value 4, indicating the
1258 Diameter credit-control application.
1259
1260 Message Format
1261
1262 <Credit-Control-Request> ::= < Diameter Header: 272, REQ, PXY >
1263 < Session-Id >
1264 { Origin-Host }
1265 { Origin-Realm }
1266 { Destination-Realm }
1267 { Auth-Application-Id }
1268 { Service-Context-Id }
1269 { CC-Request-Type }
1270 { CC-Request-Number }
1271 [ Destination-Host ]
1272 [ User-Name ]
1273 [ CC-Sub-Session-Id ]
1274 [ Acct-Multi-Session-Id ]
1275 [ Origin-State-Id ]
1276 [ Event-Timestamp ]
1277 *[ Subscription-Id ]
1278 [ Service-Identifier ]
1279 [ Termination-Cause ]
1280 [ Requested-Service-Unit ]
1281 [ Requested-Action ]
1282 *[ Used-Service-Unit ]
1283 [ Multiple-Services-Indicator ]
1284 *[ Multiple-Services-Credit-Control ]
1285 *[ Service-Parameter-Info ]
1286 [ CC-Correlation-Id ]
1287 [ User-Equipment-Info ]
1288 *[ Proxy-Info ]
1289 *[ Route-Record ]
1290 *[ AVP ]
1291
1292 10.1. Credit-Control AVP Table
1293
1294 The table in this section is used to represent which credit-control
1295 applications specific AVPs defined in this document are to be present
1296 in the credit-control messages.
1297
1298 +-----------+
1299 | Command |
1300 | Code |
1301 |-----+-----+
1302 Attribute Name | CCR | CCA |
1303 ------------------------------|-----+-----+
1304 Acct-Multi-Session-Id | 0-1 | 0-1 |
1305 Auth-Application-Id | 1 | 1 |
1306 CC-Correlation-Id | 0-1 | 0 |
1307 CC-Session-Failover | 0 | 0-1 |
1308 CC-Request-Number | 1 | 1 |
1309 CC-Request-Type | 1 | 1 |
1310 CC-Sub-Session-Id | 0-1 | 0-1 |
1311 Check-Balance-Result | 0 | 0-1 |
1312 Cost-Information | 0 | 0-1 |
1313 Credit-Control-Failure- | 0 | 0-1 |
1314 Handling | | |
1315 Destination-Host | 0-1 | 0 |
1316 Destination-Realm | 1 | 0 |
1317 Direct-Debiting-Failure- | 0 | 0-1 |
1318 Handling | | |
1319 Event-Timestamp | 0-1 | 0-1 |
1320 Failed-AVP | 0 | 0+ |
1321 Final-Unit-Indication | 0 | 0-1 |
1322 Granted-Service-Unit | 0 | 0-1 |
1323 Multiple-Services-Credit- | 0+ | 0+ |
1324 Control | | |
1325 Multiple-Services-Indicator | 0-1 | 0 |
1326 Origin-Host | 1 | 1 |
1327 Origin-Realm | 1 | 1 |
1328 Origin-State-Id | 0-1 | 0-1 |
1329 Proxy-Info | 0+ | 0+ |
1330 Redirect-Host | 0 | 0+ |
1331 Redirect-Host-Usage | 0 | 0-1 |
1332 Redirect-Max-Cache-Time | 0 | 0-1 |
1333 Requested-Action | 0-1 | 0 |
1334 Requested-Service-Unit | 0-1 | 0 |
1335 Route-Record | 0+ | 0+ |
1336 Result-Code | 0 | 1 |
1337 Service-Context-Id | 1 | 0 |
1338 Service-Identifier | 0-1 | 0 |
1339 Service-Parameter-Info | 0+ | 0 |
1340 Session-Id | 1 | 1 |
1341 Subscription-Id | 0+ | 0 |
1342 Termination-Cause | 0-1 | 0 |
1343 User-Equipment-Info | 0-1 | 0 |
1344 Used-Service-Unit | 0+ | 0 |
1345 User-Name | 0-1 | 0-1 |
1346 Validity-Time | 0 | 0-1 |
1347 ------------------------------|-----+-----+
1348
1349
1350 */
1351 struct dict_object * cmd;
1352 struct dict_cmd_data data = {
1353 272, /* Code */
1354 "Credit-Control-Request", /* Name */
1355 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE, /* Fixed flags */
1356 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */
1357 };
1358 struct local_rules_definition rules[] =
1359 {
1360 { "Session-Id", RULE_FIXED_HEAD, -1, 1 },
1361 { "Origin-Host", RULE_REQUIRED, -1, 1 },
1362 { "Origin-Realm", RULE_REQUIRED, -1, 1 },
1363 { "Destination-Realm", RULE_REQUIRED, -1, 1 },
1364 { "Auth-Application-Id", RULE_REQUIRED, -1, 1 },
1365 { "Service-Context-Id", RULE_REQUIRED, -1, 1 },
1366 { "CC-Request-Type", RULE_REQUIRED, -1, 1 },
1367 { "CC-Request-Number", RULE_REQUIRED, -1, 1 },
1368 { "Destination-Host", RULE_OPTIONAL, -1, 1 },
1369 { "User-Name", RULE_OPTIONAL, -1, 1 },
1370 { "CC-Sub-Session-Id", RULE_OPTIONAL, -1, 1 },
1371 { "Acct-Multi-Session-Id", RULE_OPTIONAL, -1, 1 },
1372 { "Origin-State-Id", RULE_OPTIONAL, -1, 1 },
1373 { "Event-Timestamp", RULE_OPTIONAL, -1, 1 },
1374 { "Subscription-Id", RULE_OPTIONAL, -1, -1 },
1375 { "Service-Identifier", RULE_OPTIONAL, -1, 1 },
1376 { "Termination-Cause", RULE_OPTIONAL, -1, 1 },
1377 { "Requested-Service-Unit", RULE_OPTIONAL, -1, 1 },
1378 { "Requested-Action", RULE_OPTIONAL, -1, 1 },
1379 { "Used-Service-Unit", RULE_OPTIONAL, -1, -1 },
1380 { "Multiple-Services-Indicator", RULE_OPTIONAL, -1, 1 },
1381 { "Multiple-Services-Credit-Control", RULE_OPTIONAL, -1, -1 },
1382 { "Service-Parameter-Info", RULE_OPTIONAL, -1, -1 },
1383 { "CC-Correlation-Id", RULE_OPTIONAL, -1, 1 },
1384 { "User-Equipment-Info", RULE_OPTIONAL, -1, 1 },
1385 { "Proxy-Info", RULE_OPTIONAL, -1, -1 },
1386 { "Route-Record", RULE_OPTIONAL, -1, -1 }
1387 /* plus any additional AVPs { "AVP", RULE_OPTIONAL, -1, -1 } */
1388 };
1389
1390 CHECK_dict_new( DICT_COMMAND, &data, dcca, &cmd);
1391 PARSE_loc_rules( rules, cmd );
1392 }
1393
1394 /* Credit-Control-Answer (CCA) Command */
1395 {
1396 /*
1397 From RFC 4006:
1398 3.2. Credit-Control-Answer (CCA) Command
1399
1400 The Credit-Control-Answer message (CCA) is indicated by the command-
1401 code field being set to 272 and the 'R' bit being cleared in the
1402 Command Flags field. It is used between the credit-control server
1403 and the Diameter credit-control client to acknowledge a Credit-
1404 Control-Request command.
1405
1406 Message Format
1407
1408 <Credit-Control-Answer> ::= < Diameter Header: 272, PXY >
1409 < Session-Id >
1410 { Result-Code }
1411 { Origin-Host }
1412 { Origin-Realm }
1413 { Auth-Application-Id }
1414 { CC-Request-Type }
1415 { CC-Request-Number }
1416 [ User-Name ]
1417 [ CC-Session-Failover ]
1418 [ CC-Sub-Session-Id ]
1419 [ Acct-Multi-Session-Id ]
1420 [ Origin-State-Id ]
1421 [ Event-Timestamp ]
1422 [ Granted-Service-Unit ]
1423 *[ Multiple-Services-Credit-Control ]
1424 [ Cost-Information]
1425 [ Final-Unit-Indication ]
1426 [ Check-Balance-Result ]
1427 [ Credit-Control-Failure-Handling ]
1428 [ Direct-Debiting-Failure-Handling ]
1429 [ Validity-Time]
1430 *[ Redirect-Host]
1431 [ Redirect-Host-Usage ]
1432 [ Redirect-Max-Cache-Time ]
1433 *[ Proxy-Info ]
1434 *[ Route-Record ]
1435 *[ Failed-AVP ]
1436 *[ AVP ]
1437
1438 */
1439 struct dict_object * cmd;
1440 struct dict_cmd_data data = {
1441 272, /* Code */
1442 "Credit-Control-Answer", /* Name */
1443 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */
1444 CMD_FLAG_PROXIABLE /* Fixed flag values */
1445 };
1446 struct local_rules_definition rules[] =
1447 {
1448 { "Session-Id", RULE_FIXED_HEAD, -1, 1 },
1449 { "Result-Code", RULE_REQUIRED, -1, 1 },
1450 { "Origin-Host", RULE_REQUIRED, -1, 1 },
1451 { "Origin-Realm", RULE_REQUIRED, -1, 1 },
1452 { "Auth-Application-Id", RULE_REQUIRED, -1, 1 },
1453 { "CC-Request-Type", RULE_REQUIRED, -1, 1 },
1454 { "CC-Request-Number", RULE_REQUIRED, -1, 1 },
1455 { "User-Name", RULE_OPTIONAL, -1, 1 },
1456 { "CC-Session-Failover", RULE_OPTIONAL, -1, 1 },
1457 { "CC-Sub-Session-Id", RULE_OPTIONAL, -1, 1 },
1458 { "Acct-Multi-Session-Id", RULE_OPTIONAL, -1, 1 },
1459 { "Origin-State-Id", RULE_OPTIONAL, -1, 1 },
1460 { "Event-Timestamp", RULE_OPTIONAL, -1, 1 },
1461 { "Granted-Service-Unit", RULE_OPTIONAL, -1, 1 },
1462 { "Multiple-Services-Credit-Control", RULE_OPTIONAL, -1, -1 },
1463 { "Cost-Information", RULE_OPTIONAL, -1, 1 },
1464 { "Final-Unit-Indication", RULE_OPTIONAL, -1, 1 },
1465 { "Check-Balance-Result", RULE_OPTIONAL, -1, 1 },
1466 { "Credit-Control-Failure-Handling", RULE_OPTIONAL, -1, 1 },
1467 { "Direct-Debiting-Failure-Handling", RULE_OPTIONAL, -1, 1 },
1468 { "Validity-Time", RULE_OPTIONAL, -1, 1 },
1469 { "Redirect-Host", RULE_OPTIONAL, -1, -1 },
1470 { "Redirect-Host-Usage", RULE_OPTIONAL, -1, 1 },
1471 { "Redirect-Max-Cache-Time", RULE_OPTIONAL, -1, 1 },
1472 { "Proxy-Info", RULE_OPTIONAL, -1, -1 },
1473 { "Route-Record", RULE_OPTIONAL, -1, -1 },
1474 { "Failed-AVP", RULE_OPTIONAL, -1, -1 }
1475 /* plus any additional AVPs { "AVP", RULE_OPTIONAL, -1, -1 } */
1476 };
1477
1478 CHECK_dict_new( DICT_COMMAND, &data, dcca, &cmd);
1479 PARSE_loc_rules( rules, cmd );
1480 }
1481 }
1482 LOG_D( "Extension 'Dictionary definitions for DCCA (rfc4006)' initialized");
1483 return 0;
1484}
1485
1486/* needs dict_nasreq for Filter-Id */
1487EXTENSION_ENTRY("dict_dcca", dict_dcca_entry, "dict_nasreq");