rr/api.h

Go to the documentation of this file.
00001 /*
00002  * $Id: api.h 5575 2009-02-10 10:13:29Z henningw $
00003  *
00004  * Copyright (C) 2005 Voice Sistem SRL
00005  *
00006  * This file is part of Kamailio, a free SIP server.
00007  *
00008  * Kamailio is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License
00010  * as published by the Free Software Foundation; either version 2
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Kamailio is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021  */
00022 
00023 /*!
00024  * \file
00025  * \brief Kamailio RR module (record-routing) API
00026  *
00027  * Kamailio RR module (record-routing) API.
00028  * The RR module provides an internal API to be used by other
00029  * Kamailio modules. The API offers support for SIP dialog based
00030  * functionalities.
00031 
00032  * For internal(non-script) usage, the RR module offers to other
00033  * module the possibility to register callback functions to be
00034  * executed each time a local Route header is processed. The
00035  * callback function will receive as parameter the register
00036  * parameter and the Route header parameter string.
00037  * \ingroup rr
00038  */
00039 
00040 
00041 #ifndef RR_API_H_
00042 #define RR_API_H_
00043 
00044 #include "../../str.h"
00045 #include "../../sr_module.h"
00046 #include "loose.h"
00047 #include "rr_cb.h"
00048 
00049 typedef  int (*add_rr_param_t)(struct sip_msg*, str*);
00050 typedef  int (*check_route_param_t)(struct sip_msg*, regex_t*);
00051 typedef  int (*is_direction_t)(struct sip_msg*, int);
00052 typedef  int (*get_route_param_t)(struct sip_msg*, str*, str*);
00053 
00054 
00055 /*! record-route API export binding */
00056 struct rr_binds {
00057    add_rr_param_t    add_rr_param;
00058    check_route_param_t  check_route_param;
00059    is_direction_t       is_direction;
00060    get_route_param_t    get_route_param;
00061    register_rrcb_t         register_rrcb;
00062    int               append_fromtag;
00063 };
00064 
00065 typedef  int (*load_rr_f)( struct rr_binds* );
00066 
00067 /*!
00068 * \brief API bind function exported by the module - it will load the other functions
00069  * \param rr_binds record-route API export binding
00070  * \return 1
00071  */
00072 int load_rr( struct rr_binds * );
00073 
00074 
00075 /*!
00076  * \brief Function to be called directly from other modules to load the RR API
00077  * \param rrb record-route API export binding
00078  * \return 0 on success, -1 if the API loader could not imported
00079  */
00080 inline static int load_rr_api( struct rr_binds *rrb )
00081 {
00082    load_rr_f load_rr_v;
00083 
00084    /* import the RR auto-loading function */
00085    if ( !(load_rr_v=(load_rr_f)find_export("load_rr", 0, 0))) {
00086       LM_ERR("failed to import load_rr\n");
00087       return -1;
00088    }
00089    /* let the auto-loading function load all RR stuff */
00090    load_rr_v( rrb );
00091 
00092    return 0;
00093 }
00094 
00095 
00096 #endif

Generated on Thu May 24 12:00:23 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6