summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/signaler.cpp1
-rw-r--r--src/tcp_connecter.cpp19
-rw-r--r--src/tcp_listener.cpp31
-rw-r--r--src/uuid.cpp29
-rw-r--r--src/uuid.hpp11
5 files changed, 83 insertions, 8 deletions
diff --git a/src/signaler.cpp b/src/signaler.cpp
index 54f48c6..592688b 100644
--- a/src/signaler.cpp
+++ b/src/signaler.cpp
@@ -25,6 +25,7 @@
#if defined ZMQ_HAVE_OPENVMS
#include <netinet/tcp.h>
+#include <unistd.h>
#elif defined ZMQ_HAVE_WINDOWS
#include "windows.hpp"
#else
diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp
index 1286187..17c0257 100644
--- a/src/tcp_connecter.cpp
+++ b/src/tcp_connecter.cpp
@@ -140,6 +140,10 @@ zmq::fd_t zmq::tcp_connecter_t::connect ()
#include <netdb.h>
#include <fcntl.h>
+#ifdef ZMQ_HAVE_OPENVMS
+#include <ioctl.h>
+#endif
+
zmq::tcp_connecter_t::tcp_connecter_t () :
s (retired_fd)
{
@@ -176,11 +180,17 @@ int zmq::tcp_connecter_t::open ()
return -1;
// Set to non-blocking mode.
- int flags = fcntl (s, F_GETFL, 0);
- if (flags == -1)
+#ifdef ZMQ_HAVE_OPENVMS
+ int flags = 1;
+ int rc = ioctl (s, FIONBIO, &flags);
+ errno_assert (rc != -1);
+#else
+ int flags = fcntl (s, F_GETFL, 0);
+ if (flags == -1)
flags = 0;
- int rc = fcntl (s, F_SETFL, flags | O_NONBLOCK);
+ int rc = fcntl (s, F_SETFL, flags | O_NONBLOCK);
errno_assert (rc != -1);
+#endif
// Disable Nagle's algorithm.
int flag = 1;
@@ -215,6 +225,8 @@ int zmq::tcp_connecter_t::open ()
errno = err;
return -1;
}
+
+#ifndef ZMQ_HAVE_OPENVMS
else {
// Create the socket.
@@ -243,6 +255,7 @@ int zmq::tcp_connecter_t::open ()
errno = err;
return -1;
}
+#endif
zmq_assert (false);
return -1;
diff --git a/src/tcp_listener.cpp b/src/tcp_listener.cpp
index 437c6eb..0cb9a6e 100644
--- a/src/tcp_listener.cpp
+++ b/src/tcp_listener.cpp
@@ -140,7 +140,14 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
#include <netinet/in.h>
#include <netdb.h>
#include <fcntl.h>
+
+#ifndef ZMQ_HAVE_OPENVMS
#include <sys/un.h>
+#endif
+
+#ifdef ZMQ_HAVE_OPENVMS
+#include <ioctl.h>
+#endif
zmq::tcp_listener_t::tcp_listener_t () :
s (retired_fd)
@@ -174,11 +181,17 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_)
errno_assert (rc == 0);
// Set the non-blocking flag.
- flag = fcntl (s, F_GETFL, 0);
- if (flag == -1)
+#ifdef ZMQ_HAVE_OPENVMS
+ flag = 1;
+ rc = ioctl (s, FIONBIO, &flag);
+ errno_assert (rc != -1);
+#else
+ flag = fcntl (s, F_GETFL, 0);
+ if (flag == -1)
flag = 0;
- rc = fcntl (s, F_SETFL, flag | O_NONBLOCK);
+ rc = fcntl (s, F_SETFL, flag | O_NONBLOCK);
errno_assert (rc != -1);
+#endif
// Bind the socket to the network interface and port.
rc = bind (s, (struct sockaddr*) &addr, addr_len);
@@ -196,6 +209,7 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_)
return 0;
}
+#ifndef ZMQ_HAVE_OPENVMS
else if (strcmp (protocol_, "ipc") == 0) {
// Get rid of the file associated with the UNIX domain socket that
@@ -235,6 +249,7 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_)
return 0;
}
+#endif
else {
errno = EPROTONOSUPPORT;
return -1;
@@ -249,6 +264,7 @@ int zmq::tcp_listener_t::close ()
return -1;
s = retired_fd;
+#ifndef ZMQ_HAVE_OPENVMS
// If there's an underlying UNIX domain socket, get rid of the file it
// is associated with.
struct sockaddr_un *su = (struct sockaddr_un*) &addr;
@@ -257,6 +273,7 @@ int zmq::tcp_listener_t::close ()
if (rc != 0)
return -1;
}
+#endif
return 0;
}
@@ -299,11 +316,17 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
errno_assert (sock != -1);
// Set to non-blocking mode.
+#ifdef ZMQ_HAVE_OPENVMS
+ int flags = 1;
+ int rc = ioctl (sock, FIONBIO, &flags);
+ errno_assert (rc != -1);
+#else
int flags = fcntl (s, F_GETFL, 0);
- if (flags == -1)
+ if (flags == -1)
flags = 0;
int rc = fcntl (sock, F_SETFL, flags | O_NONBLOCK);
errno_assert (rc != -1);
+#endif
struct sockaddr *sa = (struct sockaddr*) &addr;
if (AF_UNIX != sa->sa_family) {
diff --git a/src/uuid.cpp b/src/uuid.cpp
index 5991bfb..631a625 100644
--- a/src/uuid.cpp
+++ b/src/uuid.cpp
@@ -97,6 +97,35 @@ const char *zmq::uuid_t::to_string ()
return string_buf;
}
+#elif defined ZMQ_HAVE_OPENVMS
+
+#include <starlet.h>
+
+#define uuid_generate(x) sys$create_uid(&(x))
+
+#define uuid_unparse(x, y) \
+ sprintf (y, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", \
+ x.data0, x.data1, x.data2, \
+ x.data3 [0], x.data3 [1], \
+ x.data3 [2], x.data3 [3], \
+ x.data3 [4], x.data3 [5], \
+ x.data3 [6], x.data3 [7]);
+
+zmq::uuid_t::uuid_t ()
+{
+ uuid_generate (uuid);
+ uuid_unparse (uuid, string_buf);
+}
+
+zmq::uuid_t::~uuid_t ()
+{
+}
+
+const char *zmq::uuid_t::to_string ()
+{
+ return string_buf;
+}
+
#else
#include <stdio.h>
diff --git a/src/uuid.hpp b/src/uuid.hpp
index a39bc99..da365ae 100644
--- a/src/uuid.hpp
+++ b/src/uuid.hpp
@@ -30,6 +30,14 @@
#include <uuid/uuid.h>
#elif defined ZMQ_HAVE_WINDOWS
#include <rpc.h>
+#elif defined ZMQ_HAVE_OPENVMS
+typedef struct
+{
+ unsigned long data0;
+ unsigned short data1;
+ unsigned short data2;
+ unsigned char data3 [8];
+} uuid_t;
#endif
namespace zmq
@@ -77,7 +85,8 @@ namespace zmq
::uuid_t uuid;
char *string_buf;
#elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS ||\
- defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_CYGWIN
+ defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_CYGWIN ||\
+ defined ZMQ_HAVE_OPENVMS
::uuid_t uuid;
char string_buf [uuid_string_len + 1];
#else