cx_avp.h File Reference


Detailed Description

I/S-CSCF Module - Cx AVP Operations.

Author:
Dragos Vingarzan vingarzan -at- fokus dot fraunhofer dot de
Copyright (C) 2005 FhG Fokus

Definition in file cx_avp.h.

#include "../../sr_module.h"
#include "mod.h"
#include "../cdp/cdp_load.h"

Go to the source code of this file.

Functions

int Cx_add_user_name (AAAMessage *uar, str private_identity)
 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_AVPCx_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.


Function Documentation

int Cx_add_user_name ( AAAMessage msg,
str  data 
) [inline]

NO DATA WILL BE DUPLICATED OR FREED - DO THAT AFTER SENDING THE MESSAGE!!!

Parameters:
msg - the Diameter message to add to.
data - the value for the AVP payload
Returns:
1 on success or 0 on error

Definition at line 166 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, AVP_DUPLICATE_DATA, AVP_User_Name, and Cx_add_avp().

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.

Parameters:
msg - the Diameter message to add to.
data - the value for the AVP payload
Returns:
1 on success or 0 on error

Definition at line 183 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, AAA_AVP_FLAG_VENDOR_SPECIFIC, AVP_DUPLICATE_DATA, AVP_IMS_Public_Identity, Cx_add_avp(), and IMS_vendor_id_3GPP.

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.

Parameters:
msg - the Diameter message to add to.
data - the value for the AVP payload
Returns:
1 on success or 0 on error

Definition at line 200 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, AAA_AVP_FLAG_VENDOR_SPECIFIC, AVP_DUPLICATE_DATA, AVP_IMS_Visited_Network_Identifier, Cx_add_avp(), and IMS_vendor_id_3GPP.

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.

Parameters:
msg - the Diameter message to add to.
data - the value for the AVP payload
Returns:
1 on success or 0 on error

Definition at line 217 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, AAA_AVP_FLAG_VENDOR_SPECIFIC, AVP_DUPLICATE_DATA, AVP_IMS_User_Authorization_Type, Cx_add_avp(), IMS_vendor_id_3GPP, and set_4bytes.

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.

Parameters:
msg - the Diameter message to add to.
data - the value for the AVP payload
Returns:
1 on success or 0 on error

Definition at line 237 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, AAA_AVP_FLAG_VENDOR_SPECIFIC, AVP_DUPLICATE_DATA, AVP_IMS_Server_Name, Cx_add_avp(), and IMS_vendor_id_3GPP.

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.

Parameters:
msg - the Diameter message to add to.
data - the value for the AVP payload
Returns:
1 on success or 0 on error

Definition at line 254 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, AAA_AVP_FLAG_VENDOR_SPECIFIC, AVP_DUPLICATE_DATA, AVP_IMS_SIP_Number_Auth_Items, Cx_add_avp(), IMS_vendor_id_3GPP, and set_4bytes.

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.

Parameters:
msg - the Diameter message to add to.
auth_scheme - the value for the authorization scheme AVP
auth - the value for the authorization AVP
Returns:
1 on success or 0 on error

Definition at line 276 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, AAA_AVP_FLAG_VENDOR_SPECIFIC, cdp_binds::AAAFreeAVPList, cdp_binds::AAAGroupAVPS, AVP_DONT_FREE_DATA, AVP_ETSI_SIP_Authorization, AVP_FREE_DATA, AVP_IMS_SIP_Auth_Data_Item, AVP_IMS_SIP_Authentication_Scheme, AVP_IMS_SIP_Authorization, cdpb, Cx_add_avp(), Cx_add_avp_list(), Cx_ETSI_sip_authorization(), _avp_list_t::head, IMS_vendor_id_3GPP, IMS_vendor_id_ETSI, s_empty, and _avp_list_t::tail.

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.

Parameters:
username - UserName
realm - Realm
nonce - Nonce
URI - URI
response - Response
algoritm - Algorithm
method - Method
hash - Enitity-Body-Hash
Returns:
grouped str on success

Definition at line 343 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, AAA_AVP_FLAG_VENDOR_SPECIFIC, cdp_binds::AAAFreeAVPList, cdp_binds::AAAGroupAVPS, AVP_DONT_FREE_DATA, AVP_ETSI_Digest_Algorithm, AVP_ETSI_Digest_Entity_Body_Hash, AVP_ETSI_Digest_Method, AVP_ETSI_Digest_Nonce, AVP_ETSI_Digest_Realm, AVP_ETSI_Digest_Response, AVP_ETSI_Digest_URI, AVP_ETSI_Digest_Username, cdpb, Cx_add_avp_list(), _avp_list_t::head, IMS_vendor_id_ETSI, and _avp_list_t::tail.

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.

Parameters:
msg - the Diameter message to add to.
data - the value for the AVP payload
Returns:
1 on success or 0 on error

Definition at line 443 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, AAA_AVP_FLAG_VENDOR_SPECIFIC, AVP_DUPLICATE_DATA, AVP_IMS_Server_Assignment_Type, Cx_add_avp(), IMS_vendor_id_3GPP, and set_4bytes.

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.

Parameters:
msg - the Diameter message to add to.
data - the value for the AVP payload
Returns:
1 on success or 0 on error

Definition at line 462 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, AAA_AVP_FLAG_VENDOR_SPECIFIC, AVP_DUPLICATE_DATA, AVP_IMS_User_Data_Already_Available, Cx_add_avp(), IMS_vendor_id_3GPP, and set_4bytes.

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.

Parameters:
msg - the Diameter message to add to.
data - the value for the AVP payload
Returns:
1 on success or 0 on error

Definition at line 481 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, AVP_DUPLICATE_DATA, AVP_Result_Code, Cx_add_avp(), and set_4bytes.

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.

Parameters:
msg - the Diameter message to add to.
data - the value for the AVP payload
Returns:
1 on success or 0 on error

Definition at line 500 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, cdp_binds::AAAFreeAVPList, cdp_binds::AAAGroupAVPS, AVP_DUPLICATE_DATA, AVP_FREE_DATA, AVP_IMS_Experimental_Result, AVP_IMS_Experimental_Result_Code, AVP_IMS_Vendor_Id, cdpb, Cx_add_avp(), Cx_add_avp_list(), _avp_list_t::head, IMS_vendor_id_3GPP, set_4bytes, and _avp_list_t::tail.

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.

Parameters:
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
Returns:
1 on success or 0 on error

Definition at line 547 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, cdp_binds::AAAFreeAVPList, cdp_binds::AAAGroupAVPS, AVP_Acct_Application_Id, AVP_Auth_Application_Id, AVP_DUPLICATE_DATA, AVP_FREE_DATA, AVP_Vendor_Id, AVP_Vendor_Specific_Application_Id, cdpb, Cx_add_avp(), Cx_add_avp_list(), _avp_list_t::head, set_4bytes, and _avp_list_t::tail.

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.

Parameters:
msg - the Diameter message to add to.
data - the value for the AVP payload
Returns:
1 on success or 0 on error

Definition at line 606 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, AVP_Auth_Session_State, AVP_DUPLICATE_DATA, Cx_add_avp(), and set_4bytes.

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.

Parameters:
msg - the Diameter message to add to.
data - the value for the AVP payload
Returns:
1 on success or 0 on error

Definition at line 625 of file cx_avp.c.

References AAA_AVP_FLAG_MANDATORY, AVP_Destination_Realm, AVP_DUPLICATE_DATA, and Cx_add_avp().

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.

Parameters:
msg - the Diameter message
Returns:
AVP payload on success or an empty string on error

Definition at line 642 of file cx_avp.c.

References AVP_Session_Id, and Cx_get_avp().

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.

Parameters:
msg - the Diameter message
Returns:
the AVP payload on success or an empty string on error

Definition at line 656 of file cx_avp.c.

References AVP_User_Name, and Cx_get_avp().

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.

Parameters:
msg - the Diameter message
Returns:
the AVP payload on success or an empty string on error

Definition at line 669 of file cx_avp.c.

References AVP_IMS_Public_Identity, Cx_get_avp(), and IMS_vendor_id_3GPP.

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.

Parameters:
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
Returns:
the AVP payload on success or an empty string on error

Definition at line 686 of file cx_avp.c.

References cdp_binds::AAAFindMatchingAVP, cdpb, and M_NAME.

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 msg  )  [inline]

Returns the Visited-Network-ID AVP from a Diameter message.

Parameters:
msg - the Diameter message
Returns:
the AVP payload on success or an empty string on error

Definition at line 704 of file cx_avp.c.

References AVP_IMS_Visited_Network_Identifier, Cx_get_avp(), and IMS_vendor_id_3GPP.

00705 {
00706     return Cx_get_avp(msg,
00707         AVP_IMS_Visited_Network_Identifier,
00708         IMS_vendor_id_3GPP,
00709         __FUNCTION__);
00710 }

int Cx_get_authorization_type ( AAAMessage msg,
int *  data 
) [inline]

Returns the Authorization-Type AVP from a Diameter message.

Parameters:
msg - the Diameter message
Returns:
the AVP payload on success or an empty string on error

Definition at line 717 of file cx_avp.c.

References AVP_IMS_User_Authorization_Type, Cx_get_avp(), get_4bytes, and IMS_vendor_id_3GPP.

00718 {
00719     str s;
00720     s = Cx_get_avp(msg,
00721         AVP_IMS_User_Authorization_Type,
00722         IMS_vendor_id_3GPP,
00723         __FUNCTION__);
00724     if (!s.s) return 0;
00725     *data = get_4bytes(s.s);
00726     return 1;
00727 }

int Cx_get_server_assignment_type ( AAAMessage msg,
int *  data 
) [inline]

Returns the Server-Assignment-Type AVP from a Diameter message.

Parameters:
msg - the Diameter message
Returns:
the AVP payload on success or an empty string on error

Definition at line 734 of file cx_avp.c.

References AVP_IMS_Server_Assignment_Type, Cx_get_avp(), get_4bytes, and IMS_vendor_id_3GPP.

00735 {
00736     str s;
00737     s = Cx_get_avp(msg,
00738         AVP_IMS_Server_Assignment_Type,
00739         IMS_vendor_id_3GPP,
00740         __FUNCTION__);
00741     if (!s.s) return 0;
00742     *data = get_4bytes(s.s);
00743     return 1;
00744 }

int Cx_get_userdata_available ( AAAMessage msg,
int *  data 
) [inline]

Returns the User-Data-Available AVP from a Diameter message.

Parameters:
msg - the Diameter message
Returns:
the AVP payload on success or an empty string on error

Definition at line 751 of file cx_avp.c.

References AVP_IMS_User_Data_Already_Available, Cx_get_avp(), get_4bytes, and IMS_vendor_id_3GPP.

00752 {
00753     str s;
00754     s = Cx_get_avp(msg,
00755         AVP_IMS_User_Data_Already_Available,
00756         IMS_vendor_id_3GPP,
00757         __FUNCTION__);
00758     if (!s.s) return 0;
00759     *data = get_4bytes(s.s);
00760     return 1;
00761 }

int Cx_get_result_code ( AAAMessage msg,
int *  data 
) [inline]

Returns the Result-Code AVP from a Diameter message.

Parameters:
msg - the Diameter message
Returns:
the AVP payload on success or an empty string on error

Definition at line 769 of file cx_avp.c.

References AVP_Result_Code, Cx_get_avp(), and get_4bytes.

00770 {
00771     str s;
00772     s = Cx_get_avp(msg,
00773         AVP_Result_Code,
00774         0,
00775         __FUNCTION__);
00776     if (!s.s) return 0;
00777     *data = get_4bytes(s.s);
00778     return 1;
00779 }

int Cx_get_experimental_result_code ( AAAMessage msg,
int *  data 
) [inline]

Returns the Experimental-Result-Code AVP from a Diameter message.

Parameters:
msg - the Diameter message
Returns:
the AVP payload on success or an empty string on error

Definition at line 786 of file cx_avp.c.

References cdp_binds::AAAFindMatchingAVPList, cdp_binds::AAAFreeAVPList, cdp_binds::AAAUngroupAVPS, AVP_IMS_Experimental_Result, AVP_IMS_Experimental_Result_Code, cdpb,