diff --git a/docs/source/api/zmq.rst b/docs/source/api/zmq.rst index 2d3c9156b..9252cb27e 100644 --- a/docs/source/api/zmq.rst +++ b/docs/source/api/zmq.rst @@ -119,6 +119,10 @@ as well as via enums (``zmq.SocketType.PUSH``, etc.). .. autoenum:: Event +.. autoenum:: NormMode + +.. autoenum:: RouterNotify + .. autoenum:: SecurityMechanism .. autoenum:: DeviceType diff --git a/zmq/backend/cython/constant_enums.pxi b/zmq/backend/cython/constant_enums.pxi index f6ed04277..811d2a84f 100644 --- a/zmq/backend/cython/constant_enums.pxi +++ b/zmq/backend/cython/constant_enums.pxi @@ -88,6 +88,11 @@ cdef extern from "zmq.h" nogil: enum: ZMQ_MORE enum: ZMQ_SHARED enum: ZMQ_SRCFD + enum: ZMQ_NORM_FIXED + enum: ZMQ_NORM_CC + enum: ZMQ_NORM_CCL + enum: ZMQ_NORM_CCE + enum: ZMQ_NORM_CCE_ECNONLY enum: ZMQ_POLLIN enum: ZMQ_POLLOUT enum: ZMQ_POLLERR @@ -95,6 +100,8 @@ cdef extern from "zmq.h" nogil: enum: ZMQ_RECONNECT_STOP_CONN_REFUSED enum: ZMQ_RECONNECT_STOP_HANDSHAKE_FAILED enum: ZMQ_RECONNECT_STOP_AFTER_DISCONNECT + enum: ZMQ_NOTIFY_CONNECT + enum: ZMQ_NOTIFY_DISCONNECT enum: ZMQ_NULL enum: ZMQ_PLAIN enum: ZMQ_CURVE @@ -206,6 +213,18 @@ cdef extern from "zmq.h" nogil: enum: ZMQ_HELLO_MSG enum: ZMQ_DISCONNECT_MSG enum: ZMQ_PRIORITY + enum: ZMQ_BUSY_POLL + enum: ZMQ_HICCUP_MSG + enum: ZMQ_XSUB_VERBOSE_UNSUBSCRIBE + enum: ZMQ_TOPICS_COUNT + enum: ZMQ_NORM_MODE + enum: ZMQ_NORM_UNICAST_NACK + enum: ZMQ_NORM_BUFFER_SIZE + enum: ZMQ_NORM_SEGMENT_SIZE + enum: ZMQ_NORM_BLOCK_SIZE + enum: ZMQ_NORM_NUM_PARITY + enum: ZMQ_NORM_NUM_AUTOPARITY + enum: ZMQ_NORM_PUSH enum: ZMQ_PAIR enum: ZMQ_PUB enum: ZMQ_SUB diff --git a/zmq/constants.py b/zmq/constants.py index 64684b86e..d9859871d 100644 --- a/zmq/constants.py +++ b/zmq/constants.py @@ -257,6 +257,19 @@ def __new__(cls, value: int, opt_type: _OptType = _OptType.int): HELLO_MSG = 110, _OptType.bytes DISCONNECT_MSG = 111, _OptType.bytes PRIORITY = 112 + # 4.3.5 + BUSY_POLL = 113 + HICCUP_MSG = 114, _OptType.bytes + XSUB_VERBOSE_UNSUBSCRIBE = 115 + TOPICS_COUNT = 116 + NORM_MODE = 117 + NORM_UNICAST_NACK = 118 + NORM_BUFFER_SIZE = 119 + NORM_SEGMENT_SIZE = 120 + NORM_BLOCK_SIZE = 121 + NORM_NUM_PARITY = 122 + NORM_NUM_AUTOPARITY = 123 + NORM_PUSH = 124 class MessageOption(IntEnum): @@ -282,6 +295,39 @@ class Flag(IntFlag): NOBLOCK = DONTWAIT +class RouterNotify(IntEnum): + """Values for zmq.ROUTER_NOTIFY socket option + + .. versionadded:: 26 + .. versionadded:: libzmq-4.3.0 (draft) + """ + + @staticmethod + def _global_name(name): + return f"NOTIFY_{name}" + + CONNECT = 1 + DISCONNECT = 2 + + +class NormMode(IntEnum): + """Values for zmq.NORM_MODE socket option + + .. versionadded:: 26 + .. versionadded:: libzmq-4.3.5 (draft) + """ + + @staticmethod + def _global_name(name): + return f"NORM_{name}" + + FIXED = 0 + CC = 1 + CCL = 2 + CCE = 3 + CCE_ECNONLY = 4 + + class SecurityMechanism(IntEnum): """Security mechanisms (as returned by ``socket.get(zmq.MECHANISM)``) @@ -502,6 +548,11 @@ class DeviceType(IntEnum): MORE: int = MessageOption.MORE SHARED: int = MessageOption.SHARED SRCFD: int = MessageOption.SRCFD +NORM_FIXED: int = NormMode.FIXED +NORM_CC: int = NormMode.CC +NORM_CCL: int = NormMode.CCL +NORM_CCE: int = NormMode.CCE +NORM_CCE_ECNONLY: int = NormMode.CCE_ECNONLY POLLIN: int = PollEvent.POLLIN POLLOUT: int = PollEvent.POLLOUT POLLERR: int = PollEvent.POLLERR @@ -509,6 +560,8 @@ class DeviceType(IntEnum): RECONNECT_STOP_CONN_REFUSED: int = ReconnectStop.CONN_REFUSED RECONNECT_STOP_HANDSHAKE_FAILED: int = ReconnectStop.HANDSHAKE_FAILED RECONNECT_STOP_AFTER_DISCONNECT: int = ReconnectStop.AFTER_DISCONNECT +NOTIFY_CONNECT: int = RouterNotify.CONNECT +NOTIFY_DISCONNECT: int = RouterNotify.DISCONNECT NULL: int = SecurityMechanism.NULL PLAIN: int = SecurityMechanism.PLAIN CURVE: int = SecurityMechanism.CURVE @@ -620,6 +673,18 @@ class DeviceType(IntEnum): HELLO_MSG: int = SocketOption.HELLO_MSG DISCONNECT_MSG: int = SocketOption.DISCONNECT_MSG PRIORITY: int = SocketOption.PRIORITY +BUSY_POLL: int = SocketOption.BUSY_POLL +HICCUP_MSG: int = SocketOption.HICCUP_MSG +XSUB_VERBOSE_UNSUBSCRIBE: int = SocketOption.XSUB_VERBOSE_UNSUBSCRIBE +TOPICS_COUNT: int = SocketOption.TOPICS_COUNT +NORM_MODE: int = SocketOption.NORM_MODE +NORM_UNICAST_NACK: int = SocketOption.NORM_UNICAST_NACK +NORM_BUFFER_SIZE: int = SocketOption.NORM_BUFFER_SIZE +NORM_SEGMENT_SIZE: int = SocketOption.NORM_SEGMENT_SIZE +NORM_BLOCK_SIZE: int = SocketOption.NORM_BLOCK_SIZE +NORM_NUM_PARITY: int = SocketOption.NORM_NUM_PARITY +NORM_NUM_AUTOPARITY: int = SocketOption.NORM_NUM_AUTOPARITY +NORM_PUSH: int = SocketOption.NORM_PUSH PAIR: int = SocketType.PAIR PUB: int = SocketType.PUB SUB: int = SocketType.SUB @@ -738,6 +803,12 @@ class DeviceType(IntEnum): "MORE", "SHARED", "SRCFD", + "NormMode", + "NORM_FIXED", + "NORM_CC", + "NORM_CCL", + "NORM_CCE", + "NORM_CCE_ECNONLY", "PollEvent", "POLLIN", "POLLOUT", @@ -747,6 +818,9 @@ class DeviceType(IntEnum): "RECONNECT_STOP_CONN_REFUSED", "RECONNECT_STOP_HANDSHAKE_FAILED", "RECONNECT_STOP_AFTER_DISCONNECT", + "RouterNotify", + "NOTIFY_CONNECT", + "NOTIFY_DISCONNECT", "SecurityMechanism", "NULL", "PLAIN", @@ -860,6 +934,18 @@ class DeviceType(IntEnum): "HELLO_MSG", "DISCONNECT_MSG", "PRIORITY", + "BUSY_POLL", + "HICCUP_MSG", + "XSUB_VERBOSE_UNSUBSCRIBE", + "TOPICS_COUNT", + "NORM_MODE", + "NORM_UNICAST_NACK", + "NORM_BUFFER_SIZE", + "NORM_SEGMENT_SIZE", + "NORM_BLOCK_SIZE", + "NORM_NUM_PARITY", + "NORM_NUM_AUTOPARITY", + "NORM_PUSH", "SocketType", "PAIR", "PUB", diff --git a/zmq/tests/test_socket.py b/zmq/tests/test_socket.py index bb052611b..c305ec6d3 100644 --- a/zmq/tests/test_socket.py +++ b/zmq/tests/test_socket.py @@ -245,6 +245,11 @@ def test_int_sockopts(self): 'ONLY_FIRST_SUBSCRIBE', 'PRIORITY', 'RECONNECT_STOP', + 'NORM_', + 'ROUTER_', + 'BUSY_POLL', + 'XSUB_VERBOSE_', + 'TOPICS_', ) ): # some sockopts are write-only