JNIEXPORT void JNICALL Java_org_zeromq_czmq_Zsys__1_1setInterface (JNIEnv *env, jclass c, jstring value) { char *value_ = (char *) (*env)->GetStringUTFChars (env, value, NULL); zsys_set_interface (value_); (*env)->ReleaseStringUTFChars (env, value, value_); }
/// // Set network interface name to use for broadcasts, particularly zbeacon. // This lets the interface be configured for test environments where required. // For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is // the default when there is no specified interface. If the environment // variable ZSYS_INTERFACE is set, use that as the default interface name. // Setting the interface to "*" means "use all available interfaces". void QmlZsysAttached::setInterface (const QString &value) { zsys_set_interface (value.toUtf8().data()); };
void * zsys_init (void) { if (s_initialized) { assert (s_process_ctx); return s_process_ctx; } // Pull process defaults from environment if (getenv ("ZSYS_IO_THREADS")) s_io_threads = atoi (getenv ("ZSYS_IO_THREADS")); if (getenv ("ZSYS_MAX_SOCKETS")) s_max_sockets = atoi (getenv ("ZSYS_MAX_SOCKETS")); if (getenv ("ZSYS_LINGER")) s_linger = atoi (getenv ("ZSYS_LINGER")); if (getenv ("ZSYS_SNDHWM")) s_sndhwm = atoi (getenv ("ZSYS_SNDHWM")); if (getenv ("ZSYS_RCVHWM")) s_rcvhwm = atoi (getenv ("ZSYS_RCVHWM")); if (getenv ("ZSYS_PIPEHWM")) s_pipehwm = atoi (getenv ("ZSYS_PIPEHWM")); if (getenv ("ZSYS_IPV6")) s_ipv6 = atoi (getenv ("ZSYS_IPV6")); if (getenv ("ZSYS_LOGSTREAM")) { if (streq (getenv ("ZSYS_LOGSTREAM"), "stdout")) s_logstream = stdout; else if (streq (getenv ("ZSYS_LOGSTREAM"), "stderr")) s_logstream = stderr; } else s_logstream = stdout; if (getenv ("ZSYS_LOGSYSTEM")) { if (streq (getenv ("ZSYS_LOGSYSTEM"), "true")) s_logsystem = true; else if (streq (getenv ("ZSYS_LOGSYSTEM"), "false")) s_logsystem = false; } // Catch SIGINT and SIGTERM unless ZSYS_SIGHANDLER=false if ( getenv ("ZSYS_SIGHANDLER") == NULL || strneq (getenv ("ZSYS_SIGHANDLER"), "false")) zsys_catch_interrupts (); ZMUTEX_INIT (s_mutex); s_sockref_list = zlist_new (); if (!s_sockref_list) { zsys_shutdown (); return NULL; } srandom ((unsigned) time (NULL)); atexit (zsys_shutdown); assert (!s_process_ctx); // We use zmq_init/zmq_term to keep compatibility back to ZMQ v2 s_process_ctx = zmq_init ((int) s_io_threads); #if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (3, 2, 0)) // TODO: this causes TravisCI to break; libzmq does not return a // valid socket on zmq_socket(), after this... zmq_ctx_set (s_process_ctx, ZMQ_MAX_SOCKETS, s_max_sockets); #endif s_initialized = true; // The following functions call zsys_init(), so they MUST be called after // s_initialized is set in order to avoid an infinite recursion if (getenv ("ZSYS_INTERFACE")) zsys_set_interface (getenv ("ZSYS_INTERFACE")); if (getenv ("ZSYS_LOGIDENT")) zsys_set_logident (getenv ("ZSYS_LOGIDENT")); if (getenv ("ZSYS_LOGSENDER")) zsys_set_logsender (getenv ("ZSYS_LOGSENDER")); return s_process_ctx; }
void zyre_set_interface (zyre_t *self, const char *value) { // Implemented by zsys global for now zsys_set_interface (value); }
/// // Set network interface name to use for broadcasts, particularly zbeacon. // This lets the interface be configured for test environments where required. // For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is // the default when there is no specified interface. If the environment // variable ZSYS_INTERFACE is set, use that as the default interface name. // Setting the interface to "*" means "use all available interfaces". void QZsys::setInterface (const QString &value) { zsys_set_interface (value.toUtf8().data()); }