Support for transparent / notransparent commands added

This commit is contained in:
z3APA3A 2017-10-17 18:00:09 +03:00
parent b99fa7aaa4
commit 18c1ce0a22

View File

@ -23,23 +23,15 @@
extern "C" { extern "C" {
#endif #endif
#ifndef isnumber
#define isnumber(i_n_arg) ((i_n_arg>='0')&&(i_n_arg<='9'))
#endif
static struct pluginlink * pl; static struct pluginlink * pl;
static pthread_mutex_t transparent_mutex;
static int transparent_loaded = 0; static int transparent_loaded = 0;
static void* transparent_filter_open(void * idata, struct srvparam * param){ static void* transparent_filter_open(void * idata, struct srvparam * param){
return idata; return idata;
} }
static FILTER_ACTION transparent_filter_client(void *fo, struct clientparam * param, void** fc){ static FILTER_ACTION transparent_filter_client(void *fo, struct clientparam * param, void** fc){
socklen_t len; socklen_t len;
@ -94,6 +86,21 @@ static struct filter transparent_filter = {
transparent_filter_close transparent_filter_close
}; };
static int h_transparent(int argc, unsigned char **argv){
transparent_filter.filter_open = transparent_filter_open;
return 0;
}
static int h_notransparent(int argc, unsigned char **argv){
transparent_filter.filter_open = NULL;
return 0;
}
static struct commands transparent_commandhandlers[] = {
{transparent_commandhandlers+1, "transparent", h_transparent, 1, 1},
{NULL, "notransparent", h_notransparent, 1, 1}
};
#ifdef WATCOM #ifdef WATCOM
#pragma aux transparent_plugin "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx] #pragma aux transparent_plugin "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx]
@ -106,9 +113,10 @@ PLUGINAPI int PLUGINCALL transparent_plugin (struct pluginlink * pluginlink,
pl = pluginlink; pl = pluginlink;
if(!transparent_loaded){ if(!transparent_loaded){
transparent_loaded = 1; transparent_loaded = 1;
pthread_mutex_init(&transparent_mutex, NULL);
transparent_filter.next = pl->conf->filters; transparent_filter.next = pl->conf->filters;
pl->conf->filters = &transparent_filter; pl->conf->filters = &transparent_filter;
transparent_commandhandlers[1].next = pl->commandhandlers->next;
pl->commandhandlers->next = transparent_commandhandlers;
} }
return 0; return 0;