Mercurial > hg > freeDiameter
annotate freeDiameter/dict_base_proto.c @ 119:5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Wed, 09 Dec 2009 17:09:18 +0900 |
parents | 2db15632a63d |
children | e2dc300819b3 |
rev | line source |
---|---|
0 | 1 /********************************************************************************************************* |
2 * Software License Agreement (BSD License) * | |
3 * Author: Sebastien Decugis <sdecugis@nict.go.jp> * | |
4 * * | |
5 * Copyright (c) 2009, WIDE Project and NICT * | |
6 * All rights reserved. * | |
7 * * | |
8 * Redistribution and use of this software in source and binary forms, with or without modification, are * | |
9 * permitted provided that the following conditions are met: * | |
10 * * | |
11 * * Redistributions of source code must retain the above * | |
12 * copyright notice, this list of conditions and the * | |
13 * following disclaimer. * | |
14 * * | |
15 * * Redistributions in binary form must reproduce the above * | |
16 * copyright notice, this list of conditions and the * | |
17 * following disclaimer in the documentation and/or other * | |
18 * materials provided with the distribution. * | |
19 * * | |
20 * * Neither the name of the WIDE Project or NICT nor the * | |
21 * names of its contributors may be used to endorse or * | |
22 * promote products derived from this software without * | |
23 * specific prior written permission of WIDE Project and * | |
24 * NICT. * | |
25 * * | |
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * | |
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * | |
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * | |
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * | |
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * | |
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * | |
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * | |
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * | |
34 *********************************************************************************************************/ | |
35 | |
36 /* Diameter Base protocol definitions. | |
37 */ | |
38 | |
1
bafb831ba688
Fix names to proper case for freeDiameter
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
0
diff
changeset
|
39 #include "fD.h" |
0 | 40 |
41 #include <netinet/in.h> | |
42 #include <sys/socket.h> | |
43 | |
44 /* The pointer for the global dictionary (initialized from main) */ | |
45 struct dictionary * fd_g_dict = NULL; | |
46 | |
47 /* The functions to encode and interpret the derived types defined in the base protocol */ | |
48 | |
49 /* Address AVP <-> struct sockaddr_storage */ | |
50 static int Address_encode(void * data, union avp_value * avp_value) | |
51 { | |
52 sSS * ss = (sSS *) data; | |
53 uint16_t AddressType = 0; | |
54 size_t size = 0; | |
55 unsigned char * buf = NULL; | |
56 | |
57 TRACE_ENTRY("%p %p", data, avp_value); | |
58 CHECK_PARAMS( data && avp_value ); | |
59 | |
60 switch (ss->ss_family) { | |
61 case AF_INET: | |
62 { | |
63 /* We are encoding an IP address */ | |
64 sSA4 * sin = (sSA4 *)ss; | |
65 | |
66 AddressType = 1;/* see http://www.iana.org/assignments/address-family-numbers/ */ | |
67 size = 6; /* 2 for AddressType + 4 for data */ | |
68 | |
69 CHECK_MALLOC( buf = malloc(size) ); | |
70 | |
71 /* may not work because of alignment: *(uint32_t *)(buf+2) = htonl(sin->sin_addr.s_addr); */ | |
72 memcpy(buf + 2, &sin->sin_addr.s_addr, 4); | |
73 } | |
74 break; | |
75 | |
76 case AF_INET6: | |
77 { | |
78 /* We are encoding an IPv6 address */ | |
79 sSA6 * sin6 = (sSA6 *)ss; | |
80 | |
81 AddressType = 2;/* see http://www.iana.org/assignments/address-family-numbers/ */ | |
82 size = 18; /* 2 for AddressType + 16 for data */ | |
83 | |
84 CHECK_MALLOC( buf = malloc(size) ); | |
85 | |
86 /* The order is already good here */ | |
87 memcpy(buf + 2, &sin6->sin6_addr.s6_addr, 16); | |
88 } | |
89 break; | |
90 | |
91 default: | |
92 CHECK_PARAMS( AddressType = 0 ); | |
93 } | |
94 | |
95 *(uint16_t *)buf = htons(AddressType); | |
96 | |
97 avp_value->os.len = size; | |
98 avp_value->os.data = buf; | |
99 | |
100 return 0; | |
101 } | |
102 | |
103 static int Address_interpret(union avp_value * avp_value, void * interpreted) | |
104 { | |
105 uint16_t AddressType = 0; | |
106 unsigned char * buf; | |
107 | |
108 TRACE_ENTRY("%p %p", avp_value, interpreted); | |
109 | |
110 CHECK_PARAMS( avp_value && interpreted && (avp_value->os.len >= 2) ); | |
111 | |
112 AddressType = ntohs(*(uint16_t *)avp_value->os.data); | |
113 buf = &avp_value->os.data[2]; | |
114 | |
115 switch (AddressType) { | |
116 case 1 /* IP */: | |
117 { | |
118 sSA4 * sin = (sSA4 *)interpreted; | |
119 | |
120 CHECK_PARAMS( avp_value->os.len == 6 ); | |
121 | |
122 sin->sin_family = AF_INET; | |
123 /* sin->sin_addr.s_addr = ntohl( * (uint32_t *) buf); -- may not work because of bad alignment */ | |
124 memcpy(&sin->sin_addr.s_addr, buf, 4); | |
125 } | |
126 break; | |
127 | |
128 case 2 /* IP6 */: | |
129 { | |
130 sSA6 * sin6 = (sSA6 *)interpreted; | |
131 | |
132 CHECK_PARAMS( avp_value->os.len == 18 ); | |
133 | |
134 sin6->sin6_family = AF_INET6; | |
135 memcpy(&sin6->sin6_addr.s6_addr, buf, 16); | |
136 } | |
137 break; | |
138 | |
139 default: | |
140 CHECK_PARAMS( AddressType = 0 ); | |
141 } | |
142 | |
143 return 0; | |
144 } | |
145 | |
146 | |
147 | |
148 #define CHECK_dict_new( _type, _data, _parent, _ref ) \ | |
149 CHECK_FCT( fd_dict_new( dict, (_type), (_data), (_parent), (_ref)) ); | |
150 | |
151 #define CHECK_dict_search( _type, _criteria, _what, _result ) \ | |
152 CHECK_FCT( fd_dict_search( dict, (_type), (_criteria), (_what), (_result), ENOENT) ); | |
153 | |
154 struct local_rules_definition { | |
155 char *avp_name; | |
156 enum rule_position position; | |
157 int min; | |
158 int max; | |
159 }; | |
160 | |
161 #define RULE_ORDER( _position ) ((((_position) == RULE_FIXED_HEAD) || ((_position) == RULE_FIXED_TAIL)) ? 1 : 0 ) | |
162 | |
163 #define PARSE_loc_rules( _rulearray, _parent) { \ | |
164 int __ar; \ | |
165 for (__ar=0; __ar < sizeof(_rulearray) / sizeof((_rulearray)[0]); __ar++) { \ | |
166 struct dict_rule_data __data = { NULL, \ | |
167 (_rulearray)[__ar].position, \ | |
168 0, \ | |
169 (_rulearray)[__ar].min, \ | |
170 (_rulearray)[__ar].max}; \ | |
171 __data.rule_order = RULE_ORDER(__data.rule_position); \ | |
172 CHECK_FCT( fd_dict_search( \ | |
173 dict, \ | |
174 DICT_AVP, \ | |
175 AVP_BY_NAME, \ | |
176 (_rulearray)[__ar].avp_name, \ | |
177 &__data.rule_avp, 0 ) ); \ | |
178 if ( !__data.rule_avp ) { \ | |
179 TRACE_DEBUG(INFO, "AVP Not found: '%s'", (_rulearray)[__ar].avp_name ); \ | |
180 return ENOENT; \ | |
181 } \ | |
182 CHECK_FCT_DO( fd_dict_new( dict, DICT_RULE, &__data, _parent, NULL), \ | |
183 { \ | |
184 TRACE_DEBUG(INFO, "Error on rule with AVP '%s'", \ | |
185 (_rulearray)[__ar].avp_name ); \ | |
186 return EINVAL; \ | |
187 } ); \ | |
188 } \ | |
189 } | |
190 | |
191 int fd_dict_base_protocol(struct dictionary * dict) | |
192 { | |
193 TRACE_ENTRY("%p", dict); | |
194 CHECK_PARAMS(dict); | |
195 | |
196 /* Vendors section */ | |
197 { | |
198 /* The base RFC has no vendor information */ | |
199 ; | |
200 } | |
201 | |
202 /* Applications section */ | |
203 { | |
204 /* base accounting application */ | |
205 { | |
206 struct dict_application_data data = { 3, "Diameter Base Accounting" }; | |
207 CHECK_dict_new( DICT_APPLICATION, &data, NULL, NULL); | |
208 } | |
209 | |
210 /* relay application */ | |
211 { | |
212 struct dict_application_data data = { 0xffffffff, "Relay" }; | |
43
2db15632a63d
Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
1
diff
changeset
|
213 #if AI_RELAY != 0xffffffff |
2db15632a63d
Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
1
diff
changeset
|
214 #error "AI_RELAY definition mismatch" |
2db15632a63d
Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
1
diff
changeset
|
215 #endif |
0 | 216 CHECK_dict_new( DICT_APPLICATION, &data , NULL, NULL); |
217 } | |
218 } | |
219 | |
220 /* Derived AVP types section */ | |
221 { | |
222 /* Address */ | |
223 { | |
224 /* | |
225 The Address format is derived from the OctetString AVP Base | |
226 Format. It is a discriminated union, representing, for example a | |
227 32-bit (IPv4) [RFC791] or 128-bit (IPv6) [RFC4291] address, most | |
228 significant octet first. The first two octets of the Address AVP | |
229 represents the AddressType, which contains an Address Family | |
230 defined in [IANAADFAM]. The AddressType is used to discriminate | |
231 the content and format of the remaining octets. | |
232 */ | |
233 struct dict_type_data data = { AVP_TYPE_OCTETSTRING, "Address" , Address_interpret , Address_encode }; | |
234 CHECK_dict_new( DICT_TYPE, &data , NULL, NULL); | |
235 } | |
236 | |
237 /* Time */ | |
238 { | |
239 /* | |
240 The Time format is derived from the OctetString AVP Base Format. | |
241 The string MUST contain four octets, in the same format as the | |
242 first four bytes are in the NTP timestamp format. The NTP | |
243 Timestamp format is defined in chapter 3 of [RFC4330]. | |
244 | |
245 This represents the number of seconds since 0h on 1 January 1900 | |
246 with respect to the Coordinated Universal Time (UTC). | |
247 | |
248 On 6h 28m 16s UTC, 7 February 2036 the time value will overflow. | |
249 SNTP [RFC4330] describes a procedure to extend the time to 2104. | |
250 This procedure MUST be supported by all DIAMETER nodes. | |
251 */ | |
252 struct dict_type_data data = { AVP_TYPE_OCTETSTRING, "Time" , NULL , NULL }; | |
253 CHECK_dict_new( DICT_TYPE, &data , NULL, NULL); | |
254 } | |
255 | |
256 /* UTF8String */ | |
257 { | |
258 /* | |
259 The UTF8String format is derived from the OctetString AVP Base | |
260 Format. This is a human readable string represented using the | |
261 ISO/IEC IS 10646-1 character set, encoded as an OctetString using | |
262 the UTF-8 [RFC3629] transformation format described in RFC 3629. | |
263 | |
264 Since additional code points are added by amendments to the 10646 | |
265 standard from time to time, implementations MUST be prepared to | |
266 encounter any code point from 0x00000001 to 0x7fffffff. Byte | |
267 sequences that do not correspond to the valid encoding of a code | |
268 point into UTF-8 charset or are outside this range are prohibited. | |
269 | |
270 The use of control codes SHOULD be avoided. When it is necessary | |
271 to represent a new line, the control code sequence CR LF SHOULD be | |
272 used. | |
273 | |
274 The use of leading or trailing white space SHOULD be avoided. | |
275 | |
276 For code points not directly supported by user interface hardware | |
277 or software, an alternative means of entry and display, such as | |
278 hexadecimal, MAY be provided. | |
279 | |
280 For information encoded in 7-bit US-ASCII, the UTF-8 charset is | |
281 identical to the US-ASCII charset. | |
282 | |
283 UTF-8 may require multiple bytes to represent a single character / | |
284 code point; thus the length of an UTF8String in octets may be | |
285 different from the number of characters encoded. | |
286 | |
287 Note that the AVP Length field of an UTF8String is measured in | |
288 octets, not characters. | |
289 */ | |
290 struct dict_type_data data = { AVP_TYPE_OCTETSTRING, "UTF8String" , NULL , NULL }; | |
291 CHECK_dict_new( DICT_TYPE, &data , NULL, NULL); | |
292 } | |
293 | |
294 /* DiameterIdentity */ | |
295 { | |
296 /* | |
297 The DiameterIdentity format is derived from the OctetString AVP | |
298 Base Format. | |
299 | |
300 DiameterIdentity = FQDN | |
301 | |
302 | |
303 DiameterIdentity value is used to uniquely identify a Diameter | |
304 node for purposes of duplicate connection and routing loop | |
305 detection. | |
306 | |
307 The contents of the string MUST be the FQDN of the Diameter node. | |
308 If multiple Diameter nodes run on the same host, each Diameter | |
309 node MUST be assigned a unique DiameterIdentity. If a Diameter | |
310 | |
311 node can be identified by several FQDNs, a single FQDN should be | |
312 picked at startup, and used as the only DiameterIdentity for that | |
313 node, whatever the connection it is sent on. Note that in this | |
314 document, DiameterIdentity is in ASCII form in order to be | |
315 compatible with existing DNS infrastructure. See Appendix D for | |
316 interactions between the Diameter protocol and Internationalized | |
317 Domain Name (IDNs). | |
318 */ | |
319 struct dict_type_data data = { AVP_TYPE_OCTETSTRING, "DiameterIdentity" , NULL , NULL }; | |
320 CHECK_dict_new( DICT_TYPE, &data , NULL, NULL); | |
321 } | |
322 | |
323 /* DiameterURI */ | |
324 { | |
325 /* | |
326 The DiameterURI MUST follow the Uniform Resource Identifiers (URI) | |
327 syntax [RFC3986] rules specified below: | |
328 | |
329 "aaa://" FQDN [ port ] [ transport ] [ protocol ] | |
330 | |
331 ; No transport security | |
332 | |
333 "aaas://" FQDN [ port ] [ transport ] [ protocol ] | |
334 | |
335 ; Transport security used | |
336 | |
337 FQDN = Fully Qualified Host Name | |
338 | |
339 port = ":" 1*DIGIT | |
340 | |
341 ; One of the ports used to listen for | |
342 ; incoming connections. | |
343 ; If absent, | |
344 ; the default Diameter port (3868) is | |
345 ; assumed. | |
346 | |
347 transport = ";transport=" transport-protocol | |
348 | |
349 ; One of the transports used to listen | |
350 ; for incoming connections. If absent, | |
351 ; the default SCTP [RFC2960] protocol is | |
352 ; assumed. UDP MUST NOT be used when | |
353 ; the aaa-protocol field is set to | |
354 ; diameter. | |
355 | |
356 transport-protocol = ( "tcp" / "sctp" / "udp" ) | |
357 | |
358 protocol = ";protocol=" aaa-protocol | |
359 | |
360 ; If absent, the default AAA protocol | |
361 ; is diameter. | |
362 | |
363 aaa-protocol = ( "diameter" / "radius" / "tacacs+" ) | |
364 | |
365 The following are examples of valid Diameter host identities: | |
366 | |
367 aaa://host.example.com;transport=tcp | |
368 aaa://host.example.com:6666;transport=tcp | |
369 aaa://host.example.com;protocol=diameter | |
370 aaa://host.example.com:6666;protocol=diameter | |
371 aaa://host.example.com:6666;transport=tcp;protocol=diameter | |
372 aaa://host.example.com:1813;transport=udp;protocol=radius | |
373 */ | |
374 struct dict_type_data data = { AVP_TYPE_OCTETSTRING, "DiameterURI" , NULL , NULL }; | |
375 CHECK_dict_new( DICT_TYPE, &data , NULL, NULL); | |
376 } | |
377 | |
378 /* Enumerated */ | |
379 { | |
380 /* | |
381 Enumerated is derived from the Integer32 AVP Base Format. The | |
382 definition contains a list of valid values and their | |
383 interpretation and is described in the Diameter application | |
384 introducing the AVP. | |
385 */ | |
386 | |
387 /* We don't use a generic "Enumerated" type in waaad. Instead, we define | |
388 * types of the form "Enumerated(<avpname>)" where <avpname> is replaced | |
389 * by the name of the AVP to which the type applies. | |
390 * Example: Enumerated(Disconnect-Cause) | |
391 */ | |
392 ; | |
393 } | |
394 | |
395 /* IPFilterRule */ | |
396 { | |
397 /* | |
398 The IPFilterRule format is derived from the OctetString AVP Base | |
399 Format and uses the ASCII charset. The rule syntax is a modified | |
400 subset of ipfw(8) from FreeBSD. Packets may be filtered based on | |
401 the following information that is associated with it: | |
402 | |
403 Direction (in or out) | |
404 Source and destination IP address (possibly masked) | |
405 Protocol | |
406 Source and destination port (lists or ranges) | |
407 TCP flags | |
408 IP fragment flag | |
409 IP options | |
410 ICMP types | |
411 | |
412 Rules for the appropriate direction are evaluated in order, with | |
413 the first matched rule terminating the evaluation. Each packet is | |
414 evaluated once. If no rule matches, the packet is dropped if the | |
415 last rule evaluated was a permit, and passed if the last rule was | |
416 a deny. | |
417 | |
418 IPFilterRule filters MUST follow the format: | |
419 | |
420 action dir proto from src to dst [options] | |
421 | |
422 (...skipped loooong explanation...) | |
423 | |
424 There is one kind of packet that the access device MUST always | |
425 discard, that is an IP fragment with a fragment offset of one. | |
426 This is a valid packet, but it only has one use, to try to | |
427 circumvent firewalls. | |
428 | |
429 An access device that is unable to interpret or apply a deny rule | |
430 MUST terminate the session. An access device that is unable to | |
431 interpret or apply a permit rule MAY apply a more restrictive | |
432 rule. An access device MAY apply deny rules of its own before the | |
433 supplied rules, for example to protect the access device owner's | |
434 infrastructure. | |
435 */ | |
436 struct dict_type_data data = { AVP_TYPE_OCTETSTRING, "IPFilterRule" , NULL , NULL }; | |
437 CHECK_dict_new( DICT_TYPE, &data , NULL, NULL); | |
438 } | |
439 } | |
440 | |
441 /* AVP section */ | |
442 { | |
443 struct dict_object * Address_type; | |
444 struct dict_object * UTF8String_type; | |
445 struct dict_object * DiameterIdentity_type; | |
446 struct dict_object * DiameterURI_type; | |
447 struct dict_object * Time_type; | |
448 | |
449 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Address", &Address_type); | |
450 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "UTF8String", &UTF8String_type); | |
451 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterIdentity", &DiameterIdentity_type); | |
452 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterURI", &DiameterURI_type); | |
453 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Time", &Time_type); | |
454 | |
455 /* Vendor-Id */ | |
456 { | |
457 /* | |
458 The Vendor-Id AVP (AVP Code 266) is of type Unsigned32 and contains | |
459 the IANA "SMI Network Management Private Enterprise Codes" [RFC3232] | |
460 value assigned to the vendor of the Diameter device. It is | |
461 envisioned that the combination of the Vendor-Id, Product-Name | |
462 (Section 5.3.7) and the Firmware-Revision (Section 5.3.4) AVPs may | |
463 provide useful debugging information. | |
464 | |
465 A Vendor-Id value of zero in the CER or CEA messages is reserved and | |
466 indicates that this field is ignored. | |
467 */ | |
468 struct dict_avp_data data = { | |
469 266, /* Code */ | |
470 #if AC_VENDOR_ID != 266 | |
471 #error "AC_VENDOR_ID definition mismatch" | |
472 #endif | |
473 0, /* Vendor */ | |
474 "Vendor-Id", /* Name */ | |
475 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
476 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
477 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
478 }; | |
479 CHECK_dict_new( DICT_AVP, &data, NULL, NULL); | |
480 } | |
481 | |
482 /* Firmware-Revision */ | |
483 { | |
484 /* | |
485 The Firmware-Revision AVP (AVP Code 267) is of type Unsigned32 and is | |
486 used to inform a Diameter peer of the firmware revision of the | |
487 issuing device. | |
488 | |
489 For devices that do not have a firmware revision (general purpose | |
490 computers running Diameter software modules, for instance), the | |
491 revision of the Diameter software module may be reported instead. | |
492 */ | |
493 struct dict_avp_data data = { | |
494 267, /* Code */ | |
495 #if AC_FIRMWARE_REVISION != 267 | |
496 #error "AC_FIRMWARE_REVISION definition mismatch" | |
497 #endif | |
498 0, /* Vendor */ | |
499 "Firmware-Revision", /* Name */ | |
500 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
501 0, /* Fixed flag values */ | |
502 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
503 }; | |
504 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
505 } | |
506 | |
507 /* Host-IP-Address */ | |
508 { | |
509 /* | |
510 The Host-IP-Address AVP (AVP Code 257) is of type Address and is used | |
511 to inform a Diameter peer of the sender's IP address. All source | |
512 addresses that a Diameter node expects to use with SCTP [RFC2960] | |
513 MUST be advertised in the CER and CEA messages by including a | |
514 Host-IP- Address AVP for each address. This AVP MUST ONLY be used in | |
515 the CER and CEA messages. | |
516 */ | |
517 struct dict_avp_data data = { | |
518 257, /* Code */ | |
519 #if AC_HOST_IP_ADDRESS != 257 | |
520 #error "AC_HOST_IP_ADDRESS definition mismatch" | |
521 #endif | |
522 0, /* Vendor */ | |
523 "Host-IP-Address", /* Name */ | |
524 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
525 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
526 AVP_TYPE_OCTETSTRING /* base type of data */ | |
527 }; | |
528 CHECK_dict_new( DICT_AVP, &data , Address_type, NULL); | |
529 } | |
530 | |
531 /* Supported-Vendor-Id */ | |
532 { | |
533 /* | |
534 The Supported-Vendor-Id AVP (AVP Code 265) is of type Unsigned32 and | |
535 contains the IANA "SMI Network Management Private Enterprise Codes" | |
536 [RFC3232] value assigned to a vendor other than the device vendor but | |
537 including the application vendor. This is used in the CER and CEA | |
538 messages in order to inform the peer that the sender supports (a | |
539 subset of) the vendor-specific AVPs defined by the vendor identified | |
540 in this AVP. The value of this AVP SHOULD NOT be set to zero. | |
541 Multiple instances of this AVP containing the same value SHOULD NOT | |
542 be sent. | |
543 */ | |
544 struct dict_avp_data data = { | |
545 265, /* Code */ | |
546 #if AC_SUPPORTED_VENDOR_ID != 265 | |
547 #error "AC_SUPPORTED_VENDOR_ID definition mismatch" | |
548 #endif | |
549 0, /* Vendor */ | |
550 "Supported-Vendor-Id", /* Name */ | |
551 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
552 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
553 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
554 }; | |
555 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
556 } | |
557 | |
558 /* Product-Name */ | |
559 { | |
560 /* | |
561 The Product-Name AVP (AVP Code 269) is of type UTF8String, and | |
562 contains the vendor assigned name for the product. The Product-Name | |
563 AVP SHOULD remain constant across firmware revisions for the same | |
564 product. | |
565 */ | |
566 struct dict_avp_data data = { | |
567 269, /* Code */ | |
568 #if AC_PRODUCT_NAME != 269 | |
569 #error "AC_PRODUCT_NAME definition mismatch" | |
570 #endif | |
571 0, /* Vendor */ | |
572 "Product-Name", /* Name */ | |
573 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
574 0, /* Fixed flag values */ | |
575 AVP_TYPE_OCTETSTRING /* base type of data */ | |
576 }; | |
577 CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); | |
578 } | |
579 | |
580 /* Disconnect-Cause */ | |
581 { | |
582 /* | |
583 The Disconnect-Cause AVP (AVP Code 273) is of type Enumerated. A | |
584 Diameter node MUST include this AVP in the Disconnect-Peer-Request | |
585 message to inform the peer of the reason for its intention to | |
586 shutdown the transport connection. The following values are | |
587 supported: | |
588 | |
589 REBOOTING 0 | |
590 A scheduled reboot is imminent. Receiver of DPR with above result | |
591 code MAY attempt reconnection. | |
592 | |
593 BUSY 1 | |
594 The peer's internal resources are constrained, and it has | |
595 determined that the transport connection needs to be closed. | |
596 Receiver of DPR with above result code SHOULD NOT attempt | |
597 reconnection. | |
598 | |
599 DO_NOT_WANT_TO_TALK_TO_YOU 2 | |
600 The peer has determined that it does not see a need for the | |
601 transport connection to exist, since it does not expect any | |
602 messages to be exchanged in the near future. Receiver of DPR | |
603 with above result code SHOULD NOT attempt reconnection. | |
604 */ | |
605 struct dict_object * type; | |
606 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Disconnect-Cause)" , NULL, NULL}; | |
607 struct dict_enumval_data t_0 = { "REBOOTING", { .i32 = 0 }}; | |
608 struct dict_enumval_data t_1 = { "BUSY", { .i32 = 1 }}; | |
609 struct dict_enumval_data t_2 = { "DO_NOT_WANT_TO_TALK_TO_YOU", { .i32 = 2 }}; | |
610 struct dict_avp_data data = { | |
611 273, /* Code */ | |
612 #if AC_DISCONNECT_CAUSE != 273 | |
613 #error "AC_DISCONNECT_CAUSE definition mismatch" | |
614 #endif | |
615 0, /* Vendor */ | |
616 "Disconnect-Cause", /* Name */ | |
617 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
618 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
619 AVP_TYPE_INTEGER32 /* base type of data */ | |
620 }; | |
621 /* Create the Enumerated type, and then the AVP */ | |
622 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
623 CHECK_dict_new( DICT_ENUMVAL, &t_0 , type, NULL); | |
624 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL); | |
625 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL); | |
626 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
627 } | |
628 | |
629 /* Origin-Host */ | |
630 { | |
631 /* | |
632 The Origin-Host AVP (AVP Code 264) is of type DiameterIdentity, and | |
633 MUST be present in all Diameter messages. This AVP identifies the | |
634 endpoint that originated the Diameter message. Relay agents MUST NOT | |
635 modify this AVP. | |
636 | |
637 The value of the Origin-Host AVP is guaranteed to be unique within a | |
638 single host. | |
639 | |
640 Note that the Origin-Host AVP may resolve to more than one address as | |
641 the Diameter peer may support more than one address. | |
642 | |
643 This AVP SHOULD be placed as close to the Diameter header as | |
644 possible. | |
645 */ | |
646 struct dict_avp_data data = { | |
647 264, /* Code */ | |
648 #if AC_ORIGIN_HOST != 264 | |
649 #error "AC_ORIGIN_HOST definition mismatch" | |
650 #endif | |
651 0, /* Vendor */ | |
652 "Origin-Host", /* Name */ | |
653 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
654 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
655 AVP_TYPE_OCTETSTRING /* base type of data */ | |
656 }; | |
657 CHECK_dict_new( DICT_AVP, &data , DiameterIdentity_type, NULL); | |
658 } | |
659 | |
660 /* Origin-Realm */ | |
661 { | |
662 /* | |
663 The Origin-Realm AVP (AVP Code 296) is of type DiameterIdentity. | |
664 This AVP contains the Realm of the originator of any Diameter message | |
665 and MUST be present in all messages. | |
666 | |
667 This AVP SHOULD be placed as close to the Diameter header as | |
668 possible. | |
669 */ | |
670 struct dict_avp_data data = { | |
671 296, /* Code */ | |
672 #if AC_ORIGIN_REALM != 296 | |
673 #error "AC_ORIGIN_REALM definition mismatch" | |
674 #endif | |
675 0, /* Vendor */ | |
676 "Origin-Realm", /* Name */ | |
677 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
678 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
679 AVP_TYPE_OCTETSTRING /* base type of data */ | |
680 }; | |
681 CHECK_dict_new( DICT_AVP, &data , DiameterIdentity_type, NULL); | |
682 } | |
683 | |
684 /* Destination-Host */ | |
685 { | |
686 /* | |
687 The Destination-Host AVP (AVP Code 293) is of type DiameterIdentity. | |
688 This AVP MUST be present in all unsolicited agent initiated messages, | |
689 MAY be present in request messages, and MUST NOT be present in Answer | |
690 messages. | |
691 | |
692 The absence of the Destination-Host AVP will cause a message to be | |
693 sent to any Diameter server supporting the application within the | |
694 realm specified in Destination-Realm AVP. | |
695 | |
696 This AVP SHOULD be placed as close to the Diameter header as | |
697 possible. | |
698 */ | |
699 struct dict_avp_data data = { | |
700 293, /* Code */ | |
701 #if AC_DESTINATION_HOST != 293 | |
702 #error "AC_DESTINATION_HOST definition mismatch" | |
703 #endif | |
704 0, /* Vendor */ | |
705 "Destination-Host", /* Name */ | |
706 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
707 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
708 AVP_TYPE_OCTETSTRING /* base type of data */ | |
709 }; | |
710 CHECK_dict_new( DICT_AVP, &data , DiameterIdentity_type, NULL); | |
711 } | |
712 | |
713 /* Destination-Realm */ | |
714 { | |
715 /* | |
716 The Destination-Realm AVP (AVP Code 283) is of type DiameterIdentity, | |
717 and contains the realm the message is to be routed to. The | |
718 Destination-Realm AVP MUST NOT be present in Answer messages. | |
719 Diameter Clients insert the realm portion of the User-Name AVP. | |
720 Diameter servers initiating a request message use the value of the | |
721 Origin-Realm AVP from a previous message received from the intended | |
722 target host (unless it is known a priori). When present, the | |
723 Destination-Realm AVP is used to perform message routing decisions. | |
724 | |
725 Request messages whose ABNF does not list the Destination-Realm AVP | |
726 as a mandatory AVP are inherently non-routable messages. | |
727 | |
728 This AVP SHOULD be placed as close to the Diameter header as | |
729 possible. | |
730 */ | |
731 struct dict_avp_data data = { | |
732 283, /* Code */ | |
733 #if AC_DESTINATION_REALM != 283 | |
734 #error "AC_DESTINATION_REALM definition mismatch" | |
735 #endif | |
736 0, /* Vendor */ | |
737 "Destination-Realm", /* Name */ | |
738 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
739 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
740 AVP_TYPE_OCTETSTRING /* base type of data */ | |
741 }; | |
742 CHECK_dict_new( DICT_AVP, &data , DiameterIdentity_type, NULL); | |
743 } | |
744 | |
745 /* Route-Record */ | |
746 { | |
747 /* | |
748 The Route-Record AVP (AVP Code 282) is of type DiameterIdentity. The | |
749 identity added in this AVP MUST be the same as the one received in | |
750 the Origin-Host of the Capabilities Exchange message. | |
751 */ | |
752 struct dict_avp_data data = { | |
753 282, /* Code */ | |
754 #if AC_ROUTE_RECORD != 282 | |
755 #error "AC_ROUTE_RECORD definition mismatch" | |
756 #endif | |
757 0, /* Vendor */ | |
758 "Route-Record", /* 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 , DiameterIdentity_type, NULL); | |
764 } | |
765 | |
766 /* Proxy-Host */ | |
767 { | |
768 /* | |
769 The Proxy-Host AVP (AVP Code 280) is of type DiameterIdentity. This | |
770 AVP contains the identity of the host that added the Proxy-Info AVP. | |
771 */ | |
772 struct dict_avp_data adata = { | |
773 280, /* Code */ | |
774 #if AC_PROXY_HOST != 280 | |
775 #error "AC_PROXY_HOST definition mismatch" | |
776 #endif | |
777 0, /* Vendor */ | |
778 "Proxy-Host", /* Name */ | |
779 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
780 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
781 AVP_TYPE_OCTETSTRING /* base type of data */ | |
782 }; | |
783 CHECK_dict_new( DICT_AVP, &adata , DiameterIdentity_type, NULL); | |
784 } | |
785 | |
786 /* Proxy-State */ | |
787 { | |
788 /* | |
789 The Proxy-State AVP (AVP Code 33) is of type OctetString, and | |
790 contains state local information, and MUST be treated as opaque data. | |
791 */ | |
792 struct dict_avp_data adata = { | |
793 33, /* Code */ | |
794 #if AC_PROXY_STATE != 33 | |
795 #error "AC_PROXY_STATE definition mismatch" | |
796 #endif | |
797 0, /* Vendor */ | |
798 "Proxy-State", /* Name */ | |
799 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
800 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
801 AVP_TYPE_OCTETSTRING /* base type of data */ | |
802 }; | |
803 CHECK_dict_new( DICT_AVP, &adata , NULL, NULL); | |
804 } | |
805 | |
806 /* Proxy-Info */ | |
807 { | |
808 /* | |
809 The Proxy-Info AVP (AVP Code 284) is of type Grouped. The Grouped | |
810 Data field has the following ABNF grammar: | |
811 | |
812 Proxy-Info ::= < AVP Header: 284 > | |
813 { Proxy-Host } | |
814 { Proxy-State } | |
815 * [ AVP ] | |
816 */ | |
817 struct dict_object * avp; | |
818 struct dict_avp_data data = { | |
819 284, /* Code */ | |
820 #if AC_PROXY_INFO != 284 | |
821 #error "AC_PROXY_INFO definition mismatch" | |
822 #endif | |
823 0, /* Vendor */ | |
824 "Proxy-Info", /* Name */ | |
825 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
826 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
827 AVP_TYPE_GROUPED /* base type of data */ | |
828 }; | |
829 struct local_rules_definition rules[] = | |
830 { { "Proxy-Host", RULE_REQUIRED, -1, 1 } | |
831 ,{ "Proxy-State", RULE_REQUIRED, -1, 1 } | |
832 }; | |
833 | |
834 CHECK_dict_new( DICT_AVP, &data , NULL, &avp); | |
835 PARSE_loc_rules( rules, avp ); | |
836 } | |
837 | |
838 /* Auth-Application-Id */ | |
839 { | |
840 /* | |
841 The Auth-Application-Id AVP (AVP Code 258) is of type Unsigned32 and | |
842 is used in order to advertise support of the Authentication and | |
843 Authorization portion of an application (see Section 2.4). If | |
844 present in a message other than CER and CEA, the value of the Auth- | |
845 Application-Id AVP MUST match the Application Id present in the | |
846 Diameter message header. | |
847 */ | |
848 struct dict_avp_data data = { | |
849 258, /* Code */ | |
850 #if AC_AUTH_APPLICATION_ID != 258 | |
851 #error "AC_AUTH_APPLICATION_ID definition mismatch" | |
852 #endif | |
853 0, /* Vendor */ | |
854 "Auth-Application-Id", /* Name */ | |
855 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
856 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
857 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
858 }; | |
859 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
860 } | |
861 | |
862 /* Acct-Application-Id */ | |
863 { | |
864 /* | |
865 The Acct-Application-Id AVP (AVP Code 259) is of type Unsigned32 and | |
866 is used in order to advertise support of the Accounting portion of an | |
867 application (see Section 2.4). If present in a message other than | |
868 CER and CEA, the value of the Acct-Application-Id AVP MUST match the | |
869 Application Id present in the Diameter message header. | |
870 */ | |
871 struct dict_avp_data data = { | |
872 259, /* Code */ | |
873 #if AC_ACCT_APPLICATION_ID != 259 | |
874 #error "AC_ACCT_APPLICATION_ID definition mismatch" | |
875 #endif | |
876 0, /* Vendor */ | |
877 "Acct-Application-Id", /* Name */ | |
878 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
879 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
880 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
881 }; | |
882 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
883 } | |
884 | |
885 /* Inband-Security-Id */ | |
886 { | |
887 /* | |
888 The Inband-Security-Id AVP (AVP Code 299) is of type Unsigned32 and | |
889 is used in order to advertise support of the Security portion of the | |
890 application. | |
891 | |
892 Currently, the following values are supported, but there is ample | |
893 room to add new security Ids. | |
894 | |
895 | |
896 NO_INBAND_SECURITY 0 | |
897 | |
898 This peer does not support TLS. This is the default value, if the | |
899 AVP is omitted. | |
900 | |
901 TLS 1 | |
902 | |
903 This node supports TLS security, as defined by [RFC4346]. | |
904 */ | |
905 | |
906 /* Although the RFC does not specify an "Enumerated" type here, we go forward and create one. | |
907 * This is the reason for the "*" in the type name | |
908 */ | |
909 | |
910 struct dict_object * type; | |
911 struct dict_type_data tdata = { AVP_TYPE_UNSIGNED32, "Enumerated*(Inband-Security-Id)" , NULL, NULL}; | |
43
2db15632a63d
Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
1
diff
changeset
|
912 struct dict_enumval_data t_0 = { "NO_INBAND_SECURITY", { .u32 = ACV_ISI_NO_INBAND_SECURITY }}; |
2db15632a63d
Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
1
diff
changeset
|
913 struct dict_enumval_data t_1 = { "TLS", { .u32 = ACV_ISI_TLS }}; |
0 | 914 struct dict_avp_data data = { |
915 299, /* Code */ | |
916 #if AC_INBAND_SECURITY_ID != 299 | |
917 #error "AC_INBAND_SECURITY_ID definition mismatch" | |
918 #endif | |
919 0, /* Vendor */ | |
920 "Inband-Security-Id", /* Name */ | |
921 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
922 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
923 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
924 }; | |
925 /* Create the Enumerated type, and then the AVP */ | |
926 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
927 CHECK_dict_new( DICT_ENUMVAL, &t_0 , type, NULL); | |
928 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL); | |
929 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
930 } | |
931 | |
932 /* Vendor-Specific-Application-Id */ | |
933 { | |
934 /* | |
935 The Vendor-Specific-Application-Id AVP (AVP Code 260) is of type | |
936 Grouped and is used to advertise support of a vendor-specific | |
937 Diameter Application. Exactly one instance of either Auth- | |
938 Application-Id or Acct-Application-Id AVP MUST be present. The | |
939 Application Id carried by either Auth-Application-Id or Acct- | |
940 Application-Id AVP MUST comply with vendor specific Application Id | |
941 assignment described in Sec 11.3. It MUST also match the Application | |
942 Id present in the diameter header except when used in a CER or CEA | |
943 messages. | |
944 | |
945 The Vendor-Id AVP is an informational AVP pertaining to the vendor | |
946 who may have authorship of the vendor-specific Diameter application. | |
947 It MUST NOT be used as a means of defining a completely separate | |
948 vendor-specific Application Id space. | |
949 | |
950 This AVP MUST also be present as the first AVP in all experimental | |
951 commands defined in the vendor-specific application. | |
952 | |
953 This AVP SHOULD be placed as close to the Diameter header as | |
954 possible. | |
955 | |
956 AVP Format | |
957 | |
958 <Vendor-Specific-Application-Id> ::= < AVP Header: 260 > | |
959 { Vendor-Id } | |
960 [ Auth-Application-Id ] | |
961 [ Acct-Application-Id ] | |
962 | |
963 A Vendor-Specific-Application-Id AVP MUST contain exactly one of | |
964 either Auth-Application-Id or Acct-Application-Id. If a Vendor- | |
965 Specific-Application-Id is received without any of these two AVPs, | |
966 then the recipient SHOULD issue an answer with a Result-Code set to | |
967 DIAMETER_MISSING_AVP. The answer SHOULD also include a Failed-AVP | |
968 which MUST contain an example of an Auth-Application-Id AVP and an | |
969 Acct-Application-Id AVP. | |
970 | |
971 If a Vendor-Specific-Application-Id is received that contains both | |
972 Auth-Application-Id and Acct-Application-Id, then the recipient | |
973 SHOULD issue an answer with Result-Code set to | |
974 DIAMETER_AVP_OCCURS_TOO_MANY_TIMES. The answer SHOULD also include a | |
975 Failed-AVP which MUST contain the received Auth-Application-Id AVP | |
976 and Acct-Application-Id AVP. | |
977 */ | |
978 struct dict_object * avp; | |
979 struct dict_avp_data data = { | |
980 260, /* Code */ | |
981 #if AC_VENDOR_SPECIFIC_APPLICATION_ID != 260 | |
982 #error "AC_VENDOR_SPECIFIC_APPLICATION_ID definition mismatch" | |
983 #endif | |
984 0, /* Vendor */ | |
985 "Vendor-Specific-Application-Id", /* Name */ | |
986 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
987 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
988 AVP_TYPE_GROUPED /* base type of data */ | |
989 }; | |
990 | |
991 struct local_rules_definition rules[] = | |
992 { { "Vendor-Id", RULE_REQUIRED, -1, 1 } | |
993 ,{ "Auth-Application-Id", RULE_OPTIONAL, -1, 1 } | |
994 ,{ "Acct-Application-Id", RULE_OPTIONAL, -1, 1 } | |
995 }; | |
996 | |
997 /* Create the grouped AVP */ | |
998 CHECK_dict_new( DICT_AVP, &data , NULL, &avp); | |
999 PARSE_loc_rules( rules, avp ); | |
1000 | |
1001 } | |
1002 | |
1003 /* Redirect-Host */ | |
1004 { | |
1005 /* | |
1006 One or more of instances of this AVP MUST be present if the answer | |
1007 message's 'E' bit is set and the Result-Code AVP is set to | |
1008 DIAMETER_REDIRECT_INDICATION. | |
1009 | |
1010 Upon receiving the above, the receiving Diameter node SHOULD forward | |
1011 the request directly to one of the hosts identified in these AVPs. | |
1012 The server contained in the selected Redirect-Host AVP SHOULD be used | |
1013 for all messages pertaining to this session. | |
1014 */ | |
1015 struct dict_avp_data data = { | |
1016 292, /* Code */ | |
1017 #if AC_REDIRECT_HOST != 292 | |
1018 #error "AC_REDIRECT_HOST definition mismatch" | |
1019 #endif | |
1020 0, /* Vendor */ | |
1021 "Redirect-Host", /* Name */ | |
1022 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1023 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1024 AVP_TYPE_OCTETSTRING /* base type of data */ | |
1025 }; | |
1026 CHECK_dict_new( DICT_AVP, &data , DiameterURI_type, NULL); | |
1027 } | |
1028 | |
1029 /* Redirect-Host-Usage */ | |
1030 { | |
1031 /* | |
1032 The Redirect-Host-Usage AVP (AVP Code 261) is of type Enumerated. | |
1033 This AVP MAY be present in answer messages whose 'E' bit is set and | |
1034 the Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION. | |
1035 | |
1036 When present, this AVP dictates how the routing entry resulting from | |
1037 the Redirect-Host is to be used. The following values are supported: | |
1038 | |
1039 | |
1040 DONT_CACHE 0 | |
1041 | |
1042 The host specified in the Redirect-Host AVP should not be cached. | |
1043 This is the default value. | |
1044 | |
1045 | |
1046 ALL_SESSION 1 | |
1047 | |
1048 All messages within the same session, as defined by the same value | |
1049 of the Session-ID AVP MAY be sent to the host specified in the | |
1050 Redirect-Host AVP. | |
1051 | |
1052 | |
1053 ALL_REALM 2 | |
1054 | |
1055 All messages destined for the realm requested MAY be sent to the | |
1056 host specified in the Redirect-Host AVP. | |
1057 | |
1058 | |
1059 REALM_AND_APPLICATION 3 | |
1060 | |
1061 All messages for the application requested to the realm specified | |
1062 MAY be sent to the host specified in the Redirect-Host AVP. | |
1063 | |
1064 ALL_APPLICATION 4 | |
1065 | |
1066 All messages for the application requested MAY be sent to the host | |
1067 specified in the Redirect-Host AVP. | |
1068 | |
1069 | |
1070 ALL_HOST 5 | |
1071 | |
1072 All messages that would be sent to the host that generated the | |
1073 Redirect-Host MAY be sent to the host specified in the Redirect- | |
1074 Host AVP. | |
1075 | |
1076 | |
1077 ALL_USER 6 | |
1078 | |
1079 All messages for the user requested MAY be sent to the host | |
1080 specified in the Redirect-Host AVP. | |
1081 | |
1082 | |
1083 When multiple cached routes are created by redirect indications and | |
1084 they differ only in redirect usage and peers to forward requests to | |
1085 (see Section 6.1.8), a precedence rule MUST be applied to the | |
1086 redirect usage values of the cached routes during normal routing to | |
1087 resolve contentions that may occur. The precedence rule is the order | |
1088 that dictate which redirect usage should be considered before any | |
1089 other as they appear. The order is as follows: | |
1090 | |
1091 | |
1092 1. ALL_SESSION | |
1093 | |
1094 2. ALL_USER | |
1095 | |
1096 3. REALM_AND_APPLICATION | |
1097 | |
1098 4. ALL_REALM | |
1099 | |
1100 5. ALL_APPLICATION | |
1101 | |
1102 6. ALL_HOST | |
1103 */ | |
1104 struct dict_object * type; | |
1105 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Redirect-Host-Usage)" , NULL, NULL}; | |
1106 struct dict_enumval_data t_0 = { "DONT_CACHE", { .i32 = 0 }}; | |
1107 struct dict_enumval_data t_1 = { "ALL_SESSION", { .i32 = 1 }}; | |
1108 struct dict_enumval_data t_2 = { "ALL_REALM", { .i32 = 2 }}; | |
1109 struct dict_enumval_data t_3 = { "REALM_AND_APPLICATION", { .i32 = 3 }}; | |
1110 struct dict_enumval_data t_4 = { "ALL_APPLICATION", { .i32 = 4 }}; | |
1111 struct dict_enumval_data t_5 = { "ALL_HOST", { .i32 = 5 }}; | |
1112 struct dict_enumval_data t_6 = { "ALL_USER", { .i32 = 6 }}; | |
1113 struct dict_avp_data data = { | |
1114 261, /* Code */ | |
1115 #if AC_REDIRECT_HOST_USAGE != 261 | |
1116 #error "AC_REDIRECT_HOST_USAGE definition mismatch" | |
1117 #endif | |
1118 0, /* Vendor */ | |
1119 "Redirect-Host-Usage", /* Name */ | |
1120 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1121 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1122 AVP_TYPE_INTEGER32 /* base type of data */ | |
1123 }; | |
1124 /* Create the Enumerated type, and then the AVP */ | |
1125 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
1126 CHECK_dict_new( DICT_ENUMVAL, &t_0 , type, NULL); | |
1127 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL); | |
1128 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL); | |
1129 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL); | |
1130 CHECK_dict_new( DICT_ENUMVAL, &t_4 , type, NULL); | |
1131 CHECK_dict_new( DICT_ENUMVAL, &t_5 , type, NULL); | |
1132 CHECK_dict_new( DICT_ENUMVAL, &t_6 , type, NULL); | |
1133 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
1134 } | |
1135 | |
1136 /* Redirect-Max-Cache-Time */ | |
1137 { | |
1138 /* | |
1139 The Redirect-Max-Cache-Time AVP (AVP Code 262) is of type Unsigned32. | |
1140 This AVP MUST be present in answer messages whose 'E' bit is set, the | |
1141 Result-Code AVP is set to DIAMETER_REDIRECT_INDICATION and the | |
1142 Redirect-Host-Usage AVP set to a non-zero value. | |
1143 | |
1144 This AVP contains the maximum number of seconds the peer and route | |
1145 table entries, created as a result of the Redirect-Host, will be | |
1146 cached. Note that once a host created due to a redirect indication | |
1147 is no longer reachable, any associated peer and routing table entries | |
1148 MUST be deleted. | |
1149 */ | |
1150 struct dict_avp_data data = { | |
1151 262, /* Code */ | |
1152 #if AC_REDIRECT_MAX_CACHE_TIME != 262 | |
1153 #error "AC_REDIRECT_MAX_CACHE_TIME definition mismatch" | |
1154 #endif | |
1155 0, /* Vendor */ | |
1156 "Redirect-Max-Cache-Time", /* Name */ | |
1157 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1158 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1159 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
1160 }; | |
1161 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
1162 } | |
1163 | |
1164 /* Result-Code */ | |
1165 { | |
1166 /* | |
1167 The Result-Code AVP (AVP Code 268) is of type Unsigned32 and | |
1168 indicates whether a particular request was completed successfully or | |
1169 whether an error occurred. All Diameter answer messages defined in | |
1170 IETF applications MUST include one Result-Code AVP. A non-successful | |
1171 Result-Code AVP (one containing a non 2xxx value other than | |
1172 DIAMETER_REDIRECT_INDICATION) MUST include the Error-Reporting-Host | |
1173 AVP if the host setting the Result-Code AVP is different from the | |
1174 identity encoded in the Origin-Host AVP. | |
1175 | |
1176 The Result-Code data field contains an IANA-managed 32-bit address | |
1177 space representing errors (see Section 11.4). Diameter provides the | |
1178 following classes of errors, all identified by the thousands digit in | |
1179 the decimal notation: | |
1180 | |
1181 o 1xxx (Informational) | |
1182 | |
1183 o 2xxx (Success) | |
1184 | |
1185 o 3xxx (Protocol Errors) | |
1186 | |
1187 o 4xxx (Transient Failures) | |
1188 | |
1189 o 5xxx (Permanent Failure) | |
1190 | |
1191 A non-recognized class (one whose first digit is not defined in this | |
1192 section) MUST be handled as a permanent failure. | |
1193 */ | |
1194 | |
1195 /* Although the RFC does not specify an "Enumerated" type here, we go forward and create one. | |
1196 * This is the reason for the "*" in the type name | |
1197 */ | |
1198 struct dict_object * type; | |
1199 struct dict_type_data tdata = { AVP_TYPE_UNSIGNED32, "Enumerated*(Result-Code)" , NULL, NULL}; | |
1200 struct dict_avp_data data = { | |
1201 268, /* Code */ | |
1202 #if AC_RESULT_CODE != 268 | |
1203 #error "AC_RESULT_CODE definition mismatch" | |
1204 #endif | |
1205 0, /* Vendor */ | |
1206 "Result-Code", /* Name */ | |
1207 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1208 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1209 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
1210 }; | |
1211 /* Create the Enumerated type, and then the AVP */ | |
1212 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
1213 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
1214 | |
1215 /* Informational */ | |
1216 { | |
1217 /* 1001 */ | |
1218 { | |
1219 /* | |
1220 This informational error is returned by a Diameter server to | |
1221 inform the access device that the authentication mechanism being | |
1222 used requires multiple round trips, and a subsequent request needs | |
1223 to be issued in order for access to be granted. | |
1224 */ | |
1225 struct dict_enumval_data error_code = { "DIAMETER_MULTI_ROUND_AUTH", { .u32 = 1001 }}; | |
1226 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1227 } | |
1228 } | |
1229 /* Success */ | |
1230 { | |
1231 /* 2001 */ | |
1232 { | |
1233 /* | |
1234 The Request was successfully completed. | |
1235 */ | |
1236 struct dict_enumval_data error_code = { "DIAMETER_SUCCESS", { .u32 = 2001 }}; | |
1237 #if ER_DIAMETER_SUCCESS != 2001 | |
1238 #error "ER_DIAMETER_SUCCESS definition mismatch" | |
1239 #endif | |
1240 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1241 } | |
1242 /* 2002 */ | |
1243 { | |
1244 /* | |
1245 When returned, the request was successfully completed, but | |
1246 additional processing is required by the application in order to | |
1247 provide service to the user. | |
1248 */ | |
1249 struct dict_enumval_data error_code = { "DIAMETER_LIMITED_SUCCESS", { .u32 = 2002 }}; | |
1250 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1251 } | |
1252 } | |
1253 /* Protocol Errors */ | |
1254 { | |
119
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1255 /* 3001 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1256 { |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1257 /* |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1258 The Request contained a Command-Code that the receiver did not |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1259 recognize or support. This MUST be used when a Diameter node |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1260 receives an experimental command that it does not understand. |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1261 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1262 /* (old): it has been changed to 5019 in 3588bis */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1263 struct dict_enumval_data error_code = { "DIAMETER_COMMAND_UNSUPPORTED(old)", { .u32 = 3001 }}; |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1264 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1265 } |
0 | 1266 /* 3002 */ |
1267 { | |
1268 /* | |
1269 This error is given when Diameter can not deliver the message to | |
1270 the destination, either because no host within the realm | |
1271 supporting the required application was available to process the | |
1272 request, or because Destination-Host AVP was given without the | |
1273 associated Destination-Realm AVP. | |
1274 */ | |
1275 struct dict_enumval_data error_code = { "DIAMETER_UNABLE_TO_DELIVER", { .u32 = 3002 }}; | |
1276 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1277 } | |
1278 /* 3003 */ | |
1279 { | |
1280 /* | |
1281 The intended realm of the request is not recognized. | |
1282 */ | |
1283 struct dict_enumval_data error_code = { "DIAMETER_REALM_NOT_SERVED", { .u32 = 3003 }}; | |
1284 #if ER_DIAMETER_REALM_NOT_SERVED != 3003 | |
1285 #error "ER_DIAMETER_REALM_NOT_SERVED definition mismatch" | |
1286 #endif | |
1287 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1288 } | |
1289 /* 3004 */ | |
1290 { | |
1291 /* | |
1292 When returned, a Diameter node SHOULD attempt to send the message | |
1293 to an alternate peer. This error MUST only be used when a | |
1294 specific server is requested, and it cannot provide the requested | |
1295 service. | |
1296 */ | |
1297 struct dict_enumval_data error_code = { "DIAMETER_TOO_BUSY", { .u32 = 3004 }}; | |
1298 #if ER_DIAMETER_TOO_BUSY != 3004 | |
1299 #error "ER_DIAMETER_TOO_BUSY definition mismatch" | |
1300 #endif | |
1301 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1302 } | |
1303 /* 3005 */ | |
1304 { | |
1305 /* | |
1306 An agent detected a loop while trying to get the message to the | |
1307 intended recipient. The message MAY be sent to an alternate peer, | |
1308 if one is available, but the peer reporting the error has | |
1309 identified a configuration problem. | |
1310 */ | |
1311 struct dict_enumval_data error_code = { "DIAMETER_LOOP_DETECTED", { .u32 = 3005 }}; | |
1312 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1313 } | |
1314 /* 3006 */ | |
1315 { | |
1316 /* | |
1317 A redirect agent has determined that the request could not be | |
1318 satisfied locally and the initiator of the request should direct | |
1319 the request directly to the server, whose contact information has | |
1320 been added to the response. When set, the Redirect-Host AVP MUST | |
1321 be present. | |
1322 */ | |
1323 struct dict_enumval_data error_code = { "DIAMETER_REDIRECT_INDICATION", { .u32 = 3006 }}; | |
1324 #if ER_DIAMETER_REDIRECT_INDICATION != 3006 | |
1325 #error "ER_DIAMETER_REDIRECT_INDICATION definition mismatch" | |
1326 #endif | |
1327 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1328 } | |
1329 /* 3007 */ | |
1330 { | |
1331 /* | |
1332 A request was sent for an application that is not supported. | |
1333 */ | |
1334 struct dict_enumval_data error_code = { "DIAMETER_APPLICATION_UNSUPPORTED", { .u32 = 3007 }}; | |
1335 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1336 } | |
119
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1337 /* 3008 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1338 { |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1339 /* |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1340 A request was received whose bits in the Diameter header were |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1341 either set to an invalid combination, or to a value that is |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1342 inconsistent with the command code's definition. |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1343 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1344 /* (old): it has been changed in 3588bis */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1345 struct dict_enumval_data error_code = { "DIAMETER_INVALID_HDR_BITS(old)", { .u32 = 3008 }}; |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1346 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1347 } |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1348 /* 3009 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1349 { |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1350 /* |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1351 A request was received that included an AVP whose flag bits are |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1352 set to an unrecognized value, or that is inconsistent with the |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1353 AVP's definition. |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1354 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1355 /* (old): it has been changed in 3588bis */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1356 struct dict_enumval_data error_code = { "DIAMETER_INVALID_AVP_BITS(old)", { .u32 = 3009 }}; |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1357 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1358 } |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1359 /* 3010 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1360 { |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1361 /* |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1362 A CER was received from an unknown peer. |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1363 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1364 /* (old): it has been changed in 3588bis */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1365 struct dict_enumval_data error_code = { "DIAMETER_UNKNOWN_PEER(old)", { .u32 = 3010 }}; |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1366 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1367 } |
0 | 1368 /* 3011 */ |
1369 { | |
1370 /* | |
1371 This error is returned when a reserved bit in the Diameter header | |
1372 is set to one (1) or the bits in the Diameter header defined in | |
1373 Sec 3 are set incorrectly. | |
1374 */ | |
1375 struct dict_enumval_data error_code = { "DIAMETER_INVALID_BIT_IN_HEADER", { .u32 = 3011 }}; | |
1376 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1377 } | |
1378 /* 3012 */ | |
1379 { | |
1380 /* | |
1381 This error is returned when a request is received with an invalid | |
1382 message length. | |
1383 */ | |
1384 struct dict_enumval_data error_code = { "DIAMETER_INVALID_MESSAGE_LENGTH", { .u32 = 3012 }}; | |
1385 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1386 } | |
1387 } | |
1388 /* Transient Failures */ | |
1389 { | |
1390 /* 4001 */ | |
1391 { | |
1392 /* | |
1393 The authentication process for the user failed, most likely due to | |
1394 an invalid password used by the user. Further attempts MUST only | |
1395 be tried after prompting the user for a new password. | |
1396 */ | |
1397 struct dict_enumval_data error_code = { "DIAMETER_AUTHENTICATION_REJECTED", { .u32 = 4001 }}; | |
1398 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1399 } | |
1400 /* 4002 */ | |
1401 { | |
1402 /* | |
1403 A Diameter node received the accounting request but was unable to | |
1404 commit it to stable storage due to a temporary lack of space. | |
1405 */ | |
1406 struct dict_enumval_data error_code = { "DIAMETER_OUT_OF_SPACE", { .u32 = 4002 }}; | |
1407 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1408 } | |
1409 /* 4003 */ | |
1410 { | |
1411 /* | |
1412 The peer has determined that it has lost the election process and | |
1413 has therefore disconnected the transport connection. | |
1414 */ | |
1415 struct dict_enumval_data error_code = { "ELECTION_LOST", { .u32 = 4003 }}; | |
1416 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1417 } | |
1418 } | |
1419 /* Permanent Failures */ | |
1420 { | |
1421 /* 5001 */ | |
1422 { | |
1423 /* | |
1424 The peer received a message that contained an AVP that is not | |
1425 recognized or supported and was marked with the Mandatory bit. A | |
1426 Diameter message with this error MUST contain one or more Failed- | |
1427 AVP AVP containing the AVPs that caused the failure. | |
1428 */ | |
1429 struct dict_enumval_data error_code = { "DIAMETER_AVP_UNSUPPORTED", { .u32 = 5001 }}; | |
1430 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1431 } | |
1432 /* 5002 */ | |
1433 { | |
1434 /* | |
1435 The request contained an unknown Session-Id. | |
1436 */ | |
1437 struct dict_enumval_data error_code = { "DIAMETER_UNKNOWN_SESSION_ID", { .u32 = 5002 }}; | |
1438 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1439 } | |
1440 /* 5003 */ | |
1441 { | |
1442 /* | |
1443 A request was received for which the user could not be authorized. | |
1444 This error could occur if the service requested is not permitted | |
1445 to the user. | |
1446 */ | |
1447 struct dict_enumval_data error_code = { "DIAMETER_AUTHORIZATION_REJECTED",{ .u32 = 5003 }}; | |
1448 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1449 } | |
1450 /* 5004 */ | |
1451 { | |
1452 /* | |
1453 The request contained an AVP with an invalid value in its data | |
1454 portion. A Diameter message indicating this error MUST include | |
1455 the offending AVPs within a Failed-AVP AVP. | |
1456 */ | |
1457 struct dict_enumval_data error_code = { "DIAMETER_INVALID_AVP_VALUE", { .u32 = 5004 }}; | |
1458 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1459 } | |
1460 /* 5005 */ | |
1461 { | |
1462 /* | |
1463 The request did not contain an AVP that is required by the Command | |
1464 Code definition. If this value is sent in the Result-Code AVP, a | |
1465 Failed-AVP AVP SHOULD be included in the message. The Failed-AVP | |
1466 AVP MUST contain an example of the missing AVP complete with the | |
1467 Vendor-Id if applicable. The value field of the missing AVP | |
1468 should be of correct minimum length and contain zeroes. | |
1469 */ | |
1470 struct dict_enumval_data error_code = { "DIAMETER_MISSING_AVP", { .u32 = 5005 }}; | |
1471 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1472 } | |
1473 /* 5006 */ | |
1474 { | |
1475 /* | |
1476 A request was received that cannot be authorized because the user | |
1477 has already expended allowed resources. An example of this error | |
1478 condition is a user that is restricted to one dial-up PPP port, | |
1479 attempts to establish a second PPP connection. | |
1480 */ | |
1481 struct dict_enumval_data error_code = { "DIAMETER_RESOURCES_EXCEEDED", { .u32 = 5006 }}; | |
1482 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1483 } | |
1484 /* 5007 */ | |
1485 { | |
1486 /* | |
1487 The Home Diameter server has detected AVPs in the request that | |
1488 contradicted each other, and is not willing to provide service to | |
1489 the user. The Failed-AVP AVPs MUST be present which contains the | |
1490 AVPs that contradicted each other. | |
1491 */ | |
1492 struct dict_enumval_data error_code = { "DIAMETER_CONTRADICTING_AVPS", { .u32 = 5007 }}; | |
1493 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1494 } | |
1495 /* 5008 */ | |
1496 { | |
1497 /* | |
1498 A message was received with an AVP that MUST NOT be present. The | |
1499 Failed-AVP AVP MUST be included and contain a copy of the | |
1500 offending AVP. | |
1501 */ | |
1502 struct dict_enumval_data error_code = { "DIAMETER_AVP_NOT_ALLOWED", { .u32 = 5008 }}; | |
1503 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1504 } | |
1505 /* 5009 */ | |
1506 { | |
1507 /* | |
1508 A message was received that included an AVP that appeared more | |
1509 often than permitted in the message definition. The Failed-AVP | |
1510 AVP MUST be included and contain a copy of the first instance of | |
1511 the offending AVP that exceeded the maximum number of occurrences | |
1512 */ | |
1513 struct dict_enumval_data error_code = { "DIAMETER_AVP_OCCURS_TOO_MANY_TIMES",{ .u32 = 5009 }}; | |
1514 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1515 } | |
1516 /* 5010 */ | |
1517 { | |
1518 /* | |
1519 This error is returned by a Diameter node that is not acting as a | |
1520 relay when it receives a CER which advertises a set of | |
1521 applications that it does not support. | |
1522 */ | |
1523 struct dict_enumval_data error_code = { "DIAMETER_NO_COMMON_APPLICATION",{ .u32 = 5010 }}; | |
1524 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1525 } | |
1526 /* 5011 */ | |
1527 { | |
1528 /* | |
1529 This error is returned when a request was received, whose version | |
1530 number is unsupported. | |
1531 */ | |
1532 struct dict_enumval_data error_code = { "DIAMETER_UNSUPPORTED_VERSION", { .u32 = 5011 }}; | |
1533 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1534 } | |
1535 /* 5012 */ | |
1536 { | |
1537 /* | |
1538 This error is returned when a request is rejected for unspecified | |
1539 reasons. | |
1540 */ | |
1541 struct dict_enumval_data error_code = { "DIAMETER_UNABLE_TO_COMPLY", { .u32 = 5012 }}; | |
1542 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1543 } | |
119
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1544 /* 5013 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1545 { |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1546 /* |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1547 This error is returned when an unrecognized bit in the Diameter |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1548 header is set to one (1). |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1549 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1550 /* (old): it has been changed in 3588bis */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1551 struct dict_enumval_data error_code = { "DIAMETER_INVALID_BIT_IN_HEADER(old)", { .u32 = 5013 }}; |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1552 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1553 } |
0 | 1554 /* 5014 */ |
1555 { | |
1556 /* | |
1557 The request contained an AVP with an invalid length. A Diameter | |
1558 message indicating this error MUST include the offending AVPs | |
1559 within a Failed-AVP AVP. In cases where the erroneous avp length | |
1560 value exceeds the message length or is less than the minimum AVP | |
1561 header length, it is sufficient to include the offending AVP | |
1562 header and a zero filled payload of the minimum required length | |
1563 for the payloads data type. If the AVP is a grouped AVP, the | |
1564 grouped AVP header with an empty payload would be sufficient to | |
1565 indicate the offending AVP. In the case where the offending AVP | |
1566 header cannot be fully decoded when avp length is less than the | |
1567 minimum AVP header length, it is sufficient to include an | |
1568 offending AVP header that is formulated by padding the incomplete | |
1569 AVP header with zero up to the minimum AVP header length. | |
1570 */ | |
1571 struct dict_enumval_data error_code = { "DIAMETER_INVALID_AVP_LENGTH", { .u32 = 5014 }}; | |
1572 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1573 } | |
119
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1574 /* 5015 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1575 { |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1576 /* |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1577 This error is returned when a request is received with an invalid |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1578 message length. |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1579 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1580 /* (old): it has been changed in 3588bis */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1581 struct dict_enumval_data error_code = { "DIAMETER_INVALID_MESSAGE_LENGTH(old)", { .u32 = 5015 }}; |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1582 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1583 } |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1584 /* 5016 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1585 { |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1586 /* |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1587 The request contained an AVP with which is not allowed to have the |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1588 given value in the AVP Flags field. A Diameter message indicating |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1589 this error MUST include the offending AVPs within a Failed-AVP |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1590 AVP. |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1591 */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1592 /* (old): it has been changed in 3588bis */ |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1593 struct dict_enumval_data error_code = { "DIAMETER_INVALID_AVP_BIT_COMBO(old)", { .u32 = 5016 }}; |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1594 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); |
5b3faa0b5c25
Added Result-Code values that disappeard between rfc3588 and 3588bis
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
1595 } |
0 | 1596 /* 5017 */ |
1597 { | |
1598 /* | |
1599 This error is returned when a CER message is received, and there | |
1600 are no common security mechanisms supported between the peers. A | |
1601 Capabilities-Exchange-Answer (CEA) MUST be returned with the | |
1602 Result-Code AVP set to DIAMETER_NO_COMMON_SECURITY. | |
1603 */ | |
1604 struct dict_enumval_data error_code = { "DIAMETER_NO_COMMON_SECURITY", { .u32 = 5017 }}; | |
1605 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1606 } | |
1607 /* 5018 */ | |
1608 { | |
1609 /* | |
1610 A CER was received from an unknown peer. | |
1611 */ | |
1612 struct dict_enumval_data error_code = { "DIAMETER_UNKNOWN_PEER", { .u32 = 5018 }}; | |
1613 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1614 } | |
1615 /* 5019 */ | |
1616 { | |
1617 /* | |
1618 The Request contained a Command-Code that the receiver did not | |
1619 recognize or support. This MUST be used when a Diameter node | |
1620 receives an experimental command that it does not understand. | |
1621 */ | |
1622 struct dict_enumval_data error_code = { "DIAMETER_COMMAND_UNSUPPORTED", { .u32 = 5019 }}; | |
1623 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1624 } | |
1625 /* 5020 */ | |
1626 { | |
1627 /* | |
1628 A request was received whose bits in the Diameter header were | |
1629 either set to an invalid combination, or to a value that is | |
1630 inconsistent with the command code's definition. | |
1631 */ | |
1632 struct dict_enumval_data error_code = { "DIAMETER_INVALID_HDR_BITS", { .u32 = 5020 }}; | |
1633 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1634 } | |
1635 /* 5021 */ | |
1636 { | |
1637 /* | |
1638 A request was received that included an AVP whose flag bits are | |
1639 set to an unrecognized value, or that is inconsistent with the | |
1640 AVP's definition. | |
1641 */ | |
1642 struct dict_enumval_data error_code = { "DIAMETER_INVALID_AVP_BITS", { .u32 = 5021 }}; | |
1643 CHECK_dict_new( DICT_ENUMVAL, &error_code , type, NULL); | |
1644 } | |
1645 } | |
1646 } | |
1647 | |
1648 /* Error-Message */ | |
1649 { | |
1650 /* | |
1651 The Error-Message AVP (AVP Code 281) is of type UTF8String. It MAY | |
1652 accompany a Result-Code AVP as a human readable error message. The | |
1653 Error-Message AVP is not intended to be useful in real-time, and | |
1654 SHOULD NOT be expected to be parsed by network entities. | |
1655 */ | |
1656 struct dict_avp_data data = { | |
1657 281, /* Code */ | |
1658 #if AC_ERROR_MESSAGE != 281 | |
1659 #error "AC_ERROR_MESSAGE definition mismatch" | |
1660 #endif | |
1661 0, /* Vendor */ | |
1662 "Error-Message", /* Name */ | |
1663 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1664 0, /* Fixed flag values */ | |
1665 AVP_TYPE_OCTETSTRING /* base type of data */ | |
1666 }; | |
1667 CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); | |
1668 } | |
1669 | |
1670 /* Error-Reporting-Host */ | |
1671 { | |
1672 /* | |
1673 The Error-Reporting-Host AVP (AVP Code 294) is of type | |
1674 DiameterIdentity. This AVP contains the identity of the Diameter | |
1675 host that sent the Result-Code AVP to a value other than 2001 | |
1676 (Success), only if the host setting the Result-Code is different from | |
1677 the one encoded in the Origin-Host AVP. This AVP is intended to be | |
1678 used for troubleshooting purposes, and MUST be set when the Result- | |
1679 Code AVP indicates a failure. | |
1680 */ | |
1681 struct dict_avp_data data = { | |
1682 294, /* Code */ | |
1683 #if AC_ERROR_REPORTING_HOST != 294 | |
1684 #error "AC_ERROR_REPORTING_HOST definition mismatch" | |
1685 #endif | |
1686 0, /* Vendor */ | |
1687 "Error-Reporting-Host", /* Name */ | |
1688 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1689 0, /* Fixed flag values */ | |
1690 AVP_TYPE_OCTETSTRING /* base type of data */ | |
1691 }; | |
1692 CHECK_dict_new( DICT_AVP, &data , DiameterIdentity_type, NULL); | |
1693 } | |
1694 | |
1695 /* Failed-AVP */ | |
1696 { | |
1697 /* | |
1698 The Failed-AVP AVP (AVP Code 279) is of type Grouped and provides | |
1699 debugging information in cases where a request is rejected or not | |
1700 fully processed due to erroneous information in a specific AVP. The | |
1701 value of the Result-Code AVP will provide information on the reason | |
1702 for the Failed-AVP AVP. A Diameter message SHOULD contain only one | |
1703 Failed-AVP that corresponds to the error indicated by the Result-Code | |
1704 AVP. For practical purposes, this Failed-AVP would typically refer | |
1705 to the first AVP processing error that a Diameter node encounters. | |
1706 | |
1707 The possible reasons for this AVP are the presence of an improperly | |
1708 constructed AVP, an unsupported or unrecognized AVP, an invalid AVP | |
1709 value, the omission of a required AVP, the presence of an explicitly | |
1710 excluded AVP (see tables in Section 10), or the presence of two or | |
1711 more occurrences of an AVP which is restricted to 0, 1, or 0-1 | |
1712 occurrences. | |
1713 | |
1714 A Diameter message SHOULD contain one Failed-AVP AVP, containing the | |
1715 entire AVP that could not be processed successfully. If the failure | |
1716 reason is omission of a required AVP, an AVP with the missing AVP | |
1717 code, the missing vendor id, and a zero filled payload of the minimum | |
1718 required length for the omitted AVP will be added. If the failure | |
1719 reason is an invalid AVP length where the reported length is less | |
1720 than the minimum AVP header length or greater than the reported | |
1721 message length, a copy of the offending AVP header and a zero filled | |
1722 payload of the minimum required length SHOULD be added. | |
1723 | |
1724 In the case where the offending AVP is embedded within a grouped AVP, | |
1725 the Failed-AVP MAY contain the grouped AVP which in turn contains the | |
1726 single offending AVP. The same method MAY be employed if the grouped | |
1727 AVP itself is embedded in yet another grouped AVP and so on. In this | |
1728 case, the Failed-AVP MAY contain the grouped AVP heirarchy up to the | |
1729 single offending AVP. This enables the recipient to detect the | |
1730 location of the offending AVP when embedded in a group. | |
1731 | |
1732 AVP Format | |
1733 | |
1734 <Failed-AVP> ::= < AVP Header: 279 > | |
1735 1* {AVP} | |
1736 */ | |
1737 struct dict_avp_data data = { | |
1738 279, /* Code */ | |
1739 #if AC_FAILED_AVP != 279 | |
1740 #error "AC_FAILED_AVP definition mismatch" | |
1741 #endif | |
1742 0, /* Vendor */ | |
1743 "Failed-AVP", /* Name */ | |
1744 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1745 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1746 AVP_TYPE_GROUPED /* base type of data */ | |
1747 }; | |
1748 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
1749 } | |
1750 | |
1751 /* Experimental-Result */ | |
1752 { | |
1753 /* | |
1754 The Experimental-Result AVP (AVP Code 297) is of type Grouped, and | |
1755 indicates whether a particular vendor-specific request was completed | |
1756 successfully or whether an error occurred. Its Data field has the | |
1757 following ABNF grammar: | |
1758 | |
1759 AVP Format | |
1760 | |
1761 Experimental-Result ::= < AVP Header: 297 > | |
1762 { Vendor-Id } | |
1763 { Experimental-Result-Code } | |
1764 | |
1765 The Vendor-Id AVP (see Section 5.3.3) in this grouped AVP identifies | |
1766 the vendor responsible for the assignment of the result code which | |
1767 follows. All Diameter answer messages defined in vendor-specific | |
1768 applications MUST include either one Result-Code AVP or one | |
1769 Experimental-Result AVP. | |
1770 */ | |
1771 struct dict_avp_data data = { | |
1772 297, /* Code */ | |
1773 0, /* Vendor */ | |
1774 "Experimental-Result", /* Name */ | |
1775 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1776 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1777 AVP_TYPE_GROUPED /* base type of data */ | |
1778 }; | |
1779 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
1780 } | |
1781 | |
1782 /* Experimental-Result-Code */ | |
1783 { | |
1784 /* | |
1785 The Experimental-Result-Code AVP (AVP Code 298) is of type Unsigned32 | |
1786 and contains a vendor-assigned value representing the result of | |
1787 processing the request. | |
1788 | |
1789 It is recommended that vendor-specific result codes follow the same | |
1790 conventions given for the Result-Code AVP regarding the different | |
1791 types of result codes and the handling of errors (for non 2xxx | |
1792 values). | |
1793 */ | |
1794 /* Although the RFC does not specify an "Enumerated" type here, we go forward and create one. | |
1795 * This is the reason for the "*" in the type name. Vendors will have to define their values. | |
1796 */ | |
1797 struct dict_object * type; | |
1798 struct dict_type_data tdata = { AVP_TYPE_UNSIGNED32, "Enumerated*(Experimental-Result-Code)" , NULL, NULL}; | |
1799 struct dict_avp_data data = { | |
1800 298, /* Code */ | |
1801 0, /* Vendor */ | |
1802 "Experimental-Result-Code", /* Name */ | |
1803 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1804 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1805 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
1806 }; | |
1807 | |
1808 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
1809 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
1810 } | |
1811 | |
1812 /* Auth-Request-Type */ | |
1813 { | |
1814 /* | |
1815 The Auth-Request-Type AVP (AVP Code 274) is of type Enumerated and is | |
1816 included in application-specific auth requests to inform the peers | |
1817 whether a user is to be authenticated only, authorized only or both. | |
1818 Note any value other than both MAY cause RADIUS interoperability | |
1819 issues. The following values are defined: | |
1820 | |
1821 | |
1822 AUTHENTICATE_ONLY 1 | |
1823 | |
1824 The request being sent is for authentication only, and MUST | |
1825 contain the relevant application specific authentication AVPs that | |
1826 are needed by the Diameter server to authenticate the user. | |
1827 | |
1828 | |
1829 AUTHORIZE_ONLY 2 | |
1830 | |
1831 The request being sent is for authorization only, and MUST contain | |
1832 the application specific authorization AVPs that are necessary to | |
1833 identify the service being requested/offered. | |
1834 | |
1835 | |
1836 AUTHORIZE_AUTHENTICATE 3 | |
1837 | |
1838 The request contains a request for both authentication and | |
1839 authorization. The request MUST include both the relevant | |
1840 application specific authentication information, and authorization | |
1841 information necessary to identify the service being requested/ | |
1842 offered. | |
1843 */ | |
1844 struct dict_object * type; | |
1845 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Auth-Request-Type)" , NULL, NULL}; | |
1846 struct dict_enumval_data t_1 = { "AUTHENTICATE_ONLY", { .i32 = 1 }}; | |
1847 struct dict_enumval_data t_2 = { "AUTHORIZE_ONLY", { .i32 = 2 }}; | |
1848 struct dict_enumval_data t_3 = { "AUTHORIZE_AUTHENTICATE", { .i32 = 3 }}; | |
1849 struct dict_avp_data data = { | |
1850 274, /* Code */ | |
1851 0, /* Vendor */ | |
1852 "Auth-Request-Type", /* Name */ | |
1853 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1854 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1855 AVP_TYPE_INTEGER32 /* base type of data */ | |
1856 }; | |
1857 /* Create the Enumerated type, and then the AVP */ | |
1858 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
1859 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL); | |
1860 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL); | |
1861 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL); | |
1862 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
1863 } | |
1864 | |
1865 /* Session-Id */ | |
1866 { | |
1867 /* | |
1868 The Session-Id AVP (AVP Code 263) is of type UTF8String and is used | |
1869 to identify a specific session (see Section 8). All messages | |
1870 pertaining to a specific session MUST include only one Session-Id AVP | |
1871 and the same value MUST be used throughout the life of a session. | |
1872 When present, the Session-Id SHOULD appear immediately following the | |
1873 Diameter Header (see Section 3). | |
1874 | |
1875 The Session-Id MUST be globally and eternally unique, as it is meant | |
1876 to uniquely identify a user session without reference to any other | |
1877 information, and may be needed to correlate historical authentication | |
1878 information with accounting information. The Session-Id includes a | |
1879 mandatory portion and an implementation-defined portion; a | |
1880 recommended format for the implementation-defined portion is outlined | |
1881 below. | |
1882 | |
1883 (skipped, see RFC for detail) | |
1884 */ | |
1885 struct dict_avp_data data = { | |
1886 263, /* Code */ | |
1887 #if AC_SESSION_ID != 263 | |
1888 #error "AC_SESSION_ID definition mismatch" | |
1889 #endif | |
1890 0, /* Vendor */ | |
1891 "Session-Id", /* Name */ | |
1892 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1893 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1894 AVP_TYPE_OCTETSTRING /* base type of data */ | |
1895 }; | |
1896 CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); | |
1897 } | |
1898 | |
1899 /* Authorization-Lifetime */ | |
1900 { | |
1901 /* | |
1902 The Authorization-Lifetime AVP (AVP Code 291) is of type Unsigned32 | |
1903 and contains the maximum number of seconds of service to be provided | |
1904 to the user before the user is to be re-authenticated and/or re- | |
1905 authorized. Great care should be taken when the Authorization- | |
1906 Lifetime value is determined, since a low, non-zero, value could | |
1907 create significant Diameter traffic, which could congest both the | |
1908 network and the agents. | |
1909 | |
1910 A value of zero (0) means that immediate re-auth is necessary by the | |
1911 access device. This is typically used in cases where multiple | |
1912 authentication methods are used, and a successful auth response with | |
1913 this AVP set to zero is used to signal that the next authentication | |
1914 method is to be immediately initiated. The absence of this AVP, or a | |
1915 value of all ones (meaning all bits in the 32 bit field are set to | |
1916 one) means no re-auth is expected. | |
1917 | |
1918 If both this AVP and the Session-Timeout AVP are present in a | |
1919 message, the value of the latter MUST NOT be smaller than the | |
1920 Authorization-Lifetime AVP. | |
1921 | |
1922 An Authorization-Lifetime AVP MAY be present in re-authorization | |
1923 messages, and contains the number of seconds the user is authorized | |
1924 to receive service from the time the re-auth answer message is | |
1925 received by the access device. | |
1926 | |
1927 This AVP MAY be provided by the client as a hint of the maximum | |
1928 lifetime that it is willing to accept. However, the server MAY | |
1929 return a value that is equal to, or smaller, than the one provided by | |
1930 the client. | |
1931 */ | |
1932 struct dict_avp_data data = { | |
1933 291, /* Code */ | |
1934 0, /* Vendor */ | |
1935 "Authorization-Lifetime", /* Name */ | |
1936 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1937 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1938 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
1939 }; | |
1940 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
1941 } | |
1942 | |
1943 /* Auth-Grace-Period */ | |
1944 { | |
1945 /* | |
1946 The Auth-Grace-Period AVP (AVP Code 276) is of type Unsigned32 and | |
1947 contains the number of seconds the Diameter server will wait | |
1948 following the expiration of the Authorization-Lifetime AVP before | |
1949 cleaning up resources for the session. | |
1950 */ | |
1951 struct dict_avp_data data = { | |
1952 276, /* Code */ | |
1953 0, /* Vendor */ | |
1954 "Auth-Grace-Period", /* Name */ | |
1955 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1956 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1957 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
1958 }; | |
1959 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
1960 } | |
1961 | |
1962 /* Auth-Session-State */ | |
1963 { | |
1964 /* | |
1965 The Auth-Session-State AVP (AVP Code 277) is of type Enumerated and | |
1966 specifies whether state is maintained for a particular session. The | |
1967 client MAY include this AVP in requests as a hint to the server, but | |
1968 the value in the server's answer message is binding. The following | |
1969 values are supported: | |
1970 | |
1971 | |
1972 STATE_MAINTAINED 0 | |
1973 | |
1974 This value is used to specify that session state is being | |
1975 maintained, and the access device MUST issue a session termination | |
1976 message when service to the user is terminated. This is the | |
1977 default value. | |
1978 | |
1979 | |
1980 NO_STATE_MAINTAINED 1 | |
1981 | |
1982 This value is used to specify that no session termination messages | |
1983 will be sent by the access device upon expiration of the | |
1984 Authorization-Lifetime. | |
1985 */ | |
1986 struct dict_object * type; | |
1987 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Auth-Session-State)" , NULL, NULL}; | |
1988 struct dict_enumval_data t_0 = { "STATE_MAINTAINED", { .i32 = 0 }}; | |
1989 struct dict_enumval_data t_1 = { "NO_STATE_MAINTAINED", { .i32 = 1 }}; | |
1990 struct dict_avp_data data = { | |
1991 277, /* Code */ | |
1992 0, /* Vendor */ | |
1993 "Auth-Session-State", /* Name */ | |
1994 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
1995 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
1996 AVP_TYPE_INTEGER32 /* base type of data */ | |
1997 }; | |
1998 /* Create the Enumerated type, and then the AVP */ | |
1999 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
2000 CHECK_dict_new( DICT_ENUMVAL, &t_0 , type, NULL); | |
2001 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL); | |
2002 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
2003 } | |
2004 | |
2005 /* Re-Auth-Request-Type */ | |
2006 { | |
2007 /* | |
2008 The Re-Auth-Request-Type AVP (AVP Code 285) is of type Enumerated and | |
2009 is included in application-specific auth answers to inform the client | |
2010 of the action expected upon expiration of the Authorization-Lifetime. | |
2011 If the answer message contains an Authorization-Lifetime AVP with a | |
2012 positive value, the Re-Auth-Request-Type AVP MUST be present in an | |
2013 answer message. The following values are defined: | |
2014 | |
2015 | |
2016 AUTHORIZE_ONLY 0 | |
2017 | |
2018 An authorization only re-auth is expected upon expiration of the | |
2019 Authorization-Lifetime. This is the default value if the AVP is | |
2020 not present in answer messages that include the Authorization- | |
2021 Lifetime. | |
2022 | |
2023 | |
2024 AUTHORIZE_AUTHENTICATE 1 | |
2025 | |
2026 An authentication and authorization re-auth is expected upon | |
2027 expiration of the Authorization-Lifetime. | |
2028 */ | |
2029 struct dict_object * type; | |
2030 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Re-Auth-Request-Type)" , NULL, NULL}; | |
2031 struct dict_enumval_data t_0 = { "AUTHORIZE_ONLY", { .i32 = 0 }}; | |
2032 struct dict_enumval_data t_1 = { "AUTHORIZE_AUTHENTICATE", { .i32 = 1 }}; | |
2033 struct dict_avp_data data = { | |
2034 285, /* Code */ | |
2035 0, /* Vendor */ | |
2036 "Re-Auth-Request-Type", /* Name */ | |
2037 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2038 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2039 AVP_TYPE_INTEGER32 /* base type of data */ | |
2040 }; | |
2041 /* Create the Enumerated type, and then the AVP */ | |
2042 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
2043 CHECK_dict_new( DICT_ENUMVAL, &t_0 , type, NULL); | |
2044 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL); | |
2045 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
2046 } | |
2047 | |
2048 /* Session-Timeout */ | |
2049 { | |
2050 /* | |
2051 The Session-Timeout AVP (AVP Code 27) [RFC2865] is of type Unsigned32 | |
2052 and contains the maximum number of seconds of service to be provided | |
2053 to the user before termination of the session. When both the | |
2054 Session-Timeout and the Authorization-Lifetime AVPs are present in an | |
2055 answer message, the former MUST be equal to or greater than the value | |
2056 of the latter. | |
2057 | |
2058 A session that terminates on an access device due to the expiration | |
2059 of the Session-Timeout MUST cause an STR to be issued, unless both | |
2060 the access device and the home server had previously agreed that no | |
2061 session termination messages would be sent (see Section 8.11). | |
2062 | |
2063 A Session-Timeout AVP MAY be present in a re-authorization answer | |
2064 message, and contains the remaining number of seconds from the | |
2065 beginning of the re-auth. | |
2066 | |
2067 A value of zero, or the absence of this AVP, means that this session | |
2068 has an unlimited number of seconds before termination. | |
2069 | |
2070 This AVP MAY be provided by the client as a hint of the maximum | |
2071 timeout that it is willing to accept. However, the server MAY return | |
2072 a value that is equal to, or smaller, than the one provided by the | |
2073 client. | |
2074 */ | |
2075 struct dict_avp_data data = { | |
2076 27, /* Code */ | |
2077 0, /* Vendor */ | |
2078 "Session-Timeout", /* Name */ | |
2079 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2080 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2081 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
2082 }; | |
2083 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
2084 } | |
2085 | |
2086 /* User-Name */ | |
2087 { | |
2088 /* | |
2089 The User-Name AVP (AVP Code 1) [RFC2865] is of type UTF8String, which | |
2090 contains the User-Name, in a format consistent with the NAI | |
2091 specification [RFC4282]. | |
2092 */ | |
2093 struct dict_avp_data data = { | |
2094 1, /* Code */ | |
2095 0, /* Vendor */ | |
2096 "User-Name", /* Name */ | |
2097 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2098 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2099 AVP_TYPE_OCTETSTRING /* base type of data */ | |
2100 }; | |
2101 CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); | |
2102 } | |
2103 | |
2104 /* Termination-Cause */ | |
2105 { | |
2106 /* | |
2107 The Termination-Cause AVP (AVP Code 295) is of type Enumerated, and | |
2108 is used to indicate the reason why a session was terminated on the | |
2109 access device. The following values are defined: | |
2110 | |
2111 | |
2112 DIAMETER_LOGOUT 1 | |
2113 | |
2114 The user initiated a disconnect | |
2115 | |
2116 | |
2117 DIAMETER_SERVICE_NOT_PROVIDED 2 | |
2118 | |
2119 This value is used when the user disconnected prior to the receipt | |
2120 of the authorization answer message. | |
2121 | |
2122 | |
2123 DIAMETER_BAD_ANSWER 3 | |
2124 | |
2125 This value indicates that the authorization answer received by the | |
2126 access device was not processed successfully. | |
2127 | |
2128 | |
2129 DIAMETER_ADMINISTRATIVE 4 | |
2130 | |
2131 The user was not granted access, or was disconnected, due to | |
2132 administrative reasons, such as the receipt of a Abort-Session- | |
2133 Request message. | |
2134 | |
2135 | |
2136 DIAMETER_LINK_BROKEN 5 | |
2137 | |
2138 The communication to the user was abruptly disconnected. | |
2139 | |
2140 | |
2141 DIAMETER_AUTH_EXPIRED 6 | |
2142 | |
2143 The user's access was terminated since its authorized session time | |
2144 has expired. | |
2145 | |
2146 | |
2147 DIAMETER_USER_MOVED 7 | |
2148 | |
2149 The user is receiving services from another access device. | |
2150 | |
2151 | |
2152 DIAMETER_SESSION_TIMEOUT 8 | |
2153 | |
2154 The user's session has timed out, and service has been terminated. | |
2155 */ | |
2156 struct dict_object * type; | |
2157 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Termination-Cause)" , NULL, NULL}; | |
2158 struct dict_enumval_data t_1 = { "DIAMETER_LOGOUT", { .i32 = 1 }}; | |
2159 struct dict_enumval_data t_2 = { "DIAMETER_SERVICE_NOT_PROVIDED", { .i32 = 2 }}; | |
2160 struct dict_enumval_data t_3 = { "DIAMETER_BAD_ANSWER", { .i32 = 3 }}; | |
2161 struct dict_enumval_data t_4 = { "DIAMETER_ADMINISTRATIVE", { .i32 = 4 }}; | |
2162 struct dict_enumval_data t_5 = { "DIAMETER_LINK_BROKEN", { .i32 = 5 }}; | |
2163 struct dict_enumval_data t_6 = { "DIAMETER_AUTH_EXPIRED", { .i32 = 6 }}; | |
2164 struct dict_enumval_data t_7 = { "DIAMETER_USER_MOVED", { .i32 = 7 }}; | |
2165 struct dict_enumval_data t_8 = { "DIAMETER_SESSION_TIMEOUT", { .i32 = 8 }}; | |
2166 struct dict_avp_data data = { | |
2167 295, /* Code */ | |
2168 0, /* Vendor */ | |
2169 "Termination-Cause", /* Name */ | |
2170 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2171 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2172 AVP_TYPE_INTEGER32 /* base type of data */ | |
2173 }; | |
2174 /* Create the Enumerated type, and then the AVP */ | |
2175 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
2176 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL); | |
2177 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL); | |
2178 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL); | |
2179 CHECK_dict_new( DICT_ENUMVAL, &t_4 , type, NULL); | |
2180 CHECK_dict_new( DICT_ENUMVAL, &t_5 , type, NULL); | |
2181 CHECK_dict_new( DICT_ENUMVAL, &t_6 , type, NULL); | |
2182 CHECK_dict_new( DICT_ENUMVAL, &t_7 , type, NULL); | |
2183 CHECK_dict_new( DICT_ENUMVAL, &t_8 , type, NULL); | |
2184 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
2185 } | |
2186 | |
2187 /* Origin-State-Id */ | |
2188 { | |
2189 /* | |
2190 The Origin-State-Id AVP (AVP Code 278), of type Unsigned32, is a | |
2191 monotonically increasing value that is advanced whenever a Diameter | |
2192 entity restarts with loss of previous state, for example upon reboot. | |
2193 Origin-State-Id MAY be included in any Diameter message, including | |
2194 CER. | |
2195 | |
2196 A Diameter entity issuing this AVP MUST create a higher value for | |
2197 this AVP each time its state is reset. A Diameter entity MAY set | |
2198 Origin-State-Id to the time of startup, or it MAY use an incrementing | |
2199 counter retained in non-volatile memory across restarts. | |
2200 | |
2201 The Origin-State-Id, if present, MUST reflect the state of the entity | |
2202 indicated by Origin-Host. If a proxy modifies Origin-Host, it MUST | |
2203 either remove Origin-State-Id or modify it appropriately as well. | |
2204 Typically, Origin-State-Id is used by an access device that always | |
2205 starts up with no active sessions; that is, any session active prior | |
2206 to restart will have been lost. By including Origin-State-Id in a | |
2207 message, it allows other Diameter entities to infer that sessions | |
2208 associated with a lower Origin-State-Id are no longer active. If an | |
2209 access device does not intend for such inferences to be made, it MUST | |
2210 either not include Origin-State-Id in any message, or set its value | |
2211 to 0. | |
2212 */ | |
2213 struct dict_avp_data data = { | |
2214 278, /* Code */ | |
2215 0, /* Vendor */ | |
2216 "Origin-State-Id", /* Name */ | |
2217 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2218 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2219 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
2220 }; | |
2221 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
2222 } | |
2223 | |
2224 /* Session-Binding */ | |
2225 { | |
2226 /* | |
2227 The Session-Binding AVP (AVP Code 270) is of type Unsigned32, and MAY | |
2228 be present in application-specific authorization answer messages. If | |
2229 present, this AVP MAY inform the Diameter client that all future | |
2230 application-specific re-auth messages for this session MUST be sent | |
2231 to the same authorization server. This AVP MAY also specify that a | |
2232 Session-Termination-Request message for this session MUST be sent to | |
2233 the same authorizing server. | |
2234 | |
2235 This field is a bit mask, and the following bits have been defined: | |
2236 | |
2237 | |
2238 RE_AUTH 1 | |
2239 | |
2240 When set, future re-auth messages for this session MUST NOT | |
2241 include the Destination-Host AVP. When cleared, the default | |
2242 value, the Destination-Host AVP MUST be present in all re-auth | |
2243 messages for this session. | |
2244 | |
2245 | |
2246 STR 2 | |
2247 | |
2248 When set, the STR message for this session MUST NOT include the | |
2249 Destination-Host AVP. When cleared, the default value, the | |
2250 Destination-Host AVP MUST be present in the STR message for this | |
2251 session. | |
2252 | |
2253 | |
2254 ACCOUNTING 4 | |
2255 | |
2256 When set, all accounting messages for this session MUST NOT | |
2257 include the Destination-Host AVP. When cleared, the default | |
2258 value, the Destination-Host AVP, if known, MUST be present in all | |
2259 accounting messages for this session. | |
2260 */ | |
2261 | |
2262 /* Although the RFC does not specify an "Enumerated" type here, we go forward and create one. | |
2263 * This is the reason for the "*" in the type name | |
2264 * The actual values of the AVP will not always be defined here, but at least it can be used in some cases. | |
2265 * ... maybe the code will be changed later to support bitfields AVP ... | |
2266 */ | |
2267 | |
2268 struct dict_object * type; | |
2269 struct dict_type_data tdata = { AVP_TYPE_UNSIGNED32, "Enumerated*(Session-Binding)" , NULL, NULL}; | |
2270 struct dict_enumval_data t_1 = { "RE_AUTH", { .u32 = 1 }}; | |
2271 struct dict_enumval_data t_2 = { "STR", { .u32 = 2 }}; | |
2272 struct dict_enumval_data t_4 = { "ACCOUNTING", { .u32 = 4 }}; | |
2273 struct dict_avp_data data = { | |
2274 270, /* Code */ | |
2275 0, /* Vendor */ | |
2276 "Session-Binding", /* Name */ | |
2277 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2278 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2279 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
2280 }; | |
2281 /* Create the Enumerated type, and then the AVP */ | |
2282 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
2283 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL); | |
2284 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL); | |
2285 CHECK_dict_new( DICT_ENUMVAL, &t_4 , type, NULL); | |
2286 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
2287 } | |
2288 | |
2289 /* Session-Server-Failover */ | |
2290 { | |
2291 /* | |
2292 The Session-Server-Failover AVP (AVP Code 271) is of type Enumerated, | |
2293 and MAY be present in application-specific authorization answer | |
2294 messages that either do not include the Session-Binding AVP or | |
2295 include the Session-Binding AVP with any of the bits set to a zero | |
2296 value. If present, this AVP MAY inform the Diameter client that if a | |
2297 re-auth or STR message fails due to a delivery problem, the Diameter | |
2298 client SHOULD issue a subsequent message without the Destination-Host | |
2299 AVP. When absent, the default value is REFUSE_SERVICE. | |
2300 | |
2301 The following values are supported: | |
2302 | |
2303 | |
2304 REFUSE_SERVICE 0 | |
2305 | |
2306 If either the re-auth or the STR message delivery fails, terminate | |
2307 service with the user, and do not attempt any subsequent attempts. | |
2308 | |
2309 | |
2310 TRY_AGAIN 1 | |
2311 | |
2312 If either the re-auth or the STR message delivery fails, resend | |
2313 the failed message without the Destination-Host AVP present. | |
2314 | |
2315 | |
2316 ALLOW_SERVICE 2 | |
2317 | |
2318 If re-auth message delivery fails, assume that re-authorization | |
2319 succeeded. If STR message delivery fails, terminate the session. | |
2320 | |
2321 | |
2322 TRY_AGAIN_ALLOW_SERVICE 3 | |
2323 | |
2324 If either the re-auth or the STR message delivery fails, resend | |
2325 the failed message without the Destination-Host AVP present. If | |
2326 the second delivery fails for re-auth, assume re-authorization | |
2327 succeeded. If the second delivery fails for STR, terminate the | |
2328 session. | |
2329 */ | |
2330 struct dict_object * type; | |
2331 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Session-Server-Failover)" , NULL, NULL}; | |
2332 struct dict_enumval_data t_0 = { "REFUSE_SERVICE", { .i32 = 0 }}; | |
2333 struct dict_enumval_data t_1 = { "TRY_AGAIN", { .i32 = 1 }}; | |
2334 struct dict_enumval_data t_2 = { "ALLOW_SERVICE", { .i32 = 2 }}; | |
2335 struct dict_enumval_data t_3 = { "TRY_AGAIN_ALLOW_SERVICE", { .i32 = 3 }}; | |
2336 struct dict_avp_data data = { | |
2337 271, /* Code */ | |
2338 0, /* Vendor */ | |
2339 "Session-Server-Failover", /* Name */ | |
2340 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2341 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2342 AVP_TYPE_INTEGER32 /* base type of data */ | |
2343 }; | |
2344 /* Create the Enumerated type, and then the AVP */ | |
2345 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
2346 CHECK_dict_new( DICT_ENUMVAL, &t_0 , type, NULL); | |
2347 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL); | |
2348 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL); | |
2349 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL); | |
2350 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
2351 } | |
2352 | |
2353 /* Multi-Round-Time-Out */ | |
2354 { | |
2355 /* | |
2356 The Multi-Round-Time-Out AVP (AVP Code 272) is of type Unsigned32, | |
2357 and SHOULD be present in application-specific authorization answer | |
2358 messages whose Result-Code AVP is set to DIAMETER_MULTI_ROUND_AUTH. | |
2359 This AVP contains the maximum number of seconds that the access | |
2360 device MUST provide the user in responding to an authentication | |
2361 request. | |
2362 */ | |
2363 struct dict_avp_data data = { | |
2364 272, /* Code */ | |
2365 0, /* Vendor */ | |
2366 "Multi-Round-Time-Out", /* Name */ | |
2367 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2368 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2369 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
2370 }; | |
2371 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
2372 } | |
2373 | |
2374 /* Class */ | |
2375 { | |
2376 /* | |
2377 The Class AVP (AVP Code 25) is of type OctetString and is used to by | |
2378 Diameter servers to return state information to the access device. | |
2379 When one or more Class AVPs are present in application-specific | |
2380 authorization answer messages, they MUST be present in subsequent re- | |
2381 authorization, session termination and accounting messages. Class | |
2382 AVPs found in a re-authorization answer message override the ones | |
2383 found in any previous authorization answer message. Diameter server | |
2384 implementations SHOULD NOT return Class AVPs that require more than | |
2385 4096 bytes of storage on the Diameter client. A Diameter client that | |
2386 receives Class AVPs whose size exceeds local available storage MUST | |
2387 terminate the session. | |
2388 */ | |
2389 struct dict_avp_data data = { | |
2390 25, /* Code */ | |
2391 0, /* Vendor */ | |
2392 "Class", /* Name */ | |
2393 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2394 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2395 AVP_TYPE_OCTETSTRING /* base type of data */ | |
2396 }; | |
2397 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
2398 } | |
2399 | |
2400 /* Event-Timestamp */ | |
2401 { | |
2402 /* | |
2403 The Event-Timestamp (AVP Code 55) is of type Time, and MAY be | |
2404 included in an Accounting-Request and Accounting-Answer messages to | |
2405 record the time that the reported event occurred, in seconds since | |
2406 January 1, 1900 00:00 UTC. | |
2407 */ | |
2408 struct dict_avp_data data = { | |
2409 55, /* Code */ | |
2410 0, /* Vendor */ | |
2411 "Event-Timestamp", /* Name */ | |
2412 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2413 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2414 AVP_TYPE_OCTETSTRING /* base type of data */ | |
2415 }; | |
2416 CHECK_dict_new( DICT_AVP, &data , Time_type, NULL); | |
2417 } | |
2418 | |
2419 | |
2420 /* Accounting-Record-Type */ | |
2421 { | |
2422 /* | |
2423 The Accounting-Record-Type AVP (AVP Code 480) is of type Enumerated | |
2424 and contains the type of accounting record being sent. The following | |
2425 values are currently defined for the Accounting-Record-Type AVP: | |
2426 | |
2427 | |
2428 EVENT_RECORD 1 | |
2429 | |
2430 An Accounting Event Record is used to indicate that a one-time | |
2431 event has occurred (meaning that the start and end of the event | |
2432 are simultaneous). This record contains all information relevant | |
2433 to the service, and is the only record of the service. | |
2434 | |
2435 | |
2436 START_RECORD 2 | |
2437 | |
2438 An Accounting Start, Interim, and Stop Records are used to | |
2439 indicate that a service of a measurable length has been given. An | |
2440 Accounting Start Record is used to initiate an accounting session, | |
2441 and contains accounting information that is relevant to the | |
2442 initiation of the session. | |
2443 | |
2444 | |
2445 INTERIM_RECORD 3 | |
2446 | |
2447 An Interim Accounting Record contains cumulative accounting | |
2448 information for an existing accounting session. Interim | |
2449 Accounting Records SHOULD be sent every time a re-authentication | |
2450 or re-authorization occurs. Further, additional interim record | |
2451 triggers MAY be defined by application-specific Diameter | |
2452 applications. The selection of whether to use INTERIM_RECORD | |
2453 records is done by the Acct-Interim-Interval AVP. | |
2454 | |
2455 | |
2456 STOP_RECORD 4 | |
2457 | |
2458 An Accounting Stop Record is sent to terminate an accounting | |
2459 session and contains cumulative accounting information relevant to | |
2460 the existing session. | |
2461 */ | |
2462 struct dict_object * type; | |
2463 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Accounting-Record-Type)" , NULL, NULL}; | |
2464 struct dict_enumval_data t_1 = { "EVENT_RECORD", { .i32 = 1 }}; | |
2465 struct dict_enumval_data t_2 = { "START_RECORD", { .i32 = 2 }}; | |
2466 struct dict_enumval_data t_3 = { "INTERIM_RECORD", { .i32 = 3 }}; | |
2467 struct dict_enumval_data t_4 = { "STOP_RECORD", { .i32 = 4 }}; | |
2468 struct dict_avp_data data = { | |
2469 480, /* Code */ | |
2470 0, /* Vendor */ | |
2471 "Accounting-Record-Type", /* Name */ | |
2472 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2473 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2474 AVP_TYPE_INTEGER32 /* base type of data */ | |
2475 }; | |
2476 /* Create the Enumerated type, and then the AVP */ | |
2477 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
2478 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL); | |
2479 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL); | |
2480 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL); | |
2481 CHECK_dict_new( DICT_ENUMVAL, &t_4 , type, NULL); | |
2482 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
2483 } | |
2484 | |
2485 /* Acct-Interim-Interval */ | |
2486 { | |
2487 /* | |
2488 The Acct-Interim-Interval AVP (AVP Code 85) is of type Unsigned32 and | |
2489 is sent from the Diameter home authorization server to the Diameter | |
2490 client. The client uses information in this AVP to decide how and | |
2491 when to produce accounting records. With different values in this | |
2492 AVP, service sessions can result in one, two, or two+N accounting | |
2493 records, based on the needs of the home-organization. The following | |
2494 accounting record production behavior is directed by the inclusion of | |
2495 this AVP: | |
2496 | |
2497 | |
2498 1. The omission of the Acct-Interim-Interval AVP or its inclusion | |
2499 with Value field set to 0 means that EVENT_RECORD, START_RECORD, | |
2500 and STOP_RECORD are produced, as appropriate for the service. | |
2501 | |
2502 | |
2503 2. The inclusion of the AVP with Value field set to a non-zero value | |
2504 means that INTERIM_RECORD records MUST be produced between the | |
2505 START_RECORD and STOP_RECORD records. The Value field of this | |
2506 AVP is the nominal interval between these records in seconds. | |
2507 | |
2508 The Diameter node that originates the accounting information, | |
2509 known as the client, MUST produce the first INTERIM_RECORD record | |
2510 roughly at the time when this nominal interval has elapsed from | |
2511 the START_RECORD, the next one again as the interval has elapsed | |
2512 once more, and so on until the session ends and a STOP_RECORD | |
2513 record is produced. | |
2514 | |
2515 The client MUST ensure that the interim record production times | |
2516 are randomized so that large accounting message storms are not | |
2517 created either among records or around a common service start | |
2518 time. | |
2519 */ | |
2520 struct dict_avp_data data = { | |
2521 85, /* Code */ | |
2522 0, /* Vendor */ | |
2523 "Acct-Interim-Interval", /* Name */ | |
2524 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2525 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2526 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
2527 }; | |
2528 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
2529 } | |
2530 | |
2531 /* Accounting-Record-Number */ | |
2532 { | |
2533 /* | |
2534 The Accounting-Record-Number AVP (AVP Code 485) is of type Unsigned32 | |
2535 and identifies this record within one session. As Session-Id AVPs | |
2536 are globally unique, the combination of Session-Id and Accounting- | |
2537 Record-Number AVPs is also globally unique, and can be used in | |
2538 matching accounting records with confirmations. An easy way to | |
2539 produce unique numbers is to set the value to 0 for records of type | |
2540 EVENT_RECORD and START_RECORD, and set the value to 1 for the first | |
2541 INTERIM_RECORD, 2 for the second, and so on until the value for | |
2542 STOP_RECORD is one more than for the last INTERIM_RECORD. | |
2543 */ | |
2544 struct dict_avp_data data = { | |
2545 485, /* Code */ | |
2546 0, /* Vendor */ | |
2547 "Accounting-Record-Number", /* Name */ | |
2548 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2549 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2550 AVP_TYPE_UNSIGNED32 /* base type of data */ | |
2551 }; | |
2552 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
2553 } | |
2554 | |
2555 /* Acct-Session-Id */ | |
2556 { | |
2557 /* | |
2558 The Acct-Session-Id AVP (AVP Code 44) is of type OctetString is only | |
2559 used when RADIUS/Diameter translation occurs. This AVP contains the | |
2560 contents of the RADIUS Acct-Session-Id attribute. | |
2561 */ | |
2562 struct dict_avp_data data = { | |
2563 44, /* Code */ | |
2564 0, /* Vendor */ | |
2565 "Acct-Session-Id", /* Name */ | |
2566 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2567 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2568 AVP_TYPE_OCTETSTRING /* base type of data */ | |
2569 }; | |
2570 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
2571 } | |
2572 | |
2573 /* Acct-Multi-Session-Id */ | |
2574 { | |
2575 /* | |
2576 The Acct-Multi-Session-Id AVP (AVP Code 50) is of type UTF8String, | |
2577 following the format specified in Section 8.8. The Acct-Multi- | |
2578 Session-Id AVP is used to link together multiple related accounting | |
2579 sessions, where each session would have a unique Session-Id, but the | |
2580 same Acct-Multi-Session-Id AVP. This AVP MAY be returned by the | |
2581 Diameter server in an authorization answer, and MUST be used in all | |
2582 accounting messages for the given session. | |
2583 */ | |
2584 struct dict_avp_data data = { | |
2585 50, /* Code */ | |
2586 0, /* Vendor */ | |
2587 "Acct-Multi-Session-Id", /* Name */ | |
2588 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2589 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2590 AVP_TYPE_OCTETSTRING /* base type of data */ | |
2591 }; | |
2592 CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); | |
2593 } | |
2594 | |
2595 /* Accounting-Sub-Session-Id */ | |
2596 { | |
2597 /* | |
2598 The Accounting-Sub-Session-Id AVP (AVP Code 287) is of type | |
2599 Unsigned64 and contains the accounting sub-session identifier. The | |
2600 combination of the Session-Id and this AVP MUST be unique per sub- | |
2601 session, and the value of this AVP MUST be monotonically increased by | |
2602 one for all new sub-sessions. The absence of this AVP implies no | |
2603 sub-sessions are in use, with the exception of an Accounting-Request | |
2604 whose Accounting-Record-Type is set to STOP_RECORD. A STOP_RECORD | |
2605 message with no Accounting-Sub-Session-Id AVP present will signal the | |
2606 termination of all sub-sessions for a given Session-Id. | |
2607 */ | |
2608 struct dict_avp_data data = { | |
2609 287, /* Code */ | |
2610 0, /* Vendor */ | |
2611 "Accounting-Sub-Session-Id", /* Name */ | |
2612 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2613 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2614 AVP_TYPE_UNSIGNED64 /* base type of data */ | |
2615 }; | |
2616 CHECK_dict_new( DICT_AVP, &data , NULL, NULL); | |
2617 } | |
2618 | |
2619 /* Accounting-Realtime-Required */ | |
2620 { | |
2621 /* | |
2622 The Accounting-Realtime-Required AVP (AVP Code 483) is of type | |
2623 Enumerated and is sent from the Diameter home authorization server to | |
2624 the Diameter client or in the Accounting-Answer from the accounting | |
2625 server. The client uses information in this AVP to decide what to do | |
2626 if the sending of accounting records to the accounting server has | |
2627 been temporarily prevented due to, for instance, a network problem. | |
2628 | |
2629 | |
2630 DELIVER_AND_GRANT 1 | |
2631 | |
2632 The AVP with Value field set to DELIVER_AND_GRANT means that the | |
2633 service MUST only be granted as long as there is a connection to | |
2634 an accounting server. Note that the set of alternative accounting | |
2635 servers are treated as one server in this sense. Having to move | |
2636 the accounting record stream to a backup server is not a reason to | |
2637 discontinue the service to the user. | |
2638 | |
2639 | |
2640 GRANT_AND_STORE 2 | |
2641 | |
2642 The AVP with Value field set to GRANT_AND_STORE means that service | |
2643 SHOULD be granted if there is a connection, or as long as records | |
2644 can still be stored as described in Section 9.4. | |
2645 | |
2646 This is the default behavior if the AVP isn't included in the | |
2647 reply from the authorization server. | |
2648 | |
2649 | |
2650 GRANT_AND_LOSE 3 | |
2651 | |
2652 The AVP with Value field set to GRANT_AND_LOSE means that service | |
2653 SHOULD be granted even if the records can not be delivered or | |
2654 stored. | |
2655 */ | |
2656 struct dict_object * type; | |
2657 struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Accounting-Realtime-Required)" , NULL, NULL}; | |
2658 struct dict_enumval_data t_1 = { "DELIVER_AND_GRANT", { .i32 = 1 }}; | |
2659 struct dict_enumval_data t_2 = { "GRANT_AND_STORE", { .i32 = 2 }}; | |
2660 struct dict_enumval_data t_3 = { "GRANT_AND_LOSE", { .i32 = 3 }}; | |
2661 struct dict_avp_data data = { | |
2662 483, /* Code */ | |
2663 0, /* Vendor */ | |
2664 "Accounting-Realtime-Required", /* Name */ | |
2665 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ | |
2666 AVP_FLAG_MANDATORY, /* Fixed flag values */ | |
2667 AVP_TYPE_INTEGER32 /* base type of data */ | |
2668 }; | |
2669 /* Create the Enumerated type, and then the AVP */ | |
2670 CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); | |
2671 CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL); | |
2672 CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL); | |
2673 CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL); | |
2674 CHECK_dict_new( DICT_AVP, &data , type, NULL); | |
2675 } | |
2676 | |
2677 } | |
2678 | |
2679 /* Commands section */ | |
2680 { | |
2681 /* To avoid defining global variables for all the AVP that we use here, we do search the dictionary in each sub-block. | |
2682 * This is far from optimal, but the code is clearer like this, and the time it requires at execution is not noticeable. | |
2683 */ | |
2684 | |
2685 /* Generic message syntax when the 'E' bit is set */ | |
2686 { | |
2687 /* | |
2688 The 'E' (Error Bit) in the Diameter header is set when the request | |
2689 caused a protocol-related error (see Section 7.1.3). A message with | |
2690 the 'E' bit MUST NOT be sent as a response to an answer message. | |
2691 Note that a message with the 'E' bit set is still subjected to the | |
2692 processing rules defined in Section 6.2. When set, the answer | |
2693 message will not conform to the ABNF specification for the command, | |
2694 and will instead conform to the following ABNF: | |
2695 | |
2696 Message Format | |
2697 | |
2698 <answer-message> ::= < Diameter Header: code, ERR [PXY] > | |
2699 0*1< Session-Id > | |
2700 { Origin-Host } | |
2701 { Origin-Realm } | |
2702 { Result-Code } | |
2703 [ Origin-State-Id ] | |
2704 [ Error-Message ] | |
2705 [ Error-Reporting-Host ] | |
2706 [ Failed-AVP ] | |
2707 * [ Proxy-Info ] | |
2708 * [ AVP ] | |
2709 | |
2710 Note that the code used in the header is the same than the one found | |
2711 in the request message, but with the 'R' bit cleared and the 'E' bit | |
2712 set. The 'P' bit in the header is set to the same value as the one | |
2713 found in the request message. | |
2714 */ | |
2715 struct dict_object * cmd_error; | |
2716 struct local_rules_definition rules[] = | |
2717 { { "Session-Id", RULE_FIXED_HEAD,0, 1 } | |
2718 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 } | |
2719 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
2720 ,{ "Result-Code", RULE_REQUIRED, -1, 1 } | |
2721 ,{ "Origin-State-Id", RULE_OPTIONAL, -1, 1 } | |
2722 ,{ "Error-Message", RULE_OPTIONAL, -1, 1 } | |
2723 ,{ "Error-Reporting-Host", RULE_OPTIONAL, -1, 1 } | |
2724 ,{ "Failed-AVP", RULE_OPTIONAL, -1, 1 } | |
2725 ,{ "Proxy-Info", RULE_OPTIONAL, -1,-1 } | |
2726 }; | |
2727 CHECK_FCT( fd_dict_get_error_cmd(dict, &cmd_error) ); | |
2728 PARSE_loc_rules( rules, cmd_error ); | |
2729 } | |
2730 | |
2731 /* Capabilities-Exchange-Request */ | |
2732 { | |
2733 /* | |
2734 The Capabilities-Exchange-Request (CER), indicated by the Command- | |
2735 Code set to 257 and the Command Flags' 'R' bit set, is sent to | |
2736 exchange local capabilities. Upon detection of a transport failure, | |
2737 this message MUST NOT be sent to an alternate peer. | |
2738 | |
2739 When Diameter is run over SCTP [RFC2960], which allows for | |
2740 connections to span multiple interfaces and multiple IP addresses, | |
2741 the Capabilities-Exchange-Request message MUST contain one Host-IP- | |
2742 Address AVP for each potential IP address that MAY be locally used | |
2743 when transmitting Diameter messages. | |
2744 | |
2745 Message Format | |
2746 | |
2747 <CER> ::= < Diameter Header: 257, REQ > | |
2748 { Origin-Host } | |
2749 { Origin-Realm } | |
2750 1* { Host-IP-Address } | |
2751 { Vendor-Id } | |
2752 { Product-Name } | |
2753 [ Origin-State-Id ] | |
2754 * [ Supported-Vendor-Id ] | |
2755 * [ Auth-Application-Id ] | |
2756 * [ Inband-Security-Id ] | |
2757 * [ Acct-Application-Id ] | |
2758 * [ Vendor-Specific-Application-Id ] | |
2759 [ Firmware-Revision ] | |
2760 * [ AVP ] | |
2761 */ | |
2762 struct dict_object * cmd; | |
2763 struct dict_cmd_data data = { | |
2764 257, /* Code */ | |
2765 #if CC_CAPABILITIES_EXCHANGE != 257 | |
2766 #error "CC_CAPABILITIES_EXCHANGE definition mismatch" | |
2767 #endif | |
2768 "Capabilities-Exchange-Request", /* Name */ | |
2769 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_RETRANSMIT | CMD_FLAG_ERROR, /* Fixed flags */ | |
2770 CMD_FLAG_REQUEST /* Fixed flag values */ | |
2771 }; | |
2772 struct local_rules_definition rules[] = | |
2773 { { "Origin-Host", RULE_REQUIRED, -1, 1 } | |
2774 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
2775 ,{ "Host-IP-Address", RULE_REQUIRED, -1,-1 } | |
2776 ,{ "Vendor-Id", RULE_REQUIRED, -1, 1 } | |
2777 ,{ "Product-Name", RULE_REQUIRED, -1, 1 } | |
2778 ,{ "Origin-State-Id", RULE_OPTIONAL, -1, 1 } | |
2779 ,{ "Supported-Vendor-Id", RULE_OPTIONAL, -1,-1 } | |
2780 ,{ "Auth-Application-Id", RULE_OPTIONAL, -1,-1 } | |
2781 ,{ "Inband-Security-Id", RULE_OPTIONAL, -1,-1 } | |
2782 ,{ "Acct-Application-Id", RULE_OPTIONAL, -1,-1 } | |
2783 ,{ "Vendor-Specific-Application-Id", RULE_OPTIONAL, -1,-1 } | |
2784 ,{ "Firmware-Revision", RULE_OPTIONAL, -1, 1 } | |
2785 }; | |
2786 | |
2787 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
2788 PARSE_loc_rules( rules, cmd ); | |
2789 } | |
2790 | |
2791 /* Capabilities-Exchange-Answer */ | |
2792 { | |
2793 /* | |
2794 The Capabilities-Exchange-Answer (CEA), indicated by the Command-Code | |
2795 set to 257 and the Command Flags' 'R' bit cleared, is sent in | |
2796 response to a CER message. | |
2797 | |
2798 When Diameter is run over SCTP [RFC2960], which allows connections to | |
2799 span multiple interfaces, hence, multiple IP addresses, the | |
2800 Capabilities-Exchange-Answer message MUST contain one Host-IP-Address | |
2801 AVP for each potential IP address that MAY be locally used when | |
2802 transmitting Diameter messages. | |
2803 | |
2804 Message Format | |
2805 | |
2806 <CEA> ::= < Diameter Header: 257 > | |
2807 { Result-Code } | |
2808 { Origin-Host } | |
2809 { Origin-Realm } | |
2810 1* { Host-IP-Address } | |
2811 { Vendor-Id } | |
2812 { Product-Name } | |
2813 [ Origin-State-Id ] | |
2814 [ Error-Message ] | |
2815 [ Failed-AVP ] | |
2816 * [ Supported-Vendor-Id ] | |
2817 * [ Auth-Application-Id ] | |
2818 * [ Inband-Security-Id ] | |
2819 * [ Acct-Application-Id ] | |
2820 * [ Vendor-Specific-Application-Id ] | |
2821 [ Firmware-Revision ] | |
2822 * [ AVP ] | |
2823 */ | |
2824 struct dict_object * cmd; | |
2825 struct dict_cmd_data data = { | |
2826 257, /* Code */ | |
2827 #if CC_CAPABILITIES_EXCHANGE != 257 | |
2828 #error "CC_CAPABILITIES_EXCHANGE definition mismatch" | |
2829 #endif | |
2830 "Capabilities-Exchange-Answer", /* Name */ | |
2831 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_RETRANSMIT, /* Fixed flags */ | |
2832 0 /* Fixed flag values */ | |
2833 }; | |
2834 struct local_rules_definition rules[] = | |
2835 { { "Result-Code", RULE_REQUIRED, -1, 1 } | |
2836 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 } | |
2837 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
2838 ,{ "Host-IP-Address", RULE_REQUIRED, -1,-1 } | |
2839 ,{ "Vendor-Id", RULE_REQUIRED, -1, 1 } | |
2840 ,{ "Product-Name", RULE_REQUIRED, -1, 1 } | |
2841 ,{ "Origin-State-Id", RULE_OPTIONAL, -1, 1 } | |
2842 ,{ "Error-Message", RULE_OPTIONAL, -1, 1 } | |
2843 ,{ "Failed-AVP", RULE_OPTIONAL, -1, 1 } | |
2844 ,{ "Supported-Vendor-Id", RULE_OPTIONAL, -1,-1 } | |
2845 ,{ "Auth-Application-Id", RULE_OPTIONAL, -1,-1 } | |
2846 ,{ "Inband-Security-Id", RULE_OPTIONAL, -1,-1 } | |
2847 ,{ "Acct-Application-Id", RULE_OPTIONAL, -1,-1 } | |
2848 ,{ "Vendor-Specific-Application-Id", RULE_OPTIONAL, -1,-1 } | |
2849 ,{ "Firmware-Revision", RULE_OPTIONAL, -1, 1 } | |
2850 }; | |
2851 | |
2852 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
2853 PARSE_loc_rules( rules, cmd ); | |
2854 } | |
2855 | |
2856 /* Disconnect-Peer-Request */ | |
2857 { | |
2858 /* | |
2859 The Disconnect-Peer-Request (DPR), indicated by the Command-Code set | |
2860 to 282 and the Command Flags' 'R' bit set, is sent to a peer to | |
2861 inform its intentions to shutdown the transport connection. Upon | |
2862 detection of a transport failure, this message MUST NOT be sent to an | |
2863 alternate peer. | |
2864 | |
2865 Message Format | |
2866 | |
2867 <DPR> ::= < Diameter Header: 282, REQ > | |
2868 { Origin-Host } | |
2869 { Origin-Realm } | |
2870 { Disconnect-Cause } | |
2871 */ | |
2872 struct dict_object * cmd; | |
2873 struct dict_cmd_data data = { | |
2874 282, /* Code */ | |
2875 #if CC_DISCONNECT_PEER != 282 | |
2876 #error "CC_DISCONNECT_PEER definition mismatch" | |
2877 #endif | |
2878 "Disconnect-Peer-Request", /* Name */ | |
2879 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_RETRANSMIT | CMD_FLAG_ERROR, /* Fixed flags */ | |
2880 CMD_FLAG_REQUEST /* Fixed flag values */ | |
2881 }; | |
2882 struct local_rules_definition rules[] = | |
2883 { { "Origin-Host", RULE_REQUIRED, -1, 1 } | |
2884 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
2885 ,{ "Disconnect-Cause", RULE_REQUIRED, -1, 1 } | |
2886 }; | |
2887 | |
2888 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
2889 PARSE_loc_rules( rules, cmd ); | |
2890 } | |
2891 | |
2892 /* Disconnect-Peer-Answer */ | |
2893 { | |
2894 /* | |
2895 The Disconnect-Peer-Answer (DPA), indicated by the Command-Code set | |
2896 to 282 and the Command Flags' 'R' bit cleared, is sent as a response | |
2897 to the Disconnect-Peer-Request message. Upon receipt of this | |
2898 message, the transport connection is shutdown. | |
2899 | |
2900 Message Format | |
2901 | |
2902 <DPA> ::= < Diameter Header: 282 > | |
2903 { Result-Code } | |
2904 { Origin-Host } | |
2905 { Origin-Realm } | |
2906 [ Error-Message ] | |
2907 [ Failed-AVP ] | |
2908 */ | |
2909 struct dict_object * cmd; | |
2910 struct dict_cmd_data data = { | |
2911 282, /* Code */ | |
2912 #if CC_DISCONNECT_PEER != 282 | |
2913 #error "CC_DISCONNECT_PEER definition mismatch" | |
2914 #endif | |
2915 "Disconnect-Peer-Answer", /* Name */ | |
2916 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_RETRANSMIT, /* Fixed flags */ | |
2917 0 /* Fixed flag values */ | |
2918 }; | |
2919 struct local_rules_definition rules[] = | |
2920 { { "Result-Code", RULE_REQUIRED, -1, 1 } | |
2921 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 } | |
2922 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
2923 ,{ "Error-Message", RULE_OPTIONAL, -1, 1 } | |
2924 ,{ "Failed-AVP", RULE_OPTIONAL, -1, 1 } | |
2925 }; | |
2926 | |
2927 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
2928 PARSE_loc_rules( rules, cmd ); | |
2929 } | |
2930 | |
2931 /* Device-Watchdog-Request */ | |
2932 { | |
2933 /* | |
2934 The Device-Watchdog-Request (DWR), indicated by the Command-Code set | |
2935 to 280 and the Command Flags' 'R' bit set, is sent to a peer when no | |
2936 traffic has been exchanged between two peers (see Section 5.5.3). | |
2937 Upon detection of a transport failure, this message MUST NOT be sent | |
2938 to an alternate peer. | |
2939 | |
2940 Message Format | |
2941 | |
2942 <DWR> ::= < Diameter Header: 280, REQ > | |
2943 { Origin-Host } | |
2944 { Origin-Realm } | |
2945 [ Origin-State-Id ] | |
2946 */ | |
2947 struct dict_object * cmd; | |
2948 struct dict_cmd_data data = { | |
2949 280, /* Code */ | |
2950 #if CC_DEVICE_WATCHDOG != 280 | |
2951 #error "CC_DEVICE_WATCHDOG definition mismatch" | |
2952 #endif | |
2953 "Device-Watchdog-Request", /* Name */ | |
2954 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_RETRANSMIT | CMD_FLAG_ERROR, /* Fixed flags */ | |
2955 CMD_FLAG_REQUEST /* Fixed flag values */ | |
2956 }; | |
2957 struct local_rules_definition rules[] = | |
2958 { { "Origin-Host", RULE_REQUIRED, -1, 1 } | |
2959 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
2960 ,{ "Origin-State-Id", RULE_OPTIONAL, -1, 1 } | |
2961 }; | |
2962 | |
2963 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
2964 PARSE_loc_rules( rules, cmd ); | |
2965 } | |
2966 | |
2967 /* Device-Watchdog-Answer */ | |
2968 { | |
2969 /* | |
2970 The Device-Watchdog-Answer (DWA), indicated by the Command-Code set | |
2971 to 280 and the Command Flags' 'R' bit cleared, is sent as a response | |
2972 to the Device-Watchdog-Request message. | |
2973 | |
2974 Message Format | |
2975 | |
2976 <DWA> ::= < Diameter Header: 280 > | |
2977 { Result-Code } | |
2978 { Origin-Host } | |
2979 { Origin-Realm } | |
2980 [ Error-Message ] | |
2981 [ Failed-AVP ] | |
2982 [ Origin-State-Id ] | |
2983 */ | |
2984 struct dict_object * cmd; | |
2985 struct dict_cmd_data data = { | |
2986 280, /* Code */ | |
2987 #if CC_DEVICE_WATCHDOG != 280 | |
2988 #error "CC_DEVICE_WATCHDOG definition mismatch" | |
2989 #endif | |
2990 "Device-Watchdog-Answer", /* Name */ | |
2991 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_RETRANSMIT, /* Fixed flags */ | |
2992 0 /* Fixed flag values */ | |
2993 }; | |
2994 struct local_rules_definition rules[] = | |
2995 { { "Result-Code", RULE_REQUIRED, -1, 1 } | |
2996 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 } | |
2997 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
2998 ,{ "Error-Message", RULE_OPTIONAL, -1, 1 } | |
2999 ,{ "Failed-AVP", RULE_OPTIONAL, -1, 1 } | |
3000 ,{ "Origin-State-Id", RULE_OPTIONAL, -1, 1 } | |
3001 }; | |
3002 | |
3003 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
3004 PARSE_loc_rules( rules, cmd ); | |
3005 } | |
3006 | |
3007 /* Re-Auth-Request */ | |
3008 { | |
3009 /* | |
3010 The Re-Auth-Request (RAR), indicated by the Command-Code set to 258 | |
3011 and the message flags' 'R' bit set, may be sent by any server to the | |
3012 access device that is providing session service, to request that the | |
3013 user be re-authenticated and/or re-authorized. | |
3014 | |
3015 | |
3016 Message Format | |
3017 | |
3018 <RAR> ::= < Diameter Header: 258, REQ, PXY > | |
3019 < Session-Id > | |
3020 { Origin-Host } | |
3021 { Origin-Realm } | |
3022 { Destination-Realm } | |
3023 { Destination-Host } | |
3024 { Auth-Application-Id } | |
3025 { Re-Auth-Request-Type } | |
3026 [ User-Name ] | |
3027 [ Origin-State-Id ] | |
3028 * [ Proxy-Info ] | |
3029 * [ Route-Record ] | |
3030 * [ AVP ] | |
3031 */ | |
3032 struct dict_object * cmd; | |
3033 struct dict_cmd_data data = { | |
3034 258, /* Code */ | |
3035 #if CC_RE_AUTH != 258 | |
3036 #error "CC_RE_AUTH definition mismatch" | |
3037 #endif | |
3038 "Re-Auth-Request", /* Name */ | |
3039 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */ | |
3040 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */ | |
3041 }; | |
3042 struct local_rules_definition rules[] = | |
3043 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 } | |
3044 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 } | |
3045 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
3046 ,{ "Destination-Realm", RULE_REQUIRED, -1, 1 } | |
3047 ,{ "Destination-Host", RULE_REQUIRED, -1, 1 } | |
3048 ,{ "Auth-Application-Id", RULE_REQUIRED, -1, 1 } | |
3049 ,{ "Re-Auth-Request-Type", RULE_REQUIRED, -1, 1 } | |
3050 ,{ "User-Name", RULE_OPTIONAL, -1, 1 } | |
3051 ,{ "Origin-State-Id", RULE_OPTIONAL, -1, 1 } | |
3052 ,{ "Proxy-Info", RULE_OPTIONAL, -1,-1 } | |
3053 ,{ "Route-Record", RULE_OPTIONAL, -1,-1 } | |
3054 }; | |
3055 | |
3056 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
3057 PARSE_loc_rules( rules, cmd ); | |
3058 } | |
3059 | |
3060 /* Re-Auth-Answer */ | |
3061 { | |
3062 /* | |
3063 The Re-Auth-Answer (RAA), indicated by the Command-Code set to 258 | |
3064 and the message flags' 'R' bit clear, is sent in response to the RAR. | |
3065 The Result-Code AVP MUST be present, and indicates the disposition of | |
3066 the request. | |
3067 | |
3068 A successful RAA message MUST be followed by an application-specific | |
3069 authentication and/or authorization message. | |
3070 | |
3071 | |
3072 Message Format | |
3073 | |
3074 <RAA> ::= < Diameter Header: 258, PXY > | |
3075 < Session-Id > | |
3076 { Result-Code } | |
3077 { Origin-Host } | |
3078 { Origin-Realm } | |
3079 [ User-Name ] | |
3080 [ Origin-State-Id ] | |
3081 [ Error-Message ] | |
3082 [ Error-Reporting-Host ] | |
3083 [ Failed-AVP ] | |
3084 * [ Redirect-Host ] | |
3085 [ Redirect-Host-Usage ] | |
3086 [ Redirect-Max-Cache-Time ] | |
3087 * [ Proxy-Info ] | |
3088 * [ AVP ] | |
3089 */ | |
3090 struct dict_object * cmd; | |
3091 struct dict_cmd_data data = { | |
3092 258, /* Code */ | |
3093 #if CC_RE_AUTH != 258 | |
3094 #error "CC_RE_AUTH definition mismatch" | |
3095 #endif | |
3096 "Re-Auth-Answer", /* Name */ | |
3097 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE, /* Fixed flags */ | |
3098 CMD_FLAG_PROXIABLE /* Fixed flag values */ | |
3099 }; | |
3100 struct local_rules_definition rules[] = | |
3101 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 } | |
3102 ,{ "Result-Code", RULE_REQUIRED, -1, 1 } | |
3103 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 } | |
3104 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
3105 ,{ "User-Name", RULE_OPTIONAL, -1, 1 } | |
3106 ,{ "Origin-State-Id", RULE_OPTIONAL, -1, 1 } | |
3107 ,{ "Error-Message", RULE_OPTIONAL, -1, 1 } | |
3108 ,{ "Error-Reporting-Host", RULE_OPTIONAL, -1, 1 } | |
3109 ,{ "Failed-AVP", RULE_OPTIONAL, -1, 1 } | |
3110 ,{ "Redirect-Host", RULE_OPTIONAL, -1,-1 } | |
3111 ,{ "Redirect-Host-Usage", RULE_OPTIONAL, -1, 1 } | |
3112 ,{ "Redirect-Max-Cache-Time", RULE_OPTIONAL, -1, 1 } | |
3113 ,{ "Proxy-Info", RULE_OPTIONAL, -1,-1 } | |
3114 }; | |
3115 | |
3116 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
3117 PARSE_loc_rules( rules, cmd ); | |
3118 } | |
3119 | |
3120 /* Session-Termination-Request */ | |
3121 { | |
3122 /* | |
3123 The Session-Termination-Request (STR), indicated by the Command-Code | |
3124 set to 275 and the Command Flags' 'R' bit set, is sent by the access | |
3125 device to inform the Diameter Server that an authenticated and/or | |
3126 authorized session is being terminated. | |
3127 | |
3128 | |
3129 Message Format | |
3130 | |
3131 <STR> ::= < Diameter Header: 275, REQ, PXY > | |
3132 < Session-Id > | |
3133 { Origin-Host } | |
3134 { Origin-Realm } | |
3135 { Destination-Realm } | |
3136 { Auth-Application-Id } | |
3137 { Termination-Cause } | |
3138 [ User-Name ] | |
3139 [ Destination-Host ] | |
3140 * [ Class ] | |
3141 [ Origin-State-Id ] | |
3142 * [ Proxy-Info ] | |
3143 * [ Route-Record ] | |
3144 * [ AVP ] | |
3145 */ | |
3146 struct dict_object * cmd; | |
3147 struct dict_cmd_data data = { | |
3148 275, /* Code */ | |
3149 #if CC_SESSION_TERMINATION != 275 | |
3150 #error "CC_SESSION_TERMINATION definition mismatch" | |
3151 #endif | |
3152 "Session-Termination-Request", /* Name */ | |
3153 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */ | |
3154 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */ | |
3155 }; | |
3156 struct local_rules_definition rules[] = | |
3157 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 } | |
3158 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 } | |
3159 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
3160 ,{ "Destination-Realm", RULE_REQUIRED, -1, 1 } | |
3161 ,{ "Auth-Application-Id", RULE_REQUIRED, -1, 1 } | |
3162 ,{ "Termination-Cause", RULE_REQUIRED, -1, 1 } | |
3163 ,{ "User-Name", RULE_OPTIONAL, -1, 1 } | |
3164 ,{ "Destination-Host", RULE_OPTIONAL, -1, 1 } | |
3165 ,{ "Class", RULE_OPTIONAL, -1,-1 } | |
3166 ,{ "Origin-State-Id", RULE_OPTIONAL, -1, 1 } | |
3167 ,{ "Proxy-Info", RULE_OPTIONAL, -1,-1 } | |
3168 ,{ "Route-Record", RULE_OPTIONAL, -1,-1 } | |
3169 }; | |
3170 | |
3171 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
3172 PARSE_loc_rules( rules, cmd ); | |
3173 } | |
3174 | |
3175 /* Session-Termination-Answer */ | |
3176 { | |
3177 /* | |
3178 The Session-Termination-Answer (STA), indicated by the Command-Code | |
3179 set to 275 and the message flags' 'R' bit clear, is sent by the | |
3180 Diameter Server to acknowledge the notification that the session has | |
3181 been terminated. The Result-Code AVP MUST be present, and MAY | |
3182 contain an indication that an error occurred while servicing the STR. | |
3183 | |
3184 Upon sending or receipt of the STA, the Diameter Server MUST release | |
3185 all resources for the session indicated by the Session-Id AVP. Any | |
3186 intermediate server in the Proxy-Chain MAY also release any | |
3187 resources, if necessary. | |
3188 | |
3189 Message Format | |
3190 | |
3191 <STA> ::= < Diameter Header: 275, PXY > | |
3192 < Session-Id > | |
3193 { Result-Code } | |
3194 { Origin-Host } | |
3195 { Origin-Realm } | |
3196 [ User-Name ] | |
3197 * [ Class ] | |
3198 [ Error-Message ] | |
3199 [ Error-Reporting-Host ] | |
3200 [ Failed-AVP ] | |
3201 [ Origin-State-Id ] | |
3202 * [ Redirect-Host ] | |
3203 [ Redirect-Host-Usage ] | |
3204 [ Redirect-Max-Cache-Time ] | |
3205 * [ Proxy-Info ] | |
3206 * [ AVP ] | |
3207 */ | |
3208 struct dict_object * cmd; | |
3209 struct dict_cmd_data data = { | |
3210 275, /* Code */ | |
3211 #if CC_SESSION_TERMINATION != 275 | |
3212 #error "CC_SESSION_TERMINATION definition mismatch" | |
3213 #endif | |
3214 "Session-Termination-Answer", /* Name */ | |
3215 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE, /* Fixed flags */ | |
3216 CMD_FLAG_PROXIABLE /* Fixed flag values */ | |
3217 }; | |
3218 struct local_rules_definition rules[] = | |
3219 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 } | |
3220 ,{ "Result-Code", RULE_REQUIRED, -1, 1 } | |
3221 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 } | |
3222 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
3223 ,{ "User-Name", RULE_OPTIONAL, -1, 1 } | |
3224 ,{ "Class", RULE_OPTIONAL, -1,-1 } | |
3225 ,{ "Error-Message", RULE_OPTIONAL, -1, 1 } | |
3226 ,{ "Error-Reporting-Host", RULE_OPTIONAL, -1, 1 } | |
3227 ,{ "Failed-AVP", RULE_OPTIONAL, -1, 1 } | |
3228 ,{ "Origin-State-Id", RULE_OPTIONAL, -1, 1 } | |
3229 ,{ "Redirect-Host", RULE_OPTIONAL, -1,-1 } | |
3230 ,{ "Redirect-Host-Usage", RULE_OPTIONAL, -1, 1 } | |
3231 ,{ "Redirect-Max-Cache-Time", RULE_OPTIONAL, -1, 1 } | |
3232 ,{ "Proxy-Info", RULE_OPTIONAL, -1,-1 } | |
3233 }; | |
3234 | |
3235 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
3236 PARSE_loc_rules( rules, cmd ); | |
3237 } | |
3238 | |
3239 /* Abort-Session-Request */ | |
3240 { | |
3241 /* | |
3242 The Abort-Session-Request (ASR), indicated by the Command-Code set to | |
3243 274 and the message flags' 'R' bit set, may be sent by any server to | |
3244 the access device that is providing session service, to request that | |
3245 the session identified by the Session-Id be stopped. | |
3246 | |
3247 | |
3248 Message Format | |
3249 | |
3250 <ASR> ::= < Diameter Header: 274, REQ, PXY > | |
3251 < Session-Id > | |
3252 { Origin-Host } | |
3253 { Origin-Realm } | |
3254 { Destination-Realm } | |
3255 { Destination-Host } | |
3256 { Auth-Application-Id } | |
3257 [ User-Name ] | |
3258 [ Origin-State-Id ] | |
3259 * [ Proxy-Info ] | |
3260 * [ Route-Record ] | |
3261 * [ AVP ] | |
3262 */ | |
3263 struct dict_object * cmd; | |
3264 struct dict_cmd_data data = { | |
3265 274, /* Code */ | |
3266 #if CC_ABORT_SESSION != 274 | |
3267 #error "CC_ABORT_SESSION definition mismatch" | |
3268 #endif | |
3269 "Abort-Session-Request", /* Name */ | |
3270 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */ | |
3271 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */ | |
3272 }; | |
3273 struct local_rules_definition rules[] = | |
3274 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 } | |
3275 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 } | |
3276 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
3277 ,{ "Destination-Realm", RULE_REQUIRED, -1, 1 } | |
3278 ,{ "Destination-Host", RULE_REQUIRED, -1, 1 } | |
3279 ,{ "Auth-Application-Id", RULE_REQUIRED, -1, 1 } | |
3280 ,{ "User-Name", RULE_OPTIONAL, -1, 1 } | |
3281 ,{ "Origin-State-Id", RULE_OPTIONAL, -1, 1 } | |
3282 ,{ "Proxy-Info", RULE_OPTIONAL, -1,-1 } | |
3283 ,{ "Route-Record", RULE_OPTIONAL, -1,-1 } | |
3284 }; | |
3285 | |
3286 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
3287 PARSE_loc_rules( rules, cmd ); | |
3288 } | |
3289 | |
3290 /* Abort-Session-Answer */ | |
3291 { | |
3292 /* | |
3293 The Abort-Session-Answer (ASA), indicated by the Command-Code set to | |
3294 274 and the message flags' 'R' bit clear, is sent in response to the | |
3295 ASR. The Result-Code AVP MUST be present, and indicates the | |
3296 disposition of the request. | |
3297 | |
3298 If the session identified by Session-Id in the ASR was successfully | |
3299 terminated, Result-Code is set to DIAMETER_SUCCESS. If the session | |
3300 is not currently active, Result-Code is set to | |
3301 DIAMETER_UNKNOWN_SESSION_ID. If the access device does not stop the | |
3302 session for any other reason, Result-Code is set to | |
3303 DIAMETER_UNABLE_TO_COMPLY. | |
3304 | |
3305 Message Format | |
3306 | |
3307 <ASA> ::= < Diameter Header: 274, PXY > | |
3308 < Session-Id > | |
3309 { Result-Code } | |
3310 { Origin-Host } | |
3311 { Origin-Realm } | |
3312 [ User-Name ] | |
3313 [ Origin-State-Id ] | |
3314 [ Error-Message ] | |
3315 [ Error-Reporting-Host ] | |
3316 [ Failed-AVP ] | |
3317 * [ Redirect-Host ] | |
3318 [ Redirect-Host-Usage ] | |
3319 [ Redirect-Max-Cache-Time ] | |
3320 * [ Proxy-Info ] | |
3321 * [ AVP ] | |
3322 */ | |
3323 struct dict_object * cmd; | |
3324 struct dict_cmd_data data = { | |
3325 274, /* Code */ | |
3326 #if CC_ABORT_SESSION != 274 | |
3327 #error "CC_ABORT_SESSION definition mismatch" | |
3328 #endif | |
3329 "Abort-Session-Answer", /* Name */ | |
3330 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE, /* Fixed flags */ | |
3331 CMD_FLAG_PROXIABLE /* Fixed flag values */ | |
3332 }; | |
3333 struct local_rules_definition rules[] = | |
3334 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 } | |
3335 ,{ "Result-Code", RULE_REQUIRED, -1, 1 } | |
3336 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 } | |
3337 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
3338 ,{ "User-Name", RULE_OPTIONAL, -1, 1 } | |
3339 ,{ "Origin-State-Id", RULE_OPTIONAL, -1, 1 } | |
3340 ,{ "Error-Message", RULE_OPTIONAL, -1, 1 } | |
3341 ,{ "Error-Reporting-Host", RULE_OPTIONAL, -1, 1 } | |
3342 ,{ "Failed-AVP", RULE_OPTIONAL, -1, 1 } | |
3343 ,{ "Redirect-Host", RULE_OPTIONAL, -1,-1 } | |
3344 ,{ "Redirect-Host-Usage", RULE_OPTIONAL, -1, 1 } | |
3345 ,{ "Redirect-Max-Cache-Time", RULE_OPTIONAL, -1, 1 } | |
3346 ,{ "Proxy-Info", RULE_OPTIONAL, -1,-1 } | |
3347 }; | |
3348 | |
3349 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
3350 PARSE_loc_rules( rules, cmd ); | |
3351 } | |
3352 | |
3353 /* Accounting-Request */ | |
3354 { | |
3355 /* | |
3356 The Accounting-Request (ACR) command, indicated by the Command-Code | |
3357 field set to 271 and the Command Flags' 'R' bit set, is sent by a | |
3358 Diameter node, acting as a client, in order to exchange accounting | |
3359 information with a peer. | |
3360 | |
3361 One of Acct-Application-Id and Vendor-Specific-Application-Id AVPs | |
3362 MUST be present. If the Vendor-Specific-Application-Id grouped AVP | |
3363 is present, it MUST include an Acct-Application-Id AVP. | |
3364 | |
3365 The AVP listed below SHOULD include service specific accounting AVPs, | |
3366 as described in Section 9.3. | |
3367 | |
3368 | |
3369 Message Format | |
3370 | |
3371 <ACR> ::= < Diameter Header: 271, REQ, PXY > | |
3372 < Session-Id > | |
3373 { Origin-Host } | |
3374 { Origin-Realm } | |
3375 { Destination-Realm } | |
3376 { Accounting-Record-Type } | |
3377 { Accounting-Record-Number } | |
3378 [ Acct-Application-Id ] | |
3379 [ Vendor-Specific-Application-Id ] | |
3380 [ User-Name ] | |
3381 [ Destination-Host ] | |
3382 [ Accounting-Sub-Session-Id ] | |
3383 [ Acct-Session-Id ] | |
3384 [ Acct-Multi-Session-Id ] | |
3385 [ Acct-Interim-Interval ] | |
3386 [ Accounting-Realtime-Required ] | |
3387 [ Origin-State-Id ] | |
3388 [ Event-Timestamp ] | |
3389 * [ Proxy-Info ] | |
3390 * [ Route-Record ] | |
3391 * [ AVP ] | |
3392 */ | |
3393 struct dict_object * cmd; | |
3394 struct dict_cmd_data data = { | |
3395 271, /* Code */ | |
3396 #if CC_ACCOUNTING != 271 | |
3397 #error "CC_ACCOUNTING definition mismatch" | |
3398 #endif | |
3399 "Accounting-Request", /* Name */ | |
3400 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */ | |
3401 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */ | |
3402 }; | |
3403 struct local_rules_definition rules[] = | |
3404 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 } | |
3405 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 } | |
3406 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
3407 ,{ "Destination-Realm", RULE_REQUIRED, -1, 1 } | |
3408 ,{ "Accounting-Record-Type", RULE_REQUIRED, -1, 1 } | |
3409 ,{ "Accounting-Record-Number", RULE_REQUIRED, -1, 1 } | |
3410 ,{ "Acct-Application-Id", RULE_OPTIONAL, -1, 1 } | |
3411 ,{ "Vendor-Specific-Application-Id", RULE_OPTIONAL, -1, 1 } | |
3412 ,{ "User-Name", RULE_OPTIONAL, -1, 1 } | |
3413 ,{ "Destination-Host", RULE_OPTIONAL, -1, 1 } | |
3414 ,{ "Accounting-Sub-Session-Id", RULE_OPTIONAL, -1, 1 } | |
3415 ,{ "Acct-Session-Id", RULE_OPTIONAL, -1, 1 } | |
3416 ,{ "Acct-Multi-Session-Id", RULE_OPTIONAL, -1, 1 } | |
3417 ,{ "Acct-Interim-Interval", RULE_OPTIONAL, -1, 1 } | |
3418 ,{ "Accounting-Realtime-Required", RULE_OPTIONAL, -1, 1 } | |
3419 ,{ "Origin-State-Id", RULE_OPTIONAL, -1, 1 } | |
3420 ,{ "Event-Timestamp", RULE_OPTIONAL, -1, 1 } | |
3421 ,{ "Proxy-Info", RULE_OPTIONAL, -1,-1 } | |
3422 ,{ "Route-Record", RULE_OPTIONAL, -1,-1 } | |
3423 }; | |
3424 | |
3425 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
3426 PARSE_loc_rules( rules, cmd ); | |
3427 } | |
3428 | |
3429 /* Accounting-Answer */ | |
3430 { | |
3431 /* | |
3432 The Accounting-Answer (ACA) command, indicated by the Command-Code | |
3433 field set to 271 and the Command Flags' 'R' bit cleared, is used to | |
3434 acknowledge an Accounting-Request command. The Accounting-Answer | |
3435 command contains the same Session-Id as the corresponding request. | |
3436 | |
3437 Only the target Diameter Server, known as the home Diameter Server, | |
3438 SHOULD respond with the Accounting-Answer command. | |
3439 | |
3440 One of Acct-Application-Id and Vendor-Specific-Application-Id AVPs | |
3441 MUST be present. If the Vendor-Specific-Application-Id grouped AVP | |
3442 is present, it MUST contain an Acct-Application-Id AVP. | |
3443 | |
3444 The AVP listed below SHOULD include service specific accounting AVPs, | |
3445 as described in Section 9.3. | |
3446 | |
3447 | |
3448 Message Format | |
3449 | |
3450 <ACA> ::= < Diameter Header: 271, PXY > | |
3451 < Session-Id > | |
3452 { Result-Code } | |
3453 { Origin-Host } | |
3454 { Origin-Realm } | |
3455 { Accounting-Record-Type } | |
3456 { Accounting-Record-Number } | |
3457 [ Acct-Application-Id ] | |
3458 [ Vendor-Specific-Application-Id ] | |
3459 [ User-Name ] | |
3460 [ Accounting-Sub-Session-Id ] | |
3461 [ Acct-Session-Id ] | |
3462 [ Acct-Multi-Session-Id ] | |
3463 [ Error-Message ] | |
3464 [ Error-Reporting-Host ] | |
3465 [ Failed-AVP ] | |
3466 [ Acct-Interim-Interval ] | |
3467 [ Accounting-Realtime-Required ] | |
3468 [ Origin-State-Id ] | |
3469 [ Event-Timestamp ] | |
3470 * [ Proxy-Info ] | |
3471 * [ AVP ] | |
3472 */ | |
3473 struct dict_object * cmd; | |
3474 struct dict_cmd_data data = { | |
3475 271, /* Code */ | |
3476 #if CC_ACCOUNTING != 271 | |
3477 #error "CC_ACCOUNTING definition mismatch" | |
3478 #endif | |
3479 "Accounting-Answer", /* Name */ | |
3480 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE, /* Fixed flags */ | |
3481 CMD_FLAG_PROXIABLE /* Fixed flag values */ | |
3482 }; | |
3483 struct local_rules_definition rules[] = | |
3484 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 } | |
3485 ,{ "Result-Code", RULE_REQUIRED, -1, 1 } | |
3486 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 } | |
3487 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 } | |
3488 ,{ "Accounting-Record-Type", RULE_REQUIRED, -1, 1 } | |
3489 ,{ "Accounting-Record-Number", RULE_REQUIRED, -1, 1 } | |
3490 ,{ "Acct-Application-Id", RULE_OPTIONAL, -1, 1 } | |
3491 ,{ "Vendor-Specific-Application-Id", RULE_OPTIONAL, -1, 1 } | |
3492 ,{ "User-Name", RULE_OPTIONAL, -1, 1 } | |
3493 ,{ "Accounting-Sub-Session-Id", RULE_OPTIONAL, -1, 1 } | |
3494 ,{ "Acct-Session-Id", RULE_OPTIONAL, -1, 1 } | |
3495 ,{ "Acct-Multi-Session-Id", RULE_OPTIONAL, -1, 1 } | |
3496 ,{ "Error-Message", RULE_OPTIONAL, -1, 1 } | |
3497 ,{ "Error-Reporting-Host", RULE_OPTIONAL, -1, 1 } | |
3498 ,{ "Failed-AVP", RULE_OPTIONAL, -1, 1 } | |
3499 ,{ "Acct-Interim-Interval", RULE_OPTIONAL, -1, 1 } | |
3500 ,{ "Accounting-Realtime-Required", RULE_OPTIONAL, -1, 1 } | |
3501 ,{ "Origin-State-Id", RULE_OPTIONAL, -1, 1 } | |
3502 ,{ "Event-Timestamp", RULE_OPTIONAL, -1, 1 } | |
3503 ,{ "Proxy-Info", RULE_OPTIONAL, -1,-1 } | |
3504 }; | |
3505 | |
3506 CHECK_dict_new( DICT_COMMAND, &data , NULL, &cmd); | |
3507 PARSE_loc_rules( rules, cmd ); | |
3508 } | |
3509 } | |
3510 | |
3511 return 0; | |
3512 } |