Пример #1
0
int l4init1(lsi_cb_param_t *rec)
{
    MyData *myData = (MyData *)g_api->get_module_data(rec->_session, &MNAME,
                     LSI_MODULE_DATA_L4);
    if (!myData)
    {
        myData = (MyData *) malloc(sizeof(MyData));
        ls_loopbuf(&myData->inBuf, MAX_BLOCK_BUFSIZE);
        ls_loopbuf(&myData->outBuf, MAX_BLOCK_BUFSIZE);

        g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpin1 test %s\n", "l4init");
        g_api->set_module_data(rec->_session, &MNAME, LSI_MODULE_DATA_L4,
                               (void *)myData);
    }
    else
    {
        ls_loopbuf_clear(&myData->inBuf);
        ls_loopbuf_clear(&myData->outBuf);
    }

    return LS_OK;
}
Пример #2
0
static void *ls_zbufinfo_new()
{
    zbufinfo_t *pNew = (zbufinfo_t *)malloc(sizeof(zbufinfo_t));
    if (pNew == NULL)
        return NULL;
    memset(pNew, 0, sizeof(zbufinfo_t));
    pNew->zstream.opaque = Z_NULL;
    pNew->zstream.zalloc = Z_NULL;
    pNew->zstream.zfree = Z_NULL;
    if ((ls_loopbuf(&pNew->loopbuf, INIT_LOOPBUF_SIZE)) == NULL)
    {
        free(pNew);
        return NULL;
    }
    return pNew;
}