/src/libzmq/src/endpoint.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* SPDX-License-Identifier: MPL-2.0 */ |
2 | | |
3 | | #ifndef __ZMQ_ENDPOINT_HPP_INCLUDED__ |
4 | | #define __ZMQ_ENDPOINT_HPP_INCLUDED__ |
5 | | |
6 | | #include <string> |
7 | | |
8 | | namespace zmq |
9 | | { |
10 | | enum endpoint_type_t |
11 | | { |
12 | | endpoint_type_none, // a connection-less endpoint |
13 | | endpoint_type_bind, // a connection-oriented bind endpoint |
14 | | endpoint_type_connect // a connection-oriented connect endpoint |
15 | | }; |
16 | | |
17 | | struct endpoint_uri_pair_t |
18 | | { |
19 | 0 | endpoint_uri_pair_t () : local_type (endpoint_type_none) {} |
20 | | endpoint_uri_pair_t (const std::string &local, |
21 | | const std::string &remote, |
22 | | endpoint_type_t local_type) : |
23 | 0 | local (local), remote (remote), local_type (local_type) |
24 | 0 | { |
25 | 0 | } |
26 | | |
27 | | const std::string &identifier () const |
28 | 0 | { |
29 | 0 | return local_type == endpoint_type_bind ? local : remote; |
30 | 0 | } |
31 | | |
32 | 0 | bool clash () const { return local == remote; } |
33 | | |
34 | | std::string local, remote; |
35 | | endpoint_type_t local_type; |
36 | | }; |
37 | | |
38 | | endpoint_uri_pair_t |
39 | | make_unconnected_connect_endpoint_pair (const std::string &endpoint_); |
40 | | |
41 | | endpoint_uri_pair_t |
42 | | make_unconnected_bind_endpoint_pair (const std::string &endpoint_); |
43 | | } |
44 | | |
45 | | #endif |