Sha256: d804b786a1f1a767353f1484be1d8a547d6fb658c64ce307d26a9a27cbd0775e

Contents?: true

Size: 1.34 KB

Versions: 10

Compression:

Stored size: 1.34 KB

Contents

#ifndef RBCZMQ_MESSAGE_H
#define RBCZMQ_MESSAGE_H

/* This flag indicates that the wrapped zmsg_t is owned by ruby
   and can be freed when the ZMQ::Message object is garbage collected */
#define ZMQ_MESSAGE_OWNED 0x01

typedef struct {
    zmsg_t  *message;
    int flags;
    /* a zlist of frame wrapper objects for the frames in this message */
    zlist_t *frames;
} zmq_message_wrapper;

#define ZmqAssertMessage(obj) ZmqAssertType(obj, rb_cZmqMessage, "ZMQ::Message")
#define ZmqGetMessage(obj) \
    zmq_message_wrapper *message = NULL; \
    ZmqAssertMessage(obj); \
    Data_Get_Struct(obj, zmq_message_wrapper, message); \
    if (!message) rb_raise(rb_eTypeError, "uninitialized ZMQ message!");

    /*
    if (message->flags & ZMQ_MESSAGE_DESTROYED) rb_raise(rb_eZmqError, "ZMQ::Message instance %p has been destroyed by the ZMQ framework", (void *)obj);
    */

#define ZmqReturnNilUnlessOwned(wrapper) if (wrapper && (wrapper->flags & ZMQ_MESSAGE_OWNED) == 0) { \
    return Qnil; \
}

#define ZmqAssertMessageOwned(wrapper) if (wrapper && (wrapper->flags & ZMQ_MESSAGE_OWNED) == 0) { \
    rb_raise(rb_eTypeError, "Cannot modify a message that is gone."); \
}

VALUE rb_czmq_alloc_message(zmsg_t *message);
void rb_czmq_free_message(zmq_message_wrapper *message);
void rb_czmq_mark_message(zmq_message_wrapper *message);

void _init_rb_czmq_message();

#endif

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rbczmq-1.7.9 ext/rbczmq/message.h
rbczmq-1.7.8 ext/rbczmq/message.h
rbczmq-1.7.7 ext/rbczmq/message.h
rbczmq-1.7.6 ext/rbczmq/message.h
rbczmq-1.7.5 ext/rbczmq/message.h
rbczmq-1.7.4 ext/rbczmq/message.h
rbczmq-1.7.3 ext/rbczmq/message.h
rbczmq-1.7.2 ext/rbczmq/message.h
rbczmq-1.7.1 ext/rbczmq/message.h
rbczmq-1.7.0 ext/rbczmq/message.h