Преглед изворни кода

sl(k): module was removed

- from now on use modules/sl
Daniel-Constantin Mierla пре 15 година
родитељ
комит
4883cf0c8d

+ 0 - 17
modules_k/sl/Makefile

@@ -1,17 +0,0 @@
-# $Id$
-#
-# example module makefile
-#
-# 
-# WARNING: do not run this directly, it should be run by the master Makefile
-
-include ../../Makefile.defs
-auto_gen=
-NAME=sl.so
-LIBS= 
-
-DEFS+=-DOPENSER_MOD_INTERFACE
-
-SERLIBPATH=../../lib
-SER_LIBS+=$(SERLIBPATH)/kcore/kcore
-include ../../Makefile.modules

+ 0 - 272
modules_k/sl/README

@@ -1,272 +0,0 @@
-sl Module
-
-Bogdan Iancu
-
-   voice-system.ro
-
-Edited by
-
-Bogdan Iancu
-
-   Copyright © 2003 FhG FOKUS
-   Revision History
-   Revision $Revision$ $Date$
-     __________________________________________________________________
-
-   Table of Contents
-
-   1. Admin Guide
-
-        1. Overview
-        2. Dependencies
-
-              2.1. Kamailio Modules
-              2.2. External Libraries or Applications
-
-        3. Exported Parameters
-
-              3.1. enable_stats (integer)
-              3.2. bind_tm (integer)
-
-        4. Exported Functions
-
-              4.1. sl_send_reply(code, reason)
-              4.2. send_reply(code, reason)
-              4.3. sl_reply_error()
-
-        5. Exported Statistics
-
-              5.1. 1xx_replies
-              5.2. 2xx_replies
-              5.3. 3xx_replies
-              5.4. 4xx_replies
-              5.5. 5xx_replies
-              5.6. 6xx_replies
-              5.7. sent_replies
-              5.8. sent_err_replies
-              5.9. received_ACKs
-
-   List of Examples
-
-   1.1. enable_stats example
-   1.2. bind_tm example
-   1.3. sl_send_reply usage
-   1.4. send_reply usage
-   1.5. sl_reply_error usage
-
-Chapter 1. Admin Guide
-
-   Table of Contents
-
-   1. Overview
-   2. Dependencies
-
-        2.1. Kamailio Modules
-        2.2. External Libraries or Applications
-
-   3. Exported Parameters
-
-        3.1. enable_stats (integer)
-        3.2. bind_tm (integer)
-
-   4. Exported Functions
-
-        4.1. sl_send_reply(code, reason)
-        4.2. send_reply(code, reason)
-        4.3. sl_reply_error()
-
-   5. Exported Statistics
-
-        5.1. 1xx_replies
-        5.2. 2xx_replies
-        5.3. 3xx_replies
-        5.4. 4xx_replies
-        5.5. 5xx_replies
-        5.6. 6xx_replies
-        5.7. sent_replies
-        5.8. sent_err_replies
-        5.9. received_ACKs
-
-1. Overview
-
-   The SL module allows Kamailio to act as a stateless UA server and
-   generate replies to SIP requests without keeping state. That is
-   beneficial in many scenarios, in which you wish not to burden server's
-   memory and scale well.
-
-   The SL module needs to filter ACKs sent after a local stateless reply
-   to an INVITE was generated. To recognize such ACKs, Kamailio adds a
-   special "signature" in to-tags. This signature is sought for in
-   incoming ACKs, and if included, the ACKs are absorbed.
-
-   To speed up the filtering process, the module uses a timeout mechanism.
-   When a reply is sent, a timer is set. As time as the timeout didn't
-   hit, the incoming ACK requests will be checked using TO tag value. Once
-   the timer expires, all the ACK are let through - a long time passed
-   till it sent a reply, so it does not expect any ACK that have to be
-   blocked.
-
-   The ACK filtering may fail in some rare cases. If you think these
-   matter to you, better use stateful processing (tm module) for INVITE
-   processing. Particularly, the problem happens when a UA sends an INVITE
-   which already has a to-tag in it (e.g., a re-INVITE) and Kamailio want
-   to reply to it. Than, it will keep the current to-tag, which will be
-   mirrored in ACK. Kamailio will not see its signature and forward the
-   ACK downstream. Caused harm is not bad--just a useless ACK is
-   forwarded.
-
-2. Dependencies
-
-   2.1. Kamailio Modules
-   2.2. External Libraries or Applications
-
-2.1. Kamailio Modules
-
-   The following modules must be loaded before this module:
-     * TM - transaction module, if you want to use the transactional
-       send_reply functionality.
-
-2.2. External Libraries or Applications
-
-   The following libraries or applications must be installed before
-   running Kamailio with this module loaded:
-     * None.
-
-3. Exported Parameters
-
-   3.1. enable_stats (integer)
-   3.2. bind_tm (integer)
-
-3.1. enable_stats (integer)
-
-   If the module should generate and export statistics to the core
-   manager. A zero value means disabled.
-
-   SL module provides statistics about how many replies were sent (
-   splitted per code classes) and how many local ACKs were filtered out.
-
-   Default value is 1 (enabled).
-
-   Example 1.1. enable_stats example
-modparam("sl", "enable_stats", 0)
-
-3.2. bind_tm (integer)
-
-   If the module should use transaction support for sending the replies. A
-   zero value means disabled.
-
-   Module tm should be loaded before of this one
-
-   Default value is 1 (enabled).
-
-   Example 1.2. bind_tm example
-modparam("sl", "bind_tm", 0)
-
-4. Exported Functions
-
-   4.1. sl_send_reply(code, reason)
-   4.2. send_reply(code, reason)
-   4.3. sl_reply_error()
-
-4.1.  sl_send_reply(code, reason)
-
-   For the current request, a reply is sent back having the given code and
-   text reason. The reply is sent stateless, totally independent of the
-   Transaction module and with no retransmission for the INVITE's replies.
-   'code' and 'reason' can contain pseudo-variables that are replaced at
-   runtime.
-
-   Meaning of the parameters is as follows:
-     * code - Return code.
-     * reason - Reason phrase.
-
-   This function can be used from REQUEST_ROUTE, ERROR_ROUTE.
-
-   Example 1.3. sl_send_reply usage
-...
-sl_send_reply("404", "Not found");
-...
-sl_send_reply("$err.rcode", "$err.rreason");
-...
-
-4.2.  send_reply(code, reason)
-
-   For the current request, a reply is sent back having the given code and
-   text reason. The reply is sent stateful or stateless, depending of the
-   Transaction module: if the transaction for current request has created,
-   then the reply is sent stateful, otherwise stateless.
-
-   Meaning of the parameters is as follows:
-     * code - Return code.
-     * reason - Reason phrase.
-
-   This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
-   BRANCH_ROUTE, ERROR_ROUTE.
-
-   Example 1.4. send_reply usage
-...
-send_reply("404", "Not found");
-...
-send_reply("403", "Invalid user - $fU");
-...
-
-4.3.  sl_reply_error()
-
-   Sends back an error reply describing the nature of the last internal
-   error. Usually this function should be used after a script function
-   that returned an error code.
-
-   This function can be used from REQUEST_ROUTE.
-
-   Example 1.5. sl_reply_error usage
-...
-sl_reply_error();
-...
-
-5. Exported Statistics
-
-   5.1. 1xx_replies
-   5.2. 2xx_replies
-   5.3. 3xx_replies
-   5.4. 4xx_replies
-   5.5. 5xx_replies
-   5.6. 6xx_replies
-   5.7. sent_replies
-   5.8. sent_err_replies
-   5.9. received_ACKs
-
-5.1. 1xx_replies
-
-   The number of 1xx_replies.
-
-5.2. 2xx_replies
-
-   The number of 2xx_replies.
-
-5.3. 3xx_replies
-
-   The number of 3xx_replies.
-
-5.4. 4xx_replies
-
-   The number of 4xx_replies.
-
-5.5. 5xx_replies
-
-   The number of 5xx_replies.
-
-5.6. 6xx_replies
-
-   The number of 6xx_replies.
-
-5.7. sent_replies
-
-   The number of sent_replies.
-
-5.8. sent_err_replies
-
-   The number of sent_err_replies.
-
-5.9. received_ACKs
-
-   The number of received_ACKs.

+ 0 - 4
modules_k/sl/doc/Makefile

@@ -1,4 +0,0 @@
-docs = sl.xml
-
-docbook_dir = ../../../docbook
-include $(docbook_dir)/Makefile.module

+ 0 - 48
modules_k/sl/doc/sl.xml

@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding='ISO-8859-1'?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
-"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
-
-<!-- Include general documentation entities -->
-<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
-%docentities;
-
-]>
-
-<book xmlns:xi="http://www.w3.org/2001/XInclude">
-    <bookinfo>
-	<title>sl Module</title>
-	<productname class="trade">&kamailioname;</productname>
-	<authorgroup>
-	    <author>
-		<firstname>Bogdan</firstname>
-		<surname>Iancu</surname>
-		<affiliation><orgname>&voicesystem;</orgname></affiliation>
-		<address>
-		    <email>[email protected]</email>
-		</address>
-	    </author>
-	    <editor>
-		<firstname>Bogdan</firstname>
-		<surname>Iancu</surname>
-		<address>
-		    <email>[email protected]</email>
-		</address>
-	    </editor>
-	</authorgroup>
-	<copyright>
-	    <year>2003</year>
-	    <holder>&fhg;</holder>
-	</copyright>
-	<revhistory>
-	    <revision>
-		<revnumber>$Revision$</revnumber>
-		<date>$Date$</date>
-	    </revision>
-	</revhistory>
-    </bookinfo>
-    <toc></toc>
-    
-    <xi:include href="sl_admin.xml"/>
-    
-    
-</book>

+ 0 - 281
modules_k/sl/doc/sl_admin.xml

@@ -1,281 +0,0 @@
-<?xml version="1.0" encoding='ISO-8859-1'?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
-"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
-
-<!-- Include general documentation entities -->
-<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
-%docentities;
-
-]>
-<!-- Module User's Guide -->
-
-<chapter>
-	
-	<title>&adminguide;</title>
-	
-	<section>
-	<title>Overview</title>
-	<para>
-		The <acronym>SL</acronym> module allows &kamailio; to act as a stateless 
-		&ua; server and generate replies to &sip; requests without keeping 
-		state. That is beneficial in many scenarios, in which you wish not to 
-		burden server's memory and scale well.
-	</para>
-	<para>
-		The <acronym>SL</acronym> module needs to filter ACKs sent after a 
-		local stateless reply to an INVITE was generated. To recognize such 
-		ACKs, &kamailio; adds a special "signature" in to-tags. This signature is 
-		sought for in incoming ACKs, and if included, the ACKs are absorbed.
-	</para>
-	<para>
-		To speed up the filtering process, the module uses a timeout 
-		mechanism. When a reply is sent, a timer is set. As time as the timeout 
-		didn't hit, the incoming ACK requests will be checked using TO tag 
-		value. Once the timer expires, all the ACK are let through - a long
-		time passed till it sent a reply, so it does not expect any ACK that 
-		have to be blocked.
-	</para>
-	<para>
-		The ACK filtering may fail in some rare cases. If you think these 
-		matter to you, better use stateful processing (tm module) for INVITE 
-		processing. Particularly, the problem happens when a UA sends an 
-		INVITE which already has a to-tag in it (e.g., a re-INVITE)
-		and &kamailio; want to reply to it. Than, it will keep the current to-tag, 
-		which will be mirrored in ACK. &kamailio; will not see its signature and 
-		forward the ACK downstream. Caused harm is not bad--just a useless 
-		ACK is forwarded.
-	</para>
-	</section>
-	<section>
-	<title>Dependencies</title>
-	<section>
-		<title>&kamailio; Modules</title>
-		<para>
-		The following modules must be loaded before this module:
-			<itemizedlist>
-			<listitem>
-			<para>
-				<emphasis>TM - transaction module</emphasis>, if you want
-				to use the transactional send_reply functionality.
-			</para>
-			</listitem>
-			</itemizedlist>
-		</para>
-	</section>
-	<section>
-		<title>External Libraries or Applications</title>
-		<para>
-		The following libraries or applications must be installed before running
-		&kamailio; with this module loaded:
-			<itemizedlist>
-			<listitem>
-			<para>
-				<emphasis>None</emphasis>.
-			</para>
-			</listitem>
-			</itemizedlist>
-		</para>
-	</section>
-	</section>
-
-	<section>
-	<title>Exported Parameters</title>
-	<section>
-		<title><varname>enable_stats</varname> (integer)</title>
-		<para>
-		If the module should generate and export statistics to the core
-		manager. A zero value means disabled.
-		</para>
-		<para>
-		SL module provides statistics about how many replies were sent (
-		splitted per code classes) and how many local ACKs were filtered out.
-		</para>
-		<para>
-		Default value is 1 (enabled).
-		</para>
-		<example>
-		<title>enable_stats example</title>
-		<programlisting format="linespecific">
-modparam("sl", "enable_stats", 0)
-</programlisting>
-		</example>
-	</section>
-	<section>
-               <title><varname>bind_tm</varname> (integer)</title>
-               <para>
-               If the module should use transaction support for sending the
-               replies. A zero value means disabled.
-               </para>
-               <para>
-               Module tm should be loaded before of this one
-               </para>
-               <para>
-               Default value is 1 (enabled).
-               </para>
-               <example>
-               <title>bind_tm example</title>
-               <programlisting format="linespecific">
-modparam("sl", "bind_tm", 0)
-</programlisting>
-               </example>
-       </section>
-	</section>
-
-	<section>
-	<title>Exported Functions</title>
-	<section>
-		<title>
-		<function moreinfo="none">sl_send_reply(code, reason)</function>
-		</title>
-		<para>
-		For the current request, a reply is sent back having the given code 
-		and text reason. The reply is sent stateless, totally independent of 
-		the Transaction module and with no retransmission for the INVITE's 
-		replies. 'code' and 'reason' can contain pseudo-variables that are
-		replaced at runtime.
-		</para>
-		<para>Meaning of the parameters is as follows:</para>
-		<itemizedlist>
-		<listitem>
-			<para><emphasis>code</emphasis> - Return code.
-			</para>
-		</listitem>
-		<listitem>
-			<para><emphasis>reason</emphasis> - Reason phrase.
-			</para>
-		</listitem>
-		</itemizedlist>
-		<para>
-		This function can be used from REQUEST_ROUTE, ERROR_ROUTE.
-		</para>
-		<example>
-		<title><function>sl_send_reply</function> usage</title>
-		<programlisting format="linespecific">
-...
-sl_send_reply("404", "Not found");
-...
-sl_send_reply("$err.rcode", "$err.rreason");
-...
-</programlisting>
-		</example>
-	</section>
-
-	<section>
-		<title>
-		<function moreinfo="none">send_reply(code, reason)</function>
-		</title>
-		<para>
-		For the current request, a reply is sent back having the given code 
-		and text reason. The reply is sent stateful or stateless, depending of 
-		the Transaction module: if the transaction for current request has
-		created, then the reply is sent stateful, otherwise stateless.
-		</para>
-		<para>Meaning of the parameters is as follows:</para>
-		<itemizedlist>
-		<listitem>
-			<para><emphasis>code</emphasis> - Return code.
-			</para>
-		</listitem>
-		<listitem>
-			<para><emphasis>reason</emphasis> - Reason phrase.
-			</para>
-		</listitem>
-		</itemizedlist>
-		<para>
-			This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
-			BRANCH_ROUTE, ERROR_ROUTE.
-		</para>
-		<example>
-		<title><function>send_reply</function> usage</title>
-		<programlisting format="linespecific">
-...
-send_reply("404", "Not found");
-...
-send_reply("403", "Invalid user - $fU");
-...
-</programlisting>
-		</example>
-	</section>
-
-	<section>
-		<title>
-		<function moreinfo="none">sl_reply_error()</function>
-		</title>
-		<para>
-		Sends back an error reply describing the nature of the last internal 
-		error.  Usually this function should be used after a script function 
-		that returned an error code.
-		</para>
-		<para>
-		This function can be used from REQUEST_ROUTE.
-		</para>
-		<example>
-		<title><function>sl_reply_error</function> usage</title>
-		<programlisting format="linespecific">
-...
-sl_reply_error();
-...
-</programlisting>
-		</example>
-	</section>
-	</section>
-
-	<section>
-	<title>Exported Statistics</title>
-	<section>
-		<title><varname>1xx_replies</varname></title>
-		<para>
-		The number of 1xx_replies.
-		</para>
-	</section>
-	<section>
-		<title><varname>2xx_replies</varname></title>
-		<para>
-		The number of 2xx_replies.
-		</para>
-	</section>
-	<section>
-		<title><varname>3xx_replies</varname></title>
-		<para>
-		The number of 3xx_replies.
-		</para>
-	</section>
-	<section>
-		<title><varname>4xx_replies</varname></title>
-		<para>
-		The number of 4xx_replies.
-		</para>
-	</section>
-	<section>
-		<title><varname>5xx_replies</varname></title>
-		<para>
-		The number of 5xx_replies.
-		</para>
-	</section>
-	<section>
-		<title><varname>6xx_replies</varname></title>
-		<para>
-		The number of 6xx_replies.
-		</para>
-	</section>
-	<section>
-		<title><varname>sent_replies</varname></title>
-		<para>
-		The number of sent_replies.
-		</para>
-	</section>
-	<section>
-		<title><varname>sent_err_replies</varname></title>
-		<para>
-		The number of sent_err_replies.
-		</para>
-	</section>
-	<section>
-		<title><varname>received_ACKs</varname></title>
-		<para>
-		The number of received_ACKs.
-		</para>
-	</section>
-	</section>
-	
-</chapter>

+ 0 - 389
modules_k/sl/sl.c

@@ -1,389 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2001-2003 FhG Fokus
- *
- * This file is part of Kamailio, a free SIP server.
- *
- * Kamailio 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
- *
- * Kamailio 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
- *
- * History:
- * --------
- *  2003-03-11  updated to the new module exports interface (andrei)
- *  2003-03-16  flags export parameter added (janakj)
- *  2003-03-19  all mallocs/frees replaced w/ pkg_malloc/pkg_free
- *  2005-03-01  force for stateless replies the incoming interface of
- *              the request (bogdan)
- *  2006-03-29  callbacks for sending replies added (bogdan)
- */
-
-/*!
- * \file
- * \brief SL :: module definitions
- * \ingroup sl
- * - Module: \ref sl
- */
-
-/*!
- * \defgroup sl SL :: The Kamailio SL Module
- *
- * The SL module allows Kamailio to act as a stateless UA server and
- * generate replies to SIP requests without keeping state. That is beneficial
- * in many scenarios, in which you wish not to burden server's memory and scale
- * well.
- */
-
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "../../sr_module.h"
-#include "../../dprint.h"
-#include "../../error.h"
-#include "../../ut.h"
-#include "../../script_cb.h"
-#include "../../mem/mem.h"
-#include "../../pvar.h"
-
-#include "../../modules/tm/tm_load.h"
-
-#include "sl_funcs.h"
-#include "sl_api.h"
-#include "sl.h"
-#include "sl_cb.h"
-
-MODULE_VERSION
-
-
-static int w_sl_send_reply(struct sip_msg* msg, char* str1, char* str2);
-static int w_send_reply(struct sip_msg* msg, char* str1, char* str2);
-static int w_sl_reply_error(struct sip_msg* msg, char* str1, char* str2);
-static int fixup_sl_send_reply(void** param, int param_no);
-static int mod_init(void);
-static void mod_destroy(void);
-/* module parameter */
-int sl_enable_stats = 1;
-int sl_bind_tm = 1;
-
-/* statistic variables */
-stat_var *tx_1xx_rpls;
-stat_var *tx_2xx_rpls;
-stat_var *tx_3xx_rpls;
-stat_var *tx_4xx_rpls;
-stat_var *tx_5xx_rpls;
-stat_var *tx_6xx_rpls;
-stat_var *sent_rpls;
-stat_var *sent_err_rpls;
-stat_var *rcv_acks;
-
-static struct tm_binds tmb;
-
-static cmd_export_t cmds[]={
-	{"sl_send_reply",   (cmd_function)w_sl_send_reply,
-		2,  fixup_sl_send_reply, 0,
-		REQUEST_ROUTE | ERROR_ROUTE },
-	{"send_reply",   (cmd_function)w_send_reply,
-		2,  fixup_sl_send_reply, 0,
-		REQUEST_ROUTE|BRANCH_ROUTE|FAILURE_ROUTE|ERROR_ROUTE },
-	{"sl_reply_error",  (cmd_function)w_sl_reply_error,
-		0,  0, 0, REQUEST_ROUTE},
-	{"register_slcb",  (cmd_function)register_slcb,
-		0,  0, 0,
-		0},
-	{"load_sl",        (cmd_function)load_sl,
-		0,  0, 0,
-		0},
-	{"api_sl_reply",   (cmd_function)sl_send_reply_sz, 2, 0, 0, 0},
-	{0,0,0,0,0,0}
-};
-
-
-static param_export_t mod_params[]={
-	{ "enable_stats",  INT_PARAM, &sl_enable_stats },
-	{ "bind_tm",       INT_PARAM, &sl_bind_tm },
-	{ 0,0,0 }
-};
-
-
-stat_export_t mod_stats[] = {
-	{"1xx_replies" ,       0,  &tx_1xx_rpls    },
-	{"2xx_replies" ,       0,  &tx_2xx_rpls    },
-	{"3xx_replies" ,       0,  &tx_3xx_rpls    },
-	{"4xx_replies" ,       0,  &tx_4xx_rpls    },
-	{"5xx_replies" ,       0,  &tx_5xx_rpls    },
-	{"6xx_replies" ,       0,  &tx_6xx_rpls    },
-	{"sent_replies" ,      0,  &sent_rpls      },
-	{"sent_err_replies" ,  0,  &sent_err_rpls  },
-	{"received_ACKs" ,     0,  &rcv_acks       },
-	{0,0,0}
-};
-
-
-struct module_exports exports= {
-	"sl",         /* module's name */
-	DEFAULT_DLFLAGS, /* dlopen flags */
-	cmds,         /* exported functions */
-	mod_params,   /* param exports */
-	mod_stats,    /* exported statistics */
-	0,            /* exported MI functions */
-	0,            /* exported pseudo-variables */
-	0,            /* extra processes */
-	mod_init,     /* module initialization function */
-	0,            /* reply processing function */
-	mod_destroy,
-	0             /* per-child init function */
-};
-
-
-static int mod_init(void)
-{
-	/* if statistics are disabled, prevent their registration to core */
-	if (sl_enable_stats==0)
-		exports.stats = 0;
-
-#ifdef STATISTICS
-	/* register statistics */
-	if (sl_enable_stats!=0)
-	{
-		if (register_module_stats( exports.name, mod_stats)!=0 ) {
-			LM_ERR("failed to register core statistics\n");
-			return -1;
-		}
-	}
-#endif
-
-	/* filter all ACKs before script */
-	if (register_script_cb(sl_filter_ACK, PRE_SCRIPT_CB|REQUEST_CB, 0 )!=0) {
-		LM_ERR("register_script_cb failed\n");
-		return -1;
-	}
-
-	/* init internal SL stuff */
-	if (sl_startup()!=0) {
-		LM_ERR("sl_startup failed\n");
-		return -1;
-	}
-
-	if(sl_bind_tm!=0)
-	{
-		if(load_tm_api(&tmb)==-1)
-		{
-			LM_INFO("could not bind tm module - only stateless mode"
-					" available\n");
-			sl_bind_tm=0;
-		}
-	}
-
-	return 0;
-}
-
-
-static void mod_destroy(void)
-{
-	sl_shutdown();
-	destroy_slcb_lists();
-
-}
-
-/*!
- * \brief Fixup function for sl_send_reply
- */
-static int fixup_sl_send_reply(void** param, int param_no)
-{
-	pv_elem_t *model=NULL;
-	str s;
-
-	/* convert to str */
-	s.s = (char*)*param;
-	s.len = strlen(s.s);
-
-	model=NULL;
-	if (param_no==1 || param_no==2)
-	{
-		if(s.len==0)
-		{
-			LM_ERR("no param %d!\n", param_no);
-			return E_UNSPEC;
-		}
-
-		if(pv_parse_format(&s ,&model) || model==NULL)
-		{
-			LM_ERR("wrong format [%s] for param no %d!\n", s.s, param_no);
-			return E_UNSPEC;
-		}
-		if(model->spec.getf==NULL)
-		{
-			if(param_no==1)
-			{
-			   if(str2int(&s,
-					(unsigned int*)&model->spec.pvp.pvn.u.isname.name.n)!=0
-					   || model->spec.pvp.pvn.u.isname.name.n<100
-					   || model->spec.pvp.pvn.u.isname.name.n>699)
-			   {
-					LM_ERR("wrong value [%s] for param no %d!\n",
-						s.s, param_no);
-					LM_ERR("allowed values: 1xx - 6xx only!\n");
-					return E_UNSPEC;
-			   }
-			}
-		}
-		*param = (void*)model;
-	}
-
-	return 0;
-}
-
-
-/*!
- * \brief Small wrapper around sl_send_reply
- */
-static int w_sl_reply_error( struct sip_msg* msg, char* str1, char* str2)
-{
-	return sl_reply_error( msg );
-}
-
-
-/*!
- * \brief Wrapper around sl_send_reply
- *
- * Wrapper around sl_send_reply, evaluate pseudo-variables.
- */
-static int w_sl_send_reply(struct sip_msg* msg, char* str1, char* str2)
-{
-	str code_s;
-	unsigned int code_i;
-
-	if(((pv_elem_p)str1)->spec.getf!=NULL)
-	{
-		if(pv_printf_s(msg, (pv_elem_p)str1, &code_s)!=0)
-			return -1;
-		if(str2int(&code_s, &code_i)!=0 || code_i<100 || code_i>699)
-			return -1;
-	} else {
-		code_i = ((pv_elem_p)str1)->spec.pvp.pvn.u.isname.name.n;
-	}
-	
-	if(((pv_elem_p)str2)->spec.getf!=NULL)
-	{
-		if(pv_printf_s(msg, (pv_elem_p)str2, &code_s)!=0 || code_s.len <=0)
-			return -1;
-	} else {
-		code_s = ((pv_elem_p)str2)->text;
-	}
-
-	return sl_send_reply(msg, code_i, &code_s);
-}
-
-int send_reply(struct sip_msg *msg, int code, str *text)
-{
-	struct cell * t;
-	char rbuf[256];
-	if(sl_bind_tm!=0)
-	{
-		t = tmb.t_gett();
-		if(t!= NULL && t!=T_UNDEFINED)
-		{
-			if(text->len>=256)
-			{
-				LM_ERR("reason phrase too long (tm)\n");
-				return -1;
-			}
-			strncpy(rbuf,  text->s,  text->len);			
-			rbuf[text->len] = '\0';
-			if(tmb.t_reply(msg, code, rbuf)< 0)
-			{
-				LM_ERR("failed to reply stateful (tm)\n");
-				return -1;
-			}
-			LM_DBG("reply in stateful mode (tm)\n");
-			return 1;
-		}
-	}
-
-	LM_DBG("reply in stateless mode (sl)\n");
-	return sl_send_reply(msg, code, text);
-}
-
-static int w_send_reply(struct sip_msg* msg, char* str1, char* str2)
-{
-	str code_s;
-	unsigned int code_i;
-
-	if(((pv_elem_p)str1)->spec.getf!=NULL)
-	{
-		if(pv_printf_s(msg, (pv_elem_p)str1, &code_s)!=0)
-			return -1;
-		if(str2int(&code_s, &code_i)!=0 || code_i<100 || code_i>699)
-			return -1;
-	} else {
-		code_i = ((pv_elem_p)str1)->spec.pvp.pvn.u.isname.name.n;
-	}
-	
-	if(((pv_elem_p)str2)->spec.getf!=NULL)
-	{
-		if(pv_printf_s(msg, (pv_elem_p)str2, &code_s)!=0 || code_s.len <=0)
-			return -1;
-	} else {
-		code_s = ((pv_elem_p)str2)->text;
-	}
-	return send_reply(msg, code_i, &code_s);
-}
-
-
-int get_reply_totag(struct sip_msg *msg, str *totag)
-{
-	struct cell * t;
-	if(msg==NULL || totag==NULL)
-		return -1;
-	if(sl_bind_tm!=0)
-	{
-		t = tmb.t_gett();
-		if(t!= NULL && t!=T_UNDEFINED)
-		{
-			if(tmb.t_get_reply_totag(msg, totag)< 0)
-			{
-				LM_ERR("failed to get totag (tm)\n");
-				return -1;
-			}
-			LM_DBG("totag stateful mode (tm)\n");
-			return 1;
-		}
-	}
-
-	LM_DBG("totag stateless mode (sl)\n");
-	return sl_get_reply_totag(msg, totag);
-}
-
-/*!
- * \brief Helper function for loading the SL API
- * \param slb sl_bind structure
- * \return -1 on parameter errors, 1 otherwise
- */
-int load_sl( struct sl_binds *slb)
-{
-	if(slb==NULL)
-		return -1;
-
-	slb->reply      = sl_send_reply;
-	slb->reply_dlg  = sl_send_reply_dlg;
-	slb->sl_get_reply_totag = sl_get_reply_totag;
-	slb->send_reply         = send_reply;
-	slb->get_reply_totag    = get_reply_totag;
-
-
-	return 1;
-}
-

+ 0 - 37
modules_k/sl/sl.h

@@ -1,37 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2006 Voice Sistem
- *
- * This file is part of Kamailio, a free SIP server.
- *
- * Kamailio 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
- *
- * Kamailio 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
- *
- * History:
- * --------
- *  2006-02-06  original version (bogdan)
- */
-
-/*!
- * \file
- * \brief SL::module definitions
- * \ingroup sl
- * - Module: \ref sl
- */
-
-#ifndef _SL_K_H_
-#define _SL_K_H_
-
-#endif

+ 0 - 76
modules_k/sl/sl_api.h

@@ -1,76 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2007 Voice Sistem SRL
- *
- * This file is part of Kamailio, a free SIP server.
- *
- * Kamailio 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
- *
- * Kamailio 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
- */
-
-/*!
- * \file
- * \brief SL :: API
- * \ingroup sl
- * - Module: \ref sl
- */
-
-#ifndef _SL_API_H_
-#define _SL_API_H_
-
-#include "../../sr_module.h"
-#include "../../dprint.h"
-
-typedef int (*get_reply_totag_f)(struct sip_msg *msg, str *tag);
-typedef int (*send_reply_f)(struct sip_msg *msg, int code, str *reason);
-typedef int (*sl_get_reply_totag_f)(struct sip_msg *msg, str *tag);
-typedef int (*sl_send_reply_str_f)(struct sip_msg *msg, int code, str *reason);
-typedef int (*sl_send_reply_dlg_f)(struct sip_msg *msg, int code, str *reason,
-		str *tag);
-
-/*! SL API bindings */
-struct sl_binds {
-	sl_send_reply_str_f reply;
-	sl_send_reply_dlg_f reply_dlg;
-	sl_get_reply_totag_f sl_get_reply_totag;
-	send_reply_f send_reply;
-	get_reply_totag_f get_reply_totag;
-};
-
-typedef int(*load_sl_f)(struct sl_binds *slb);
-
-int load_sl(struct sl_binds *slb);
-
-/*!
- * \brief Load the SL API
- */
-static inline int load_sl_api( struct sl_binds *slb )
-{
-	load_sl_f load_sl;
-
-	/* import the SL auto-loading function */
-	if ( !(load_sl=(load_sl_f)find_export("load_sl", 0, 0))) {
-		LM_ERR("can't import load_sl\n");
-		return -1;
-	}
-	/* let the auto-loading function load all TM stuff */
-	if (load_sl( slb )==-1)
-		return -1;
-
-	return 0;
-}
-
-
-#endif

+ 0 - 101
modules_k/sl/sl_cb.c

@@ -1,101 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2006 Voice Sistem SRL
- *
- * This file is part of Kamailio, a free SIP server.
- *
- * Kamailio 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.
- *
- * Kamailio 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.
- *
- * History:
- * ---------
- *  2006-03-29  first version (bogdan)
- */
-
-/*!
- * \file
- * \brief SL :: callbacks
- * \ingroup sl
- * - Module: \ref sl
- */
-
-#include "../../mem/mem.h"
-#include "sl_cb.h"
-
-/*! callback list head */
-struct sl_callback* slcb_hl = 0;
-
-
-/*! cleanup callback list */
-void destroy_slcb_lists(void)
-{
-	struct sl_callback *cbp, *cbp_tmp;
-
-	for( cbp=slcb_hl; cbp ; ) {
-		cbp_tmp = cbp;
-		cbp = cbp->next;
-		pkg_free( cbp_tmp );
-	}
-}
-
-
-/*! register a SL callback */
-int register_slcb(unsigned int types, sl_cb_t f, void *param )
-{
-	struct sl_callback *cbp;
-
-	/* build a new callback structure */
-	if (!(cbp=pkg_malloc( sizeof( struct sl_callback)))) {
-		LM_ERR("out of pkg. mem\n");
-		return -1;
-	}
-
-	/* fill it up */
-	cbp->types = types;
-	cbp->callback = f;
-	cbp->param = param;
-	/* link it at the beginning of the list */
-	cbp->next = slcb_hl;
-	slcb_hl = cbp;
-	/* set next id */
-	if (cbp->next)
-		cbp->id = cbp->next->id+1;
-	else
-		cbp->id = 0;
-
-	return 0;
-}
-
-
-/*! run SL callbacks */
-void run_sl_callbacks( unsigned int types, struct sip_msg *req, str *buffer,
-							int code, str *reason, union sockaddr_union *to )
-{
-	static struct sl_cb_param cb_params;
-	struct sl_callback *cbp;
-
-	cb_params.buffer = buffer;
-	cb_params.code = code;
-	cb_params.reason = reason;
-	cb_params.dst = to;
-
-	for ( cbp=slcb_hl ; cbp ; cbp=cbp->next ) {
-		if (types&cbp->types) {
-			cb_params.param = cbp->param;
-			LM_DBG("callback id %d entered\n", cbp->id );
-				cbp->callback( types&cbp->types, req, &cb_params);
-		}
-	}
-}

+ 0 - 86
modules_k/sl/sl_cb.h

@@ -1,86 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2006 Voice Sistem SRL
- *
- * This file is part of Kamailio, a free SIP server.
- *
- * Kamailio 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.
- *
- * Kamailio 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.
- *
- *
- * History:
- * ---------
- *  2006-03-29  first version (bogdan)
- */
-
-/*!
- * \file
- * \brief SL :: callbacks
- * \ingroup sl
- * - Module: \ref sl
- */
-
-#ifndef SL_CB_H_
-#define SL_CB_H_
-
-#include "../../str.h"
-#include "../../ip_addr.h"
-#include "../../parser/msg_parser.h"
-
-
-struct sl_cb_param {
-	str  *buffer;
-	int  code;
-	str  *reason;
-	union sockaddr_union *dst;
-	void *param;
-};
-
-/*! callback function prototype */
-typedef void (sl_cb_t) (unsigned int types, struct sip_msg* req,
-		struct sl_cb_param *sl_param);
-/*! register callback function prototype */
-typedef int (*register_slcb_t)(unsigned int types, sl_cb_t f, void *param);
-
-
-
-/*! SL callback definition */
-struct sl_callback {
-	int id;                    /* id of this callback - useless */
-	unsigned int types;        /* maks of types */
-	sl_cb_t* callback;         /* callback function */
-	void* param;               /* param to be passed to callback function */
-	struct sl_callback* next;  /* next callback element*/
-};
-
-
-#define SLCB_REPLY_OUT       (1<<0)
-#define SLCB_ACK_IN          (1<<1)
-
-/*! cleanup callback list */
-void destroy_slcb_lists(void);
-
-
-/*! register a SL callback */
-int register_slcb(unsigned int types, sl_cb_t f, void *param );
-
-/*! run SL callbacks */
-void run_sl_callbacks( unsigned int types, struct sip_msg *req, str *buffer,
-		int code, str *reason, union sockaddr_union *to);
-
-
-#endif
-
-

+ 0 - 363
modules_k/sl/sl_funcs.c

@@ -1,363 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2001-2003 FhG Fokus
- *
- * This file is part of Kamailio, a free SIP server.
- *
- * Kamailio 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
- *
- * Kamailio 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
- *
- * History:
- * -------
- * 2003-02-11  modified sl_send_reply to use the transport independent
- *              msg_send  (andrei)
- * 2003-02-18  replaced TOTAG_LEN w/ TOTAG_VALUE_LEN (it was defined twice
- *              w/ different values!)  (andrei)
- * 2003-03-06  aligned to request2response use of tag bookmarks (jiri)
- * 2003-04-04  modified sl_send_reply to use src_port if rport is present
- *              in the topmost via (andrei)
- * 2003-09-11: updated to new build_lump_rpl() interface (bogdan)
- * 2003-09-11: sl_tag converted to str to fit to the new
- *               build_res_buf_from_sip_req() interface (bogdan)
- * 2003-11-11: build_lump_rpl() removed, add_lump_rpl() has flags (bogdan)
- * 2004-10-10: use of mhomed disabled for replies (jiri)
- * 2006-03-29: callbacks for sending replies added (bogdan)
- * 2006-11-28: Moved numerical code tracking out of sl_send_reply() and into
- *             update_sl_reply_stat(). Also added more detail stat collection.
- *             (Jeffrey Magder - SOMA Networks)
- */
-
-/*!
- * \file
- * \brief SL :: functions
- * \ingroup sl
- * - Module: \ref sl
- */
-
-#include "../../globals.h"
-#include "../../forward.h"
-#include "../../dprint.h"
-#include "../../md5utils.h"
-#include "../../msg_translator.h"
-#include "../../udp_server.h"
-#include "../../timer.h"
-#include "../../mem/mem.h"
-#include "../../mem/shm_mem.h"
-#include "../../crc.h"
-#include "../../dset.h"
-#include "../../data_lump_rpl.h"
-#include "../../action.h"
-#include "../../parser/parse_to.h"
-#include "../../config.h"
-#include "../../tags.h"
-#include "sl.h"
-#include "sl_funcs.h"
-#include "sl_cb.h"
-#include "../../usr_avp.h"
-#include <string.h>
-#include "../../lib/kcore/statistics.h"
-
-/* module parameter */
-extern int sl_enable_stats;
-
-/* statistic variables */
-extern stat_var *tx_1xx_rpls;
-extern stat_var *tx_2xx_rpls;
-extern stat_var *tx_3xx_rpls;
-extern stat_var *tx_4xx_rpls;
-extern stat_var *tx_5xx_rpls;
-extern stat_var *tx_6xx_rpls;
-extern stat_var *sent_rpls;
-extern stat_var *sent_err_rpls;
-extern stat_var *rcv_acks;
-
-
-/* to-tag including pre-calculated and fixed part */
-static char           sl_tag_buf[TOTAG_VALUE_LEN];
-static str            sl_tag = {sl_tag_buf,TOTAG_VALUE_LEN};
-/* from here, the variable prefix begins */
-static char           *tag_suffix;
-/* if we for this time did not send any stateless reply,
-   we do not filter */
-static unsigned int  *sl_timeout = 0;
-
-
-/*! SL startup helper */
-int sl_startup(void)
-{
-
-	init_tags( sl_tag.s, &tag_suffix,
-			"Kamailio-stateless",
-			SL_TOTAG_SEPARATOR );
-
-	/*timeout*/
-	sl_timeout = (unsigned int*)shm_malloc(sizeof(unsigned int));
-	if (!sl_timeout)
-	{
-		LM_ERR("no more shm memory!\n");
-		return -1;
-	}
-	*(sl_timeout)=get_ticks();
-
-	return 0;
-}
-
-
-/*! SL shutdown helper */
-int sl_shutdown(void)
-{
-	if (sl_timeout)
-		shm_free(sl_timeout);
-	return 1;
-}
-
-
-/*! Take care of the statistics associated with numerical codes and replies */
-static inline void update_sl_reply_stat(int code) 
-{
-	stat_var *numerical_stat;
-
-	/* If stats aren't enabled, just skip over this. */
-	if (!sl_enable_stats) 
-		return;
-
-	/* Kamailio already kept track of the total number of 1xx, 2xx, replies.
-	* There may be setups that still expect these variables to exist, so we
-	* don't touch them */
-	if (code < 200 ) {
-		update_stat( tx_1xx_rpls , 1);
-	} else if (code<300) {
-		update_stat( tx_2xx_rpls , 1);
-	} else if (code<400) {
-		update_stat( tx_3xx_rpls , 1);
-	} else if (code<500) {
-		update_stat( tx_4xx_rpls , 1);
-	} else if (code<600) {
-		update_stat( tx_5xx_rpls , 1);
-	} else {
-		update_stat( tx_6xx_rpls , 1);
-	}
-
-	update_stat( sent_rpls , 1);
-
-	numerical_stat = get_stat_var_from_num_code(code, 1);
-
-	if (numerical_stat != NULL)
-		update_stat(numerical_stat, 1);
-}
-
-int sl_get_reply_totag(struct sip_msg *msg, str *totag)
-{
-	if(msg==NULL || totag==NULL)
-		return -1;
-	calc_crc_suffix(msg, tag_suffix);
-	*totag = sl_tag;
-	return 1;
-}
-
-/*! sl_send_reply helper function */
-int sl_send_reply_helper(struct sip_msg *msg ,int code, str *text, str *tag)
-{
-	str buf;
-	char *dset;
-	int dset_len;
-	struct bookmark dummy_bm;
-	int backup_mhomed;
-	int ret;
-	struct dest_info dst;
-	char rbuf[256];
-
-	if ( msg->first_line.u.request.method_value==METHOD_ACK)
-		goto error;
-
-	init_dest_info(&dst);
-	if (reply_to_via) {
-		if (update_sock_struct_from_via(  &dst.to, msg, msg->via1 )==-1)
-		{		
-			LOG(L_ERR, "ERROR: sl_send_reply: "
-				"cannot lookup reply dst: %s\n",
-				msg->via1->host.s );
-			goto error;
-		}
-	} else update_sock_struct_from_ip( &dst.to, msg );
-
-	/* if that is a redirection message, dump current message set to it */
-	if (code>=300 && code<400) {
-		dset=print_dset(msg, &dset_len);
-		if (dset) {
-			add_lump_rpl(msg, dset, dset_len, LUMP_RPL_HDR);
-		}
-	}
-
-	/*sr core requres charz reason phrase */
-	if(text->len>=256)
-	{
-		LOG(L_ERR, "ERROR: reason phrase too long\n");
-		goto error;
-	}
-	strncpy(rbuf, text->s, text->len);
-	rbuf[text->len] = '\0';
-
-	/* add a to-tag if there is a To header field without it */
-	if ( code>=180 &&
-		(msg->to || (parse_headers(msg,HDR_TO_F, 0)!=-1 && msg->to))
-		&& (get_to(msg)->tag_value.s==0 || get_to(msg)->tag_value.len==0) ) 
-	{
-		if(tag!=NULL && tag->s!=NULL) {
-			buf.s = build_res_buf_from_sip_req( code, rbuf, tag,
-						msg, (unsigned int*)&buf.len, &dummy_bm);
-		} else {
-			calc_crc_suffix( msg, tag_suffix );
-			buf.s = build_res_buf_from_sip_req( code, rbuf, &sl_tag, msg,
-				(unsigned int*)&buf.len, &dummy_bm);
-		}
-	} else {
-		buf.s = build_res_buf_from_sip_req( code, rbuf, 0, msg,
-			(unsigned int*)&buf.len, &dummy_bm);
-	}
-	if (!buf.s) {
-		LM_ERR("response building failed\n");
-		goto error;
-	}
-
-	run_sl_callbacks( SLCB_REPLY_OUT, msg, &buf, code, text, &dst.to );
-
-	/* supress multhoming support when sending a reply back -- that makes sure
-	   that replies will come from where requests came in; good for NATs
-	   (there is no known use for mhomed for locally generated replies;
-	    note: forwarded cross-interface replies do benefit of mhomed!
-	*/
-	backup_mhomed=mhomed;
-	mhomed=0;
-	/* use for sending the received interface -bogdan*/
-	dst.proto=msg->rcv.proto;
-	dst.send_sock=msg->rcv.bind_address;
-	dst.id=msg->rcv.proto_reserved1;
-#ifdef USE_COMP
-	dst.comp=msg->via1->comp_no;
-#endif
-	dst.send_flags=msg->rpl_send_flags;
-	ret = msg_send(&dst, buf.s, buf.len);
-	mhomed=backup_mhomed;
-	pkg_free(buf.s);
-
-	if (ret<0)
-		goto error;
-
-	*(sl_timeout) = get_ticks() + SL_RPL_WAIT_TIME;
-
-	update_sl_reply_stat(code);
-
-	return 1;
-
-error:
-	return -1;
-}
-
-
-/*! small wrapper around sl_send_reply_helper */
-int sl_send_reply(struct sip_msg *msg ,int code, str *text)
-{
-	return sl_send_reply_helper(msg, code, text, 0);
-}
-
-/*! small wrapper around sl_send_reply_helper */
-int sl_send_reply_sz(struct sip_msg *msg ,int code, char *text)
-{
-	str r;
-	r.s = text;
-	r.len = strlen(text);
-	return sl_send_reply_helper(msg, code, &r, 0);
-}
-
-
-/*! small wrapper around sl_send_reply_helper */
-int sl_send_reply_dlg(struct sip_msg *msg ,int code, str *text, str *tag)
-{
-	return sl_send_reply_helper(msg, code, text, tag);
-}
-
-
-/*! Reply an SIP error */
-int sl_reply_error(struct sip_msg *msg )
-{
-	char err_buf[MAX_REASON_LEN];
-	int sip_error;
-	str text;
-	int ret;
-
-	ret = err2reason_phrase( prev_ser_error, &sip_error, 
-		err_buf, sizeof(err_buf), "SL");
-	if (ret<=0) {
-		LM_ERR("err2reason failed\n");
-		return -1;
-	}
-	text.len = ret;
-	text.s = err_buf;
-	LM_DBG("error text is %.*s\n",text.len,text.s);
-
-	ret = sl_send_reply_helper( msg, sip_error, &text, 0);
-	if (ret==-1)
-		return -1;
-	if_update_stat( sl_enable_stats, sent_err_rpls , 1);
-	return ret;
-}
-
-
-
-/*!
- * Filter ACKs
- * \return 0 for ACKs to a local reply, -1 on error, 1 is not an ACK or a non-local ACK
- */
-int sl_filter_ACK(struct sip_msg *msg, unsigned int flags, void *bar )
-{
-	str *tag_str;
-
-	if (msg->first_line.u.request.method_value!=METHOD_ACK)
-		goto pass_it;
-
-	/*check the timeout value*/
-	if ( *(sl_timeout)<= get_ticks() )
-	{
-		LM_DBG("to late to be a local ACK!\n");
-		goto pass_it;
-	}
-
-	/*force to parse to header -> we need it for tag param*/
-	if (parse_headers( msg, HDR_TO_F, 0 )==-1)
-	{
-		LM_ERR("unable to parse To header\n");
-		return -1;
-	}
-
-	if (msg->to) {
-		tag_str = &(get_to(msg)->tag_value);
-		if ( tag_str->len==TOTAG_VALUE_LEN )
-		{
-			/* calculate the variable part of to-tag */	
-			calc_crc_suffix(msg, tag_suffix);
-			/* test whether to-tag equal now */
-			if (memcmp(tag_str->s,sl_tag.s,sl_tag.len)==0) {
-				LM_DBG("local ACK found -> dropping it!\n");
-				if_update_stat( sl_enable_stats, rcv_acks, 1);
-				run_sl_callbacks( SLCB_ACK_IN, msg, 0, 0, 0, 0 );
-				return 0;
-			}
-		}
-	}
-
-pass_it:
-	return 1;
-}

+ 0 - 50
modules_k/sl/sl_funcs.h

@@ -1,50 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2001-2003 FhG Fokus
- *
- * This file is part of Kamailio, a free SIP server.
- *
- * Kamailio 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
- *
- * Kamailio 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
- */
-
-/*!
- * \file
- * \brief SL :: functions
- * \ingroup sl
- * - Module: \ref sl
- */
-
-#ifndef _SL_FUNCS_H
-#define _SL_FUNCS_H
-
-#include "../../parser/msg_parser.h"
-
-#define SL_RPL_WAIT_TIME  2  /* in sec */
-
-#define SL_TOTAG_SEPARATOR '.'
-
-int sl_startup(void);
-int sl_shutdown(void);
-int sl_send_reply( struct sip_msg *msg, int code, str *reason);
-int sl_send_reply_sz( struct sip_msg *msg, int code, char *reason);
-int sl_send_reply_dlg( struct sip_msg *msg, int code, str *reason, str *tag);
-int sl_filter_ACK( struct sip_msg *msg, unsigned int flags, void *foo );
-int sl_reply_error( struct sip_msg *msg );
-int sl_get_reply_totag(struct sip_msg *msg, str *totag);
-
-#endif
-
-