From 3caa637e1b43f0665ae77fd25c5a66c08638f201 Mon Sep 17 00:00:00 2001 From: Ilya Kulakov Date: Mon, 14 Dec 2015 19:18:43 +0600 Subject: [PATCH] Add special interface to represent local VMCI context. --- doc/zmq_vmci.txt | 2 +- src/vmci_address.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/zmq_vmci.txt b/doc/zmq_vmci.txt index 1bf2dce3..1a25a007 100644 --- a/doc/zmq_vmci.txt +++ b/doc/zmq_vmci.txt @@ -34,7 +34,7 @@ colon and the TCP port number to use. An 'interface' may be specified by either of the following: * The wild-card `*`, meaning all available interfaces. -* An integer returned by `VMCISock_GetLocalCID` +* An integer returned by `VMCISock_GetLocalCID` or `@` (ZeroMQ will call VMCISock_GetLocalCID internally). The port may be specified by: diff --git a/src/vmci_address.cpp b/src/vmci_address.cpp index f3e17846..ad5b0740 100644 --- a/src/vmci_address.cpp +++ b/src/vmci_address.cpp @@ -77,6 +77,14 @@ int zmq::vmci_address_t::resolve(const char *path_) errno = EINVAL; return -1; } + else if (addr_str == "@") { + cid = VMCISock_GetLocalCID(); + + if (cid == VMADDR_CID_ANY) { + errno = ENODEV; + return -1; + } + } else if (addr_str != "*" && addr_str != "-1") { const char *begin = addr_str.c_str(); char *end = NULL;