Skip to content

Commit 0073e39

Browse files
authored
Merge pull request #214 from zebastian/master
sockopts updated to 4.3
2 parents efc0c6c + fe9e797 commit 0073e39

14 files changed

+1030
-2563
lines changed

DEVELOPERS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ line.
3636

3737
```shell
3838
git clone https://github.com/SegFaulty/DocThor
39-
php -d extension=modules/zmq.so DocThor.php --sourceDir=./ zmq
39+
php -d extension=modules/zmq.so DocThor/DocThor.php --sourceDir=./ zmq
4040
```

api.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* zmq-API v@PACKAGE_VERSION@ Docs build by DocThor [2020-02-16]
3+
* zmq-API v@PACKAGE_VERSION@ Docs build by DocThor [2020-03-15]
44
* @package zmq
55
*/
66

@@ -66,39 +66,39 @@ class ZMQ {
6666
const SOCKOPT_GSSAPI_SERVICE_PRINCIPAL = 64;
6767
const SOCKOPT_IPV6 = 42;
6868
const SOCKOPT_IMMEDIATE = 39;
69+
const SOCKOPT_SNDHWM = 23;
70+
const SOCKOPT_RCVHWM = 24;
71+
const SOCKOPT_MAXMSGSIZE = 22;
72+
const SOCKOPT_MULTICAST_HOPS = 25;
73+
const SOCKOPT_XPUB_VERBOSE = 40;
74+
const SOCKOPT_TCP_KEEPALIVE = 34;
75+
const SOCKOPT_TCP_KEEPALIVE_IDLE = 36;
76+
const SOCKOPT_TCP_KEEPALIVE_CNT = 35;
77+
const SOCKOPT_TCP_KEEPALIVE_INTVL = 37;
78+
const SOCKOPT_TCP_ACCEPT_FILTER = 38;
79+
const SOCKOPT_LAST_ENDPOINT = 32;
6980
const SOCKOPT_ROUTER_RAW = 41;
7081
const SOCKOPT_IPV4ONLY = 31;
7182
const SOCKOPT_DELAY_ATTACH_ON_CONNECT = 39;
72-
const SOCKOPT_TYPE = 16;
73-
const SOCKOPT_SNDHWM = 23;
74-
const SOCKOPT_RCVHWM = 24;
83+
const SOCKOPT_HWM = 2001;
7584
const SOCKOPT_AFFINITY = 4;
76-
const SOCKOPT_SUBSCRIBE = 6;
77-
const SOCKOPT_UNSUBSCRIBE = 7;
7885
const SOCKOPT_IDENTITY = 5;
7986
const SOCKOPT_RATE = 8;
8087
const SOCKOPT_RECOVERY_IVL = 9;
88+
const SOCKOPT_RCVTIMEO = 27;
89+
const SOCKOPT_SNDTIMEO = 28;
8190
const SOCKOPT_SNDBUF = 11;
8291
const SOCKOPT_RCVBUF = 12;
8392
const SOCKOPT_LINGER = 17;
8493
const SOCKOPT_RECONNECT_IVL = 18;
8594
const SOCKOPT_RECONNECT_IVL_MAX = 21;
8695
const SOCKOPT_BACKLOG = 19;
87-
const SOCKOPT_MAXMSGSIZE = 22;
88-
const SOCKOPT_MULTICAST_HOPS = 25;
89-
const SOCKOPT_RCVTIMEO = 27;
90-
const SOCKOPT_SNDTIMEO = 28;
91-
const SOCKOPT_XPUB_VERBOSE = 40;
92-
const SOCKOPT_TCP_KEEPALIVE = 34;
93-
const SOCKOPT_TCP_KEEPALIVE_IDLE = 36;
94-
const SOCKOPT_TCP_KEEPALIVE_CNT = 35;
95-
const SOCKOPT_TCP_KEEPALIVE_INTVL = 37;
96-
const SOCKOPT_TCP_ACCEPT_FILTER = 38;
96+
const SOCKOPT_SUBSCRIBE = 6;
97+
const SOCKOPT_UNSUBSCRIBE = 7;
98+
const SOCKOPT_TYPE = 16;
9799
const SOCKOPT_RCVMORE = 13;
98100
const SOCKOPT_FD = 14;
99101
const SOCKOPT_EVENTS = 15;
100-
const SOCKOPT_LAST_ENDPOINT = 32;
101-
const SOCKOPT_HWM = 2001;
102102
const CTXOPT_MAX_SOCKETS = 2;
103103
const CTXOPT_MAX_SOCKETS_DEFAULT = 1023;
104104
const EVENT_CONNECTED = 1;

options/generate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ then
2525
fi
2626

2727
# latest version supported
28-
$WGET https://raw.githubusercontent.com/zeromq/czmq/v4.0.0/src/sockopts.xml -O sockopts.xml
28+
# $WGET https://raw.githubusercontent.com/zeromq/czmq/v4.0.0/src/sockopts.xml -O sockopts.xml
2929

3030
# not yet working
31-
# $WGET https://raw.githubusercontent.com/zeromq/czmq/master/src/sockopts.xml -O sockopts.xml
31+
$WGET https://raw.githubusercontent.com/zeromq/czmq/master/src/sockopts.xml -O sockopts.xml
3232

3333
git diff sockopts.xml
3434

options/sockopts.xml

Lines changed: 86 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,53 @@
88
License, v. 2.0. If a copy of the MPL was not distributed with this
99
file, You can obtain one at http://mozilla.org/MPL/2.0/.
1010
-->
11-
<version major = "4" style = "macro">
11+
<version major = "4" minor = "3" style = "macro">
12+
<!-- Options that are new in 4.3 -->
13+
<option name = "only_first_subscribe" type = "int" mode = "w" test = "XPUB"
14+
test_value = "1" >
15+
<restrict type = "XPUB" />
16+
<restrict type = "XSUB" />
17+
</option>
18+
19+
<!-- We don't test these as libzmq doesn't always support WSS -->
20+
<option name = "wss_trust_system" type = "int" mode = "w" />
21+
<option name = "wss_hostname" type = "string" mode = "w" />
22+
<option name = "wss_trust_pem" type = "string" mode = "w" />
23+
<option name = "wss_cert_pem" type = "string" mode = "w" />
24+
<option name = "wss_key_pem" type = "string" mode = "w" />
25+
26+
<option name = "out_batch_size" type = "int" mode = "rw" test = "ROUTER"
27+
test_value = "16384" />
28+
<option name = "in_batch_size" type = "int" mode = "rw" test = "ROUTER"
29+
test_value = "16384" />
30+
<option name = "socks_password" type = "string" mode = "rw" test = "ROUTER"
31+
test_value = "password" />
32+
<option name = "socks_username" type = "string" mode = "rw" test = "ROUTER"
33+
test_value = "username" />
34+
<option name = "xpub_manual_last_value" type = "int" mode = "w" test = "XPUB"
35+
test_value = "1" >
36+
<restrict type = "XPUB" />
37+
</option>
38+
<option name = "router_notify" type = "int" mode = "rw" test = "ROUTER"
39+
test_value = "3" />
40+
<option name = "multicast_loop" type = "int" mode = "rw" test = "RADIO"
41+
test_value = "1" />
42+
<option name = "metadata" type = "string" mode = "rw" test = "DEALER"
43+
test_value = "X-testkey:testvalue" />
44+
<option name = "loopback_fastpath" type = "int" mode = "rw" test = "DEALER"
45+
test_value = "1" />
46+
<option name = "zap_enforce_domain" type = "int" mode = "rw" test = "DEALER"
47+
test_value = "1" />
48+
49+
<!-- We don't test these as libzmq doesn't always support GSSAPI -->
50+
<option name = "gssapi_principal_nametype" type = "int" mode = "rw" />
51+
<option name = "gssapi_service_principal_nametype" type = "int" mode = "rw" />
52+
53+
<!-- We don't test this as it requires CAP_NET_RAW or root -->
54+
<option name = "bindtodevice" type = "string" mode = "rw" />
55+
</version>
56+
57+
<version major = "4" minor = "2" style = "macro">
1258
<!-- Options that are new in 4.2 -->
1359
<option name = "heartbeat_ivl" type = "int" mode = "rw" test = "DEALER"
1460
test_value = "2000" />
@@ -54,7 +100,9 @@
54100
<option name = "vmci_buffer_min_size" type = "uint64" mode = "rw" />
55101
<option name = "vmci_buffer_max_size" type = "uint64" mode = "rw" />
56102
<option name = "vmci_connect_timeout" type = "int" mode = "rw" />
103+
</version>
57104

105+
<version major = "4" minor = "1" style = "macro">
58106
<!-- Options that are new in 4.1 -->
59107
<option name = "tos" type = "int" mode = "rw" test = "DEALER" />
60108
<option name = "router_handover" type = "int" mode = "w" test = "ROUTER">
@@ -74,7 +122,9 @@
74122
<restrict type = "XPUB" />
75123
<restrict type = "PUB" />
76124
</option>
77-
125+
</version>
126+
127+
<version major = "4" style = "macro">
78128
<!-- Options that are new in 4.0 -->
79129
<option name = "router_mandatory" type = "int" mode = "w" test = "ROUTER">
80130
<restrict type = "ROUTER" />
@@ -122,25 +172,29 @@
122172
<!-- New names for deprecated 3.x options -->
123173
<option name = "ipv6" type = "int" mode = "rw" test = "SUB" />
124174
<option name = "immediate" type = "int" mode = "rw" test = "DEALER" />
125-
126-
<!-- Deprecated 3.x options -->
127-
<option name = "router_raw" type = "int" mode = "w" test = "ROUTER">
128-
<restrict type = "ROUTER" />
129-
</option>
130-
<option name = "ipv4only" type = "int" mode = "rw" test = "SUB" />
131-
<option name = "delay_attach_on_connect"
132-
type = "int" mode = "w" test = "PUB" />
133-
134-
<!-- Options that are the same in 3.x -->
135-
<include name = "3-x options" />
136175
</version>
137176

138177
<version major = "3" style = "macro">
139178
<!-- Options that are carried forward to 4.0 -->
140-
<include name = "3-x options" />
141-
179+
<option name = "sndhwm" type = "int" mode = "rw" test = "PUB" />
180+
<option name = "rcvhwm" type = "int" mode = "rw" test = "SUB" />
181+
<option name = "maxmsgsize" type = "int64" mode = "rw" test = "SUB" />
182+
<option name = "multicast_hops" type = "int" mode = "rw" test = "SUB" />
183+
<option name = "xpub_verbose" type = "int" mode = "w" test = "XPUB">
184+
<restrict type = "XPUB" />
185+
</option>
186+
<option name = "tcp_keepalive" type = "int" mode = "rw" test = "SUB" />
187+
<option name = "tcp_keepalive_idle"
188+
type = "int" mode = "rw" test = "SUB" />
189+
<option name = "tcp_keepalive_cnt" type = "int" mode = "rw" test = "SUB" />
190+
<option name = "tcp_keepalive_intvl"
191+
type = "int" mode = "rw" test = "SUB" />
192+
<option name = "tcp_accept_filter" type = "string" mode = "rw" test = "SUB"
193+
test_value = "127.0.0.1" />
194+
<option name = "last_endpoint" type = "string" mode = "r" test = "SUB" />
195+
142196
<!-- Options that are deprecated in 4.0 -->
143-
<option name = "router_raw" type = "int" mode = "w" test = "ROUTER">
197+
<option name = "router_raw" type = "int" mode = "w" test = "ROUTER" >
144198
<restrict type = "ROUTER" />
145199
</option>
146200
<option name = "ipv4only" type = "int" mode = "rw" test = "SUB" />
@@ -150,18 +204,23 @@
150204

151205
<!-- Legacy version 2 -->
152206
<version major = "2" style = "macro">
153-
<option name = "hwm" type = "uint64" mode = "rw" test = "SUB" />
154-
<option name = "swap" type = "int64" mode = "rw" test = "SUB" />
207+
<option name = "hwm" type = "uint64" mode = "rw" test = "SUB" major_removed = "3" />
208+
<option name = "swap" type = "int64" mode = "rw" test = "SUB" major_removed = "3" />
155209
<option name = "affinity" type = "uint64" mode = "rw" test = "SUB" />
156-
<option name = "identity" type = "string" mode = "rw" test = "SUB" />
157-
<option name = "rate" type = "int64" mode = "rw" test = "SUB" />
158-
<option name = "recovery_ivl" type = "int64" mode = "rw" test = "SUB" />
159-
<option name = "recovery_ivl_msec" type = "int64" mode = "rw" test = "SUB" />
160-
<option name = "mcast_loop" type = "int64" mode = "rw" test = "SUB" />
210+
<option name = "identity" type = "string" mode = "rw" test = "DEALER">
211+
<restrict type = "REQ" />
212+
<restrict type = "REP" />
213+
<restrict type = "DEALER" />
214+
<restrict type = "ROUTER" />
215+
</option>
216+
<option name = "rate" type = "int64" mode = "rw" test = "SUB" major_changed = "3" type_new = "int" />
217+
<option name = "recovery_ivl" type = "int64" mode = "rw" test = "SUB" major_changed = "3" type_new = "int" />
218+
<option name = "recovery_ivl_msec" type = "int64" mode = "rw" test = "SUB" major_removed = "3" />
219+
<option name = "mcast_loop" type = "int64" mode = "rw" test = "SUB" major_removed = "3" />
161220
<option name = "rcvtimeo" type = "int" mode = "rw" test = "SUB" minor = "2" />
162221
<option name = "sndtimeo" type = "int" mode = "rw" test = "SUB" minor = "2" />
163-
<option name = "sndbuf" type = "uint64" mode = "rw" test = "SUB" />
164-
<option name = "rcvbuf" type = "uint64" mode = "rw" test = "SUB" />
222+
<option name = "sndbuf" type = "uint64" mode = "rw" test = "SUB" major_changed = "3" type_new = "int" />
223+
<option name = "rcvbuf" type = "uint64" mode = "rw" test = "SUB" major_changed = "3" type_new = "int" />
165224
<option name = "linger" type = "int" mode = "rw" test = "SUB" />
166225
<option name = "reconnect_ivl" type = "int" mode = "rw" test = "SUB" />
167226
<option name = "reconnect_ivl_max" type = "int" mode = "rw" test = "SUB" />
@@ -173,54 +232,8 @@
173232
<restrict type = "SUB" />
174233
</option>
175234
<option name = "type" type = "int" mode = "r" test = "SUB" />
176-
<option name = "rcvmore" type = "int64" mode = "r" test = "SUB" />
235+
<option name = "rcvmore" type = "int64" mode = "r" test = "SUB" major_changed = "3" type_new = "int" />
177236
<option name = "fd" type = "socket" mode = "r" test = "SUB" />
178-
<option name = "events" type = "uint32" mode = "r" test = "SUB" />
237+
<option name = "events" type = "uint32" mode = "r" test = "SUB" major_changed = "3" type_new = "int" />
179238
</version>
180-
181-
<macro name = "3-x options">
182-
<option name = "type" type = "int" mode = "r" test = "SUB" />
183-
<option name = "sndhwm" type = "int" mode = "rw" test = "PUB" />
184-
<option name = "rcvhwm" type = "int" mode = "rw" test = "SUB" />
185-
<option name = "affinity" type = "uint64" mode = "rw" test = "SUB" />
186-
<option name = "subscribe" type = "string" mode = "w" test = "SUB">
187-
<restrict type = "SUB" />
188-
</option>
189-
<option name = "unsubscribe" type = "string" mode = "w" test = "SUB">
190-
<restrict type = "SUB" />
191-
</option>
192-
<option name = "identity" type = "string" mode = "rw" test = "DEALER">
193-
<restrict type = "REQ" />
194-
<restrict type = "REP" />
195-
<restrict type = "DEALER" />
196-
<restrict type = "ROUTER" />
197-
</option>
198-
<option name = "rate" type = "int" mode = "rw" test = "SUB" />
199-
<option name = "recovery_ivl" type = "int" mode = "rw" test = "SUB" />
200-
<option name = "sndbuf" type = "int" mode = "rw" test = "PUB" />
201-
<option name = "rcvbuf" type = "int" mode = "rw" test = "SUB" />
202-
<option name = "linger" type = "int" mode = "rw" test = "SUB" />
203-
<option name = "reconnect_ivl" type = "int" mode = "rw" test = "SUB" />
204-
<option name = "reconnect_ivl_max" type = "int" mode = "rw" test = "SUB" />
205-
<option name = "backlog" type = "int" mode = "rw" test = "SUB" />
206-
<option name = "maxmsgsize" type = "int64" mode = "rw" test = "SUB" />
207-
<option name = "multicast_hops" type = "int" mode = "rw" test = "SUB" />
208-
<option name = "rcvtimeo" type = "int" mode = "rw" test = "SUB" />
209-
<option name = "sndtimeo" type = "int" mode = "rw" test = "SUB" />
210-
<option name = "xpub_verbose" type = "int" mode = "w" test = "XPUB">
211-
<restrict type = "XPUB" />
212-
</option>
213-
<option name = "tcp_keepalive" type = "int" mode = "rw" test = "SUB" />
214-
<option name = "tcp_keepalive_idle"
215-
type = "int" mode = "rw" test = "SUB" />
216-
<option name = "tcp_keepalive_cnt" type = "int" mode = "rw" test = "SUB" />
217-
<option name = "tcp_keepalive_intvl"
218-
type = "int" mode = "rw" test = "SUB" />
219-
<option name = "tcp_accept_filter" type = "string" mode = "rw" test = "SUB"
220-
test_value = "127.0.0.1" />
221-
<option name = "rcvmore" type = "int" mode = "r" test = "SUB" />
222-
<option name = "fd" type = "socket" mode = "r" test = "SUB" />
223-
<option name = "events" type = "int" mode = "r" test = "SUB" />
224-
<option name = "last_endpoint" type = "string" mode = "r" test = "SUB" />
225-
</macro>
226239
</options>

options/sockopts_get.gsl

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@ PHP_METHOD(zmqsocket, getsockopt)
3030
}
3131

3232
.for version
33-
#if ZMQ_VERSION_MAJOR == $(version.major)
33+
. if defined (version.major_removed)
34+
#if (ZMQ_VERSION_MAJOR >= $(version.major)) && (ZMQ_VERSION_MAJOR < $(version.major_removed))
35+
. else
36+
#if (ZMQ_VERSION_MAJOR >= $(version.major))
37+
. endif
38+
. if defined (version.minor)
39+
# if (ZMQ_VERSION_MINOR >= $(version.minor))
40+
. endif
3441

3542
switch (key) {
3643
. for option where !defined (is_alias)
@@ -42,7 +49,15 @@ PHP_METHOD(zmqsocket, getsockopt)
4249
.-
4350
. if php_type = "int"
4451
.-
52+
. if defined (major_changed)
53+
# if ZMQ_VERSION_MAJOR < $(major_changed)
4554
SOCKOPTS_GET_INT($(NAME), $(c_type));
55+
# else
56+
SOCKOPTS_GET_INT($(NAME), $(c_type_new));
57+
# endif
58+
. else
59+
SOCKOPTS_GET_INT($(NAME), $(c_type));
60+
. endif
4661
.-
4762
. elsif php_type = "string"
4863
.-
@@ -72,14 +87,17 @@ PHP_METHOD(zmqsocket, getsockopt)
7287

7388
# endif /* ZMQ_$(NAME) */
7489
. endfor /* for option */
75-
76-
default:
77-
zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), PHP_ZMQ_INTERNAL_ERROR, "Unknown option key %ld", key);
78-
return;
7990
}
8091

92+
. if defined (version.minor)
93+
# endif
94+
. endif
95+
8196
#endif /* ZMQ_VERSION_MAJOR == $(version.major) */
8297
.endfor /* .for version */
98+
99+
zend_throw_exception_ex(php_zmq_socket_exception_sc_entry_get (), PHP_ZMQ_INTERNAL_ERROR, "Unknown option key %ld", key);
100+
return;
83101
}
84102
/* }}} */
85103
.endtemplate

options/sockopts_preprocess.gsl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@ for version
2424
option.is_alias = "YES"
2525
endif
2626

27-
if type = "uint64" | type = "int64" | type = "uint32"
27+
if type = "uint64" | type = "int64" | type = "uint32" | type = "int"
2828

2929
option.php_type = "int"
3030
option.c_type = "$(type)_t"
31-
option.binary = "no"
32-
33-
elsif type = "int"
34-
35-
option.php_type = "int"
36-
option.c_type = "$(type)"
31+
if(option.c_type = "int_t")
32+
option.c_type = "int"
33+
endif
34+
if defined (major_changed)
35+
option.c_type_new = "$(type_new)_t"
36+
if(option.c_type_new = "int_t")
37+
option.c_type_new = "int"
38+
endif
39+
option.major_changed = major_changed
40+
endif
3741
option.binary = "no"
3842

3943
elsif type = "string"

0 commit comments

Comments
 (0)