Răsfoiți Sursa

modules_k/nathelper: remove rtpproxy functionality from nathelper

Ovidiu Sas 15 ani în urmă
părinte
comite
48e555e0a6

Fișier diff suprimat deoarece este prea mare
+ 34 - 1778
modules_k/nathelper/nathelper.c


+ 0 - 35
modules_k/nathelper/nathelper.h

@@ -33,39 +33,4 @@
 #define STR2IOVEC(sx, ix)       do {(ix).iov_base = (sx).s; (ix).iov_len = (sx).len;} while(0)
 #define STR2IOVEC(sx, ix)       do {(ix).iov_base = (sx).s; (ix).iov_len = (sx).len;} while(0)
 #define SZ2IOVEC(sx, ix)        do {(ix).iov_base = (sx); (ix).iov_len = strlen(sx);} while(0)
 #define SZ2IOVEC(sx, ix)        do {(ix).iov_base = (sx); (ix).iov_len = strlen(sx);} while(0)
 
 
-struct rtpp_node {
-	unsigned int		idx;			/* overall index */
-	str					rn_url;			/* unparsed, deletable */
-	int					rn_umode;
-	char				*rn_address;	/* substring of rn_url */
-	int					rn_disabled;	/* found unaccessible? */
-	unsigned			rn_weight;		/* for load balancing */
-	unsigned int		rn_recheck_ticks;
-        int                     rn_rep_supported;
-        int                     rn_ptl_supported;
-	struct rtpp_node	*rn_next;
-};
-
-
-struct rtpp_set{
-	unsigned int 		id_set;
-	unsigned			weight_sum;
-	unsigned int		rtpp_node_count;
-	int 				set_disabled;
-	unsigned int		set_recheck_ticks;
-	struct rtpp_node	*rn_first;
-	struct rtpp_node	*rn_last;
-	struct rtpp_set     *rset_next;
-};
-
-
-struct rtpp_set_head{
-	struct rtpp_set		*rset_first;
-	struct rtpp_set		*rset_last;
-};
-
-/* Functions from nathelper */
-struct rtpp_node *select_rtpp_node(str, int);
-char *send_rtpp_command(struct rtpp_node *, struct iovec *, int);
-
 #endif
 #endif

+ 0 - 75
modules_k/nathelper/nhelpr_funcs.c

@@ -161,7 +161,6 @@ other:
 	return -1;
 	return -1;
 }
 }
 
 
-
 /*
 /*
  * Get message body and check Content-Type header field
  * Get message body and check Content-Type header field
  */
  */
@@ -319,80 +318,6 @@ ser_memmem(const void *b1, const void *b2, size_t len1, size_t len2)
  * Some helper functions taken verbatim from tm module.
  * Some helper functions taken verbatim from tm module.
  */
  */
 
 
-/*
- * Extract Call-ID value
- * assumes the callid header is already parsed
- * (so make sure it is, before calling this function or
- *  it might fail even if the message _has_ a callid)
- */
-int
-get_callid(struct sip_msg* _m, str* _cid)
-{
-
-        if ((parse_headers(_m, HDR_CALLID_F, 0) == -1)) {
-                LM_ERR("failed to parse call-id header\n");
-                return -1;
-        }
-
-        if (_m->callid == NULL) {
-                LM_ERR("call-id not found\n");
-                return -1;
-        }
-
-        _cid->s = _m->callid->body.s;
-        _cid->len = _m->callid->body.len;
-        trim(_cid);
-        return 0;
-}
-
-/*
- * Extract tag from To header field of a response
- * assumes the to header is already parsed, so
- * make sure it really is before calling this function
- */
-int
-get_to_tag(struct sip_msg* _m, str* _tag)
-{
-
-        if (!_m->to) {
-                LM_ERR("To header field missing\n");
-                return -1;
-        }
-
-        if (get_to(_m)->tag_value.len) {
-                _tag->s = get_to(_m)->tag_value.s;
-                _tag->len = get_to(_m)->tag_value.len;
-        } else {
-                _tag->s = NULL; /* fixes gcc 4.0 warnings */
-                _tag->len = 0;
-        }
-
-        return 0;
-}
-
-/*
- * Extract tag from From header field of a request
- */
-int
-get_from_tag(struct sip_msg* _m, str* _tag)
-{
-
-        if (parse_from_header(_m)<0) {
-                LM_ERR("failed to parse From header\n");
-                return -1;
-        }
-
-        if (get_from(_m)->tag_value.len) {
-                _tag->s = get_from(_m)->tag_value.s;
-                _tag->len = get_from(_m)->tag_value.len;
-        } else {
-                _tag->s = NULL; /* fixes gcc 4.0 warnings */
-                _tag->len = 0;
-        }
-
-        return 0;
-}
-
 /*
 /*
  * Extract URI from the Contact header field
  * Extract URI from the Contact header field
  */
  */

+ 0 - 3
modules_k/nathelper/nhelpr_funcs.h

@@ -31,9 +31,6 @@
 int extract_body(struct sip_msg * , str *);
 int extract_body(struct sip_msg * , str *);
 int check_content_type(struct sip_msg * );
 int check_content_type(struct sip_msg * );
 void *ser_memmem(const void *, const void *, size_t, size_t);
 void *ser_memmem(const void *, const void *, size_t, size_t);
-int get_callid(struct sip_msg *, str *);
-int get_to_tag(struct sip_msg *, str *);
-int get_from_tag(struct sip_msg *, str *);
 int get_contact_uri(struct sip_msg *, struct sip_uri *, contact_t **);
 int get_contact_uri(struct sip_msg *, struct sip_uri *, contact_t **);
 
 
 #endif
 #endif

+ 0 - 234
modules_k/nathelper/rtpproxy_stream.c

@@ -1,234 +0,0 @@
-/* $Id: rtpproxy_stream.c,v 1.2 2008/11/04 22:28:04 sobomax Exp $
- *
- * Copyright (C) 2008 Sippy Software, Inc., http://www.sippysoft.com
- *
- * This file is part of ser, a free SIP server.
- *
- * ser is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version
- *
- * For a license to use the ser software under conditions
- * other than those described here, or to purchase support for this
- * software, please contact iptel.org by e-mail at the following addresses:
- *    [email protected]
- *
- * ser is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- */
-
-#include <stdio.h>
-#include <sys/uio.h>
-
-#include "../../ip_addr.h"
-#include "../../parser/msg_parser.h"
-#include "../../sr_module.h"
-#include "../../ut.h"
-#include "nathelper.h"
-#include "nhelpr_funcs.h"
-
-int
-fixup_var_str_int(void **param, int param_no)
-{
-    int ret;
-    pv_elem_t *model;
-    str s;
-
-    if (param_no == 1) {
-        model = NULL;
-        s.s = (char *)(*param);
-        s.len = strlen(s.s);
-        if (pv_parse_format(&s, &model) < 0) {
-            LM_ERR("wrong format[%s]!\n", (char *)(*param));
-            return E_UNSPEC;
-        }
-        if (model == NULL) {
-            LM_ERR("empty parameter!\n");
-            return E_UNSPEC;
-        }
-        *param = (void *)model;
-    } else if (param_no == 2) {
-	/* According to
-	 * http://www.kamailio.org/docs/modules/1.5.x/nathelper.html#rtpproxy_stream2xxx
-	 * this could be -1 */
-	s.s = (char *)(*param);
-	s.len = strlen(s.s);
-	if (str2sint(&s, &ret)==0) {
-		pkg_free(*param);
-		*param = (void *)ret;
-        } else {
-            LM_ERR("bad number <%s>\n", (char *)(*param));
-            return E_CFG;
-        }
-    }
-    return 0;
-}
-
-static int
-rtpproxy_stream(struct sip_msg* msg, str *pname, int count, int stream2uac)
-{
-    int nitems;
-    str callid, from_tag, to_tag;
-    struct rtpp_node *node;
-    char cbuf[16];
-    struct iovec v[] = {
-        {NULL,        0},
-        {cbuf,        0}, /* 1 P<count> */
-        {" ",         1},
-        {NULL,        0}, /* 3 callid */
-        {" ",         1},
-        {NULL,        0}, /* 5 pname */
-        {" session ", 9},
-        {NULL,        0}, /* 7 from tag */
-        {";1 ",       3},
-        {NULL,        0}, /* 9 to tag */
-        {";1",        2}
-    };
-
-    if (get_callid(msg, &callid) == -1 || callid.len == 0) {
-        LM_ERR("can't get Call-Id field\n");
-        return -1;
-    }
-    if (get_to_tag(msg, &to_tag) == -1) {
-        LM_ERR("can't get To tag\n");
-        return -1;
-    }
-    if (get_from_tag(msg, &from_tag) == -1 || from_tag.len == 0) {
-        LM_ERR("can't get From tag\n");
-        return -1;
-    }
-    v[1].iov_len = sprintf(cbuf, "P%d", count);
-    STR2IOVEC(callid, v[3]);
-    STR2IOVEC(*pname, v[5]);
-    node = select_rtpp_node(callid, 1);
-    if (!node) {
-        LM_ERR("no available proxies\n");
-        return -1;
-    }
-    if (node->rn_ptl_supported == 0) {
-        LM_ERR("required functionality is not "
-          "supported by the version of the RTPproxy running on the selected "
-          "node.  Please upgrade the RTPproxy and try again.\n");
-        return -1;
-    }
-    nitems = 11;
-    if (stream2uac == 0) {
-        if (to_tag.len == 0)
-            return -1;
-        STR2IOVEC(to_tag, v[7]);
-        STR2IOVEC(from_tag, v[9]);
-    } else {
-        STR2IOVEC(from_tag, v[7]);
-        STR2IOVEC(to_tag, v[9]);
-        if (to_tag.len <= 0)
-            nitems -= 2;
-    }
-    send_rtpp_command(node, v, nitems);
-
-    return 1;
-}
-
-static int
-rtpproxy_stream2_f(struct sip_msg *msg, char *str1, int count, int stream2uac)
-{
-    str pname;
-
-    if (str1 == NULL || pv_printf_s(msg, (pv_elem_p)str1, &pname) != 0)
-	return -1;
-    return rtpproxy_stream(msg, &pname, count, stream2uac);
-}
-
-int
-rtpproxy_stream2uac2_f(struct sip_msg* msg, char* str1, char* str2)
-{
-
-    return rtpproxy_stream2_f(msg, str1, (int)(long)str2, 1);
-}
-
-int
-rtpproxy_stream2uas2_f(struct sip_msg* msg, char* str1, char* str2)
-{
-
-    return rtpproxy_stream2_f(msg, str1, (int)(long)str2, 0);
-}
-
-static int
-rtpproxy_stop_stream(struct sip_msg* msg, int stream2uac)
-{
-    int nitems;
-    str callid, from_tag, to_tag;
-    struct rtpp_node *node;
-    struct iovec v[] = {
-        {NULL,        0},
-        {"S",         1}, /* 1 */
-        {" ",         1},
-        {NULL,        0}, /* 3 callid */
-        {" ",         1},
-        {NULL,        0}, /* 5 from tag */
-        {";1 ",       3},
-        {NULL,        0}, /* 7 to tag */
-        {";1",        2}
-    };
-
-    if (get_callid(msg, &callid) == -1 || callid.len == 0) {
-        LM_ERR("can't get Call-Id field\n");
-        return -1;
-    }
-    if (get_to_tag(msg, &to_tag) == -1) {
-        LM_ERR("can't get To tag\n");
-        return -1;
-    }
-    if (get_from_tag(msg, &from_tag) == -1 || from_tag.len == 0) {
-        LM_ERR("can't get From tag\n");
-        return -1;
-    }
-    STR2IOVEC(callid, v[3]);
-    node = select_rtpp_node(callid, 1);
-    if (!node) {
-        LM_ERR("no available proxies\n");
-        return -1;
-    }
-    if (node->rn_ptl_supported == 0) {
-        LM_ERR("required functionality is not "
-          "supported by the version of the RTPproxy running on the selected "
-          "node.  Please upgrade the RTPproxy and try again.\n");
-        return -1;
-    }
-    nitems = 9;
-    if (stream2uac == 0) {
-        if (to_tag.len == 0)
-            return -1;
-        STR2IOVEC(to_tag, v[5]);
-        STR2IOVEC(from_tag, v[7]);
-    } else {
-        STR2IOVEC(from_tag, v[5]);
-        STR2IOVEC(to_tag, v[7]);
-        if (to_tag.len <= 0)
-            nitems -= 2;
-    }
-    send_rtpp_command(node, v, nitems);
-
-    return 1;
-}
-
-int
-rtpproxy_stop_stream2uac2_f(struct sip_msg* msg, char* str1, char* str2)
-{
-
-    return rtpproxy_stop_stream(msg, 1);
-}
-
-int
-rtpproxy_stop_stream2uas2_f(struct sip_msg* msg, char* str1, char* str2)
-{
-
-    return rtpproxy_stop_stream(msg, 0);
-}

+ 0 - 37
modules_k/nathelper/rtpproxy_stream.h

@@ -1,37 +0,0 @@
-/* $Id: rtpproxy_stream.h,v 1.1 2008/11/04 21:10:07 sobomax Exp $
- *
- * Copyright (C) 2008 Sippy Software, Inc., http://www.sippysoft.com
- *
- * This file is part of ser, a free SIP server.
- *
- * ser is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version
- *
- * For a license to use the ser software under conditions
- * other than those described here, or to purchase support for this
- * software, please contact iptel.org by e-mail at the following addresses:
- *    [email protected]
- *
- * ser is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- */
-
-#ifndef _RTPPROXY_STREAM_H
-#define  _RTPPROXY_STREAM_H
-
-int fixup_var_str_int(void **, int);
-int rtpproxy_stream2uac2_f(struct sip_msg *, char *, char *);
-int rtpproxy_stream2uas2_f(struct sip_msg *, char *, char *);
-int rtpproxy_stop_stream2uac2_f(struct sip_msg *, char *, char *);
-int rtpproxy_stop_stream2uas2_f(struct sip_msg *, char *, char *);
-
-#endif

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff