modules/tm/test.c

00001 /* 
00002  * $Id$
00003  *
00004  *
00005  * Copyright (C) 2001-2003 FhG Fokus
00006  *
00007  * This file is part of ser, a free SIP server.
00008  *
00009  * ser is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version
00013  *
00014  * For a license to use the ser software under conditions
00015  * other than those described here, or to purchase support for this
00016  * software, please contact iptel.org by e-mail at the following addresses:
00017  *    info@iptel.org
00018  *
00019  * ser is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  * GNU General Public License for more details.
00023  *
00024  * You should have received a copy of the GNU General Public License 
00025  * along with this program; if not, write to the Free Software 
00026  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027  */
00028 
00029 #if 0
00030 
00031 #include "defs.h"
00032 
00033 
00034 #include "../../hash_func.h"
00035 #include "t_funcs.h"
00036 #include "../../dprint.h"
00037 #include "../../config.h"
00038 #include "../../parser/parser_f.h"
00039 #include "../../data_lump.h"
00040 #include "../../ut.h"
00041 #include "../../timer.h"
00042 #include "../../data_lump.h"
00043 
00044 #include "t_hooks.h"
00045 
00046 int _test_insert_to_reply( struct sip_msg *msg, char *str )
00047 {
00048     struct lump* anchor;
00049     char *buf;
00050     int len;
00051 
00052     len=strlen( str );
00053     buf=pkg_malloc( len );
00054     if (!buf) {
00055         LOG(L_ERR, "_test_insert_to_reply: no mem\n");
00056         return 0;
00057     }
00058     memcpy( buf, str, len );
00059 
00060     anchor = anchor_lump(msg, msg->headers->name.s - msg->buf, 0 , 0);
00061     if (anchor == NULL) {
00062         LOG(L_ERR, "_test_insert_to_reply: anchor_lump failed\n");
00063         return 0;
00064     }
00065     if (insert_new_lump_before(anchor,buf, len, 0)==0) {
00066         LOG(L_ERR, "_test_insert_to_reply: insert_new_lump failed\n");
00067         return 0;
00068     }
00069     return 1;
00070 }
00071 
00072 #endif