e2.c File Reference


Detailed Description

Serving-CSCF - e2 Operations.

Author:
Dragos Vingarzan vingarzan -at- fokus dot fraunhofer dot de

Definition in file e2.c.

#include "e2.h"
#include "../tm/tm_load.h"
#include "e2_avp.h"
#include "sip.h"
#include "registrar_storage.h"
#include "registration.h"

Go to the source code of this file.

Functions

int e2AnswerHandler (AAAMessage *response, AAATransaction *t)
 Handler for incoming Diameter answers.
int e2FailureHandler (AAATransaction *t, int reason)
 Handler for incoming Diameter failures This is not used as all diameter failures are handled transactionaly.
AAAMessagee2RequestHandler (AAAMessage *request, void *param)
 Handler for incoming Diameter requests.
AAAMessagee2_UDR (struct sip_msg *msg, str ip, str address_realm, str private_identity, str server_name, str dest_realm)
 Create and send a User-Data-Request and returns the Answer received for it.

Variables

tm_binds tmb
 Structure with pointers to tm funcs.
cdp_binds cdpb
 Structure with pointers to cdp funcs.
int pcscf_use_e2
 if to enable usage of e2 or not
str forced_clf_peer_str
 FQDN of the Diameter Peer (HSS).
int r_hash_size
 records tables parameters
r_hash_slotregistrar
 the contacts


Function Documentation

int e2AnswerHandler ( AAAMessage response,
AAATransaction t 
)

Handler for incoming Diameter answers.

This is not used as all diameter answers are handled transactionaly

Parameters:
response - received response
t - transaction
Returns:
1

Definition at line 81 of file e2.c.

References _message_t::commandCode, and M_NAME.

00082 {
00083     switch(response->commandCode){
00084         default:
00085             LOG(L_ERR,"ERR:"M_NAME":e2AnswerHandler: Unkown Command Code %d\n", response->commandCode);
00086     }
00087     return 1;
00088 }

int e2FailureHandler ( AAATransaction t,
int  reason 
)

Handler for incoming Diameter failures This is not used as all diameter failures are handled transactionaly.

Parameters:
t - transaction
reason - failure reason
Returns:
1

Definition at line 97 of file e2.c.

References _AAATransaction::command_code, _AAATransaction::hash, _AAATransaction::label, and M_NAME.

00098 {
00099     LOG(L_INFO,"INF:"M_NAME":AAAFailureHandler:  SIP transaction %u %u Reason %d\n",
00100         t->hash,t->label,reason);
00101     switch(t->command_code){
00102         default:
00103         LOG(L_ERR,"ERR:"M_NAME":e2FailureHandler: Unkown Command Code %d\n",
00104             t->command_code);
00105     }
00106     return 0;
00107 }

AAAMessage* e2RequestHandler ( AAAMessage request,
void *  param 
)

Handler for incoming Diameter requests.

Parameters:
request - the received request
param - generic pointer
Returns:
the answer to this request

Definition at line 115 of file e2.c.

References _message_t::applicationId, _message_t::commandCode, IMS_e2, is_req, and M_NAME.

00116 {
00117     if (is_req(request)){       
00118         LOG(L_INFO,"INFO:"M_NAME":e2RequestHandler(): We have received a request\n");
00119         switch(request->applicationId){
00120             case IMS_e2:
00121                 switch(request->commandCode){               
00122                     default :
00123                         LOG(L_ERR,"ERR:"M_NAME":e2RequestHandler(): - Received unknown request for e2 command %d\n",request->commandCode);
00124                         break;  
00125                 }
00126                 break;
00127             default:
00128                 LOG(L_ERR,"ERR:"M_NAME":e2RequestHandler(): - Received unknown request for app %d command %d\n",
00129                     request->applicationId,
00130                     request->commandCode);
00131                 break;              
00132         }                   
00133     }
00134     return 0;       
00135 }

AAAMessage* e2_UDR ( struct sip_msg *  msg,
str  ip,
str  address_realm,
str  private_identity,
str  server_name,
str  dest_realm 
)

Create and send a User-Data-Request and returns the Answer received for it.

Parameters:
msg - the SIP message to send for
ip - ip address of the UE
address_realm - Realm of the user
private_identity - user private identity
server_name - pcscf name
dest_realm - pcscf realm
Returns:
the MAA

Definition at line 151 of file e2.c.

References cdp_binds::AAACreateRequest, cdp_binds::AAACreateSession, cdp_binds::AAACreateTransaction, cdp_binds::AAADropSession, cdp_binds::AAADropTransaction, cdp_binds::AAAFreeMessage, cdp_binds::AAASendRecvMessage, cdp_binds::AAASendRecvMessageToPeer, _AAATransaction::application_id, _message_t::applicationId, cdpb, _AAATransaction::command_code, _message_t::commandCode, e2_add_app_identifier(), e2_add_auth_session_state(), e2_add_destination_realm(), e2_add_g_unique_address(), e2_add_user_name(), e2_add_vendor_specific_appid(), Flag_Proxyable, forced_clf_peer_str, _AAATransaction::hash, IMS_e2, IMS_UDR, IMS_vendor_id_3GPP, _AAATransaction::label, M_NAME, pcscf_use_e2, and tmb.

Referenced by P_access_network_info().

00152 {
00153     
00154     if (!pcscf_use_e2)
00155         return 0;
00156     
00157     AAAMessage *udr=0,*uda=0;
00158     AAASessionId sessId={0,0};
00159     AAATransaction *trans=0;
00160     unsigned int hash=0,label=0;    
00161     
00162     sessId = cdpb.AAACreateSession();
00163     trans=cdpb.AAACreateTransaction(IMS_e2,IMS_UDR);
00164 
00165     udr = cdpb.AAACreateRequest(IMS_e2,IMS_UDR,Flag_Proxyable,&sessId);
00166     if (!udr) goto error;
00167 
00168     if (!e2_add_destination_realm(udr,dest_realm)) goto error;
00169         
00170     if (!e2_add_vendor_specific_appid(udr,IMS_vendor_id_3GPP,IMS_e2,0 )) goto error;
00171     if (!e2_add_auth_session_state(udr,1)) goto error;          
00172     
00173     if (!e2_add_user_name(udr,private_identity)) goto error;
00174     //if (!e2_add_server_name(udr,server_name)) goto error;
00175     
00176     if (!e2_add_g_unique_address(udr,ip, address_realm)) goto error;
00177     
00178     if (!e2_add_app_identifier(udr, server_name)) goto error;
00179         
00180     if (tmb.t_get_trans_ident(msg,&hash,&label)<0){ 
00181         LOG(L_ERR,"INF:"M_NAME":e2_udr: SIP message without transaction... very strange\n");
00182         return 0;
00183     }
00184 
00185     trans->hash=hash;
00186     trans->label=label;
00187     trans->application_id=udr->applicationId;
00188     trans->command_code=udr->commandCode;
00189     
00190     if (forced_clf_peer_str.len)
00191         uda = cdpb.AAASendRecvMessageToPeer(udr,&forced_clf_peer_str);
00192     else
00193         uda = cdpb.AAASendRecvMessage(udr);
00194     
00195     cdpb.AAADropSession(&sessId);
00196     cdpb.AAADropTransaction(trans);
00197     
00198     return uda;
00199     
00200     
00201 error:
00202     //free stuff
00203     if (trans) cdpb.AAADropTransaction(trans);
00204     if (sessId.s) cdpb.AAADropSession(&sessId);
00205     if (udr) cdpb.AAAFreeMessage(&udr);
00206     return 0;   
00207 }


Variable Documentation

struct tm_binds tmb

Structure with pointers to tm funcs.

Definition at line 257 of file mod.c.

struct cdp_binds cdpb

Structure with pointers to cdp funcs.

Definition at line 258 of file mod.c.

int pcscf_use_e2

if to enable usage of e2 or not

Definition at line 160 of file mod.c.

Referenced by e2_UDR(), mod_init(), and P_access_network_info().

str forced_clf_peer_str

FQDN of the Diameter Peer (HSS).

Definition at line 168 of file mod.c.

Referenced by e2_UDR(), and fix_parameters().

int r_hash_size

records tables parameters

Definition at line 73 of file registrar_storage.c.

r_hash_slot* registrar

the contacts

Definition at line 72 of file registrar_storage.c.

Referenced by add_r_contact(), add_r_public(), add_r_public_previous_lock(), bin_cache_dump_registrar_to_table(), bin_cache_load_registrar_from_table(), del_r_contact(), del_r_public(), get_matching_wildcard_psi(), get_r_contact(), get_r_public(), get_r_public_nolock(), get_r_public_previous_lock(), get_r_public_wpsi(), load_snapshot_registrar(), make_snapshot_registrar(), mod_init(), print_r(), r_lock(), r_private_expire(), r_storage_destroy(), r_storage_init(), r_unlock(), registrar_timer(), and update_r_public().


Generated on Thu Oct 23 04:14:44 2008 for Open IMS Core CSCFs by  doxygen 1.5.2