Beispiel #1
0
const char *
    zyre_event_header (zyre_event_t *self, const char *name);

// Returns the group name that a SHOUT event was sent to
const char *
    zyre_event_group (zyre_event_t *self);

// Returns the incoming message payload; the caller can modify the
// message but does not own it and should not destroy it.         
zmsg_t *
    zyre_event_msg (zyre_event_t *self);

// Returns the incoming message payload, and pass ownership to the   
// caller. The caller must destroy the message when finished with it.
// After called on the given event, further calls will return NULL.  
zmsg_t *
    zyre_event_get_msg (zyre_event_t *self);

// Print event to zsys log
void
    zyre_event_print (zyre_event_t *self);

// Self test of this class.
void
    zyre_event_test (bool verbose);

'''
cdefs = re.sub(r';[^;]*\bva_list\b[^;]*;', ';', cdefs, flags=re.S) # we don't support anything with a va_list arg

ffi.cdef(cdefs)
Beispiel #2
0
// Set the sender field
void
    xrap_traffic_set_sender (xrap_traffic_t *self, zuuid_t *sender_p);

// Get the status_code field
uint16_t
    xrap_traffic_status_code (xrap_traffic_t *self);

// Set the status_code field
void
    xrap_traffic_set_status_code (xrap_traffic_t *self, uint16_t status_code);

// Get the status_reason field
const char *
    xrap_traffic_status_reason (xrap_traffic_t *self);

// Set the status_reason field
void
    xrap_traffic_set_status_reason (xrap_traffic_t *self, const char *status_reason);

// Self test of this class.
void
    xrap_traffic_test (bool verbose);

'''
cdefs = re.sub(r';[^;]*\bva_list\b[^;]*;', ';', cdefs,
               flags=re.S)  # we don't support anything with a va_list arg

ffi.cdef(cdefs)
Beispiel #3
0
            libpath = 'libmlm.0.dylib'
        else:
            libpath = 'libmlm.so.0'
    elif os.name == 'nt':
        libpath = 'libmlm.dll'
    lib = ffi.dlopen(libpath)
except OSError:
    libpath = find_library("malamute")
    if not libpath:
        raise ImportError("Unable to find libmlm")
    lib = ffi.dlopen(libpath)

# Custom setup for malamute
ffi.cdef('''
typedef struct _zactor_t zactor_t;
typedef struct _zsock_t zsock_t;
typedef struct _zmsg_t zmsg_t;
''')


cdefs = '''
typedef struct _mlm_proto_t mlm_proto_t;
typedef struct _zsock_t zsock_t;
typedef struct _zframe_t zframe_t;
typedef struct _zmsg_t zmsg_t;
typedef struct _mlm_client_t mlm_client_t;
typedef struct _zactor_t zactor_t;
// CLASS: mlm_proto
// Create a new empty mlm_proto
MLM_EXPORT mlm_proto_t *
    mlm_proto_new (void);
Beispiel #4
0
@cdef('int zmq_socket_monitor (void *s, const char *addr, int events);')
def socket_monitor(sock, addr, events):
    return Z.zmq_socket_monitor(sock, addr, events)


@cdef('int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags);')
def sendmsg(sock, msg, flags):
    return Z.zmq_sendmsg(sock, msg, flags)


@cdef('int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags);')
def recvmsg(sock, msg, flags):
    return Z.zmq_recvmsg(sock, msg, flags)


ffi.cdef('struct iovec;')
ffi.cdef(
    'int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags);')
ffi.cdef(
    'int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags);')

# TODO:mp Windoze
ffi.cdef('''
typedef struct
{
    void *socket;
    int fd;
    short events;
    short revents;
} zmq_pollitem_t;
''')
Beispiel #5
0
_ffi.cdef('''

/*  =========================================================================
    zsockopt - get/set 0MQ socket options

            ****************************************************
            *   GENERATED SOURCE CODE, DO NOT EDIT!!           *
            *   TO CHANGE THIS, EDIT scripts/sockopts.gsl      *
            *   AND RUN ./generate in models/.                 *
            ****************************************************
    -------------------------------------------------------------------------
    Copyright (c) 1991-2013 iMatix Corporation <www.imatix.com>
    Copyright other contributors as noted in the AUTHORS file.

    This file is part of CZMQ, the high-level C binding for 0MQ:
    http://czmq.zeromq.org.

    This is free software; you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License as published by the 
    Free Software Foundation; either version 3 of the License, or (at your 
    option) any later version.

    This software is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABIL-
    ITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 
    Public License for more details.

    You should have received a copy of the GNU Lesser General Public License 
    along with this program. If not, see <http://www.gnu.org/licenses/>.
    =========================================================================
*/

 int zsocket_ipv6 (void *zocket);
 int zsocket_ipv4only (void *zocket);
 int zsocket_probe_router (void *zocket);
 int zsocket_plain_server (void *zocket);
 char * zsocket_plain_username (void *zocket);
 char * zsocket_plain_password (void *zocket);
 int zsocket_curve_server (void *zocket);
 char * zsocket_curve_publickey (void *zocket);
 char * zsocket_curve_secretkey (void *zocket);
 char * zsocket_curve_serverkey (void *zocket);
 char * zsocket_zap_domain (void *zocket);
 int zsocket_type (void *zocket);
 int zsocket_sndhwm (void *zocket);
 int zsocket_rcvhwm (void *zocket);
 int zsocket_affinity (void *zocket);
 char * zsocket_identity (void *zocket);
 int zsocket_rate (void *zocket);
 int zsocket_recovery_ivl (void *zocket);
 int zsocket_sndbuf (void *zocket);
 int zsocket_rcvbuf (void *zocket);
 int zsocket_linger (void *zocket);
 int zsocket_reconnect_ivl (void *zocket);
 int zsocket_reconnect_ivl_max (void *zocket);
 int zsocket_backlog (void *zocket);
 int zsocket_maxmsgsize (void *zocket);
 int zsocket_multicast_hops (void *zocket);
 int zsocket_rcvtimeo (void *zocket);
 int zsocket_sndtimeo (void *zocket);
 int zsocket_tcp_keepalive (void *zocket);
 int zsocket_tcp_keepalive_idle (void *zocket);
 int zsocket_tcp_keepalive_cnt (void *zocket);
 int zsocket_tcp_keepalive_intvl (void *zocket);
 char * zsocket_tcp_accept_filter (void *zocket);
 int zsocket_rcvmore (void *zocket);
 int zsocket_fd (void *zocket);
 int zsocket_events (void *zocket);
 char * zsocket_last_endpoint (void *zocket);

//  Set socket options
 void zsocket_set_ipv6 (void *zocket, int ipv6);
 void zsocket_set_immediate (void *zocket, int immediate);
 void zsocket_set_router_raw (void *zocket, int router_raw);
 void zsocket_set_ipv4only (void *zocket, int ipv4only);
 void zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect);
 void zsocket_set_router_mandatory (void *zocket, int router_mandatory);
 void zsocket_set_req_relaxed (void *zocket, int req_relaxed);
 void zsocket_set_req_correlate (void *zocket, int req_correlate);
 void zsocket_set_conflate (void *zocket, int conflate);
 void zsocket_set_plain_server (void *zocket, int plain_server);
 void zsocket_set_plain_username (void *zocket, const char * plain_username);
 void zsocket_set_plain_password (void *zocket, const char * plain_password);
 void zsocket_set_curve_server (void *zocket, int curve_server);
 void zsocket_set_curve_publickey (void *zocket, const char * curve_publickey);
 void zsocket_set_curve_publickey_bin (void *zocket, const char *curve_publickey);
 void zsocket_set_curve_secretkey (void *zocket, const char * curve_secretkey);
 void zsocket_set_curve_secretkey_bin (void *zocket, const char *curve_secretkey);
 void zsocket_set_curve_serverkey (void *zocket, const char * curve_serverkey);
 void zsocket_set_curve_serverkey_bin (void *zocket, const char *curve_serverkey);
 void zsocket_set_zap_domain (void *zocket, const char * zap_domain);
 void zsocket_set_sndhwm (void *zocket, int sndhwm);
 void zsocket_set_rcvhwm (void *zocket, int rcvhwm);
 void zsocket_set_affinity (void *zocket, int affinity);
 void zsocket_set_subscribe (void *zocket, const char * subscribe);
 void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe);
 void zsocket_set_identity (void *zocket, const char * identity);
 void zsocket_set_rate (void *zocket, int rate);
 void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl);
 void zsocket_set_sndbuf (void *zocket, int sndbuf);
 void zsocket_set_rcvbuf (void *zocket, int rcvbuf);
 void zsocket_set_linger (void *zocket, int linger);
 void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl);
 void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max);
 void zsocket_set_backlog (void *zocket, int backlog);
 void zsocket_set_maxmsgsize (void *zocket, int maxmsgsize);
 void zsocket_set_multicast_hops (void *zocket, int multicast_hops);
 void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo);
 void zsocket_set_sndtimeo (void *zocket, int sndtimeo);
 void zsocket_set_xpub_verbose (void *zocket, int xpub_verbose);
 void zsocket_set_tcp_keepalive (void *zocket, int tcp_keepalive);
 void zsocket_set_tcp_keepalive_idle (void *zocket, int tcp_keepalive_idle);
 void zsocket_set_tcp_keepalive_cnt (void *zocket, int tcp_keepalive_cnt);
 void zsocket_set_tcp_keepalive_intvl (void *zocket, int tcp_keepalive_intvl);
 void zsocket_set_tcp_accept_filter (void *zocket, const char * tcp_accept_filter);

//  Emulation of widely-used 2.x socket options
 void zsocket_set_hwm (void *zocket, int hwm);

int zsockopt_test (bool verbose);
''')
Beispiel #6
0
@cdef('int zmq_socket_monitor (void *s, const char *addr, int events);')
def socket_monitor(sock, addr, events):
    return Z.zmq_socket_monitor(sock, addr, events)


@cdef('int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags);')
def sendmsg(sock, msg, flags):
    return Z.zmq_sendmsg(sock, msg, flags)


@cdef('int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags);')
def recvmsg(sock, msg, flags):
    return Z.zmq_recvmsg(sock, msg, flags)


ffi.cdef('struct iovec;')
ffi.cdef('int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags);')
ffi.cdef('int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags);')


# TODO:mp Windoze
ffi.cdef('''
typedef struct
{
    void *socket;
    int fd;
    short events;
    short revents;
} zmq_pollitem_t;
''')
Beispiel #7
0
            libpath = 'libmlm.0.dylib'
        else:
            libpath = 'libmlm.so.0'
    elif os.name == 'nt':
        libpath = 'libmlm.dll'
    lib = ffi.dlopen(libpath)
except OSError:
    libpath = find_library("malamute")
    if not libpath:
        raise ImportError("Unable to find libmlm")
    lib = ffi.dlopen(libpath)

# Custom setup for malamute
ffi.cdef('''
typedef struct _zactor_t zactor_t;
typedef struct _zsock_t zsock_t;
typedef struct _zmsg_t zmsg_t;
''')

cdefs = '''
typedef struct _mlm_proto_t mlm_proto_t;
typedef struct _zsock_t zsock_t;
typedef struct _zframe_t zframe_t;
typedef struct _zmsg_t zmsg_t;
typedef struct _mlm_client_t mlm_client_t;
typedef struct _zactor_t zactor_t;
// CLASS: mlm_proto
// Create a new empty mlm_proto
MLM_EXPORT mlm_proto_t *
    mlm_proto_new (void);