?? sample_plugin_core.c
字號:
/* The sample_plugin plugin is a plugin for partysip. Copyright (C) 2002 Aymeric MOIZARD - <jack@atosc.org> The sample_plugin plugin 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. The sample_plugin plugin 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 sample_plugin; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/#include <partysip/partysip.h>#include "sample_plugin.h"#define PSP_SERVER_CF_DIR PSP_SERVER_CONFIG_DIR/* this structure is retreived by the core application with dlsym */psp_plugin_t PPL_DECLARE_DATA sample_plugin_plugin;/* element shared with the core application layer *//* all xxx_plugin elements MUST be DYNAMICLY ALLOCATED as the core application will assume they are */imp_plugin_t *sample_plugin_plugin1;uap_plugin_t *sample_plugin_plugin2;extern sample_plugin_ctx_t *sample_plugin_context;/* this is called by the core application when the module is loaded (the address of this method is located in the structure sample_plugin_plugin->plugin_init() */int plugin_init(){ char *noauth; imp_func_t *fn; uap_func_t *fn2; int i; /* plugin MUST create their own structure and give them back to the core by calling: psp_core_load_xxx_plugin(); where xxx is the module name related to the plugin. psp_plugins can have more than one xxx_plugins attached */ TRACE(trace(__FILE__,__LINE__,TRACE_LEVEL2,NULL, "INFO: sample_plugin plugin: plugin_init()!\n")); i = sample_plugin_ctx_init(); if (i!=0) goto pi_error1; psp_plugin_take_ownership(&sample_plugin_plugin); i = psp_core_load_imp_plugin(&sample_plugin_plugin1, &sample_plugin_plugin); if (i!=0) goto pi_error2; psp_plugin_take_ownership(&sample_plugin_plugin); i = psp_core_load_uap_plugin(&sample_plugin_plugin2, &sample_plugin_plugin); if (i!=0) goto pi_error2; /* INIT HOOK METHOD FOR IMP */ /* hook sample for INVITE */ i = imp_func_init(&fn, &cb_sample_plugin_on_INVITE, sample_plugin_plugin.plug_id); if (i!=0) goto pi_error3; i = psp_core_add_imp_invite_hook(fn, PSP_HOOK_REALLY_FIRST); if (i!=0) goto pi_error4; /* hook sample for 2XX */ i = uap_func_init(&fn2, &cb_sample_plugin_on_2XX, sample_plugin_plugin.plug_id); if (i!=0) goto pi_error5; i = psp_core_add_uap_2xx_hook(fn2, PSP_HOOK_MIDDLE); if (i!=0) goto pi_error6; i = uap_func_init(&fn2, &cb_sample_plugin_on_3456XX, sample_plugin_plugin.plug_id); if (i!=0) goto pi_error7; i = psp_core_add_uap_2xx_hook(fn2, PSP_HOOK_MIDDLE); if (i!=0) goto pi_error8; return 0; pi_error8: /* YOU HAVE TO manage the memory in case of errors... */ pi_error7: pi_error6: pi_error5: pi_error4: pi_error3: /* ... */ pi_error2: sample_plugin_ctx_free(); pi_error1: return -1;}/* THIS METHOD IS NOT USED IN 0.4.4 */int plugin_start(){ TRACE(trace(__FILE__,__LINE__,TRACE_LEVEL2,NULL, "INFO: sample_plugin plugin: plugin_start()!\n")); return -1;}int plugin_release(){ TRACE(trace(__FILE__,__LINE__,TRACE_LEVEL2,NULL, "INFO: sample_plugin plugin: plugin_release()!\n")); sample_plugin_ctx_free(); sample_plugin_context=NULL; return -1;}psp_plugin_t PPL_DECLARE_DATA sample_plugin_plugin = { 0, /* uninitialized DO NOT TOUCH */ "Sample_Plugin plugin", "0.1.0", "This is just a sample_plugin. It does nothing.", PLUGIN_IMP|PLUGIN_UAP, /* PLUGIN_TLP | PLUGIN_IMP | PLUGIN_UAP | PLUGIN_SLP | PLUGIN_SFP */ 0, /* number of owners is always 0 at the begining: DO NOT TOUCH */ NULL, /* future place for the dso_handle: DO NOT TOUCH */ &plugin_init, /* DO NOT TOUCH */ &plugin_start, /* DO NOT TOUCH */ &plugin_release /* DO NOT TOUCH */};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -