void bootstrap_module(
    ib_engine_t* ib_engine,
    ib_module_t& ib_module,
    const char*  name,
    const char*  filename
)
{
    IB_MODULE_INIT_DYNAMIC(
        &ib_module,
        filename,                           // filename
        NULL,                               // data
        NULL,                               // ib, filled in init.
        name,                               // name
        NULL,                               // config data
        0,                                  // config data length
        NULL,                               // config copier
        NULL,                               // config copier data
        NULL,                               // config field map
        NULL,                               // config directive map
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL
    );
    ib_module.ib = ib_engine;
}
Beispiel #2
0
/**
 * Create a new module to be registered with @a ib.
 *
 * This is pre-configuration time so directives may be registered.
 *
 * @param[out] module Module created using ib_module_create() and
 *             properly initialized. This should not be
 *             passed to ib_module_init(), the manager will do that.
 * @param[in] ib The unconfigured engine this module will be
 *            initialized in.
 * @param[in] cbdata The server plugin data.
 *
 * @returns
 * - IB_OK On success.
 * - IB_DECLINED Is never returned.
 * - Other on fatal errors.
 */
ib_status_t ngxib_module(
    ib_module_t **module,
    ib_engine_t *ib,
    void *cbdata
)
{
    assert(module != NULL);
    assert(ib != NULL);
    assert(cbdata != NULL);

    ib_status_t    rc;
    module_data_t *mod_data = (module_data_t *)cbdata;

    rc = ib_module_create(module, ib);
    if (rc != IB_OK) {
        return rc;
    }

    IB_MODULE_INIT_DYNAMIC(
      *module,
      __FILE__,
      NULL,                  /* Module data */
      ib,                    /* Engine. */
      "nginxModule",         /* Module name. */
      NULL,                  /* Config struct. */
      0,                     /* Config size. */
      NULL,                  /* Config copy function. */
      NULL,                  /* Config copy function callback data. */
      NULL,                  /* Configuration field map. */
      NULL,                  /* Configuration directive map. */
      init_module,           /* Init function. */
      mod_data,              /* Init function callback data. */
      NULL,                  /* Finish function. */
      NULL                   /* Finish function callback data. */
    );

    return IB_OK;
}