k/rr/api.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
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 
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 typedef  int (*record_route_f)(struct sip_msg*, str*);
00054 typedef  int (*loose_route_f)(struct sip_msg*);
00055 
00057 typedef struct rr_binds {
00058         record_route_f       record_route;
00059         record_route_f       record_route_preset;
00060         record_route_f       record_route_advertised_address;
00061         loose_route_f        loose_route;
00062         add_rr_param_t       add_rr_param;
00063         check_route_param_t  check_route_param;
00064         is_direction_t       is_direction;
00065         get_route_param_t    get_route_param;
00066         register_rrcb_t      register_rrcb;
00067         int                  append_fromtag;
00068 } rr_api_t;
00069 
00070 typedef  int (*load_rr_f)( struct rr_binds* );
00071 
00077 int load_rr( struct rr_binds *rrb );
00078 
00079 
00085 inline static int load_rr_api( struct rr_binds *rrb )
00086 {
00087         load_rr_f load_rr_v;
00088 
00089         /* import the RR auto-loading function */
00090         if ( !(load_rr_v=(load_rr_f)find_export("load_rr", 0, 0))) {
00091                 LM_ERR("failed to import load_rr\n");
00092                 return -1;
00093         }
00094         /* let the auto-loading function load all RR stuff */
00095         load_rr_v( rrb );
00096 
00097         return 0;
00098 }
00099 
00103 inline static int rr_load_api( rr_api_t *rrb )
00104 {
00105         return load_rr_api(rrb);
00106 }
00107 
00108 #endif