api_process.c File Reference


Detailed Description

CDiameterPeer API processor.

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

Definition in file api_process.c.

#include "api_process.h"
#include "transaction.h"
#include "receiver.h"

Go to the source code of this file.

Functions

int api_callback (peer *p, AAAMessage *msg, void *ptr)
 This callback is added as an internal message listener and used to process transaction requests.

Variables

handler_listhandlers = 0
 list of handlers
gen_lock_t * handlers_lock
 lock for list of handlers


Function Documentation

int api_callback ( peer p,
AAAMessage msg,
void *  ptr 
)

This callback is added as an internal message listener and used to process transaction requests.

Definition at line 73 of file api_process.c.

References _cdp_trans_t::ans, _cdp_trans_t::auto_drop, _cdp_trans_t::cb, free_trans(), handler_t::handler, handlers, handlers_lock, handler_list_t::head, is_req, handler_t::next, handler_t::param, peer_send_msg(), _cdp_trans_t::ptr, REQUEST_HANDLER, handler_t::requestHandler, RESPONSE_HANDLER, handler_t::responseHandler, take_trans(), and handler_t::type.

Referenced by diameter_peer_init().

00074 {
00075     cdp_trans_t *t;
00076     int auto_drop;  
00077     handler *h;
00078     enum handler_types type;
00079     AAAMessage *rsp;
00080     if (is_req(msg)) type = REQUEST_HANDLER;
00081     else type=RESPONSE_HANDLER;
00082 
00083     lock_get(handlers_lock);
00084         for(h=handlers->head;h;h=h->next){
00085             if (h->type==type){
00086                 if (h->type == REQUEST_HANDLER) {                   
00087                     rsp = (h->handler.requestHandler)(msg,h->param);
00088                     if (rsp) peer_send_msg(p,rsp);
00089                 }
00090                 else (h->handler.responseHandler)(msg,h->param);
00091             }
00092         }       
00093     lock_release(handlers_lock);
00094     
00095     if (!is_req(msg)){      
00096         /* take care of transactional callback if any */
00097         t = take_trans(msg);
00098         if (t){
00099             t->ans = msg;
00100             auto_drop = t->auto_drop;
00101             if (t->cb){
00102                 (t->cb)(0,*(t->ptr),msg);
00103             }
00104             if (auto_drop) free_trans(t);
00105         }
00106     }
00107     return 1;
00108 }


Variable Documentation

handler_list* handlers = 0

list of handlers

Definition at line 60 of file api_process.c.

Referenced by AAAAddRequestHandler(), AAAAddResponseHandler(), api_callback(), diameter_peer_destroy(), and diameter_peer_init().

gen_lock_t* handlers_lock

lock for list of handlers

Definition at line 61 of file api_process.c.

Referenced by AAAAddRequestHandler(), AAAAddResponseHandler(), api_callback(), diameter_peer_destroy(), and diameter_peer_init().


Generated on Tue Jul 29 04:19:13 2008 for Open IMS Core CSCFs by  doxygen 1.5.2