Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/smanonr..../usr/include
File: verto-module.h
/*
[0] Fix | Delete
* Copyright 2011 Red Hat, Inc.
[1] Fix | Delete
*
[2] Fix | Delete
* Permission is hereby granted, free of charge, to any person
[3] Fix | Delete
* obtaining a copy of this software and associated documentation files
[4] Fix | Delete
* (the "Software"), to deal in the Software without restriction,
[5] Fix | Delete
* including without limitation the rights to use, copy, modify, merge,
[6] Fix | Delete
* publish, distribute, sublicense, and/or sell copies of the Software,
[7] Fix | Delete
* and to permit persons to whom the Software is furnished to do so,
[8] Fix | Delete
* subject to the following conditions:
[9] Fix | Delete
*
[10] Fix | Delete
* The above copyright notice and this permission notice shall be
[11] Fix | Delete
* included in all copies or substantial portions of the Software.
[12] Fix | Delete
*
[13] Fix | Delete
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
[14] Fix | Delete
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
[15] Fix | Delete
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
[16] Fix | Delete
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
[17] Fix | Delete
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
[18] Fix | Delete
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
[19] Fix | Delete
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
[20] Fix | Delete
* SOFTWARE.
[21] Fix | Delete
*/
[22] Fix | Delete
[23] Fix | Delete
/*** THE FOLLOWING ARE FOR IMPLEMENTATION MODULES ONLY ***/
[24] Fix | Delete
[25] Fix | Delete
#ifndef VERTO_MODULE_H_
[26] Fix | Delete
#define VERTO_MODULE_H_
[27] Fix | Delete
[28] Fix | Delete
#include <verto.h>
[29] Fix | Delete
[30] Fix | Delete
#ifndef VERTO_MODULE_TYPES
[31] Fix | Delete
#define VERTO_MODULE_TYPES
[32] Fix | Delete
typedef void verto_mod_ctx;
[33] Fix | Delete
typedef void verto_mod_ev;
[34] Fix | Delete
#endif
[35] Fix | Delete
[36] Fix | Delete
#define VERTO_MODULE_VERSION 3
[37] Fix | Delete
#define VERTO_MODULE_TABLE(name) verto_module_table_ ## name
[38] Fix | Delete
#define VERTO_MODULE(name, symb, types) \
[39] Fix | Delete
static verto_ctx_funcs name ## _funcs = { \
[40] Fix | Delete
name ## _ctx_new, \
[41] Fix | Delete
name ## _ctx_default, \
[42] Fix | Delete
name ## _ctx_free, \
[43] Fix | Delete
name ## _ctx_run, \
[44] Fix | Delete
name ## _ctx_run_once, \
[45] Fix | Delete
name ## _ctx_break, \
[46] Fix | Delete
name ## _ctx_reinitialize, \
[47] Fix | Delete
name ## _ctx_set_flags, \
[48] Fix | Delete
name ## _ctx_add, \
[49] Fix | Delete
name ## _ctx_del \
[50] Fix | Delete
}; \
[51] Fix | Delete
verto_module VERTO_MODULE_TABLE(name) = { \
[52] Fix | Delete
VERTO_MODULE_VERSION, \
[53] Fix | Delete
# name, \
[54] Fix | Delete
# symb, \
[55] Fix | Delete
types, \
[56] Fix | Delete
&name ## _funcs, \
[57] Fix | Delete
}; \
[58] Fix | Delete
verto_ctx * \
[59] Fix | Delete
verto_new_ ## name() \
[60] Fix | Delete
{ \
[61] Fix | Delete
return verto_convert(name, 0, NULL); \
[62] Fix | Delete
} \
[63] Fix | Delete
verto_ctx * \
[64] Fix | Delete
verto_default_ ## name() \
[65] Fix | Delete
{ \
[66] Fix | Delete
return verto_convert(name, 1, NULL); \
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
typedef struct {
[70] Fix | Delete
/* Required */ verto_mod_ctx *(*ctx_new)();
[71] Fix | Delete
/* Optional */ verto_mod_ctx *(*ctx_default)();
[72] Fix | Delete
/* Required */ void (*ctx_free)(verto_mod_ctx *ctx);
[73] Fix | Delete
/* Optional */ void (*ctx_run)(verto_mod_ctx *ctx);
[74] Fix | Delete
/* Required */ void (*ctx_run_once)(verto_mod_ctx *ctx);
[75] Fix | Delete
/* Optional */ void (*ctx_break)(verto_mod_ctx *ctx);
[76] Fix | Delete
/* Optional */ void (*ctx_reinitialize)(verto_mod_ctx *ctx);
[77] Fix | Delete
/* Optional */ void (*ctx_set_flags)(verto_mod_ctx *ctx,
[78] Fix | Delete
const verto_ev *ev,
[79] Fix | Delete
verto_mod_ev *modev);
[80] Fix | Delete
/* Required */ verto_mod_ev *(*ctx_add)(verto_mod_ctx *ctx,
[81] Fix | Delete
const verto_ev *ev,
[82] Fix | Delete
verto_ev_flag *flags);
[83] Fix | Delete
/* Required */ void (*ctx_del)(verto_mod_ctx *ctx,
[84] Fix | Delete
const verto_ev *ev,
[85] Fix | Delete
verto_mod_ev *modev);
[86] Fix | Delete
} verto_ctx_funcs;
[87] Fix | Delete
[88] Fix | Delete
typedef struct {
[89] Fix | Delete
unsigned int vers;
[90] Fix | Delete
const char *name;
[91] Fix | Delete
const char *symb;
[92] Fix | Delete
verto_ev_type types;
[93] Fix | Delete
verto_ctx_funcs *funcs;
[94] Fix | Delete
} verto_module;
[95] Fix | Delete
[96] Fix | Delete
/**
[97] Fix | Delete
* Converts an existing implementation specific loop to a verto_ctx.
[98] Fix | Delete
*
[99] Fix | Delete
* This function also sets the internal default implementation so that future
[100] Fix | Delete
* calls to verto_new(NULL) or verto_default(NULL) will use this specific
[101] Fix | Delete
* implementation if it was not already set.
[102] Fix | Delete
*
[103] Fix | Delete
* @param name The name of the module (unquoted)
[104] Fix | Delete
* @param deflt Whether the ctx is the default context or not
[105] Fix | Delete
* @param ctx The context to store
[106] Fix | Delete
* @return A new verto_ctx, or NULL on error. Call verto_free() when done.
[107] Fix | Delete
*/
[108] Fix | Delete
#define verto_convert(name, deflt, ctx) \
[109] Fix | Delete
verto_convert_module(&VERTO_MODULE_TABLE(name), deflt, ctx)
[110] Fix | Delete
[111] Fix | Delete
/**
[112] Fix | Delete
* Converts an existing implementation specific loop to a verto_ctx.
[113] Fix | Delete
*
[114] Fix | Delete
* If you are a module implementation, you probably want the macro above. This
[115] Fix | Delete
* function is generally used directly only when an application is attempting
[116] Fix | Delete
* to expose a home-grown event loop to verto.
[117] Fix | Delete
*
[118] Fix | Delete
* If deflt is non-zero and a default ctx was already defined for this module
[119] Fix | Delete
* and ctx is not NULL, than ctx will be free'd and the previously defined
[120] Fix | Delete
* default will be returned.
[121] Fix | Delete
*
[122] Fix | Delete
* If ctx is non-NULL, than the pre-existing verto_mod_ctx will be converted to
[123] Fix | Delete
* to a verto_ctx; if deflt is non-zero than this verto_mod_ctx will also be
[124] Fix | Delete
* marked as the default loop for this process. If ctx is NULL, than the
[125] Fix | Delete
* appropriate constructor will be called: either module->ctx_new() or
[126] Fix | Delete
* module->ctx_default() depending on the boolean value of deflt. If
[127] Fix | Delete
* module->ctx_default is NULL and deflt is non-zero, than module->ctx_new()
[128] Fix | Delete
* will be called and the resulting verto_mod_ctx will be utilized as the
[129] Fix | Delete
* default.
[130] Fix | Delete
*
[131] Fix | Delete
* This function also sets the internal default implementation so that future
[132] Fix | Delete
* calls to verto_new(NULL) or verto_default(NULL) will use this specific
[133] Fix | Delete
* implementation if it was not already set.
[134] Fix | Delete
*
[135] Fix | Delete
* @param name The name of the module (unquoted)
[136] Fix | Delete
* @param ctx The context private to store
[137] Fix | Delete
* @return A new verto_ctx, or NULL on error. Call verto_free() when done.
[138] Fix | Delete
*/
[139] Fix | Delete
verto_ctx *
[140] Fix | Delete
verto_convert_module(const verto_module *module, int deflt, verto_mod_ctx *ctx);
[141] Fix | Delete
[142] Fix | Delete
/**
[143] Fix | Delete
* Calls the callback of the verto_ev and then frees it via verto_del().
[144] Fix | Delete
*
[145] Fix | Delete
* The verto_ev is not freed (verto_del() is not called) if it is a signal event.
[146] Fix | Delete
*
[147] Fix | Delete
* @see verto_add_read()
[148] Fix | Delete
* @see verto_add_write()
[149] Fix | Delete
* @see verto_add_timeout()
[150] Fix | Delete
* @see verto_add_idle()
[151] Fix | Delete
* @see verto_add_signal()
[152] Fix | Delete
* @see verto_add_child()
[153] Fix | Delete
* @see verto_del()
[154] Fix | Delete
* @param ev The verto_ev
[155] Fix | Delete
*/
[156] Fix | Delete
void
[157] Fix | Delete
verto_fire(verto_ev *ev);
[158] Fix | Delete
[159] Fix | Delete
/**
[160] Fix | Delete
* Sets the status of the pid/handle which caused this event to fire.
[161] Fix | Delete
*
[162] Fix | Delete
* This function does nothing if the verto_ev is not a child type.
[163] Fix | Delete
*
[164] Fix | Delete
* @see verto_add_child()
[165] Fix | Delete
* @param ev The verto_ev to set the status in.
[166] Fix | Delete
* @param status The pid/handle status.
[167] Fix | Delete
*/
[168] Fix | Delete
void
[169] Fix | Delete
verto_set_proc_status(verto_ev *ev, verto_proc_status status);
[170] Fix | Delete
[171] Fix | Delete
/**
[172] Fix | Delete
* Sets the state of the fd which caused this event to fire.
[173] Fix | Delete
*
[174] Fix | Delete
* This function does nothing if the verto_ev is not a io type.
[175] Fix | Delete
*
[176] Fix | Delete
* Only the flags VERTO_EV_FLAG_IO_(READ|WRITE|ERROR) are supported. All other
[177] Fix | Delete
* flags are unset.
[178] Fix | Delete
*
[179] Fix | Delete
* @see verto_add_io()
[180] Fix | Delete
* @param ev The verto_ev to set the state in.
[181] Fix | Delete
* @param state The fd state.
[182] Fix | Delete
*/
[183] Fix | Delete
void
[184] Fix | Delete
verto_set_fd_state(verto_ev *ev, verto_ev_flag state);
[185] Fix | Delete
[186] Fix | Delete
#endif /* VERTO_MODULE_H_ */
[187] Fix | Delete
[188] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function