00001 /* 00002 * $Id: loose.h 5575 2009-02-10 10:13:29Z henningw $ 00003 * 00004 * Copyright (C) 2001-2003 FhG Fokus 00005 * 00006 * This file is part of Kamailio, a free SIP server. 00007 * 00008 * Kamailio is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (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 Route & Record-Route module, loose routing support 00026 * \ingroup rr 00027 */ 00028 00029 00030 #ifndef LOOSE_H 00031 #define LOOSE_H 00032 00033 00034 #include <regex.h> 00035 #include "../../str.h" 00036 #include "../../parser/msg_parser.h" 00037 00038 #define RR_FLOW_DOWNSTREAM (1<<0) 00039 #define RR_FLOW_UPSTREAM (1<<1) 00040 00041 00042 /*! 00043 * \brief Do loose routing as per RFC3261 00044 * \param _m SIP message 00045 * \param _s1 unused 00046 * \param _s2 unused 00047 * \return -1 on failure, 1 on success 00048 */ 00049 int loose_route(struct sip_msg* _m, char* _s1, char* _s2); 00050 00051 00052 /*! 00053 * \brief Check if the route hdr has the required parameter 00054 * 00055 * The function checks for the request "msg" if the URI parameters 00056 * of the local Route header (corresponding to the local server) 00057 * matches the given regular expression "re". It must be call 00058 * after the loose_route was done. 00059 * 00060 * \param msg SIP message request that will has the Route header parameters checked 00061 * \param re compiled regular expression to be checked against the Route header parameters 00062 * \return -1 on failure, 1 on success 00063 */ 00064 int check_route_param(struct sip_msg *msg, regex_t* re); 00065 00066 00067 /*! 00068 * \brief Check the direction of the message 00069 * 00070 * The function checks the flow direction of the request "msg". As 00071 * for checking it's used the "ftag" Route header parameter, the 00072 * append_fromtag module parameter must be enables. 00073 * Also this must be call only after the loose_route is done. 00074 00075 * \param msg SIP message request that will have the direction checked 00076 * \param dir direction to be checked against. It may be RR_FLOW_UPSTREAM or RR_FLOW_DOWNSTREAM 00077 * \return 0 if the request flow direction is the same as the given direction, -1 otherwise 00078 */ 00079 int is_direction(struct sip_msg *msg, int dir); 00080 00081 00082 /*! 00083 * \brief Gets the value of a route parameter 00084 * 00085 * The function search in to the "msg"'s Route header parameters 00086 * the parameter called "name" and returns its value into "val". 00087 * It must be call only after the loose_route is done. 00088 * 00089 * \param msg - request that will have the Route header parameter searched 00090 * \param name - contains the Route header parameter to be serached 00091 * \param val returns the value of the searched Route header parameter if found. 00092 * It might be an empty string if the parameter had no value. 00093 * \return 0 if parameter was found (even if it has no value), -1 otherwise 00094 */ 00095 int get_route_param( struct sip_msg *msg, str *name, str *val); 00096 00097 00098 #endif /* LOOSE_H */
1.5.6