PageRenderTime 233ms CodeModel.GetById 153ms app.highlight 71ms RepoModel.GetById 1ms app.codeStats 1ms

/src/zsockopt.c

https://github.com/jricher42/czmq
C | 3883 lines | 2723 code | 570 blank | 590 comment | 707 complexity | 8d354f2b6f9a7ae9e5150d43fd8c01ed MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1/*  =========================================================================
   2    zsockopt - get/set 0MQ socket options
   3
   4            ****************************************************
   5            *   GENERATED SOURCE CODE, DO NOT EDIT!!           *
   6            *   TO CHANGE THIS, EDIT scripts/sockopts.gsl      *
   7            *   AND RUN ./generate in models/.                 *
   8            ****************************************************
   9
  10    Copyright (c) the Contributors as noted in the AUTHORS file.
  11    This file is part of CZMQ, the high-level C binding for 0MQ:
  12    http://czmq.zeromq.org.
  13
  14    This Source Code Form is subject to the terms of the Mozilla Public
  15    License, v. 2.0. If a copy of the MPL was not distributed with this
  16    file, You can obtain one at http://mozilla.org/MPL/2.0/.
  17    =========================================================================
  18*/
  19
  20/*
  21@header
  22    The zsockopt class provides access to the 0MQ getsockopt/setsockopt API.
  23@discuss
  24    This class is generated, using the GSL code generator. See the sockopts
  25    XML file, which provides the metadata, and the zsockopt.gsl template,
  26    which does the work.
  27@end
  28*/
  29
  30#include "../include/czmq.h"
  31#include "platform.h"
  32
  33#if (ZMQ_VERSION_MAJOR == 4)
  34//  --------------------------------------------------------------------------
  35//  Set socket ZMQ_TOS value
  36//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
  37
  38void
  39zsocket_set_tos (void *zocket, int tos)
  40{
  41#   if defined (ZMQ_TOS)
  42    int rc = zmq_setsockopt (zocket, ZMQ_TOS, &tos, sizeof (int));
  43    assert (rc == 0 || zmq_errno () == ETERM);
  44#   endif
  45}
  46
  47
  48//  --------------------------------------------------------------------------
  49//  Return socket ZMQ_TOS value
  50//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
  51
  52int 
  53zsocket_tos (void *zocket)
  54{
  55#   if defined (ZMQ_TOS)
  56    int tos;
  57    size_t option_len = sizeof (int);
  58    zmq_getsockopt (zocket, ZMQ_TOS, &tos, &option_len);
  59    return tos;
  60#   else
  61    return 0;
  62#   endif
  63}
  64
  65
  66//  --------------------------------------------------------------------------
  67//  Set socket ZMQ_ROUTER_HANDOVER value
  68//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
  69
  70void
  71zsocket_set_router_handover (void *zocket, int router_handover)
  72{
  73#   if defined (ZMQ_ROUTER_HANDOVER)
  74    if (zsocket_type (zocket) != ZMQ_ROUTER) {
  75        printf ("ZMQ_ROUTER_HANDOVER is not valid on %s sockets\n", zsocket_type_str (zocket));
  76        assert (false);
  77    }
  78    int rc = zmq_setsockopt (zocket, ZMQ_ROUTER_HANDOVER, &router_handover, sizeof (int));
  79    assert (rc == 0 || zmq_errno () == ETERM);
  80#   endif
  81}
  82
  83
  84//  --------------------------------------------------------------------------
  85//  Set socket ZMQ_ROUTER_MANDATORY value
  86//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
  87
  88void
  89zsocket_set_router_mandatory (void *zocket, int router_mandatory)
  90{
  91#   if defined (ZMQ_ROUTER_MANDATORY)
  92    if (zsocket_type (zocket) != ZMQ_ROUTER) {
  93        printf ("ZMQ_ROUTER_MANDATORY is not valid on %s sockets\n", zsocket_type_str (zocket));
  94        assert (false);
  95    }
  96    int rc = zmq_setsockopt (zocket, ZMQ_ROUTER_MANDATORY, &router_mandatory, sizeof (int));
  97    assert (rc == 0 || zmq_errno () == ETERM);
  98#   endif
  99}
 100
 101
 102//  --------------------------------------------------------------------------
 103//  Set socket ZMQ_PROBE_ROUTER value
 104//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 105
 106void
 107zsocket_set_probe_router (void *zocket, int probe_router)
 108{
 109#   if defined (ZMQ_PROBE_ROUTER)
 110    if (zsocket_type (zocket) != ZMQ_ROUTER
 111    &&  zsocket_type (zocket) != ZMQ_DEALER
 112    &&  zsocket_type (zocket) != ZMQ_REQ) {
 113        printf ("ZMQ_PROBE_ROUTER is not valid on %s sockets\n", zsocket_type_str (zocket));
 114        assert (false);
 115    }
 116    int rc = zmq_setsockopt (zocket, ZMQ_PROBE_ROUTER, &probe_router, sizeof (int));
 117    assert (rc == 0 || zmq_errno () == ETERM);
 118#   endif
 119}
 120
 121
 122//  --------------------------------------------------------------------------
 123//  Set socket ZMQ_REQ_RELAXED value
 124//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 125
 126void
 127zsocket_set_req_relaxed (void *zocket, int req_relaxed)
 128{
 129#   if defined (ZMQ_REQ_RELAXED)
 130    if (zsocket_type (zocket) != ZMQ_REQ) {
 131        printf ("ZMQ_REQ_RELAXED is not valid on %s sockets\n", zsocket_type_str (zocket));
 132        assert (false);
 133    }
 134    int rc = zmq_setsockopt (zocket, ZMQ_REQ_RELAXED, &req_relaxed, sizeof (int));
 135    assert (rc == 0 || zmq_errno () == ETERM);
 136#   endif
 137}
 138
 139
 140//  --------------------------------------------------------------------------
 141//  Set socket ZMQ_REQ_CORRELATE value
 142//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 143
 144void
 145zsocket_set_req_correlate (void *zocket, int req_correlate)
 146{
 147#   if defined (ZMQ_REQ_CORRELATE)
 148    if (zsocket_type (zocket) != ZMQ_REQ) {
 149        printf ("ZMQ_REQ_CORRELATE is not valid on %s sockets\n", zsocket_type_str (zocket));
 150        assert (false);
 151    }
 152    int rc = zmq_setsockopt (zocket, ZMQ_REQ_CORRELATE, &req_correlate, sizeof (int));
 153    assert (rc == 0 || zmq_errno () == ETERM);
 154#   endif
 155}
 156
 157
 158//  --------------------------------------------------------------------------
 159//  Set socket ZMQ_CONFLATE value
 160//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 161
 162void
 163zsocket_set_conflate (void *zocket, int conflate)
 164{
 165#   if defined (ZMQ_CONFLATE)
 166    if (zsocket_type (zocket) != ZMQ_PUSH
 167    &&  zsocket_type (zocket) != ZMQ_PULL
 168    &&  zsocket_type (zocket) != ZMQ_PUB
 169    &&  zsocket_type (zocket) != ZMQ_SUB
 170    &&  zsocket_type (zocket) != ZMQ_DEALER) {
 171        printf ("ZMQ_CONFLATE is not valid on %s sockets\n", zsocket_type_str (zocket));
 172        assert (false);
 173    }
 174    int rc = zmq_setsockopt (zocket, ZMQ_CONFLATE, &conflate, sizeof (int));
 175    assert (rc == 0 || zmq_errno () == ETERM);
 176#   endif
 177}
 178
 179
 180//  --------------------------------------------------------------------------
 181//  Set socket ZMQ_ZAP_DOMAIN value
 182//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 183
 184void
 185zsocket_set_zap_domain (void *zocket, const char * zap_domain)
 186{
 187#   if defined (ZMQ_ZAP_DOMAIN)
 188    int rc = zmq_setsockopt (zocket, ZMQ_ZAP_DOMAIN, zap_domain, strlen (zap_domain));
 189    assert (rc == 0 || zmq_errno () == ETERM);
 190#   endif
 191}
 192
 193
 194//  --------------------------------------------------------------------------
 195//  Return socket ZMQ_ZAP_DOMAIN value
 196//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 197
 198char * 
 199zsocket_zap_domain (void *zocket)
 200{
 201#   if defined (ZMQ_ZAP_DOMAIN)
 202    size_t option_len = 255;
 203    char *zap_domain = (char *) zmalloc (option_len);
 204    zmq_getsockopt (zocket, ZMQ_ZAP_DOMAIN, zap_domain, &option_len);
 205    return (char *) zap_domain;
 206#   else
 207    return NULL;
 208#   endif
 209}
 210
 211
 212//  --------------------------------------------------------------------------
 213//  Return socket ZMQ_MECHANISM value
 214//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 215
 216int 
 217zsocket_mechanism (void *zocket)
 218{
 219#   if defined (ZMQ_MECHANISM)
 220    int mechanism;
 221    size_t option_len = sizeof (int);
 222    zmq_getsockopt (zocket, ZMQ_MECHANISM, &mechanism, &option_len);
 223    return mechanism;
 224#   else
 225    return 0;
 226#   endif
 227}
 228
 229
 230//  --------------------------------------------------------------------------
 231//  Set socket ZMQ_PLAIN_SERVER value
 232//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 233
 234void
 235zsocket_set_plain_server (void *zocket, int plain_server)
 236{
 237#   if defined (ZMQ_PLAIN_SERVER)
 238    int rc = zmq_setsockopt (zocket, ZMQ_PLAIN_SERVER, &plain_server, sizeof (int));
 239    assert (rc == 0 || zmq_errno () == ETERM);
 240#   endif
 241}
 242
 243
 244//  --------------------------------------------------------------------------
 245//  Return socket ZMQ_PLAIN_SERVER value
 246//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 247
 248int 
 249zsocket_plain_server (void *zocket)
 250{
 251#   if defined (ZMQ_PLAIN_SERVER)
 252    int plain_server;
 253    size_t option_len = sizeof (int);
 254    zmq_getsockopt (zocket, ZMQ_PLAIN_SERVER, &plain_server, &option_len);
 255    return plain_server;
 256#   else
 257    return 0;
 258#   endif
 259}
 260
 261
 262//  --------------------------------------------------------------------------
 263//  Set socket ZMQ_PLAIN_USERNAME value
 264//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 265
 266void
 267zsocket_set_plain_username (void *zocket, const char * plain_username)
 268{
 269#   if defined (ZMQ_PLAIN_USERNAME)
 270    int rc = zmq_setsockopt (zocket, ZMQ_PLAIN_USERNAME, plain_username, strlen (plain_username));
 271    assert (rc == 0 || zmq_errno () == ETERM);
 272#   endif
 273}
 274
 275
 276//  --------------------------------------------------------------------------
 277//  Return socket ZMQ_PLAIN_USERNAME value
 278//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 279
 280char * 
 281zsocket_plain_username (void *zocket)
 282{
 283#   if defined (ZMQ_PLAIN_USERNAME)
 284    size_t option_len = 255;
 285    char *plain_username = (char *) zmalloc (option_len);
 286    zmq_getsockopt (zocket, ZMQ_PLAIN_USERNAME, plain_username, &option_len);
 287    return (char *) plain_username;
 288#   else
 289    return NULL;
 290#   endif
 291}
 292
 293
 294//  --------------------------------------------------------------------------
 295//  Set socket ZMQ_PLAIN_PASSWORD value
 296//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 297
 298void
 299zsocket_set_plain_password (void *zocket, const char * plain_password)
 300{
 301#   if defined (ZMQ_PLAIN_PASSWORD)
 302    int rc = zmq_setsockopt (zocket, ZMQ_PLAIN_PASSWORD, plain_password, strlen (plain_password));
 303    assert (rc == 0 || zmq_errno () == ETERM);
 304#   endif
 305}
 306
 307
 308//  --------------------------------------------------------------------------
 309//  Return socket ZMQ_PLAIN_PASSWORD value
 310//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 311
 312char * 
 313zsocket_plain_password (void *zocket)
 314{
 315#   if defined (ZMQ_PLAIN_PASSWORD)
 316    size_t option_len = 255;
 317    char *plain_password = (char *) zmalloc (option_len);
 318    zmq_getsockopt (zocket, ZMQ_PLAIN_PASSWORD, plain_password, &option_len);
 319    return (char *) plain_password;
 320#   else
 321    return NULL;
 322#   endif
 323}
 324
 325
 326//  --------------------------------------------------------------------------
 327//  Set socket ZMQ_CURVE_SERVER value
 328//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 329
 330void
 331zsocket_set_curve_server (void *zocket, int curve_server)
 332{
 333#   if defined (ZMQ_CURVE_SERVER)
 334    int rc = zmq_setsockopt (zocket, ZMQ_CURVE_SERVER, &curve_server, sizeof (int));
 335    assert (rc == 0 || zmq_errno () == ETERM);
 336#   endif
 337}
 338
 339
 340//  --------------------------------------------------------------------------
 341//  Return socket ZMQ_CURVE_SERVER value
 342//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 343
 344int 
 345zsocket_curve_server (void *zocket)
 346{
 347#   if defined (ZMQ_CURVE_SERVER)
 348    int curve_server;
 349    size_t option_len = sizeof (int);
 350    zmq_getsockopt (zocket, ZMQ_CURVE_SERVER, &curve_server, &option_len);
 351    return curve_server;
 352#   else
 353    return 0;
 354#   endif
 355}
 356
 357
 358//  --------------------------------------------------------------------------
 359//  Set socket ZMQ_CURVE_PUBLICKEY value
 360//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 361
 362void
 363zsocket_set_curve_publickey (void *zocket, const char * curve_publickey)
 364{
 365#   if defined (ZMQ_CURVE_PUBLICKEY)
 366    int rc = zmq_setsockopt (zocket, ZMQ_CURVE_PUBLICKEY, curve_publickey, strlen (curve_publickey));
 367    assert (rc == 0 || zmq_errno () == ETERM);
 368#   endif
 369}
 370
 371
 372//  --------------------------------------------------------------------------
 373//  Set socket ZMQ_CURVE_PUBLICKEY value from 32-octet binary
 374//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 375
 376void
 377zsocket_set_curve_publickey_bin (void *zocket, const byte *curve_publickey)
 378{
 379#   if defined (ZMQ_CURVE_PUBLICKEY)
 380    int rc = zmq_setsockopt (zocket, ZMQ_CURVE_PUBLICKEY, curve_publickey, 32);
 381    assert (rc == 0 || zmq_errno () == ETERM);
 382#   endif
 383}
 384
 385
 386//  --------------------------------------------------------------------------
 387//  Return socket ZMQ_CURVE_PUBLICKEY value
 388//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 389
 390char * 
 391zsocket_curve_publickey (void *zocket)
 392{
 393#   if defined (ZMQ_CURVE_PUBLICKEY)
 394    size_t option_len = 40 + 1;     //  Z85 key + terminator
 395    char *curve_publickey = (char *) zmalloc (option_len);
 396    zmq_getsockopt (zocket, ZMQ_CURVE_PUBLICKEY, curve_publickey, &option_len);
 397    return (char *) curve_publickey;
 398#   else
 399    return NULL;
 400#   endif
 401}
 402
 403
 404//  --------------------------------------------------------------------------
 405//  Set socket ZMQ_CURVE_SECRETKEY value
 406//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 407
 408void
 409zsocket_set_curve_secretkey (void *zocket, const char * curve_secretkey)
 410{
 411#   if defined (ZMQ_CURVE_SECRETKEY)
 412    int rc = zmq_setsockopt (zocket, ZMQ_CURVE_SECRETKEY, curve_secretkey, strlen (curve_secretkey));
 413    assert (rc == 0 || zmq_errno () == ETERM);
 414#   endif
 415}
 416
 417
 418//  --------------------------------------------------------------------------
 419//  Set socket ZMQ_CURVE_SECRETKEY value from 32-octet binary
 420//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 421
 422void
 423zsocket_set_curve_secretkey_bin (void *zocket, const byte *curve_secretkey)
 424{
 425#   if defined (ZMQ_CURVE_SECRETKEY)
 426    int rc = zmq_setsockopt (zocket, ZMQ_CURVE_SECRETKEY, curve_secretkey, 32);
 427    assert (rc == 0 || zmq_errno () == ETERM);
 428#   endif
 429}
 430
 431
 432//  --------------------------------------------------------------------------
 433//  Return socket ZMQ_CURVE_SECRETKEY value
 434//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 435
 436char * 
 437zsocket_curve_secretkey (void *zocket)
 438{
 439#   if defined (ZMQ_CURVE_SECRETKEY)
 440    size_t option_len = 40 + 1;     //  Z85 key + terminator
 441    char *curve_secretkey = (char *) zmalloc (option_len);
 442    zmq_getsockopt (zocket, ZMQ_CURVE_SECRETKEY, curve_secretkey, &option_len);
 443    return (char *) curve_secretkey;
 444#   else
 445    return NULL;
 446#   endif
 447}
 448
 449
 450//  --------------------------------------------------------------------------
 451//  Set socket ZMQ_CURVE_SERVERKEY value
 452//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 453
 454void
 455zsocket_set_curve_serverkey (void *zocket, const char * curve_serverkey)
 456{
 457#   if defined (ZMQ_CURVE_SERVERKEY)
 458    int rc = zmq_setsockopt (zocket, ZMQ_CURVE_SERVERKEY, curve_serverkey, strlen (curve_serverkey));
 459    assert (rc == 0 || zmq_errno () == ETERM);
 460#   endif
 461}
 462
 463
 464//  --------------------------------------------------------------------------
 465//  Set socket ZMQ_CURVE_SERVERKEY value from 32-octet binary
 466//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 467
 468void
 469zsocket_set_curve_serverkey_bin (void *zocket, const byte *curve_serverkey)
 470{
 471#   if defined (ZMQ_CURVE_SERVERKEY)
 472    int rc = zmq_setsockopt (zocket, ZMQ_CURVE_SERVERKEY, curve_serverkey, 32);
 473    assert (rc == 0 || zmq_errno () == ETERM);
 474#   endif
 475}
 476
 477
 478//  --------------------------------------------------------------------------
 479//  Return socket ZMQ_CURVE_SERVERKEY value
 480//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 481
 482char * 
 483zsocket_curve_serverkey (void *zocket)
 484{
 485#   if defined (ZMQ_CURVE_SERVERKEY)
 486    size_t option_len = 40 + 1;     //  Z85 key + terminator
 487    char *curve_serverkey = (char *) zmalloc (option_len);
 488    zmq_getsockopt (zocket, ZMQ_CURVE_SERVERKEY, curve_serverkey, &option_len);
 489    return (char *) curve_serverkey;
 490#   else
 491    return NULL;
 492#   endif
 493}
 494
 495
 496//  --------------------------------------------------------------------------
 497//  Set socket ZMQ_GSSAPI_SERVER value
 498//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 499
 500void
 501zsocket_set_gssapi_server (void *zocket, int gssapi_server)
 502{
 503#   if defined (ZMQ_GSSAPI_SERVER)
 504    int rc = zmq_setsockopt (zocket, ZMQ_GSSAPI_SERVER, &gssapi_server, sizeof (int));
 505    assert (rc == 0 || zmq_errno () == ETERM);
 506#   endif
 507}
 508
 509
 510//  --------------------------------------------------------------------------
 511//  Return socket ZMQ_GSSAPI_SERVER value
 512//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 513
 514int 
 515zsocket_gssapi_server (void *zocket)
 516{
 517#   if defined (ZMQ_GSSAPI_SERVER)
 518    int gssapi_server;
 519    size_t option_len = sizeof (int);
 520    zmq_getsockopt (zocket, ZMQ_GSSAPI_SERVER, &gssapi_server, &option_len);
 521    return gssapi_server;
 522#   else
 523    return 0;
 524#   endif
 525}
 526
 527
 528//  --------------------------------------------------------------------------
 529//  Set socket ZMQ_GSSAPI_PLAINTEXT value
 530//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 531
 532void
 533zsocket_set_gssapi_plaintext (void *zocket, int gssapi_plaintext)
 534{
 535#   if defined (ZMQ_GSSAPI_PLAINTEXT)
 536    int rc = zmq_setsockopt (zocket, ZMQ_GSSAPI_PLAINTEXT, &gssapi_plaintext, sizeof (int));
 537    assert (rc == 0 || zmq_errno () == ETERM);
 538#   endif
 539}
 540
 541
 542//  --------------------------------------------------------------------------
 543//  Return socket ZMQ_GSSAPI_PLAINTEXT value
 544//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 545
 546int 
 547zsocket_gssapi_plaintext (void *zocket)
 548{
 549#   if defined (ZMQ_GSSAPI_PLAINTEXT)
 550    int gssapi_plaintext;
 551    size_t option_len = sizeof (int);
 552    zmq_getsockopt (zocket, ZMQ_GSSAPI_PLAINTEXT, &gssapi_plaintext, &option_len);
 553    return gssapi_plaintext;
 554#   else
 555    return 0;
 556#   endif
 557}
 558
 559
 560//  --------------------------------------------------------------------------
 561//  Set socket ZMQ_GSSAPI_PRINCIPAL value
 562//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 563
 564void
 565zsocket_set_gssapi_principal (void *zocket, const char * gssapi_principal)
 566{
 567#   if defined (ZMQ_GSSAPI_PRINCIPAL)
 568    int rc = zmq_setsockopt (zocket, ZMQ_GSSAPI_PRINCIPAL, gssapi_principal, strlen (gssapi_principal));
 569    assert (rc == 0 || zmq_errno () == ETERM);
 570#   endif
 571}
 572
 573
 574//  --------------------------------------------------------------------------
 575//  Return socket ZMQ_GSSAPI_PRINCIPAL value
 576//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 577
 578char * 
 579zsocket_gssapi_principal (void *zocket)
 580{
 581#   if defined (ZMQ_GSSAPI_PRINCIPAL)
 582    size_t option_len = 255;
 583    char *gssapi_principal = (char *) zmalloc (option_len);
 584    zmq_getsockopt (zocket, ZMQ_GSSAPI_PRINCIPAL, gssapi_principal, &option_len);
 585    return (char *) gssapi_principal;
 586#   else
 587    return NULL;
 588#   endif
 589}
 590
 591
 592//  --------------------------------------------------------------------------
 593//  Set socket ZMQ_GSSAPI_SERVICE_PRINCIPAL value
 594//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 595
 596void
 597zsocket_set_gssapi_service_principal (void *zocket, const char * gssapi_service_principal)
 598{
 599#   if defined (ZMQ_GSSAPI_SERVICE_PRINCIPAL)
 600    int rc = zmq_setsockopt (zocket, ZMQ_GSSAPI_SERVICE_PRINCIPAL, gssapi_service_principal, strlen (gssapi_service_principal));
 601    assert (rc == 0 || zmq_errno () == ETERM);
 602#   endif
 603}
 604
 605
 606//  --------------------------------------------------------------------------
 607//  Return socket ZMQ_GSSAPI_SERVICE_PRINCIPAL value
 608//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 609
 610char * 
 611zsocket_gssapi_service_principal (void *zocket)
 612{
 613#   if defined (ZMQ_GSSAPI_SERVICE_PRINCIPAL)
 614    size_t option_len = 255;
 615    char *gssapi_service_principal = (char *) zmalloc (option_len);
 616    zmq_getsockopt (zocket, ZMQ_GSSAPI_SERVICE_PRINCIPAL, gssapi_service_principal, &option_len);
 617    return (char *) gssapi_service_principal;
 618#   else
 619    return NULL;
 620#   endif
 621}
 622
 623
 624//  --------------------------------------------------------------------------
 625//  Set socket ZMQ_IPV6 value
 626//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 627
 628void
 629zsocket_set_ipv6 (void *zocket, int ipv6)
 630{
 631#   if defined (ZMQ_IPV6)
 632    int rc = zmq_setsockopt (zocket, ZMQ_IPV6, &ipv6, sizeof (int));
 633    assert (rc == 0 || zmq_errno () == ETERM);
 634#   endif
 635}
 636
 637
 638//  --------------------------------------------------------------------------
 639//  Return socket ZMQ_IPV6 value
 640//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 641
 642int 
 643zsocket_ipv6 (void *zocket)
 644{
 645#   if defined (ZMQ_IPV6)
 646    int ipv6;
 647    size_t option_len = sizeof (int);
 648    zmq_getsockopt (zocket, ZMQ_IPV6, &ipv6, &option_len);
 649    return ipv6;
 650#   else
 651    return 0;
 652#   endif
 653}
 654
 655
 656//  --------------------------------------------------------------------------
 657//  Set socket ZMQ_IMMEDIATE value
 658//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 659
 660void
 661zsocket_set_immediate (void *zocket, int immediate)
 662{
 663#   if defined (ZMQ_IMMEDIATE)
 664    int rc = zmq_setsockopt (zocket, ZMQ_IMMEDIATE, &immediate, sizeof (int));
 665    assert (rc == 0 || zmq_errno () == ETERM);
 666#   endif
 667}
 668
 669
 670//  --------------------------------------------------------------------------
 671//  Return socket ZMQ_IMMEDIATE value
 672//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 673
 674int 
 675zsocket_immediate (void *zocket)
 676{
 677#   if defined (ZMQ_IMMEDIATE)
 678    int immediate;
 679    size_t option_len = sizeof (int);
 680    zmq_getsockopt (zocket, ZMQ_IMMEDIATE, &immediate, &option_len);
 681    return immediate;
 682#   else
 683    return 0;
 684#   endif
 685}
 686
 687
 688//  --------------------------------------------------------------------------
 689//  Set socket ZMQ_ROUTER_RAW value
 690//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 691
 692void
 693zsocket_set_router_raw (void *zocket, int router_raw)
 694{
 695#   if defined (ZMQ_ROUTER_RAW)
 696    if (zsocket_type (zocket) != ZMQ_ROUTER) {
 697        printf ("ZMQ_ROUTER_RAW is not valid on %s sockets\n", zsocket_type_str (zocket));
 698        assert (false);
 699    }
 700    int rc = zmq_setsockopt (zocket, ZMQ_ROUTER_RAW, &router_raw, sizeof (int));
 701    assert (rc == 0 || zmq_errno () == ETERM);
 702#   endif
 703}
 704
 705
 706//  --------------------------------------------------------------------------
 707//  Set socket ZMQ_IPV4ONLY value
 708//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 709
 710void
 711zsocket_set_ipv4only (void *zocket, int ipv4only)
 712{
 713#   if defined (ZMQ_IPV4ONLY)
 714    int rc = zmq_setsockopt (zocket, ZMQ_IPV4ONLY, &ipv4only, sizeof (int));
 715    assert (rc == 0 || zmq_errno () == ETERM);
 716#   endif
 717}
 718
 719
 720//  --------------------------------------------------------------------------
 721//  Return socket ZMQ_IPV4ONLY value
 722//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 723
 724int 
 725zsocket_ipv4only (void *zocket)
 726{
 727#   if defined (ZMQ_IPV4ONLY)
 728    int ipv4only;
 729    size_t option_len = sizeof (int);
 730    zmq_getsockopt (zocket, ZMQ_IPV4ONLY, &ipv4only, &option_len);
 731    return ipv4only;
 732#   else
 733    return 0;
 734#   endif
 735}
 736
 737
 738//  --------------------------------------------------------------------------
 739//  Set socket ZMQ_DELAY_ATTACH_ON_CONNECT value
 740//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 741
 742void
 743zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect)
 744{
 745#   if defined (ZMQ_DELAY_ATTACH_ON_CONNECT)
 746    int rc = zmq_setsockopt (zocket, ZMQ_DELAY_ATTACH_ON_CONNECT, &delay_attach_on_connect, sizeof (int));
 747    assert (rc == 0 || zmq_errno () == ETERM);
 748#   endif
 749}
 750
 751
 752//  --------------------------------------------------------------------------
 753//  Return socket ZMQ_TYPE value
 754//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 755
 756int 
 757zsocket_type (void *zocket)
 758{
 759#   if defined (ZMQ_TYPE)
 760    int type;
 761    size_t option_len = sizeof (int);
 762    zmq_getsockopt (zocket, ZMQ_TYPE, &type, &option_len);
 763    return type;
 764#   else
 765    return 0;
 766#   endif
 767}
 768
 769
 770//  --------------------------------------------------------------------------
 771//  Set socket ZMQ_SNDHWM value
 772//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 773
 774void
 775zsocket_set_sndhwm (void *zocket, int sndhwm)
 776{
 777#   if defined (ZMQ_SNDHWM)
 778    int rc = zmq_setsockopt (zocket, ZMQ_SNDHWM, &sndhwm, sizeof (int));
 779    assert (rc == 0 || zmq_errno () == ETERM);
 780#   endif
 781}
 782
 783
 784//  --------------------------------------------------------------------------
 785//  Return socket ZMQ_SNDHWM value
 786//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 787
 788int 
 789zsocket_sndhwm (void *zocket)
 790{
 791#   if defined (ZMQ_SNDHWM)
 792    int sndhwm;
 793    size_t option_len = sizeof (int);
 794    zmq_getsockopt (zocket, ZMQ_SNDHWM, &sndhwm, &option_len);
 795    return sndhwm;
 796#   else
 797    return 0;
 798#   endif
 799}
 800
 801
 802//  --------------------------------------------------------------------------
 803//  Set socket ZMQ_RCVHWM value
 804//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 805
 806void
 807zsocket_set_rcvhwm (void *zocket, int rcvhwm)
 808{
 809#   if defined (ZMQ_RCVHWM)
 810    int rc = zmq_setsockopt (zocket, ZMQ_RCVHWM, &rcvhwm, sizeof (int));
 811    assert (rc == 0 || zmq_errno () == ETERM);
 812#   endif
 813}
 814
 815
 816//  --------------------------------------------------------------------------
 817//  Return socket ZMQ_RCVHWM value
 818//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 819
 820int 
 821zsocket_rcvhwm (void *zocket)
 822{
 823#   if defined (ZMQ_RCVHWM)
 824    int rcvhwm;
 825    size_t option_len = sizeof (int);
 826    zmq_getsockopt (zocket, ZMQ_RCVHWM, &rcvhwm, &option_len);
 827    return rcvhwm;
 828#   else
 829    return 0;
 830#   endif
 831}
 832
 833
 834//  --------------------------------------------------------------------------
 835//  Set socket ZMQ_AFFINITY value
 836//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 837
 838void
 839zsocket_set_affinity (void *zocket, int affinity)
 840{
 841#   if defined (ZMQ_AFFINITY)
 842    uint64_t value = affinity;
 843    int rc = zmq_setsockopt (zocket, ZMQ_AFFINITY, &value, sizeof (uint64_t));
 844    assert (rc == 0 || zmq_errno () == ETERM);
 845#   endif
 846}
 847
 848
 849//  --------------------------------------------------------------------------
 850//  Return socket ZMQ_AFFINITY value
 851//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 852
 853int 
 854zsocket_affinity (void *zocket)
 855{
 856#   if defined (ZMQ_AFFINITY)
 857    uint64_t affinity;
 858    size_t option_len = sizeof (uint64_t);
 859    zmq_getsockopt (zocket, ZMQ_AFFINITY, &affinity, &option_len);
 860    return (int) affinity;
 861#   else
 862    return 0;
 863#   endif
 864}
 865
 866
 867//  --------------------------------------------------------------------------
 868//  Set socket ZMQ_SUBSCRIBE value
 869//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 870
 871void
 872zsocket_set_subscribe (void *zocket, const char * subscribe)
 873{
 874#   if defined (ZMQ_SUBSCRIBE)
 875    if (zsocket_type (zocket) != ZMQ_SUB) {
 876        printf ("ZMQ_SUBSCRIBE is not valid on %s sockets\n", zsocket_type_str (zocket));
 877        assert (false);
 878    }
 879    int rc = zmq_setsockopt (zocket, ZMQ_SUBSCRIBE, subscribe, strlen (subscribe));
 880    assert (rc == 0 || zmq_errno () == ETERM);
 881#   endif
 882}
 883
 884
 885//  --------------------------------------------------------------------------
 886//  Set socket ZMQ_UNSUBSCRIBE value
 887//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 888
 889void
 890zsocket_set_unsubscribe (void *zocket, const char * unsubscribe)
 891{
 892#   if defined (ZMQ_UNSUBSCRIBE)
 893    if (zsocket_type (zocket) != ZMQ_SUB) {
 894        printf ("ZMQ_UNSUBSCRIBE is not valid on %s sockets\n", zsocket_type_str (zocket));
 895        assert (false);
 896    }
 897    int rc = zmq_setsockopt (zocket, ZMQ_UNSUBSCRIBE, unsubscribe, strlen (unsubscribe));
 898    assert (rc == 0 || zmq_errno () == ETERM);
 899#   endif
 900}
 901
 902
 903//  --------------------------------------------------------------------------
 904//  Set socket ZMQ_IDENTITY value
 905//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 906
 907void
 908zsocket_set_identity (void *zocket, const char * identity)
 909{
 910#   if defined (ZMQ_IDENTITY)
 911    if (zsocket_type (zocket) != ZMQ_REQ
 912    &&  zsocket_type (zocket) != ZMQ_REP
 913    &&  zsocket_type (zocket) != ZMQ_DEALER
 914    &&  zsocket_type (zocket) != ZMQ_ROUTER) {
 915        printf ("ZMQ_IDENTITY is not valid on %s sockets\n", zsocket_type_str (zocket));
 916        assert (false);
 917    }
 918    int rc = zmq_setsockopt (zocket, ZMQ_IDENTITY, identity, strlen (identity));
 919    assert (rc == 0 || zmq_errno () == ETERM);
 920#   endif
 921}
 922
 923
 924//  --------------------------------------------------------------------------
 925//  Return socket ZMQ_IDENTITY value
 926//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 927
 928char * 
 929zsocket_identity (void *zocket)
 930{
 931#   if defined (ZMQ_IDENTITY)
 932    size_t option_len = 255;
 933    char *identity = (char *) zmalloc (option_len);
 934    zmq_getsockopt (zocket, ZMQ_IDENTITY, identity, &option_len);
 935    return (char *) identity;
 936#   else
 937    return NULL;
 938#   endif
 939}
 940
 941
 942//  --------------------------------------------------------------------------
 943//  Set socket ZMQ_RATE value
 944//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 945
 946void
 947zsocket_set_rate (void *zocket, int rate)
 948{
 949#   if defined (ZMQ_RATE)
 950    int rc = zmq_setsockopt (zocket, ZMQ_RATE, &rate, sizeof (int));
 951    assert (rc == 0 || zmq_errno () == ETERM);
 952#   endif
 953}
 954
 955
 956//  --------------------------------------------------------------------------
 957//  Return socket ZMQ_RATE value
 958//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 959
 960int 
 961zsocket_rate (void *zocket)
 962{
 963#   if defined (ZMQ_RATE)
 964    int rate;
 965    size_t option_len = sizeof (int);
 966    zmq_getsockopt (zocket, ZMQ_RATE, &rate, &option_len);
 967    return rate;
 968#   else
 969    return 0;
 970#   endif
 971}
 972
 973
 974//  --------------------------------------------------------------------------
 975//  Set socket ZMQ_RECOVERY_IVL value
 976//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 977
 978void
 979zsocket_set_recovery_ivl (void *zocket, int recovery_ivl)
 980{
 981#   if defined (ZMQ_RECOVERY_IVL)
 982    int rc = zmq_setsockopt (zocket, ZMQ_RECOVERY_IVL, &recovery_ivl, sizeof (int));
 983    assert (rc == 0 || zmq_errno () == ETERM);
 984#   endif
 985}
 986
 987
 988//  --------------------------------------------------------------------------
 989//  Return socket ZMQ_RECOVERY_IVL value
 990//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
 991
 992int 
 993zsocket_recovery_ivl (void *zocket)
 994{
 995#   if defined (ZMQ_RECOVERY_IVL)
 996    int recovery_ivl;
 997    size_t option_len = sizeof (int);
 998    zmq_getsockopt (zocket, ZMQ_RECOVERY_IVL, &recovery_ivl, &option_len);
 999    return recovery_ivl;
1000#   else
1001    return 0;
1002#   endif
1003}
1004
1005
1006//  --------------------------------------------------------------------------
1007//  Set socket ZMQ_SNDBUF value
1008//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1009
1010void
1011zsocket_set_sndbuf (void *zocket, int sndbuf)
1012{
1013#   if defined (ZMQ_SNDBUF)
1014    int rc = zmq_setsockopt (zocket, ZMQ_SNDBUF, &sndbuf, sizeof (int));
1015    assert (rc == 0 || zmq_errno () == ETERM);
1016#   endif
1017}
1018
1019
1020//  --------------------------------------------------------------------------
1021//  Return socket ZMQ_SNDBUF value
1022//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1023
1024int 
1025zsocket_sndbuf (void *zocket)
1026{
1027#   if defined (ZMQ_SNDBUF)
1028    int sndbuf;
1029    size_t option_len = sizeof (int);
1030    zmq_getsockopt (zocket, ZMQ_SNDBUF, &sndbuf, &option_len);
1031    return sndbuf;
1032#   else
1033    return 0;
1034#   endif
1035}
1036
1037
1038//  --------------------------------------------------------------------------
1039//  Set socket ZMQ_RCVBUF value
1040//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1041
1042void
1043zsocket_set_rcvbuf (void *zocket, int rcvbuf)
1044{
1045#   if defined (ZMQ_RCVBUF)
1046    int rc = zmq_setsockopt (zocket, ZMQ_RCVBUF, &rcvbuf, sizeof (int));
1047    assert (rc == 0 || zmq_errno () == ETERM);
1048#   endif
1049}
1050
1051
1052//  --------------------------------------------------------------------------
1053//  Return socket ZMQ_RCVBUF value
1054//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1055
1056int 
1057zsocket_rcvbuf (void *zocket)
1058{
1059#   if defined (ZMQ_RCVBUF)
1060    int rcvbuf;
1061    size_t option_len = sizeof (int);
1062    zmq_getsockopt (zocket, ZMQ_RCVBUF, &rcvbuf, &option_len);
1063    return rcvbuf;
1064#   else
1065    return 0;
1066#   endif
1067}
1068
1069
1070//  --------------------------------------------------------------------------
1071//  Set socket ZMQ_LINGER value
1072//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1073
1074void
1075zsocket_set_linger (void *zocket, int linger)
1076{
1077#   if defined (ZMQ_LINGER)
1078    int rc = zmq_setsockopt (zocket, ZMQ_LINGER, &linger, sizeof (int));
1079    assert (rc == 0 || zmq_errno () == ETERM);
1080#   endif
1081}
1082
1083
1084//  --------------------------------------------------------------------------
1085//  Return socket ZMQ_LINGER value
1086//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1087
1088int 
1089zsocket_linger (void *zocket)
1090{
1091#   if defined (ZMQ_LINGER)
1092    int linger;
1093    size_t option_len = sizeof (int);
1094    zmq_getsockopt (zocket, ZMQ_LINGER, &linger, &option_len);
1095    return linger;
1096#   else
1097    return 0;
1098#   endif
1099}
1100
1101
1102//  --------------------------------------------------------------------------
1103//  Set socket ZMQ_RECONNECT_IVL value
1104//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1105
1106void
1107zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl)
1108{
1109#   if defined (ZMQ_RECONNECT_IVL)
1110    int rc = zmq_setsockopt (zocket, ZMQ_RECONNECT_IVL, &reconnect_ivl, sizeof (int));
1111    assert (rc == 0 || zmq_errno () == ETERM);
1112#   endif
1113}
1114
1115
1116//  --------------------------------------------------------------------------
1117//  Return socket ZMQ_RECONNECT_IVL value
1118//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1119
1120int 
1121zsocket_reconnect_ivl (void *zocket)
1122{
1123#   if defined (ZMQ_RECONNECT_IVL)
1124    int reconnect_ivl;
1125    size_t option_len = sizeof (int);
1126    zmq_getsockopt (zocket, ZMQ_RECONNECT_IVL, &reconnect_ivl, &option_len);
1127    return reconnect_ivl;
1128#   else
1129    return 0;
1130#   endif
1131}
1132
1133
1134//  --------------------------------------------------------------------------
1135//  Set socket ZMQ_RECONNECT_IVL_MAX value
1136//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1137
1138void
1139zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max)
1140{
1141#   if defined (ZMQ_RECONNECT_IVL_MAX)
1142    int rc = zmq_setsockopt (zocket, ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, sizeof (int));
1143    assert (rc == 0 || zmq_errno () == ETERM);
1144#   endif
1145}
1146
1147
1148//  --------------------------------------------------------------------------
1149//  Return socket ZMQ_RECONNECT_IVL_MAX value
1150//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1151
1152int 
1153zsocket_reconnect_ivl_max (void *zocket)
1154{
1155#   if defined (ZMQ_RECONNECT_IVL_MAX)
1156    int reconnect_ivl_max;
1157    size_t option_len = sizeof (int);
1158    zmq_getsockopt (zocket, ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, &option_len);
1159    return reconnect_ivl_max;
1160#   else
1161    return 0;
1162#   endif
1163}
1164
1165
1166//  --------------------------------------------------------------------------
1167//  Set socket ZMQ_BACKLOG value
1168//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1169
1170void
1171zsocket_set_backlog (void *zocket, int backlog)
1172{
1173#   if defined (ZMQ_BACKLOG)
1174    int rc = zmq_setsockopt (zocket, ZMQ_BACKLOG, &backlog, sizeof (int));
1175    assert (rc == 0 || zmq_errno () == ETERM);
1176#   endif
1177}
1178
1179
1180//  --------------------------------------------------------------------------
1181//  Return socket ZMQ_BACKLOG value
1182//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1183
1184int 
1185zsocket_backlog (void *zocket)
1186{
1187#   if defined (ZMQ_BACKLOG)
1188    int backlog;
1189    size_t option_len = sizeof (int);
1190    zmq_getsockopt (zocket, ZMQ_BACKLOG, &backlog, &option_len);
1191    return backlog;
1192#   else
1193    return 0;
1194#   endif
1195}
1196
1197
1198//  --------------------------------------------------------------------------
1199//  Set socket ZMQ_MAXMSGSIZE value
1200//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1201
1202void
1203zsocket_set_maxmsgsize (void *zocket, int maxmsgsize)
1204{
1205#   if defined (ZMQ_MAXMSGSIZE)
1206    int64_t value = maxmsgsize;
1207    int rc = zmq_setsockopt (zocket, ZMQ_MAXMSGSIZE, &value, sizeof (int64_t));
1208    assert (rc == 0 || zmq_errno () == ETERM);
1209#   endif
1210}
1211
1212
1213//  --------------------------------------------------------------------------
1214//  Return socket ZMQ_MAXMSGSIZE value
1215//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1216
1217int 
1218zsocket_maxmsgsize (void *zocket)
1219{
1220#   if defined (ZMQ_MAXMSGSIZE)
1221    int64_t maxmsgsize;
1222    size_t option_len = sizeof (int64_t);
1223    zmq_getsockopt (zocket, ZMQ_MAXMSGSIZE, &maxmsgsize, &option_len);
1224    return (int) maxmsgsize;
1225#   else
1226    return 0;
1227#   endif
1228}
1229
1230
1231//  --------------------------------------------------------------------------
1232//  Set socket ZMQ_MULTICAST_HOPS value
1233//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1234
1235void
1236zsocket_set_multicast_hops (void *zocket, int multicast_hops)
1237{
1238#   if defined (ZMQ_MULTICAST_HOPS)
1239    int rc = zmq_setsockopt (zocket, ZMQ_MULTICAST_HOPS, &multicast_hops, sizeof (int));
1240    assert (rc == 0 || zmq_errno () == ETERM);
1241#   endif
1242}
1243
1244
1245//  --------------------------------------------------------------------------
1246//  Return socket ZMQ_MULTICAST_HOPS value
1247//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1248
1249int 
1250zsocket_multicast_hops (void *zocket)
1251{
1252#   if defined (ZMQ_MULTICAST_HOPS)
1253    int multicast_hops;
1254    size_t option_len = sizeof (int);
1255    zmq_getsockopt (zocket, ZMQ_MULTICAST_HOPS, &multicast_hops, &option_len);
1256    return multicast_hops;
1257#   else
1258    return 0;
1259#   endif
1260}
1261
1262
1263//  --------------------------------------------------------------------------
1264//  Set socket ZMQ_RCVTIMEO value
1265//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1266
1267void
1268zsocket_set_rcvtimeo (void *zocket, int rcvtimeo)
1269{
1270#   if defined (ZMQ_RCVTIMEO)
1271    int rc = zmq_setsockopt (zocket, ZMQ_RCVTIMEO, &rcvtimeo, sizeof (int));
1272    assert (rc == 0 || zmq_errno () == ETERM);
1273#   endif
1274}
1275
1276
1277//  --------------------------------------------------------------------------
1278//  Return socket ZMQ_RCVTIMEO value
1279//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1280
1281int 
1282zsocket_rcvtimeo (void *zocket)
1283{
1284#   if defined (ZMQ_RCVTIMEO)
1285    int rcvtimeo;
1286    size_t option_len = sizeof (int);
1287    zmq_getsockopt (zocket, ZMQ_RCVTIMEO, &rcvtimeo, &option_len);
1288    return rcvtimeo;
1289#   else
1290    return 0;
1291#   endif
1292}
1293
1294
1295//  --------------------------------------------------------------------------
1296//  Set socket ZMQ_SNDTIMEO value
1297//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1298
1299void
1300zsocket_set_sndtimeo (void *zocket, int sndtimeo)
1301{
1302#   if defined (ZMQ_SNDTIMEO)
1303    int rc = zmq_setsockopt (zocket, ZMQ_SNDTIMEO, &sndtimeo, sizeof (int));
1304    assert (rc == 0 || zmq_errno () == ETERM);
1305#   endif
1306}
1307
1308
1309//  --------------------------------------------------------------------------
1310//  Return socket ZMQ_SNDTIMEO value
1311//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1312
1313int 
1314zsocket_sndtimeo (void *zocket)
1315{
1316#   if defined (ZMQ_SNDTIMEO)
1317    int sndtimeo;
1318    size_t option_len = sizeof (int);
1319    zmq_getsockopt (zocket, ZMQ_SNDTIMEO, &sndtimeo, &option_len);
1320    return sndtimeo;
1321#   else
1322    return 0;
1323#   endif
1324}
1325
1326
1327//  --------------------------------------------------------------------------
1328//  Set socket ZMQ_XPUB_VERBOSE value
1329//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1330
1331void
1332zsocket_set_xpub_verbose (void *zocket, int xpub_verbose)
1333{
1334#   if defined (ZMQ_XPUB_VERBOSE)
1335    if (zsocket_type (zocket) != ZMQ_XPUB) {
1336        printf ("ZMQ_XPUB_VERBOSE is not valid on %s sockets\n", zsocket_type_str (zocket));
1337        assert (false);
1338    }
1339    int rc = zmq_setsockopt (zocket, ZMQ_XPUB_VERBOSE, &xpub_verbose, sizeof (int));
1340    assert (rc == 0 || zmq_errno () == ETERM);
1341#   endif
1342}
1343
1344
1345//  --------------------------------------------------------------------------
1346//  Set socket ZMQ_TCP_KEEPALIVE value
1347//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1348
1349void
1350zsocket_set_tcp_keepalive (void *zocket, int tcp_keepalive)
1351{
1352#   if defined (ZMQ_TCP_KEEPALIVE)
1353    int rc = zmq_setsockopt (zocket, ZMQ_TCP_KEEPALIVE, &tcp_keepalive, sizeof (int));
1354    assert (rc == 0 || zmq_errno () == ETERM);
1355#   endif
1356}
1357
1358
1359//  --------------------------------------------------------------------------
1360//  Return socket ZMQ_TCP_KEEPALIVE value
1361//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1362
1363int 
1364zsocket_tcp_keepalive (void *zocket)
1365{
1366#   if defined (ZMQ_TCP_KEEPALIVE)
1367    int tcp_keepalive;
1368    size_t option_len = sizeof (int);
1369    zmq_getsockopt (zocket, ZMQ_TCP_KEEPALIVE, &tcp_keepalive, &option_len);
1370    return tcp_keepalive;
1371#   else
1372    return 0;
1373#   endif
1374}
1375
1376
1377//  --------------------------------------------------------------------------
1378//  Set socket ZMQ_TCP_KEEPALIVE_IDLE value
1379//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1380
1381void
1382zsocket_set_tcp_keepalive_idle (void *zocket, int tcp_keepalive_idle)
1383{
1384#   if defined (ZMQ_TCP_KEEPALIVE_IDLE)
1385    int rc = zmq_setsockopt (zocket, ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, sizeof (int));
1386    assert (rc == 0 || zmq_errno () == ETERM);
1387#   endif
1388}
1389
1390
1391//  --------------------------------------------------------------------------
1392//  Return socket ZMQ_TCP_KEEPALIVE_IDLE value
1393//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1394
1395int 
1396zsocket_tcp_keepalive_idle (void *zocket)
1397{
1398#   if defined (ZMQ_TCP_KEEPALIVE_IDLE)
1399    int tcp_keepalive_idle;
1400    size_t option_len = sizeof (int);
1401    zmq_getsockopt (zocket, ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, &option_len);
1402    return tcp_keepalive_idle;
1403#   else
1404    return 0;
1405#   endif
1406}
1407
1408
1409//  --------------------------------------------------------------------------
1410//  Set socket ZMQ_TCP_KEEPALIVE_CNT value
1411//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1412
1413void
1414zsocket_set_tcp_keepalive_cnt (void *zocket, int tcp_keepalive_cnt)
1415{
1416#   if defined (ZMQ_TCP_KEEPALIVE_CNT)
1417    int rc = zmq_setsockopt (zocket, ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, sizeof (int));
1418    assert (rc == 0 || zmq_errno () == ETERM);
1419#   endif
1420}
1421
1422
1423//  --------------------------------------------------------------------------
1424//  Return socket ZMQ_TCP_KEEPALIVE_CNT value
1425//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1426
1427int 
1428zsocket_tcp_keepalive_cnt (void *zocket)
1429{
1430#   if defined (ZMQ_TCP_KEEPALIVE_CNT)
1431    int tcp_keepalive_cnt;
1432    size_t option_len = sizeof (int);
1433    zmq_getsockopt (zocket, ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, &option_len);
1434    return tcp_keepalive_cnt;
1435#   else
1436    return 0;
1437#   endif
1438}
1439
1440
1441//  --------------------------------------------------------------------------
1442//  Set socket ZMQ_TCP_KEEPALIVE_INTVL value
1443//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1444
1445void
1446zsocket_set_tcp_keepalive_intvl (void *zocket, int tcp_keepalive_intvl)
1447{
1448#   if defined (ZMQ_TCP_KEEPALIVE_INTVL)
1449    int rc = zmq_setsockopt (zocket, ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, sizeof (int));
1450    assert (rc == 0 || zmq_errno () == ETERM);
1451#   endif
1452}
1453
1454
1455//  --------------------------------------------------------------------------
1456//  Return socket ZMQ_TCP_KEEPALIVE_INTVL value
1457//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1458
1459int 
1460zsocket_tcp_keepalive_intvl (void *zocket)
1461{
1462#   if defined (ZMQ_TCP_KEEPALIVE_INTVL)
1463    int tcp_keepalive_intvl;
1464    size_t option_len = sizeof (int);
1465    zmq_getsockopt (zocket, ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, &option_len);
1466    return tcp_keepalive_intvl;
1467#   else
1468    return 0;
1469#   endif
1470}
1471
1472
1473//  --------------------------------------------------------------------------
1474//  Set socket ZMQ_TCP_ACCEPT_FILTER value
1475//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1476
1477void
1478zsocket_set_tcp_accept_filter (void *zocket, const char * tcp_accept_filter)
1479{
1480#   if defined (ZMQ_TCP_ACCEPT_FILTER)
1481    int rc = zmq_setsockopt (zocket, ZMQ_TCP_ACCEPT_FILTER, tcp_accept_filter, strlen (tcp_accept_filter));
1482    assert (rc == 0 || zmq_errno () == ETERM);
1483#   endif
1484}
1485
1486
1487//  --------------------------------------------------------------------------
1488//  Return socket ZMQ_TCP_ACCEPT_FILTER value
1489//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1490
1491char * 
1492zsocket_tcp_accept_filter (void *zocket)
1493{
1494#   if defined (ZMQ_TCP_ACCEPT_FILTER)
1495    size_t option_len = 255;
1496    char *tcp_accept_filter = (char *) zmalloc (option_len);
1497    zmq_getsockopt (zocket, ZMQ_TCP_ACCEPT_FILTER, tcp_accept_filter, &option_len);
1498    return (char *) tcp_accept_filter;
1499#   else
1500    return NULL;
1501#   endif
1502}
1503
1504
1505//  --------------------------------------------------------------------------
1506//  Return socket ZMQ_RCVMORE value
1507//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1508
1509int 
1510zsocket_rcvmore (void *zocket)
1511{
1512#   if defined (ZMQ_RCVMORE)
1513    int rcvmore;
1514    size_t option_len = sizeof (int);
1515    zmq_getsockopt (zocket, ZMQ_RCVMORE, &rcvmore, &option_len);
1516    return rcvmore;
1517#   else
1518    return 0;
1519#   endif
1520}
1521
1522
1523//  --------------------------------------------------------------------------
1524//  Return socket ZMQ_FD value
1525//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1526
1527int 
1528zsocket_fd (void *zocket)
1529{
1530#   if defined (ZMQ_FD)
1531    int fd;
1532    size_t option_len = sizeof (int);
1533    zmq_getsockopt (zocket, ZMQ_FD, &fd, &option_len);
1534    return fd;
1535#   else
1536    return 0;
1537#   endif
1538}
1539
1540
1541//  --------------------------------------------------------------------------
1542//  Return socket ZMQ_EVENTS value
1543//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1544
1545int 
1546zsocket_events (void *zocket)
1547{
1548#   if defined (ZMQ_EVENTS)
1549    int events;
1550    size_t option_len = sizeof (int);
1551    zmq_getsockopt (zocket, ZMQ_EVENTS, &events, &option_len);
1552    return events;
1553#   else
1554    return 0;
1555#   endif
1556}
1557
1558
1559//  --------------------------------------------------------------------------
1560//  Return socket ZMQ_LAST_ENDPOINT value
1561//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1562
1563char * 
1564zsocket_last_endpoint (void *zocket)
1565{
1566#   if defined (ZMQ_LAST_ENDPOINT)
1567    size_t option_len = 255;
1568    char *last_endpoint = (char *) zmalloc (option_len);
1569    zmq_getsockopt (zocket, ZMQ_LAST_ENDPOINT, last_endpoint, &option_len);
1570    return (char *) last_endpoint;
1571#   else
1572    return NULL;
1573#   endif
1574}
1575
1576
1577#endif
1578
1579#if (ZMQ_VERSION_MAJOR == 3)
1580//  --------------------------------------------------------------------------
1581//  Set socket ZMQ_ROUTER_RAW value
1582//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1583
1584void
1585zsocket_set_router_raw (void *zocket, int router_raw)
1586{
1587#   if defined (ZMQ_ROUTER_RAW)
1588    if (zsocket_type (zocket) != ZMQ_ROUTER) {
1589        printf ("ZMQ_ROUTER_RAW is not valid on %s sockets\n", zsocket_type_str (zocket));
1590        assert (false);
1591    }
1592    int rc = zmq_setsockopt (zocket, ZMQ_ROUTER_RAW, &router_raw, sizeof (int));
1593    assert (rc == 0 || zmq_errno () == ETERM);
1594#   endif
1595}
1596
1597
1598//  --------------------------------------------------------------------------
1599//  Set socket ZMQ_IPV4ONLY value
1600//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1601
1602void
1603zsocket_set_ipv4only (void *zocket, int ipv4only)
1604{
1605#   if defined (ZMQ_IPV4ONLY)
1606    int rc = zmq_setsockopt (zocket, ZMQ_IPV4ONLY, &ipv4only, sizeof (int));
1607    assert (rc == 0 || zmq_errno () == ETERM);
1608#   endif
1609}
1610
1611
1612//  --------------------------------------------------------------------------
1613//  Return socket ZMQ_IPV4ONLY value
1614//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1615
1616int 
1617zsocket_ipv4only (void *zocket)
1618{
1619#   if defined (ZMQ_IPV4ONLY)
1620    int ipv4only;
1621    size_t option_len = sizeof (int);
1622    zmq_getsockopt (zocket, ZMQ_IPV4ONLY, &ipv4only, &option_len);
1623    return ipv4only;
1624#   else
1625    return 0;
1626#   endif
1627}
1628
1629
1630//  --------------------------------------------------------------------------
1631//  Set socket ZMQ_DELAY_ATTACH_ON_CONNECT value
1632//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1633
1634void
1635zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect)
1636{
1637#   if defined (ZMQ_DELAY_ATTACH_ON_CONNECT)
1638    int rc = zmq_setsockopt (zocket, ZMQ_DELAY_ATTACH_ON_CONNECT, &delay_attach_on_connect, sizeof (int));
1639    assert (rc == 0 || zmq_errno () == ETERM);
1640#   endif
1641}
1642
1643
1644//  --------------------------------------------------------------------------
1645//  Return socket ZMQ_TYPE value
1646//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1647
1648int 
1649zsocket_type (void *zocket)
1650{
1651#   if defined (ZMQ_TYPE)
1652    int type;
1653    size_t option_len = sizeof (int);
1654    zmq_getsockopt (zocket, ZMQ_TYPE, &type, &option_len);
1655    return type;
1656#   else
1657    return 0;
1658#   endif
1659}
1660
1661
1662//  --------------------------------------------------------------------------
1663//  Set socket ZMQ_SNDHWM value
1664//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1665
1666void
1667zsocket_set_sndhwm (void *zocket, int sndhwm)
1668{
1669#   if defined (ZMQ_SNDHWM)
1670    int rc = zmq_setsockopt (zocket, ZMQ_SNDHWM, &sndhwm, sizeof (int));
1671    assert (rc == 0 || zmq_errno () == ETERM);
1672#   endif
1673}
1674
1675
1676//  --------------------------------------------------------------------------
1677//  Return socket ZMQ_SNDHWM value
1678//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1679
1680int 
1681zsocket_sndhwm (void *zocket)
1682{
1683#   if defined (ZMQ_SNDHWM)
1684    int sndhwm;
1685    size_t option_len = sizeof (int);
1686    zmq_getsockopt (zocket, ZMQ_SNDHWM, &sndhwm, &option_len);
1687    return sndhwm;
1688#   else
1689    return 0;
1690#   endif
1691}
1692
1693
1694//  --------------------------------------------------------------------------
1695//  Set socket ZMQ_RCVHWM value
1696//  *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1697
1698void
1699zsocket_set_rcvhwm (void *zocket, int rcvhwm)
1700{
1701#   if defined (ZMQ_RCVHWM)
1702    int rc = zmq_setsockopt (zocket, ZMQ_RCVH

Large files files are truncated, but you can click here to view the full file