blob: dd58c8d81af3597d6da543631887b54220f56ddc [file] [log] [blame]
Brian Waters13d96012017-12-08 16:53:31 -06001/*********************************************************************************************************
2 * Software License Agreement (BSD License) *
3 * Author: Norberto R. de Goes Jr. *
4 * *
5 * Copyright (c) 2011, Norberto R. de Goes Jr.. *
6 * *
7 * All rights reserved. *
8 * *
9 * Redistribution and use of this software in source and binary forms, with or without modification, are *
10 * permitted provided that the following conditions are met: *
11 * *
12 * * Redistributions of source code must retain the above *
13 * copyright notice, this list of conditions and the *
14 * following disclaimer. *
15 * *
16 * * Redistributions in binary form must reproduce the above *
17 * copyright notice, this list of conditions and the *
18 * following disclaimer in the documentation and/or other *
19 * materials provided with the distribution. *
20 * *
21 * * Neither the name of the Teraoka Laboratory nor the *
22 * names of its contributors may be used to endorse or *
23 * promote products derived from this software without *
24 * specific prior written permission of Teraoka Laboratory *
25 * *
26 * *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
28 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
29 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
30 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
33 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
34 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
35 *********************************************************************************************************/
36
37
38/*********************************************************************************************************
39
40 === CpqD/DRC - Projeto ADRIMS - Mar/2011 ===
41 === Dicionario Dx/Cx ===
42 Baseado no "dict_sip" do FreeDiameter (www.freediameter.net)
43 Norberto R Goes Jr
44*********************************************************************************************************/
45
46
47#include <freeDiameter/extension.h>
48
49
50
51/* The content of this file follows the same structure as dict_base_proto.c */
52
53#define CHECK_dict_new( _type, _data, _parent, _ref ) \
54 CHECK_FCT( fd_dict_new( fd_g_config->cnf_dict, (_type), (_data), (_parent), (_ref)) );
55
56#define CHECK_dict_search( _type, _criteria, _what, _result ) \
57 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
58
59
60struct local_rules_definition
61{
62 char *avp_name;
63 enum rule_position position;
64 int min;
65 int max;
66};
67
68/*==================================================================*/
69
70#define RULE_ORDER( _position ) ((((_position) == RULE_FIXED_HEAD) || ((_position) == RULE_FIXED_TAIL)) ? 1 : 0 )
71
72/*==================================================================*/
73
74#define PARSE_loc_rules( _rulearray, _parent, _avp_search_flag) { \
75 int __ar; \
76 for (__ar=0; __ar < sizeof(_rulearray) / sizeof((_rulearray)[0]); __ar++) { \
77 struct dict_rule_data __data = { NULL, \
78 (_rulearray)[__ar].position, \
79 0, \
80 (_rulearray)[__ar].min, \
81 (_rulearray)[__ar].max}; \
82 __data.rule_order = RULE_ORDER(__data.rule_position); \
83 \
84 CHECK_FCT( fd_dict_search( \
85 fd_g_config->cnf_dict, \
86 DICT_AVP, \
87 _avp_search_flag, \
88 (_rulearray)[__ar].avp_name, \
89 &__data.rule_avp, 0 ) ); \
90 if ( !__data.rule_avp ) { \
91 TRACE_DEBUG(INFO, "AVP Not found: '%s'", (_rulearray)[__ar].avp_name ); \
92 return ENOENT; \
93 } \
94 \
95 CHECK_FCT_DO( fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &__data, _parent, NULL), \
96 { \
97 TRACE_DEBUG(INFO, "Error on rule with AVP '%s'", \
98 (_rulearray)[__ar].avp_name ); \
99 return EINVAL; \
100 } ); \
101 } \
102 }
103
104#define enumval_def_u32( _val_, _str_ ) \
105 { _str_, { .u32 = _val_ }}
106
107#define enumval_def_os( _len_, _val_, _str_ ) \
108 { _str_, { .os = { .data = (unsigned char *)_val_, .len = _len_ }}}
109
110
111/*==================================================================*/
112/*==================================================================*/
113/*==================================================================*/
114/*==================================================================*/
115
116int cxdx_dict_init(char * conffile)
117{
118
119#define VENDOR_3GPP_Id 10415
120
121
122 struct dict_object * vendor_dict;
123 {
124 struct dict_vendor_data vendor_data = { VENDOR_3GPP_Id, "3GPP" };
125 CHECK_dict_new (DICT_VENDOR, &vendor_data, NULL, &vendor_dict);
126 }
127
128
129 struct dict_object * cxdx_dict;
130 {
131 struct dict_application_data data = { 16777216 /* NRGJ */, "Diameter CxDx Application" };
132 CHECK_dict_new (DICT_APPLICATION, &data, vendor_dict, &cxdx_dict);
133 }
134
135
136 /* ##### AVP section #################################### */
137 {
138 struct dict_object * UTF8String_type;
139 struct dict_object * DiameterURI_type;
140
141 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "UTF8String", &UTF8String_type);
142 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterURI", &DiameterURI_type);
143
144 /* Digest AVPs: */
145
146 /* Visited-Network-Identifier */
147 {
148 struct dict_avp_data data =
149 {
150 600, /* Code */
151 VENDOR_3GPP_Id, /* Vendor */
152 "Visited-Network-Identifier", /* Name */
153 AVP_FLAG_MANDATORY | AVP_FLAG_VENDOR, /* Fixed flags */
154 AVP_FLAG_MANDATORY | AVP_FLAG_VENDOR, /* Fixed flag values */
155 AVP_TYPE_OCTETSTRING /* base type of data */
156 };
157 CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL);
158 }
159
160 /* Public-Identity */
161 {
162 struct dict_avp_data data =
163 {
164 601, /* Code */
165 VENDOR_3GPP_Id, /* Vendor */
166 "Public-Identity", /* Name */
167 AVP_FLAG_MANDATORY | AVP_FLAG_VENDOR, /* Fixed flags */
168 AVP_FLAG_MANDATORY | AVP_FLAG_VENDOR, /* Fixed flag values */
169 AVP_TYPE_OCTETSTRING /* base type of data */
170 };
171 CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL);
172 }
173
174
175 /* Server-Name */
176 {
177 struct dict_avp_data data =
178 {
179 602, /* Code */
180 VENDOR_3GPP_Id, /* Vendor */
181 "Server-Name", /* Name */
182 AVP_FLAG_MANDATORY | AVP_FLAG_VENDOR, /* Fixed flags */
183 AVP_FLAG_MANDATORY | AVP_FLAG_VENDOR, /* Fixed flag values */
184 AVP_TYPE_OCTETSTRING /* base type of data */
185 };
186 CHECK_dict_new( DICT_AVP, &data , DiameterURI_type/*UTF8String_type*/, NULL);
187 }
188
189
190 /* Optional-Capability */
191 {
192 struct dict_avp_data data =
193 {
194 605, /* Code */
195 VENDOR_3GPP_Id, /* Vendor */
196 "Optional-Capability", /* Name */
197 AVP_FLAG_MANDATORY | AVP_FLAG_VENDOR, /* Fixed flags */
198 AVP_FLAG_MANDATORY | AVP_FLAG_VENDOR, /* Fixed flag values */
199 AVP_TYPE_UNSIGNED32 /* base type of data */
200 };
201 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
202 }
203
204
205 /* Feature-List-ID */
206 {
207 struct dict_avp_data data =
208 {
209 629, /* Code */
210 VENDOR_3GPP_Id, /* Vendor */
211 "Feature-List-ID", /* Name */
212 AVP_FLAG_VENDOR, /* Fixed flags */
213 AVP_FLAG_VENDOR, /* Fixed flag values */
214 AVP_TYPE_UNSIGNED32 /* base type of data */
215 };
216 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
217 }
218
219
220 /* Feature-List */
221 {
222 struct dict_avp_data data =
223 {
224 630, /* Code */
225 VENDOR_3GPP_Id, /* Vendor */
226 "Feature-List", /* Name */
227 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
228 AVP_FLAG_MANDATORY, /* Fixed flag values */
229 AVP_TYPE_UNSIGNED32 /* base type of data */
230 };
231 CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
232 }
233
234 /* Server-Capabilities */
235 {
236 struct dict_object * avp;
237 struct dict_avp_data data =
238 {
239 603, /* Code */
240 VENDOR_3GPP_Id, /* Vendor */
241 "Server-Capabilities", /* Name */
242 AVP_FLAG_MANDATORY | AVP_FLAG_VENDOR, /* Fixed flags */
243 AVP_FLAG_MANDATORY | AVP_FLAG_VENDOR, /* Fixed flag values */
244 AVP_TYPE_GROUPED /* base type of data */
245 };
246
247 struct local_rules_definition rules[] =
248 {
249 { "Vendor-Id", RULE_REQUIRED, -1, 1 },
250 { "Feature-List-ID", RULE_REQUIRED, -1, 1 },
251 { "Feature-List", RULE_REQUIRED, -1, 1 }
252 };
253
254 CHECK_dict_new (DICT_AVP, &data , NULL, &avp);
255 PARSE_loc_rules(rules, avp, AVP_BY_NAME_ALL_VENDORS );
256 }
257
258
259
260 /* User-Authorization-Type */
261 {
262 struct dict_avp_data data =
263 {
264 623, /* Code */
265 VENDOR_3GPP_Id, /* Vendor */
266 "User-Authorization-Type", /* Name */
267 AVP_FLAG_MANDATORY | AVP_FLAG_VENDOR, /* Fixed flags */
268 AVP_FLAG_MANDATORY | AVP_FLAG_VENDOR, /* Fixed flag values */
269 AVP_TYPE_OCTETSTRING /* base type of data */
270 };
271 CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL);
272 }
273
274
275 /* Supported-Features */
276 {
277 struct dict_object * avp;
278 struct dict_avp_data data =
279 {
280 628, /* Code */
281 VENDOR_3GPP_Id, /* Vendor */
282 "Supported-Features", /* Name */
283 AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
284 AVP_FLAG_MANDATORY, /* Fixed flag values */
285 AVP_TYPE_GROUPED /* base type of data */
286 };
287
288 struct local_rules_definition rules[] =
289 {
290 { "Vendor-Id", RULE_REQUIRED, -1, 1 },
291 { "Feature-List-ID", RULE_REQUIRED, -1, 1 },
292 { "Feature-List", RULE_REQUIRED, -1, 1 }
293 };
294
295 CHECK_dict_new (DICT_AVP, &data , NULL, &avp);
296 PARSE_loc_rules(rules, avp, AVP_BY_NAME_ALL_VENDORS );
297 }
298
299
300
301
302 } /* end AVP section */
303
304
305
306 /* ### Command section ############################# */
307 {
308 /* User-Authorization-Request (UAR) Command */
309 {
310 /*
311 The User-Authorization-Request (UAR) is indicated by the Command-Code
312 set to 283 and the Command Flags' 'R' bit set. The Diameter client
313 in a SIP server sends this command to the Diameter server to request
314 authorization for the SIP User Agent to route a SIP REGISTER request.
315 Because the SIP REGISTER request implicitly carries a permission to
316 bind an AOR to a contact address, the Diameter client uses the
317 Diameter UAR as a first authorization request towards the Diameter
318 server to authorize the registration. For instance, the Diameter
319 server can verify that the AOR is a legitimate user of the realm.
320
321 The Diameter client in the SIP server requests authorization for one
322 of the possible values defined in the SIP-User-Authorization-Type AVP
323 (Section 9.10).
324
325 The user name used for authentication of the user is conveyed in a
326 User-Name AVP (defined in the Diameter base protocol, RFC 3588
327 [RFC3588]). The location of the authentication user name in the SIP
328 REGISTER request varies depending on the authentication mechanism.
329 When the authentication mechanism is HTTP Digest as defined in RFC
330 2617 [RFC2617], the authentication user name is found in the
331 "username" directive of the SIP Authorization header field value.
332 This Diameter SIP application only provides support for HTTP Digest
333 authentication in SIP; other authentication mechanisms are not
334 currently supported.
335
336 The SIP or SIPS URI to be registered is conveyed in the SIP-AOR AVP
337 (Section 9.8). Typically this SIP or SIPS URI is found in the To
338 header field value of the SIP REGISTER request that triggered the
339 Diameter UAR message.
340
341 The SIP-Visited-Network-Id AVP indicates the network that is
342 providing SIP services (e.g., SIP proxy functionality or any other
343 kind of services) to the SIP User Agent.
344
345 The Message Format of the UAR command is as follows:
346
347
348 < UAR> ::=< Diameter Header: 300, REQ, PXY, 16777216 >
349 < Session-Id >
350 { Vendor-Specific-Application-Id }
351 { Auth-Session-State }
352 { Origin-Host }
353 { Origin-Realm }
354 [ Destination-Host ]
355 { Destination-Realm }
356 { User-Name }
357 *[ Supported-Features ]
358 { Public-Identity }
359 { Visited-Network-Identifier }
360 [ User-Authorization-Type ]
361 [ UAR-Flags ]
362 *[ AVP ]
363 *[ Proxy-Info ]
364 *[ Route-Record ]
365 */
366
367 struct dict_object * cmd;
368 struct dict_cmd_data data =
369 {
370 300, /* Code */
371 "User-Authorization-Request", /* Name */
372 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */
373 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */
374 };
375
376 struct local_rules_definition rules[] =
377 {
378 { "Session-Id", RULE_FIXED_HEAD, -1, 1 },
379 { "Vendor-Specific-Application-Id", RULE_REQUIRED, -1, 1 },
380 { "Auth-Session-State", RULE_REQUIRED, -1, 1 },
381 { "Origin-Host", RULE_REQUIRED, -1, 1 },
382 { "Origin-Realm", RULE_REQUIRED, -1, 1 },
383 // { "Destination-Host", RULE_OPTIONAL, -1, 1 },
384 { "Destination-Realm", RULE_REQUIRED, -1, 1 },
385 { "User-Name", RULE_REQUIRED, -1, 1 },
386 // { "Supported-Features", RULE_OPTIONAL, -1, -1 },
387 { "Public-Identity", RULE_REQUIRED, -1, 1 },
388 { "Visited-Network-Identifier", RULE_REQUIRED, -1, 1 },
389 // { "UAR-Flags", RULE_OPTIONAL, -1, 1 },
390 // { "User-Authorization-Type", RULE_OPTIONAL, -1, 1 },
391 // { "Proxy-Info", RULE_OPTIONAL, -1, -1 },
392 // { "Route-Record", RULE_OPTIONAL, -1, -1 }
393 };
394
395 CHECK_dict_new( DICT_COMMAND, &data , cxdx_dict, &cmd);
396 PARSE_loc_rules( rules, cmd, AVP_BY_NAME_ALL_VENDORS);
397 }
398
399 /* User-Authorization-Answer (UAA) Command */
400 {
401 /*
402 The User-Authorization-Answer (UAA) is indicated by the Command-Code
403 set to 283 and the Command Flags' 'R' bit cleared. The Diameter
404 server sends this command in response to a previously received
405 Diameter User-Authorization-Request (UAR) command. The Diameter
406 server indicates the result of the requested registration
407 authorization. Additionally, the Diameter server may indicate a
408 collection of SIP capabilities that assists the Diameter client to
409 select a SIP proxy to the AOR under registration.
410
411
412 In addition to the values already defined in RFC 3588 [RFC3588], the
413 Result-Code AVP may contain one of the values defined in
414 Section 10.1.
415
416 Whenever the Diameter server fails to process the Diameter UAR
417 message, it MUST stop processing and return the relevant error in the
418 Diameter UAA message. When there is success in the process, the
419 Diameter server MUST set the code to DIAMETER_SUCCESS in the Diameter
420 UAA message.
421
422 If the Diameter server requires a User-Name AVP value to process the
423 Diameter UAR request, but the Diameter UAR message did not contain a
424 User-Name AVP value, the Diameter server MUST set the Result-Code AVP
425 value to DIAMETER_USER_NAME_REQUIRED (see Section 10.1.2) and return
426 it in a Diameter UAA message. Upon reception of this Diameter UAA
427 message with the Result-Code AVP value set to
428 DIAMETER_USER_NAME_REQUIRED, the SIP server typically requests
429 authentication by sending a SIP 401 (Unauthorized) or SIP 407 (Proxy
430 Authentication Required) response back to the originator.
431
432 When the authorization procedure succeeds, the Diameter server
433 constructs a User-Authorization-Answer (UAA) message that MUST
434 include (1) the address of the SIP server already assigned to the
435 user name, (2) the capabilities needed by the SIP server (Diameter
436 client) to select another SIP server for the user, or (3) a
437 combination of the previous two options.
438
439 If the Diameter server is already aware of a SIP server allocated to
440 the user, the Diameter UAA message contains the address of that SIP
441 server.
442
443 The Diameter UAA message contains the capabilities required by a SIP
444 server to trigger and execute services. It is required that these
445 capabilities are present in the Diameter UAA message due to the
446 possibility that the Diameter client (in the SIP server) allocates a
447 different SIP server to trigger and execute services for that
448 particular user.
449
450 If a User-Name AVP is present in the Diameter UAR message, then the
451 Diameter server MUST verify the existence of the user in the realm,
452 i.e., the User-Name AVP value is a valid user within that realm. If
453 the Diameter server does not recognize the user name received in the
454 User-Name AVP, the Diameter server MUST build a Diameter User-
455 Authorization-Answer (UAA) message and MUST set the Result-Code AVP
456 to DIAMETER_ERROR_USER_UNKNOWN.
457
458
459 If a User-Name AVP is present in the Diameter UAR message, then the
460 Diameter server MUST authorize that User-Name AVP value is able to
461 register the SIP or SIPS URI included in the SIP-AOR AVP. If this
462 authorization fails, the Diameter server must set the Result-Code AVP
463 to DIAMETER_ERROR_IDENTITIES_DONT_MATCH and send it in a Diameter
464 User-Authorization-Answer (UAA) message.
465
466 Note: Correlation between User-Name and SIP-AOR AVP values is
467 required in order to avoid registration of a SIP-AOR allocated to
468 another user.
469
470 If there is a SIP-Visited-Network-Id AVP in the Diameter UAR message,
471 and the SIP-User-Authorization-Type AVP value received in the
472 Diameter UAR message is set to REGISTRATION or REGISTRATION&
473 CAPABILITIES, then the Diameter server SHOULD verify whether the user
474 is allowed to roam into the network specified in the
475 SIP-Visited-Network-Id AVP in the Diameter UAR message. If the user
476 is not allowed to roam into that network, the Diameter AAA server
477 MUST set the Result-Code AVP value in the Diameter UAA message to
478 DIAMETER_ERROR_ROAMING_NOT_ALLOWED.
479
480 If the SIP-User-Authorization-Type AVP value received in the Diameter
481 UAR message is set to REGISTRATION or REGISTRATION&CAPABILITIES, then
482 the Diameter server SHOULD verify whether the SIP-AOR AVP value is
483 authorized to register in the Home Realm. Where the SIP AOR is not
484 authorized to register in the Home Realm, the Diameter server MUST
485 set the Result-Code AVP to DIAMETER_AUTHORIZATION_REJECTED and send
486 it in a Diameter UAA message.
487
488 When the SIP-User-Authorization-Type AVP is not present in the
489 Diameter UAR message, or when it is present and its value is set to
490 REGISTRATION, then:
491
492 o If the Diameter server is not aware of any previous registration
493 of the user name (including registrations of other SIP AORs
494 allocated to the same user name), then the Diameter server does
495 not know of any SIP server allocated to the user. In this case,
496 the Diameter server MUST set the Result-Code AVP value to
497 DIAMETER_FIRST_REGISTRATION in the Diameter UAA message, and the
498 Diameter server SHOULD include the required SIP server
499 capabilities in the SIP-Server-Capabilities AVP value in the
500 Diameter UAA message. The SIP-Server-Capabilities AVP assists the
501 Diameter client (SIP server) to select an appropriate SIP server
502 for the user, according to the required capabilities.
503
504 o In some cases, the Diameter server is aware of a previously
505 assigned SIP server for the same or different SIP AORs allocated
506 to the same user name. In these cases, re-assignment of a new SIP
507 server may or may not be needed, depending on the capabilities of
508 the SIP server. The Diameter server MUST always include the
509 allocated SIP server URI in the SIP-Server-URI AVP of the UAA
510 message. If the Diameter server does not return the SIP
511 capabilities, the Diameter server MUST set the Result-Code AVP in
512 the Diameter UAA message to DIAMETER_SUBSEQUENT_REGISTRATION.
513 Otherwise (i.e., if the Diameter server includes a
514 SIP-Server-Capabilities AVP), then the Diameter server MUST set
515 the Result-Code AVP in the Diameter UAA message to
516 DIAMETER_SERVER_SELECTION. Then the Diameter client determines,
517 based on the received information, whether it needs to select a
518 new SIP server.
519
520 When the SIP-User-Authorization-Type AVP value received in the
521 Diameter UAR message is set to REGISTRATION&CAPABILITIES, then
522 Diameter Server MUST return the list of capabilities in the
523 SIP-Server-Capabilities AVP value of the Diameter UAA message, it
524 MUST set the Result-Code to DIAMETER_SUCCESS, and it MUST NOT return
525 a SIP-Server-URI AVP. The SIP-Server-Capabilities AVP enables the
526 SIP server (Diameter client) to select another appropriate SIP server
527 for invoking and executing services for the user, depending on the
528 required capabilities. The Diameter server MAY leave the list of
529 capabilities empty to indicate that any SIP server can be selected.
530
531 When the SIP-User-Authorization-Type AVP value received in the
532 Diameter UAR message is set to DEREGISTRATION, then:
533
534 o If the Diameter server is aware of a SIP server assigned to the
535 SIP AOR under deregistration, the Diameter server MUST set the
536 Result-Code AVP to DIAMETER_SUCCESS and MUST set the
537 SIP-Server-URI AVP value to the known SIP server, and return them
538 in the Diameter UAA message.
539
540 o If the Diameter server is not aware of a SIP server assigned to
541 the SIP AOR under deregistration, then the Diameter server MUST
542 set the Result-Code AVP in the Diameter UAA message to
543 DIAMETER_ERROR_IDENTITY_NOT_REGISTERED.
544
545 The Message Format of the UAA command is as follows:
546
547 <UAA> ::= < Diameter Header: 283, PXY >
548 < Session-Id >
549 { Auth-Application-Id }
550 { Auth-Session-State }
551 { Result-Code }
552 { Origin-Host }
553 { Origin-Realm }
554 [ SIP-Server-URI ]
555 [ SIP-Server-Capabilities ]
556 [ Authorization-Lifetime ]
557 [ Auth-Grace-Period ]
558 [ Redirect-Host ]
559 [ Redirect-Host-Usage ]
560 [ Redirect-Max-Cache-Time ]
561 * [ Proxy-Info ]
562 * [ Route-Record ]
563 * [ AVP ]
564
565
566 */
567 struct dict_object * cmd;
568 struct dict_cmd_data data =
569 {
570 300, /* Code */
571 "User-Authorization-Answer", /* Name */
572 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */
573 CMD_FLAG_PROXIABLE /* Fixed flag values */
574 };
575
576 struct local_rules_definition rules[] =
577 {
578 { "Session-Id", RULE_FIXED_HEAD, -1, 1 },
579 { "Auth-Application-Id", RULE_REQUIRED, -1, 1 },
580 { "Auth-Session-State", RULE_REQUIRED, -1, 1 },
581 { "Result-Code", RULE_REQUIRED, -1, 1 },
582 { "Origin-Host", RULE_REQUIRED, -1, 1 },
583 { "Origin-Realm", RULE_REQUIRED, -1, 1 },
584 { "Proxy-Info", RULE_OPTIONAL, -1, -1 },
585 { "Route-Record", RULE_OPTIONAL, -1, -1 }
586 };
587
588 CHECK_dict_new( DICT_COMMAND, &data , cxdx_dict, &cmd);
589 PARSE_loc_rules( rules, cmd, AVP_BY_NAME );
590 }
591
592
593
594
595
596#if 0 /* TODO - NRGJ : alterar conforme RFC-3GPP : */
597
598 /* Multimedia-Auth-Request (MAR) Command */
599 {
600 /*
601 The Multimedia-Auth-Request (MAR) command is indicated by the
602 Command-Code set to 286 and the Command Flags' 'R' bit set. The
603 Diameter client in a SIP server sends this command to the Diameter
604 server to request that the Diameter server authenticate and authorize
605 a user attempt to use some SIP service (in this context, SIP service
606 can be something as simple as a SIP subscription or using the proxy
607 services for a SIP request).
608
609 The MAR command may also register the SIP server's own URI to the
610 Diameter server, so that future LIR/LIA messages can return this URI.
611 If the SIP server is acting as a SIP registrar (see examples in
612 Sections 6.2 and 6.3), its Diameter client MUST include a SIP-
613 Server-URI AVP in the MAR command. In any other cases (see example
614 in Section 6.4), its Diameter client MUST NOT include a SIP-Server-
615 URI AVP in the MAR command.
616
617 The SIP-Method AVP MUST include the SIP method name of the SIP
618 request that triggered this Diameter MAR message. The Diameter
619 server can use this AVP to authorize some SIP requests depending on
620 the method.
621
622 The Diameter MAR message MUST include a SIP-AOR AVP. The SIP-AOR AVP
623 indicates the target of the SIP request. The value of the AVP is
624 extracted from different places in SIP request, depending on the
625 semantics of the SIP request. For SIP REGISTER messages the SIP-AOR
626 AVP value indicates the intended public user identity under
627 registration, and it is the SIP or SIPS URI populated in the To
628 header field value (addr-spec as per RFC 3261 [RFC3261]) of the SIP
629 REGISTER request. For other types of SIP requests, such as INVITE,
630 SUBSCRIBE, MESSAGE, etc., the SIP-AOR AVP value indicates the
631 intended destination of the request. This is typically populated in
632 the Request-URI of the SIP request. Extracting the SIP-AOR AVP value
633 from the proper SIP header field is the Diameter client's
634 responsibility. Extensions to SIP (new SIP methods or new semantics)
635 may require the SIP-AOR to be extracted from other parts of the
636 request.
637
638 If the SIP request includes some sort of authentication information,
639 the Diameter client MUST include the user name, extracted from the
640 authentication information of the SIP request, in the User-Name AVP
641 value.
642
643 The Message Format of the MAR command is as follows:
644
645 <MAR> ::= < Diameter Header: 286, REQ, PXY >
646 < Session-Id >
647 { Auth-Application-Id }
648 { Auth-Session-State }
649 { Origin-Host }
650 { Origin-Realm }
651 { Destination-Realm }
652 { SIP-AOR }
653 { SIP-Method }
654 [ Destination-Host ]
655 [ User-Name ]
656 [ SIP-Server-URI ]
657 [ SIP-Number-Auth-Items ]
658 [ SIP-Auth-Data-Item ]
659 * [ Proxy-Info ]
660 * [ Route-Record ]
661 * [ AVP ]
662
663 */
664
665 struct dict_object * cmd;
666 struct dict_cmd_data data =
667 {
668 303, /* Code */
669 "Multimedia-Auth-Request", /* Name */
670 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */
671 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */
672 };
673
674 struct local_rules_definition rules[] =
675 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 }
676 ,{ "Auth-Application-Id", RULE_REQUIRED, -1, 1 }
677 ,{ "Auth-Session-State", RULE_REQUIRED, -1, 1 }
678 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 }
679 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 }
680 ,{ "Destination-Realm", RULE_REQUIRED, -1, 1 }
681 ,{ "SIP-AOR", RULE_REQUIRED, -1, 1 }
682 ,{ "SIP-Method", RULE_REQUIRED, -1, 1 }
683 ,{ "Destination-Host", RULE_OPTIONAL, -1, 1 }
684 ,{ "User-Name", RULE_OPTIONAL, -1, 1 }
685 ,{ "SIP-Server-URI", RULE_OPTIONAL, -1, 1 }
686 ,{ "SIP-Number-Auth-Items", RULE_OPTIONAL, -1, 1 }
687 ,{ "SIP-Auth-Data-Item", RULE_OPTIONAL, -1, 1 }
688 ,{ "Proxy-Info", RULE_OPTIONAL, -1, -1 }
689 ,{ "Route-Record", RULE_OPTIONAL, -1, -1 }
690
691 };
692
693 CHECK_dict_new( DICT_COMMAND, &data , cxdx_dict, &cmd);
694 PARSE_loc_rules( rules, cmd, AVP_BY_NAME );
695 }
696 /* Multimedia-Auth-Answer (MAA) Command */
697 {
698 /*
699
700 The Multimedia-Auth-Answer (MAA) is indicated by the Command-Code set
701 to 286 and the Command Flags' 'R' bit cleared. The Diameter server
702 sends this command in response to a previously received Diameter
703 Multimedia-Auth-Request (MAR) command.
704
705 In addition to the values already defined in RFC 3588 [RFC3588], the
706 Result-Code AVP may contain one of the values defined in
707 Section 10.1.
708
709 If the Diameter server requires a User-Name AVP value to process the
710 Diameter MAR request, but the Diameter MAR message did not contain a
711 User-Name AVP value, the Diameter server MUST set the Result-Code AVP
712 value to DIAMETER_USER_NAME_REQUIRED (see Section 10.1.2) and return
713 it in a Diameter MAA message. The Diameter server MAY include a
714 SIP-Number-Auth-Items AVP and one or more SIP-Auth-Data-Item AVPs
715 with authentication information (e.g., a challenge). Upon reception
716 of this Diameter MAA message with the Result-Code AVP value set to
717 DIAMETER_USER_NAME_REQUIRED, the SIP server typically requests
718 authentication by generating a SIP 401 (Unauthorized) or SIP 407
719 (Proxy Authentication Required) response back to the originator.
720
721 If the User-Name AVP is present in the Diameter MAR message, the
722 Diameter server MUST verify the existence of the user in the realm,
723 i.e., the User-Name AVP value is a valid user within that realm. If
724 the Diameter server does not recognize the user name received in the
725 User-Name AVP, the Diameter server MUST build a Diameter
726 Multimedia-Auth-Answer (MAA) message and MUST set the Result-Code AVP
727 to DIAMETER_ERROR_USER_UNKNOWN.
728
729 If the SIP-Methods AVP value of the Diameter MAR message is set to
730 REGISTER and a User-Name AVP is present, then the Diameter server
731 MUST authorize that User-Name AVP value is able to use the URI
732 included in the SIP-AOR AVP. If this authorization fails, the
733 Diameter server must set the Result-Code AVP to
734 DIAMETER_ERROR_IDENTITIES_DONT_MATCH and send it in a Diameter
735 Multimedia-Auth-Answer (MAA) message.
736
737 Note: Correlation between User-Name and SIP-AOR AVP values is only
738 required for SIP REGISTER request, to prevent a user from
739 registering a SIP-AOR allocated to another user. In other types
740 of SIP requests (e.g., INVITE), the SIP-AOR indicates the intended
741 destination of the request, rather than the originator of it.
742
743 The Diameter server MUST verify whether the authentication scheme
744 (SIP-Authentication-Scheme AVP value) indicated in the grouped
745 SIP-Auth-Data-Item AVP is supported or not. If that authentication
746 scheme is not supported, then the Diameter server MUST set the
747 Result-Code AVP to DIAMETER_ERROR_AUTH_SCHEME_NOT_SUPPORTED and send
748 it in a Diameter Multimedia-Auth-Answer (MAA) message.
749
750 If the SIP-Number-Auth-Items AVP is present in the Diameter MAR
751 message, it indicates the number of authentication data items that
752 the Diameter client is requesting. It is RECOMMENDED that the
753 Diameter server, when building the Diameter MAA message, includes a
754 number of SIP-Auth-Data-Item AVPs that are a subset of the
755 authentication data items requested by the Diameter client in the
756 SIP-Number-Auth-Items AVP value of the Diameter MAR message.
757
758 If the SIP-Server-URI AVP is present in the Diameter MAR message,
759 then the Diameter server MUST compare the stored SIP server (assigned
760 to the user) with the SIP-Server-URI AVP value (received in the
761 Diameter MAR message). If they don't match, the Diameter server MUST
762 temporarily save the newly received SIP server assigned to the user,
763 and MUST set an "authentication pending" flag for the user. If they
764 match, the Diameter server shall clear the "authentication pending"
765 flag for the user.
766
767 In any other situation, if there is a success in processing the
768 Diameter MAR command and the Diameter server stored the
769 SIP-Server-URI, the Diameter server MUST set the Result-Code AVP
770 value to DIAMETER_SUCCESS and return it in a Diameter MAA message.
771
772 If there is a success in processing the Diameter MAR command, but the
773 Diameter server does not store the SIP-Server-URI because the AVP was
774 not present in the Diameter MAR command, then the Diameter server
775 MUST set the Result-Code AVP value to either:
776
777 1. DIAMETER_SUCCESS_AUTH_SENT_SERVER_NOT_STORED, if the Diameter
778 server is sending authentication credentials to create a
779 challenge.
780
781 2. DIAMETER_SUCCESS_SERVER_NAME_NOT_STORED, if the Diameter server
782 successfully authenticated the user and authorized the SIP server
783 to proceed with the SIP request.
784
785 Otherwise, the Diameter server MUST set the Result-Code AVP value to
786 DIAMETER_UNABLE_TO_COMPLY, and it MUST NOT include any
787 SIP-Auth-Data-Item AVP.
788
789 The Message Format of the MAA command is as follows:
790
791 <MAA> ::= < Diameter Header: 286, PXY >
792 < Session-Id >
793 { Auth-Application-Id }
794 { Result-Code }
795 { Auth-Session-State }
796 { Origin-Host }
797 { Origin-Realm }
798 [ User-Name ]
799 [ SIP-AOR ]
800 [ SIP-Number-Auth-Items ]
801 * [ SIP-Auth-Data-Item ]
802 [ Authorization-Lifetime ]
803 [ Auth-Grace-Period ]
804 [ Redirect-Host ]
805 [ Redirect-Host-Usage ]
806 [ Redirect-Max-Cache-Time ]
807 * [ Proxy-Info ]
808 * [ Route-Record ]
809 * [ AVP ]
810
811 */
812 struct dict_object * cmd;
813 struct dict_cmd_data data = {
814 286, /* Code */
815 "Multimedia-Auth-Answer", /* Name */
816 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */
817 CMD_FLAG_PROXIABLE /* Fixed flag values */
818 };
819 struct local_rules_definition rules[] =
820 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 }
821 ,{ "Auth-Application-Id", RULE_REQUIRED, -1, 1 }
822 ,{ "Result-Code", RULE_REQUIRED, -1, 1 }
823 ,{ "Auth-Session-State", RULE_REQUIRED, -1, 1 }
824 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 }
825 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 }
826 ,{ "User-Name", RULE_OPTIONAL, -1, 1 }
827 ,{ "SIP-AOR", RULE_OPTIONAL, -1, 1 }
828 ,{ "SIP-Number-Auth-Items", RULE_OPTIONAL, -1, 1 }
829 ,{ "SIP-Auth-Data-Item", RULE_OPTIONAL, -1, -1 }
830 ,{ "Authorization-Lifetime", RULE_OPTIONAL, -1, 1 }
831 ,{ "Auth-Grace-Period", RULE_OPTIONAL, -1, 1 }
832 ,{ "Redirect-Host", RULE_OPTIONAL, -1, 1 }
833 ,{ "Redirect-Host-Usage", RULE_OPTIONAL, -1, 1 }
834 ,{ "Redirect-Max-Cache-Time", RULE_OPTIONAL, -1, 1 }
835 ,{ "Proxy-Info", RULE_OPTIONAL, -1, -1 }
836 ,{ "Route-Record", RULE_OPTIONAL, -1, -1 }
837
838 };
839
840 CHECK_dict_new( DICT_COMMAND, &data , cxdx_dict, &cmd);
841 PARSE_loc_rules( rules, cmd, AVP_BY_NAME );
842 }
843 /* Server-Assignment-Request (SAR) Command */
844 {
845 /*
846
847 The Server-Assignment-Request (SAR) command is indicated by the
848 Command-Code set to 284 and the Command Flags' 'R' bit set. The
849 Diameter client in a SIP server sends this command to the Diameter
850 server to indicate the completion of the authentication process and
851 to request that the Diameter server store the URI of the SIP server
852 that is currently serving the user. The main functions of the
853 Diameter SAR command are to inform the Diameter server of the URI of
854 the SIP server allocated to the user, and to store or clear it from
855 the Diameter server. Additionally, the Diameter client can request
856 to download the user profile or part of it.
857
858 During the registration procedure, a SIP server becomes assigned to
859 the user. The Diameter client in the assigned SIP server MUST
860 include its own URI in the SIP-Server-URI AVP of the
861 Server-Assignment-Request (SAR) Diameter message and send it to the
862 Diameter server. The Diameter server then becomes aware of the
863 allocation of the SIP server to the user name and the server's URI.
864
865 The Diameter client in the SIP server MAY send a Diameter SAR message
866 because of other reasons. These reasons are identified in the
867 SIP-Server-Assignment-Type AVP (Section 9.4) value. For instance, a
868 Diameter client in a SIP server may contact the Diameter server to
869 request deregistration of a user, to inform the Diameter server of an
870 authentication failure, or just to download the user profile. For a
871 complete description of all the SIP-Server-Assignment-Type AVP
872 values, see Section 9.4.
873
874 Typically the reception of a SIP REGISTER request in a SIP server
875 will trigger the Diameter client in the SIP server to send the
876 Diameter SAR message. However, if a SIP server is receiving other
877 SIP request, such as INVITE, and the SIP server does not have the
878 user profile, the Diameter client in the SIP server may send the
879 Diameter SAR message to the Diameter server in order to download the
880 user profile and make the Diameter server aware of the SIP server
881 assigned to the user.
882 The user profile is an important piece of information that dictates
883 the behavior of the SIP server when triggering or providing services
884 for the user. Typically the user profile is divided into:
885
886 o Services to be rendered to the user when the user is registered
887 and initiates a SIP request.
888
889 o Services to be rendered to the user when the user is registered
890 and a SIP request destined to that user arrives to the SIP proxy.
891
892 o Services to be rendered to the user when the user is not
893 registered and a SIP request destined to that user arrives to the
894 SIP proxy.
895
896 The SIP-Server-Assignment-Type AVP indicates the reason why the
897 Diameter client (SIP server) contacted the Diameter server. If the
898 Diameter client sets the SIP-Server-Assignment-Type AVP value to
899 REGISTRATION, RE_REGISTRATION, UNREGISTERED_USER, NO_ASSIGNMENT,
900 AUTHENTICATION_FAILURE or AUTHENTICATION_TIMEOUT, the Diameter client
901 MUST include exactly one SIP-AOR AVP in the Diameter SAR message.
902
903 The SAR message MAY contain zero or more SIP-Supported-User-Data-Type
904 AVPs. Each of them contains a type of user data understood by the
905 SIP server. This allows the Diameter client to provide an indication
906 to the Diameter server of the different format of user data
907 understood by the SIP server. The Diameter server uses this
908 information to select one or more SIP-User-Data AVPs that will be
909 included in the SAA message.
910
911 The Message Format of the SAR command is as follows:
912
913 <SAR> ::= < Diameter Header: 284, REQ, PXY >
914 < Session-Id >
915 { Auth-Application-Id }
916 { Auth-Session-State }
917 { Origin-Host }
918 { Origin-Realm }
919 { Destination-Realm }
920 { SIP-Server-Assignment-Type }
921 { SIP-User-Data-Already-Available }
922 [ Destination-Host ]
923 [ User-Name ]
924 [ SIP-Server-URI ]
925 * [ SIP-Supported-User-Data-Type ]
926 * [ SIP-AOR ]
927 * [ Proxy-Info ]
928 * [ Route-Record ]
929 * [ AVP ]
930 */
931 struct dict_object * cmd;
932 struct dict_cmd_data data = {
933 284, /* Code */
934 "Server-Assignment-Request", /* Name */
935 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */
936 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */
937 };
938 struct local_rules_definition rules[] =
939 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 }
940 ,{ "Auth-Application-Id", RULE_REQUIRED, -1, 1 }
941 ,{ "Auth-Session-State", RULE_REQUIRED, -1, 1 }
942 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 }
943 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 }
944 ,{ "Destination-Realm", RULE_REQUIRED, -1, 1 }
945 ,{ "SIP-Server-Assignment-Type", RULE_REQUIRED, -1, 1 }
946 ,{ "SIP-User-Data-Already-Available", RULE_REQUIRED, -1, 1 }
947 ,{ "Destination-Host", RULE_OPTIONAL, -1, 1 }
948 ,{ "User-Name", RULE_OPTIONAL, -1, 1 }
949 ,{ "SIP-Server-URI", RULE_OPTIONAL, -1, 1 }
950 ,{ "SIP-Supported-User-Data-Type", RULE_OPTIONAL, -1, -1 }
951 ,{ "SIP-AOR", RULE_OPTIONAL, -1, -1 }
952 ,{ "Proxy-Info", RULE_OPTIONAL, -1, -1 }
953 ,{ "Route-Record", RULE_OPTIONAL, -1, -1 }
954
955 };
956
957 CHECK_dict_new( DICT_COMMAND, &data , cxdx_dict, &cmd);
958 PARSE_loc_rules( rules, cmd, AVP_BY_NAME );
959 }
960 /* Server-Assignment-Answer (SAA) Command */
961 {
962 /*
963
964 The Server-Assignment-Answer (SAA) is indicated by the Command-Code
965 set to 284 and the Command Flags' 'R' bit cleared. The Diameter
966 server sends this command in response to a previously received
967 Diameter Server-Assignment-Request (SAR) command. The response may
968 include the user profile or part of it, if requested.
969
970 In addition to the values already defined in RFC 3588 [RFC3588], the
971 Result-Code AVP may contain one of the values defined in
972 Section 10.1.
973
974 The Result-Code AVP value in the Diameter SAA message may indicate a
975 success or an error in the execution of the Diameter SAR command. If
976 Result-Code AVP value in the Diameter SAA message does not contain an
977 error code, the SAA message MAY include one or more SIP-User-Data
978 AVPs that typically contain the profile of the user, indicating
979 services that the SIP server can provide to that user.
980
981 The Diameter server MAY include one or more
982 SIP-Supported-User-Data-Type AVPs, each one identifying a type of
983 user data format supported in the Diameter server. If there is not a
984 common supported user data type between the Diameter client and the
985 Diameter server, the Diameter server SHOULD declare its list of
986 supported user data types by including one or more
987 SIP-Supported-User-Data-Type AVPs in a Diameter SAA message. This
988 indication is merely for debugging reasons, since there is not a
989 fallback mechanism that allows the Diameter client to retrieve the
990 profile in a supported format.
991
992 If the Diameter server requires a User-Name AVP value to process the
993 Diameter SAR request, but the Diameter SAR message did not contain a
994 User-Name AVP value, the Diameter server MUST set the Result-Code AVP
995 value to DIAMETER_USER_NAME_REQUIRED (see Section 10.1.2) and return
996 it in a Diameter SAA message. Upon reception of this Diameter SAA
997 message with the Result-Code AVP value set to
998 DIAMETER_USER_NAME_REQUIRED, the SIP server typically requests
999 authentication by generating a SIP 401 (Unauthorized) or SIP 407
1000 (Proxy Authentication Required) response back to the originator.
1001
1002 If the User-Name AVP is included in the Diameter SAR message, upon
1003 reception of the Diameter SAR message, the Diameter server MUST
1004 verify the existence of the user in the realm, i.e., the User-Name
1005 AVP value is a valid user within that realm. If the Diameter server
1006 does not recognize the user name received in the User-Name AVP, the
1007 Diameter server MUST build a Diameter Server-Assignment-Answer (SAA)
1008 message and MUST set the Result-Code AVP to
1009 DIAMETER_ERROR_USER_UNKNOWN.
1010 Then the Diameter server MUST authorize that User-Name AVP value is a
1011 valid authentication name for the SIP or SIPS URI included in the
1012 SIP-AOR AVP of the Diameter SAR message. If this authorization
1013 fails, the Diameter server must set the Result-Code AVP to
1014 DIAMETER_ERROR_IDENTITIES_DONT_MATCH and send it in a Diameter
1015 Server-Assignment-Answer (SAA) message.
1016
1017 After successful execution of the Diameter SAR command, the Diameter
1018 server MUST clear the "authentication pending" flag and SHOULD move
1019 the temporarily stored SIP server URI to permanent storage.
1020
1021 The actions of the Diameter server upon reception of the Diameter SAR
1022 message depend on the value of the SIP-Server-Assignment-Type:
1023
1024 o If the SIP-Server-Assignment-Type AVP value in the Diameter SAR
1025 message is set to REGISTRATION or RE_REGISTRATION, the Diameter
1026 server SHOULD verify that there is only one SIP-AOR AVP.
1027 Otherwise, the Diameter server MUST answer with a Diameter SAA
1028 message with the Result-Code AVP value set to
1029 DIAMETER_AVP_OCCURS_TOO_MANY_TIMES and MUST NOT include any
1030 SIP-User-Data AVP. If there is only one SIP-AOR AVP and if the
1031 SIP-User-Data-Already-Available AVP value is set to
1032 USER_DATA_NOT_AVAILABLE, then the Diameter server SHOULD include
1033 one or more user profile data with the SIP or SIPS URI (SIP-AOR
1034 AVP) and all other SIP identities associated with that AVP in the
1035 SIP-User-Data AVP value of the Diameter SAA message. On selecting
1036 the type of user data, the Diameter server SHOULD take into
1037 account the supported formats at the SIP server
1038 (SIP-Supported-User-Data-Type AVP in the SAR message) and the
1039 local policy. Additionally, the Diameter server MUST set the
1040 Result-Code AVP value to DIAMETER_SUCCESS in the Diameter SAA
1041 message. The Diameter server considers the SIP AOR authenticated
1042 and registered.
1043
1044 o If the SIP-Server-Assignment-Type AVP value in the Diameter SAR
1045 message is set to UNREGISTERED_USER, then the Diameter server MUST
1046 store the SIP server address included in the SIP-Server-URI AVP
1047 value. The Diameter server will return the SIP server address in
1048 Diameter Location-Info-Answer (LIA) messages. If the
1049 SIP-User-Data-Already-Available AVP value is set to
1050 USER_DATA_NOT_AVAILABLE, then the Diameter server SHOULD include
1051 one or more user profile data associated with the SIP or SIPS URI
1052 (SIP-AOR AVP) and associated identities in the SIP-User-Data AVP
1053 value of the Diameter SAA message. On selecting the type of user
1054 data, the Diameter server SHOULD take into account the supported
1055 formats at the SIP server (SIP-Supported-User-Data-Type AVP in the
1056 SAR message) and the local policy. The Diameter server MUST set
1057 the Result-Code AVP value to DIAMETER_SUCCESS. The Diameter
1058 server considers the SIP AOR UNREGISTERED, but with a SIP server
1059 allocated to trigger and provide services for unregistered users.
1060 Note that in case of UNREGISTERED_USER (SIP-Server-Assignment-Type
1061 AVP), the Diameter server MUST verify that there is only one
1062 SIP-AOR AVP. Otherwise, the Diameter server MUST answer the
1063 Diameter SAR message with a Diameter SAA message, and it MUST set
1064 the Result-Code AVP value to DIAMETER_AVP_OCCURS_TOO_MANY_TIMES
1065 and MUST NOT include any SIP-User-Data AVP.
1066 If the User-Name AVP was not present in the Diameter SAR message
1067 and the SIP-AOR is not known for the Diameter server, the Diameter
1068 server MUST NOT include a User-Name AVP in the Diameter SAA
1069 message and MUST set the Result-Code AVP value to
1070 DIAMETER_ERROR_USER_UNKNOWN.
1071
1072 o If the SIP-Server-Assignment-Type AVP value in the Diameter SAR
1073 message is set to TIMEOUT_DEREGISTRATION, USER_DEREGISTRATION,
1074 DEREGISTRATION_TOO_MUCH_DATA, or ADMINISTRATIVE_DEREGISTRATION,
1075 the Diameter server MUST clear the SIP server address associated
1076 with all SIP AORs indicated in each of the SIP-AOR AVP values
1077 included in the Diameter SAR message. The Diameter server
1078 considers all of these SIP AORs as not registered. The Diameter
1079 server MUST set the Result-Code AVP value to DIAMETER_SUCCESS in
1080 the Diameter SAA message.
1081
1082 o If the SIP-Server-Assignment-Type AVP value in the Diameter SAR
1083 message is set to TIMEOUT_DEREGISTRATION_STORE_SERVER_NAME or
1084 USER_DEREGISTRATION_STORE_SERVER_NAME, the Diameter server MAY
1085 keep the SIP server address associated with the SIP AORs included
1086 in the SIP-AOR AVP values of the Diameter SAR message, even though
1087 the SIP AORs become unregistered. This feature allows a SIP
1088 server to request that the Diameter server remain an assigned SIP
1089 server for those SIP AORs (SIP-AOR AVP values) allocated to the
1090 same user name, and avoid SIP server assignment. The Diameter
1091 server MUST consider all these SIP AORs as not registered. If the
1092 Diameter server honors the request of the Diameter client (SIP
1093 server) to remain as an allocated SIP server, then the Diameter
1094 server MUST keep the SIP server assigned to those SIP AORs
1095 allocated to the username and MUST set the Result-Code AVP value
1096 to DIAMETER_SUCCESS in the Diameter SAA message. Otherwise, when
1097 the Diameter server does not honor the request of the Diameter
1098 client (SIP server) to remain as an allocated SIP server, the
1099 Diameter server MUST clear the SIP server name assigned to those
1100 SIP AORs and it MUST set the Result-Code AVP value to
1101 DIAMETER_SUCCESS_SERVER_NAME_NOT_STORED in the Diameter SAA
1102 message.
1103 o If the SIP-Server-Assignment-Type AVP value in the Diameter SAR
1104 message is set to NO_ASSIGNMENT, the Diameter server SHOULD first
1105 verify that the SIP-Server-URI AVP value in the Diameter SAR
1106 message is the same URI as the one assigned to the SIP-AOR AVP
1107 value. If they differ, then the Diameter server MUST set the
1108 Result-Code AVP value to DIAMETER_UNABLE_TO_COMPLY in the Diameter
1109 SAA message. Otherwise, if the SIP-User-Data-Already-Available
1110 AVP value is set to USER_DATA_NOT_AVAILABLE, then the Diameter
1111 server SHOULD include the user profile data with the SIP or SIPS
1112 URI (SIP-AOR AVP) and all other SIP identities associated with
1113 that AVP in the SIP-User-Data AVP value of the Diameter SAA
1114 message. On selecting the type of user data, the Diameter server
1115 SHOULD take into account the supported formats at the SIP server
1116 (SIP-Supported-User-Data-Type AVP in the SAR message) and the
1117 local policy.
1118
1119 o If the SIP-Server-Assignment-Type AVP value in the Diameter SAR
1120 message is set to AUTHENTICATION_FAILURE or
1121 AUTHENTICATION_TIMEOUT, the Diameter server MUST verify that there
1122 is exactly one SIP-AOR AVP in the Diameter SAR message. If the
1123 number of occurrences of the SIP-AOR AVP is not exactly one, the
1124 Diameter server MUST set the Result-Code AVP value to
1125 DIAMETER_AVP_OCCURS_TOO_MANY_TIMES in the Diameter SAA message,
1126 and SHOULD not take further actions. If there is exactly one
1127 SIP-AOR AVP in the Diameter SAR message, the Diameter server MUST
1128 clear the address of the SIP server assigned to the SIP AOR
1129 allocated to the user name, and the Diameter server MUST set the
1130 Result-Code AVP value to DIAMETER_SUCCESS in the Diameter SAA
1131 message. The Diameter server MUST consider the SIP AOR as not
1132 registered.
1133
1134 The Message Format of the SAA command is as follows:
1135
1136 <SAA> ::= < Diameter Header: 284, PXY >
1137 < Session-Id >
1138 { Auth-Application-Id }
1139 { Result-Code }
1140 { Auth-Session-State }
1141 { Origin-Host }
1142 { Origin-Realm }
1143 * [ SIP-User-Data ]
1144 [ SIP-Accounting-Information ]
1145 * [ SIP-Supported-User-Data-Type ]
1146 [ User-Name ]
1147 [ Auth-Grace-Period ]
1148 [ Authorization-Lifetime ]
1149 [ Redirect-Host ]
1150 [ Redirect-Host-Usage ]
1151 [ Redirect-Max-Cache-Time ]
1152 * [ Proxy-Info ]
1153 * [ Route-Record ]
1154 * [ AVP ]
1155
1156
1157
1158
1159 */
1160 struct dict_object * cmd;
1161 struct dict_cmd_data data = {
1162 284, /* Code */
1163 "Server-Assignment-Answer", /* Name */
1164 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */
1165 CMD_FLAG_PROXIABLE /* Fixed flag values */
1166 };
1167 struct local_rules_definition rules[] =
1168 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 }
1169 ,{ "Auth-Application-Id", RULE_REQUIRED, -1, 1 }
1170 ,{ "Result-Code", RULE_REQUIRED, -1, 1 }
1171 ,{ "Auth-Session-State", RULE_REQUIRED, -1, 1 }
1172 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 }
1173 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 }
1174 ,{ "SIP-User-Data", RULE_OPTIONAL, -1, -1 }
1175 ,{ "SIP-Accounting-Information", RULE_OPTIONAL, -1, 1 }
1176 ,{ "SIP-Supported-User-Data-Type", RULE_OPTIONAL, -1, -1 }
1177 ,{ "User-Name", RULE_OPTIONAL, -1, 1 }
1178 ,{ "Auth-Grace-Period", RULE_OPTIONAL, -1, 1 }
1179 ,{ "Authorization-Lifetime", RULE_OPTIONAL, -1, 1 }
1180 ,{ "Redirect-Host", RULE_OPTIONAL, -1, 1 }
1181 ,{ "Redirect-Host-Usage", RULE_OPTIONAL, -1, 1 }
1182 ,{ "Redirect-Max-Cache-Time", RULE_OPTIONAL, -1, 1 }
1183 ,{ "Proxy-Info", RULE_OPTIONAL, -1, -1 }
1184 ,{ "Route-Record", RULE_OPTIONAL, -1, -1 }
1185
1186 };
1187
1188 CHECK_dict_new( DICT_COMMAND, &data , cxdx_dict, &cmd);
1189 PARSE_loc_rules( rules, cmd, AVP_BY_NAME );
1190 }
1191 /* Location-Info-Request (LIR) Command */
1192 {
1193 /*
1194
1195 The Location-Info-Request (LIR) is indicated by the Command-Code set
1196 to 285 and the Command Flags' 'R' bit set. The Diameter client in a
1197 SIP server sends this command to the Diameter server to request
1198 routing information, e.g., the URI of the SIP server assigned to the
1199 SIP-AOR AVP value allocated to the users.
1200
1201 The Message Format of the LIR command is as follows:
1202
1203 <LIR> ::= < Diameter Header: 285, REQ, PXY >
1204 < Session-Id >
1205 { Auth-Application-Id }
1206 { Auth-Session-State }
1207 { Origin-Host }
1208 { Origin-Realm }
1209 { Destination-Realm }
1210 { SIP-AOR }
1211 [ Destination-Host ]
1212 * [ Proxy-Info ]
1213 * [ Route-Record ]
1214 * [ AVP ]
1215 */
1216 struct dict_object * cmd;
1217 struct dict_cmd_data data = {
1218 285, /* Code */
1219 "Location-Info-Request", /* Name */
1220 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */
1221 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */
1222 };
1223 struct local_rules_definition rules[] =
1224 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 }
1225 ,{ "Auth-Application-Id", RULE_REQUIRED, -1, 1 }
1226 ,{ "Auth-Session-State", RULE_REQUIRED, -1, 1 }
1227 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 }
1228 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 }
1229 ,{ "Destination-Realm", RULE_REQUIRED, -1, 1 }
1230 ,{ "SIP-AOR", RULE_REQUIRED, -1, 1 }
1231 ,{ "Destination-Host", RULE_OPTIONAL, -1, 1 }
1232 ,{ "Proxy-Info", RULE_OPTIONAL, -1, -1 }
1233 ,{ "Route-Record", RULE_OPTIONAL, -1, -1 }
1234
1235 };
1236
1237 CHECK_dict_new( DICT_COMMAND, &data , cxdx_dict, &cmd);
1238 PARSE_loc_rules( rules, cmd, AVP_BY_NAME );
1239 }
1240 /* Location-Info-Answer (LIA) Command */
1241 {
1242 /*
1243 The Location-Info-Answer (LIA) is indicated by the Command-Code set
1244 to 285 and the Command Flags' 'R' bit cleared. The Diameter server
1245 sends this command in response to a previously received Diameter
1246 Location-Info-Request (LIR) command.
1247
1248 In addition to the values already defined in RFC 3588 [RFC3588], the
1249 Result-Code AVP may contain one of the values defined in
1250 Section 10.1. When the Diameter server finds an error in processing
1251 the Diameter LIR message, the Diameter server MUST stop the process
1252 of the message and answer with a Diameter LIA message that includes
1253 the appropriate error code in the Result-Code AVP value. When there
1254 is no error, the Diameter server MUST set the Result-Code AVP value
1255 to DIAMETER_SUCCESS in the Diameter LIA message.
1256
1257 One of the errors that the Diameter server may find is that the
1258 SIP-AOR AVP value is not a valid user in the realm. In such cases,
1259 the Diameter server MUST set the Result-Code AVP value to
1260 DIAMETER_ERROR_USER_UNKNOWN and return it in a Diameter LIA message.
1261
1262 If the Diameter server cannot process the Diameter LIR command, e.g.,
1263 due to a database error, the Diameter server MUST set the Result-Code
1264 AVP value to DIAMETER_UNABLE_TO_COMPLY and return it in a Diameter
1265 LIA message. The Diameter server MUST NOT include any SIP-Server-URI
1266 or SIP-Server-Capabilities AVP in the Diameter LIA message.
1267
1268 The Diameter server may or may not be aware of a SIP server assigned
1269 to the SIP-AOR AVP value included in the Diameter LIR message. If
1270 the Diameter server is aware of a SIP server allocated to that
1271 particular user, the Diameter server MUST include the URI of such SIP
1272 server in the SIP-Server-URI AVP and return it in a Diameter LIA
1273 message. This is typically the situation when the user is either
1274 registered, or unregistered but a SIP server is still assigned to the
1275 user.
1276
1277 When the Diameter server is not aware of a SIP server allocated to
1278 the user (typically the case when the user unregistered), the
1279 Result-Code AVP value in the Diameter LIA message depends on whether
1280 the Diameter server is aware that the user has services defined for
1281 unregistered users:
1282
1283 o Those users who have services defined for unregistered users may
1284 require the allocation of a SIP server to trigger and perhaps
1285 execute those services. Therefore, when the Diameter server is
1286 not aware of an assigned SIP server, but the user has services
1287 defined for unregistered users, the Diameter server MUST set the
1288 Result-Code AVP value to DIAMETER_UNREGISTERED_SERVICE and return
1289 it in a Diameter LIA message. The Diameter server MAY also
1290 include a SIP-Server-Capabilities AVP to facilitate the SIP server
1291 (Diameter client) with the selection of an appropriate SIP server
1292 with the required capabilities. Absence of the SIP-Server-
1293 Capabilities AVP indicates to the SIP server (Diameter client)
1294 that any SIP server is suitable to be allocated for the user.
1295
1296 o Those users who do not have service defined for unregistered users
1297 do not require further processing. The Diameter server MUST set
1298 the Result-Code AVP value to
1299 DIAMETER_ERROR_IDENTITY_NOT_REGISTERED and return it to the
1300 Diameter client in a Diameter LIA message. The SIP server
1301 (Diameter client) may return the appropriate SIP response (e.g.,
1302 480 (Temporarily unavailable)) to the original SIP request.
1303
1304 The Message Format of the LIA command is as follows:
1305
1306 <LIA> ::= < Diameter Header: 285, PXY >
1307 < Session-Id >
1308 { Auth-Application-Id }
1309 { Result-Code }
1310 { Auth-Session-State }
1311 { Origin-Host }
1312 { Origin-Realm }
1313 [ SIP-Server-URI ]
1314 [ SIP-Server-Capabilities ]
1315 [ Auth-Grace-Period ]
1316 [ Authorization-Lifetime ]
1317 [ Redirect-Host ]
1318 [ Redirect-Host-Usage ]
1319 [ Redirect-Max-Cache-Time ]
1320 * [ Proxy-Info ]
1321 * [ Route-Record ]
1322 * [ AVP ]
1323 */
1324 struct dict_object * cmd;
1325 struct dict_cmd_data data = {
1326 285, /* Code */
1327 "Location-Info-Answer", /* Name */
1328 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */
1329 CMD_FLAG_PROXIABLE /* Fixed flag values */
1330 };
1331 struct local_rules_definition rules[] =
1332 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 }
1333 ,{ "Auth-Application-Id", RULE_REQUIRED, -1, 1 }
1334 ,{ "Result-Code", RULE_REQUIRED, -1, 1 }
1335 ,{ "Auth-Session-State", RULE_REQUIRED, -1, 1 }
1336 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 }
1337 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 }
1338 ,{ "SIP-Server-URI", RULE_OPTIONAL, -1, 1 }
1339 ,{ "SIP-Server-Capabilities", RULE_OPTIONAL, -1, 1 }
1340 ,{ "Auth-Grace-Period", RULE_OPTIONAL, -1, 1 }
1341 ,{ "Authorization-Lifetime", RULE_OPTIONAL, -1, 1 }
1342 ,{ "Redirect-Host", RULE_OPTIONAL, -1, 1 }
1343 ,{ "Redirect-Host-Usage", RULE_OPTIONAL, -1, 1 }
1344 ,{ "Redirect-Max-Cache-Time", RULE_OPTIONAL, -1, 1 }
1345 ,{ "Proxy-Info", RULE_OPTIONAL, -1, -1 }
1346 ,{ "Route-Record", RULE_OPTIONAL, -1, -1 }
1347
1348 };
1349
1350 CHECK_dict_new( DICT_COMMAND, &data , cxdx_dict, &cmd);
1351 PARSE_loc_rules( rules, cmd, AVP_BY_NAME );
1352 }
1353 /* Registration-Termination-Request (RTR) Command */
1354 {
1355 /*
1356 The Registration-Termination-Request (RTR) command is indicated by
1357 the Command-Code set to 287 and the Command Flags' 'R' bit set. The
1358 Diameter server sends this command to the Diameter client in a SIP
1359 server to indicate to the SIP server that one or more SIP AORs have
1360 to be deregistered. The command allows an operator to
1361 administratively cancel the registration of a user from a centralized
1362 Diameter server.
1363
1364 The Diameter server has the capability to initiate the deregistration
1365 of a user and inform the SIP server by means of the Diameter RTR
1366 command. The Diameter server can decide whether only one SIP AOR is
1367 going to be deregistered, a list of SIP AORs, or all the SIP AORs
1368 allocated to the user.
1369
1370 The absence of a SIP-AOR AVP in the Diameter RTR message indicates
1371 that all the SIP AORs allocated to the user identified by the
1372 User-Name AVP are being deregistered.
1373
1374 The Diameter server MUST include a SIP-Deregistration-Reason AVP
1375 value to indicate the reason for the deregistration.
1376
1377 The Message Format of the RTR command is as follows:
1378
1379 <RTR> ::= < Diameter Header: 287, REQ, PXY >
1380 < Session-Id >
1381 { Auth-Application-Id }
1382 { Auth-Session-State }
1383 { Origin-Host }
1384 { Origin-Realm }
1385 { Destination-Host }
1386 { SIP-Deregistration-Reason }
1387 [ Destination-Realm ]
1388 [ User-Name ]
1389 * [ SIP-AOR ]
1390 * [ Proxy-Info ]
1391 * [ Route-Record ]
1392 * [ AVP ]
1393
1394 */
1395
1396 struct dict_object * cmd;
1397 struct dict_cmd_data data =
1398 {
1399 287, /* Code */
1400 "Registration-Termination-Request", /* Name */
1401 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */
1402 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */
1403 };
1404
1405 struct local_rules_definition rules[] =
1406 {
1407 { "Session-Id", RULE_FIXED_HEAD, -1, 1 },
1408 { "Auth-Application-Id", RULE_REQUIRED, -1, 1 },
1409 { "Auth-Session-State", RULE_REQUIRED, -1, 1 },
1410 { "Origin-Host", RULE_REQUIRED, -1, 1 },
1411 { "Origin-Realm", RULE_REQUIRED, -1, 1 },
1412 { "Destination-Host", RULE_REQUIRED, -1, 1 },
1413 { "SIP-Deregistration-Reason",RULE_REQUIRED, -1, 1 },
1414 { "Destination-Realm", RULE_OPTIONAL, -1, 1 },
1415 { "User-Name", RULE_OPTIONAL, -1, 1 },
1416 { "SIP-AOR", RULE_REQUIRED, -1, -1 },
1417 { "Proxy-Info", RULE_OPTIONAL, -1, -1 },
1418 { "Route-Record", RULE_OPTIONAL, -1, -1 }
1419 };
1420
1421 CHECK_dict_new( DICT_COMMAND, &data , cxdx_dict, &cmd);
1422 PARSE_loc_rules( rules, cmd, AVP_BY_NAME );
1423 }
1424 /* Registration-Termination-Answer (RTA) Command */
1425 {
1426 /*
1427 The Registration-Termination-Answer (RTA) is indicated by the
1428 Command-Code set to 287 and the Command Flags' 'R' bit cleared. The
1429 Diameter client sends this command in response to a previously
1430 received Diameter Registration-Termination-Request (RTR) command.
1431
1432 In addition to the values already defined in RFC 3588 [RFC3588], the
1433 Result-Code AVP may contain one of the values defined in
1434 Section 10.1.
1435
1436 If the SIP server (Diameter client) requires a User-Name AVP value to
1437 process the Diameter RTR request, but the Diameter RTR message did
1438 not contain a User-Name AVP value, the Diameter client MUST set the
1439 Result-Code AVP value to DIAMETER_USER_NAME_REQUIRED (see Section
1440 10.1.2) and return it in a Diameter RTA message.
1441
1442 The SIP server (Diameter client) applies the administrative
1443 deregistration to each of the URIs included in each of the SIP-AOR
1444 AVP values, or, if there is no SIP-AOR AVP present in the Diameter
1445 RTR request, to all the URIs allocated to the User-Name AVP value.
1446
1447 The value of the SIP-Deregistration-Reason AVP in the Diameter RTR
1448 command has an effect on the actions performed at the SIP server
1449 (Diameter client):
1450
1451 o If the value is set to PERMANENT_TERMINATION, then the user has
1452 terminated his/her registration to the realm. If informing the
1453 interested parties (e.g., subscribers to the "reg" event
1454 [RFC3680]) about the administrative deregistration is supported
1455 through SIP procedures, the SIP server (Diameter client) will do
1456 so. The Diameter Client in the SIP Server SHOULD NOT request a
1457 new user registration. The SIP server clears the registration
1458 state of the deregistered AORs.
1459
1460 o If the value is set to NEW_SIP_SERVER_ASSIGNED, the Diameter
1461 server informs the SIP server (Diameter client) that a new SIP
1462 server has been allocated to the user, due to some reason. The
1463 SIP server, if supported through SIP procedures, will inform the
1464 interested parties (e.g., subscribers to the "reg" event
1465 [RFC3680]) about the administrative deregistration at this SIP
1466 server. The Diameter client in the SIP server SHOULD NOT request
1467 a new user registration. The SIP server clears the registration
1468 state of the deregistered SIP AORs.
1469
1470 o If the value is set to SIP_SERVER_CHANGE, the Diameter server
1471 informs the SIP server (Diameter client) that a new SIP server has
1472 to be allocated to the user, e.g., due to user's capabilities
1473 requiring a new SIP server, or not enough resources in the current
1474 SIP server. If informing the interested parties about the
1475 administrative deregistration is supported through SIP procedures
1476 (e.g., subscriptions to the "reg" event [RFC3680]), the SIP server
1477 will do so. The Diameter client in the SIP Server SHOULD NOT
1478 request a new user registration. The SIP server clears the
1479 registration state of the deregistered SIP AORs.
1480
1481 o If the value is set to REMOVE_SIP_SERVER, the Diameter server
1482 informs the SIP server (Diameter client) that the SIP server will
1483 no longer be bound in the Diameter server with that user. The SIP
1484 server can delete all data related to the user.
1485
1486 The Message Format of the RTA command is as follows:
1487
1488 <RTA> ::= < Diameter Header: 287, PXY >
1489 < Session-Id >
1490 { Auth-Application-Id }
1491 { Result-Code }
1492 { Auth-Session-State }
1493 { Origin-Host }
1494 { Origin-Realm }
1495 [ Authorization-Lifetime ]
1496 [ Auth-Grace-Period ]
1497 [ Redirect-Host ]
1498 [ Redirect-Host-Usage ]
1499 [ Redirect-Max-Cache-Time ]
1500 * [ Proxy-Info ]
1501 * [ Route-Record ]
1502 * [ AVP ]
1503
1504 */
1505 struct dict_object * cmd;
1506 struct dict_cmd_data data = {
1507 287, /* Code */
1508 "Registration-Termination-Answer", /* Name */
1509 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */
1510 CMD_FLAG_PROXIABLE /* Fixed flag values */
1511 };
1512 struct local_rules_definition rules[] =
1513 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 }
1514 ,{ "Auth-Application-Id", RULE_REQUIRED, -1, 1 }
1515 ,{ "Result-Code", RULE_REQUIRED, -1, 1 }
1516 ,{ "Auth-Session-State", RULE_REQUIRED, -1, 1 }
1517 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 }
1518 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 }
1519 ,{ "Authorization-Lifetime", RULE_OPTIONAL, -1, 1 }
1520 ,{ "Auth-Grace-Period", RULE_OPTIONAL, -1, 1 }
1521 ,{ "Redirect-Host", RULE_OPTIONAL, -1, 1 }
1522 ,{ "Redirect-Host-Usage", RULE_OPTIONAL, -1, 1 }
1523 ,{ "Redirect-Max-Cache-Time", RULE_OPTIONAL, -1, 1 }
1524 ,{ "Proxy-Info", RULE_OPTIONAL, -1, -1 }
1525 ,{ "Route-Record", RULE_OPTIONAL, -1, -1 }
1526
1527 };
1528
1529 CHECK_dict_new( DICT_COMMAND, &data , cxdx_dict, &cmd);
1530 PARSE_loc_rules( rules, cmd, AVP_BY_NAME );
1531 }
1532
1533 /* Push-Profile-Request (PPR) Command */
1534 {
1535 /*
1536 The Push-Profile-Request (PPR) command is indicated by the
1537 Command-Code set to 288 and the Command Flags' 'R' bit set. The
1538 Diameter server sends this command to the Diameter client in a SIP
1539 server to update either the user profile of an already registered
1540 user in that SIP server or the SIP accounting information. This
1541 allows an operator to modify the data of a user profile or the
1542 accounting information and push it to the SIP server where the user
1543 is registered.
1544
1545 Each user has a user profile associated with him/her and other
1546 accounting information. The profile or the accounting information
1547 may change with time, e.g., due to addition of new services to the
1548 user. When the user profile or the accounting information changes,
1549 the Diameter server sends a Diameter Push-Profile-Request (PPR)
1550 command to the Diameter client in a SIP server, in order to start
1551 applying those new services.
1552
1553 A PPR command MAY contain a SIP-Accounting-Information AVP that
1554 updates the addresses of the accounting servers. Changes in the
1555 addresses of the accounting servers take effect immediately. The
1556 Diameter client SHOULD close any existing accounting session with the
1557 existing server and start providing accounting information to the
1558 newly acquired accounting server.
1559
1560 A PPR command MAY contain zero or more SIP-User-Data AVP values
1561 containing the new user profile. On selecting the type of user data,
1562 the Diameter server SHOULD take into account the supported formats at
1563 the SIP server (SIP-Supported-User-Data-Type AVP sent in a previous
1564 SAR message) and the local policy.
1565
1566 The User-Name AVP indicates the user to whom the profile is
1567 applicable.
1568
1569 The Message Format of the PPR command is as follows:
1570
1571 <PPR> ::= < Diameter Header: 288, REQ, PXY >
1572 < Session-Id >
1573 { Auth-Application-Id }
1574 { Auth-Session-State }
1575 { Origin-Host }
1576 { Origin-Realm }
1577 { Destination-Realm }
1578 { User-Name }
1579 * [ SIP-User-Data ]
1580 [ SIP-Accounting-Information ]
1581 [ Destination-Host ]
1582 [ Authorization-Lifetime ]
1583 [ Auth-Grace-Period ]
1584 * [ Proxy-Info ]
1585 * [ Route-Record ]
1586 * [ AVP ]
1587
1588 */
1589 struct dict_object * cmd;
1590 struct dict_cmd_data data = {
1591 288, /* Code */
1592 "Push-Profile-Request", /* Name */
1593 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */
1594 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */
1595 };
1596 struct local_rules_definition rules[] =
1597 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 }
1598 ,{ "Auth-Application-Id", RULE_REQUIRED, -1, 1 }
1599 ,{ "Auth-Session-State", RULE_REQUIRED, -1, 1 }
1600 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 }
1601 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 }
1602 ,{ "Destination-Realm", RULE_REQUIRED, -1, 1 }
1603 ,{ "User-Name", RULE_REQUIRED, -1, 1 }
1604 ,{ "SIP-User-Data", RULE_OPTIONAL, -1, -1 }
1605 ,{ "SIP-Accounting-Information", RULE_OPTIONAL, -1, 1 }
1606 ,{ "Destination-Host", RULE_OPTIONAL, -1, 1 }
1607 ,{ "Authorization-Lifetime", RULE_OPTIONAL, -1, 1 }
1608 ,{ "Auth-Grace-Period", RULE_OPTIONAL, -1, 1 }
1609 ,{ "Proxy-Info", RULE_OPTIONAL, -1, -1 }
1610 ,{ "Route-Record", RULE_OPTIONAL, -1, -1 }
1611
1612 };
1613
1614 CHECK_dict_new( DICT_COMMAND, &data , cxdx_dict, &cmd);
1615 PARSE_loc_rules( rules, cmd, AVP_BY_NAME );
1616 }
1617 /* Push-Profile-Answer (PPA) Command */
1618 {
1619 /*
1620
1621
1622 The Push-Profile-Answer (PPA) is indicated by the Command-Code set to
1623 288 and the Command Flags' 'R' bit cleared. The Diameter client
1624 sends this command in response to a previously received Diameter
1625 Push-Profile-Request (PPR) command.
1626
1627 In addition to the values already defined in RFC 3588 [RFC3588], the
1628 Result-Code AVP may contain one of the values defined in
1629 Section 10.1.
1630
1631 If there is no error when processing the received Diameter PPR
1632 message, the SIP server (Diameter client) MUST download the received
1633 user profile from the SIP-User-Data AVP values in the Diameter PPR
1634 message and store it associated with the user specified in the
1635 User-Name AVP value.
1636
1637 If the SIP server does not recognize or does not support some of the
1638 data transferred in the SIP-User-Data AVP values, the Diameter client
1639 in the SIP server MUST return a Diameter PPA message that includes a
1640 Result-Code AVP set to the value DIAMETER_ERROR_NOT_SUPPORTED_USER_DATA.
1641
1642 If the SIP server (Diameter client) receives a Diameter PPR message
1643 with a User-Name AVP that is unknown, the Diameter client MUST set
1644 the Result-Code AVP value to DIAMETER_ERROR_USER_UNKNOWN and MUST
1645 return it to the Diameter server in a Diameter PPA message.
1646
1647 If the SIP server (Diameter client) receives in the
1648 SIP-User-Data-Content AVP value (of the grouped SIP-User-Data AVP)
1649 more data than it can accept, it MUST set the Result-Code AVP value
1650 to DIAMETER_ERROR_TOO_MUCH_DATA and MUST return it to the Diameter
1651 server in a Diameter PPA message. The SIP server MUST NOT override
1652 the existing user profile with the one received in the PPR message.
1653
1654 If the Diameter server receives the Result-Code AVP value set to
1655 DIAMETER_ERROR_TOO_MUCH_DATA in a Diameter PPA message, it SHOULD
1656 force a new re-registration of the user by sending to the Diameter
1657 client a Diameter Registration-Termination-Request (RTR) with the
1658 SIP-Deregistration-Reason AVP value set to SIP_SERVER_CHANGE. This
1659 will force a re-registration of the user and will trigger a selection
1660 of a new SIP server.
1661
1662 If the Diameter client is not able to honor the command, for any
1663 other reason, it MUST set the Result-Code AVP value to
1664 DIAMETER_UNABLE_TO_COMPLY and it MUST return it in a Diameter PPA
1665 message.
1666
1667 The Message Format of the PPA command is as follows:
1668
1669 <PPA> ::= < Diameter Header: 288, PXY >
1670 < Session-Id >
1671 { Auth-Application-Id }
1672 { Result-Code }
1673 { Auth-Session-State }
1674 { Origin-Host }
1675 { Origin-Realm }
1676 [ Redirect-Host ]
1677 [ Redirect-Host-Usage ]
1678 [ Redirect-Max-Cache-Time ]
1679 * [ Proxy-Info ]
1680 * [ Route-Record ]
1681 * [ AVP ]
1682
1683
1684
1685 */
1686 struct dict_object * cmd;
1687 struct dict_cmd_data data = {
1688 288, /* Code */
1689 "Push-Profile-Answer", /* Name */
1690 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */
1691 CMD_FLAG_PROXIABLE /* Fixed flag values */
1692 };
1693 struct local_rules_definition rules[] =
1694 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 }
1695 ,{ "Auth-Application-Id", RULE_REQUIRED, -1, 1 }
1696 ,{ "Result-Code", RULE_REQUIRED, -1, 1 }
1697 ,{ "Auth-Session-State", RULE_REQUIRED, -1, 1 }
1698 ,{ "Origin-Host", RULE_REQUIRED, -1, 1 }
1699 ,{ "Origin-Realm", RULE_REQUIRED, -1, 1 }
1700 ,{ "Redirect-Host", RULE_OPTIONAL, -1, 1 }
1701 ,{ "Redirect-Host-Usage", RULE_OPTIONAL, -1, 1 }
1702 ,{ "Redirect-Max-Cache-Time", RULE_OPTIONAL, -1, 1 }
1703 ,{ "Proxy-Info", RULE_OPTIONAL, -1, -1 }
1704 ,{ "Route-Record", RULE_OPTIONAL, -1, -1 }
1705
1706 };
1707
1708 CHECK_dict_new( DICT_COMMAND, &data , cxdx_dict, &cmd);
1709 PARSE_loc_rules( rules, cmd, AVP_BY_NAME );
1710 }
1711
1712#endif /* TODO - NRGJ */
1713
1714 } /* end Command section */
1715
1716
1717
1718 TRACE_DEBUG(INFO, "Extension 'Dictionary CxDx' initialized");
1719 return 0;
1720}
1721
1722
1723EXTENSION_ENTRY("dict_cxdx", cxdx_dict_init);
1724