Rebuild against 4.1.5

This commit is contained in:
persan 2016-02-17 06:49:48 +01:00
parent 238cc2ff2f
commit 52bd6a3f32
15 changed files with 959 additions and 859 deletions

View File

@ -29,6 +29,7 @@
-- OTHER DEALINGS IN THE SOFTWARE. --
-------------------------------------------------------------------------------
-- The contents of this file is derived from zmq.h using the
-- -fdump-ada-spec switch for gcc.
@ -47,320 +48,416 @@ package ZMQ.Low_Level is
pragma Warnings (Off);
package Defs is
-- This package is here to give a namespace to constants, since
-- identifiers in Ada are caseinsensetive.
-- This package is here to give a namespace to constants, since
-- identifiers in Ada are caseinsensetive.
ZMQ_VERSION_MAJOR : constant := 4; -- zmq.h:32
ZMQ_VERSION_MINOR : constant := 0; -- zmq.h:33
ZMQ_VERSION_PATCH : constant := 3; -- zmq.h:34
-- arg-macro: function ZMQ_MAKE_VERSION (major, minor, p((major) * 10000 + (minor) * 100 + (patch)
ZMQ_VERSION_MINOR : constant := 1; -- zmq.h:33
ZMQ_VERSION_PATCH : constant := 5; -- zmq.h:34
-- arg-macro: function ZMQ_MAKE_VERSION ((major) * 10000 + (minor) * 100 + (patch)
-- return (major) * 10000 + (minor) * 100 + (patch);
-- unsupported macro: ZMQ_VERSION ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH)
ZMQ_HAUSNUMERO : constant := 156384712; -- zmq.h:97
EFSM : constant := ZMQ_HAUSNUMERO + 51;
ZMQ_DEFINED_STDINT : constant := 1; -- zmq.h:74
ZMQ_HAUSNUMERO : constant := 156384712; -- zmq.h:98
EFSM : constant := ZMQ_HAUSNUMERO + 51;
ENOCOMPATPROTO : constant := ZMQ_HAUSNUMERO + 52;
ETERM : constant := ZMQ_HAUSNUMERO + 53;
EMTHREAD : constant := ZMQ_HAUSNUMERO + 54;
ETERM : constant := ZMQ_HAUSNUMERO + 53;
EMTHREAD : constant := ZMQ_HAUSNUMERO + 54;
ZMQ_IO_THREADS : constant := 1; -- zmq.h:179
ZMQ_MAX_SOCKETS : constant := 2; -- zmq.h:180
ZMQ_IO_THREADS : constant := 1; -- zmq.h:180
ZMQ_MAX_SOCKETS : constant := 2; -- zmq.h:181
ZMQ_SOCKET_LIMIT : constant := 3; -- zmq.h:182
ZMQ_THREAD_PRIORITY : constant := 3; -- zmq.h:183
ZMQ_THREAD_SCHED_POLICY : constant := 4; -- zmq.h:184
ZMQ_IO_THREADS_DFLT : constant := 1; -- zmq.h:183
ZMQ_MAX_SOCKETS_DFLT : constant := 1023; -- zmq.h:184
ZMQ_IO_THREADS_DFLT : constant := 1; -- zmq.h:187
ZMQ_MAX_SOCKETS_DFLT : constant := 1023; -- zmq.h:188
ZMQ_THREAD_PRIORITY_DFLT : constant := -1; -- zmq.h:189
ZMQ_THREAD_SCHED_POLICY_DFLT : constant := -1; -- zmq.h:190
ZMQ_PAIR : constant := 0; -- zmq.h:227
ZMQ_PUB : constant := 1; -- zmq.h:228
ZMQ_SUB : constant := 2; -- zmq.h:229
ZMQ_REQ : constant := 3; -- zmq.h:230
ZMQ_REP : constant := 4; -- zmq.h:231
ZMQ_DEALER : constant := 5; -- zmq.h:232
ZMQ_ROUTER : constant := 6; -- zmq.h:233
ZMQ_PULL : constant := 7; -- zmq.h:234
ZMQ_PUSH : constant := 8; -- zmq.h:235
ZMQ_XPUB : constant := 9; -- zmq.h:236
ZMQ_XSUB : constant := 10; -- zmq.h:237
ZMQ_STREAM : constant := 11; -- zmq.h:238
ZMQ_XREQ : constant := ZMQ_DEALER;
ZMQ_XREP : constant := ZMQ_ROUTER;
ZMQ_PAIR : constant := 0; -- zmq.h:234
ZMQ_PUB : constant := 1; -- zmq.h:235
ZMQ_SUB : constant := 2; -- zmq.h:236
ZMQ_REQ : constant := 3; -- zmq.h:237
ZMQ_REP : constant := 4; -- zmq.h:238
ZMQ_DEALER : constant := 5; -- zmq.h:239
ZMQ_ROUTER : constant := 6; -- zmq.h:240
ZMQ_PULL : constant := 7; -- zmq.h:241
ZMQ_PUSH : constant := 8; -- zmq.h:242
ZMQ_XPUB : constant := 9; -- zmq.h:243
ZMQ_XSUB : constant := 10; -- zmq.h:244
ZMQ_STREAM : constant := 11; -- zmq.h:245
ZMQ_XREQ : constant := ZMQ_DEALER;
ZMQ_XREP : constant := ZMQ_ROUTER;
ZMQ_AFFINITY : constant := 4; -- zmq.h:245
ZMQ_IDENTITY : constant := 5; -- zmq.h:246
ZMQ_SUBSCRIBE : constant := 6; -- zmq.h:247
ZMQ_UNSUBSCRIBE : constant := 7; -- zmq.h:248
ZMQ_RATE : constant := 8; -- zmq.h:249
ZMQ_RECOVERY_IVL : constant := 9; -- zmq.h:250
ZMQ_SNDBUF : constant := 11; -- zmq.h:251
ZMQ_RCVBUF : constant := 12; -- zmq.h:252
ZMQ_RCVMORE : constant := 13; -- zmq.h:253
ZMQ_FD : constant := 14; -- zmq.h:254
ZMQ_EVENTS : constant := 15; -- zmq.h:255
ZMQ_TYPE : constant := 16; -- zmq.h:256
ZMQ_LINGER : constant := 17; -- zmq.h:257
ZMQ_RECONNECT_IVL : constant := 18; -- zmq.h:258
ZMQ_BACKLOG : constant := 19; -- zmq.h:259
ZMQ_RECONNECT_IVL_MAX : constant := 21; -- zmq.h:260
ZMQ_MAXMSGSIZE : constant := 22; -- zmq.h:261
ZMQ_SNDHWM : constant := 23; -- zmq.h:262
ZMQ_RCVHWM : constant := 24; -- zmq.h:263
ZMQ_MULTICAST_HOPS : constant := 25; -- zmq.h:264
ZMQ_RCVTIMEO : constant := 27; -- zmq.h:265
ZMQ_SNDTIMEO : constant := 28; -- zmq.h:266
ZMQ_LAST_ENDPOINT : constant := 32; -- zmq.h:267
ZMQ_ROUTER_MANDATORY : constant := 33; -- zmq.h:268
ZMQ_TCP_KEEPALIVE : constant := 34; -- zmq.h:269
ZMQ_TCP_KEEPALIVE_CNT : constant := 35; -- zmq.h:270
ZMQ_TCP_KEEPALIVE_IDLE : constant := 36; -- zmq.h:271
ZMQ_TCP_KEEPALIVE_INTVL : constant := 37; -- zmq.h:272
ZMQ_TCP_ACCEPT_FILTER : constant := 38; -- zmq.h:273
ZMQ_IMMEDIATE : constant := 39; -- zmq.h:274
ZMQ_XPUB_VERBOSE : constant := 40; -- zmq.h:275
ZMQ_ROUTER_RAW : constant := 41; -- zmq.h:276
ZMQ_IPV6 : constant := 42; -- zmq.h:277
ZMQ_MECHANISM : constant := 43; -- zmq.h:278
ZMQ_PLAIN_SERVER : constant := 44; -- zmq.h:279
ZMQ_PLAIN_USERNAME : constant := 45; -- zmq.h:280
ZMQ_PLAIN_PASSWORD : constant := 46; -- zmq.h:281
ZMQ_CURVE_SERVER : constant := 47; -- zmq.h:282
ZMQ_CURVE_PUBLICKEY : constant := 48; -- zmq.h:283
ZMQ_CURVE_SECRETKEY : constant := 49; -- zmq.h:284
ZMQ_CURVE_SERVERKEY : constant := 50; -- zmq.h:285
ZMQ_PROBE_ROUTER : constant := 51; -- zmq.h:286
ZMQ_REQ_CORRELATE : constant := 52; -- zmq.h:287
ZMQ_REQ_RELAXED : constant := 53; -- zmq.h:288
ZMQ_CONFLATE : constant := 54; -- zmq.h:289
ZMQ_ZAP_DOMAIN : constant := 55; -- zmq.h:290
ZMQ_AFFINITY : constant := 4; -- zmq.h:252
ZMQ_IDENTITY : constant := 5; -- zmq.h:253
ZMQ_SUBSCRIBE : constant := 6; -- zmq.h:254
ZMQ_UNSUBSCRIBE : constant := 7; -- zmq.h:255
ZMQ_RATE : constant := 8; -- zmq.h:256
ZMQ_RECOVERY_IVL : constant := 9; -- zmq.h:257
ZMQ_SNDBUF : constant := 11; -- zmq.h:258
ZMQ_RCVBUF : constant := 12; -- zmq.h:259
ZMQ_RCVMORE : constant := 13; -- zmq.h:260
ZMQ_FD : constant := 14; -- zmq.h:261
ZMQ_EVENTS : constant := 15; -- zmq.h:262
ZMQ_TYPE : constant := 16; -- zmq.h:263
ZMQ_LINGER : constant := 17; -- zmq.h:264
ZMQ_RECONNECT_IVL : constant := 18; -- zmq.h:265
ZMQ_BACKLOG : constant := 19; -- zmq.h:266
ZMQ_RECONNECT_IVL_MAX : constant := 21; -- zmq.h:267
ZMQ_MAXMSGSIZE : constant := 22; -- zmq.h:268
ZMQ_SNDHWM : constant := 23; -- zmq.h:269
ZMQ_RCVHWM : constant := 24; -- zmq.h:270
ZMQ_MULTICAST_HOPS : constant := 25; -- zmq.h:271
ZMQ_RCVTIMEO : constant := 27; -- zmq.h:272
ZMQ_SNDTIMEO : constant := 28; -- zmq.h:273
ZMQ_LAST_ENDPOINT : constant := 32; -- zmq.h:274
ZMQ_ROUTER_MANDATORY : constant := 33; -- zmq.h:275
ZMQ_TCP_KEEPALIVE : constant := 34; -- zmq.h:276
ZMQ_TCP_KEEPALIVE_CNT : constant := 35; -- zmq.h:277
ZMQ_TCP_KEEPALIVE_IDLE : constant := 36; -- zmq.h:278
ZMQ_TCP_KEEPALIVE_INTVL : constant := 37; -- zmq.h:279
ZMQ_IMMEDIATE : constant := 39; -- zmq.h:280
ZMQ_XPUB_VERBOSE : constant := 40; -- zmq.h:281
ZMQ_ROUTER_RAW : constant := 41; -- zmq.h:282
ZMQ_IPV6 : constant := 42; -- zmq.h:283
ZMQ_MECHANISM : constant := 43; -- zmq.h:284
ZMQ_PLAIN_SERVER : constant := 44; -- zmq.h:285
ZMQ_PLAIN_USERNAME : constant := 45; -- zmq.h:286
ZMQ_PLAIN_PASSWORD : constant := 46; -- zmq.h:287
ZMQ_CURVE_SERVER : constant := 47; -- zmq.h:288
ZMQ_CURVE_PUBLICKEY : constant := 48; -- zmq.h:289
ZMQ_CURVE_SECRETKEY : constant := 49; -- zmq.h:290
ZMQ_CURVE_SERVERKEY : constant := 50; -- zmq.h:291
ZMQ_PROBE_ROUTER : constant := 51; -- zmq.h:292
ZMQ_REQ_CORRELATE : constant := 52; -- zmq.h:293
ZMQ_REQ_RELAXED : constant := 53; -- zmq.h:294
ZMQ_CONFLATE : constant := 54; -- zmq.h:295
ZMQ_ZAP_DOMAIN : constant := 55; -- zmq.h:296
ZMQ_ROUTER_HANDOVER : constant := 56; -- zmq.h:297
ZMQ_TOS : constant := 57; -- zmq.h:298
ZMQ_CONNECT_RID : constant := 61; -- zmq.h:299
ZMQ_GSSAPI_SERVER : constant := 62; -- zmq.h:300
ZMQ_GSSAPI_PRINCIPAL : constant := 63; -- zmq.h:301
ZMQ_GSSAPI_SERVICE_PRINCIPAL : constant := 64; -- zmq.h:302
ZMQ_GSSAPI_PLAINTEXT : constant := 65; -- zmq.h:303
ZMQ_HANDSHAKE_IVL : constant := 66; -- zmq.h:304
ZMQ_SOCKS_PROXY : constant := 68; -- zmq.h:305
ZMQ_XPUB_NODROP : constant := 69; -- zmq.h:306
ZMQ_MORE : constant := 1; -- zmq.h:293
ZMQ_MORE : constant := 1; -- zmq.h:309
ZMQ_SRCFD : constant := 2; -- zmq.h:310
ZMQ_SHARED : constant := 3; -- zmq.h:311
ZMQ_DONTWAIT : constant := 1; -- zmq.h:296
ZMQ_SNDMORE : constant := 2; -- zmq.h:297
ZMQ_DONTWAIT : constant := 1; -- zmq.h:314
ZMQ_SNDMORE : constant := 2; -- zmq.h:315
ZMQ_NULL : constant := 0; -- zmq.h:300
ZMQ_PLAIN : constant := 1; -- zmq.h:301
ZMQ_CURVE : constant := 2; -- zmq.h:302
ZMQ_NULL : constant := 0; -- zmq.h:318
ZMQ_PLAIN : constant := 1; -- zmq.h:319
ZMQ_CURVE : constant := 2; -- zmq.h:320
ZMQ_GSSAPI : constant := 3; -- zmq.h:321
ZMQ_IPV4ONLY : constant := 31; -- zmq.h:305
ZMQ_DELAY_ATTACH_ON_CONNECT : constant := ZMQ_IMMEDIATE;
ZMQ_NOBLOCK : constant := ZMQ_DONTWAIT;
ZMQ_FAIL_UNROUTABLE : constant := ZMQ_ROUTER_MANDATORY;
ZMQ_ROUTER_BEHAVIOR : constant := ZMQ_ROUTER_MANDATORY;
ZMQ_TCP_ACCEPT_FILTER : constant := 38; -- zmq.h:324
ZMQ_IPC_FILTER_PID : constant := 58; -- zmq.h:325
ZMQ_IPC_FILTER_UID : constant := 59; -- zmq.h:326
ZMQ_IPC_FILTER_GID : constant := 60; -- zmq.h:327
ZMQ_IPV4ONLY : constant := 31; -- zmq.h:328
ZMQ_DELAY_ATTACH_ON_CONNECT : constant := ZMQ_IMMEDIATE;
ZMQ_NOBLOCK : constant := ZMQ_DONTWAIT;
ZMQ_FAIL_UNROUTABLE : constant := ZMQ_ROUTER_MANDATORY;
ZMQ_ROUTER_BEHAVIOR : constant := ZMQ_ROUTER_MANDATORY;
ZMQ_EVENT_CONNECTED : constant := 1; -- zmq.h:316
ZMQ_EVENT_CONNECT_DELAYED : constant := 2; -- zmq.h:317
ZMQ_EVENT_CONNECT_RETRIED : constant := 4; -- zmq.h:318
ZMQ_EVENT_CONNECTED : constant := 16#0001#; -- zmq.h:340
ZMQ_EVENT_CONNECT_DELAYED : constant := 16#0002#; -- zmq.h:341
ZMQ_EVENT_CONNECT_RETRIED : constant := 16#0004#; -- zmq.h:342
ZMQ_EVENT_LISTENING : constant := 16#0008#; -- zmq.h:343
ZMQ_EVENT_BIND_FAILED : constant := 16#0010#; -- zmq.h:344
ZMQ_EVENT_ACCEPTED : constant := 16#0020#; -- zmq.h:345
ZMQ_EVENT_ACCEPT_FAILED : constant := 16#0040#; -- zmq.h:346
ZMQ_EVENT_CLOSED : constant := 16#0080#; -- zmq.h:347
ZMQ_EVENT_CLOSE_FAILED : constant := 16#0100#; -- zmq.h:348
ZMQ_EVENT_DISCONNECTED : constant := 16#0200#; -- zmq.h:349
ZMQ_EVENT_MONITOR_STOPPED : constant := 16#0400#; -- zmq.h:350
ZMQ_EVENT_ALL : constant := 16#FFFF#; -- zmq.h:351
ZMQ_EVENT_LISTENING : constant := 8; -- zmq.h:320
ZMQ_EVENT_BIND_FAILED : constant := 16; -- zmq.h:321
ZMQ_POLLIN : constant := 1; -- zmq.h:373
ZMQ_POLLOUT : constant := 2; -- zmq.h:374
ZMQ_POLLERR : constant := 4; -- zmq.h:375
ZMQ_EVENT_ACCEPTED : constant := 32; -- zmq.h:323
ZMQ_EVENT_ACCEPT_FAILED : constant := 64; -- zmq.h:324
ZMQ_POLLITEMS_DFLT : constant := 16; -- zmq.h:389
ZMQ_EVENT_CLOSED : constant := 128; -- zmq.h:326
ZMQ_EVENT_CLOSE_FAILED : constant := 256; -- zmq.h:327
ZMQ_EVENT_DISCONNECTED : constant := 512; -- zmq.h:328
ZMQ_EVENT_MONITOR_STOPPED : constant := 1024; -- zmq.h:329
-- unsupported macro: ZMQ_EVENT_ALL ( ZMQ_EVENT_CONNECTED | ZMQ_EVENT_CONNECT_DELAYED | ZMQ_EVENT_CONNECT_RETRIED | ZMQ_EVENT_LISTENING | ZMQ_EVENT_BIND_FAILED | ZMQ_EVENT_ACCEPTED | ZMQ_EVENT_ACCEPT_FAILED | ZMQ_EVENT_CLOSED | ZMQ_EVENT_CLOSE_FAILED | ZMQ_EVENT_DISCONNECTED | ZMQ_EVENT_MONITOR_STOPPED)
ZMQ_HAS_CAPABILITIES : constant := 1; -- zmq.h:404
ZMQ_POLLIN : constant := 1; -- zmq.h:372
ZMQ_POLLOUT : constant := 2; -- zmq.h:373
ZMQ_POLLERR : constant := 4; -- zmq.h:374
ZMQ_STREAMER : constant := 1; -- zmq.h:408
ZMQ_FORWARDER : constant := 2; -- zmq.h:409
ZMQ_QUEUE : constant := 3; -- zmq.h:410
ZMQ_POLLITEMS_DFLT : constant := 16; -- zmq.h:388
function Zmq_Errno return Int; -- zmq.h:166
pragma Import (C, Zmq_Errno, "zmq_errno");
ZMQ_STREAMER : constant := 1; -- zmq.h:403
ZMQ_FORWARDER : constant := 2; -- zmq.h:404
ZMQ_QUEUE : constant := 3; -- zmq.h:405
function Zmq_Strerror (Errnum : Int) return Interfaces.C.Strings.Chars_Ptr; -- zmq.h:169
pragma Import (C, Zmq_Strerror, "zmq_strerror");
end Defs;
procedure zmq_version (major : access int; minor : access int; patch : access int); -- zmq.h:162
pragma Import (C, zmq_version, "zmq_version");
procedure Zmq_Version
(Major : access Int;
Minor : access Int;
Patch : access Int); -- zmq.h:172
pragma Import (C, Zmq_Version, "zmq_version");
function zmq_errno return int; -- zmq.h:168
pragma Import (C, zmq_errno, "zmq_errno");
function Zmq_Ctx_New return System.Address; -- zmq.h:192
pragma Import (C, Zmq_Ctx_New, "zmq_ctx_new");
function zmq_strerror (errnum : int) return Interfaces.C.Strings.chars_ptr; -- zmq.h:171
pragma Import (C, zmq_strerror, "zmq_strerror");
function zmq_ctx_new return System.Address; -- zmq.h:186
pragma Import (C, zmq_ctx_new, "zmq_ctx_new");
function zmq_ctx_term (context : System.Address) return int; -- zmq.h:187
function Zmq_Ctx_Term (Context : System.Address) return Int; -- zmq.h:193
pragma Obsolescent;
pragma Import (C, zmq_ctx_term, "zmq_ctx_term");
pragma Import (C, Zmq_Ctx_Term, "zmq_ctx_term");
function zmq_ctx_shutdown (ctx_u : System.Address) return int; -- zmq.h:188
function Zmq_Ctx_Shutdown (Ctx_U : System.Address) return Int; -- zmq.h:194
pragma Obsolescent;
pragma Import (C, zmq_ctx_shutdown, "zmq_ctx_shutdown");
pragma Import (C, Zmq_Ctx_Shutdown, "zmq_ctx_shutdown");
function zmq_ctx_set (context : System.Address; option : int; optval : int) return int; -- zmq.h:189
pragma Import (C, zmq_ctx_set, "zmq_ctx_set");
function Zmq_Ctx_Set
(Context : System.Address;
Option : Int;
Optval : Int) return Int; -- zmq.h:195
pragma Import (C, Zmq_Ctx_Set, "zmq_ctx_set");
function zmq_ctx_get (context : System.Address; option : int) return int; -- zmq.h:190
pragma Import (C, zmq_ctx_get, "zmq_ctx_get");
function Zmq_Ctx_Get (Context : System.Address; Option : Int) return Int; -- zmq.h:196
pragma Import (C, Zmq_Ctx_Get, "zmq_ctx_get");
function zmq_init (io_threads : int) return System.Address; -- zmq.h:193
pragma Import (C, zmq_init, "zmq_init");
function Zmq_Init (Io_Threads : Int) return System.Address; -- zmq.h:199
pragma Import (C, Zmq_Init, "zmq_init");
function zmq_term (context : System.Address) return int; -- zmq.h:194
function Zmq_Term (Context : System.Address) return Int; -- zmq.h:200
pragma Obsolescent;
pragma Import (C, zmq_term, "zmq_term");
pragma Import (C, Zmq_Term, "zmq_term");
function zmq_ctx_destroy (context : System.Address) return int; -- zmq.h:195
pragma Import (C, zmq_ctx_destroy, "zmq_ctx_destroy");
function Zmq_Ctx_Destroy (Context : System.Address) return Int; -- zmq.h:201
pragma Import (C, Zmq_Ctx_Destroy, "zmq_ctx_destroy");
type zmq_msg_t_u_u_array is array (0 .. 31) of aliased unsigned_char;
type zmq_msg_t is record
u_u : aliased zmq_msg_t_u_u_array; -- zmq.h:202
type Zmq_Msg_T_U_U_Array is array (0 .. 63) of aliased Unsigned_Char;
type Zmq_Msg_T is record
U_U : aliased Zmq_Msg_T_U_U_Array; -- zmq.h:208
end record;
pragma Convention (C_Pass_By_Copy, zmq_msg_t); -- zmq.h:202
pragma Convention (C_Pass_By_Copy, Zmq_Msg_T); -- zmq.h:208
-- skipped function type zmq_free_fn
function zmq_msg_init (msg : access zmq_msg_t) return int; -- zmq.h:206
pragma Import (C, zmq_msg_init, "zmq_msg_init");
function Zmq_Msg_Init (Msg : access Zmq_Msg_T) return Int; -- zmq.h:212
pragma Import (C, Zmq_Msg_Init, "zmq_msg_init");
function zmq_msg_init_size (msg : access zmq_msg_t; size : size_t) return int; -- zmq.h:207
pragma Import (C, zmq_msg_init_size, "zmq_msg_init_size");
function Zmq_Msg_Init_Size (Msg : access Zmq_Msg_T; Size : size_t) return Int; -- zmq.h:213
pragma Import (C, Zmq_Msg_Init_Size, "zmq_msg_init_size");
function zmq_msg_init_data
(msg : access zmq_msg_t;
data : System.Address;
size : size_t;
ffn : access procedure (arg1 : System.Address; arg2 : System.Address);
hint : System.Address) return int; -- zmq.h:208
pragma Import (C, zmq_msg_init_data, "zmq_msg_init_data");
function Zmq_Msg_Init_Data
(Msg : access Zmq_Msg_T;
Data : System.Address;
Size : size_t;
Ffn : access procedure (Arg1 : System.Address; Arg2 : System.Address);
Hint : System.Address) return Int; -- zmq.h:214
pragma Import (C, Zmq_Msg_Init_Data, "zmq_msg_init_data");
function zmq_msg_send (msg : access zmq_msg_t; s : System.Address; flags : int) return int; -- zmq.h:210
pragma Import (C, zmq_msg_send, "zmq_msg_send");
function Zmq_Msg_Send
(Msg : access Zmq_Msg_T;
S : System.Address;
Flags : Int) return Int; -- zmq.h:216
pragma Import (C, Zmq_Msg_Send, "zmq_msg_send");
function zmq_msg_recv (msg : access zmq_msg_t; s : System.Address; flags : int) return int; -- zmq.h:211
pragma Import (C, zmq_msg_recv, "zmq_msg_recv");
function Zmq_Msg_Recv
(Msg : access Zmq_Msg_T;
S : System.Address;
Flags : Int) return Int; -- zmq.h:217
pragma Import (C, Zmq_Msg_Recv, "zmq_msg_recv");
function zmq_msg_close (msg : access zmq_msg_t) return int; -- zmq.h:212
pragma Import (C, zmq_msg_close, "zmq_msg_close");
function Zmq_Msg_Close (Msg : access Zmq_Msg_T) return Int; -- zmq.h:218
pragma Import (C, Zmq_Msg_Close, "zmq_msg_close");
function zmq_msg_move (dest : access zmq_msg_t; src : access zmq_msg_t) return int; -- zmq.h:213
pragma Import (C, zmq_msg_move, "zmq_msg_move");
function Zmq_Msg_Move (Dest : access Zmq_Msg_T; Src : access Zmq_Msg_T) return Int; -- zmq.h:219
pragma Import (C, Zmq_Msg_Move, "zmq_msg_move");
function zmq_msg_copy (dest : access zmq_msg_t; src : access zmq_msg_t) return int; -- zmq.h:214
pragma Import (C, zmq_msg_copy, "zmq_msg_copy");
function Zmq_Msg_Copy (Dest : access Zmq_Msg_T; Src : access Zmq_Msg_T) return Int; -- zmq.h:220
pragma Import (C, Zmq_Msg_Copy, "zmq_msg_copy");
function zmq_msg_data (msg : access zmq_msg_t) return System.Address; -- zmq.h:215
pragma Import (C, zmq_msg_data, "zmq_msg_data");
function Zmq_Msg_Data (Msg : access Zmq_Msg_T) return System.Address; -- zmq.h:221
pragma Import (C, Zmq_Msg_Data, "zmq_msg_data");
function zmq_msg_size (msg : access zmq_msg_t) return size_t; -- zmq.h:216
pragma Import (C, zmq_msg_size, "zmq_msg_size");
function Zmq_Msg_Size (Msg : access Zmq_Msg_T) return size_t; -- zmq.h:222
pragma Import (C, Zmq_Msg_Size, "zmq_msg_size");
function zmq_msg_more (msg : access zmq_msg_t) return int; -- zmq.h:217
pragma Import (C, zmq_msg_more, "zmq_msg_more");
function Zmq_Msg_More (Msg : access Zmq_Msg_T) return Int; -- zmq.h:223
pragma Import (C, Zmq_Msg_More, "zmq_msg_more");
function zmq_msg_get (msg : access zmq_msg_t; option : int) return int; -- zmq.h:218
pragma Import (C, zmq_msg_get, "zmq_msg_get");
function Zmq_Msg_Get (Msg : access Zmq_Msg_T; Property : Int) return Int; -- zmq.h:224
pragma Import (C, Zmq_Msg_Get, "zmq_msg_get");
function zmq_msg_set (msg : access zmq_msg_t; option : int; optval : int) return int; -- zmq.h:219
pragma Import (C, zmq_msg_set, "zmq_msg_set");
function Zmq_Msg_Set
(Msg : access Zmq_Msg_T;
Property : Int;
Optval : Int) return Int; -- zmq.h:225
pragma Import (C, Zmq_Msg_Set, "zmq_msg_set");
type zmq_event_t is record
event : aliased Extensions.Unsigned_16; -- zmq.h:340
value : aliased Extensions.Signed_32; -- zmq.h:341
function Zmq_Msg_Gets (Msg : access Zmq_Msg_T; Property : Interfaces.C.Strings.Chars_Ptr) return Interfaces.C.Strings.Chars_Ptr; -- zmq.h:226
pragma Import (C, Zmq_Msg_Gets, "zmq_msg_gets");
function Zmq_Socket (Arg1 : System.Address; C_Type : Int) return System.Address; -- zmq.h:353
pragma Import (C, Zmq_Socket, "zmq_socket");
function Zmq_Close (S : System.Address) return Int; -- zmq.h:354
pragma Import (C, Zmq_Close, "zmq_close");
function Zmq_Setsockopt
(S : System.Address;
Option : Int;
Optval : System.Address;
Optvallen : size_t) return Int; -- zmq.h:355
pragma Import (C, Zmq_Setsockopt, "zmq_setsockopt");
function Zmq_Getsockopt
(S : System.Address;
Option : Int;
Optval : System.Address;
Optvallen : access size_t) return Int; -- zmq.h:357
pragma Import (C, Zmq_Getsockopt, "zmq_getsockopt");
function Zmq_Bind (S : System.Address; Addr : Interfaces.C.Strings.Chars_Ptr) return Int; -- zmq.h:359
pragma Import (C, Zmq_Bind, "zmq_bind");
function Zmq_Connect (S : System.Address; Addr : Interfaces.C.Strings.Chars_Ptr) return Int; -- zmq.h:360
pragma Import (C, Zmq_Connect, "zmq_connect");
function Zmq_Unbind (S : System.Address; Addr : Interfaces.C.Strings.Chars_Ptr) return Int; -- zmq.h:361
pragma Import (C, Zmq_Unbind, "zmq_unbind");
function Zmq_Disconnect (S : System.Address; Addr : Interfaces.C.Strings.Chars_Ptr) return Int; -- zmq.h:362
pragma Import (C, Zmq_Disconnect, "zmq_disconnect");
function Zmq_Send
(S : System.Address;
Buf : System.Address;
Len : size_t;
Flags : Int) return Int; -- zmq.h:363
pragma Import (C, Zmq_Send, "zmq_send");
function Zmq_Send_Const
(S : System.Address;
Buf : System.Address;
Len : size_t;
Flags : Int) return Int; -- zmq.h:364
pragma Import (C, Zmq_Send_Const, "zmq_send_const");
function Zmq_Recv
(S : System.Address;
Buf : System.Address;
Len : size_t;
Flags : Int) return Int; -- zmq.h:365
pragma Import (C, Zmq_Recv, "zmq_recv");
function Zmq_Socket_Monitor
(S : System.Address;
Addr : Interfaces.C.Strings.Chars_Ptr;
Events : Int) return Int; -- zmq.h:366
pragma Import (C, Zmq_Socket_Monitor, "zmq_socket_monitor");
type Zmq_Pollitem_T is record
Socket : System.Address; -- zmq.h:379
Fd : aliased Int; -- zmq.h:383
Events : aliased Short; -- zmq.h:385
Revents : aliased Short; -- zmq.h:386
end record;
pragma Convention (C_Pass_By_Copy, zmq_event_t); -- zmq.h:342
pragma Convention (C_Pass_By_Copy, Zmq_Pollitem_T); -- zmq.h:377
-- skipped anonymous struct anon_6
function Zmq_Poll
(Items : access Zmq_Pollitem_T;
Nitems : Int;
Timeout : Long) return Int; -- zmq.h:391
pragma Import (C, Zmq_Poll, "zmq_poll");
function zmq_socket (arg1 : System.Address; c_type : int) return System.Address; -- zmq.h:344
pragma Import (C, zmq_socket, "zmq_socket");
function Zmq_Proxy
(Frontend : System.Address;
Backend : System.Address;
Capture : System.Address) return Int; -- zmq.h:397
pragma Import (C, Zmq_Proxy, "zmq_proxy");
function zmq_close (s : System.Address) return int; -- zmq.h:345
pragma Import (C, zmq_close, "zmq_close");
function Zmq_Proxy_Steerable
(Frontend : System.Address;
Backend : System.Address;
Capture : System.Address;
Control : System.Address) return Int; -- zmq.h:398
pragma Import (C, Zmq_Proxy_Steerable, "zmq_proxy_steerable");
function zmq_setsockopt
(s : System.Address;
option : int;
optval : System.Address;
optvallen : size_t) return int; -- zmq.h:346
pragma Import (C, zmq_setsockopt, "zmq_setsockopt");
function zmq_has (Capability : Interfaces.C.Strings.Chars_Ptr) return Int; -- zmq.h:405
pragma Import (C, zmq_has, "zmq_has");
function zmq_getsockopt
(s : System.Address;
option : int;
optval : System.Address;
optvallen : access size_t) return int; -- zmq.h:348
pragma Import (C, zmq_getsockopt, "zmq_getsockopt");
function Zmq_Device
(C_Type : Int;
Frontend : System.Address;
Backend : System.Address) return Int; -- zmq.h:413
pragma Import (C, Zmq_Device, "zmq_device");
function zmq_bind (s : System.Address; addr : Interfaces.C.Strings.chars_ptr) return int; -- zmq.h:350
pragma Import (C, zmq_bind, "zmq_bind");
function zmq_connect (s : System.Address; addr : Interfaces.C.Strings.chars_ptr) return int; -- zmq.h:351
pragma Import (C, zmq_connect, "zmq_connect");
function zmq_unbind (s : System.Address; addr : Interfaces.C.Strings.chars_ptr) return int; -- zmq.h:352
pragma Import (C, zmq_unbind, "zmq_unbind");
function zmq_disconnect (s : System.Address; addr : Interfaces.C.Strings.chars_ptr) return int; -- zmq.h:353
pragma Import (C, zmq_disconnect, "zmq_disconnect");
function zmq_send (s : System.Address; buf : System.Address; len : size_t; flags : int) return int; -- zmq.h:354
pragma Import (C, zmq_send, "zmq_send");
function zmq_send_const (s : System.Address; buf : System.Address; len : size_t; flags : int) return int; -- zmq.h:355
pragma Import (C, zmq_send_const, "zmq_send_const");
function zmq_recv (s : System.Address; buf : System.Address; len : size_t; flags : int) return int; -- zmq.h:356
pragma Import (C, zmq_recv, "zmq_recv");
function zmq_socket_monitor
(s : System.Address;
addr : Interfaces.C.Strings.chars_ptr;
events : int) return int; -- zmq.h:357
pragma Import (C, zmq_socket_monitor, "zmq_socket_monitor");
function zmq_sendmsg (s : System.Address; msg : access zmq_msg_t; flags : int) return int; -- zmq.h:359
function Zmq_Sendmsg
(S : System.Address;
Msg : access Zmq_Msg_T;
Flags : Int) return Int; -- zmq.h:414
pragma Obsolescent;
pragma Import (C, zmq_sendmsg, "zmq_sendmsg");
pragma Import (C, Zmq_Sendmsg, "zmq_sendmsg");
function zmq_recvmsg (s : System.Address; msg : access zmq_msg_t; flags : int) return int; -- zmq.h:360
function Zmq_Recvmsg
(S : System.Address;
Msg : access Zmq_Msg_T;
Flags : Int) return Int; -- zmq.h:415
pragma Obsolescent;
pragma Import (C, zmq_recvmsg, "zmq_recvmsg");
pragma Import (C, Zmq_Recvmsg, "zmq_recvmsg");
function Zmq_Z85_Encode
(Dest : Interfaces.C.Strings.Chars_Ptr;
Data : access Extensions.Unsigned_8;
Size : size_t) return Interfaces.C.Strings.Chars_Ptr; -- zmq.h:423
pragma Import (C, Zmq_Z85_Encode, "zmq_z85_encode");
function Zmq_Z85_Decode (Dest : access Extensions.Unsigned_8; String : Interfaces.C.Strings.Chars_Ptr) return access Extensions.Unsigned_8; -- zmq.h:426
pragma Import (C, Zmq_Z85_Decode, "zmq_z85_decode");
function Zmq_Curve_Keypair (Z85_Public_Key : Interfaces.C.Strings.Chars_Ptr; Z85_Secret_Key : Interfaces.C.Strings.Chars_Ptr) return Int; -- zmq.h:430
pragma Import (C, Zmq_Curve_Keypair, "zmq_curve_keypair");
-- skipped empty struct iovec
function zmq_sendiov (s : System.Address; iov : System.Address; count : size_t; flags : int) return int; -- zmq.h:365
pragma Import (C, zmq_sendiov, "zmq_sendiov");
function Zmq_Sendiov
(S : System.Address;
Iov : System.Address;
Count : size_t;
Flags : Int) return Int; -- zmq.h:441
pragma Import (C, Zmq_Sendiov, "zmq_sendiov");
function zmq_recviov (s : System.Address; iov : System.Address; count : access size_t; flags : int) return int; -- zmq.h:366
pragma Import (C, zmq_recviov, "zmq_recviov");
function Zmq_Recviov
(S : System.Address;
Iov : System.Address;
Count : access size_t;
Flags : Int) return Int; -- zmq.h:442
pragma Import (C, Zmq_Recviov, "zmq_recviov");
type zmq_pollitem_t is record
socket : System.Address; -- zmq.h:378
fd : aliased int; -- zmq.h:382
events : aliased short; -- zmq.h:384
revents : aliased short; -- zmq.h:385
end record;
pragma Convention (C_Pass_By_Copy, zmq_pollitem_t); -- zmq.h:386
function Zmq_Stopwatch_Start return System.Address; -- zmq.h:448
pragma Import (C, Zmq_Stopwatch_Start, "zmq_stopwatch_start");
-- skipped anonymous struct anon_7
function Zmq_Stopwatch_Stop (Watch_U : System.Address) return Unsigned_Long; -- zmq.h:452
pragma Import (C, Zmq_Stopwatch_Stop, "zmq_stopwatch_stop");
function zmq_poll (items : access zmq_pollitem_t; nitems : int; timeout : long) return int; -- zmq.h:390
pragma Import (C, zmq_poll, "zmq_poll");
procedure Zmq_Sleep (Seconds_U : Int); -- zmq.h:455
pragma Import (C, Zmq_Sleep, "zmq_sleep");
function zmq_proxy (frontend : System.Address; backend : System.Address; capture : System.Address) return int; -- zmq.h:394
pragma Import (C, zmq_proxy, "zmq_proxy");
-- skipped function type zmq_thread_fn
function zmq_z85_encode
(dest : Interfaces.C.Strings.chars_ptr;
data : access Extensions.Unsigned_8;
size : size_t) return Interfaces.C.Strings.chars_ptr; -- zmq.h:397
pragma Import (C, zmq_z85_encode, "zmq_z85_encode");
function Zmq_Threadstart (Func : access procedure (Arg1 : System.Address); Arg : System.Address) return System.Address; -- zmq.h:460
pragma Import (C, Zmq_Threadstart, "zmq_threadstart");
function zmq_z85_decode
(dest : access Extensions.Unsigned_8;
string : Interfaces.C.Strings.chars_ptr) return access Extensions.Unsigned_8; -- zmq.h:400
pragma Import (C, zmq_z85_decode, "zmq_z85_decode");
function zmq_device (c_type : int; frontend : System.Address; backend : System.Address) return int; -- zmq.h:407
pragma Import (C, zmq_device, "zmq_device");
procedure Zmq_Threadclose (Thread : System.Address); -- zmq.h:463
pragma Import (C, Zmq_Threadclose, "zmq_threadclose");
end ZMQ.Low_Level;

View File

@ -47,11 +47,11 @@ package body ZMQ.Contexts is
is
begin
Validate_Library_Version;
if This.c /= Null_Address then
if This.C /= Null_Address then
raise ZMQ_Error with "Already Initialized";
end if;
This.c := Low_Level.zmq_ctx_new;
if This.c = Null_Address then
This.C := Low_Level.Zmq_Ctx_New;
if This.C = Null_Address then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno) & " in " &
GNAT.Source_Info.Enclosing_Entity;
end if;
@ -64,81 +64,90 @@ package body ZMQ.Contexts is
overriding procedure Finalize
(This : in out Context)
is
rc : int;
Rc : int;
begin
if This.Is_Connected then
rc := Low_Level.zmq_ctx_destroy (This.c);
if rc /= 0 then
Rc := Low_Level.Zmq_Ctx_Destroy (This.C);
if Rc /= 0 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno) & " in " &
GNAT.Source_Info.Enclosing_Entity;
end if;
This.c := Null_Address;
This.C := Null_Address;
end if;
end Finalize;
function Is_Connected (This : Context) return Boolean is
begin
return This.c /= Null_Address;
return This.C /= Null_Address;
end Is_Connected;
function GetImpl (This : Context) return System.Address is
begin
return This.c;
return This.C;
end GetImpl;
not overriding
procedure Set_number_of_IO_threads
(This : in out Context; Threads : Natural := 1) is
procedure Set_Number_Of_IO_Threads
(This : in out Context;
Threads : Natural := 1) is
Status : int;
begin
if Low_Level.zmq_ctx_set
(This.c, Low_Level.Defs.ZMQ_IO_THREADS, int (Threads)) /= 0 then
raise Program_Error with Error_Message (errno);
Status := Low_Level.Zmq_Ctx_Set
(This.C, Low_Level.Defs.ZMQ_IO_THREADS, int (Threads));
if Status /= 0 then
raise Program_Error with Error_Message (Integer (Status));
end if;
end Set_number_of_IO_threads;
end Set_Number_Of_IO_Threads;
not overriding
function get_number_of_IO_threads (This : in out Context) return Natural is
function Get_Number_Of_IO_Threads (This : in out Context) return Natural is
begin
return Natural
(Low_Level.zmq_ctx_get (This.c, Low_Level.Defs.ZMQ_IO_THREADS));
end get_number_of_IO_threads;
(Low_Level.Zmq_Ctx_Get (This.C, Low_Level.Defs.ZMQ_IO_THREADS));
end Get_Number_Of_IO_Threads;
not overriding
procedure Set_maximum_number_of_sockets
procedure Set_Maximum_Number_Of_Sockets
(This : in out Context; Count : Positive := 1024) is
status : int;
begin
if Low_Level.zmq_ctx_set
(This.c, Low_Level.Defs.ZMQ_MAX_SOCKETS, int (Count)) /= 0 then
raise Program_Error with Error_Message (errno);
status := Low_Level.Zmq_Ctx_Set
(This.C, Low_Level.Defs.ZMQ_MAX_SOCKETS, int (Count));
if status /= 0
then
raise Program_Error with Error_Message (Integer (status));
end if;
end Set_maximum_number_of_sockets;
end Set_Maximum_Number_Of_Sockets;
not overriding
function Get_maximum_number_of_sockets
function Get_Maximum_Number_Of_Sockets
(This : in out Context) return Natural is
begin
return Natural
(Low_Level.zmq_ctx_get (This.c, Low_Level.Defs.ZMQ_MAX_SOCKETS));
end Get_maximum_number_of_sockets;
(Low_Level.Zmq_Ctx_Get (This.C, Low_Level.Defs.ZMQ_MAX_SOCKETS));
end Get_Maximum_Number_Of_Sockets;
not overriding
procedure Set_IPv6
(This : in out Context; Enable : Boolean := False) is
Status : int;
begin
if Low_Level.zmq_ctx_set
(This.c, Low_Level.Defs.ZMQ_IPV6, Boolean'Pos (Enable)) /= 0 then
raise Program_Error with Error_Message (errno);
Status := Low_Level.Zmq_Ctx_Set
(This.C, Low_Level.Defs.ZMQ_IPV6, Boolean'Pos (Enable));
if Status /= 0
then
raise Program_Error with Error_Message (Integer (Status));
end if;
end Set_IPv6;
not overriding
function Get_IPv6 (This : in out Context) return Boolean is
begin
return Low_Level.zmq_ctx_get
(This.c, Low_Level.Defs.ZMQ_MAX_SOCKETS) = 1;
return Low_Level.Zmq_Ctx_Get
(This.C, Low_Level.Defs.ZMQ_MAX_SOCKETS) = 1;
end Get_IPv6;

View File

@ -42,10 +42,10 @@ package ZMQ.Contexts is
not overriding
procedure Set_number_of_IO_threads
procedure Set_Number_Of_IO_Threads
(This : in out Context; Threads : Natural := 1);
not overriding
function get_number_of_IO_threads
function Get_Number_Of_IO_Threads
(This : in out Context) return Natural;
-- Specifies the size of the ØMQ thread pool to handle I/O operations.
-- If your application is using only the inproc transport for messaging
@ -53,10 +53,10 @@ package ZMQ.Contexts is
-- This option only applies before creating any sockets on the context.
not overriding
procedure Set_maximum_number_of_sockets
procedure Set_Maximum_Number_Of_Sockets
(This : in out Context; Count : Positive := 1024);
not overriding
function Get_maximum_number_of_sockets
function Get_Maximum_Number_Of_Sockets
(This : in out Context) return Natural;
-- Sets the maximum number of sockets allowed on the context.
@ -75,7 +75,7 @@ package ZMQ.Contexts is
private
type Context is new Ada.Finalization.Limited_Controlled with record
c : System.Address := System.Null_Address;
C : System.Address := System.Null_Address;
end record;
overriding
procedure Initialize (This : in out Context);

View File

@ -45,7 +45,7 @@ package body ZMQ.Messages is
procedure Initialize (Self : in out Message) is
Ret : int;
begin
Ret := Low_Level.zmq_msg_init (Self.Msg'Access);
Ret := Low_Level.Zmq_Msg_Init (Self.Msg'Access);
if Ret /= 0 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno) & " in " &
GNAT.Source_Info.Enclosing_Entity;
@ -60,7 +60,7 @@ package body ZMQ.Messages is
procedure Initialize (Self : in out Message; Size : Natural) is
Ret : int;
begin
Ret := Low_Level.zmq_msg_init_size (Self.Msg'Access, size_t (Size));
Ret := Low_Level.Zmq_Msg_Init_Size (Self.Msg'Access, size_t (Size));
if Ret /= 0 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno) & " in " &
GNAT.Source_Info.Enclosing_Entity;
@ -112,7 +112,7 @@ package body ZMQ.Messages is
is
Ret : int;
begin
Ret := Low_Level.zmq_msg_init_data (Self.Msg'Access,
Ret := Low_Level.Zmq_Msg_Init_Data (Self.Msg'Access,
Message,
size_t (Size),
Free,
@ -188,7 +188,7 @@ package body ZMQ.Messages is
---------------
function GetData (Self : Message) return System.Address is
begin
return Low_Level.zmq_msg_data (Self.Msg'Unrestricted_Access);
return Low_Level.Zmq_Msg_Data (Self.Msg'Unrestricted_Access);
end GetData;
@ -243,7 +243,7 @@ package body ZMQ.Messages is
---------------
function GetSize (Self : Message) return Natural is
begin
return Natural (Low_Level.zmq_msg_size (Self.Msg'Unrestricted_Access));
return Natural (Low_Level.Zmq_Msg_Size (Self.Msg'Unrestricted_Access));
end GetSize;
@ -252,10 +252,10 @@ package body ZMQ.Messages is
--------------
procedure Finalize (Self : in out Message) is
ret : int;
Ret : int;
begin
ret := Low_Level.zmq_msg_close (Self.Msg'Access);
if ret /= 0 then
Ret := Low_Level.Zmq_Msg_Close (Self.Msg'Access);
if Ret /= 0 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno) & " in " &
GNAT.Source_Info.Enclosing_Entity;
end if;

View File

@ -113,7 +113,7 @@ package ZMQ.Messages is
procedure Finalize (Self : in out Message);
type Zmq_Msg_T_Access is access all ZMQ.Low_Level.zmq_msg_t;
type Zmq_Msg_T_Access is access all ZMQ.Low_Level.Zmq_Msg_T;
function GetImpl (Self : Message) return not null Zmq_Msg_T_Access;
@ -141,7 +141,7 @@ package ZMQ.Messages is
private
type Message is new Ada.Finalization.Limited_Controlled with record
Msg : aliased ZMQ.Low_Level.zmq_msg_t;
Msg : aliased ZMQ.Low_Level.Zmq_Msg_T;
end record;
end ZMQ.Messages;

View File

@ -35,39 +35,39 @@ package body ZMQ.Pollsets is
-- append --
------------
procedure append (this : in out Pollset; item : pollitem'Class) is
pragma Unreferenced (this, item);
procedure Append (This : in out Pollset; Item : Pollitem'Class) is
pragma Unreferenced (This, Item);
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "append unimplemented");
raise Program_Error with "Unimplemented procedure append";
end append;
end Append;
------------
-- remove --
------------
procedure remove (this : in out Pollset; item : pollitem'Class) is
pragma Unreferenced (this, item);
procedure Remove (This : in out Pollset; Item : Pollitem'Class) is
pragma Unreferenced (This, Item);
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "remove unimplemented");
raise Program_Error with "Unimplemented procedure remove";
end remove;
end Remove;
----------
-- poll --
----------
procedure poll
(this : in out Pollset;
procedure Poll
(This : in out Pollset;
Timeout : Duration)
is
pragma Unreferenced (this, Timeout);
pragma Unreferenced (This, Timeout);
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "poll unimplemented");
raise Program_Error with "Unimplemented procedure poll";
end poll;
end Poll;
end ZMQ.Pollsets;

View File

@ -26,24 +26,24 @@ with ZMQ.Sockets;
with ZMQ.Low_Level;
package ZMQ.Pollsets is
pragma Elaborate_Body;
type pollitem is tagged record
socket : access ZMQ.Sockets.Socket;
type Pollitem is tagged record
Socket : access ZMQ.Sockets.Socket;
-- fd : aliased int;
-- events : aliased short;
-- revents : aliased short;
end record;
type Pollset (Max_Size : Natural := 32) is tagged limited private;
procedure append (this : in out Pollset; item : pollitem'Class);
procedure remove (this : in out Pollset; item : pollitem'Class);
procedure Append (This : in out Pollset; Item : Pollitem'Class);
procedure Remove (This : in out Pollset; Item : Pollitem'Class);
procedure poll (this : in out Pollset;
procedure Poll (This : in out Pollset;
Timeout : Duration);
private
type ll_polset is array (Natural range <>)
of aliased ZMQ.Low_Level.zmq_pollitem_t;
type Ll_Polset is array (Natural range <>)
of aliased ZMQ.Low_Level.Zmq_Pollitem_T;
type Pollset (Max_Size : Natural := 32) is tagged limited record
local_data : aliased ll_polset (1 .. Max_Size);
Local_Data : aliased Ll_Polset (1 .. Max_Size);
Cursor : Natural := 1;
end record;
end ZMQ.Pollsets;

View File

@ -45,7 +45,7 @@ package body ZMQ.Proxys is
Dummy : int;
pragma Unreferenced (Dummy);
begin
Dummy := ZMQ.Low_Level.zmq_proxy
Dummy := ZMQ.Low_Level.Zmq_Proxy
(Frontend.Get_Impl, Backend.Get_Impl, Capture.Get_Impl);
end Proxy;

View File

@ -50,13 +50,13 @@ package body ZMQ.Sockets is
if With_Context.GetImpl = Null_Address then
raise ZMQ_Error with "Contecxt Not Initialized";
end if;
if This.c /= Null_Address then
if This.C /= Null_Address then
raise ZMQ_Error with "Socket Initialized";
end if;
This.c := Low_Level.zmq_socket (With_Context.GetImpl,
This.C := Low_Level.Zmq_Socket (With_Context.GetImpl,
Socket_Type'Pos (Kind));
if This.c = Null_Address then
if This.C = Null_Address then
raise ZMQ_Error with "Unable to initialize";
end if;
end Initialize;
@ -70,12 +70,12 @@ package body ZMQ.Sockets is
(This : in out Socket;
Address : String)
is
addr : chars_ptr := Interfaces.C.Strings.New_String (Address);
ret : int;
Addr : chars_ptr := Interfaces.C.Strings.New_String (Address);
Ret : int;
begin
ret := Low_Level.zmq_bind (This.c, addr);
Free (addr);
if ret /= 0 then
Ret := Low_Level.Zmq_Bind (This.C, Addr);
Free (Addr);
if Ret /= 0 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno) & " in " &
GNAT.Source_Info.Enclosing_Entity & "(" & Address & ")";
end if;
@ -92,12 +92,12 @@ package body ZMQ.Sockets is
(This : in out Socket;
Address : String)
is
addr : chars_ptr := Interfaces.C.Strings.New_String (Address);
ret : int;
Addr : chars_ptr := Interfaces.C.Strings.New_String (Address);
Ret : int;
begin
ret := Low_Level.zmq_unbind (This.c, addr);
Free (addr);
if ret /= 0 then
Ret := Low_Level.Zmq_Unbind (This.C, Addr);
Free (Addr);
if Ret /= 0 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno) & " in " &
GNAT.Source_Info.Enclosing_Entity & "(" & Address & ")";
end if;
@ -113,14 +113,14 @@ package body ZMQ.Sockets is
Option : Interfaces.C.int;
Value : System.Address;
Value_Size : Natural) is
ret : int;
Ret : int;
begin
ret := Low_Level.zmq_setsockopt
(This.c,
Ret := Low_Level.Zmq_Setsockopt
(This.C,
Option,
Value,
size_t (Value_Size));
if ret /= 0 then
if Ret /= 0 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno) & " in " &
GNAT.Source_Info.Enclosing_Entity & "(" & Option'Img & ")";
end if;
@ -219,12 +219,12 @@ package body ZMQ.Sockets is
(This : in out Socket;
Address : String)
is
addr : chars_ptr := Interfaces.C.Strings.New_String (Address);
ret : int;
Addr : chars_ptr := Interfaces.C.Strings.New_String (Address);
Ret : int;
begin
ret := Low_Level.zmq_connect (This.c, addr);
Free (addr);
if ret /= 0 then
Ret := Low_Level.Zmq_Connect (This.C, Addr);
Free (Addr);
if Ret /= 0 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno) & " in " &
GNAT.Source_Info.Enclosing_Entity & "(" & Address & ")";
end if;
@ -247,10 +247,10 @@ package body ZMQ.Sockets is
Msg : Messages.Message'Class;
Flags : Socket_Flags := No_Flags)
is
ret : int;
Ret : int;
begin
ret := Low_Level.zmq_msg_send (Msg.GetImpl, This.c, int (Flags));
if ret = -1 then
Ret := Low_Level.Zmq_Msg_Send (Msg.GetImpl, This.C, int (Flags));
if Ret = -1 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno) & " in " &
GNAT.Source_Info.Enclosing_Entity;
end if;
@ -300,11 +300,11 @@ package body ZMQ.Sockets is
Msg_Address : System.Address;
Msg_Length : Natural;
Flags : Socket_Flags := No_Flags) is
ret : int;
Ret : int;
begin
ret := Low_Level.zmq_send
(This.c, Msg_Address, Interfaces.C.size_t (Msg_Length), int (Flags));
if ret = -1 then
Ret := Low_Level.Zmq_Send
(This.C, Msg_Address, Interfaces.C.size_t (Msg_Length), int (Flags));
if Ret = -1 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno) & " in " &
GNAT.Source_Info.Enclosing_Entity;
end if;
@ -336,26 +336,26 @@ package body ZMQ.Sockets is
Msg : in out Messages.Message'Class;
Flags : Socket_Flags := No_Flags)
is
ret : int;
Ret : int;
begin
ret := Low_Level.zmq_msg_recv (Msg.GetImpl,
This.c,
Ret := Low_Level.Zmq_Msg_Recv (Msg.GetImpl,
This.C,
int (Flags));
if ret = -1 then
if Ret = -1 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno) & " in "
& GNAT.Source_Info.Enclosing_Entity;
end if;
end Recv;
procedure recv (This : in Socket;
procedure Recv (This : in Socket;
Flags : Socket_Flags := No_Flags) is
dummy_Msg : Messages.Message;
Dummy_Msg : Messages.Message;
begin
dummy_Msg.Initialize;
This.Recv (dummy_Msg, Flags);
dummy_Msg.Finalize;
end recv;
Dummy_Msg.Initialize;
This.Recv (Dummy_Msg, Flags);
Dummy_Msg.Finalize;
end Recv;
not overriding
@ -365,8 +365,8 @@ package body ZMQ.Sockets is
begin
Msg.Initialize;
This.Recv (Msg, Flags);
return ret : String (1 .. Msg.GetSize) do
ret := Msg.GetData;
return Ret : String (1 .. Msg.GetSize) do
Ret := Msg.GetData;
end return;
end Recv;
@ -382,15 +382,15 @@ package body ZMQ.Sockets is
Max_Length : Natural := 1024;
Flags : Socket_Flags := No_Flags)
return String is
msg : Messages.Message;
Msg : Messages.Message;
begin
This.Recv (msg, Flags);
if msg.GetSize > Max_Length then
This.Recv (Msg, Flags);
if Msg.GetSize > Max_Length then
raise Constraint_Error with "message size out of bounds" &
msg.GetSize'Img & ">" & Max_Length'Img;
Msg.GetSize'Img & ">" & Max_Length'Img;
end if;
return ret : String (1 .. msg.GetSize) do
ret := msg.GetData;
return Ret : String (1 .. Msg.GetSize) do
Ret := Msg.GetData;
end return;
end Recv;
@ -399,8 +399,8 @@ package body ZMQ.Sockets is
Flags : Socket_Flags := No_Flags)
return Ada.Strings.Unbounded.Unbounded_String is
begin
return ret : Ada.Strings.Unbounded.Unbounded_String do
This.Recv (ret, Flags);
return Ret : Ada.Strings.Unbounded.Unbounded_String do
This.Recv (Ret, Flags);
end return;
end Recv;
@ -409,29 +409,29 @@ package body ZMQ.Sockets is
--------------
overriding procedure Finalize
(this : in out Socket)
(This : in out Socket)
is
ret : int;
Ret : int;
begin
if this.c /= Null_Address then
ret := Low_Level.zmq_close (this.c);
if ret /= 0 then
if This.C /= Null_Address then
Ret := Low_Level.Zmq_Close (This.C);
if Ret /= 0 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno);
end if;
this.c := Null_Address;
This.C := Null_Address;
end if;
end Finalize;
procedure Proxy (frontend : not null access Socket;
backend : not null access Socket'Class;
capture : access Socket'Class) is
ret : int;
procedure Proxy (Frontend : not null access Socket;
Backend : not null access Socket'Class;
Capture : access Socket'Class) is
Ret : int;
begin
ret := Low_Level.zmq_proxy
(frontend.c,
backend.c,
(if capture /= null then capture.c else System.Null_Address));
if ret /= 0 then
Ret := Low_Level.Zmq_Proxy
(Frontend.C,
Backend.C,
(if Capture /= null then Capture.C else System.Null_Address));
if Ret /= 0 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno);
end if;
end Proxy;
@ -440,247 +440,247 @@ package body ZMQ.Sockets is
not overriding
procedure Set_high_water_mark_for_outbound_messages
procedure Set_High_Water_Mark_For_Outbound_Messages
(This : in out Socket;
messages : Natural := 1_000)
Messages : Natural := 1_000)
is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_SNDHWM, messages);
end Set_high_water_mark_for_outbound_messages;
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_SNDHWM, Messages);
end Set_High_Water_Mark_For_Outbound_Messages;
not overriding
procedure Set_high_water_mark_for_inbound_messages
procedure Set_High_Water_Mark_For_Inbound_Messages
(This : in out Socket;
messages : Natural := 1_000)
Messages : Natural := 1_000)
is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_RCVHWM, messages);
end Set_high_water_mark_for_inbound_messages;
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_RCVHWM, Messages);
end Set_High_Water_Mark_For_Inbound_Messages;
not overriding
procedure Set_disk_offload_size (This : in out Socket;
procedure Set_Disk_Offload_Size (This : in out Socket;
Value : Natural) is
begin
null; -- This.setsockopt (ZMQ.Low_Level.Defs.SWAP, Value);
end Set_disk_offload_size;
end Set_Disk_Offload_Size;
not overriding
procedure Set_IO_thread_affinity (This : in out Socket;
procedure Set_IO_Thread_Affinity (This : in out Socket;
Threads : Thread_Bitmap) is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_AFFINITY, Threads'Address, 4);
end Set_IO_thread_affinity;
end Set_IO_Thread_Affinity;
not overriding
procedure Set_socket_identity
procedure Set_Socket_Identity
(This : in out Socket;
Value : Ada.Streams.Stream_Element_Array) is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_IDENTITY, Value);
end Set_socket_identity;
end Set_Socket_Identity;
procedure Set_socket_identity
procedure Set_Socket_Identity
(This : in out Socket;
Value : String) is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_IDENTITY, Value);
end Set_socket_identity;
end Set_Socket_Identity;
not overriding
procedure Establish_message_filter (This : in out Socket;
procedure Establish_Message_Filter (This : in out Socket;
Value : String) is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_SUBSCRIBE, Value);
end Establish_message_filter;
end Establish_Message_Filter;
not overriding
procedure Establish_message_filter
procedure Establish_Message_Filter
(This : in out Socket;
Value : Ada.Streams.Stream_Element_Array) is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_SUBSCRIBE, Value);
end Establish_message_filter;
end Establish_Message_Filter;
procedure Establish_message_filter
procedure Establish_Message_Filter
(This : in out Socket;
Value : Ada.Strings.Unbounded.Unbounded_String) is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_SUBSCRIBE, To_String (Value));
end Establish_message_filter;
end Establish_Message_Filter;
not overriding
procedure Remove_message_filter (This : in out Socket;
procedure Remove_Message_Filter (This : in out Socket;
Value : String) is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_UNSUBSCRIBE, Value);
end Remove_message_filter;
end Remove_Message_Filter;
procedure Remove_message_filter
procedure Remove_Message_Filter
(This : in out Socket;
Value : Ada.Strings.Unbounded.Unbounded_String) is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_UNSUBSCRIBE, To_String (Value));
end Remove_message_filter;
end Remove_Message_Filter;
procedure Remove_message_filter
procedure Remove_Message_Filter
(This : in out Socket;
Value : Ada.Streams.Stream_Element_Array) is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_UNSUBSCRIBE, Value);
end Remove_message_filter;
end Remove_Message_Filter;
not overriding
procedure Set_multicast_data_rate
procedure Set_Multicast_Data_Rate
(This : in out Socket;
kilobits_per_second : Natural := 100) is
Kilobits_Per_Second : Natural := 100) is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_RATE, kilobits_per_second);
end Set_multicast_data_rate;
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_RATE, Kilobits_Per_Second);
end Set_Multicast_Data_Rate;
not overriding
procedure set_multicast_recovery_interval (This : in out Socket;
procedure Set_Multicast_Recovery_Interval (This : in out Socket;
Time : Duration := 10.0) is
begin
This.Setsockopt
(ZMQ.Low_Level.Defs.ZMQ_RECOVERY_IVL, Integer (Time * 1000));
end set_multicast_recovery_interval;
end Set_Multicast_Recovery_Interval;
not overriding
procedure Set_multicast_loopback (This : in out Socket;
procedure Set_Multicast_Loopback (This : in out Socket;
Enable : Boolean) is
begin
null; -- This.setsockopt (ZMQ.Low_Level.Defs.ZMQ_HWM, Enable);
end Set_multicast_loopback;
end Set_Multicast_Loopback;
not overriding
procedure Set_kernel_transmit_buffer_size (This : in out Socket;
bytes : Natural) is
procedure Set_Kernel_Transmit_Buffer_Size (This : in out Socket;
Bytes : Natural) is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_SNDBUF, bytes);
end Set_kernel_transmit_buffer_size;
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_SNDBUF, Bytes);
end Set_Kernel_Transmit_Buffer_Size;
not overriding
procedure Set_kernel_receive_buffer_size (This : in out Socket;
bytes : Natural) is
procedure Set_Kernel_Receive_Buffer_Size (This : in out Socket;
Bytes : Natural) is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_RCVBUF, bytes);
end Set_kernel_receive_buffer_size;
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_RCVBUF, Bytes);
end Set_Kernel_Receive_Buffer_Size;
not overriding
function Get_linger_period_for_socket_shutdown
function Get_Linger_Period_For_Socket_Shutdown
(This : Socket) return Duration is
begin
return This.Getsockopt (ZMQ.Low_Level.Defs.ZMQ_LINGER);
end Get_linger_period_for_socket_shutdown;
end Get_Linger_Period_For_Socket_Shutdown;
not overriding
procedure Set_linger_period_for_socket_shutdown
procedure Set_Linger_Period_For_Socket_Shutdown
(This : in out Socket;
period : Duration := Duration'Last) is
Period : Duration := Duration'Last) is
begin
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_LINGER, period);
end Set_linger_period_for_socket_shutdown;
This.Setsockopt (ZMQ.Low_Level.Defs.ZMQ_LINGER, Period);
end Set_Linger_Period_For_Socket_Shutdown;
not overriding
function Get_reconnection_interval
function Get_Reconnection_Interval
(This : Socket) return Duration is
begin
return Duration (Natural'(This.Getsockopt
(ZMQ.Low_Level.Defs.ZMQ_RECONNECT_IVL))) / 1000.0;
end Get_reconnection_interval;
end Get_Reconnection_Interval;
not overriding
procedure Set_reconnection_interval
procedure Set_Reconnection_Interval
(This : in out Socket;
period : Duration := 0.100) is
Period : Duration := 0.100) is
begin
if period < 0.0 then
if Period < 0.0 then
This.Setsockopt
(ZMQ.Low_Level.Defs.ZMQ_RECONNECT_IVL, Integer'(-1));
else
This.Setsockopt
(ZMQ.Low_Level.Defs.ZMQ_RECONNECT_IVL, Natural (period * 1000.0));
(ZMQ.Low_Level.Defs.ZMQ_RECONNECT_IVL, Natural (Period * 1000.0));
end if;
end Set_reconnection_interval;
end Set_Reconnection_Interval;
not overriding
function Get_Maximum_reconnection_interval
function Get_Maximum_Reconnection_Interval
(This : Socket) return Duration is
begin
return Duration (Natural'(This.Getsockopt
(ZMQ.Low_Level.Defs.ZMQ_RECONNECT_IVL))) / 1000.0;
end Get_Maximum_reconnection_interval;
end Get_Maximum_Reconnection_Interval;
not overriding
procedure Set_Maximum_reconnection_interval
procedure Set_Maximum_Reconnection_Interval
(This : in out Socket;
period : Duration := 0.0) is
Period : Duration := 0.0) is
begin
if period < 0.0 then
if Period < 0.0 then
This.Setsockopt
(Low_Level.Defs.ZMQ_RECONNECT_IVL, Integer'(-1));
else
This.Setsockopt
(Low_Level.Defs.ZMQ_RECONNECT_IVL, Natural (period * 1000.0));
(Low_Level.Defs.ZMQ_RECONNECT_IVL, Natural (Period * 1000.0));
end if;
end Set_Maximum_reconnection_interval;
end Set_Maximum_Reconnection_Interval;
not overriding
function Get_maximum_length_of_the_queue_of_outstanding_connections
function Get_Maximum_Length_Of_The_Queue_Of_Outstanding_Connections
(This : Socket) return Natural is
begin
return This.Getsockopt (Low_Level.Defs.ZMQ_BACKLOG);
end Get_maximum_length_of_the_queue_of_outstanding_connections;
end Get_Maximum_Length_Of_The_Queue_Of_Outstanding_Connections;
not overriding
procedure Set_maximum_length_of_the_queue_of_outstanding_connections
procedure Set_Maximum_Length_Of_The_Queue_Of_Outstanding_Connections
(This : in out Socket;
connections : Natural := 100) is
Connections : Natural := 100) is
begin
This.Setsockopt (Low_Level.Defs.ZMQ_BACKLOG, connections);
end Set_maximum_length_of_the_queue_of_outstanding_connections;
This.Setsockopt (Low_Level.Defs.ZMQ_BACKLOG, Connections);
end Set_Maximum_Length_Of_The_Queue_Of_Outstanding_Connections;
not overriding
function Get_Maximum_acceptable_inbound_message_size
function Get_Maximum_Acceptable_Inbound_Message_Size
(This : Socket) return Long_Long_Integer is
begin
return This.Getsockopt (Low_Level.Defs.ZMQ_MAXMSGSIZE);
end Get_Maximum_acceptable_inbound_message_size;
end Get_Maximum_Acceptable_Inbound_Message_Size;
not overriding
procedure Set_Maximum_acceptable_inbound_message_size
procedure Set_Maximum_Acceptable_Inbound_Message_Size
(This : in out Socket;
Bytes : Long_Long_Integer := 0) is
begin
This.Setsockopt (Low_Level.Defs.ZMQ_MAXMSGSIZE, Bytes);
end Set_Maximum_acceptable_inbound_message_size;
end Set_Maximum_Acceptable_Inbound_Message_Size;
not overriding
function Get_Maximum_network_hops_for_multicast_packets
function Get_Maximum_Network_Hops_For_Multicast_Packets
(This : Socket) return Positive is
begin
return This.Getsockopt (Low_Level.Defs.ZMQ_MULTICAST_HOPS);
end Get_Maximum_network_hops_for_multicast_packets;
end Get_Maximum_Network_Hops_For_Multicast_Packets;
not overriding
procedure Set_Maximum_network_hops_for_multicast_packets
procedure Set_Maximum_Network_Hops_For_Multicast_Packets
(This : in out Socket;
network_hops : Positive := 1) is
Network_Hops : Positive := 1) is
begin
This.Setsockopt (Low_Level.Defs.ZMQ_MULTICAST_HOPS, network_hops);
end Set_Maximum_network_hops_for_multicast_packets;
This.Setsockopt (Low_Level.Defs.ZMQ_MULTICAST_HOPS, Network_Hops);
end Set_Maximum_Network_Hops_For_Multicast_Packets;
not overriding
@ -743,7 +743,7 @@ package body ZMQ.Sockets is
function Get_Impl (This : in Socket) return System.Address is
begin
return This.c;
return This.C;
end Get_Impl;
-------------
@ -753,16 +753,16 @@ package body ZMQ.Sockets is
Option : Interfaces.C.int;
Value : System.Address;
Value_Size : in out Natural) is
ret : int;
Value_Size_i : aliased size_t;
Ret : int;
Value_Size_I : aliased size_t;
begin
ret := Low_Level.zmq_getsockopt
(This.c,
Ret := Low_Level.Zmq_Getsockopt
(This.C,
Option,
Value,
Value_Size_i'Access);
Value_Size := Natural (Value_Size_i);
if ret /= 0 then
Value_Size_I'Access);
Value_Size := Natural (Value_Size_I);
if Ret /= 0 then
raise ZMQ_Error with Error_Message (GNAT.OS_Lib.Errno) & " in " &
GNAT.Source_Info.Enclosing_Entity & "(" & Option'Img & ")";
end if;
@ -773,8 +773,8 @@ package body ZMQ.Sockets is
Option : Interfaces.C.int) return unsigned_long is
Dummy_Value_Size : Natural := unsigned_long'Size / System.Storage_Unit;
begin
return ret : unsigned_long do
This.Getsockopt (Option, ret'Address, Dummy_Value_Size);
return Ret : unsigned_long do
This.Getsockopt (Option, Ret'Address, Dummy_Value_Size);
if Dummy_Value_Size /= 8 then
raise Program_Error with "Invalid getsockopt for this type";
end if;
@ -797,8 +797,8 @@ package body ZMQ.Sockets is
function Getsockopt (This : in Socket;
Option : Interfaces.C.int) return Boolean is
begin
return ret : Boolean do
ret := unsigned_long'(This.Getsockopt (Option)) /= 0;
return Ret : Boolean do
Ret := unsigned_long'(This.Getsockopt (Option)) /= 0;
end return;
end Getsockopt;
@ -806,8 +806,8 @@ package body ZMQ.Sockets is
function Getsockopt (This : in Socket;
Option : Interfaces.C.int) return Integer is
begin
return ret : Integer do
ret := Integer (unsigned_long'(This.Getsockopt (Option)));
return Ret : Integer do
Ret := Integer (unsigned_long'(This.Getsockopt (Option)));
end return;
end Getsockopt;
@ -815,8 +815,8 @@ package body ZMQ.Sockets is
(This : in Socket;
Option : Interfaces.C.int) return Long_Long_Integer is
begin
return ret : Long_Long_Integer do
ret := Long_Long_Integer (unsigned_long'(This.Getsockopt (Option)));
return Ret : Long_Long_Integer do
Ret := Long_Long_Integer (unsigned_long'(This.Getsockopt (Option)));
end return;
end Getsockopt;
@ -841,79 +841,79 @@ package body ZMQ.Sockets is
return Duration (Integer'(This.Getsockopt (Option)) * 1000.0);
end Getsockopt;
function More_message_parts_to_follow (This : Socket) return Boolean is
function More_Message_Parts_To_Follow (This : Socket) return Boolean is
begin
return ret : Boolean do
ret := This.Getsockopt (ZMQ.Low_Level.Defs.ZMQ_RCVMORE);
return Ret : Boolean do
Ret := This.Getsockopt (ZMQ.Low_Level.Defs.ZMQ_RCVMORE);
end return;
end More_message_parts_to_follow;
end More_Message_Parts_To_Follow;
function Get_high_water_mark_for_outbound_messages
function Get_High_Water_Mark_For_Outbound_Messages
(This : Socket) return Natural is
begin
return This.Getsockopt (ZMQ.Low_Level.Defs.ZMQ_SNDHWM);
end Get_high_water_mark_for_outbound_messages;
end Get_High_Water_Mark_For_Outbound_Messages;
function Get_high_water_mark_for_inbound_messages
function Get_High_Water_Mark_For_Inbound_Messages
(This : Socket) return Natural is
begin
return This.Getsockopt (ZMQ.Low_Level.Defs.ZMQ_RCVHWM);
end Get_high_water_mark_for_inbound_messages;
end Get_High_Water_Mark_For_Inbound_Messages;
function Get_IO_thread_affinity (This : Socket) return Thread_Bitmap is
function Get_IO_Thread_Affinity (This : Socket) return Thread_Bitmap is
Value_Size : Natural := Thread_Bitmap'Size / System.Storage_Unit;
begin
return ret : Thread_Bitmap do
return Ret : Thread_Bitmap do
This.Getsockopt
(ZMQ.Low_Level.Defs.ZMQ_AFFINITY, ret'Address, Value_Size);
(ZMQ.Low_Level.Defs.ZMQ_AFFINITY, Ret'Address, Value_Size);
if Value_Size /= 8 then
raise Program_Error with "Invalid bitmap size " & Value_Size'Img;
end if;
end return;
end Get_IO_thread_affinity;
end Get_IO_Thread_Affinity;
function Get_socket_identity
function Get_Socket_Identity
(This : Socket) return Ada.Streams.Stream_Element_Array is
begin
return This.Getsockopt (ZMQ.Low_Level.Defs.ZMQ_IDENTITY);
end Get_socket_identity;
end Get_Socket_Identity;
function Get_multicast_data_rate (This : Socket) return Natural is
function Get_Multicast_Data_Rate (This : Socket) return Natural is
begin
return This.Getsockopt (ZMQ.Low_Level.Defs.ZMQ_RATE);
end Get_multicast_data_rate;
end Get_Multicast_Data_Rate;
function Get_multicast_recovery_interval (This : Socket) return Duration is
function Get_Multicast_Recovery_Interval (This : Socket) return Duration is
begin
return Duration
(unsigned_long'(
This.Getsockopt (ZMQ.Low_Level.Defs.ZMQ_RECOVERY_IVL)));
end Get_multicast_recovery_interval;
end Get_Multicast_Recovery_Interval;
function Get_multicast_loopback (This : Socket) return Boolean is
function Get_Multicast_Loopback (This : Socket) return Boolean is
pragma Unreferenced (This);
begin
return False; -- This.getsockopt (ZMQ.Low_Level.Defs.ZMQ_MCAST_LOOP);
end Get_multicast_loopback;
end Get_Multicast_Loopback;
function Get_kernel_transmit_buffer_size (This : Socket) return Natural is
function Get_Kernel_Transmit_Buffer_Size (This : Socket) return Natural is
begin
return This.Getsockopt (ZMQ.Low_Level.Defs.ZMQ_SNDBUF);
end Get_kernel_transmit_buffer_size;
end Get_Kernel_Transmit_Buffer_Size;
function Get_kernel_receive_buffer_size (This : Socket) return Natural is
function Get_Kernel_Receive_Buffer_Size (This : Socket) return Natural is
begin
return This.Getsockopt (ZMQ.Low_Level.Defs.ZMQ_RCVBUF);
end Get_kernel_receive_buffer_size;
end Get_Kernel_Receive_Buffer_Size;
not overriding function Retrieve_socket_type
not overriding function Retrieve_Socket_Type
(This : in Socket)
return Socket_Type is
begin
return Socket_Type'Val
(Natural'(This.Getsockopt (Low_Level.Defs.ZMQ_TYPE)));
end Retrieve_socket_type;
end Retrieve_Socket_Type;
procedure Read
@ -932,21 +932,21 @@ package body ZMQ.Sockets is
end Write;
procedure Read_Socket
(stream : not null access Ada.Streams.Root_Stream_Type'class;
s : out Socket) is
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
S : out Socket) is
begin
raise Program_Error with "Sockets are not streameble";
end Read_Socket;
procedure Write_Socket
(stream : not null access Ada.Streams.Root_Stream_Type'class;
s : Socket) is
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
S : Socket) is
begin
raise Program_Error with "Sockets are not streameble";
end Write_Socket;
function Stream
(This : Socket)
return not null access Ada.Streams.Root_Stream_Type'class is
return not null access Ada.Streams.Root_Stream_Type'Class is
begin
return This.S'Unrestricted_Access;
end Stream;

View File

@ -89,7 +89,7 @@ package ZMQ.Sockets is
procedure Unbind (This : in out Socket;
Address : Ada.Strings.Unbounded.Unbounded_String);
not overriding function Retrieve_socket_type
not overriding function Retrieve_Socket_Type
(This : in Socket)
return Socket_Type;
-- ========================================================================
@ -97,13 +97,13 @@ package ZMQ.Sockets is
-- ========================================================================
not overriding
function Get_high_water_mark_for_inbound_messages
function Get_High_Water_Mark_For_Inbound_Messages
(This : Socket) return Natural;
not overriding
procedure Set_high_water_mark_for_outbound_messages
procedure Set_High_Water_Mark_For_Outbound_Messages
(This : in out Socket;
messages : Natural := 1_000);
Messages : Natural := 1_000);
-- Sets the high water mark for outbound messages on the specified socket.
-- The high water mark is a hard limit on the maximum number of outstanding
-- messages ØMQ shall queue in memory for any single peer that the
@ -123,13 +123,13 @@ package ZMQ.Sockets is
not overriding
function Get_high_water_mark_for_outbound_messages
function Get_High_Water_Mark_For_Outbound_Messages
(This : Socket) return Natural;
not overriding
procedure Set_high_water_mark_for_inbound_messages
procedure Set_High_Water_Mark_For_Inbound_Messages
(This : in out Socket;
messages : Natural := 1_000);
Messages : Natural := 1_000);
-- Sets the high water mark for inbound messages on the specified socket.
-- The high water mark is a hard limit on the maximum number of
-- outstanding messages ØMQ shall queue in memory for any single peer
@ -145,7 +145,7 @@ package ZMQ.Sockets is
not overriding
procedure Set_disk_offload_size
procedure Set_Disk_Offload_Size
(This : in out Socket;
Value : Natural);
-- Sets the disk offload (swap) size < for the specified socket.
@ -159,10 +159,10 @@ package ZMQ.Sockets is
type Thread_Bitmap is array (0 .. 63) of Boolean;
pragma Pack (Thread_Bitmap);
function Get_IO_thread_affinity
function Get_IO_Thread_Affinity
(This : Socket) return Thread_Bitmap;
not overriding
procedure Set_IO_thread_affinity
procedure Set_IO_Thread_Affinity
(This : in out Socket;
Threads : Thread_Bitmap);
-- Sets the I/O thread affinity for newly created connections on the
@ -182,17 +182,17 @@ package ZMQ.Sockets is
----------------------------------------------------------------------------
not overriding
procedure Set_socket_identity
procedure Set_Socket_Identity
(This : in out Socket;
Value : String) with
pre => Value'Length < 256 and then
Pre => Value'Length < 256 and then
Value'Length > 0 and then
Value (Value'First) /= ASCII.NUL;
not overriding
procedure Set_socket_identity
procedure Set_Socket_Identity
(This : in out Socket;
Value : Ada.Streams.Stream_Element_Array) with
pre => Value'Length < 256 and then
Pre => Value'Length < 256 and then
Value'Length > 0 and then
Value (Value'First) /= 0;
-- Sets the identity of the specified socket.
@ -209,18 +209,18 @@ package ZMQ.Sockets is
----------------------------------------------------------------------------
not overriding
procedure Establish_message_filter (This : in out Socket;
procedure Establish_Message_Filter (This : in out Socket;
Value : String) with
pre => This.Retrieve_socket_type = SUB;
Pre => This.Retrieve_Socket_Type = SUB;
not overriding
procedure Establish_message_filter
procedure Establish_Message_Filter
(This : in out Socket;
Value : Ada.Strings.Unbounded.Unbounded_String) with
pre => This.Retrieve_socket_type = SUB;
procedure Establish_message_filter
Pre => This.Retrieve_Socket_Type = SUB;
procedure Establish_Message_Filter
(This : in out Socket;
Value : Ada.Streams.Stream_Element_Array) with
pre => This.Retrieve_socket_type = SUB;
Pre => This.Retrieve_Socket_Type = SUB;
-- Establishes a new message filter on a SUB socket.
-- Newly created SUB sockets filters out all incoming messages,
-- therefore you should call this option to establish an initial
@ -235,21 +235,21 @@ package ZMQ.Sockets is
----------------------------------------------------------------------------
not overriding
procedure Remove_message_filter (This : in out Socket;
procedure Remove_Message_Filter (This : in out Socket;
Value : String) with
pre => This.Retrieve_socket_type = SUB;
Pre => This.Retrieve_Socket_Type = SUB;
not overriding
procedure Remove_message_filter
procedure Remove_Message_Filter
(This : in out Socket;
Value : Ada.Strings.Unbounded.Unbounded_String) with
pre => This.Retrieve_socket_type = SUB;
Pre => This.Retrieve_Socket_Type = SUB;
not overriding
procedure Remove_message_filter
procedure Remove_Message_Filter
(This : in out Socket;
Value : Ada.Streams.Stream_Element_Array) with
pre => This.Retrieve_socket_type = SUB;
Pre => This.Retrieve_Socket_Type = SUB;
-- Remove an existing message filter on a SUB socket.
-- The filter specified must match an existing filter previously
-- established with "Establish_message_filter".
@ -259,23 +259,23 @@ package ZMQ.Sockets is
----------------------------------------------------------------------------
function Get_multicast_data_rate
function Get_Multicast_Data_Rate
(This : Socket) return Natural;
not overriding
procedure Set_multicast_data_rate
procedure Set_Multicast_Data_Rate
(This : in out Socket;
kilobits_per_second : Natural := 100);
Kilobits_Per_Second : Natural := 100);
-- Sets the maximum send or receive data rate for multicast transports
-- such as PGM using the specified socket.
not overriding
procedure set_multicast_recovery_interval
procedure Set_Multicast_Recovery_Interval
(This : in out Socket;
Time : Duration := 10.0) with
Inline => True;
not overriding
function Get_multicast_recovery_interval
function Get_Multicast_Recovery_Interval
(This : Socket) return Duration;
-- Sets the recovery interval in seconds for multicast transports using
-- the specified socket.
@ -290,7 +290,7 @@ package ZMQ.Sockets is
not overriding
procedure Set_multicast_loopback
procedure Set_Multicast_Loopback
(This : in out Socket;
Enable : Boolean);
-- Controls whether data sent via multicast transports using
@ -304,12 +304,12 @@ package ZMQ.Sockets is
-- in production environments.
not overriding
function Get_kernel_transmit_buffer_size
function Get_Kernel_Transmit_Buffer_Size
(This : Socket) return Natural;
not overriding
procedure Set_kernel_transmit_buffer_size
procedure Set_Kernel_Transmit_Buffer_Size
(This : in out Socket;
bytes : Natural);
Bytes : Natural);
-- Sets the underlying kernel transmit buffer size for the socket
-- to the specified size in bytes.
-- A value of zero means leave the OS default unchanged.
@ -318,12 +318,12 @@ package ZMQ.Sockets is
not overriding
function Get_kernel_receive_buffer_size
function Get_Kernel_Receive_Buffer_Size
(This : Socket) return Natural;
not overriding
procedure Set_kernel_receive_buffer_size
procedure Set_Kernel_Receive_Buffer_Size
(This : in out Socket;
bytes : Natural);
Bytes : Natural);
-- Sets the underlying kernel receive buffer size for the socket to
-- the specified size in bytes.
-- A value of zero means leave the OS default unchanged.
@ -332,12 +332,12 @@ package ZMQ.Sockets is
not overriding
function Get_linger_period_for_socket_shutdown
function Get_Linger_Period_For_Socket_Shutdown
(This : Socket) return Duration;
not overriding
procedure Set_linger_period_for_socket_shutdown
procedure Set_Linger_Period_For_Socket_Shutdown
(This : in out Socket;
period : Duration := Duration'Last);
Period : Duration := Duration'Last);
-- Sets the linger period for the specified socket.
-- The linger period determines how long pending messages which have yet
-- to be sent to a peer shall linger in memory after a socket is closed,
@ -360,12 +360,12 @@ package ZMQ.Sockets is
not overriding
function Get_reconnection_interval
function Get_Reconnection_Interval
(This : Socket) return Duration;
not overriding
procedure Set_reconnection_interval
procedure Set_Reconnection_Interval
(This : in out Socket;
period : Duration := 0.100);
Period : Duration := 0.100);
-- Sets the initial reconnection interval for the specified socket.
-- The reconnection interval is the period ØMQ shall wait between attempts
-- to reconnect disconnected peers when using connection-oriented
@ -376,13 +376,13 @@ package ZMQ.Sockets is
not overriding
function Get_Maximum_reconnection_interval
function Get_Maximum_Reconnection_Interval
(This : Socket) return Duration;
not overriding
procedure Set_Maximum_reconnection_interval
procedure Set_Maximum_Reconnection_Interval
(This : in out Socket;
period : Duration := 0.0) with
pre => period = 0.0 or else This.Get_reconnection_interval < period;
Period : Duration := 0.0) with
Pre => Period = 0.0 or else This.Get_Reconnection_Interval < Period;
-- Sets the maximum reconnection interval for the specified socket.
-- This is the maximum period ØMQ shall wait between attempts to reconnect.
-- On each reconnect attempt, the previous interval shall be doubled
@ -392,12 +392,12 @@ package ZMQ.Sockets is
-- interval calculations are only based on reconnection_interval.
not overriding
function Get_maximum_length_of_the_queue_of_outstanding_connections
function Get_Maximum_Length_Of_The_Queue_Of_Outstanding_Connections
(This : Socket) return Natural;
not overriding
procedure Set_maximum_length_of_the_queue_of_outstanding_connections
procedure Set_Maximum_Length_Of_The_Queue_Of_Outstanding_Connections
(This : in out Socket;
connections : Natural := 100);
Connections : Natural := 100);
-- Set the maximum length of the queue of outstanding peer connections
-- this only applies to connection-oriented transports.
-- For details refer to your operating system documentation for the
@ -405,25 +405,25 @@ package ZMQ.Sockets is
not overriding
function Get_Maximum_acceptable_inbound_message_size
function Get_Maximum_Acceptable_Inbound_Message_Size
(This : Socket) return Long_Long_Integer;
not overriding
procedure Set_Maximum_acceptable_inbound_message_size
procedure Set_Maximum_Acceptable_Inbound_Message_Size
(This : in out Socket;
Bytes : Long_Long_Integer := 0) with
pre => Bytes >= -1;
Pre => Bytes >= -1;
-- Limits the size of the inbound message.
-- If a peer sends a message larger than Bytes it is disconnected.
-- Value of -1 means no limit.
not overriding
function Get_Maximum_network_hops_for_multicast_packets
function Get_Maximum_Network_Hops_For_Multicast_Packets
(This : Socket) return Positive;
not overriding
procedure Set_Maximum_network_hops_for_multicast_packets
procedure Set_Maximum_Network_Hops_For_Multicast_Packets
(This : in out Socket;
network_hops : Positive := 1);
Network_Hops : Positive := 1);
-- Sets the time-to-live field in every multicast packet sent from
-- this socket.
-- The default is 1 which means that the multicast packets don't leave
@ -436,7 +436,7 @@ package ZMQ.Sockets is
procedure Set_Recieve_Timeout
(This : in out Socket;
Timeout : Duration := Duration'Last) with
pre => Timeout > 0.0;
Pre => Timeout > 0.0;
-- Sets the timeout for receive operation on the socket.
-- If the value is 0, receive will return immediately,
-- with a EAGAIN error if there is no message to receive.
@ -452,7 +452,7 @@ package ZMQ.Sockets is
procedure Set_Send_Timeout
(This : in out Socket;
Timeout : Duration := Duration'Last) with
pre => Timeout >= 0.0;
Pre => Timeout >= 0.0;
-- Sets the timeout for send operation on the socket.
-- If the value is 0, send will return immediately, with a EAGAIN error
-- if the message cannot be sent.
@ -474,7 +474,7 @@ package ZMQ.Sockets is
not overriding
function More_message_parts_to_follow
function More_Message_Parts_To_Follow
(This : Socket) return Boolean;
-- Returns True if the multi-part message currently being read from the
-- specified socket has more message parts to follow.
@ -485,7 +485,7 @@ package ZMQ.Sockets is
not overriding
function Get_socket_identity
function Get_Socket_Identity
(This : Socket) return Ada.Streams.Stream_Element_Array;
-- Returns the identity of the specified socket.
-- Socket identity determines if existing ZMQ infastructure
@ -504,7 +504,7 @@ package ZMQ.Sockets is
not overriding
function Get_multicast_loopback
function Get_Multicast_Loopback
(This : Socket) return Boolean;
-- Returns True if multicast transports shall be recievd bye the
-- loopback interface.
@ -623,22 +623,22 @@ package ZMQ.Sockets is
return Ada.Strings.Unbounded.Unbounded_String;
not overriding
procedure recv
procedure Recv
(This : in Socket;
Flags : Socket_Flags := No_Flags);
not overriding
procedure Proxy (frontend : not null access Socket;
backend : not null access Socket'Class;
capture : access Socket'Class);
procedure Proxy (Frontend : not null access Socket;
Backend : not null access Socket'Class;
Capture : access Socket'Class);
overriding
procedure Finalize (this : in out Socket);
procedure Finalize (This : in out Socket);
not overriding
procedure Close (this : in out Socket) renames Finalize;
procedure Close (This : in out Socket) renames Finalize;
--
@ -742,12 +742,12 @@ package ZMQ.Sockets is
function Stream
(This : Socket)
return not null access Ada.Streams.Root_Stream_Type'class with
pre => This.Retrieve_socket_type = STREAM;
return not null access Ada.Streams.Root_Stream_Type'Class with
Pre => This.Retrieve_Socket_Type = STREAM;
private
type Socket_Stream (self : not null access Socket'class) is new
type Socket_Stream (Self : not null access Socket'Class) is new
Ada.Streams.Root_Stream_Type with null record;
procedure Read
@ -760,14 +760,14 @@ private
Item : Ada.Streams.Stream_Element_Array);
procedure Read_Socket
(stream : not null access Ada.Streams.Root_Stream_Type'class;
s : out Socket);
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
S : out Socket);
procedure Write_Socket
(stream : not null access Ada.Streams.Root_Stream_Type'class;
s : Socket);
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
S : Socket);
type Socket is new Ada.Finalization.Limited_Controlled with record
c : System.Address := System.Null_Address;
C : System.Address := System.Null_Address;
S : aliased Socket_Stream (Socket'Access);
end record;

View File

@ -1,254 +1,254 @@
-------------------------------------------------------------------------------
-- --
-- Copyright (C) 2013-2020, per.s.sandberg@bahnhof.se --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files --
-- (the "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, sublicense, and / or sell copies of the Software, and to --
-- permit persons to whom the Software is furnished to do so, subject to --
-- the following conditions : --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, --
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL --
-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR --
-- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, --
-- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR --
-- OTHER DEALINGS IN THE SOFTWARE. --
-------------------------------------------------------------------------------
-- --
------------------------------------------------------------------------------
with Ada.IO_Exceptions;
with GNAT.Memory_Dump;
with System.Memory;
package body ZMQ.Utilities.Memory_Streams is
use Ada.Streams;
overriding
procedure Dump
(This : in Memory_Stream;
Full_Buffer : in Boolean := False;
Outf : in Text_IO.File_Access := Text_IO.Standard_Output) is
pragma Unreferenced (Outf);
Buffer : Large_Buffer_Access renames This.Buffer.As_Pointer;
begin
if Full_Buffer then
GNAT.Memory_Dump.Dump
(Buffer.all (Buffer.all'First)'Address,
Integer (This.Buffer_Length));
else
GNAT.Memory_Dump.Dump
(Buffer.all (Buffer.all'First)'Address,
Integer (This.Cursor) - 1);
end if;
end Dump;
overriding function Eof (This : in Memory_Stream) return Boolean is
begin
return This.Cursor > This.Buffer_Length;
end Eof;
-----------------
-- Get_Address --
-----------------
overriding
function Get_Address (This : in Memory_Stream) return System.Address is
begin
return This.Buffer.As_Address;
end Get_Address;
----------------
-- Get_Length --
----------------
overriding function Get_Length (This : in Memory_Stream)
return Ada.Streams.Stream_Element_Count is
begin
return This.Buffer_Length;
end Get_Length;
overriding procedure Seek (This : in out Memory_Stream;
Pos : in Ada.Streams.Stream_Element_Offset) is
begin
This.Cursor := This.Cursor + Pos;
end Seek;
overriding function Pos (This : in Memory_Stream)
return Ada.Streams.Stream_Element_Offset is
begin
return This.Cursor;
end Pos;
-----------------
-- Set_Address --
-----------------
overriding
procedure Set_Address
(This : in out Memory_Stream; To : in System.Address) is
begin
This.Buffer.As_Address := To;
end Set_Address;
----------------
-- Set_Length --
----------------
overriding
procedure Set_Length (This : in out Memory_Stream;
To : in Ada.Streams.Stream_Element_Count) is
begin
This.Buffer_Length := To;
This.Reset;
end Set_Length;
----------
-- Read --
----------
overriding
procedure Read
(This : in out Memory_Stream;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset)
is
First : Stream_Element_Offset;
LLast : Stream_Element_Offset;
begin
First := This.Cursor;
LLast := This.Cursor + Item'Length - 1;
if LLast > This.Buffer_Length then
raise Ada.IO_Exceptions.End_Error;
end if;
Item := This.Buffer.As_Pointer.all (First .. LLast);
This.Cursor := LLast + 1;
Last := Item'Last;
end Read;
-----------
-- Write --
-----------
overriding
procedure Write
(This : in out Memory_Stream;
Item : in Stream_Element_Array)
is
First : Stream_Element_Offset;
Last : Stream_Element_Offset;
begin
First := This.Cursor;
Last := This.Cursor + Item'Length - 1;
if Last > This.Buffer_Length then
raise Ada.IO_Exceptions.Device_Error;
end if;
This.Cursor := Last + 1;
This.Buffer.As_Pointer.all (First .. Last) := Item;
end Write;
overriding
procedure Reset (This : in out Memory_Stream) is
begin
This.Cursor := This.Buffer.As_Pointer.all'First;
end Reset;
procedure Read
(This : not null access Ada.Streams.Root_Stream_Type'Class;
Item : out Memory_Stream) is
begin
raise Program_Error with
"Its not possible to read into a memory stream using 'read";
end Read;
procedure Write
(This : not null access Ada.Streams.Root_Stream_Type'Class;
Item : in Memory_Stream) is
begin
Ada.Streams.Stream_Element_Array'Write
(This,
Item.Buffer.As_Pointer.all
(Item.Buffer.As_Pointer.all'First .. Item.Cursor));
end Write;
procedure Read
(This : not null access Ada.Streams.Root_Stream_Type'Class;
Item : out Dynamic_Memory_Stream) is
begin
Read (This, Memory_Stream (Item));
end Read;
procedure Write
(This : not null access Ada.Streams.Root_Stream_Type'Class;
Item : in Dynamic_Memory_Stream) is
begin
Write (This, Memory_Stream (Item));
end Write;
procedure Write
(This : in out Dynamic_Memory_Stream;
Item : in Ada.Streams.Stream_Element_Array) is
begin
if This.Cursor + Item'Length > This.Buffer_Length then
This.Expand (This.Cursor + Item'Length);
end if;
Memory_Stream (This).Write (Item);
end Write;
procedure Expand
(This : in out Dynamic_Memory_Stream;
to_Size : Ada.Streams.Stream_Element_Offset) is
new_Size : System.Memory.size_t := 0;
use System.Memory;
begin
while new_Size < size_t (to_Size) loop
case This.Strategy is
when As_Needed =>
new_Size := size_t (to_Size);
when Multiply_By_Two =>
new_Size := size_t (2 * This.Buffer_Length);
when Add_Initial_Size =>
new_Size := size_t (This.Buffer_Length + This.Initial_Size);
end case;
end loop;
This.Buffer.As_Address := System.Memory.Realloc
(This.Buffer.As_Address, new_Size);
This.Buffer_Length := Streams.Stream_Element_Count (new_Size);
end Expand;
procedure Initialize (This : in out Dynamic_Memory_Stream) is
use System.Memory;
begin
This.Buffer.As_Address :=
System.Memory.Alloc (size_t (This.Initial_Size));
This.Buffer_Length := This.Initial_Size;
end Initialize;
procedure Finalize (This : in out Dynamic_Memory_Stream) is
use System.Memory;
begin
System.Memory.Free (This.Buffer.As_Address);
end Finalize;
procedure Initialize (This : in out controler) is
use System.Memory;
begin
This.controled.Initialize;
end Initialize;
procedure Finalize (This : in out controler) is
begin
This.controled.Finalize;
end Finalize;
end ZMQ.Utilities.Memory_Streams;
-------------------------------------------------------------------------------
-- --
-- Copyright (C) 2013-2020, per.s.sandberg@bahnhof.se --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files --
-- (the "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, sublicense, and / or sell copies of the Software, and to --
-- permit persons to whom the Software is furnished to do so, subject to --
-- the following conditions : --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, --
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL --
-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR --
-- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, --
-- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR --
-- OTHER DEALINGS IN THE SOFTWARE. --
-------------------------------------------------------------------------------
-- --
------------------------------------------------------------------------------
with Ada.IO_Exceptions;
with GNAT.Memory_Dump;
with System.Memory;
package body ZMQ.Utilities.Memory_Streams is
use Ada.Streams;
overriding
procedure Dump
(This : in Memory_Stream;
Full_Buffer : in Boolean := False;
Outf : in Text_IO.File_Access := Text_IO.Standard_Output) is
pragma Unreferenced (Outf);
Buffer : Large_Buffer_Access renames This.Buffer.As_Pointer;
begin
if Full_Buffer then
GNAT.Memory_Dump.Dump
(Buffer.all (Buffer.all'First)'Address,
Integer (This.Buffer_Length));
else
GNAT.Memory_Dump.Dump
(Buffer.all (Buffer.all'First)'Address,
Integer (This.Cursor) - 1);
end if;
end Dump;
overriding function Eof (This : in Memory_Stream) return Boolean is
begin
return This.Cursor > This.Buffer_Length;
end Eof;
-----------------
-- Get_Address --
-----------------
overriding
function Get_Address (This : in Memory_Stream) return System.Address is
begin
return This.Buffer.As_Address;
end Get_Address;
----------------
-- Get_Length --
----------------
overriding function Get_Length (This : in Memory_Stream)
return Ada.Streams.Stream_Element_Count is
begin
return This.Buffer_Length;
end Get_Length;
overriding procedure Seek (This : in out Memory_Stream;
Pos : in Ada.Streams.Stream_Element_Offset) is
begin
This.Cursor := This.Cursor + Pos;
end Seek;
overriding function Pos (This : in Memory_Stream)
return Ada.Streams.Stream_Element_Offset is
begin
return This.Cursor;
end Pos;
-----------------
-- Set_Address --
-----------------
overriding
procedure Set_Address
(This : in out Memory_Stream; To : in System.Address) is
begin
This.Buffer.As_Address := To;
end Set_Address;
----------------
-- Set_Length --
----------------
overriding
procedure Set_Length (This : in out Memory_Stream;
To : in Ada.Streams.Stream_Element_Count) is
begin
This.Buffer_Length := To;
This.Reset;
end Set_Length;
----------
-- Read --
----------
overriding
procedure Read
(This : in out Memory_Stream;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset)
is
First : Stream_Element_Offset;
LLast : Stream_Element_Offset;
begin
First := This.Cursor;
LLast := This.Cursor + Item'Length - 1;
if LLast > This.Buffer_Length then
raise Ada.IO_Exceptions.End_Error;
end if;
Item := This.Buffer.As_Pointer.all (First .. LLast);
This.Cursor := LLast + 1;
Last := Item'Last;
end Read;
-----------
-- Write --
-----------
overriding
procedure Write
(This : in out Memory_Stream;
Item : in Stream_Element_Array)
is
First : Stream_Element_Offset;
Last : Stream_Element_Offset;
begin
First := This.Cursor;
Last := This.Cursor + Item'Length - 1;
if Last > This.Buffer_Length then
raise Ada.IO_Exceptions.Device_Error;
end if;
This.Cursor := Last + 1;
This.Buffer.As_Pointer.all (First .. Last) := Item;
end Write;
overriding
procedure Reset (This : in out Memory_Stream) is
begin
This.Cursor := This.Buffer.As_Pointer.all'First;
end Reset;
procedure Read
(This : not null access Ada.Streams.Root_Stream_Type'Class;
Item : out Memory_Stream) is
begin
raise Program_Error with
"Its not possible to read into a memory stream using 'read";
end Read;
procedure Write
(This : not null access Ada.Streams.Root_Stream_Type'Class;
Item : in Memory_Stream) is
begin
Ada.Streams.Stream_Element_Array'Write
(This,
Item.Buffer.As_Pointer.all
(Item.Buffer.As_Pointer.all'First .. Item.Cursor));
end Write;
procedure Read
(This : not null access Ada.Streams.Root_Stream_Type'Class;
Item : out Dynamic_Memory_Stream) is
begin
Read (This, Memory_Stream (Item));
end Read;
procedure Write
(This : not null access Ada.Streams.Root_Stream_Type'Class;
Item : in Dynamic_Memory_Stream) is
begin
Write (This, Memory_Stream (Item));
end Write;
procedure Write
(This : in out Dynamic_Memory_Stream;
Item : in Ada.Streams.Stream_Element_Array) is
begin
if This.Cursor + Item'Length > This.Buffer_Length then
This.Expand (This.Cursor + Item'Length);
end if;
Memory_Stream (This).Write (Item);
end Write;
procedure Expand
(This : in out Dynamic_Memory_Stream;
To_Size : Ada.Streams.Stream_Element_Offset) is
New_Size : System.Memory.size_t := 0;
use System.Memory;
begin
while New_Size < size_t (To_Size) loop
case This.Strategy is
when As_Needed =>
New_Size := size_t (To_Size);
when Multiply_By_Two =>
New_Size := size_t (2 * This.Buffer_Length);
when Add_Initial_Size =>
New_Size := size_t (This.Buffer_Length + This.Initial_Size);
end case;
end loop;
This.Buffer.As_Address := System.Memory.Realloc
(This.Buffer.As_Address, New_Size);
This.Buffer_Length := Streams.Stream_Element_Count (New_Size);
end Expand;
procedure Initialize (This : in out Dynamic_Memory_Stream) is
use System.Memory;
begin
This.Buffer.As_Address :=
System.Memory.Alloc (size_t (This.Initial_Size));
This.Buffer_Length := This.Initial_Size;
end Initialize;
procedure Finalize (This : in out Dynamic_Memory_Stream) is
use System.Memory;
begin
System.Memory.Free (This.Buffer.As_Address);
end Finalize;
procedure Initialize (This : in out Controler) is
use System.Memory;
begin
This.Controled.Initialize;
end Initialize;
procedure Finalize (This : in out Controler) is
begin
This.Controled.Finalize;
end Finalize;
end ZMQ.Utilities.Memory_Streams;

View File

@ -178,13 +178,13 @@ package ZMQ.Utilities.Memory_Streams is
private
subtype large_buffer is
subtype Large_Buffer is
Streams.Stream_Element_Array (1 .. Streams.Stream_Element_Offset'Last);
type Large_Buffer_Access is access large_buffer;
type Large_Buffer_Access is access Large_Buffer;
for Large_Buffer_Access'Storage_Size use 0;
type Large_Buffer_Union (ref : Boolean := False) is record
case ref is
type Large_Buffer_Union (Ref : Boolean := False) is record
case Ref is
when True =>
As_Address : System.Address;
when False =>
@ -211,17 +211,18 @@ private
Item : in Memory_Stream);
for Memory_Stream'Write use Write;
type controler (controled : not null access Dynamic_Memory_Stream)
type Controler (Controled : not null access Dynamic_Memory_Stream)
is new Ada.Finalization.Limited_Controlled with null record;
procedure Initialize (This : in out controler);
procedure Finalize (This : in out controler);
procedure Initialize (This : in out Controler);
procedure Finalize (This : in out Controler);
type Dynamic_Memory_Stream
(Initial_Size : Streams.Stream_Element_Offset;
Strategy : Expand_Strategy) is new Memory_Stream with record
C : controler (Dynamic_Memory_Stream'Access);
end record;
Strategy : Expand_Strategy) is new Memory_Stream with
record
C : Controler (Dynamic_Memory_Stream'Access);
end record;
procedure Initialize (This : in out Dynamic_Memory_Stream);
procedure Finalize (This : in out Dynamic_Memory_Stream);
@ -237,6 +238,6 @@ private
for Dynamic_Memory_Stream'Write use Write;
procedure Expand
(This : in out Dynamic_Memory_Stream;
to_Size : Ada.Streams.Stream_Element_Offset);
To_Size : Ada.Streams.Stream_Element_Offset);
end ZMQ.Utilities.Memory_Streams;

View File

@ -30,7 +30,7 @@
-------------------------------------------------------------------------------
with Interfaces.C.Strings;
with Interfaces.C;
with ZMQ.Low_Level;
with Ada.Assertions;
package body ZMQ is
@ -40,10 +40,9 @@ package body ZMQ is
-------------------
function Error_Message (No : Integer) return String is
s : constant String := No'Img;
S : constant String := No'Img;
begin
return "[" & s (s'First + 1 .. s'Last) & "] " &
Interfaces.C.Strings.Value (Low_Level.zmq_strerror (int (No)));
return "[" & S (S'First + 1 .. S'Last) & "] ";
end Error_Message;
function Library_Version return Version_Type is
@ -51,22 +50,22 @@ package body ZMQ is
Minor : aliased int;
Patch : aliased int;
begin
return ret : Version_Type do
Low_Level.zmq_version (Major'Access,
return Ret : Version_Type do
Low_Level.Zmq_Version (Major'Access,
Minor'Access,
Patch'Access);
ret := (Natural (Major), Natural (Minor), Natural (Patch));
Ret := (Natural (Major), Natural (Minor), Natural (Patch));
end return;
end Library_Version;
function Image (Item : Version_Type) return String is
s1 : constant String := Item.Major'Img;
s2 : constant String := Item.Minor'Img;
s3 : constant String := Item.Patch'Img;
S1 : constant String := Item.Major'Img;
S2 : constant String := Item.Minor'Img;
S3 : constant String := Item.Patch'Img;
begin
return s1 (s1'First + 1 .. s1'Last) & "." &
s2 (s2'First + 1 .. s2'Last) & "." &
s3 (s3'First + 1 .. s3'Last);
return S1 (S1'First + 1 .. S1'Last) & "." &
S2 (S2'First + 1 .. S2'Last) & "." &
S3 (S3'First + 1 .. S3'Last);
end Image;
procedure Validate_Library_Version is
@ -79,9 +78,4 @@ package body ZMQ is
", expected: " & Image (Binding_Version));
end Validate_Library_Version;
function errno return Integer is
begin
return Integer (Low_Level.zmq_errno);
end errno;
end ZMQ;

View File

@ -49,7 +49,6 @@ package ZMQ is
function Image (Item : Version_Type) return String;
private
function errno return Integer;
function Error_Message (No : Integer) return String;
procedure Validate_Library_Version;
-- Raiese ZMQ_Error if the underlaying library is'nt a valid version

View File

@ -36,7 +36,7 @@ package body ZMQ.Tests.Testcases.Test_Pubsub is
T.Sub.Initialize (T.Ctx, Sockets.SUB);
T.Pub.Connect (Test_Port);
T.Sub.Bind (Test_Port);
T.Sub.Establish_message_filter ("");
T.Sub.Establish_Message_Filter ("");
delay 0.1;
end initialize;