msg.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #include "precompiled.hpp"
4 #include "compat.hpp"
5 #include "macros.hpp"
6 #include "msg.hpp"
7 
8 #include <string.h>
9 #include <stdlib.h>
10 #include <new>
11 
12 #include "stdint.hpp"
13 #include "likely.hpp"
14 #include "metadata.hpp"
15 #include "err.hpp"
16 
17 // Check whether the sizes of public representation of the message (zmq_msg_t)
18 // and private representation of the message (zmq::msg_t) match.
19 
20 typedef char
21  zmq_msg_size_check[2 * ((sizeof (zmq::msg_t) == sizeof (zmq_msg_t)) != 0)
22  - 1];
23 
24 bool zmq::msg_t::check () const
25 {
26  return _u.base.type >= type_min && _u.base.type <= type_max;
27 }
28 
30  size_t size_,
31  msg_free_fn *ffn_,
32  void *hint_,
33  content_t *content_)
34 {
35  if (size_ <= max_vsm_size) {
36  const int rc = init_size (size_);
37 
38  if (rc != -1) {
39  memcpy (data (), data_, size_);
40  return 0;
41  }
42  return -1;
43  }
44  if (content_) {
45  return init_external_storage (content_, data_, size_, ffn_, hint_);
46  }
47  return init_data (data_, size_, ffn_, hint_);
48 }
49 
51 {
52  _u.vsm.metadata = NULL;
53  _u.vsm.type = type_vsm;
54  _u.vsm.flags = 0;
55  _u.vsm.size = 0;
56  _u.vsm.group.sgroup.group[0] = '\0';
57  _u.vsm.group.type = group_type_short;
58  _u.vsm.routing_id = 0;
59  return 0;
60 }
61 
62 int zmq::msg_t::init_size (size_t size_)
63 {
64  if (size_ <= max_vsm_size) {
65  _u.vsm.metadata = NULL;
66  _u.vsm.type = type_vsm;
67  _u.vsm.flags = 0;
68  _u.vsm.size = static_cast<unsigned char> (size_);
69  _u.vsm.group.sgroup.group[0] = '\0';
70  _u.vsm.group.type = group_type_short;
71  _u.vsm.routing_id = 0;
72  } else {
73  _u.lmsg.metadata = NULL;
74  _u.lmsg.type = type_lmsg;
75  _u.lmsg.flags = 0;
76  _u.lmsg.group.sgroup.group[0] = '\0';
77  _u.lmsg.group.type = group_type_short;
78  _u.lmsg.routing_id = 0;
79  _u.lmsg.content = NULL;
80  if (sizeof (content_t) + size_ > size_)
81  _u.lmsg.content =
82  static_cast<content_t *> (malloc (sizeof (content_t) + size_));
83  if (unlikely (!_u.lmsg.content)) {
84  errno = ENOMEM;
85  return -1;
86  }
87 
88  _u.lmsg.content->data = _u.lmsg.content + 1;
89  _u.lmsg.content->size = size_;
90  _u.lmsg.content->ffn = NULL;
91  _u.lmsg.content->hint = NULL;
92  new (&_u.lmsg.content->refcnt) zmq::atomic_counter_t ();
93  }
94  return 0;
95 }
96 
97 int zmq::msg_t::init_buffer (const void *buf_, size_t size_)
98 {
99  const int rc = init_size (size_);
100  if (unlikely (rc < 0)) {
101  return -1;
102  }
103  if (size_) {
104  // NULL and zero size is allowed
105  assert (NULL != buf_);
106  memcpy (data (), buf_, size_);
107  }
108  return 0;
109 }
110 
112  void *data_,
113  size_t size_,
114  msg_free_fn *ffn_,
115  void *hint_)
116 {
117  zmq_assert (NULL != data_);
118  zmq_assert (NULL != content_);
119 
120  _u.zclmsg.metadata = NULL;
121  _u.zclmsg.type = type_zclmsg;
122  _u.zclmsg.flags = 0;
123  _u.zclmsg.group.sgroup.group[0] = '\0';
124  _u.zclmsg.group.type = group_type_short;
125  _u.zclmsg.routing_id = 0;
126 
127  _u.zclmsg.content = content_;
128  _u.zclmsg.content->data = data_;
129  _u.zclmsg.content->size = size_;
130  _u.zclmsg.content->ffn = ffn_;
131  _u.zclmsg.content->hint = hint_;
132  new (&_u.zclmsg.content->refcnt) zmq::atomic_counter_t ();
133 
134  return 0;
135 }
136 
138  size_t size_,
139  msg_free_fn *ffn_,
140  void *hint_)
141 {
142  // If data is NULL and size is not 0, a segfault
143  // would occur once the data is accessed
144  zmq_assert (data_ != NULL || size_ == 0);
145 
146  // Initialize constant message if there's no need to deallocate
147  if (ffn_ == NULL) {
148  _u.cmsg.metadata = NULL;
149  _u.cmsg.type = type_cmsg;
150  _u.cmsg.flags = 0;
151  _u.cmsg.data = data_;
152  _u.cmsg.size = size_;
153  _u.cmsg.group.sgroup.group[0] = '\0';
154  _u.cmsg.group.type = group_type_short;
155  _u.cmsg.routing_id = 0;
156  } else {
157  _u.lmsg.metadata = NULL;
158  _u.lmsg.type = type_lmsg;
159  _u.lmsg.flags = 0;
160  _u.lmsg.group.sgroup.group[0] = '\0';
161  _u.lmsg.group.type = group_type_short;
162  _u.lmsg.routing_id = 0;
163  _u.lmsg.content =
164  static_cast<content_t *> (malloc (sizeof (content_t)));
165  if (!_u.lmsg.content) {
166  errno = ENOMEM;
167  return -1;
168  }
169 
170  _u.lmsg.content->data = data_;
171  _u.lmsg.content->size = size_;
172  _u.lmsg.content->ffn = ffn_;
173  _u.lmsg.content->hint = hint_;
174  new (&_u.lmsg.content->refcnt) zmq::atomic_counter_t ();
175  }
176  return 0;
177 }
178 
180 {
181  _u.delimiter.metadata = NULL;
182  _u.delimiter.type = type_delimiter;
183  _u.delimiter.flags = 0;
184  _u.delimiter.group.sgroup.group[0] = '\0';
185  _u.delimiter.group.type = group_type_short;
186  _u.delimiter.routing_id = 0;
187  return 0;
188 }
189 
191 {
192  _u.base.metadata = NULL;
193  _u.base.type = type_join;
194  _u.base.flags = 0;
195  _u.base.group.sgroup.group[0] = '\0';
196  _u.base.group.type = group_type_short;
197  _u.base.routing_id = 0;
198  return 0;
199 }
200 
202 {
203  _u.base.metadata = NULL;
204  _u.base.type = type_leave;
205  _u.base.flags = 0;
206  _u.base.group.sgroup.group[0] = '\0';
207  _u.base.group.type = group_type_short;
208  _u.base.routing_id = 0;
209  return 0;
210 }
211 
212 int zmq::msg_t::init_subscribe (const size_t size_, const unsigned char *topic_)
213 {
214  int rc = init_size (size_);
215  if (rc == 0) {
216  set_flags (zmq::msg_t::subscribe);
217 
218  // We explicitly allow a NULL subscription with size zero
219  if (size_) {
220  assert (topic_);
221  memcpy (data (), topic_, size_);
222  }
223  }
224  return rc;
225 }
226 
227 int zmq::msg_t::init_cancel (const size_t size_, const unsigned char *topic_)
228 {
229  int rc = init_size (size_);
230  if (rc == 0) {
231  set_flags (zmq::msg_t::cancel);
232 
233  // We explicitly allow a NULL subscription with size zero
234  if (size_) {
235  assert (topic_);
236  memcpy (data (), topic_, size_);
237  }
238  }
239  return rc;
240 }
241 
243 {
244  // Check the validity of the message.
245  if (unlikely (!check ())) {
246  errno = EFAULT;
247  return -1;
248  }
249 
250  if (_u.base.type == type_lmsg) {
251  // If the content is not shared, or if it is shared and the reference
252  // count has dropped to zero, deallocate it.
253  if (!(_u.lmsg.flags & msg_t::shared)
254  || !_u.lmsg.content->refcnt.sub (1)) {
255  // We used "placement new" operator to initialize the reference
256  // counter so we call the destructor explicitly now.
257  _u.lmsg.content->refcnt.~atomic_counter_t ();
258 
259  if (_u.lmsg.content->ffn)
260  _u.lmsg.content->ffn (_u.lmsg.content->data,
261  _u.lmsg.content->hint);
262  free (_u.lmsg.content);
263  }
264  }
265 
266  if (is_zcmsg ()) {
267  zmq_assert (_u.zclmsg.content->ffn);
268 
269  // If the content is not shared, or if it is shared and the reference
270  // count has dropped to zero, deallocate it.
271  if (!(_u.zclmsg.flags & msg_t::shared)
272  || !_u.zclmsg.content->refcnt.sub (1)) {
273  // We used "placement new" operator to initialize the reference
274  // counter so we call the destructor explicitly now.
275  _u.zclmsg.content->refcnt.~atomic_counter_t ();
276 
277  _u.zclmsg.content->ffn (_u.zclmsg.content->data,
278  _u.zclmsg.content->hint);
279  }
280  }
281 
282  if (_u.base.metadata != NULL) {
283  if (_u.base.metadata->drop_ref ()) {
284  LIBZMQ_DELETE (_u.base.metadata);
285  }
286  _u.base.metadata = NULL;
287  }
288 
289  if (_u.base.group.type == group_type_long) {
290  if (!_u.base.group.lgroup.content->refcnt.sub (1)) {
291  // We used "placement new" operator to initialize the reference
292  // counter so we call the destructor explicitly now.
293  _u.base.group.lgroup.content->refcnt.~atomic_counter_t ();
294 
295  free (_u.base.group.lgroup.content);
296  }
297  }
298 
299  // Make the message invalid.
300  _u.base.type = 0;
301 
302  return 0;
303 }
304 
306 {
307  // Check the validity of the source.
308  if (unlikely (!src_.check ())) {
309  errno = EFAULT;
310  return -1;
311  }
312 
313  int rc = close ();
314  if (unlikely (rc < 0))
315  return rc;
316 
317  *this = src_;
318 
319  rc = src_.init ();
320  if (unlikely (rc < 0))
321  return rc;
322 
323  return 0;
324 }
325 
327 {
328  // Check the validity of the source.
329  if (unlikely (!src_.check ())) {
330  errno = EFAULT;
331  return -1;
332  }
333 
334  const int rc = close ();
335  if (unlikely (rc < 0))
336  return rc;
337 
338  // The initial reference count, when a non-shared message is initially
339  // shared (between the original and the copy we create here).
340  const atomic_counter_t::integer_t initial_shared_refcnt = 2;
341 
342  if (src_.is_lmsg () || src_.is_zcmsg ()) {
343  // One reference is added to shared messages. Non-shared messages
344  // are turned into shared messages.
345  if (src_.flags () & msg_t::shared)
346  src_.refcnt ()->add (1);
347  else {
348  src_.set_flags (msg_t::shared);
349  src_.refcnt ()->set (initial_shared_refcnt);
350  }
351  }
352 
353  if (src_._u.base.metadata != NULL)
354  src_._u.base.metadata->add_ref ();
355 
356  if (src_._u.base.group.type == group_type_long)
357  src_._u.base.group.lgroup.content->refcnt.add (1);
358 
359  *this = src_;
360 
361  return 0;
362 }
363 
364 void *zmq::msg_t::data ()
365 {
366  // Check the validity of the message.
367  zmq_assert (check ());
368 
369  switch (_u.base.type) {
370  case type_vsm:
371  return _u.vsm.data;
372  case type_lmsg:
373  return _u.lmsg.content->data;
374  case type_cmsg:
375  return _u.cmsg.data;
376  case type_zclmsg:
377  return _u.zclmsg.content->data;
378  default:
379  zmq_assert (false);
380  return NULL;
381  }
382 }
383 
384 size_t zmq::msg_t::size () const
385 {
386  // Check the validity of the message.
387  zmq_assert (check ());
388 
389  switch (_u.base.type) {
390  case type_vsm:
391  return _u.vsm.size;
392  case type_lmsg:
393  return _u.lmsg.content->size;
394  case type_zclmsg:
395  return _u.zclmsg.content->size;
396  case type_cmsg:
397  return _u.cmsg.size;
398  default:
399  zmq_assert (false);
400  return 0;
401  }
402 }
403 
404 void zmq::msg_t::shrink (size_t new_size_)
405 {
406  // Check the validity of the message.
407  zmq_assert (check ());
408  zmq_assert (new_size_ <= size ());
409 
410  switch (_u.base.type) {
411  case type_vsm:
412  _u.vsm.size = static_cast<unsigned char> (new_size_);
413  break;
414  case type_lmsg:
415  _u.lmsg.content->size = new_size_;
416  break;
417  case type_zclmsg:
418  _u.zclmsg.content->size = new_size_;
419  break;
420  case type_cmsg:
421  _u.cmsg.size = new_size_;
422  break;
423  default:
424  zmq_assert (false);
425  }
426 }
427 
428 unsigned char zmq::msg_t::flags () const
429 {
430  return _u.base.flags;
431 }
432 
433 void zmq::msg_t::set_flags (unsigned char flags_)
434 {
435  _u.base.flags |= flags_;
436 }
437 
438 void zmq::msg_t::reset_flags (unsigned char flags_)
439 {
440  _u.base.flags &= ~flags_;
441 }
442 
444 {
445  return _u.base.metadata;
446 }
447 
449 {
450  assert (metadata_ != NULL);
451  assert (_u.base.metadata == NULL);
452  metadata_->add_ref ();
453  _u.base.metadata = metadata_;
454 }
455 
457 {
458  if (_u.base.metadata) {
459  if (_u.base.metadata->drop_ref ()) {
460  LIBZMQ_DELETE (_u.base.metadata);
461  }
462  _u.base.metadata = NULL;
463  }
464 }
465 
467 {
468  return (_u.base.flags & routing_id) == routing_id;
469 }
470 
472 {
473  return (_u.base.flags & credential) == credential;
474 }
475 
477 {
478  return _u.base.type == type_delimiter;
479 }
480 
481 bool zmq::msg_t::is_vsm () const
482 {
483  return _u.base.type == type_vsm;
484 }
485 
486 bool zmq::msg_t::is_cmsg () const
487 {
488  return _u.base.type == type_cmsg;
489 }
490 
491 bool zmq::msg_t::is_lmsg () const
492 {
493  return _u.base.type == type_lmsg;
494 }
495 
496 bool zmq::msg_t::is_zcmsg () const
497 {
498  return _u.base.type == type_zclmsg;
499 }
500 
501 bool zmq::msg_t::is_join () const
502 {
503  return _u.base.type == type_join;
504 }
505 
506 bool zmq::msg_t::is_leave () const
507 {
508  return _u.base.type == type_leave;
509 }
510 
511 bool zmq::msg_t::is_ping () const
512 {
513  return (_u.base.flags & CMD_TYPE_MASK) == ping;
514 }
515 
516 bool zmq::msg_t::is_pong () const
517 {
518  return (_u.base.flags & CMD_TYPE_MASK) == pong;
519 }
520 
522 {
523  return (_u.base.flags & CMD_TYPE_MASK) == close_cmd;
524 }
525 
527 {
528  if (this->is_ping () || this->is_pong ())
529  return this->size () - ping_cmd_name_size;
530  else if (!(this->flags () & msg_t::command)
531  && (this->is_subscribe () || this->is_cancel ()))
532  return this->size ();
533  else if (this->is_subscribe ())
534  return this->size () - sub_cmd_name_size;
535  else if (this->is_cancel ())
536  return this->size () - cancel_cmd_name_size;
537 
538  return 0;
539 }
540 
542 {
543  unsigned char *data = NULL;
544 
545  if (this->is_ping () || this->is_pong ())
546  data =
547  static_cast<unsigned char *> (this->data ()) + ping_cmd_name_size;
548  // With inproc, command flag is not set for sub/cancel
549  else if (!(this->flags () & msg_t::command)
550  && (this->is_subscribe () || this->is_cancel ()))
551  data = static_cast<unsigned char *> (this->data ());
552  else if (this->is_subscribe ())
553  data = static_cast<unsigned char *> (this->data ()) + sub_cmd_name_size;
554  else if (this->is_cancel ())
555  data =
556  static_cast<unsigned char *> (this->data ()) + cancel_cmd_name_size;
557 
558  return data;
559 }
560 
561 void zmq::msg_t::add_refs (int refs_)
562 {
563  zmq_assert (refs_ >= 0);
564 
565  // Operation not supported for messages with metadata.
566  zmq_assert (_u.base.metadata == NULL);
567 
568  // No copies required.
569  if (!refs_)
570  return;
571 
572  // VSMs, CMSGS and delimiters can be copied straight away. The only
573  // message type that needs special care are long messages.
574  if (_u.base.type == type_lmsg || is_zcmsg ()) {
575  if (_u.base.flags & msg_t::shared)
576  refcnt ()->add (refs_);
577  else {
578  refcnt ()->set (refs_ + 1);
579  _u.base.flags |= msg_t::shared;
580  }
581  }
582 }
583 
584 bool zmq::msg_t::rm_refs (int refs_)
585 {
586  zmq_assert (refs_ >= 0);
587 
588  // Operation not supported for messages with metadata.
589  zmq_assert (_u.base.metadata == NULL);
590 
591  // No copies required.
592  if (!refs_)
593  return true;
594 
595  // If there's only one reference close the message.
596  if ((_u.base.type != type_zclmsg && _u.base.type != type_lmsg)
597  || !(_u.base.flags & msg_t::shared)) {
598  close ();
599  return false;
600  }
601 
602  // The only message type that needs special care are long and zcopy messages.
603  if (_u.base.type == type_lmsg && !_u.lmsg.content->refcnt.sub (refs_)) {
604  // We used "placement new" operator to initialize the reference
605  // counter so we call the destructor explicitly now.
606  _u.lmsg.content->refcnt.~atomic_counter_t ();
607 
608  if (_u.lmsg.content->ffn)
609  _u.lmsg.content->ffn (_u.lmsg.content->data, _u.lmsg.content->hint);
610  free (_u.lmsg.content);
611 
612  return false;
613  }
614 
615  if (is_zcmsg () && !_u.zclmsg.content->refcnt.sub (refs_)) {
616  // storage for rfcnt is provided externally
617  if (_u.zclmsg.content->ffn) {
618  _u.zclmsg.content->ffn (_u.zclmsg.content->data,
619  _u.zclmsg.content->hint);
620  }
621 
622  return false;
623  }
624 
625  return true;
626 }
627 
628 uint32_t zmq::msg_t::get_routing_id () const
629 {
630  return _u.base.routing_id;
631 }
632 
633 int zmq::msg_t::set_routing_id (uint32_t routing_id_)
634 {
635  if (routing_id_) {
636  _u.base.routing_id = routing_id_;
637  return 0;
638  }
639  errno = EINVAL;
640  return -1;
641 }
642 
644 {
645  _u.base.routing_id = 0;
646  return 0;
647 }
648 
649 const char *zmq::msg_t::group () const
650 {
651  if (_u.base.group.type == group_type_long)
652  return _u.base.group.lgroup.content->group;
653  return _u.base.group.sgroup.group;
654 }
655 
656 int zmq::msg_t::set_group (const char *group_)
657 {
658  size_t length = strnlen (group_, ZMQ_GROUP_MAX_LENGTH);
659 
660  return set_group (group_, length);
661 }
662 
663 int zmq::msg_t::set_group (const char *group_, size_t length_)
664 {
665  if (length_ > ZMQ_GROUP_MAX_LENGTH) {
666  errno = EINVAL;
667  return -1;
668  }
669 
670  if (length_ > 14) {
671  _u.base.group.lgroup.type = group_type_long;
672  _u.base.group.lgroup.content =
673  (long_group_t *) malloc (sizeof (long_group_t));
674  assert (_u.base.group.lgroup.content);
675  new (&_u.base.group.lgroup.content->refcnt) zmq::atomic_counter_t ();
676  _u.base.group.lgroup.content->refcnt.set (1);
677  strncpy (_u.base.group.lgroup.content->group, group_, length_);
678  _u.base.group.lgroup.content->group[length_] = '\0';
679  } else {
680  strncpy (_u.base.group.sgroup.group, group_, length_);
681  _u.base.group.sgroup.group[length_] = '\0';
682  }
683 
684  return 0;
685 }
686 
688 {
689  switch (_u.base.type) {
690  case type_lmsg:
691  return &_u.lmsg.content->refcnt;
692  case type_zclmsg:
693  return &_u.zclmsg.content->refcnt;
694  default:
695  zmq_assert (false);
696  return NULL;
697  }
698 }
zmq::msg_t::init_subscribe
int init_subscribe(const size_t size_, const unsigned char *topic)
Definition: msg.cpp:212
LIBZMQ_DELETE
#define LIBZMQ_DELETE(p_object)
Definition: macros.hpp:7
zmq::msg_t::command
@ command
Definition: msg.hpp:56
zmq::msg_t::is_leave
bool is_leave() const
Definition: msg.cpp:506
data_
StringPiece data_
Definition: bytestream_unittest.cc:60
zmq::msg_t::subscribe
@ subscribe
Definition: msg.hpp:61
zmq::msg_t::init_buffer
int init_buffer(const void *buf_, size_t size_)
Definition: msg.cpp:97
zmq::msg_t::is_vsm
bool is_vsm() const
Definition: msg.cpp:481
zmq::msg_t::reset_routing_id
int reset_routing_id()
Definition: msg.cpp:643
NULL
NULL
Definition: test_security_zap.cpp:405
length
GLenum GLuint GLenum GLsizei length
Definition: glcorearb.h:2695
EINVAL
#define EINVAL
Definition: errno.hpp:25
strnlen
static size_t strnlen(const char *s, size_t len)
Definition: compat.hpp:37
zmq::atomic_counter_t::integer_t
uint32_t integer_t
Definition: atomic_counter.hpp:65
zmq::msg_t::init_data
int init_data(void *data_, size_t size_, msg_free_fn *ffn_, void *hint_)
Definition: msg.cpp:137
zmq::msg_t::copy
int copy(msg_t &src_)
Definition: msg.cpp:326
precompiled.hpp
zmq_assert
#define zmq_assert(x)
Definition: err.hpp:102
errno
int errno
zmq::msg_t::type_max
@ type_max
Definition: msg.hpp:189
zmq::atomic_counter_t::set
void set(integer_t value_) ZMQ_NOEXCEPT
Definition: atomic_counter.hpp:70
zmq::msg_t::_u
union zmq::msg_t::@52 _u
zmq_msg_size_check
char zmq_msg_size_check[2 *((sizeof(zmq::msg_t)==sizeof(zmq_msg_t)) !=0) - 1]
Definition: msg.cpp:22
ZMQ_GROUP_MAX_LENGTH
#define ZMQ_GROUP_MAX_LENGTH
Definition: zmq.h:368
zmq::msg_t::base
struct zmq::msg_t::@52::@55 base
flags
GLbitfield flags
Definition: glcorearb.h:3585
zmq::msg_t::move
int move(msg_t &src_)
Definition: msg.cpp:305
zmq::msg_t::init_cancel
int init_cancel(const size_t size_, const unsigned char *topic)
Definition: msg.cpp:227
zmq::msg_t::init_size
int init_size(size_t size_)
Definition: msg.cpp:62
zmq::msg_t::is_credential
bool is_credential() const
Definition: msg.cpp:471
zmq::msg_t::cancel
@ cancel
Definition: msg.hpp:62
zmq::metadata_t::add_ref
void add_ref()
Definition: metadata.cpp:23
zmq::msg_t::is_routing_id
bool is_routing_id() const
Definition: msg.cpp:466
compat.hpp
macros.hpp
zmq::msg_t::get_routing_id
uint32_t get_routing_id() const
Definition: msg.cpp:628
zmq::msg_t::flags
unsigned char flags
Definition: msg.hpp:232
stdint.hpp
zmq::msg_t::close
int close()
Definition: msg.cpp:242
zmq::atomic_counter_t
Definition: atomic_counter.hpp:61
zmq::atomic_counter_t::add
integer_t add(integer_t increment_) ZMQ_NOEXCEPT
Definition: atomic_counter.hpp:73
zmq::msg_t::shared
@ shared
Definition: msg.hpp:66
zmq::msg_t::is_lmsg
bool is_lmsg() const
Definition: msg.cpp:491
zmq_msg_t
Definition: zmq.h:218
zmq::msg_t::add_refs
void add_refs(int refs_)
Definition: msg.cpp:561
zmq::msg_t::set_metadata
void set_metadata(metadata_t *metadata_)
Definition: msg.cpp:448
size
#define size
Definition: glcorearb.h:2944
zmq::msg_t::content_t
Definition: msg.hpp:43
zmq::msg_t::check
bool check() const
Definition: msg.cpp:24
zmq::msg_t::content_t::data
void * data
Definition: msg.hpp:45
zmq::msg_t::is_zcmsg
bool is_zcmsg() const
Definition: msg.cpp:496
CMD_TYPE_MASK
#define CMD_TYPE_MASK
Definition: msg.hpp:16
zmq::msg_t::init_leave
int init_leave()
Definition: msg.cpp:201
zmq::msg_t::group
group_t group
Definition: msg.hpp:234
zmq::msg_t::init_delimiter
int init_delimiter()
Definition: msg.cpp:179
zmq::msg_t::init
int init()
Definition: msg.cpp:50
msg.hpp
zmq::msg_t::shrink
void shrink(size_t new_size_)
Definition: msg.cpp:404
zmq::metadata_t
Definition: metadata.hpp:13
zmq::msg_t::is_join
bool is_join() const
Definition: msg.cpp:501
zmq::msg_t::reset_metadata
void reset_metadata()
Definition: msg.cpp:456
zmq::msg_t::command_body
void * command_body()
Definition: msg.cpp:541
metadata.hpp
zmq::msg_t::command_body_size
size_t command_body_size() const
Definition: msg.cpp:526
zmq::msg_t::reset_flags
void reset_flags(unsigned char flags_)
Definition: msg.cpp:438
zmq::msg_t::set_routing_id
int set_routing_id(uint32_t routing_id_)
Definition: msg.cpp:633
zmq::msg_t::init_join
int init_join()
Definition: msg.cpp:190
size
GLsizeiptr size
Definition: glcorearb.h:2943
zmq::msg_t::init_external_storage
int init_external_storage(content_t *content_, void *data_, size_t size_, msg_free_fn *ffn_, void *hint_)
Definition: msg.cpp:111
zmq::msg_t::metadata
metadata_t * metadata
Definition: msg.hpp:227
zmq::msg_t::long_group_t
Definition: msg.hpp:198
err.hpp
zmq::msg_t::type_min
@ type_min
Definition: msg.hpp:170
likely.hpp
zmq::msg_t::rm_refs
bool rm_refs(int refs_)
Definition: msg.cpp:584
zmq::msg_t::is_ping
bool is_ping() const
Definition: msg.cpp:511
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: glcorearb.h:2879
zmq::msg_t::is_pong
bool is_pong() const
Definition: msg.cpp:516
zmq::msg_t::is_delimiter
bool is_delimiter() const
Definition: msg.cpp:476
zmq::msg_t::size
unsigned char size
Definition: msg.hpp:240
zmq::msg_t::data
unsigned char data[max_vsm_size]
Definition: msg.hpp:239
EFAULT
#define EFAULT
Definition: errno.hpp:17
zmq::msg_t::refcnt
zmq::atomic_counter_t * refcnt()
Definition: msg.cpp:687
zmq::msg_t::is_cmsg
bool is_cmsg() const
Definition: msg.cpp:486
zmq::msg_t::group_t::group
char group[15]
Definition: msg.hpp:210
check
static void check(upb_inttable *t)
Definition: php/ext/google/protobuf/upb.c:5088
msg_free_fn
void() msg_free_fn(void *data_, void *hint_)
Definition: msg.hpp:22
zmq::msg_t::set_flags
void set_flags(unsigned char flags_)
Definition: msg.cpp:433
zmq::msg_t::is_close_cmd
bool is_close_cmd() const
Definition: msg.cpp:521
zmq::msg_t::set_group
int set_group(const char *group_)
Definition: msg.cpp:656
zmq::msg_t
Definition: msg.hpp:33
unlikely
#define unlikely(x)
Definition: likely.hpp:11


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:57