PREPROC_LINKAGE int InitializePreprocessor(DynamicPreprocessorData *dpd)
{
    int i;
    if (dpd->version < PREPROCESSOR_DATA_VERSION)
    {
        return -1;
    }

    _dpd.version = dpd->version;
    _dpd.altBuffer = dpd->altBuffer;
    _dpd.altBufferLen = dpd->altBufferLen;
    for (i=0;i<MAX_URIINFOS;i++)
    {
        _dpd.uriBuffers[i] = dpd->uriBuffers[i];
    }
    _dpd.logMsg = dpd->logMsg;
    _dpd.errMsg = dpd->errMsg;
    _dpd.fatalMsg = dpd->fatalMsg;
    _dpd.debugMsg = dpd->debugMsg;

    _dpd.registerPreproc = dpd->registerPreproc;
    _dpd.addPreproc = dpd->addPreproc;
    _dpd.addPreprocRestart = dpd->addPreprocRestart;
    _dpd.addPreprocExit = dpd->addPreprocExit;
    _dpd.addPreprocConfCheck = dpd->addPreprocConfCheck;
    _dpd.preprocOptRegister = dpd->preprocOptRegister;
    _dpd.addPreprocProfileFunc = dpd->addPreprocProfileFunc;
    _dpd.profilingPreprocsFunc = dpd->profilingPreprocsFunc;
    _dpd.totalPerfStats = dpd->totalPerfStats;

    _dpd.alertAdd = dpd->alertAdd;
    _dpd.thresholdCheck = dpd->thresholdCheck;

    _dpd.inlineMode = dpd->inlineMode;
    _dpd.inlineDrop = dpd->inlineDrop;

    _dpd.detect = dpd->detect;
    _dpd.disableDetect = dpd->disableDetect;
    _dpd.disableAllDetect = dpd->disableAllDetect;
    _dpd.setPreprocBit = dpd->setPreprocBit;

    _dpd.streamAPI = dpd->streamAPI;
    _dpd.searchAPI = dpd->searchAPI;

    _dpd.config_file = dpd->config_file;
    _dpd.config_line = dpd->config_line;
    _dpd.printfappend = dpd->printfappend;
    _dpd.tokenSplit = dpd->tokenSplit;
    _dpd.tokenFree = dpd->tokenFree;

    _dpd.getRuleInfoByName = dpd->getRuleInfoByName;
    _dpd.getRuleInfoById = dpd->getRuleInfoById;

    DYNAMIC_PREPROC_SETUP();
    return 0;
}
Esempio n. 2
0
PREPROC_LINKAGE int InitializePreprocessor(DynamicPreprocessorData *dpd)
{
    if (dpd->version < PREPROCESSOR_DATA_VERSION)
    {
        printf("ERROR version %d < %d\n", dpd->version,
            PREPROCESSOR_DATA_VERSION);
        return -1;
    }

    if (dpd->size != sizeof(DynamicPreprocessorData))
    {
        printf("ERROR size %d != %u\n", dpd->size, (unsigned)sizeof(*dpd));
        return -2;
    }

    _dpd = *dpd;
    DYNAMIC_PREPROC_SETUP();
    return 0;
}