print_lib.c

00001 /*$Id$
00002  *
00003  * Example library using ser module (it doesn't do anything usefull)
00004  *
00005  *
00006  * Copyright (C) 2007 iptelorg GmbH
00007  *
00008  * This file is part of ser, a free SIP server.
00009  *
00010  * ser is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version
00014  *
00015  * For a license to use the ser software under conditions
00016  * other than those described here, or to purchase support for this
00017  * software, please contact iptel.org by e-mail at the following addresses:
00018  *    info@iptel.org
00019  *
00020  * ser is distributed in the hope that it will be useful,
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  * GNU General Public License for more details.
00024  *
00025  * You should have received a copy of the GNU General Public License
00026  * along with this program; if not, write to the Free Software
00027  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028  */
00029  /* History:
00030  * --------
00031  *  2007-03-16  created by andrei
00032  */
00033 
00034 
00035 
00036 
00037 #include "../../sr_module.h"
00038 #include "../../lib/print/print.h"
00039 
00040 MODULE_VERSION
00041 
00042 static int print_f(struct sip_msg*, char*,char*);
00043 static int mod_init(void);
00044 
00045 
00046 static cmd_export_t cmds[]={
00047         {"print_stderr", print_f, 1, 0, REQUEST_ROUTE},
00048         {0, 0, 0, 0, 0}
00049 };
00050 
00051 static param_export_t params[]={
00052         {0,0,0}
00053 };
00054 
00055 struct module_exports exports = {
00056         "print_stderr",
00057         cmds,
00058         0,        /* RPC methods */
00059         params,
00060 
00061         mod_init, /* module initialization function */
00062         0,        /* response function*/
00063         0,        /* destroy function */
00064         0,        /* oncancel function */
00065         0         /* per-child init function */
00066 };
00067 
00068 
00069 static int mod_init(void)
00070 {
00071         stderr_println("print_lib - initializing");
00072         return 0;
00073 }
00074 
00075 
00076 static int print_f(struct sip_msg* msg, char* s1, char* s2)
00077 {
00078         stderr_println(s1);
00079         return 1;
00080 }
00081