00001 /* Copyright (C) 2008 Telecats BV 00002 * 00003 * This file is part of openser, a free SIP server. 00004 * 00005 * openser is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * openser is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 * 00019 * 00020 * History: 00021 * --------- 00022 * 2008-07-14 first version (Ardjan Zwartjes) 00023 */ 00024 00025 00026 #ifndef TEXTOPS_API_H_ 00027 #define TEXTOPS_API_H_ 00028 #include "../../str.h" 00029 #include "../../sr_module.h" 00030 00031 00032 typedef int (*append_hf_t)(struct sip_msg*, str*); 00033 typedef int (*remove_hf_t)(struct sip_msg*, str*); 00034 typedef int (*search_append_t)(struct sip_msg*, str*, str*); 00035 typedef int (*search_t)(struct sip_msg*, str*); 00036 00037 /* 00038 * Struct with the textops api. 00039 */ 00040 struct textops_binds{ 00041 append_hf_t append_hf; // Append a header to the message. 00042 remove_hf_t remove_hf; // Remove a header with the specified name from the message. 00043 search_append_t search_append; // Append a str after a match of the specified regex. 00044 search_t search; // Check if the regex matches a part of the message. 00045 }; 00046 00047 typedef int (*load_textops_f)(struct textops_binds*); 00048 00049 /* 00050 * function exported by module - it will load the other functions 00051 */ 00052 int load_textops(struct textops_binds*); 00053 00054 /* 00055 * Function to be called direclty from other modules to load 00056 * the textops API. 00057 */ 00058 inline static int load_textops_api(struct textops_binds *tob){ 00059 load_textops_f load_textops_exports; 00060 if(!(load_textops_exports=(load_textops_f)find_export("load_textops",0,0))){ 00061 LM_ERR("Failed to import load_textops\n"); 00062 return -1; 00063 } 00064 return load_textops_exports(tob); 00065 } 00066 00067 #endif /*TEXT_OPS_API_H_*/
1.5.6