virtual void log( ::boost::shared_ptr< osiris::LogMessage > message ) { ::osiris::PythonState __pystate(getPythonThreadState()); if( ::osiris::PythonOverride func_log = this->get_override( "log" ) ) func_log( message ); else{ __pystate.leave(); this->::osiris::FileLogger::log( message ); } }
func_t *func_diff_pow(func_t *f, int var) { func_t *fx=NULL,*g=NULL,*h=NULL,*gx=NULL,*hx=NULL; if(!func_is(f,"pow")){ FUNC_ERROR_ARG1("func_diff_pow",f); } g=f->a[0]; h=f->a[1]; gx=func_diff(FR(g),func_var1(var,1)); hx=func_diff(FR(h),func_var1(var,1)); hx=func_mul(hx,func_log(FR(g))); gx=func_mul(gx,FR(h)); gx=func_div(gx,FR(g)); gx=func_add(gx,hx); fx=func_mul(FR(f),gx); f=func_del(f); return fx; }
/* * execute a function. * return FLAG_TRUE if the function was successful */ static int execute_func(struct filter_op *fop, struct packet_object *po) { switch (fop->op.func.op) { case FFUNC_SEARCH: /* search the string */ if (func_search(fop, po) == ESUCCESS) return FLAG_TRUE; break; case FFUNC_REGEX: /* search the string with a regex */ if (func_regex(fop, po) == ESUCCESS) return FLAG_TRUE; break; case FFUNC_PCRE: /* evaluate a perl regex */ if (func_pcre(fop, po) == ESUCCESS) return FLAG_TRUE; break; case FFUNC_REPLACE: /* replace the string */ if (func_replace(fop, po) == ESUCCESS) return FLAG_TRUE; break; case FFUNC_INJECT: /* replace the string */ if (func_inject(fop, po) == ESUCCESS) return FLAG_TRUE; break; case FFUNC_LOG: /* log the packet */ if (func_log(fop, po) == ESUCCESS) return FLAG_TRUE; break; case FFUNC_DROP: /* drop the packet */ func_drop(po); return FLAG_TRUE; break; case FFUNC_KILL: /* kill the connection */ func_kill(po); return FLAG_TRUE; break; case FFUNC_MSG: /* display the message to the user */ USER_MSG("%s", fop->op.func.string); return FLAG_TRUE; break; case FFUNC_EXEC: /* execute the command */ if (func_exec(fop) == ESUCCESS) return FLAG_TRUE; break; default: JIT_FAULT("unsupported function [%d]", fop->op.func.op); break; } return FLAG_FALSE; }