File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed
Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 2525#include < vmci_sockets.h>
2626#endif
2727
28+ #ifdef ZMQ_HAVE_VSOCK
29+ #include < sys/socket.h>
30+ #include " linux/vm_sockets.h"
31+ #endif
32+
2833#ifdef ZMQ_USE_NSS
2934#include < nss.h>
3035#endif
@@ -867,6 +872,15 @@ int zmq::ctx_t::get_vmci_socket_family ()
867872
868873#endif
869874
875+ #ifdef ZMQ_HAVE_VSOCK
876+
877+ int zmq::ctx_t::get_vsock_socket_family ()
878+ {
879+ return AF_VSOCK;
880+ }
881+
882+ #endif
883+
870884// The last used socket ID, or 0 if no socket was used so far. Note that this
871885// is a global variable. Thus, even sockets created in different contexts have
872886// unique IDs.
Original file line number Diff line number Diff line change @@ -122,6 +122,10 @@ class ctx_t ZMQ_FINAL : public thread_ctx_t
122122 // Return family for the VMCI socket or -1 if it's not available.
123123 int get_vmci_socket_family ();
124124#endif
125+ #ifdef ZMQ_HAVE_VSOCK
126+ // Return family for the AF_VSOCK socket or -1 if it's not available.
127+ int get_vsock_socket_family ();
128+ #endif
125129
126130 enum
127131 {
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ int zmq::vsock_address_t::resolve (const char *path_)
9999
100100int zmq::vsock_address_t::to_string (std::string &addr_) const
101101{
102- if (address.svm_family != AF_VSOCK ) {
102+ if (address.svm_family != parent-> get_vsock_socket_family () ) {
103103 addr_.clear ();
104104 return -1 ;
105105 }
@@ -136,4 +136,10 @@ socklen_t zmq::vsock_address_t::addrlen () const
136136 return static_cast <socklen_t > (sizeof address);
137137}
138138
139+ sa_family_t zmq::vsock_address_t::family () const
140+ {
141+ return AF_VSOCK;
142+ }
143+
144+
139145#endif
You can’t perform that action at this time.
0 commit comments