LCOV - code coverage report
Current view: top level - home/h/core/forks/m4-libzmq/src - options.hpp (source / functions) Hit Total Coverage
Test: zeromq-4.2.0 Code Coverage Lines: 1 1 100.0 %
Date: 2016-05-09 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :     Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
       3             : 
       4             :     This file is part of libzmq, the ZeroMQ core engine in C++.
       5             : 
       6             :     libzmq is free software; you can redistribute it and/or modify it under
       7             :     the terms of the GNU Lesser General Public License (LGPL) as published
       8             :     by the Free Software Foundation; either version 3 of the License, or
       9             :     (at your option) any later version.
      10             : 
      11             :     As a special exception, the Contributors give you permission to link
      12             :     this library with independent modules to produce an executable,
      13             :     regardless of the license terms of these independent modules, and to
      14             :     copy and distribute the resulting executable under terms of your choice,
      15             :     provided that you also meet, for each linked independent module, the
      16             :     terms and conditions of the license of that module. An independent
      17             :     module is a module which is not derived from or based on this library.
      18             :     If you modify this library, you must extend this exception to your
      19             :     version of the library.
      20             : 
      21             :     libzmq is distributed in the hope that it will be useful, but WITHOUT
      22             :     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      23             :     FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
      24             :     License for more details.
      25             : 
      26             :     You should have received a copy of the GNU Lesser General Public License
      27             :     along with this program.  If not, see <http://www.gnu.org/licenses/>.
      28             : */
      29             : 
      30             : #ifndef __ZMQ_OPTIONS_HPP_INCLUDED__
      31             : #define __ZMQ_OPTIONS_HPP_INCLUDED__
      32             : 
      33             : #include <string>
      34             : #include <vector>
      35             : #include <set>
      36             : 
      37             : #include "stddef.h"
      38             : #include "stdint.hpp"
      39             : #include "tcp_address.hpp"
      40             : #include "../include/zmq.h"
      41             : 
      42             : #if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED
      43             : #include <sys/types.h>
      44             : #endif
      45             : #ifdef ZMQ_HAVE_LOCAL_PEERCRED
      46             : #include <sys/ucred.h>
      47             : #endif
      48             : 
      49             : //  Normal base 256 key is 32 bytes
      50             : #define CURVE_KEYSIZE       32
      51             : //  Key encoded using Z85 is 40 bytes
      52             : #define CURVE_KEYSIZE_Z85   40
      53             : 
      54             : namespace zmq
      55             : {
      56      482594 :     struct options_t
      57             :     {
      58             :         options_t ();
      59             : 
      60             :         int setsockopt (int option_, const void *optval_, size_t optvallen_);
      61             :         int getsockopt (int option_, void *optval_, size_t *optvallen_) const;
      62             : 
      63             :         bool is_valid (int option_) const;
      64             : 
      65             :         //  High-water marks for message pipes.
      66             :         int sndhwm;
      67             :         int rcvhwm;
      68             : 
      69             :         //  I/O thread affinity.
      70             :         uint64_t affinity;
      71             : 
      72             :         //  Socket identity
      73             :         unsigned char identity_size;
      74             :         unsigned char identity [256];
      75             : 
      76             :         //  Maximum transfer rate [kb/s]. Default 100kb/s.
      77             :         int rate;
      78             : 
      79             :         //  Reliability time interval [ms]. Default 10 seconds.
      80             :         int recovery_ivl;
      81             : 
      82             :         // Sets the time-to-live field in every multicast packet sent.
      83             :         int multicast_hops;
      84             : 
      85             :         // Sets the maximum transport data unit size in every multicast
      86             :         // packet sent.
      87             :         int multicast_maxtpdu;
      88             : 
      89             :         // SO_SNDBUF and SO_RCVBUF to be passed to underlying transport sockets.
      90             :         int sndbuf;
      91             :         int rcvbuf;
      92             : 
      93             :         // Type of service (containing DSCP and ECN socket options)
      94             :         int tos;
      95             : 
      96             :         //  Socket type.
      97             :         int type;
      98             : 
      99             :         //  Linger time, in milliseconds.
     100             :         int linger;
     101             : 
     102             :         //  Maximum interval in milliseconds beyond which userspace will
     103             :         //  timeout connect().
     104             :         //  Default 0 (unused)
     105             :         int connect_timeout;
     106             : 
     107             :         //  Maximum interval in milliseconds beyond which TCP will timeout
     108             :         //  retransmitted packets.
     109             :         //  Default 0 (unused)
     110             :         int tcp_maxrt;
     111             : 
     112             :         //  Minimum interval between attempts to reconnect, in milliseconds.
     113             :         //  Default 100ms
     114             :         int reconnect_ivl;
     115             : 
     116             :         //  Maximum interval between attempts to reconnect, in milliseconds.
     117             :         //  Default 0 (unused)
     118             :         int reconnect_ivl_max;
     119             : 
     120             :         //  Maximum backlog for pending connections.
     121             :         int backlog;
     122             : 
     123             :         //  Maximal size of message to handle.
     124             :         int64_t maxmsgsize;
     125             : 
     126             :         // The timeout for send/recv operations for this socket.
     127             :         int rcvtimeo;
     128             :         int sndtimeo;
     129             : 
     130             :         //  If true, IPv6 is enabled (as well as IPv4)
     131             :         bool ipv6;
     132             : 
     133             :         //  If 1, connecting pipes are not attached immediately, meaning a send()
     134             :         //  on a socket with only connecting pipes would block
     135             :         int immediate;
     136             : 
     137             :         //  If 1, (X)SUB socket should filter the messages. If 0, it should not.
     138             :         bool filter;
     139             : 
     140             :         //  If true, the subscription matching on (X)PUB and (X)SUB sockets
     141             :         //  is reversed. Messages are sent to and received by non-matching
     142             :         //  sockets.
     143             :         bool invert_matching;
     144             : 
     145             :         //  If true, the identity message is forwarded to the socket.
     146             :         bool recv_identity;
     147             : 
     148             :         // if true, router socket accepts non-zmq tcp connections
     149             :         bool raw_socket;
     150             :         bool raw_notify;        //  Provide connect notifications
     151             : 
     152             :         //  Address of SOCKS proxy
     153             :         std::string socks_proxy_address;
     154             : 
     155             :         //  TCP keep-alive settings.
     156             :         //  Defaults to -1 = do not change socket options
     157             :         int tcp_keepalive;
     158             :         int tcp_keepalive_cnt;
     159             :         int tcp_keepalive_idle;
     160             :         int tcp_keepalive_intvl;
     161             : 
     162             :         // TCP accept() filters
     163             :         typedef std::vector <tcp_address_mask_t> tcp_accept_filters_t;
     164             :         tcp_accept_filters_t tcp_accept_filters;
     165             : 
     166             :         // IPC accept() filters
     167             : #       if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED
     168             :         bool zap_ipc_creds;
     169             :         typedef std::set <uid_t> ipc_uid_accept_filters_t;
     170             :         ipc_uid_accept_filters_t ipc_uid_accept_filters;
     171             :         typedef std::set <gid_t> ipc_gid_accept_filters_t;
     172             :         ipc_gid_accept_filters_t ipc_gid_accept_filters;
     173             : #       endif
     174             : #       if defined ZMQ_HAVE_SO_PEERCRED
     175             :         typedef std::set <pid_t> ipc_pid_accept_filters_t;
     176             :         ipc_pid_accept_filters_t ipc_pid_accept_filters;
     177             : #       endif
     178             : 
     179             :         //  Security mechanism for all connections on this socket
     180             :         int mechanism;
     181             : 
     182             :         //  If peer is acting as server for PLAIN or CURVE mechanisms
     183             :         int as_server;
     184             : 
     185             :         //  ZAP authentication domain
     186             :         std::string zap_domain;
     187             : 
     188             :         //  Security credentials for PLAIN mechanism
     189             :         std::string plain_username;
     190             :         std::string plain_password;
     191             : 
     192             :         //  Security credentials for CURVE mechanism
     193             :         uint8_t curve_public_key [CURVE_KEYSIZE];
     194             :         uint8_t curve_secret_key [CURVE_KEYSIZE];
     195             :         uint8_t curve_server_key [CURVE_KEYSIZE];
     196             : 
     197             :         //  Principals for GSSAPI mechanism
     198             :         std::string gss_principal;
     199             :         std::string gss_service_principal;
     200             : 
     201             :         //  If true, gss encryption will be disabled
     202             :         bool gss_plaintext;
     203             : 
     204             :         //  ID of the socket.
     205             :         int socket_id;
     206             : 
     207             :         //  If true, socket conflates outgoing/incoming messages.
     208             :         //  Applicable to dealer, push/pull, pub/sub socket types.
     209             :         //  Cannot receive multi-part messages.
     210             :         //  Ignores hwm
     211             :         bool conflate;
     212             : 
     213             :         //  If connection handshake is not done after this many milliseconds,
     214             :         //  close socket.  Default is 30 secs.  0 means no handshake timeout.
     215             :         int handshake_ivl;
     216             : 
     217             :         bool connected;
     218             :         //  If remote peer receives a PING message and doesn't receive another
     219             :         //  message within the ttl value, it should close the connection
     220             :         //  (measured in tenths of a second)
     221             :         uint16_t heartbeat_ttl;
     222             :         //  Time in milliseconds between sending heartbeat PING messages.
     223             :         int heartbeat_interval;
     224             :         //  Time in milliseconds to wait for a PING response before disconnecting
     225             :         int heartbeat_timeout;
     226             : 
     227             : #       if defined ZMQ_HAVE_VMCI
     228             :         uint64_t vmci_buffer_size;
     229             :         uint64_t vmci_buffer_min_size;
     230             :         uint64_t vmci_buffer_max_size;
     231             :         int vmci_connect_timeout;
     232             : #       endif
     233             : 
     234             :         //  When creating a new ZMQ socket, if this option is set the value
     235             :         //  will be used as the File Descriptor instead of allocating a new
     236             :         //  one via the socket () system call.
     237             :         int use_fd;
     238             :     };
     239             : }
     240             : 
     241             : #endif

Generated by: LCOV version 1.10