|
|
|
|
|
|
|
|
//
|
|
|
//
|
|
|
// \throws runtime_error if the obtained pointer is 0.
|
|
|
// \throws runtime_error if the obtained pointer is 0.
|
|
|
//
|
|
|
//
|
|
|
SNFMilterContext *
|
|
|
|
|
|
|
|
|
SNFMilterContext*
|
|
|
getContextFromCtx(SMFICTX* Ctx) {
|
|
|
getContextFromCtx(SMFICTX* Ctx) {
|
|
|
SNFMilterContext* Context = (SNFMilterContext*) smfi_getpriv(Ctx);
|
|
|
|
|
|
if(0 == Context) throw runtime_error("Got NULL from snfi_getpriv()");
|
|
|
|
|
|
|
|
|
SNFMilterContext* Context = (SNFMilterContext*) smfi_getpriv(Ctx); // Get the context object.
|
|
|
|
|
|
if(0 == Context) throw runtime_error("Got NULL from smfi_getpriv()");
|
|
|
return Context;
|
|
|
return Context;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
//
|
|
|
// \throws runtime_error if the obtained pointer is 0.
|
|
|
// \throws runtime_error if the obtained pointer is 0.
|
|
|
//
|
|
|
//
|
|
|
SNFMilterContext *
|
|
|
|
|
|
|
|
|
SNFMilterContext*
|
|
|
assignContextToCtx(SMFICTX* Ctx) {
|
|
|
assignContextToCtx(SMFICTX* Ctx) {
|
|
|
SNFMilterContext *Context = MilterContexts->grab(); // Get any existing context object.
|
|
|
|
|
|
|
|
|
SNFMilterContext* Context = MilterContexts->grab(); // Get any existing context object.
|
|
|
if(0 == Context) // Check address.
|
|
|
if(0 == Context) // Check address.
|
|
|
throw runtime_error("Got NULL from MilterContexts->grab()");
|
|
|
throw runtime_error("Got NULL from MilterContexts->grab()");
|
|
|
smfi_setpriv(Ctx, Context); // Save the context object.
|
|
|
smfi_setpriv(Ctx, Context); // Save the context object.
|