Scope:
Copyright (C) 2005 FhG Fokus
Definition in file cx_avp.c.
#include "cx_avp.h"
#include "../../mem/shm_mem.h"
#include <stdio.h>
Go to the source code of this file.
Functions | |
| static int | Cx_add_avp (AAAMessage *m, char *d, int len, int avp_code, int flags, int vendorid, int data_do, const char *func) |
| Create and add an AVP to a Diameter message. | |
| static int | Cx_add_avp_list (AAA_AVP_LIST *list, char *d, int len, int avp_code, int flags, int vendorid, int data_do, const char *func) |
| Create and add an AVP to a list of AVPs. | |
| static str | Cx_get_avp (AAAMessage *msg, int avp_code, int vendor_id, const char *func) |
| Returns the value of a certain AVP from a Diameter message. | |
| int | Cx_add_user_name (AAAMessage *msg, str data) |
| NO DATA WILL BE DUPLICATED OR FREED - DO THAT AFTER SENDING THE MESSAGE!!! | |
| int | Cx_add_public_identity (AAAMessage *msg, str data) |
| Creates and adds a Public Identity AVP. | |
| int | Cx_add_visited_network_id (AAAMessage *msg, str data) |
| Creates and adds a Visited-Network-ID AVP. | |
| int | Cx_add_authorization_type (AAAMessage *msg, unsigned int data) |
| Creates and adds a Authorization-Type AVP. | |
| int | Cx_add_server_name (AAAMessage *msg, str data) |
| Creates and adds a Server-Name AVP. | |
| int | Cx_add_sip_number_auth_items (AAAMessage *msg, unsigned int data) |
| Creates and adds a SIP-Number-Auth-Items AVP. | |
| int | Cx_add_sip_auth_data_item_request (AAAMessage *msg, str auth_scheme, str auth, str username, str realm, str method, str server_name) |
| Creates and adds a SIP-Auth-Data-Item AVP. | |
| str | Cx_ETSI_sip_authorization (str username, str realm, str nonce, str URI, str response, str algorithm, str method, str hash) |
| Creates and adds a ETSI_sip_authorization AVP. | |
| int | Cx_add_server_assignment_type (AAAMessage *msg, unsigned int data) |
| Creates and adds a Server-Assignment-Type AVP. | |
| int | Cx_add_userdata_available (AAAMessage *msg, unsigned int data) |
| Creates and adds Userdata-Available AVP. | |
| int | Cx_add_result_code (AAAMessage *msg, unsigned int data) |
| Creates and adds a Result-Code AVP. | |
| int | Cx_add_experimental_result_code (AAAMessage *msg, unsigned int data) |
| Creates and adds a Experimental-Result-Code AVP. | |
| int | Cx_add_vendor_specific_appid (AAAMessage *msg, unsigned int vendor_id, unsigned int auth_id, unsigned int acct_id) |
| Creates and adds a Vendor-Specifig-Application-ID AVP. | |
| int | Cx_add_auth_session_state (AAAMessage *msg, unsigned int data) |
| Creates and adds a Auth-Session-State AVP. | |
| int | Cx_add_destination_realm (AAAMessage *msg, str data) |
| Creates and adds a Destination-Realm AVP. | |
| str | Cx_get_session_id (AAAMessage *msg) |
| Returns the Session-Id AVP of a Diameter message. | |
| str | Cx_get_user_name (AAAMessage *msg) |
| Returns the User-Name AVP from a Diameter message. | |
| str | Cx_get_public_identity (AAAMessage *msg) |
| Returns the Public-Identity AVP from a Diameter message. | |
| AAA_AVP * | Cx_get_next_public_identity (AAAMessage *msg, AAA_AVP *pos, int avp_code, int vendor_id, const char *func) |
| Finds out the next Public-Identity AVP from a Diameter message. | |
| str | Cx_get_visited_network_id (AAAMessage *msg) |
| Returns the Visited-Network-ID AVP from a Diameter message. | |
| int | Cx_get_authorization_type (AAAMessage *msg, int *data) |
| Returns the Authorization-Type AVP from a Diameter message. | |
| int | Cx_get_server_assignment_type (AAAMessage *msg, int *data) |
| Returns the Server-Assignment-Type AVP from a Diameter message. | |
| int | Cx_get_userdata_available (AAAMessage *msg, int *data) |
| Returns the User-Data-Available AVP from a Diameter message. | |
| int | Cx_get_result_code (AAAMessage *msg, int *data) |
| Returns the Result-Code AVP from a Diameter message. | |
| int | Cx_get_experimental_result_code (AAAMessage *msg, int *data) |
| Returns the Experimental-Result-Code AVP from a Diameter message. | |
| str | Cx_get_server_name (AAAMessage *msg) |
| Returns the Server-Name AVP from a Diameter message. | |
| int | Cx_get_capabilities (AAAMessage *msg, int **m, int *m_cnt, int **o, int *o_cnt, str **p, int *p_cnt) |
| Returns the Capabilities from the grouped AVP from a Diameter message. | |
| int | Cx_get_sip_number_auth_items (AAAMessage *msg, int *data) |
| Returns the SIP-Number-Auth-Items AVP from a Diameter message. | |
| int | Cx_get_auth_data_item_request (AAAMessage *msg, str *auth_scheme, str *authorization) |
| Returns the Auth-Data-Item from a Diameter Request message. | |
| int | Cx_get_auth_data_item_answer (AAAMessage *msg, AAA_AVP **auth_data, int *item_number, str *auth_scheme, str *authenticate, str *authorization, str *ck, str *ik, str *ip, str *ha1, str *response_auth, str *digest_realm, str *line_identifier) |
| Returns the Auth-Data-Item from a Diameter answer message. | |
| str | Cx_get_destination_host (AAAMessage *msg) |
| Returns the Destination-Host from a Diameter message. | |
| str | Cx_get_user_data (AAAMessage *msg) |
| Returns the User-Data from a Diameter message. | |
| int | Cx_get_charging_info (AAAMessage *msg, str *ccf1, str *ccf2, str *ecf1, str *ecf2) |
| Returns the Charging-Information from a Diameter message. | |
Variables | |
| cdp_binds | cdpb |
| Structure with pointers to cdp funcs. | |
| static str | s_empty = {0, 0} |
| static int Cx_add_avp | ( | AAAMessage * | m, | |
| char * | d, | |||
| int | len, | |||
| int | avp_code, | |||
| int | flags, | |||
| int | vendorid, | |||
| int | data_do, | |||
| const char * | func | |||
| ) | [inline, static] |
Create and add an AVP to a Diameter message.
| m | - Diameter message to add to | |
| d | - the payload data | |
| len | - length of the payload data | |
| avp_code | - the code of the AVP | |
| flags | - flags for the AVP | |
| vendorid | - the value of the vendor id or 0 if none | |
| data_do | - what to do with the data when done | |
| func | - the name of the calling function, for debugging purposes |
Definition at line 79 of file cx_avp.c.
References AAA_AVP_FLAG_VENDOR_SPECIFIC, AAA_ERR_SUCCESS, cdp_binds::AAAAddAVPToMessage, cdp_binds::AAACreateAVP, cdp_binds::AAAFreeAVP, _message_t::avpList, cdpb, M_NAME, and _avp_list_t::tail.
Referenced by Cx_add_auth_session_state(), Cx_add_authorization_type(), Cx_add_destination_realm(), Cx_add_experimental_result_code(), Cx_add_public_identity(), Cx_add_result_code(), Cx_add_server_assignment_type(), Cx_add_server_name(), Cx_add_sip_auth_data_item_request(), Cx_add_sip_number_auth_items(), Cx_add_user_name(), Cx_add_userdata_available(), Cx_add_vendor_specific_appid(), and Cx_add_visited_network_id().
00081 { 00082 AAA_AVP *avp; 00083 if (vendorid!=0) flags |= AAA_AVP_FLAG_VENDOR_SPECIFIC; 00084 avp = cdpb.AAACreateAVP(avp_code,flags,vendorid,d,len,data_do); 00085 if (!avp) { 00086 LOG(L_ERR,"ERR:"M_NAME":%s: Failed creating avp\n",func); 00087 return 0; 00088 } 00089 if (cdpb.AAAAddAVPToMessage(m,avp,m->avpList.tail)!=AAA_ERR_SUCCESS) { 00090 LOG(L_ERR,"ERR:"M_NAME":%s: Failed adding avp to message\n",func); 00091 cdpb.AAAFreeAVP(&avp); 00092 return 0; 00093 } 00094 return 1; 00095 }
| static int Cx_add_avp_list | ( | AAA_AVP_LIST * | list, | |
| char * | d, | |||
| int | len, | |||
| int | avp_code, | |||
| int | flags, | |||
| int | vendorid, | |||
| int | data_do, | |||
| const char * | func | |||
| ) | [inline, static] |
Create and add an AVP to a list of AVPs.
| list | - the AVP list to add to | |
| d | - the payload data | |
| len | - length of the payload data | |
| avp_code | - the code of the AVP | |
| flags | - flags for the AVP | |
| vendorid | - the value of the vendor id or 0 if none | |
| data_do | - what to do with the data when done | |
| func | - the name of the calling function, for debugging purposes |
Definition at line 109 of file cx_avp.c.
References AAA_AVP_FLAG_VENDOR_SPECIFIC, cdp_binds::AAACreateAVP, cdpb, _avp_list_t::head, M_NAME, avp::next, avp::prev, and _avp_list_t::tail.
Referenced by Cx_add_experimental_result_code(), Cx_add_sip_auth_data_item_request(), Cx_add_vendor_specific_appid(), and Cx_ETSI_sip_authorization().
00111 { 00112 AAA_AVP *avp; 00113 if (vendorid!=0) flags |= AAA_AVP_FLAG_VENDOR_SPECIFIC; 00114 avp = cdpb.AAACreateAVP(avp_code,flags,vendorid,d,len,data_do); 00115 if (!avp) { 00116 LOG(L_ERR,"ERR:"M_NAME":%s: Failed creating avp\n",func); 00117 return 0; 00118 } 00119 if (list->tail) { 00120 avp->prev=list->tail; 00121 avp->next=0; 00122 list->tail->next = avp; 00123 list->tail=avp; 00124 } else { 00125 list->head = avp; 00126 list->tail = avp; 00127 avp->next=0; 00128 avp->prev=0; 00129 } 00130 00131 return 1; 00132 }
| static str Cx_get_avp | ( | AAAMessage * | msg, | |
| int | avp_code, | |||
| int | vendor_id, | |||
| const char * | func | |||
| ) | [inline, static] |
Returns the value of a certain AVP from a Diameter message.
| m | - Diameter message to look into | |
| avp_code | - the code to search for | |
| vendorid | - the value of the vendor id to look for or 0 if none | |
| func | - the name of the calling function, for debugging purposes |
Definition at line 142 of file cx_avp.c.
References cdp_binds::AAAFindMatchingAVP, cdpb, avp::data, and M_NAME.
Referenced by Cx_get_auth_data_item_request(), Cx_get_authorization_type(), Cx_get_capabilities(), Cx_get_charging_info(), Cx_get_destination_host(), Cx_get_experimental_result_code(), Cx_get_public_identity(), Cx_get_result_code(), Cx_get_server_assignment_type(), Cx_get_server_name(), Cx_get_session_id(), Cx_get_sip_number_auth_items(), Cx_get_user_data(), Cx_get_user_name(), Cx_get_userdata_available(), and Cx_get_visited_network_id().
00144 { 00145 AAA_AVP *avp; 00146 str r={0,0}; 00147 00148 avp = cdpb.AAAFindMatchingAVP(msg,0,avp_code,vendor_id,0); 00149 if (avp==0){ 00150 LOG(L_INFO,"INFO:"M_NAME":%s: Failed finding avp\n",func); 00151 return r; 00152 } 00153 else 00154 return avp->data; 00155 }
| int Cx_add_user_name | ( | AAAMessage * | msg, | |
| str | data | |||
| ) | [inline] |
NO DATA WILL BE DUPLICATED OR FREED - DO THAT AFTER SENDING THE MESSAGE!!!
| msg | - the Diameter message to add to. | |
| data | - the value for the AVP payload |
Definition at line 166 of file cx_avp.c.
Referenced by Cx_MAR(), Cx_SAR(), and Cx_UAR().
00167 { 00168 return 00169 Cx_add_avp(msg,data.s,data.len, 00170 AVP_User_Name, 00171 AAA_AVP_FLAG_MANDATORY, 00172 0, 00173 AVP_DUPLICATE_DATA, 00174 __FUNCTION__); 00175 }
| int Cx_add_public_identity | ( | AAAMessage * | msg, | |
| str | data | |||
| ) | [inline] |
Creates and adds a Public Identity AVP.
| msg | - the Diameter message to add to. | |
| data | - the value for the AVP payload |
Definition at line 183 of file cx_avp.c.
Referenced by Cx_LIR(), Cx_MAR(), Cx_SAR(), and Cx_UAR().
00184 { 00185 return 00186 Cx_add_avp(msg,data.s,data.len, 00187 AVP_IMS_Public_Identity, 00188 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00189 IMS_vendor_id_3GPP, 00190 AVP_DUPLICATE_DATA, 00191 __FUNCTION__); 00192 }
| int Cx_add_visited_network_id | ( | AAAMessage * | msg, | |
| str | data | |||
| ) | [inline] |
Creates and adds a Visited-Network-ID AVP.
| msg | - the Diameter message to add to. | |
| data | - the value for the AVP payload |
Definition at line 200 of file cx_avp.c.
Referenced by Cx_UAR().
00201 { 00202 return 00203 Cx_add_avp(msg,data.s,data.len, 00204 AVP_IMS_Visited_Network_Identifier, 00205 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00206 IMS_vendor_id_3GPP, 00207 AVP_DUPLICATE_DATA, 00208 __FUNCTION__); 00209 }
| int Cx_add_authorization_type | ( | AAAMessage * | msg, | |
| unsigned int | data | |||
| ) | [inline] |
Creates and adds a Authorization-Type AVP.
| msg | - the Diameter message to add to. | |
| data | - the value for the AVP payload |
Definition at line 217 of file cx_avp.c.
Referenced by Cx_UAR().
00218 { 00219 char x[4]; 00220 set_4bytes(x,data); 00221 return 00222 Cx_add_avp(msg,x,4, 00223 AVP_IMS_User_Authorization_Type, 00224 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00225 IMS_vendor_id_3GPP, 00226 AVP_DUPLICATE_DATA, 00227 __FUNCTION__); 00228 }
| int Cx_add_server_name | ( | AAAMessage * | msg, | |
| str | data | |||
| ) | [inline] |
Creates and adds a Server-Name AVP.
| msg | - the Diameter message to add to. | |
| data | - the value for the AVP payload |
Definition at line 237 of file cx_avp.c.
Referenced by Cx_MAR(), and Cx_SAR().
00238 { 00239 return 00240 Cx_add_avp(msg,data.s,data.len, 00241 AVP_IMS_Server_Name, 00242 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00243 IMS_vendor_id_3GPP, 00244 AVP_DUPLICATE_DATA, 00245 __FUNCTION__); 00246 }
| int Cx_add_sip_number_auth_items | ( | AAAMessage * | msg, | |
| unsigned int | data | |||
| ) | [inline] |
Creates and adds a SIP-Number-Auth-Items AVP.
| msg | - the Diameter message to add to. | |
| data | - the value for the AVP payload |
Definition at line 254 of file cx_avp.c.
Referenced by Cx_MAR().
00255 { 00256 char x[4]; 00257 set_4bytes(x,data); 00258 return 00259 Cx_add_avp(msg,x,4, 00260 AVP_IMS_SIP_Number_Auth_Items, 00261 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00262 IMS_vendor_id_3GPP, 00263 AVP_DUPLICATE_DATA, 00264 __FUNCTION__); 00265 }
| int Cx_add_sip_auth_data_item_request | ( | AAAMessage * | msg, | |
| str | auth_scheme, | |||
| str | auth, | |||
| str | username, | |||
| str | realm, | |||
| str | method, | |||
| str | server_name | |||
| ) | [inline] |
Creates and adds a SIP-Auth-Data-Item AVP.
| msg | - the Diameter message to add to. | |
| auth_scheme | - the value for the authorization scheme AVP | |
| auth | - the value for the authorization AVP |
Definition at line 276 of file cx_avp.c.
Referenced by Cx_MAR().
00277 { 00278 AAA_AVP_LIST list; 00279 str group; 00280 str etsi_authorization = {0, 0}; 00281 list.head=0;list.tail=0; 00282 00283 if (auth_scheme.len){ 00284 Cx_add_avp_list(&list, 00285 auth_scheme.s,auth_scheme.len, 00286 AVP_IMS_SIP_Authentication_Scheme, 00287 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00288 IMS_vendor_id_3GPP, 00289 AVP_DONT_FREE_DATA, 00290 __FUNCTION__); 00291 } 00292 if (auth.len){ 00293 Cx_add_avp_list(&list, 00294 auth.s,auth.len, 00295 AVP_IMS_SIP_Authorization, 00296 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00297 IMS_vendor_id_3GPP, 00298 AVP_DONT_FREE_DATA, 00299 __FUNCTION__); 00300 } 00301 00302 if (server_name.len) 00303 { 00304 etsi_authorization = Cx_ETSI_sip_authorization(username, realm, s_empty, server_name, s_empty, s_empty, method, s_empty); 00305 00306 if (etsi_authorization.len){ 00307 Cx_add_avp_list(&list, 00308 etsi_authorization.s,etsi_authorization.len, 00309 AVP_ETSI_SIP_Authorization, 00310 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00311 IMS_vendor_id_ETSI, 00312 AVP_FREE_DATA, 00313 __FUNCTION__); 00314 } 00315 } 00316 00317 if (!list.head) return 1; 00318 group = cdpb.AAAGroupAVPS(list); 00319 00320 cdpb.AAAFreeAVPList(&list); 00321 00322 return 00323 Cx_add_avp(msg,group.s,group.len, 00324 AVP_IMS_SIP_Auth_Data_Item, 00325 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00326 IMS_vendor_id_3GPP, 00327 AVP_FREE_DATA, 00328 __FUNCTION__); 00329 }
| str Cx_ETSI_sip_authorization | ( | str | username, | |
| str | realm, | |||
| str | nonce, | |||
| str | URI, | |||
| str | response, | |||
| str | algorithm, | |||
| str | method, | |||
| str | hash | |||
| ) |
Creates and adds a ETSI_sip_authorization AVP.
| username | - UserName | |
| realm | - Realm | |
| nonce | - Nonce | |
| URI | - URI | |
| response | - Response | |
| algoritm | - Algorithm | |
| method | - Method | |
| hash | - Enitity-Body-Hash |
Definition at line 343 of file cx_avp.c.
Referenced by Cx_add_sip_auth_data_item_request().
00344 { 00345 AAA_AVP_LIST list; 00346 str group = {0, 0}; 00347 list.head=0;list.tail=0; 00348 00349 if (username.len){ 00350 Cx_add_avp_list(&list, 00351 username.s,username.len, 00352 AVP_ETSI_Digest_Username, 00353 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00354 IMS_vendor_id_ETSI, 00355 AVP_DONT_FREE_DATA, 00356 __FUNCTION__); 00357 } 00358 00359 if (realm.len){ 00360 Cx_add_avp_list(&list, 00361 realm.s,realm.len, 00362 AVP_ETSI_Digest_Realm, 00363 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00364 IMS_vendor_id_ETSI, 00365 AVP_DONT_FREE_DATA, 00366 __FUNCTION__); 00367 } 00368 00369 if (nonce.len){ 00370 Cx_add_avp_list(&list, 00371 nonce.s,nonce.len, 00372 AVP_ETSI_Digest_Nonce, 00373 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00374 IMS_vendor_id_ETSI, 00375 AVP_DONT_FREE_DATA, 00376 __FUNCTION__); 00377 } 00378 00379 if (URI.len){ 00380 Cx_add_avp_list(&list, 00381 URI.s,URI.len, 00382 AVP_ETSI_Digest_URI, 00383 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00384 IMS_vendor_id_ETSI, 00385 AVP_DONT_FREE_DATA, 00386 __FUNCTION__); 00387 } 00388 00389 if (response.len){ 00390 Cx_add_avp_list(&list, 00391 response.s,response.len, 00392 AVP_ETSI_Digest_Response, 00393 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00394 IMS_vendor_id_ETSI, 00395 AVP_DONT_FREE_DATA, 00396 __FUNCTION__); 00397 } 00398 00399 if (algorithm.len){ 00400 Cx_add_avp_list(&list, 00401 algorithm.s,algorithm.len, 00402 AVP_ETSI_Digest_Algorithm, 00403 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00404 IMS_vendor_id_ETSI, 00405 AVP_DONT_FREE_DATA, 00406 __FUNCTION__); 00407 } 00408 00409 if (method.len){ 00410 Cx_add_avp_list(&list, 00411 method.s,method.len, 00412 AVP_ETSI_Digest_Method, 00413 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00414 IMS_vendor_id_ETSI, 00415 AVP_DONT_FREE_DATA, 00416 __FUNCTION__); 00417 } 00418 00419 if (hash.len){ 00420 Cx_add_avp_list(&list, 00421 hash.s,hash.len, 00422 AVP_ETSI_Digest_Entity_Body_Hash, 00423 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00424 IMS_vendor_id_ETSI, 00425 AVP_DONT_FREE_DATA, 00426 __FUNCTION__); 00427 } 00428 00429 if (!list.head) return group; 00430 group = cdpb.AAAGroupAVPS(list); 00431 00432 cdpb.AAAFreeAVPList(&list); 00433 00434 return group; 00435 }
| int Cx_add_server_assignment_type | ( | AAAMessage * | msg, | |
| unsigned int | data | |||
| ) | [inline] |
Creates and adds a Server-Assignment-Type AVP.
| msg | - the Diameter message to add to. | |
| data | - the value for the AVP payload |
Definition at line 443 of file cx_avp.c.
Referenced by Cx_SAR().
00444 { 00445 char x[4]; 00446 set_4bytes(x,data); 00447 return 00448 Cx_add_avp(msg,x,4, 00449 AVP_IMS_Server_Assignment_Type, 00450 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00451 IMS_vendor_id_3GPP, 00452 AVP_DUPLICATE_DATA, 00453 __FUNCTION__); 00454 }
| int Cx_add_userdata_available | ( | AAAMessage * | msg, | |
| unsigned int | data | |||
| ) | [inline] |
Creates and adds Userdata-Available AVP.
| msg | - the Diameter message to add to. | |
| data | - the value for the AVP payload |
Definition at line 462 of file cx_avp.c.
Referenced by Cx_SAR().
00463 { 00464 char x[4]; 00465 set_4bytes(x,data); 00466 return 00467 Cx_add_avp(msg,x,4, 00468 AVP_IMS_User_Data_Already_Available, 00469 AAA_AVP_FLAG_MANDATORY|AAA_AVP_FLAG_VENDOR_SPECIFIC, 00470 IMS_vendor_id_3GPP, 00471 AVP_DUPLICATE_DATA, 00472 __FUNCTION__); 00473 }
| int Cx_add_result_code | ( | AAAMessage * | msg, | |
| unsigned int | data | |||
| ) | [inline] |
Creates and adds a Result-Code AVP.
| msg | - the Diameter message to add to. | |
| data | - the value for the AVP payload |
Definition at line 481 of file cx_avp.c.
Referenced by Cx_PPA(), and Cx_RTA().
00482 { 00483 char x[4]; 00484 set_4bytes(x,data); 00485 return 00486 Cx_add_avp(msg,x,4, 00487 AVP_Result_Code, 00488 AAA_AVP_FLAG_MANDATORY, 00489 0, 00490 AVP_DUPLICATE_DATA, 00491 __FUNCTION__); 00492 }
| int Cx_add_experimental_result_code | ( | AAAMessage * | msg, | |
| unsigned int | data | |||
| ) | [inline] |
Creates and adds a Experimental-Result-Code AVP.
| msg | - the Diameter message to add to. | |
| data | - the value for the AVP payload |
Definition at line 500 of file cx_avp.c.
00501 { 00502 AAA_AVP_LIST list; 00503 str group; 00504 char x[4]; 00505 list.head=0;list.tail=0; 00506 00507 set_4bytes(x,data); 00508 Cx_add_avp_list(&list, 00509 x,4, 00510 AVP_IMS_Experimental_Result_Code, 00511 AAA_AVP_FLAG_MANDATORY, 00512 0, 00513 AVP_DUPLICATE_DATA, 00514 __FUNCTION__); 00515 00516 set_4bytes(x,IMS_vendor_id_3GPP); 00517 Cx_add_avp_list(&list, 00518 x,4, 00519 AVP_IMS_Vendor_Id, 00520 AAA_AVP_FLAG_MANDATORY, 00521 0, 00522 AVP_DUPLICATE_DATA, 00523 __FUNCTION__); 00524 00525 00526 group = cdpb.AAAGroupAVPS(list); 00527 00528 cdpb.AAAFreeAVPList(&list); 00529 00530 return 00531 Cx_add_avp(msg,group.s,group.len, 00532 AVP_IMS_Experimental_Result, 00533 AAA_AVP_FLAG_MANDATORY, 00534 0, 00535 AVP_FREE_DATA, 00536 __FUNCTION__); 00537 }
| int Cx_add_vendor_specific_appid | ( | AAAMessage * | msg, | |
| unsigned int | vendor_id, | |||
| unsigned int | auth_id, | |||
| unsigned int | acct_id | |||
| ) | [inline] |
Creates and adds a Vendor-Specifig-Application-ID AVP.
| msg | - the Diameter message to add to. | |
| vendor_id | - the value of the vendor_id, | |
| auth_id | - the authorization application id | |
| acct_id | - the accounting application id |
Definition at line 547 of file cx_avp.c.
Referenced by Cx_LIR(), Cx_MAR(), Cx_PPA(), Cx_RTA(), Cx_SAR(), and Cx_UAR().
00549 { 00550 AAA_AVP_LIST list; 00551 str group; 00552 char x[4]; 00553 00554 list.head=0;list.tail=0; 00555 00556 set_4bytes(x,vendor_id); 00557 Cx_add_avp_list(&list, 00558 x,4, 00559 AVP_Vendor_Id, 00560 AAA_AVP_FLAG_MANDATORY, 00561 0, 00562 AVP_DUPLICATE_DATA, 00563 __FUNCTION__); 00564 00565 if (auth_id) { 00566 set_4bytes(x,auth_id); 00567 Cx_add_avp_list(&list, 00568 x,4, 00569 AVP_Auth_Application_Id, 00570 AAA_AVP_FLAG_MANDATORY, 00571 0, 00572 AVP_DUPLICATE_DATA, 00573 __FUNCTION__); 00574 } 00575 if (acct_id) { 00576 set_4bytes(x,acct_id); 00577 Cx_add_avp_list(&list, 00578 x,4, 00579 AVP_Acct_Application_Id, 00580 AAA_AVP_FLAG_MANDATORY, 00581 0, 00582 AVP_DUPLICATE_DATA, 00583 __FUNCTION__); 00584 } 00585 00586 group = cdpb.AAAGroupAVPS(list); 00587 00588 cdpb.AAAFreeAVPList(&list); 00589 00590 return 00591 Cx_add_avp(msg,group.s,group.len, 00592 AVP_Vendor_Specific_Application_Id, 00593 AAA_AVP_FLAG_MANDATORY, 00594 0, 00595 AVP_FREE_DATA, 00596 __FUNCTION__); 00597 }
| int Cx_add_auth_session_state | ( | AAAMessage * | msg, | |
| unsigned int | data | |||
| ) | [inline] |
Creates and adds a Auth-Session-State AVP.
| msg | - the Diameter message to add to. | |
| data | - the value for the AVP payload |
Definition at line 606 of file cx_avp.c.
Referenced by Cx_LIR(), Cx_MAR(), Cx_PPA(), Cx_RTA(), Cx_SAR(), and Cx_UAR().
00607 { 00608 char x[4]; 00609 set_4bytes(x,data); 00610 return 00611 Cx_add_avp(msg,x,4, 00612 AVP_Auth_Session_State, 00613 AAA_AVP_FLAG_MANDATORY, 00614 0, 00615 AVP_DUPLICATE_DATA, 00616 __FUNCTION__); 00617 }
| int Cx_add_destination_realm | ( | AAAMessage * | msg, | |
| str | data | |||
| ) | [inline] |
Creates and adds a Destination-Realm AVP.
| msg | - the Diameter message to add to. | |
| data | - the value for the AVP payload |
Definition at line 625 of file cx_avp.c.
Referenced by Cx_LIR(), Cx_MAR(), Cx_SAR(), and Cx_UAR().
00626 { 00627 return 00628 Cx_add_avp(msg,data.s,data.len, 00629 AVP_Destination_Realm, 00630 AAA_AVP_FLAG_MANDATORY, 00631 0, 00632 AVP_DUPLICATE_DATA, 00633 __FUNCTION__); 00634 }
| str Cx_get_session_id | ( | AAAMessage * | msg | ) | [inline] |
Returns the Session-Id AVP of a Diameter message.
| msg | - the Diameter message |
Definition at line 642 of file cx_avp.c.
00643 { 00644 return Cx_get_avp(msg, 00645 AVP_Session_Id, 00646 0, 00647 __FUNCTION__); 00648 }
| str Cx_get_user_name | ( | AAAMessage * | msg | ) | [inline] |
Returns the User-Name AVP from a Diameter message.
| msg | - the Diameter message |
Definition at line 656 of file cx_avp.c.
Referenced by Cx_RTA().
00657 { 00658 return Cx_get_avp(msg, 00659 AVP_User_Name, 00660 0, 00661 __FUNCTION__); 00662 }
| str Cx_get_public_identity | ( | AAAMessage * | msg | ) | [inline] |
Returns the Public-Identity AVP from a Diameter message.
| msg | - the Diameter message |
Definition at line 669 of file cx_avp.c.
00670 { 00671 return Cx_get_avp(msg, 00672 AVP_IMS_Public_Identity, 00673 IMS_vendor_id_3GPP, 00674 __FUNCTION__); 00675 }
| AAA_AVP* Cx_get_next_public_identity | ( | AAAMessage * | msg, | |
| AAA_AVP * | pos, | |||
| int | avp_code, | |||
| int | vendor_id, | |||
| const char * | func | |||
| ) | [inline] |
Finds out the next Public-Identity AVP from a Diameter message.
| msg | - the Diameter message | |
| pos | - position to resume search or NULL if to start from the first AVP | |
| avp_code | - the code of the AVP to look for | |
| vendor_id | - the vendor id of the AVP to look for | |
| func | - the name of the calling function for debugging purposes |
Definition at line 686 of file cx_avp.c.
Referenced by Cx_RTA().
00687 { 00688 AAA_AVP *avp; 00689 00690 avp = cdpb.AAAFindMatchingAVP(msg,pos,avp_code,vendor_id,0); 00691 if (avp==0){ 00692 LOG(L_INFO,"INFO:"M_NAME":%s: Failed finding avp\n",func); 00693 return avp; 00694 } 00695 else 00696 return avp; 00697 }
| str Cx_get_visited_network_id | ( | AAAMessage * | ms |