ip.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #ifndef __ZMQ_IP_HPP_INCLUDED__
4 #define __ZMQ_IP_HPP_INCLUDED__
5 
6 #include <string>
7 #include "fd.hpp"
8 
9 namespace zmq
10 {
11 // Same as socket(2), but allows for transparent tweaking the options.
12 fd_t open_socket (int domain_, int type_, int protocol_);
13 
14 // Sets the socket into non-blocking mode.
15 void unblock_socket (fd_t s_);
16 
17 // Enable IPv4-mapping of addresses in case it is disabled by default.
19 
20 // Returns string representation of peer's address.
21 // Socket sockfd_ must be connected. Returns true iff successful.
22 int get_peer_ip_address (fd_t sockfd_, std::string &ip_addr_);
23 
24 // Sets the IP Type-Of-Service for the underlying socket
25 void set_ip_type_of_service (fd_t s_, int iptos_);
26 
27 // Sets the protocol-defined priority for the underlying socket
28 void set_socket_priority (fd_t s_, int priority_);
29 
30 // Sets the SO_NOSIGPIPE option for the underlying socket.
31 // Return 0 on success, -1 if the connection has been closed by the peer
32 int set_nosigpipe (fd_t s_);
33 
34 // Binds the underlying socket to the given device, eg. VRF or interface
35 int bind_to_device (fd_t s_, const std::string &bound_device_);
36 
37 // Initialize network subsystem. May be called multiple times. Each call must be matched by a call to shutdown_network.
38 bool initialize_network ();
39 
40 // Shutdown network subsystem. Must be called once for each call to initialize_network before terminating.
41 void shutdown_network ();
42 
43 // Creates a pair of sockets (using signaler_port on OS using TCP sockets).
44 // Returns -1 if we could not make the socket pair successfully
45 int make_fdpair (fd_t *r_, fd_t *w_);
46 
47 // Makes a socket non-inheritable to child processes.
48 // Asserts on any failure.
49 void make_socket_noninheritable (fd_t sock_);
50 
51 // Asserts that:
52 // - an internal 0MQ error did not occur,
53 // - and, if a socket error occurred, it can be recovered from.
54 void assert_success_or_recoverable (fd_t s_, int rc_);
55 
56 #ifdef ZMQ_HAVE_IPC
57 // Create an IPC wildcard path address
58 int create_ipc_wildcard_address (std::string &path_, std::string &file_);
59 #endif
60 }
61 
62 #endif
zmq::bind_to_device
int bind_to_device(fd_t s_, const std::string &bound_device_)
Definition: ip.cpp:244
zmq::set_nosigpipe
int set_nosigpipe(fd_t s_)
Definition: ip.cpp:224
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
zmq::assert_success_or_recoverable
void assert_success_or_recoverable(fd_t s_, int rc_)
Definition: ip.cpp:830
zmq
Definition: zmq.hpp:229
zmq::shutdown_network
void shutdown_network()
Definition: ip.cpp:305
zmq::set_socket_priority
void set_socket_priority(fd_t s_, int priority_)
Definition: ip.cpp:211
s_
std::string s_
Definition: gmock-matchers_test.cc:4128
zmq::make_fdpair
int make_fdpair(fd_t *r_, fd_t *w_)
Definition: ip.cpp:532
fd.hpp
zmq::unblock_socket
void unblock_socket(fd_t s_)
Definition: ip.cpp:107
zmq::open_socket
fd_t open_socket(int domain_, int type_, int protocol_)
Definition: ip.cpp:73
zmq::initialize_network
bool initialize_network()
Definition: ip.cpp:264
zmq::get_peer_ip_address
int get_peer_ip_address(fd_t sockfd_, std::string &ip_addr_)
Definition: ip.cpp:147
zmq::set_ip_type_of_service
void set_ip_type_of_service(fd_t s_, int iptos_)
Definition: ip.cpp:187
fd_t
zmq_fd_t fd_t
Definition: libzmq/tests/testutil.hpp:98
zmq::enable_ipv4_mapping
void enable_ipv4_mapping(fd_t s_)
Definition: ip.cpp:126
zmq::make_socket_noninheritable
void make_socket_noninheritable(fd_t sock_)
Definition: ip.cpp:810
file_
FileDescriptorProto * file_
Definition: annotation_test_util.cc:68


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