예제 #1
0
파일: vtx_tcp.c 프로젝트: imatix/vtx
static vocket_t *
vocket_new (driver_t *driver, int socktype, char *vtxname)
{
    assert (driver);
    vocket_t *self = (vocket_t *) zmalloc (sizeof (vocket_t));

    self->driver = driver;
    self->vtxname = strdup (vtxname);
    self->binding_hash = zhash_new ();
    self->peering_hash = zhash_new ();
    self->peering_list = zlist_new ();
    self->live_peerings = zlist_new ();
    self->socktype = socktype;

    uint index;
    for (index = 0; index < tblsize (s_vocket_config); index++)
        if (socktype == s_vocket_config [index].socktype)
            break;

    if (index < tblsize (s_vocket_config)) {
        self->routing = s_vocket_config [index].routing;
        self->nomnom = s_vocket_config [index].nomnom;
        self->min_peerings = s_vocket_config [index].min_peerings;
        self->max_peerings = s_vocket_config [index].max_peerings;
    }
    else {
        zclock_log ("E: invalid vocket type %d", socktype);
        exit (1);
    }
    //  Create msgpipe vocket and connect over inproc to vtxname
    self->msgpipe = zsocket_new (driver->ctx, ZMQ_PAIR);
    assert (self->msgpipe);
    zsocket_connect (self->msgpipe, "inproc://%s", vtxname);

    //  If we drop on no peerings, start routing input now
    if (self->min_peerings == 0) {
        //  Ask reactor to start monitoring vocket's msgpipe pipe
        zmq_pollitem_t item = { self->msgpipe, 0, ZMQ_POLLIN, 0 };
        zloop_poller (driver->loop, &item, s_vocket_input, self);
    }
    //  Store this vocket per driver so that driver can cleanly destroy
    //  all its vockets when it is destroyed.
    zlist_push (driver->vockets, self);

    //* Start transport-specific work
    self->inbuf_max = VTX_TCP_INBUF_MAX;
    self->outbuf_max = VTX_TCP_OUTBUF_MAX;
    //* End transport-specific work

    return self;
}
예제 #2
0
파일: tstnull.c 프로젝트: cookrn/openamq
static void
report_unrecognised_event_error (smt_thread_t *thread)
{
    int
        thread_type;
    smt_state_t
        state_id;
    smt_event_t
        event_id;
    smt_state_t
        nextstate_id;
    char
        num_buffer[8],
        *event_name_or_number;
        
    find_thread_state_next_state (&thread_type,
                                  &state_id,
                                  &event_id,
                                  &nextstate_id,
                                  thread);
    if (thread->_next_event >= 0
    &&  thread->_next_event <  tblsize (event_name))
        event_name_or_number = (char *) event_name[thread->_next_event];
    else {
        apr_snprintf (num_buffer, sizeof (num_buffer), "%u", (unsigned) thread->_next_event);
        event_name_or_number = num_buffer;
    }
    icl_console_print ("tstnull: Unrecognised event '%s' in '%s' thread number: %u, state: %s",
                       event_name_or_number,
                       thread_name [thread_type],
                       thread->id,
                       state_name  [state_id]);
    abort ();
}
예제 #3
0
파일: ggpcre.c 프로젝트: INNOAUS/gsl
    regexp_class = {
        "regexp",
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        regexp_functions, tblsize (regexp_functions) };


#include "../pcre/pcre.h"


static int
regexp_match (int argc, RESULT_NODE **argv, void *item, RESULT_NODE *result, THREAD *gsl_thread)
{
    RESULT_NODE *pattern = argc > 0 ? argv [0] : NULL;
    RESULT_NODE *subject = argc > 1 ? argv [1] : NULL;

    if (! pattern)
      {
        strcpy (object_error, "Missing argument: pattern");
        return -1;
예제 #4
0
파일: ggsock.c 프로젝트: INNOAUS/gsl
    sock_class = {
        "sock",
        NULL,
        sock_get_attr,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        sock_destroy,
        sock_link,
        NULL,
        NULL,
        NULL,
        NULL,
        sock_functions, tblsize (sock_functions) };

static GSL_FUNCTION sock_handle_functions [] =
{
    {"accept",         0, 2, 2, (void *) &parm_list_vr, 0, sock_handle_accept},
    {"close",          0, 2, 2, (void *) &parm_list_vr, 0, sock_handle_close},
    {"read",           1, 4, 4, (void *) &parm_list_rvvr, 0, sock_handle_read},
    {"write",          1, 3, 3, (void *) &parm_list_vvr, 0, sock_handle_write}};

CLASS_DESCRIPTOR
    sock_handle_class = {
        "sock handle",
        NULL,
        sock_handle_get_attr,
        NULL,
        NULL,
예제 #5
0
파일: ggconv.c 프로젝트: INNOAUS/gsl
    conv_class = {
        "conv",
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        conv_functions, tblsize (conv_functions) };



static int
conv_chr (int argc, RESULT_NODE **argv, void *item, RESULT_NODE *result, THREAD *gsl_thread)
{
    RESULT_NODE *arg     = argc > 0 ? argv [0] : NULL;

    if (! arg)
      {
        strcpy (object_error, "Missing argument: arg");
        return -1;
      }
    if (arg-> value. type == TYPE_UNDEFINED)
      {
예제 #6
0
파일: sflscrit.c 프로젝트: evoskuil/gsl
/*  toalpha -- local
    Converts the supplied ANSI character to an (approximate) alpha character
 */
static char
toalpha (char ansichar)
{
    static struct {
        int from;
        int to;
    }
    conversion [] = {
        { 192, 'A' },     /*  capital A grave                À  */
        { 193, 'A' },     /*  capital A acute                Á  */
        { 194, 'A' },     /*  capital A circumflex           Â  */
        { 195, 'A' },     /*  capital A tilde                Ã  */
        { 196, 'A' },     /*  capital A dieresis or umlaut   Ä  */
        { 197, 'A' },     /*  capital A ring                 Å  */
        { 198, 'A' },     /*  capital AE ligature            Æ  */
        { 199, 'C' },     /*  capital C cedilla              Ç  */
        { 200, 'E' },     /*  capital E grave                È  */
        { 201, 'E' },     /*  capital E acute                É  */
        { 202, 'E' },     /*  capital E circumflex           Ê  */
        { 203, 'E' },     /*  capital E dieresis or umlaut   Ë  */
        { 204, 'I' },     /*  capital I grave                Ì  */
        { 205, 'I' },     /*  capital I acute                Í  */
        { 206, 'I' },     /*  capital I circumflex           Î  */
        { 207, 'I' },     /*  capital I dieresis or umlaut   Ï  */
        { 208, 'O' },     /*  capital ETH                    Ð  */
        { 209, 'N' },     /*  capital N tilde                Ñ  */
        { 210, 'O' },     /*  capital O grave                Ò  */
        { 211, 'O' },     /*  capital O acute                Ó  */
        { 212, 'O' },     /*  capital O circumflex           Ô  */
        { 213, 'O' },     /*  capital O tilde                Õ  */
        { 214, 'O' },     /*  capital O dieresis or umlaut   Ö  */
        { 216, 'O' },     /*  capital O slash                Ø  */
        { 217, 'U' },     /*  capital U grave                Ù  */
        { 218, 'U' },     /*  capital U acute                Ú  */
        { 219, 'U' },     /*  capital U circumflex           Û  */
        { 220, 'U' },     /*  capital U dieresis or umlaut   Ü  */
        { 221, 'Y' },     /*  capital Y acute                Ý  */
        { 222, 'P' },     /*  capital THORN                  Þ  */
        { 223, 's' },     /*  small sharp s, sz ligature     ß  */
        { 224, 'a' },     /*  small a grave                  à  */
        { 225, 'a' },     /*  small a acute                  á  */
        { 226, 'a' },     /*  small a circumflex             â  */
        { 227, 'a' },     /*  small a tilde                  ã  */
        { 228, 'a' },     /*  small a dieresis or umlaut     ä  */
        { 229, 'a' },     /*  small a ring                   å  */
        { 230, 'a' },     /*  small ae ligature              æ  */
        { 231, 'c' },     /*  small c cedilla                ç  */
        { 232, 'e' },     /*  small e grave                  è  */
        { 233, 'e' },     /*  small e acute                  é  */
        { 234, 'e' },     /*  small e circumflex             ê  */
        { 235, 'e' },     /*  small e dieresis or umlaut     ë  */
        { 236, 'i' },     /*  small i grave                  ì  */
        { 237, 'i' },     /*  small i acute                  í  */
        { 238, 'i' },     /*  small i circumflex             î  */
        { 239, 'i' },     /*  small i dieresis or umlaut     ï  */
        { 240, 'o' },     /*  small eth                      ð  */
        { 241, 'n' },     /*  small n tilde                  ñ  */
        { 242, 'o' },     /*  small o grave                  ò  */
        { 243, 'o' },     /*  small o acute                  ó  */
        { 244, 'o' },     /*  small o circumflex             ô  */
        { 245, 'o' },     /*  small o tilde                  õ  */
        { 246, 'o' },     /*  small o dieresis or umlaut     ö  */
        { 248, 'o' },     /*  small o slash                  ø  */
        { 249, 'u' },     /*  small u grave                  ù  */
        { 250, 'u' },     /*  small u acute                  ú  */
        { 251, 'u' },     /*  small u circumflex             û  */
        { 252, 'u' },     /*  small u dieresis or umlaut     ü  */
        { 253, 'y' },     /*  small y acute                  ý  */
        { 254, 'p' },     /*  small thorn                    þ  */
        { 255, 'y' }      /*  small y dieresis or umlaut     ÿ  */
    };
    static int
        table [256];
    static Bool
        initialized = FALSE;
    int
        index;

    if (!initialized) {
        /*  Default translation is from character to itself                  */
        for (index = 0; index < 256; index++)
            table [index] = index;
        /*  Now punch in our conversions                                     */
        for (index = 0; index < tblsize (conversion); index++)
            table [conversion [index].from] = (unsigned int) conversion [index].to;
        initialized = TRUE;
    }
    return ((char) table [(byte) ansichar]);
}
예제 #7
0
파일: ggfunc.c 프로젝트: imatix-legacy/iaf
int register_inbuilt_functions (void)
{
    return object_register (NULL, gsl_functions, tblsize (gsl_functions));
}