1 (* 2 ################################################################################ 3 # THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # 4 # Read the zproject/README.md for information about making permanent changes. # 5 ################################################################################ 6 7 The high-level C binding for 0MQ 8 *) 9 10 unit libczmq; 11 12 {$if defined(MSWINDOWS)} 13 {$warn SYMBOL_PLATFORM off} 14 {$ifend} 15 16 interface 17 18 uses 19 Winapi.Windows, Winapi.Winsock2; 20 21 const 22 CZMQ_VERSION_MAJOR = 4; 23 CZMQ_VERSION_MINOR = 2; 24 CZMQ_VERSION_PATCH = 1; 25 26 const 27 lib_czmq = 'libczmq.dll'; 28 29 // Standard base 64 30 CZMQ_ZARMOUR_MODE_BASE64_STD = 0; 31 // URL and filename friendly base 64 32 CZMQ_ZARMOUR_MODE_BASE64_URL = 1; 33 // Standard base 32 34 CZMQ_ZARMOUR_MODE_BASE32_STD = 2; 35 // Extended hex base 32 36 CZMQ_ZARMOUR_MODE_BASE32_HEX = 3; 37 // Standard base 16 38 CZMQ_ZARMOUR_MODE_BASE16 = 4; 39 // Z85 from ZeroMQ RFC 32 40 CZMQ_ZARMOUR_MODE_Z85 = 5; 41 42 // Creates a new file 43 CZMQ_ZDIR_PATCH_CREATE = 1; 44 // Delete a file 45 CZMQ_ZDIR_PATCH_DELETE = 2; 46 47 // 48 CZMQ_ZFRAME_MORE = 1; 49 // 50 CZMQ_ZFRAME_REUSE = 2; 51 // 52 CZMQ_ZFRAME_DONTWAIT = 4; 53 54 type 55 PZactor = Pointer; 56 PZarmour = Pointer; 57 PZcert = Pointer; 58 PZcertstore = Pointer; 59 PZchunk = Pointer; 60 PZclock = Pointer; 61 PZconfig = Pointer; 62 PZdigest = Pointer; 63 PZdir = Pointer; 64 PZdirPatch = Pointer; 65 PZfile = Pointer; 66 PZframe = Pointer; 67 PZhash = Pointer; 68 PZhashx = Pointer; 69 PZiflist = Pointer; 70 PZlist = Pointer; 71 PZlistx = Pointer; 72 PZloop = Pointer; 73 PZmsg = Pointer; 74 PZpoller = Pointer; 75 PZsock = Pointer; 76 PZstr = Pointer; 77 PZsys = Pointer; 78 PZuuid = Pointer; 79 PZauth = Pointer; 80 PZbeacon = Pointer; 81 PZgossip = Pointer; 82 PZmonitor = Pointer; 83 PZproxy = Pointer; 84 PZrex = Pointer; 85 86 (* Zactor *) 87 (* provides a simple actor framework *) 88 89 type 90 91 // Actors get a pipe and arguments from caller 92 TZactorFn = procedure(Pipe: PZsock; Args: Pointer); stdcall; 93 PZactorFn = ^TZactorFn; 94 tonull95 // Function to be called on zactor_destroy. Default behavior is to send zmsg_t with string "$TERM" in a first frame. 96 // 97 // An example - to send $KTHXBAI string 98 // 99 // if (zstr_send (self, "$KTHXBAI") == 0) 100 // zsock_wait (self); 101 TZactorDestructorFn = procedure(This: PZactor); stdcall; 102 PZactorDestructorFn = ^TZactorDestructorFn; 103 104 // Create a new actor passing arbitrary arguments reference. zactor_newnull105 function zactor_new(Task: TZactorFn; Args: Pointer): PZactor; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 106 107 // Destroy an actor. 108 procedure zactor_destroy(var self: PZactor); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 109 110 // Send a zmsg message to the actor, take ownership of the message 111 // and destroy when it has been sent. zactor_sendnull112 function zactor_send(self: PZactor; var MsgP: PZmsg): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 113 114 // Receive a zmsg message from the actor. Returns NULL if the actor 115 // was interrupted before the message could be received, or if there 116 // was a timeout on the actor. zactor_recvnull117 function zactor_recv(self: PZactor): PZmsg; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 118 119 // Probe the supplied object, and report if it looks like a zactor_t. zactor_isnull120 function zactor_is(This: Pointer): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 121 122 // Probe the supplied reference. If it looks like a zactor_t instance, 123 // return the underlying libzmq actor handle; else if it looks like 124 // a libzmq actor handle, return the supplied value. zactor_resolvenull125 function zactor_resolve(This: Pointer): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 126 127 // Return the actor's zsock handle. Use this when you absolutely need 128 // to work with the zsock instance rather than the actor. 129 function zactor_sock(self: PZactor): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 130 131 // Change default destructor by custom function. Actor MUST be able to handle new message instead of default $TERM. 132 procedure zactor_set_destructor(self: PZactor; &Destructor: TZactorDestructorFn); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 133 134 // Self test of this class. 135 procedure zactor_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 136 137 (* Zarmour *) 138 (* armoured text encoding and decoding *) 139 140 // Create a new zarmour 141 function zarmour_new: PZarmour; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 142 143 // Destroy the zarmour 144 procedure zarmour_destroy(var self: PZarmour); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 145 146 // Encode a stream of bytes into an armoured string. Returns the armoured 147 // string, or NULL if there was insufficient memory available to allocate 148 // a new string. 149 function zarmour_encode(self: PZarmour; Data: PByte; Size: NativeUInt): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 150 151 // Decode an armoured string into a chunk. The decoded output is 152 // null-terminated, so it may be treated as a string, if that's what 153 // it was prior to encoding. zarmour_decodenull154 function zarmour_decode(self: PZarmour; Data: PAnsiChar): PZchunk; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 155 156 // Get the mode property. zarmour_modenull157 function zarmour_mode(self: PZarmour): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 158 159 // Get printable string for mode. zarmour_mode_strnull160 function zarmour_mode_str(self: PZarmour): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 161 162 // Set the mode property. 163 procedure zarmour_set_mode(self: PZarmour; Mode: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 164 165 // Return true if padding is turned on. zarmour_padnull166 function zarmour_pad(self: PZarmour): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 167 168 // Turn padding on or off. Default is on. 169 procedure zarmour_set_pad(self: PZarmour; Pad: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 170 171 // Get the padding character. zarmour_pad_charnull172 function zarmour_pad_char(self: PZarmour): AnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 173 174 // Set the padding character. 175 procedure zarmour_set_pad_char(self: PZarmour; PadChar: AnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 176 177 // Return if splitting output into lines is turned on. Default is off. zarmour_line_breaksnull178 function zarmour_line_breaks(self: PZarmour): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 179 180 // Turn splitting output into lines on or off. 181 procedure zarmour_set_line_breaks(self: PZarmour; LineBreaks: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 182 183 // Get the line length used for splitting lines. zarmour_line_lengthnull184 function zarmour_line_length(self: PZarmour): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 185 186 // Set the line length used for splitting lines. 187 procedure zarmour_set_line_length(self: PZarmour; LineLength: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 188 189 // Print properties of object 190 procedure zarmour_print(self: PZarmour); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 191 192 // Self test of this class. 193 procedure zarmour_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 194 195 (* Zcert *) 196 (* work with CURVE security certificates *) 197 198 // Create and initialize a new certificate in memory zcert_newnull199 function zcert_new: PZcert; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 200 201 // Accepts public/secret key pair from caller zcert_new_fromnull202 function zcert_new_from(PublicKey: PByte; SecretKey: PByte): PZcert; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 203 204 // Accepts public/secret key text pair from caller zcert_new_from_txtnull205 function zcert_new_from_txt(PublicTxt: PAnsiChar; SecretTxt: PAnsiChar): PZcert; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 206 207 // Load certificate from file zcert_loadnull208 function zcert_load(Filename: PAnsiChar): PZcert; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 209 210 // Destroy a certificate in memory 211 procedure zcert_destroy(var self: PZcert); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 212 213 // Return public part of key pair as 32-byte binary string zcert_public_keynull214 function zcert_public_key(self: PZcert): PByte; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 215 216 // Return secret part of key pair as 32-byte binary string zcert_secret_keynull217 function zcert_secret_key(self: PZcert): PByte; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 218 219 // Return public part of key pair as Z85 armored string zcert_public_txtnull220 function zcert_public_txt(self: PZcert): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 221 222 // Return secret part of key pair as Z85 armored string zcert_secret_txtnull223 function zcert_secret_txt(self: PZcert): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 224 225 // Set certificate metadata from formatted string. 226 procedure zcert_set_meta(self: PZcert; Name: PAnsiChar; Format: PAnsiChar); cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 227 228 // Unset certificate metadata. 229 procedure zcert_unset_meta(self: PZcert; Name: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 230 231 // Get metadata value from certificate; if the metadata value doesn't 232 // exist, returns NULL. 233 function zcert_meta(self: PZcert; Name: PAnsiChar): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 234 235 // Get list of metadata fields from certificate. Caller is responsible for 236 // destroying list. Caller should not modify the values of list items. 237 function zcert_meta_keys(self: PZcert): PZlist; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 238 239 // Save full certificate (public + secret) to file for persistent storage 240 // This creates one public file and one secret file (filename + "_secret"). 241 function zcert_save(self: PZcert; Filename: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 242 243 // Save public certificate only to file for persistent storage 244 function zcert_save_public(self: PZcert; Filename: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 245 246 // Save secret certificate only to file for persistent storage 247 function zcert_save_secret(self: PZcert; Filename: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 248 249 // Apply certificate to socket, i.e. use for CURVE security on socket. 250 // If certificate was loaded from public file, the secret key will be 251 // undefined, and this certificate will not work successfully. 252 procedure zcert_apply(self: PZcert; Socket: PZSock); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 253 254 // Return copy of certificate; if certificate is NULL or we exhausted 255 // heap memory, returns NULL. 256 function zcert_dup(self: PZcert): PZcert; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 257 258 // Return true if two certificates have the same keys 259 function zcert_eq(self: PZcert; Compare: PZcert): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 260 261 // Print certificate contents to stdout 262 procedure zcert_print(self: PZcert); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 263 264 // Self test of this class 265 procedure zcert_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 266 267 (* Zcertstore *) 268 (* work with CURVE security certificate stores *) 269 270 type 271 272 // Loaders retrieve certificates from an arbitrary source. 273 TZcertstoreLoader = procedure(This: PZcertstore); stdcall; 274 PZcertstoreLoader = ^TZcertstoreLoader; 275 276 // Destructor for loader state. 277 TZcertstoreDestructor = procedure(SelfP: PByte); stdcall; 278 PZcertstoreDestructor = ^TZcertstoreDestructor; 279 280 // Create a new certificate store from a disk directory, loading and 281 // indexing all certificates in that location. The directory itself may be 282 // absent, and created later, or modified at any time. The certificate store 283 // is automatically refreshed on any zcertstore_lookup() call. If the 284 // location is specified as NULL, creates a pure-memory store, which you 285 // can work with by inserting certificates at runtime. 286 function zcertstore_new(Location: PAnsiChar): PZcertstore; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 287 288 // Destroy a certificate store object in memory. Does not affect anything 289 // stored on disk. 290 procedure zcertstore_destroy(var self: PZcertstore); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 291 292 // Override the default disk loader with a custom loader fn. 293 procedure zcertstore_set_loader(self: PZcertstore; Loader: TZcertstoreLoader; &Destructor: TZcertstoreDestructor; State: PByte); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 294 295 // Look up certificate by public key, returns zcert_t object if found, 296 // else returns NULL. The public key is provided in Z85 text format. 297 function zcertstore_lookup(self: PZcertstore; PublicKey: PAnsiChar): PZcert; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 298 299 // Insert certificate into certificate store in memory. Note that this 300 // does not save the certificate to disk. To do that, use zcert_save() 301 // directly on the certificate. Takes ownership of zcert_t object. 302 procedure zcertstore_insert(self: PZcertstore; var CertP: PZcert); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 303 304 // Empty certificate hashtable. This wrapper exists to be friendly to bindings, 305 // which don't usually have access to struct internals. 306 procedure zcertstore_empty(self: PZcertstore); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 307 308 // Print list of certificates in store to logging facility 309 procedure zcertstore_print(self: PZcertstore); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 310 311 // Return a list of all the certificates in the store. 312 // The caller takes ownership of the zlistx_t object and is responsible 313 // for destroying it. The caller does not take ownership of the zcert_t 314 // objects. zcertstore_certsnull315 function zcertstore_certs(self: PZcertstore): PZlistx; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 316 317 // Return the state stored in certstore zcertstore_statenull318 function zcertstore_state(self: PZcertstore): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 319 320 // Self test of this class 321 procedure zcertstore_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 322 323 (* Zchunk *) 324 (* work with memory chunks *) 325 326 type 327 328 // Destroy an item 329 TZchunkDestructorFn = procedure(var Hint: Pointer); stdcall; 330 PZchunkDestructorFn = ^TZchunkDestructorFn; 331 332 // Create a new chunk of the specified size. If you specify the data, it 333 // is copied into the chunk. If you do not specify the data, the chunk is 334 // allocated and left empty, and you can then add data using zchunk_append. zchunk_newnull335 function zchunk_new(Data: PByte; Size: NativeUInt): PZchunk; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 336 337 // Create a new chunk from memory. Take ownership of the memory and calling the destructor 338 // on destroy. 339 function zchunk_frommem(Data: PByte; Size: NativeUInt; &Destructor: TZchunkDestructorFn; Hint: Pointer): PZchunk; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 340 341 // Destroy a chunk 342 procedure zchunk_destroy(var self: PZchunk); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 343 344 // Resizes chunk max_size as requested; chunk_cur size is set to zero 345 procedure zchunk_resize(self: PZchunk; Size: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 346 347 // Return chunk cur size zchunk_sizenull348 function zchunk_size(self: PZchunk): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 349 350 // Return chunk max size zchunk_max_sizenull351 function zchunk_max_size(self: PZchunk): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 352 353 // Return chunk data zchunk_datanull354 function zchunk_data(self: PZchunk): PByte; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 355 356 // Set chunk data from user-supplied data; truncate if too large. Data may 357 // be null. Returns actual size of chunk zchunk_setnull358 function zchunk_set(self: PZchunk; Data: PByte; Size: NativeUInt): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 359 360 // Fill chunk data from user-supplied octet zchunk_fillnull361 function zchunk_fill(self: PZchunk; Filler: Byte; Size: NativeUInt): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 362 363 // Append user-supplied data to chunk, return resulting chunk size. If the 364 // data would exceeded the available space, it is truncated. If you want to 365 // grow the chunk to accommodate new data, use the zchunk_extend method. zchunk_appendnull366 function zchunk_append(self: PZchunk; Data: PByte; Size: NativeUInt): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 367 368 // Append user-supplied data to chunk, return resulting chunk size. If the 369 // data would exceeded the available space, the chunk grows in size. zchunk_extendnull370 function zchunk_extend(self: PZchunk; Data: PByte; Size: NativeUInt): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 371 372 // Copy as much data from 'source' into the chunk as possible; returns the 373 // new size of chunk. If all data from 'source' is used, returns exhausted 374 // on the source chunk. Source can be consumed as many times as needed until 375 // it is exhausted. If source was already exhausted, does not change chunk. zchunk_consumenull376 function zchunk_consume(self: PZchunk; Source: PZchunk): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 377 378 // Returns true if the chunk was exhausted by consume methods, or if the 379 // chunk has a size of zero. zchunk_exhaustednull380 function zchunk_exhausted(self: PZchunk): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 381 382 // Read chunk from an open file descriptor zchunk_readnull383 function zchunk_read(Handle: Pointer; Bytes: NativeUInt): PZchunk; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 384 385 // Write chunk to an open file descriptor zchunk_writenull386 function zchunk_write(self: PZchunk; Handle: Pointer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 387 388 // Try to slurp an entire file into a chunk. Will read up to maxsize of 389 // the file. If maxsize is 0, will attempt to read the entire file and 390 // fail with an assertion if that cannot fit into memory. Returns a new 391 // chunk containing the file data, or NULL if the file could not be read. zchunk_slurpnull392 function zchunk_slurp(Filename: PAnsiChar; Maxsize: NativeUInt): PZchunk; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 393 394 // Create copy of chunk, as new chunk object. Returns a fresh zchunk_t 395 // object, or null if there was not enough heap memory. If chunk is null, 396 // returns null. zchunk_dupnull397 function zchunk_dup(self: PZchunk): PZchunk; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 398 399 // Return chunk data encoded as printable hex string. Caller must free 400 // string when finished with it. zchunk_strhexnull401 function zchunk_strhex(self: PZchunk): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 402 403 // Return chunk data copied into freshly allocated string 404 // Caller must free string when finished with it. zchunk_strdupnull405 function zchunk_strdup(self: PZchunk): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 406 407 // Return TRUE if chunk body is equal to string, excluding terminator zchunk_streqnull408 function zchunk_streq(self: PZchunk; &String: PAnsiChar): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 409 410 // Transform zchunk into a zframe that can be sent in a message. zchunk_packnull411 function zchunk_pack(self: PZchunk): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 412 413 // Transform zchunk into a zframe that can be sent in a message. 414 // Take ownership of the chunk. zchunk_packxnull415 function zchunk_packx(var SelfP: PZchunk): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 416 417 // Transform a zframe into a zchunk. zchunk_unpacknull418 function zchunk_unpack(Frame: PZframe): PZchunk; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 419 420 // Calculate SHA1 digest for chunk, using zdigest class. zchunk_digestnull421 function zchunk_digest(self: PZchunk): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 422 423 // Dump chunk to FILE stream, for debugging and tracing. 424 procedure zchunk_fprint(self: PZchunk; &File: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 425 426 // Dump message to stderr, for debugging and tracing. 427 // See zchunk_fprint for details 428 procedure zchunk_print(self: PZchunk); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 429 430 // Probe the supplied object, and report if it looks like a zchunk_t. zchunk_isnull431 function zchunk_is(This: Pointer): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 432 433 // Self test of this class. 434 procedure zchunk_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 435 436 (* Zclock *) 437 (* millisecond clocks and delays *) 438 439 // Sleep for a number of milliseconds 440 procedure zclock_sleep(Msecs: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 441 442 // Return current system clock as milliseconds. Note that this clock can 443 // jump backwards (if the system clock is changed) so is unsafe to use for 444 // timers and time offsets. Use zclock_mono for that instead. zclock_timenull445 function zclock_time: Int64; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 446 447 // Return current monotonic clock in milliseconds. Use this when you compute 448 // time offsets. The monotonic clock is not affected by system changes and 449 // so will never be reset backwards, unlike a system clock. zclock_mononull450 function zclock_mono: Int64; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 451 452 // Return current monotonic clock in microseconds. Use this when you compute 453 // time offsets. The monotonic clock is not affected by system changes and 454 // so will never be reset backwards, unlike a system clock. zclock_usecsnull455 function zclock_usecs: Int64; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 456 457 // Return formatted date/time as fresh string. Free using zstr_free(). zclock_timestrnull458 function zclock_timestr: PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 459 460 // Self test of this class. 461 procedure zclock_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 462 463 (* Zconfig *) 464 (* work with config files written in rfc.zeromq.org/spec:4/ZPL. *) 465 466 type 467 468 // hisnull469 TZconfigFct = function(This: PZconfig; Arg: Pointer; Level: Integer): Integer; stdcall; 470 PZconfigFct = ^TZconfigFct; 471 472 // Create new config item zconfig_newnull473 function zconfig_new(Name: PAnsiChar; Parent: PZconfig): PZconfig; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 474 475 // Load a config tree from a specified ZPL text file; returns a zconfig_t 476 // reference for the root, if the file exists and is readable. Returns NULL 477 // if the file does not exist. zconfig_loadnull478 function zconfig_load(Filename: PAnsiChar): PZconfig; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 479 480 // Equivalent to zconfig_load, taking a format string instead of a fixed 481 // filename. zconfig_loadfnull482 function zconfig_loadf(Format: PAnsiChar): PZconfig; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 483 484 // Destroy a config item and all its children 485 procedure zconfig_destroy(var self: PZconfig); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 486 487 // Create copy of zconfig, caller MUST free the value 488 // Create copy of config, as new zconfig object. Returns a fresh zconfig_t 489 // object. If config is null, or memory was exhausted, returns null. zconfig_dupnull490 function zconfig_dup(self: PZconfig): PZconfig; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 491 492 // Return name of config item zconfig_namenull493 function zconfig_name(self: PZconfig): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 494 495 // Return value of config item zconfig_valuenull496 function zconfig_value(self: PZconfig): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 497 498 // Insert or update configuration key with value 499 procedure zconfig_put(self: PZconfig; Path: PAnsiChar; Value: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 500 501 // Equivalent to zconfig_put, accepting a format specifier and variable 502 // argument list, instead of a single string value. 503 procedure zconfig_putf(self: PZconfig; Path: PAnsiChar; Format: PAnsiChar); cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 504 505 // Get value for config item into a string value; leading slash is optional 506 // and ignored. zconfig_getnull507 function zconfig_get(self: PZconfig; Path: PAnsiChar; DefaultValue: PAnsiChar): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 508 509 // Set config item name, name may be NULL 510 procedure zconfig_set_name(self: PZconfig; Name: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 511 512 // Set new value for config item. The new value may be a string, a printf 513 // format, or NULL. Note that if string may possibly contain '%', or if it 514 // comes from an insecure source, you must use '%s' as the format, followed 515 // by the string. 516 procedure zconfig_set_value(self: PZconfig; Format: PAnsiChar); cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 517 518 // Find our first child, if any zconfig_childnull519 function zconfig_child(self: PZconfig): PZconfig; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 520 521 // Find our first sibling, if any zconfig_nextnull522 function zconfig_next(self: PZconfig): PZconfig; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 523 524 // Find a config item along a path; leading slash is optional and ignored. zconfig_locatenull525 function zconfig_locate(self: PZconfig; Path: PAnsiChar): PZconfig; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 526 527 // Locate the last config item at a specified depth zconfig_at_depthnull528 function zconfig_at_depth(self: PZconfig; Level: Integer): PZconfig; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 529 530 // Execute a callback for each config item in the tree; returns zero if 531 // successful, else -1. zconfig_executenull532 function zconfig_execute(self: PZconfig; Handler: TZconfigFct; Arg: Pointer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 533 534 // Add comment to config item before saving to disk. You can add as many 535 // comment lines as you like. If you use a null format, all comments are 536 // deleted. 537 procedure zconfig_set_comment(self: PZconfig; Format: PAnsiChar); cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 538 539 // Return comments of config item, as zlist. zconfig_commentsnull540 function zconfig_comments(self: PZconfig): PZlist; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 541 542 // Save a config tree to a specified ZPL text file, where a filename 543 // "-" means dump to standard output. zconfig_savenull544 function zconfig_save(self: PZconfig; Filename: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 545 546 // Equivalent to zconfig_save, taking a format string instead of a fixed 547 // filename. zconfig_savefnull548 function zconfig_savef(self: PZconfig; Format: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 549 550 // Report filename used during zconfig_load, or NULL if none zconfig_filenamenull551 function zconfig_filename(self: PZconfig): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 552 553 // Reload config tree from same file that it was previously loaded from. 554 // Returns 0 if OK, -1 if there was an error (and then does not change 555 // existing data). zconfig_reloadnull556 function zconfig_reload(var SelfP: PZconfig): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 557 558 // Load a config tree from a memory chunk zconfig_chunk_loadnull559 function zconfig_chunk_load(Chunk: PZchunk): PZconfig; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 560 561 // Save a config tree to a new memory chunk zconfig_chunk_savenull562 function zconfig_chunk_save(self: PZconfig): PZchunk; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 563 564 // Load a config tree from a null-terminated string zconfig_str_loadnull565 function zconfig_str_load(&String: PAnsiChar): PZconfig; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 566 567 // Save a config tree to a new null terminated string zconfig_str_savenull568 function zconfig_str_save(self: PZconfig): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 569 570 // Return true if a configuration tree was loaded from a file and that 571 // file has changed in since the tree was loaded. zconfig_has_changednull572 function zconfig_has_changed(self: PZconfig): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 573 574 // Destroy subtree (all children) 575 procedure zconfig_remove_subtree(self: PZconfig); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 576 577 // Destroy node and subtree (all children) 578 procedure zconfig_remove(var SelfP: PZconfig); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 579 580 // Print the config file to open stream 581 procedure zconfig_fprint(self: PZconfig; &File: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 582 583 // Print properties of object 584 procedure zconfig_print(self: PZconfig); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 585 586 // Self test of this class 587 procedure zconfig_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 588 589 (* Zdigest *) 590 (* provides hashing functions (SHA-1 at present) *) 591 592 // Constructor - creates new digest object, which you use to build up a 593 // digest by repeatedly calling zdigest_update() on chunks of data. 594 function zdigest_new: PZdigest; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 595 596 // Destroy a digest object 597 procedure zdigest_destroy(var self: PZdigest); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 598 599 // Add buffer into digest calculation 600 procedure zdigest_update(self: PZdigest; Buffer: PByte; Length: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 601 602 // Return final digest hash data. If built without crypto support, 603 // returns NULL. zdigest_datanull604 function zdigest_data(self: PZdigest): PByte; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 605 606 // Return final digest hash size zdigest_sizenull607 function zdigest_size(self: PZdigest): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 608 609 // Return digest as printable hex string; caller should not modify nor 610 // free this string. After calling this, you may not use zdigest_update() 611 // on the same digest. If built without crypto support, returns NULL. zdigest_stringnull612 function zdigest_string(self: PZdigest): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 613 614 // Self test of this class. 615 procedure zdigest_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 616 617 (* Zdir *) 618 (* work with file-system directories *) 619 620 // Create a new directory item that loads in the full tree of the specified 621 // path, optionally located under some parent path. If parent is "-", then 622 // loads only the top-level directory, and does not use parent as a path. zdir_newnull623 function zdir_new(Path: PAnsiChar; Parent: PAnsiChar): PZdir; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 624 625 // Destroy a directory tree and all children it contains. 626 procedure zdir_destroy(var self: PZdir); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 627 628 // Return directory path zdir_pathnull629 function zdir_path(self: PZdir): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 630 631 // Return last modification time for directory. zdir_modifiednull632 function zdir_modified(self: PZdir): Int64; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 633 634 // Return total hierarchy size, in bytes of data contained in all files 635 // in the directory tree. zdir_cursizenull636 function zdir_cursize(self: PZdir): Longint; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 637 638 // Return directory count zdir_countnull639 function zdir_count(self: PZdir): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 640 641 // Returns a sorted list of zfile objects; Each entry in the list is a pointer 642 // to a zfile_t item already allocated in the zdir tree. Do not destroy the 643 // original zdir tree until you are done with this list. zdir_listnull644 function zdir_list(self: PZdir): PZlist; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 645 646 // Remove directory, optionally including all files that it contains, at 647 // all levels. If force is false, will only remove the directory if empty. 648 // If force is true, will remove all files and all subdirectories. 649 procedure zdir_remove(self: PZdir; Force: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 650 651 // Calculate differences between two versions of a directory tree. 652 // Returns a list of zdir_patch_t patches. Either older or newer may 653 // be null, indicating the directory is empty/absent. If alias is set, 654 // generates virtual filename (minus path, plus alias). zdir_diffnull655 function zdir_diff(Older: PZdir; Newer: PZdir; Alias: PAnsiChar): PZlist; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 656 657 // Return full contents of directory as a zdir_patch list. zdir_resyncnull658 function zdir_resync(self: PZdir; Alias: PAnsiChar): PZlist; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 659 660 // Load directory cache; returns a hash table containing the SHA-1 digests 661 // of every file in the tree. The cache is saved between runs in .cache. zdir_cachenull662 function zdir_cache(self: PZdir): PZhash; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 663 664 // Print contents of directory to open stream 665 procedure zdir_fprint(self: PZdir; &File: Pointer; Indent: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 666 667 // Print contents of directory to stdout 668 procedure zdir_print(self: PZdir; Indent: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 669 670 // Create a new zdir_watch actor instance: 671 // 672 // zactor_t *watch = zactor_new (zdir_watch, NULL); 673 // 674 // Destroy zdir_watch instance: 675 // 676 // zactor_destroy (&watch); 677 // 678 // Enable verbose logging of commands and activity: 679 // 680 // zstr_send (watch, "VERBOSE"); 681 // 682 // Subscribe to changes to a directory path: 683 // 684 // zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); 685 // 686 // Unsubscribe from changes to a directory path: 687 // 688 // zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); 689 // 690 // Receive directory changes: 691 // zsock_recv (watch, "sp", &path, &patches); 692 // 693 // // Delete the received data. 694 // free (path); 695 // zlist_destroy (&patches); 696 procedure zdir_watch(Pipe: PZsock; Unused: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 697 698 // Self test of this class. 699 procedure zdir_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 700 701 (* ZdirPatch *) 702 (* work with directory patches *) 703 704 // Create new patch zdir_patch_newnull705 function zdir_patch_new(Path: PAnsiChar; &File: PZfile; Op: Integer; Alias: PAnsiChar): PZdirPatch; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 706 707 // Destroy a patch 708 procedure zdir_patch_destroy(var self: PZdirPatch); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 709 710 // Create copy of a patch. If the patch is null, or memory was exhausted, 711 // returns null. zdir_patch_dupnull712 function zdir_patch_dup(self: PZdirPatch): PZdirPatch; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 713 714 // Return patch file directory path zdir_patch_pathnull715 function zdir_patch_path(self: PZdirPatch): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 716 717 // Return patch file item zdir_patch_filenull718 function zdir_patch_file(self: PZdirPatch): PZfile; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 719 720 // Return operation zdir_patch_opnull721 function zdir_patch_op(self: PZdirPatch): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 722 723 // Return patch virtual file path zdir_patch_vpathnull724 function zdir_patch_vpath(self: PZdirPatch): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 725 726 // Calculate hash digest for file (create only) 727 procedure zdir_patch_digest_set(self: PZdirPatch); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 728 729 // Return hash digest for patch file zdir_patch_digestnull730 function zdir_patch_digest(self: PZdirPatch): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 731 732 // Self test of this class. 733 procedure zdir_patch_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 734 735 (* Zfile *) 736 (* helper functions for working with files. *) 737 738 // If file exists, populates properties. CZMQ supports portable symbolic 739 // links, which are files with the extension ".ln". A symbolic link is a 740 // text file containing one line, the filename of a target file. Reading 741 // data from the symbolic link actually reads from the target file. Path 742 // may be NULL, in which case it is not used. zfile_newnull743 function zfile_new(Path: PAnsiChar; Name: PAnsiChar): PZfile; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 744 745 // Create new temporary file for writing via tmpfile. File is automatically 746 // deleted on destroy zfile_tmpnull747 function zfile_tmp: PZfile; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 748 749 // Destroy a file item 750 procedure zfile_destroy(var self: PZfile); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 751 752 // Duplicate a file item, returns a newly constructed item. If the file 753 // is null, or memory was exhausted, returns null. zfile_dupnull754 function zfile_dup(self: PZfile): PZfile; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 755 756 // Return file name, remove path if provided zfile_filenamenull757 function zfile_filename(self: PZfile; Path: PAnsiChar): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 758 759 // Refresh file properties from disk; this is not done automatically 760 // on access methods, otherwise it is not possible to compare directory 761 // snapshots. 762 procedure zfile_restat(self: PZfile); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 763 764 // Return when the file was last modified. If you want this to reflect the 765 // current situation, call zfile_restat before checking this property. zfile_modifiednull766 function zfile_modified(self: PZfile): Int64; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 767 768 // Return the last-known size of the file. If you want this to reflect the 769 // current situation, call zfile_restat before checking this property. zfile_cursizenull770 function zfile_cursize(self: PZfile): Longint; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 771 772 // Return true if the file is a directory. If you want this to reflect 773 // any external changes, call zfile_restat before checking this property. zfile_is_directorynull774 function zfile_is_directory(self: PZfile): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 775 776 // Return true if the file is a regular file. If you want this to reflect 777 // any external changes, call zfile_restat before checking this property. zfile_is_regularnull778 function zfile_is_regular(self: PZfile): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 779 780 // Return true if the file is readable by this process. If you want this to 781 // reflect any external changes, call zfile_restat before checking this 782 // property. zfile_is_readablenull783 function zfile_is_readable(self: PZfile): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 784 785 // Return true if the file is writeable by this process. If you want this 786 // to reflect any external changes, call zfile_restat before checking this 787 // property. zfile_is_writeablenull788 function zfile_is_writeable(self: PZfile): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 789 790 // Check if file has stopped changing and can be safely processed. 791 // Updates the file statistics from disk at every call. zfile_is_stablenull792 function zfile_is_stable(self: PZfile): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 793 794 // Return true if the file was changed on disk since the zfile_t object 795 // was created, or the last zfile_restat() call made on it. zfile_has_changednull796 function zfile_has_changed(self: PZfile): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 797 798 // Remove the file from disk 799 procedure zfile_remove(self: PZfile); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 800 801 // Open file for reading 802 // Returns 0 if OK, -1 if not found or not accessible zfile_inputnull803 function zfile_input(self: PZfile): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 804 805 // Open file for writing, creating directory if needed 806 // File is created if necessary; chunks can be written to file at any 807 // location. Returns 0 if OK, -1 if error. zfile_outputnull808 function zfile_output(self: PZfile): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 809 810 // Read chunk from file at specified position. If this was the last chunk, 811 // sets the eof property. Returns a null chunk in case of error. zfile_readnull812 function zfile_read(self: PZfile; Bytes: NativeUInt; Offset: Longint): PZchunk; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 813 814 // Returns true if zfile_read() just read the last chunk in the file. zfile_eofnull815 function zfile_eof(self: PZfile): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 816 817 // Write chunk to file at specified position 818 // Return 0 if OK, else -1 zfile_writenull819 function zfile_write(self: PZfile; Chunk: PZchunk; Offset: Longint): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 820 821 // Read next line of text from file. Returns a pointer to the text line, 822 // or NULL if there was nothing more to read from the file. zfile_readlnnull823 function zfile_readln(self: PZfile): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 824 825 // Close file, if open 826 procedure zfile_close(self: PZfile); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 827 828 // Return file handle, if opened zfile_handlenull829 function zfile_handle(self: PZfile): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 830 831 // Calculate SHA1 digest for file, using zdigest class. zfile_digestnull832 function zfile_digest(self: PZfile): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 833 834 // Self test of this class. 835 procedure zfile_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 836 837 (* Zframe *) 838 (* working with single message frames *) 839 840 type 841 842 // Destroy an item 843 TZframeDestructorFn = procedure(var Hint: Pointer); stdcall; 844 PZframeDestructorFn = ^TZframeDestructorFn; 845 846 // Create a new frame. If size is not null, allocates the frame data 847 // to the specified size. If additionally, data is not null, copies 848 // size octets from the specified data into the frame body. zframe_newnull849 function zframe_new(Data: PByte; Size: NativeUInt): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 850 851 // Create an empty (zero-sized) frame zframe_new_emptynull852 function zframe_new_empty: PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 853 854 // Create a frame with a specified string content. zframe_fromnull855 function zframe_from(&String: PAnsiChar): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 856 857 // Create a new frame from memory. Take ownership of the memory and calling the destructor 858 // on destroy. 859 function zframe_frommem(Data: PByte; Size: NativeUInt; &Destructor: TZframeDestructorFn; Hint: Pointer): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 860 861 // Receive frame from socket, returns zframe_t object or NULL if the recv 862 // was interrupted. Does a blocking recv, if you want to not block then use 863 // zpoller or zloop. zframe_recvnull864 function zframe_recv(Source: PZSock): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 865 866 // Destroy a frame 867 procedure zframe_destroy(var self: PZframe); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 868 869 // Send a frame to a socket, destroy frame after sending. 870 // Return -1 on error, 0 on success. zframe_sendnull871 function zframe_send(var SelfP: PZframe; Dest: PZSock; Flags: Integer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 872 873 // Return number of bytes in frame data zframe_sizenull874 function zframe_size(self: PZframe): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 875 876 // Return address of frame data zframe_datanull877 function zframe_data(self: PZframe): PByte; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 878 879 // Return meta data property for frame 880 // The caller shall not modify or free the returned value, which shall be 881 // owned by the message. zframe_metanull882 function zframe_meta(self: PZframe; &Property: PAnsiChar): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 883 884 // Create a new frame that duplicates an existing frame. If frame is null, 885 // or memory was exhausted, returns null. zframe_dupnull886 function zframe_dup(self: PZframe): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 887 888 // Return frame data encoded as printable hex string, useful for 0MQ UUIDs. 889 // Caller must free string when finished with it. zframe_strhexnull890 function zframe_strhex(self: PZframe): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 891 892 // Return frame data copied into freshly allocated string 893 // Caller must free string when finished with it. zframe_strdupnull894 function zframe_strdup(self: PZframe): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 895 896 // Return TRUE if frame body is equal to string, excluding terminator zframe_streqnull897 function zframe_streq(self: PZframe; &String: PAnsiChar): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 898 899 // Return frame MORE indicator (1 or 0), set when reading frame from socket 900 // or by the zframe_set_more() method zframe_morenull901 function zframe_more(self: PZframe): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 902 903 // Set frame MORE indicator (1 or 0). Note this is NOT used when sending 904 // frame to socket, you have to specify flag explicitly. 905 procedure zframe_set_more(self: PZframe; More: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 906 907 // Return frame routing ID, if the frame came from a ZMQ_SERVER socket. 908 // Else returns zero. zframe_routing_idnull909 function zframe_routing_id(self: PZframe): Cardinal; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 910 911 // Set routing ID on frame. This is used if/when the frame is sent to a 912 // ZMQ_SERVER socket. 913 procedure zframe_set_routing_id(self: PZframe; RoutingId: Cardinal); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 914 915 // Return frame group of radio-dish pattern. zframe_groupnull916 function zframe_group(self: PZframe): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 917 918 // Set group on frame. This is used if/when the frame is sent to a 919 // ZMQ_RADIO socket. 920 // Return -1 on error, 0 on success. zframe_set_groupnull921 function zframe_set_group(self: PZframe; Group: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 922 923 // Return TRUE if two frames have identical size and data 924 // If either frame is NULL, equality is always false. zframe_eqnull925 function zframe_eq(self: PZframe; Other: PZframe): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 926 927 // Set new contents for frame 928 procedure zframe_reset(self: PZframe; Data: PByte; Size: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 929 930 // Send message to zsys log sink (may be stdout, or system facility as 931 // configured by zsys_set_logstream). Prefix shows before frame, if not null. 932 // Long messages are truncated. 933 procedure zframe_print(self: PZframe; Prefix: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 934 935 // Send message to zsys log sink (may be stdout, or system facility as 936 // configured by zsys_set_logstream). Prefix shows before frame, if not null. 937 // Message length is specified; no truncation unless length is zero. 938 // Backwards compatible with zframe_print when length is zero. 939 procedure zframe_print_n(self: PZframe; Prefix: PAnsiChar; Length: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 940 941 // Probe the supplied object, and report if it looks like a zframe_t. zframe_isnull942 function zframe_is(This: Pointer): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 943 944 // Self test of this class. 945 procedure zframe_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 946 947 (* Zhash *) 948 (* generic type-free hash container (simple) *) 949 950 type 951 fornull952 // Callback function for zhash_freefn method 953 TZhashFreeFn = procedure(Data: Pointer); stdcall; 954 PZhashFreeFn = ^TZhashFreeFn; 955 956 // Create a new, empty hash container zhash_newnull957 function zhash_new: PZhash; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 958 959 // Unpack binary frame into a new hash table. Packed data must follow format 960 // defined by zhash_pack. Hash table is set to autofree. An empty frame 961 // unpacks to an empty hash table. zhash_unpacknull962 function zhash_unpack(Frame: PZframe): PZhash; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 963 964 // Destroy a hash container and all items in it 965 procedure zhash_destroy(var self: PZhash); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 966 967 // Insert item into hash table with specified key and item. 968 // If key is already present returns -1 and leaves existing item unchanged 969 // Returns 0 on success. zhash_insertnull970 function zhash_insert(self: PZhash; Key: PAnsiChar; Item: Pointer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 971 972 // Update item into hash table with specified key and item. 973 // If key is already present, destroys old item and inserts new one. 974 // Use free_fn method to ensure deallocator is properly called on item. 975 procedure zhash_update(self: PZhash; Key: PAnsiChar; Item: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 976 977 // Remove an item specified by key from the hash table. If there was no such doesnull978 // item, this function does nothing. 979 procedure zhash_delete(self: PZhash; Key: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 980 981 // Return the item at the specified key, or null zhash_lookupnull982 function zhash_lookup(self: PZhash; Key: PAnsiChar): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 983 984 // Reindexes an item from an old key to a new key. If there was no such 985 // item, does nothing. Returns 0 if successful, else -1. zhash_renamenull986 function zhash_rename(self: PZhash; OldKey: PAnsiChar; NewKey: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 987 fornull988 // Set a free function for the specified hash table item. When the item is 989 // destroyed, the free function, if any, is called on that item. 990 // Use this when hash items are dynamically allocated, to ensure that 991 // you don't have memory leaks. You can pass 'free' or NULL as a free_fn. 992 // Returns the item, or NULL if there is no such item. 993 function zhash_freefn(self: PZhash; Key: PAnsiChar; FreeFn: TZhashFreeFn): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 994 995 // Return the number of keys/items in the hash table 996 function zhash_size(self: PZhash): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 997 998 // Make copy of hash table; if supplied table is null, returns null. 999 // Does not copy items themselves. Rebuilds new table so may be slow on 1000 // very large tables. NOTE: only works with item values that are strings 1001 // since there's no other way to know how to duplicate the item value. 1002 function zhash_dup(self: PZhash): PZhash; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1003 1004 // Return keys for items in table zhash_keysnull1005 function zhash_keys(self: PZhash): PZlist; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1006 1007 // Simple iterator; returns first item in hash table, in no given order, 1008 // or NULL if the table is empty. This method is simpler to use than the 1009 // foreach() method, which is deprecated. To access the key for this item 1010 // use zhash_cursor(). NOTE: do NOT modify the table while iterating. zhash_firstnull1011 function zhash_first(self: PZhash): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1012 1013 // Simple iterator; returns next item in hash table, in no given order, 1014 // or NULL if the last item was already returned. Use this together with 1015 // zhash_first() to process all items in a hash table. If you need the 1016 // items in sorted order, use zhash_keys() and then zlist_sort(). To 1017 // access the key for this item use zhash_cursor(). NOTE: do NOT modify 1018 // the table while iterating. zhash_nextnull1019 function zhash_next(self: PZhash): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1020 1021 // After a successful first/next method, returns the key for the item that 1022 // was returned. This is a constant string that you may not modify or 1023 // deallocate, and which lasts as long as the item in the hash. After an 1024 // unsuccessful first/next, returns NULL. zhash_cursornull1025 function zhash_cursor(self: PZhash): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1026 1027 // Add a comment to hash table before saving to disk. You can add as many 1028 // comment lines as you like. These comment lines are discarded when loading 1029 // the file. If you use a null format, all comments are deleted. 1030 procedure zhash_comment(self: PZhash; Format: PAnsiChar); cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1031 1032 // Serialize hash table to a binary frame that can be sent in a message. 1033 // The packed format is compatible with the 'dictionary' type defined in 1034 // http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: 1035 // 1036 // ; A list of name/value pairs 1037 // dictionary = dict-count *( dict-name dict-value ) 1038 // dict-count = number-4 1039 // dict-value = longstr 1040 // dict-name = string 1041 // 1042 // ; Strings are always length + text contents 1043 // longstr = number-4 *VCHAR 1044 // string = number-1 *VCHAR 1045 // 1046 // ; Numbers are unsigned integers in network byte order 1047 // number-1 = 1OCTET 1048 // number-4 = 4OCTET 1049 // 1050 // Comments are not included in the packed data. Item values MUST be 1051 // strings. zhash_packnull1052 function zhash_pack(self: PZhash): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1053 1054 // Save hash table to a text file in name=value format. Hash values must be 1055 // printable strings; keys may not contain '=' character. Returns 0 if OK, 1056 // else -1 if a file error occurred. zhash_savenull1057 function zhash_save(self: PZhash; Filename: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1058 1059 // Load hash table from a text file in name=value format; hash table must 1060 // already exist. Hash values must printable strings; keys may not contain 1061 // '=' character. Returns 0 if OK, else -1 if a file was not readable. zhash_loadnull1062 function zhash_load(self: PZhash; Filename: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1063 1064 // When a hash table was loaded from a file by zhash_load, this method will 1065 // reload the file if it has been modified since, and is "stable", i.e. not 1066 // still changing. Returns 0 if OK, -1 if there was an error reloading the 1067 // file. zhash_refreshnull1068 function zhash_refresh(self: PZhash): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1069 1070 // Set hash for automatic value destruction. Note that this assumes that 1071 // values are NULL-terminated strings. Do not use with different types. 1072 procedure zhash_autofree(self: PZhash); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1073 1074 // Self test of this class. 1075 procedure zhash_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1076 1077 (* Zhashx *) 1078 (* extended generic type-free hash container *) 1079 1080 type 1081 1082 // Destroy an item 1083 TZhashxDestructorFn = procedure(var Item: Pointer); stdcall; 1084 PZhashxDestructorFn = ^TZhashxDestructorFn; 1085 1086 // Duplicate an item temnull1087 TZhashxDuplicatorFn = function(Item: Pointer): Pointer; stdcall; 1088 PZhashxDuplicatorFn = ^TZhashxDuplicatorFn; 1089 1090 // Compare two items, for sorting tem1null1091 TZhashxComparatorFn = function(Item1: Pointer; Item2: Pointer): Integer; stdcall; 1092 PZhashxComparatorFn = ^TZhashxComparatorFn; 1093 1094 // Destroy an item. 1095 TZhashxFreeFn = procedure(Data: Pointer); stdcall; 1096 PZhashxFreeFn = ^TZhashxFreeFn; 1097 fornull1098 // Hash function for keys. 1099 TZhashxHashFn = function(Key: Pointer): NativeUInt; stdcall; 1100 PZhashxHashFn = ^TZhashxHashFn; 1101 1102 // Serializes an item to a longstr. 1103 // The caller takes ownership of the newly created object. temnull1104 TZhashxSerializerFn = function(Item: Pointer): PAnsiChar; stdcall; 1105 PZhashxSerializerFn = ^TZhashxSerializerFn; 1106 1107 // Deserializes a longstr into an item. 1108 // The caller takes ownership of the newly created object. temStrnull1109 TZhashxDeserializerFn = function(ItemStr: PAnsiChar): Pointer; stdcall; 1110 PZhashxDeserializerFn = ^TZhashxDeserializerFn; 1111 1112 // Create a new, empty hash container zhashx_newnull1113 function zhashx_new: PZhashx; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1114 1115 // Unpack binary frame into a new hash table. Packed data must follow format 1116 // defined by zhashx_pack. Hash table is set to autofree. An empty frame 1117 // unpacks to an empty hash table. zhashx_unpacknull1118 function zhashx_unpack(Frame: PZframe): PZhashx; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1119 tonull1120 // Same as unpack but uses a user-defined deserializer function to convert 1121 // a longstr back into item format. 1122 function zhashx_unpack_own(Frame: PZframe; Deserializer: TZhashxDeserializerFn): PZhashx; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1123 1124 // Destroy a hash container and all items in it 1125 procedure zhashx_destroy(var self: PZhashx); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1126 1127 // Insert item into hash table with specified key and item. 1128 // If key is already present returns -1 and leaves existing item unchanged 1129 // Returns 0 on success. zhashx_insertnull1130 function zhashx_insert(self: PZhashx; Key: Pointer; Item: Pointer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1131 1132 // Update or insert item into hash table with specified key and item. If the 1133 // key is already present, destroys old item and inserts new one. If you set 1134 // a container item destructor, this is called on the old value. If the key 1135 // was not already present, inserts a new item. Sets the hash cursor to the 1136 // new item. 1137 procedure zhashx_update(self: PZhashx; Key: Pointer; Item: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1138 1139 // Remove an item specified by key from the hash table. If there was no such doesnull1140 // item, this function does nothing. 1141 procedure zhashx_delete(self: PZhashx; Key: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1142 1143 // Delete all items from the hash table. If the key destructor is 1144 // set, calls it on every key. If the item destructor is set, calls 1145 // it on every item. 1146 procedure zhashx_purge(self: PZhashx); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1147 1148 // Return the item at the specified key, or null zhashx_lookupnull1149 function zhashx_lookup(self: PZhashx; Key: Pointer): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1150 1151 // Reindexes an item from an old key to a new key. If there was no such 1152 // item, does nothing. Returns 0 if successful, else -1. zhashx_renamenull1153 function zhashx_rename(self: PZhashx; OldKey: Pointer; NewKey: Pointer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1154 fornull1155 // Set a free function for the specified hash table item. When the item is 1156 // destroyed, the free function, if any, is called on that item. 1157 // Use this when hash items are dynamically allocated, to ensure that 1158 // you don't have memory leaks. You can pass 'free' or NULL as a free_fn. 1159 // Returns the item, or NULL if there is no such item. 1160 function zhashx_freefn(self: PZhashx; Key: Pointer; FreeFn: TZhashxFreeFn): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1161 1162 // Return the number of keys/items in the hash table 1163 function zhashx_size(self: PZhashx): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1164 1165 // Return a zlistx_t containing the keys for the items in the 1166 // table. Uses the key_duplicator to duplicate all keys and sets the 1167 // key_destructor as destructor for the list. 1168 function zhashx_keys(self: PZhashx): PZlistx; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1169 1170 // Return a zlistx_t containing the values for the items in the 1171 // table. Uses the duplicator to duplicate all items and sets the 1172 // destructor as destructor for the list. 1173 function zhashx_values(self: PZhashx): PZlistx; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1174 1175 // Simple iterator; returns first item in hash table, in no given order, 1176 // or NULL if the table is empty. This method is simpler to use than the 1177 // foreach() method, which is deprecated. To access the key for this item 1178 // use zhashx_cursor(). NOTE: do NOT modify the table while iterating. 1179 function zhashx_first(self: PZhashx): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1180 1181 // Simple iterator; returns next item in hash table, in no given order, 1182 // or NULL if the last item was already returned. Use this together with 1183 // zhashx_first() to process all items in a hash table. If you need the 1184 // items in sorted order, use zhashx_keys() and then zlistx_sort(). To 1185 // access the key for this item use zhashx_cursor(). NOTE: do NOT modify 1186 // the table while iterating. 1187 function zhashx_next(self: PZhashx): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1188 1189 // After a successful first/next method, returns the key for the item that 1190 // was returned. This is a constant string that you may not modify or 1191 // deallocate, and which lasts as long as the item in the hash. After an 1192 // unsuccessful first/next, returns NULL. 1193 function zhashx_cursor(self: PZhashx): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1194 1195 // Add a comment to hash table before saving to disk. You can add as many 1196 // comment lines as you like. These comment lines are discarded when loading 1197 // the file. If you use a null format, all comments are deleted. 1198 procedure zhashx_comment(self: PZhashx; Format: PAnsiChar); cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1199 1200 // Save hash table to a text file in name=value format. Hash values must be 1201 // printable strings; keys may not contain '=' character. Returns 0 if OK, 1202 // else -1 if a file error occurred. 1203 function zhashx_save(self: PZhashx; Filename: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1204 1205 // Load hash table from a text file in name=value format; hash table must 1206 // already exist. Hash values must printable strings; keys may not contain 1207 // '=' character. Returns 0 if OK, else -1 if a file was not readable. 1208 function zhashx_load(self: PZhashx; Filename: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1209 1210 // When a hash table was loaded from a file by zhashx_load, this method will 1211 // reload the file if it has been modified since, and is "stable", i.e. not 1212 // still changing. Returns 0 if OK, -1 if there was an error reloading the 1213 // file. 1214 function zhashx_refresh(self: PZhashx): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1215 1216 // Serialize hash table to a binary frame that can be sent in a message. 1217 // The packed format is compatible with the 'dictionary' type defined in 1218 // http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: 1219 // 1220 // ; A list of name/value pairs 1221 // dictionary = dict-count *( dict-name dict-value ) 1222 // dict-count = number-4 1223 // dict-value = longstr 1224 // dict-name = string 1225 // 1226 // ; Strings are always length + text contents 1227 // longstr = number-4 *VCHAR 1228 // string = number-1 *VCHAR 1229 // 1230 // ; Numbers are unsigned integers in network byte order 1231 // number-1 = 1OCTET 1232 // number-4 = 4OCTET 1233 // 1234 // Comments are not included in the packed data. Item values MUST be 1235 // strings. 1236 function zhashx_pack(self: PZhashx): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1237 1238 // Same as pack but uses a user-defined serializer function to convert items 1239 // into longstr. 1240 function zhashx_pack_own(self: PZhashx; Serializer: TZhashxSerializerFn): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1241 1242 // Make a copy of the list; items are duplicated if you set a duplicator 1243 // for the list, otherwise not. Copying a null reference returns a null 1244 // reference. Note that this method's behavior changed slightly for CZMQ 1245 // v3.x, as it does not set nor respect autofree. It does however let you 1246 // duplicate any hash table safely. The old behavior is in zhashx_dup_v2. 1247 function zhashx_dup(self: PZhashx): PZhashx; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1248 1249 // Set a user-defined deallocator for hash items; by default items are not 1250 // freed when the hash is destroyed. 1251 procedure zhashx_set_destructor(self: PZhashx; &Destructor: TZhashxDestructorFn); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1252 1253 // Set a user-defined duplicator for hash items; by default items are not 1254 // copied when the hash is duplicated. 1255 procedure zhashx_set_duplicator(self: PZhashx; Duplicator: TZhashxDuplicatorFn); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1256 1257 // Set a user-defined deallocator for keys; by default keys are freed 1258 // when the hash is destroyed using free(). 1259 procedure zhashx_set_key_destructor(self: PZhashx; &Destructor: TZhashxDestructorFn); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1260 1261 // Set a user-defined duplicator for keys; by default keys are duplicated 1262 // using strdup. 1263 procedure zhashx_set_key_duplicator(self: PZhashx; Duplicator: TZhashxDuplicatorFn); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1264 1265 // Set a user-defined comparator for keys; by default keys are 1266 // compared using strcmp. shouldnull1267 // The callback function should return zero (0) on matching 1268 // items. 1269 procedure zhashx_set_key_comparator(self: PZhashx; Comparator: TZhashxComparatorFn); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1270 fornull1271 // Set a user-defined hash function for keys; by default keys are 1272 // hashed by a modified Bernstein hashing function. 1273 procedure zhashx_set_key_hasher(self: PZhashx; Hasher: TZhashxHashFn); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1274 1275 // Make copy of hash table; if supplied table is null, returns null. 1276 // Does not copy items themselves. Rebuilds new table so may be slow on 1277 // very large tables. NOTE: only works with item values that are strings 1278 // since there's no other way to know how to duplicate the item value. 1279 function zhashx_dup_v2(self: PZhashx): PZhashx; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1280 1281 // Self test of this class. 1282 procedure zhashx_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1283 1284 (* Ziflist *) 1285 (* List of network interfaces available on system *) 1286 1287 // Get a list of network interfaces currently defined on the system 1288 function ziflist_new: PZiflist; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1289 1290 // Destroy a ziflist instance 1291 procedure ziflist_destroy(var self: PZiflist); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1292 1293 // Reload network interfaces from system 1294 procedure ziflist_reload(self: PZiflist); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1295 1296 // Return the number of network interfaces on system 1297 function ziflist_size(self: PZiflist): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1298 1299 // Get first network interface, return NULL if there are none 1300 function ziflist_first(self: PZiflist): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1301 1302 // Get next network interface, return NULL if we hit the last one 1303 function ziflist_next(self: PZiflist): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1304 1305 // Return the current interface IP address as a printable string 1306 function ziflist_address(self: PZiflist): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1307 1308 // Return the current interface broadcast address as a printable string 1309 function ziflist_broadcast(self: PZiflist): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1310 1311 // Return the current interface network mask as a printable string 1312 function ziflist_netmask(self: PZiflist): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1313 1314 // Return the list of interfaces. 1315 procedure ziflist_print(self: PZiflist); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1316 1317 // Get a list of network interfaces currently defined on the system 1318 // Includes IPv6 interfaces 1319 function ziflist_new_ipv6: PZiflist; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1320 1321 // Reload network interfaces from system, including IPv6 1322 procedure ziflist_reload_ipv6(self: PZiflist); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1323 1324 // Return true if the current interface uses IPv6 1325 function ziflist_is_ipv6(self: PZiflist): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1326 1327 // Self test of this class. 1328 procedure ziflist_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1329 1330 (* Zlist *) 1331 (* simple generic list container *) 1332 1333 type 1334 1335 // Comparison function e.g. for sorting and removing. 1336 TZlistCompareFn = function(Item1: Pointer; Item2: Pointer): Integer; stdcall; 1337 PZlistCompareFn = ^TZlistCompareFn; 1338 1339 // Callback function for zlist_freefn method 1340 TZlistFreeFn = procedure(Data: Pointer); stdcall; 1341 PZlistFreeFn = ^TZlistFreeFn; 1342 1343 // Create a new list container 1344 function zlist_new: PZlist; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1345 1346 // Destroy a list container 1347 procedure zlist_destroy(var self: PZlist); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1348 1349 // Return the item at the head of list. If the list is empty, returns NULL. 1350 // Leaves cursor pointing at the head item, or NULL if the list is empty. 1351 function zlist_first(self: PZlist): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1352 1353 // Return the next item. If the list is empty, returns NULL. To move to 1354 // the start of the list call zlist_first (). Advances the cursor. 1355 function zlist_next(self: PZlist): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1356 1357 // Return the item at the tail of list. If the list is empty, returns NULL. 1358 // Leaves cursor pointing at the tail item, or NULL if the list is empty. 1359 function zlist_last(self: PZlist): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1360 1361 // Return first item in the list, or null, leaves the cursor 1362 function zlist_head(self: PZlist): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1363 1364 // Return last item in the list, or null, leaves the cursor 1365 function zlist_tail(self: PZlist): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1366 1367 // Return the current item of list. If the list is empty, returns NULL. 1368 // Leaves cursor pointing at the current item, or NULL if the list is empty. 1369 function zlist_item(self: PZlist): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1370 1371 // Append an item to the end of the list, return 0 if OK or -1 if this 1372 // failed for some reason (out of memory). Note that if a duplicator has 1373 // been set, this method will also duplicate the item. 1374 function zlist_append(self: PZlist; Item: Pointer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1375 1376 // Push an item to the start of the list, return 0 if OK or -1 if this 1377 // failed for some reason (out of memory). Note that if a duplicator has 1378 // been set, this method will also duplicate the item. 1379 function zlist_push(self: PZlist; Item: Pointer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1380 1381 // Pop the item off the start of the list, if any 1382 function zlist_pop(self: PZlist): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1383 1384 // Checks if an item already is present. Uses compare method to determine if 1385 // items are equal. If the compare method is NULL the check will only compare 1386 // pointers. Returns true if item is present else false. 1387 function zlist_exists(self: PZlist; Item: Pointer): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1388 1389 // Remove the specified item from the list if present 1390 procedure zlist_remove(self: PZlist; Item: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1391 1392 // Make a copy of list. If the list has autofree set, the copied list will 1393 // duplicate all items, which must be strings. Otherwise, the list will hold 1394 // pointers back to the items in the original list. If list is null, returns 1395 // NULL. 1396 function zlist_dup(self: PZlist): PZlist; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1397 1398 // Purge all items from list 1399 procedure zlist_purge(self: PZlist); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1400 1401 // Return number of items in the list 1402 function zlist_size(self: PZlist): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1403 1404 // Sort the list. If the compare function is null, sorts the list by 1405 // ascending key value using a straight ASCII comparison. If you specify 1406 // a compare function, this decides how items are sorted. The sort is not 1407 // stable, so may reorder items with the same keys. The algorithm used is 1408 // combsort, a compromise between performance and simplicity. 1409 procedure zlist_sort(self: PZlist; Compare: TZlistCompareFn); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1410 1411 // Set list for automatic item destruction; item values MUST be strings. 1412 // By default a list item refers to a value held elsewhere. When you set 1413 // this, each time you append or push a list item, zlist will take a copy 1414 // of the string value. Then, when you destroy the list, it will free all 1415 // item values automatically. If you use any other technique to allocate 1416 // list values, you must free them explicitly before destroying the list. 1417 // The usual technique is to pop list items and destroy them, until the 1418 // list is empty. 1419 procedure zlist_autofree(self: PZlist); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1420 1421 // Sets a compare function for this list. The function compares two items. 1422 // It returns an integer less than, equal to, or greater than zero if the 1423 // first item is found, respectively, to be less than, to match, or be 1424 // greater than the second item. 1425 // This function is used for sorting, removal and exists checking. 1426 procedure zlist_comparefn(self: PZlist; Fn: TZlistCompareFn); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1427 1428 // Set a free function for the specified list item. When the item is 1429 // destroyed, the free function, if any, is called on that item. 1430 // Use this when list items are dynamically allocated, to ensure that 1431 // you don't have memory leaks. You can pass 'free' or NULL as a free_fn. 1432 // Returns the item, or NULL if there is no such item. zlist_freefnnull1433 function zlist_freefn(self: PZlist; Item: Pointer; Fn: TZlistFreeFn; AtTail: Boolean): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1434 1435 // Self test of this class. 1436 procedure zlist_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1437 1438 (* Zlistx *) 1439 (* extended generic list container *) 1440 1441 type 1442 1443 // Destroy an item 1444 TZlistxDestructorFn = procedure(var Item: Pointer); stdcall; 1445 PZlistxDestructorFn = ^TZlistxDestructorFn; 1446 1447 // Duplicate an item temnull1448 TZlistxDuplicatorFn = function(Item: Pointer): Pointer; stdcall; 1449 PZlistxDuplicatorFn = ^TZlistxDuplicatorFn; 1450 1451 // Compare two items, for sorting tem1null1452 TZlistxComparatorFn = function(Item1: Pointer; Item2: Pointer): Integer; stdcall; 1453 PZlistxComparatorFn = ^TZlistxComparatorFn; 1454 1455 // Create a new, empty list. zlistx_newnull1456 function zlistx_new: PZlistx; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1457 1458 // Unpack binary frame into a new list. Packed data must follow format 1459 // defined by zlistx_pack. List is set to autofree. An empty frame 1460 // unpacks to an empty list. zlistx_unpacknull1461 function zlistx_unpack(Frame: PZframe): PZlistx; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1462 1463 // Destroy a list. If an item destructor was specified, all items in the 1464 // list are automatically destroyed as well. 1465 procedure zlistx_destroy(var self: PZlistx); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1466 1467 // Add an item to the head of the list. Calls the item duplicator, if any, 1468 // on the item. Resets cursor to list head. Returns an item handle on 1469 // success, NULL if memory was exhausted. zlistx_add_startnull1470 function zlistx_add_start(self: PZlistx; Item: Pointer): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1471 1472 // Add an item to the tail of the list. Calls the item duplicator, if any, 1473 // on the item. Resets cursor to list head. Returns an item handle on 1474 // success, NULL if memory was exhausted. zlistx_add_endnull1475 function zlistx_add_end(self: PZlistx; Item: Pointer): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1476 1477 // Return the number of items in the list zlistx_sizenull1478 function zlistx_size(self: PZlistx): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1479 1480 // Return first item in the list, or null, leaves the cursor zlistx_headnull1481 function zlistx_head(self: PZlistx): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1482 1483 // Return last item in the list, or null, leaves the cursor zlistx_tailnull1484 function zlistx_tail(self: PZlistx): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1485 1486 // Return the item at the head of list. If the list is empty, returns NULL. 1487 // Leaves cursor pointing at the head item, or NULL if the list is empty. zlistx_firstnull1488 function zlistx_first(self: PZlistx): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1489 1490 // Return the next item. At the end of the list (or in an empty list), 1491 // returns NULL. Use repeated zlistx_next () calls to work through the list 1492 // from zlistx_first (). First time, acts as zlistx_first(). zlistx_nextnull1493 function zlistx_next(self: PZlistx): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1494 1495 // Return the previous item. At the start of the list (or in an empty list), 1496 // returns NULL. Use repeated zlistx_prev () calls to work through the list 1497 // backwards from zlistx_last (). First time, acts as zlistx_last(). zlistx_prevnull1498 function zlistx_prev(self: PZlistx): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1499 1500 // Return the item at the tail of list. If the list is empty, returns NULL. 1501 // Leaves cursor pointing at the tail item, or NULL if the list is empty. zlistx_lastnull1502 function zlistx_last(self: PZlistx): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1503 1504 // Returns the value of the item at the cursor, or NULL if the cursor is 1505 // not pointing to an item. zlistx_itemnull1506 function zlistx_item(self: PZlistx): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1507 1508 // Returns the handle of the item at the cursor, or NULL if the cursor is 1509 // not pointing to an item. zlistx_cursornull1510 function zlistx_cursor(self: PZlistx): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1511 1512 // Returns the item associated with the given list handle, or NULL if passed 1513 // in handle is NULL. Asserts that the passed in handle points to a list element. zlistx_handle_itemnull1514 function zlistx_handle_item(Handle: Pointer): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1515 1516 // Find an item in the list, searching from the start. Uses the item 1517 // comparator, if any, else compares item values directly. Returns the 1518 // item handle found, or NULL. Sets the cursor to the found item, if any. zlistx_findnull1519 function zlistx_find(self: PZlistx; Item: Pointer): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1520 1521 // Detach an item from the list, using its handle. The item is not modified, 1522 // and the caller is responsible for destroying it if necessary. If handle is 1523 // null, detaches the first item on the list. Returns item that was detached, 1524 // or null if none was. If cursor was at item, moves cursor to previous item, 1525 // so you can detach items while iterating forwards through a list. zlistx_detachnull1526 function zlistx_detach(self: PZlistx; Handle: Pointer): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1527 1528 // Detach item at the cursor, if any, from the list. The item is not modified, 1529 // and the caller is responsible for destroying it as necessary. Returns item 1530 // that was detached, or null if none was. Moves cursor to previous item, so 1531 // you can detach items while iterating forwards through a list. zlistx_detach_curnull1532 function zlistx_detach_cur(self: PZlistx): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1533 1534 // Delete an item, using its handle. Calls the item destructor if any is 1535 // set. If handle is null, deletes the first item on the list. Returns 0 1536 // if an item was deleted, -1 if not. If cursor was at item, moves cursor 1537 // to previous item, so you can delete items while iterating forwards 1538 // through a list. 1539 function zlistx_delete(self: PZlistx; Handle: Pointer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1540 1541 // Move an item to the start of the list, via its handle. 1542 procedure zlistx_move_start(self: PZlistx; Handle: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1543 1544 // Move an item to the end of the list, via its handle. 1545 procedure zlistx_move_end(self: PZlistx; Handle: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1546 1547 // Remove all items from the list, and destroy them if the item destructor 1548 // is set. 1549 procedure zlistx_purge(self: PZlistx); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1550 1551 // Sort the list. If an item comparator was set, calls that to compare 1552 // items, otherwise compares on item value. The sort is not stable, so may 1553 // reorder equal items. 1554 procedure zlistx_sort(self: PZlistx); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1555 1556 // Create a new node and insert it into a sorted list. Calls the item 1557 // duplicator, if any, on the item. If low_value is true, starts searching 1558 // from the start of the list, otherwise searches from the end. Use the item 1559 // comparator, if any, to find where to place the new node. Returns a handle 1560 // to the new node, or NULL if memory was exhausted. Resets the cursor to the 1561 // list head. zlistx_insertnull1562 function zlistx_insert(self: PZlistx; Item: Pointer; LowValue: Boolean): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1563 1564 // Move an item, specified by handle, into position in a sorted list. Uses 1565 // the item comparator, if any, to determine the new location. If low_value 1566 // is true, starts searching from the start of the list, otherwise searches 1567 // from the end. 1568 procedure zlistx_reorder(self: PZlistx; Handle: Pointer; LowValue: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1569 1570 // Make a copy of the list; items are duplicated if you set a duplicator 1571 // for the list, otherwise not. Copying a null reference returns a null 1572 // reference. zlistx_dupnull1573 function zlistx_dup(self: PZlistx): PZlistx; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1574 1575 // Set a user-defined deallocator for list items; by default items are not 1576 // freed when the list is destroyed. 1577 procedure zlistx_set_destructor(self: PZlistx; &Destructor: TZlistxDestructorFn); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1578 1579 // Set a user-defined duplicator for list items; by default items are not 1580 // copied when the list is duplicated. 1581 procedure zlistx_set_duplicator(self: PZlistx; Duplicator: TZlistxDuplicatorFn); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1582 1583 // Set a user-defined comparator for zlistx_find and zlistx_sort; the method 1584 // must return -1, 0, or 1 depending on whether item1 is less than, equal to, 1585 // or greater than, item2. 1586 procedure zlistx_set_comparator(self: PZlistx; Comparator: TZlistxComparatorFn); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1587 1588 // Serialize list to a binary frame that can be sent in a message. 1589 // The packed format is compatible with the 'strings' type implemented by zproto: 1590 // 1591 // ; A list of strings 1592 // list = list-count *longstr 1593 // list-count = number-4 1594 // 1595 // ; Strings are always length + text contents 1596 // longstr = number-4 *VCHAR 1597 // 1598 // ; Numbers are unsigned integers in network byte order 1599 // number-4 = 4OCTET zlistx_packnull1600 function zlistx_pack(self: PZlistx): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1601 1602 // Self test of this class. 1603 procedure zlistx_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1604 1605 (* Zloop *) 1606 (* event-driven reactor *) 1607 1608 type 1609 fornull1610 // Callback function for reactor socket activity 1611 TZloopReaderFn = function(Loop: PZloop; Reader: PZsock; Arg: Pointer): Integer; stdcall; 1612 PZloopReaderFn = ^TZloopReaderFn; 1613 fornull1614 // Callback function for reactor events (low-level) 1615 TZloopFn = function(Loop: PZloop; Item: Pointer; Arg: Pointer): Integer; stdcall; 1616 PZloopFn = ^TZloopFn; 1617 1618 // Callback for reactor timer events oopnull1619 TZloopTimerFn = function(Loop: PZloop; TimerId: Integer; Arg: Pointer): Integer; stdcall; 1620 PZloopTimerFn = ^TZloopTimerFn; 1621 1622 // Create a new zloop reactor zloop_newnull1623 function zloop_new: PZloop; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1624 1625 // Destroy a reactor 1626 procedure zloop_destroy(var self: PZloop); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1627 1628 // Register socket reader with the reactor. When the reader has messages, 1629 // the reactor will call the handler, passing the arg. Returns 0 if OK, -1 1630 // if there was an error. If you register the same socket more than once, 1631 // each instance will invoke its corresponding handler. zloop_readernull1632 function zloop_reader(self: PZloop; Sock: PZsock; Handler: TZloopReaderFn; Arg: Pointer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1633 1634 // Cancel a socket reader from the reactor. If multiple readers exist for 1635 // same socket, cancels ALL of them. 1636 procedure zloop_reader_end(self: PZloop; Sock: PZsock); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1637 1638 // Configure a registered reader to ignore errors. If you do not set this, 1639 // then readers that have errors are removed from the reactor silently. 1640 procedure zloop_reader_set_tolerant(self: PZloop; Sock: PZsock); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1641 1642 // Register low-level libzmq pollitem with the reactor. When the pollitem 1643 // is ready, will call the handler, passing the arg. Returns 0 if OK, -1 1644 // if there was an error. If you register the pollitem more than once, each 1645 // instance will invoke its corresponding handler. A pollitem with 1646 // socket=NULL and fd=0 means 'poll on FD zero'. zloop_pollernull1647 function zloop_poller(self: PZloop; Item: Pointer; Handler: TZloopFn; Arg: Pointer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1648 1649 // Cancel a pollitem from the reactor, specified by socket or FD. If both 1650 // are specified, uses only socket. If multiple poll items exist for same 1651 // socket/FD, cancels ALL of them. 1652 procedure zloop_poller_end(self: PZloop; Item: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1653 1654 // Configure a registered poller to ignore errors. If you do not set this, 1655 // then poller that have errors are removed from the reactor silently. 1656 procedure zloop_poller_set_tolerant(self: PZloop; Item: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1657 1658 // Register a timer that expires after some delay and repeats some number of 1659 // times. At each expiry, will call the handler, passing the arg. To run a 1660 // timer forever, use 0 times. Returns a timer_id that is used to cancel the 1661 // timer in the future. Returns -1 if there was an error. zloop_timernull1662 function zloop_timer(self: PZloop; Delay: NativeUInt; Times: NativeUInt; Handler: TZloopTimerFn; Arg: Pointer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1663 1664 // Cancel a specific timer identified by a specific timer_id (as returned by 1665 // zloop_timer). zloop_timer_endnull1666 function zloop_timer_end(self: PZloop; TimerId: Integer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1667 1668 // Register a ticket timer. Ticket timers are very fast in the case where 1669 // you use a lot of timers (thousands), and frequently remove and add them. 1670 // The main use case is expiry timers for servers that handle many clients, 1671 // and which reset the expiry timer for each message received from a client. 1672 // Whereas normal timers perform poorly as the number of clients grows, the 1673 // cost of ticket timers is constant, no matter the number of clients. You 1674 // must set the ticket delay using zloop_set_ticket_delay before creating a 1675 // ticket. Returns a handle to the timer that you should use in 1676 // zloop_ticket_reset and zloop_ticket_delete. zloop_ticketnull1677 function zloop_ticket(self: PZloop; Handler: TZloopTimerFn; Arg: Pointer): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1678 1679 // Reset a ticket timer, which moves it to the end of the ticket list and 1680 // resets its execution time. This is a very fast operation. 1681 procedure zloop_ticket_reset(self: PZloop; Handle: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1682 1683 // Delete a ticket timer. We do not actually delete the ticket here, as 1684 // other code may still refer to the ticket. We mark as deleted, and remove 1685 // later and safely. 1686 procedure zloop_ticket_delete(self: PZloop; Handle: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1687 1688 // Set the ticket delay, which applies to all tickets. If you lower the 1689 // delay and there are already tickets created, the results are undefined. 1690 procedure zloop_set_ticket_delay(self: PZloop; TicketDelay: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1691 1692 // Set hard limit on number of timers allowed. Setting more than a small 1693 // number of timers (10-100) can have a dramatic impact on the performance 1694 // of the reactor. For high-volume cases, use ticket timers. If the hard 1695 // limit is reached, the reactor stops creating new timers and logs an 1696 // error. 1697 procedure zloop_set_max_timers(self: PZloop; MaxTimers: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1698 1699 // Set verbose tracing of reactor on/off. The default verbose setting is 1700 // off (false). 1701 procedure zloop_set_verbose(self: PZloop; Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1702 1703 // By default the reactor stops if the process receives a SIGINT or SIGTERM 1704 // signal. This makes it impossible to shut-down message based architectures 1705 // like zactors. This method lets you switch off break handling. The default 1706 // nonstop setting is off (false). 1707 procedure zloop_set_nonstop(self: PZloop; Nonstop: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1708 1709 // Start the reactor. Takes control of the thread and returns when the 0MQ 1710 // context is terminated or the process is interrupted, or any event handler 1711 // returns -1. Event handlers may register new sockets and timers, and 1712 // cancel sockets. Returns 0 if interrupted, -1 if canceled by a handler. zloop_startnull1713 function zloop_start(self: PZloop): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1714 1715 // Self test of this class. 1716 procedure zloop_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1717 1718 (* Zmsg *) 1719 (* working with multipart messages *) 1720 1721 // Create a new empty message object zmsg_newnull1722 function zmsg_new: PZmsg; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1723 1724 // Receive message from socket, returns zmsg_t object or NULL if the recv 1725 // was interrupted. Does a blocking recv. If you want to not block then use 1726 // the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input 1727 // before receiving. zmsg_recvnull1728 function zmsg_recv(Source: PZSock): PZmsg; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1729 1730 // Load/append an open file into new message, return the message. 1731 // Returns NULL if the message could not be loaded. zmsg_loadnull1732 function zmsg_load(&File: Pointer): PZmsg; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1733 1734 // Decodes a serialized message frame created by zmsg_encode () and returns 1735 // a new zmsg_t object. Returns NULL if the frame was badly formatted or 1736 // there was insufficient memory to work. zmsg_decodenull1737 function zmsg_decode(Frame: PZframe): PZmsg; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1738 1739 // Generate a signal message encoding the given status. A signal is a short 1740 // message carrying a 1-byte success/failure code (by convention, 0 means 1741 // OK). Signals are encoded to be distinguishable from "normal" messages. zmsg_new_signalnull1742 function zmsg_new_signal(Status: Byte): PZmsg; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1743 1744 // Destroy a message object and all frames it contains 1745 procedure zmsg_destroy(var self: PZmsg); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1746 1747 // Send message to destination socket, and destroy the message after sending 1748 // it successfully. If the message has no frames, sends nothing but destroys 1749 // the message anyhow. Nullifies the caller's reference to the message (as 1750 // it is a destructor). 1751 function zmsg_send(var SelfP: PZmsg; Dest: PZSock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1752 1753 // Send message to destination socket as part of a multipart sequence, and 1754 // destroy the message after sending it successfully. Note that after a 1755 // zmsg_sendm, you must call zmsg_send or another method that sends a final 1756 // message part. If the message has no frames, sends nothing but destroys 1757 // the message anyhow. Nullifies the caller's reference to the message (as 1758 // it is a destructor). 1759 function zmsg_sendm(var SelfP: PZmsg; Dest: PZSock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1760 1761 // Return size of message, i.e. number of frames (0 or more). zmsg_sizenull1762 function zmsg_size(self: PZmsg): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1763 1764 // Return total size of all frames in message. zmsg_content_sizenull1765 function zmsg_content_size(self: PZmsg): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1766 1767 // Return message routing ID, if the message came from a ZMQ_SERVER socket. 1768 // Else returns zero. zmsg_routing_idnull1769 function zmsg_routing_id(self: PZmsg): Cardinal; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1770 1771 // Set routing ID on message. This is used if/when the message is sent to a 1772 // ZMQ_SERVER socket. 1773 procedure zmsg_set_routing_id(self: PZmsg; RoutingId: Cardinal); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1774 1775 // Push frame to the front of the message, i.e. before all other frames. 1776 // Message takes ownership of frame, will destroy it when message is sent. 1777 // Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not 1778 // nullify the caller's frame reference. 1779 function zmsg_prepend(self: PZmsg; var FrameP: PZframe): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1780 1781 // Add frame to the end of the message, i.e. after all other frames. 1782 // Message takes ownership of frame, will destroy it when message is sent. 1783 // Returns 0 on success. Deprecates zmsg_add, which did not nullify the 1784 // caller's frame reference. zmsg_appendnull1785 function zmsg_append(self: PZmsg; var FrameP: PZframe): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1786 1787 // Remove first frame from message, if any. Returns frame, or NULL. zmsg_popnull1788 function zmsg_pop(self: PZmsg): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1789 1790 // Push block of memory to front of message, as a new frame. 1791 // Returns 0 on success, -1 on error. zmsg_pushmemnull1792 function zmsg_pushmem(self: PZmsg; Data: PByte; Size: NativeUInt): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1793 1794 // Add block of memory to the end of the message, as a new frame. 1795 // Returns 0 on success, -1 on error. zmsg_addmemnull1796 function zmsg_addmem(self: PZmsg; Data: PByte; Size: NativeUInt): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1797 1798 // Push string as new frame to front of message. 1799 // Returns 0 on success, -1 on error. zmsg_pushstrnull1800 function zmsg_pushstr(self: PZmsg; &String: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1801 1802 // Push string as new frame to end of message. 1803 // Returns 0 on success, -1 on error. zmsg_addstrnull1804 function zmsg_addstr(self: PZmsg; &String: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1805 1806 // Push formatted string as new frame to front of message. 1807 // Returns 0 on success, -1 on error. zmsg_pushstrfnull1808 function zmsg_pushstrf(self: PZmsg; Format: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1809 1810 // Push formatted string as new frame to end of message. 1811 // Returns 0 on success, -1 on error. zmsg_addstrfnull1812 function zmsg_addstrf(self: PZmsg; Format: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1813 1814 // Pop frame off front of message, return as fresh string. If there were 1815 // no more frames in the message, returns NULL. zmsg_popstrnull1816 function zmsg_popstr(self: PZmsg): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1817 1818 // Push encoded message as a new frame. Message takes ownership of 1819 // submessage, so the original is destroyed in this call. Returns 0 on 1820 // success, -1 on error. zmsg_addmsgnull1821 function zmsg_addmsg(self: PZmsg; var MsgP: PZmsg): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1822 1823 // Remove first submessage from message, if any. Returns zmsg_t, or NULL if 1824 // decoding was not successful. zmsg_popmsgnull1825 function zmsg_popmsg(self: PZmsg): PZmsg; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1826 1827 // Remove specified frame from list, if present. Does not destroy frame. 1828 procedure zmsg_remove(self: PZmsg; Frame: PZframe); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1829 1830 // Set cursor to first frame in message. Returns frame, or NULL, if the 1831 // message is empty. Use this to navigate the frames as a list. zmsg_firstnull1832 function zmsg_first(self: PZmsg): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1833 1834 // Return the next frame. If there are no more frames, returns NULL. To move 1835 // to the first frame call zmsg_first(). Advances the cursor. zmsg_nextnull1836 function zmsg_next(self: PZmsg): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1837 1838 // Return the last frame. If there are no frames, returns NULL. zmsg_lastnull1839 function zmsg_last(self: PZmsg): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1840 1841 // Save message to an open file, return 0 if OK, else -1. The message is 1842 // saved as a series of frames, each with length and data. Note that the 1843 // file is NOT guaranteed to be portable between operating systems, not 1844 // versions of CZMQ. The file format is at present undocumented and liable 1845 // to arbitrary change. zmsg_savenull1846 function zmsg_save(self: PZmsg; &File: Pointer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1847 1848 // Serialize multipart message to a single message frame. Use this method 1849 // to send structured messages across transports that do not support 1850 // multipart data. Allocates and returns a new frame containing the 1851 // serialized message. To decode a serialized message frame, use 1852 // zmsg_decode (). zmsg_encodenull1853 function zmsg_encode(self: PZmsg): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1854 1855 // Create copy of message, as new message object. Returns a fresh zmsg_t 1856 // object. If message is null, or memory was exhausted, returns null. zmsg_dupnull1857 function zmsg_dup(self: PZmsg): PZmsg; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1858 1859 // Send message to zsys log sink (may be stdout, or system facility as 1860 // configured by zsys_set_logstream). 1861 // Long messages are truncated. 1862 procedure zmsg_print(self: PZmsg); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1863 1864 // Send message to zsys log sink (may be stdout, or system facility as 1865 // configured by zsys_set_logstream). 1866 // Message length is specified; no truncation unless length is zero. 1867 // Backwards compatible with zframe_print when length is zero. 1868 procedure zmsg_print_n(self: PZmsg; Size: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1869 1870 // Return true if the two messages have the same number of frames and each 1871 // frame in the first message is identical to the corresponding frame in the 1872 // other message. As with zframe_eq, return false if either message is NULL. zmsg_eqnull1873 function zmsg_eq(self: PZmsg; Other: PZmsg): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1874 1875 // Return signal value, 0 or greater, if message is a signal, -1 if not. zmsg_signalnull1876 function zmsg_signal(self: PZmsg): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1877 1878 // Probe the supplied object, and report if it looks like a zmsg_t. zmsg_isnull1879 function zmsg_is(This: Pointer): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1880 1881 // Self test of this class. 1882 procedure zmsg_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1883 1884 (* Zpoller *) 1885 (* event-driven reactor *) 1886 1887 // Create new poller, specifying zero or more readers. The list of 1888 // readers ends in a NULL. Each reader can be a zsock_t instance, a 1889 // zactor_t instance, a libzmq socket (void *), or a file handle. zpoller_newnull1890 function zpoller_new(Reader: PZSock): PZpoller; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1891 1892 // Destroy a poller 1893 procedure zpoller_destroy(var self: PZpoller); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1894 1895 // Add a reader to be polled. Returns 0 if OK, -1 on failure. The reader may 1896 // be a libzmq void * socket, a zsock_t instance, a zactor_t instance or a 1897 // file handle. zpoller_addnull1898 function zpoller_add(self: PZpoller; Reader: PZSock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1899 1900 // Remove a reader from the poller; returns 0 if OK, -1 on failure. The reader 1901 // must have been passed during construction, or in an zpoller_add () call. zpoller_removenull1902 function zpoller_remove(self: PZpoller; Reader: Pointer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1903 1904 // By default the poller stops if the process receives a SIGINT or SIGTERM 1905 // signal. This makes it impossible to shut-down message based architectures 1906 // like zactors. This method lets you switch off break handling. The default 1907 // nonstop setting is off (false). 1908 procedure zpoller_set_nonstop(self: PZpoller; Nonstop: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1909 1910 // Poll the registered readers for I/O, return first reader that has input. 1911 // The reader will be a libzmq void * socket, a zsock_t, a zactor_t 1912 // instance or a file handle as specified in zpoller_new/zpoller_add. The 1913 // timeout should be zero or greater, or -1 to wait indefinitely. Socket 1914 // priority is defined by their order in the poll list. If you need a 1915 // balanced poll, use the low level zmq_poll method directly. If the poll 1916 // call was interrupted (SIGINT), or the ZMQ context was destroyed, or the 1917 // timeout expired, returns NULL. You can test the actual exit condition by 1918 // calling zpoller_expired () and zpoller_terminated (). The timeout is in 1919 // msec. zpoller_waitnull1920 function zpoller_wait(self: PZpoller; Timeout: Integer): PZSock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1921 1922 // Return true if the last zpoller_wait () call ended because the timeout 1923 // expired, without any error. zpoller_expirednull1924 function zpoller_expired(self: PZpoller): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1925 1926 // Return true if the last zpoller_wait () call ended because the process 1927 // was interrupted, or the parent context was destroyed. zpoller_terminatednull1928 function zpoller_terminated(self: PZpoller): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1929 1930 // Self test of this class. 1931 procedure zpoller_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1932 1933 (* Zsock *) 1934 (* high-level socket API that hides libzmq contexts and sockets *) 1935 1936 // Create a new socket. Returns the new socket, or NULL if the new socket 1937 // could not be created. Note that the symbol zsock_new (and other 1938 // constructors/destructors for zsock) are redirected to the *_checked 1939 // variant, enabling intelligent socket leak detection. This can have 1940 // performance implications if you use a LOT of sockets. To turn off this 1941 // redirection behaviour, define ZSOCK_NOCHECK. zsock_newnull1942 function zsock_new(&Type: Integer): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1943 1944 // Create a PUB socket. Default action is bind. zsock_new_pubnull1945 function zsock_new_pub(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1946 1947 // Create a SUB socket, and optionally subscribe to some prefix string. Default 1948 // action is connect. zsock_new_subnull1949 function zsock_new_sub(Endpoint: PAnsiChar; Subscribe: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1950 1951 // Create a REQ socket. Default action is connect. zsock_new_reqnull1952 function zsock_new_req(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1953 1954 // Create a REP socket. Default action is bind. zsock_new_repnull1955 function zsock_new_rep(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1956 1957 // Create a DEALER socket. Default action is connect. zsock_new_dealernull1958 function zsock_new_dealer(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1959 1960 // Create a ROUTER socket. Default action is bind. zsock_new_routernull1961 function zsock_new_router(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1962 1963 // Create a PUSH socket. Default action is connect. zsock_new_pushnull1964 function zsock_new_push(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1965 1966 // Create a PULL socket. Default action is bind. zsock_new_pullnull1967 function zsock_new_pull(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1968 1969 // Create an XPUB socket. Default action is bind. zsock_new_xpubnull1970 function zsock_new_xpub(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1971 1972 // Create an XSUB socket. Default action is connect. zsock_new_xsubnull1973 function zsock_new_xsub(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1974 1975 // Create a PAIR socket. Default action is connect. zsock_new_pairnull1976 function zsock_new_pair(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1977 1978 // Create a STREAM socket. Default action is connect. zsock_new_streamnull1979 function zsock_new_stream(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1980 1981 // Create a SERVER socket. Default action is bind. zsock_new_servernull1982 function zsock_new_server(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1983 1984 // Create a CLIENT socket. Default action is connect. zsock_new_clientnull1985 function zsock_new_client(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1986 1987 // Create a RADIO socket. Default action is bind. zsock_new_radionull1988 function zsock_new_radio(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1989 1990 // Create a DISH socket. Default action is connect. zsock_new_dishnull1991 function zsock_new_dish(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1992 1993 // Create a GATHER socket. Default action is bind. zsock_new_gathernull1994 function zsock_new_gather(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1995 1996 // Create a SCATTER socket. Default action is connect. zsock_new_scatternull1997 function zsock_new_scatter(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 1998 1999 // Create a DGRAM (UDP) socket. Default action is bind. 2000 // The endpoint is a string consisting of a 2001 // 'transport'`://` followed by an 'address'. As this is 2002 // a UDP socket the 'transport' has to be 'udp'. The 2003 // 'address' specifies the ip address and port to 2004 // bind to. For example: udp://127.0.0.1:1234 2005 // Note: To send to an endpoint over UDP you have to 2006 // send a message with the destination endpoint address 2007 // as a first message! zsock_new_dgramnull2008 function zsock_new_dgram(Endpoint: PAnsiChar): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2009 2010 // Destroy the socket. You must use this for any socket created via the 2011 // zsock_new method. 2012 procedure zsock_destroy(var self: PZsock); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2013 2014 // Bind a socket to a formatted endpoint. For tcp:// endpoints, supports 2015 // ephemeral ports, if you specify the port number as "*". By default 2016 // zsock uses the IANA designated range from C000 (49152) to FFFF (65535). 2017 // To override this range, follow the "*" with "[first-last]". Either or 2018 // both first and last may be empty. To bind to a random port within the 2019 // range, use "!" in place of "*". 2020 // 2021 // Examples: 2022 // tcp://127.0.0.1:* bind to first free port from C000 up 2023 // tcp://127.0.0.1:! bind to random port from C000 to FFFF 2024 // tcp://127.0.0.1:*[60000-] bind to first free port from 60000 up 2025 // tcp://127.0.0.1:![-60000] bind to random port from C000 to 60000 2026 // tcp://127.0.0.1:![55000-55999] 2027 // bind to random port from 55000 to 55999 2028 // 2029 // On success, returns the actual port number used, for tcp:// endpoints, 2030 // and 0 for other transports. On failure, returns -1. Note that when using 2031 // ephemeral ports, a port may be reused by different services without 2032 // clients being aware. Protocols that run on ephemeral ports should take 2033 // this into account. zsock_bindnull2034 function zsock_bind(self: PZsock; Format: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2035 2036 // Returns last bound endpoint, if any. zsock_endpointnull2037 function zsock_endpoint(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2038 2039 // Unbind a socket from a formatted endpoint. 2040 // Returns 0 if OK, -1 if the endpoint was invalid or the function 2041 // isn't supported. 2042 function zsock_unbind(self: PZsock; Format: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2043 2044 // Connect a socket to a formatted endpoint 2045 // Returns 0 if OK, -1 if the endpoint was invalid. 2046 function zsock_connect(self: PZsock; Format: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2047 2048 // Disconnect a socket from a formatted endpoint 2049 // Returns 0 if OK, -1 if the endpoint was invalid or the function 2050 // isn't supported. 2051 function zsock_disconnect(self: PZsock; Format: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2052 2053 // Attach a socket to zero or more endpoints. If endpoints is not null, 2054 // parses as list of ZeroMQ endpoints, separated by commas, and prefixed by 2055 // '@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all 2056 // endpoints were valid, or -1 if there was a syntax error. If the endpoint 2057 // does not start with '@' or '>', the serverish argument defines whether 2058 // it is used to bind (serverish = true) or connect (serverish = false). zsock_attachnull2059 function zsock_attach(self: PZsock; Endpoints: PAnsiChar; Serverish: Boolean): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2060 2061 // Returns socket type as printable constant string. zsock_type_strnull2062 function zsock_type_str(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2063 2064 // Send a 'picture' message to the socket (or actor). The picture is a 2065 // string that defines the type of each frame. This makes it easy to send 2066 // a complex multiframe message in one call. The picture can contain any 2067 // of these characters, each corresponding to one or two arguments: 2068 // 2069 // i = int (signed) 2070 // 1 = uint8_t 2071 // 2 = uint16_t 2072 // 4 = uint32_t 2073 // 8 = uint64_t 2074 // s = char * 2075 // b = byte *, size_t (2 arguments) 2076 // c = zchunk_t * 2077 // f = zframe_t * 2078 // h = zhashx_t * 2079 // l = zlistx_t * (DRAFT) 2080 // U = zuuid_t * 2081 // p = void * (sends the pointer value, only meaningful over inproc) 2082 // m = zmsg_t * (sends all frames in the zmsg) 2083 // z = sends zero-sized frame (0 arguments) 2084 // u = uint (deprecated) 2085 // 2086 // Note that s, b, c, and f are encoded the same way and the choice is 2087 // offered as a convenience to the sender, which may or may not already 2088 // have data in a zchunk or zframe. Does not change or take ownership of 2089 // any arguments. Returns 0 if successful, -1 if sending failed for any 2090 // reason. zsock_sendnull2091 function zsock_send(self: PZsock; Picture: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2092 2093 // Send a 'picture' message to the socket (or actor). This is a va_list 2094 // version of zsock_send (), so please consult its documentation for the 2095 // details. zsock_vsendnull2096 function zsock_vsend(self: PZsock; Picture: PAnsiChar; Argptr: va_list): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2097 2098 // Receive a 'picture' message to the socket (or actor). See zsock_send for 2099 // the format and meaning of the picture. Returns the picture elements into 2100 // a series of pointers as provided by the caller: 2101 // 2102 // i = int * (stores signed integer) 2103 // 4 = uint32_t * (stores 32-bit unsigned integer) 2104 // 8 = uint64_t * (stores 64-bit unsigned integer) 2105 // s = char ** (allocates new string) 2106 // b = byte **, size_t * (2 arguments) (allocates memory) 2107 // c = zchunk_t ** (creates zchunk) 2108 // f = zframe_t ** (creates zframe) 2109 // U = zuuid_t * (creates a zuuid with the data) 2110 // h = zhashx_t ** (creates zhashx) 2111 // l = zlistx_t ** (creates zlistx) (DRAFT) 2112 // p = void ** (stores pointer) 2113 // m = zmsg_t ** (creates a zmsg with the remaining frames) 2114 // z = null, asserts empty frame (0 arguments) 2115 // u = uint * (stores unsigned integer, deprecated) 2116 // 2117 // Note that zsock_recv creates the returned objects, and the caller must 2118 // destroy them when finished with them. The supplied pointers do not need 2119 // to be initialized. Returns 0 if successful, or -1 if it failed to recv 2120 // a message, in which case the pointers are not modified. When message 2121 // frames are truncated (a short message), sets return values to zero/null. 2122 // If an argument pointer is NULL, does not store any value (skips it). 2123 // An 'n' picture matches an empty frame; if the message does not match, 2124 // the method will return -1. zsock_recvnull2125 function zsock_recv(self: PZsock; Picture: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2126 2127 // Receive a 'picture' message from the socket (or actor). This is a 2128 // va_list version of zsock_recv (), so please consult its documentation 2129 // for the details. zsock_vrecvnull2130 function zsock_vrecv(self: PZsock; Picture: PAnsiChar; Argptr: va_list): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2131 2132 // Send a binary encoded 'picture' message to the socket (or actor). This 2133 // method is similar to zsock_send, except the arguments are encoded in a 2134 // binary format that is compatible with zproto, and is designed to reduce 2135 // memory allocations. The pattern argument is a string that defines the 2136 // type of each argument. Supports these argument types: 2137 // 2138 // pattern C type zproto type: 2139 // 1 uint8_t type = "number" size = "1" 2140 // 2 uint16_t type = "number" size = "2" 2141 // 4 uint32_t type = "number" size = "3" 2142 // 8 uint64_t type = "number" size = "4" 2143 // s char *, 0-255 chars type = "string" 2144 // S char *, 0-2^32-1 chars type = "longstr" 2145 // c zchunk_t * type = "chunk" 2146 // f zframe_t * type = "frame" 2147 // u zuuid_t * type = "uuid" 2148 // m zmsg_t * type = "msg" 2149 // p void *, sends pointer value, only over inproc 2150 // 2151 // Does not change or take ownership of any arguments. Returns 0 if 2152 // successful, -1 if sending failed for any reason. zsock_bsendnull2153 function zsock_bsend(self: PZsock; Picture: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2154 2155 // Receive a binary encoded 'picture' message from the socket (or actor). 2156 // This method is similar to zsock_recv, except the arguments are encoded 2157 // in a binary format that is compatible with zproto, and is designed to 2158 // reduce memory allocations. The pattern argument is a string that defines 2159 // the type of each argument. See zsock_bsend for the supported argument 2160 // types. All arguments must be pointers; this call sets them to point to 2161 // values held on a per-socket basis. 2162 // For types 1, 2, 4 and 8 the caller must allocate the memory itself before 2163 // calling zsock_brecv. 2164 // For types S, the caller must free the value once finished with it, as 2165 // zsock_brecv will allocate the buffer. 2166 // For type s, the caller must not free the value as it is stored in a 2167 // local cache for performance purposes. 2168 // For types c, f, u and m the caller must call the appropriate destructor 2169 // depending on the object as zsock_brecv will create new objects. 2170 // For type p the caller must coordinate with the sender, as it is just a 2171 // pointer value being passed. 2172 function zsock_brecv(self: PZsock; Picture: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2173 2174 // Return socket routing ID if any. This returns 0 if the socket is not 2175 // of type ZMQ_SERVER or if no request was already received on it. zsock_routing_idnull2176 function zsock_routing_id(self: PZsock): Cardinal; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2177 2178 // Set routing ID on socket. The socket MUST be of type ZMQ_SERVER. 2179 // This will be used when sending messages on the socket via the zsock API. 2180 procedure zsock_set_routing_id(self: PZsock; RoutingId: Cardinal); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2181 2182 // Set socket to use unbounded pipes (HWM=0); use this in cases when you are 2183 // totally certain the message volume can fit in memory. This method works 2184 // across all versions of ZeroMQ. Takes a polymorphic socket reference. 2185 procedure zsock_set_unbounded(self: PZsock); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2186 2187 // Send a signal over a socket. A signal is a short message carrying a 2188 // success/failure code (by convention, 0 means OK). Signals are encoded 2189 // to be distinguishable from "normal" messages. Accepts a zsock_t or a 2190 // zactor_t argument, and returns 0 if successful, -1 if the signal could 2191 // not be sent. Takes a polymorphic socket reference. zsock_signalnull2192 function zsock_signal(self: PZsock; Status: Byte): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2193 2194 // Wait on a signal. Use this to coordinate between threads, over pipe 2195 // pairs. Blocks until the signal is received. Returns -1 on error, 0 or 2196 // greater on success. Accepts a zsock_t or a zactor_t as argument. 2197 // Takes a polymorphic socket reference. zsock_waitnull2198 function zsock_wait(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2199 2200 // If there is a partial message still waiting on the socket, remove and 2201 // discard it. This is useful when reading partial messages, to get specific 2202 // message types. 2203 procedure zsock_flush(self: PZsock); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2204 2205 // Join a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. 2206 // Returns 0 if OK, -1 if failed. zsock_joinnull2207 function zsock_join(self: PZsock; Group: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2208 2209 // Leave a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. 2210 // Returns 0 if OK, -1 if failed. zsock_leavenull2211 function zsock_leave(self: PZsock; Group: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2212 2213 // Probe the supplied object, and report if it looks like a zsock_t. 2214 // Takes a polymorphic socket reference. zsock_isnull2215 function zsock_is(This: Pointer): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2216 2217 // Probe the supplied reference. If it looks like a zsock_t instance, return 2218 // the underlying libzmq socket handle; else if it looks like a file 2219 // descriptor, return NULL; else if it looks like a libzmq socket handle, 2220 // return the supplied value. Takes a polymorphic socket reference. zsock_resolvenull2221 function zsock_resolve(This: Pointer): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2222 2223 // Check whether the socket has available message to read. zsock_has_innull2224 function zsock_has_in(self: PZsock): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2225 2226 // Get socket option `priority`. 2227 // Available from libzmq 4.3.0. zsock_prioritynull2228 function zsock_priority(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2229 2230 // Set socket option `priority`. 2231 // Available from libzmq 4.3.0. 2232 procedure zsock_set_priority(self: PZsock; Priority: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2233 2234 // Get socket option `reconnect_stop`. 2235 // Available from libzmq 4.3.0. zsock_reconnect_stopnull2236 function zsock_reconnect_stop(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2237 2238 // Set socket option `reconnect_stop`. 2239 // Available from libzmq 4.3.0. 2240 procedure zsock_set_reconnect_stop(self: PZsock; ReconnectStop: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2241 2242 // Set socket option `only_first_subscribe`. 2243 // Available from libzmq 4.3.0. 2244 procedure zsock_set_only_first_subscribe(self: PZsock; OnlyFirstSubscribe: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2245 2246 // Set socket option `hello_msg`. 2247 // Available from libzmq 4.3.0. 2248 procedure zsock_set_hello_msg(self: PZsock; HelloMsg: PZframe); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2249 2250 // Set socket option `disconnect_msg`. 2251 // Available from libzmq 4.3.0. 2252 procedure zsock_set_disconnect_msg(self: PZsock; DisconnectMsg: PZframe); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2253 2254 // Set socket option `wss_trust_system`. 2255 // Available from libzmq 4.3.0. 2256 procedure zsock_set_wss_trust_system(self: PZsock; WssTrustSystem: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2257 2258 // Set socket option `wss_hostname`. 2259 // Available from libzmq 4.3.0. 2260 procedure zsock_set_wss_hostname(self: PZsock; WssHostname: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2261 2262 // Set socket option `wss_trust_pem`. 2263 // Available from libzmq 4.3.0. 2264 procedure zsock_set_wss_trust_pem(self: PZsock; WssTrustPem: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2265 2266 // Set socket option `wss_cert_pem`. 2267 // Available from libzmq 4.3.0. 2268 procedure zsock_set_wss_cert_pem(self: PZsock; WssCertPem: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2269 2270 // Set socket option `wss_key_pem`. 2271 // Available from libzmq 4.3.0. 2272 procedure zsock_set_wss_key_pem(self: PZsock; WssKeyPem: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2273 2274 // Get socket option `out_batch_size`. 2275 // Available from libzmq 4.3.0. zsock_out_batch_sizenull2276 function zsock_out_batch_size(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2277 2278 // Set socket option `out_batch_size`. 2279 // Available from libzmq 4.3.0. 2280 procedure zsock_set_out_batch_size(self: PZsock; OutBatchSize: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2281 2282 // Get socket option `in_batch_size`. 2283 // Available from libzmq 4.3.0. zsock_in_batch_sizenull2284 function zsock_in_batch_size(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2285 2286 // Set socket option `in_batch_size`. 2287 // Available from libzmq 4.3.0. 2288 procedure zsock_set_in_batch_size(self: PZsock; InBatchSize: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2289 2290 // Get socket option `socks_password`. 2291 // Available from libzmq 4.3.0. zsock_socks_passwordnull2292 function zsock_socks_password(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2293 2294 // Set socket option `socks_password`. 2295 // Available from libzmq 4.3.0. 2296 procedure zsock_set_socks_password(self: PZsock; SocksPassword: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2297 2298 // Get socket option `socks_username`. 2299 // Available from libzmq 4.3.0. zsock_socks_usernamenull2300 function zsock_socks_username(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2301 2302 // Set socket option `socks_username`. 2303 // Available from libzmq 4.3.0. 2304 procedure zsock_set_socks_username(self: PZsock; SocksUsername: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2305 2306 // Set socket option `xpub_manual_last_value`. 2307 // Available from libzmq 4.3.0. 2308 procedure zsock_set_xpub_manual_last_value(self: PZsock; XpubManualLastValue: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2309 2310 // Get socket option `router_notify`. 2311 // Available from libzmq 4.3.0. zsock_router_notifynull2312 function zsock_router_notify(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2313 2314 // Set socket option `router_notify`. 2315 // Available from libzmq 4.3.0. 2316 procedure zsock_set_router_notify(self: PZsock; RouterNotify: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2317 2318 // Get socket option `multicast_loop`. 2319 // Available from libzmq 4.3.0. zsock_multicast_loopnull2320 function zsock_multicast_loop(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2321 2322 // Set socket option `multicast_loop`. 2323 // Available from libzmq 4.3.0. 2324 procedure zsock_set_multicast_loop(self: PZsock; MulticastLoop: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2325 2326 // Get socket option `metadata`. 2327 // Available from libzmq 4.3.0. zsock_metadatanull2328 function zsock_metadata(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2329 2330 // Set socket option `metadata`. 2331 // Available from libzmq 4.3.0. 2332 procedure zsock_set_metadata(self: PZsock; Metadata: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2333 2334 // Get socket option `loopback_fastpath`. 2335 // Available from libzmq 4.3.0. zsock_loopback_fastpathnull2336 function zsock_loopback_fastpath(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2337 2338 // Set socket option `loopback_fastpath`. 2339 // Available from libzmq 4.3.0. 2340 procedure zsock_set_loopback_fastpath(self: PZsock; LoopbackFastpath: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2341 2342 // Get socket option `zap_enforce_domain`. 2343 // Available from libzmq 4.3.0. zsock_zap_enforce_domainnull2344 function zsock_zap_enforce_domain(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2345 2346 // Set socket option `zap_enforce_domain`. 2347 // Available from libzmq 4.3.0. 2348 procedure zsock_set_zap_enforce_domain(self: PZsock; ZapEnforceDomain: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2349 2350 // Get socket option `gssapi_principal_nametype`. 2351 // Available from libzmq 4.3.0. zsock_gssapi_principal_nametypenull2352 function zsock_gssapi_principal_nametype(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2353 2354 // Set socket option `gssapi_principal_nametype`. 2355 // Available from libzmq 4.3.0. 2356 procedure zsock_set_gssapi_principal_nametype(self: PZsock; GssapiPrincipalNametype: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2357 2358 // Get socket option `gssapi_service_principal_nametype`. 2359 // Available from libzmq 4.3.0. zsock_gssapi_service_principal_nametypenull2360 function zsock_gssapi_service_principal_nametype(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2361 2362 // Set socket option `gssapi_service_principal_nametype`. 2363 // Available from libzmq 4.3.0. 2364 procedure zsock_set_gssapi_service_principal_nametype(self: PZsock; GssapiServicePrincipalNametype: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2365 2366 // Get socket option `bindtodevice`. 2367 // Available from libzmq 4.3.0. zsock_bindtodevicenull2368 function zsock_bindtodevice(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2369 2370 // Set socket option `bindtodevice`. 2371 // Available from libzmq 4.3.0. 2372 procedure zsock_set_bindtodevice(self: PZsock; Bindtodevice: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2373 2374 // Get socket option `heartbeat_ivl`. 2375 // Available from libzmq 4.2.0. zsock_heartbeat_ivlnull2376 function zsock_heartbeat_ivl(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2377 2378 // Set socket option `heartbeat_ivl`. 2379 // Available from libzmq 4.2.0. 2380 procedure zsock_set_heartbeat_ivl(self: PZsock; HeartbeatIvl: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2381 2382 // Get socket option `heartbeat_ttl`. 2383 // Available from libzmq 4.2.0. zsock_heartbeat_ttlnull2384 function zsock_heartbeat_ttl(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2385 2386 // Set socket option `heartbeat_ttl`. 2387 // Available from libzmq 4.2.0. 2388 procedure zsock_set_heartbeat_ttl(self: PZsock; HeartbeatTtl: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2389 2390 // Get socket option `heartbeat_timeout`. 2391 // Available from libzmq 4.2.0. zsock_heartbeat_timeoutnull2392 function zsock_heartbeat_timeout(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2393 2394 // Set socket option `heartbeat_timeout`. 2395 // Available from libzmq 4.2.0. 2396 procedure zsock_set_heartbeat_timeout(self: PZsock; HeartbeatTimeout: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2397 2398 // Get socket option `use_fd`. 2399 // Available from libzmq 4.2.0. zsock_use_fdnull2400 function zsock_use_fd(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2401 2402 // Set socket option `use_fd`. 2403 // Available from libzmq 4.2.0. 2404 procedure zsock_set_use_fd(self: PZsock; UseFd: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2405 2406 // Set socket option `xpub_manual`. 2407 // Available from libzmq 4.2.0. 2408 procedure zsock_set_xpub_manual(self: PZsock; XpubManual: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2409 2410 // Set socket option `xpub_welcome_msg`. 2411 // Available from libzmq 4.2.0. 2412 procedure zsock_set_xpub_welcome_msg(self: PZsock; XpubWelcomeMsg: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2413 2414 // Set socket option `stream_notify`. 2415 // Available from libzmq 4.2.0. 2416 procedure zsock_set_stream_notify(self: PZsock; StreamNotify: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2417 2418 // Get socket option `invert_matching`. 2419 // Available from libzmq 4.2.0. zsock_invert_matchingnull2420 function zsock_invert_matching(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2421 2422 // Set socket option `invert_matching`. 2423 // Available from libzmq 4.2.0. 2424 procedure zsock_set_invert_matching(self: PZsock; InvertMatching: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2425 2426 // Set socket option `xpub_verboser`. 2427 // Available from libzmq 4.2.0. 2428 procedure zsock_set_xpub_verboser(self: PZsock; XpubVerboser: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2429 2430 // Get socket option `connect_timeout`. 2431 // Available from libzmq 4.2.0. zsock_connect_timeoutnull2432 function zsock_connect_timeout(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2433 2434 // Set socket option `connect_timeout`. 2435 // Available from libzmq 4.2.0. 2436 procedure zsock_set_connect_timeout(self: PZsock; ConnectTimeout: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2437 2438 // Get socket option `tcp_maxrt`. 2439 // Available from libzmq 4.2.0. zsock_tcp_maxrtnull2440 function zsock_tcp_maxrt(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2441 2442 // Set socket option `tcp_maxrt`. 2443 // Available from libzmq 4.2.0. 2444 procedure zsock_set_tcp_maxrt(self: PZsock; TcpMaxrt: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2445 2446 // Get socket option `thread_safe`. 2447 // Available from libzmq 4.2.0. zsock_thread_safenull2448 function zsock_thread_safe(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2449 2450 // Get socket option `multicast_maxtpdu`. 2451 // Available from libzmq 4.2.0. zsock_multicast_maxtpdunull2452 function zsock_multicast_maxtpdu(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2453 2454 // Set socket option `multicast_maxtpdu`. 2455 // Available from libzmq 4.2.0. 2456 procedure zsock_set_multicast_maxtpdu(self: PZsock; MulticastMaxtpdu: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2457 2458 // Get socket option `vmci_buffer_size`. 2459 // Available from libzmq 4.2.0. zsock_vmci_buffer_sizenull2460 function zsock_vmci_buffer_size(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2461 2462 // Set socket option `vmci_buffer_size`. 2463 // Available from libzmq 4.2.0. 2464 procedure zsock_set_vmci_buffer_size(self: PZsock; VmciBufferSize: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2465 2466 // Get socket option `vmci_buffer_min_size`. 2467 // Available from libzmq 4.2.0. zsock_vmci_buffer_min_sizenull2468 function zsock_vmci_buffer_min_size(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2469 2470 // Set socket option `vmci_buffer_min_size`. 2471 // Available from libzmq 4.2.0. 2472 procedure zsock_set_vmci_buffer_min_size(self: PZsock; VmciBufferMinSize: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2473 2474 // Get socket option `vmci_buffer_max_size`. 2475 // Available from libzmq 4.2.0. zsock_vmci_buffer_max_sizenull2476 function zsock_vmci_buffer_max_size(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2477 2478 // Set socket option `vmci_buffer_max_size`. 2479 // Available from libzmq 4.2.0. 2480 procedure zsock_set_vmci_buffer_max_size(self: PZsock; VmciBufferMaxSize: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2481 2482 // Get socket option `vmci_connect_timeout`. 2483 // Available from libzmq 4.2.0. zsock_vmci_connect_timeoutnull2484 function zsock_vmci_connect_timeout(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2485 2486 // Set socket option `vmci_connect_timeout`. 2487 // Available from libzmq 4.2.0. 2488 procedure zsock_set_vmci_connect_timeout(self: PZsock; VmciConnectTimeout: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2489 2490 // Get socket option `tos`. 2491 // Available from libzmq 4.1.0. zsock_tosnull2492 function zsock_tos(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2493 2494 // Set socket option `tos`. 2495 // Available from libzmq 4.1.0. 2496 procedure zsock_set_tos(self: PZsock; Tos: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2497 2498 // Set socket option `router_handover`. 2499 // Available from libzmq 4.1.0. 2500 procedure zsock_set_router_handover(self: PZsock; RouterHandover: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2501 2502 // Set socket option `connect_rid`. 2503 // Available from libzmq 4.1.0. 2504 procedure zsock_set_connect_rid(self: PZsock; ConnectRid: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2505 2506 // Set socket option `connect_rid` from 32-octet binary 2507 // Available from libzmq 4.1.0. 2508 procedure zsock_set_connect_rid_bin(self: PZsock; ConnectRid: PByte); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2509 2510 // Get socket option `handshake_ivl`. 2511 // Available from libzmq 4.1.0. zsock_handshake_ivlnull2512 function zsock_handshake_ivl(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2513 2514 // Set socket option `handshake_ivl`. 2515 // Available from libzmq 4.1.0. 2516 procedure zsock_set_handshake_ivl(self: PZsock; HandshakeIvl: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2517 2518 // Get socket option `socks_proxy`. 2519 // Available from libzmq 4.1.0. zsock_socks_proxynull2520 function zsock_socks_proxy(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2521 2522 // Set socket option `socks_proxy`. 2523 // Available from libzmq 4.1.0. 2524 procedure zsock_set_socks_proxy(self: PZsock; SocksProxy: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2525 2526 // Set socket option `xpub_nodrop`. 2527 // Available from libzmq 4.1.0. 2528 procedure zsock_set_xpub_nodrop(self: PZsock; XpubNodrop: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2529 2530 // Set socket option `router_mandatory`. 2531 // Available from libzmq 4.0.0. 2532 procedure zsock_set_router_mandatory(self: PZsock; RouterMandatory: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2533 2534 // Set socket option `probe_router`. 2535 // Available from libzmq 4.0.0. 2536 procedure zsock_set_probe_router(self: PZsock; ProbeRouter: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2537 2538 // Set socket option `req_relaxed`. 2539 // Available from libzmq 4.0.0. 2540 procedure zsock_set_req_relaxed(self: PZsock; ReqRelaxed: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2541 2542 // Set socket option `req_correlate`. 2543 // Available from libzmq 4.0.0. 2544 procedure zsock_set_req_correlate(self: PZsock; ReqCorrelate: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2545 2546 // Set socket option `conflate`. 2547 // Available from libzmq 4.0.0. 2548 procedure zsock_set_conflate(self: PZsock; Conflate: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2549 2550 // Get socket option `zap_domain`. 2551 // Available from libzmq 4.0.0. zsock_zap_domainnull2552 function zsock_zap_domain(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2553 2554 // Set socket option `zap_domain`. 2555 // Available from libzmq 4.0.0. 2556 procedure zsock_set_zap_domain(self: PZsock; ZapDomain: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2557 2558 // Get socket option `mechanism`. 2559 // Available from libzmq 4.0.0. zsock_mechanismnull2560 function zsock_mechanism(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2561 2562 // Get socket option `plain_server`. 2563 // Available from libzmq 4.0.0. zsock_plain_servernull2564 function zsock_plain_server(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2565 2566 // Set socket option `plain_server`. 2567 // Available from libzmq 4.0.0. 2568 procedure zsock_set_plain_server(self: PZsock; PlainServer: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2569 2570 // Get socket option `plain_username`. 2571 // Available from libzmq 4.0.0. zsock_plain_usernamenull2572 function zsock_plain_username(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2573 2574 // Set socket option `plain_username`. 2575 // Available from libzmq 4.0.0. 2576 procedure zsock_set_plain_username(self: PZsock; PlainUsername: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2577 2578 // Get socket option `plain_password`. 2579 // Available from libzmq 4.0.0. zsock_plain_passwordnull2580 function zsock_plain_password(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2581 2582 // Set socket option `plain_password`. 2583 // Available from libzmq 4.0.0. 2584 procedure zsock_set_plain_password(self: PZsock; PlainPassword: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2585 2586 // Get socket option `curve_server`. 2587 // Available from libzmq 4.0.0. zsock_curve_servernull2588 function zsock_curve_server(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2589 2590 // Set socket option `curve_server`. 2591 // Available from libzmq 4.0.0. 2592 procedure zsock_set_curve_server(self: PZsock; CurveServer: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2593 2594 // Get socket option `curve_publickey`. 2595 // Available from libzmq 4.0.0. zsock_curve_publickeynull2596 function zsock_curve_publickey(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2597 2598 // Set socket option `curve_publickey`. 2599 // Available from libzmq 4.0.0. 2600 procedure zsock_set_curve_publickey(self: PZsock; CurvePublickey: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2601 2602 // Set socket option `curve_publickey` from 32-octet binary 2603 // Available from libzmq 4.0.0. 2604 procedure zsock_set_curve_publickey_bin(self: PZsock; CurvePublickey: PByte); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2605 2606 // Get socket option `curve_secretkey`. 2607 // Available from libzmq 4.0.0. zsock_curve_secretkeynull2608 function zsock_curve_secretkey(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2609 2610 // Set socket option `curve_secretkey`. 2611 // Available from libzmq 4.0.0. 2612 procedure zsock_set_curve_secretkey(self: PZsock; CurveSecretkey: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2613 2614 // Set socket option `curve_secretkey` from 32-octet binary 2615 // Available from libzmq 4.0.0. 2616 procedure zsock_set_curve_secretkey_bin(self: PZsock; CurveSecretkey: PByte); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2617 2618 // Get socket option `curve_serverkey`. 2619 // Available from libzmq 4.0.0. zsock_curve_serverkeynull2620 function zsock_curve_serverkey(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2621 2622 // Set socket option `curve_serverkey`. 2623 // Available from libzmq 4.0.0. 2624 procedure zsock_set_curve_serverkey(self: PZsock; CurveServerkey: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2625 2626 // Set socket option `curve_serverkey` from 32-octet binary 2627 // Available from libzmq 4.0.0. 2628 procedure zsock_set_curve_serverkey_bin(self: PZsock; CurveServerkey: PByte); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2629 2630 // Get socket option `gssapi_server`. 2631 // Available from libzmq 4.0.0. zsock_gssapi_servernull2632 function zsock_gssapi_server(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2633 2634 // Set socket option `gssapi_server`. 2635 // Available from libzmq 4.0.0. 2636 procedure zsock_set_gssapi_server(self: PZsock; GssapiServer: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2637 2638 // Get socket option `gssapi_plaintext`. 2639 // Available from libzmq 4.0.0. zsock_gssapi_plaintextnull2640 function zsock_gssapi_plaintext(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2641 2642 // Set socket option `gssapi_plaintext`. 2643 // Available from libzmq 4.0.0. 2644 procedure zsock_set_gssapi_plaintext(self: PZsock; GssapiPlaintext: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2645 2646 // Get socket option `gssapi_principal`. 2647 // Available from libzmq 4.0.0. zsock_gssapi_principalnull2648 function zsock_gssapi_principal(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2649 2650 // Set socket option `gssapi_principal`. 2651 // Available from libzmq 4.0.0. 2652 procedure zsock_set_gssapi_principal(self: PZsock; GssapiPrincipal: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2653 2654 // Get socket option `gssapi_service_principal`. 2655 // Available from libzmq 4.0.0. zsock_gssapi_service_principalnull2656 function zsock_gssapi_service_principal(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2657 2658 // Set socket option `gssapi_service_principal`. 2659 // Available from libzmq 4.0.0. 2660 procedure zsock_set_gssapi_service_principal(self: PZsock; GssapiServicePrincipal: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2661 2662 // Get socket option `ipv6`. 2663 // Available from libzmq 4.0.0. zsock_ipv6null2664 function zsock_ipv6(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2665 2666 // Set socket option `ipv6`. 2667 // Available from libzmq 4.0.0. 2668 procedure zsock_set_ipv6(self: PZsock; Ipv6: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2669 2670 // Get socket option `immediate`. 2671 // Available from libzmq 4.0.0. zsock_immediatenull2672 function zsock_immediate(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2673 2674 // Set socket option `immediate`. 2675 // Available from libzmq 4.0.0. 2676 procedure zsock_set_immediate(self: PZsock; Immediate: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2677 2678 // Get socket option `sndhwm`. 2679 // Available from libzmq 3.0.0. zsock_sndhwmnull2680 function zsock_sndhwm(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2681 2682 // Set socket option `sndhwm`. 2683 // Available from libzmq 3.0.0. 2684 procedure zsock_set_sndhwm(self: PZsock; Sndhwm: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2685 2686 // Get socket option `rcvhwm`. 2687 // Available from libzmq 3.0.0. zsock_rcvhwmnull2688 function zsock_rcvhwm(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2689 2690 // Set socket option `rcvhwm`. 2691 // Available from libzmq 3.0.0. 2692 procedure zsock_set_rcvhwm(self: PZsock; Rcvhwm: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2693 2694 // Get socket option `maxmsgsize`. 2695 // Available from libzmq 3.0.0. zsock_maxmsgsizenull2696 function zsock_maxmsgsize(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2697 2698 // Set socket option `maxmsgsize`. 2699 // Available from libzmq 3.0.0. 2700 procedure zsock_set_maxmsgsize(self: PZsock; Maxmsgsize: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2701 2702 // Get socket option `multicast_hops`. 2703 // Available from libzmq 3.0.0. zsock_multicast_hopsnull2704 function zsock_multicast_hops(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2705 2706 // Set socket option `multicast_hops`. 2707 // Available from libzmq 3.0.0. 2708 procedure zsock_set_multicast_hops(self: PZsock; MulticastHops: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2709 2710 // Set socket option `xpub_verbose`. 2711 // Available from libzmq 3.0.0. 2712 procedure zsock_set_xpub_verbose(self: PZsock; XpubVerbose: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2713 2714 // Get socket option `tcp_keepalive`. 2715 // Available from libzmq 3.0.0. zsock_tcp_keepalivenull2716 function zsock_tcp_keepalive(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2717 2718 // Set socket option `tcp_keepalive`. 2719 // Available from libzmq 3.0.0. 2720 procedure zsock_set_tcp_keepalive(self: PZsock; TcpKeepalive: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2721 2722 // Get socket option `tcp_keepalive_idle`. 2723 // Available from libzmq 3.0.0. zsock_tcp_keepalive_idlenull2724 function zsock_tcp_keepalive_idle(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2725 2726 // Set socket option `tcp_keepalive_idle`. 2727 // Available from libzmq 3.0.0. 2728 procedure zsock_set_tcp_keepalive_idle(self: PZsock; TcpKeepaliveIdle: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2729 2730 // Get socket option `tcp_keepalive_cnt`. 2731 // Available from libzmq 3.0.0. zsock_tcp_keepalive_cntnull2732 function zsock_tcp_keepalive_cnt(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2733 2734 // Set socket option `tcp_keepalive_cnt`. 2735 // Available from libzmq 3.0.0. 2736 procedure zsock_set_tcp_keepalive_cnt(self: PZsock; TcpKeepaliveCnt: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2737 2738 // Get socket option `tcp_keepalive_intvl`. 2739 // Available from libzmq 3.0.0. zsock_tcp_keepalive_intvlnull2740 function zsock_tcp_keepalive_intvl(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2741 2742 // Set socket option `tcp_keepalive_intvl`. 2743 // Available from libzmq 3.0.0. 2744 procedure zsock_set_tcp_keepalive_intvl(self: PZsock; TcpKeepaliveIntvl: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2745 2746 // Get socket option `tcp_accept_filter`. 2747 // Available from libzmq 3.0.0. zsock_tcp_accept_filternull2748 function zsock_tcp_accept_filter(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2749 2750 // Set socket option `tcp_accept_filter`. 2751 // Available from libzmq 3.0.0. 2752 procedure zsock_set_tcp_accept_filter(self: PZsock; TcpAcceptFilter: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2753 2754 // Get socket option `last_endpoint`. 2755 // Available from libzmq 3.0.0. zsock_last_endpointnull2756 function zsock_last_endpoint(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2757 2758 // Set socket option `router_raw`. 2759 // Available from libzmq 3.0.0. 2760 procedure zsock_set_router_raw(self: PZsock; RouterRaw: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2761 2762 // Get socket option `ipv4only`. 2763 // Available from libzmq 3.0.0. zsock_ipv4onlynull2764 function zsock_ipv4only(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2765 2766 // Set socket option `ipv4only`. 2767 // Available from libzmq 3.0.0. 2768 procedure zsock_set_ipv4only(self: PZsock; Ipv4only: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2769 2770 // Set socket option `delay_attach_on_connect`. 2771 // Available from libzmq 3.0.0. 2772 procedure zsock_set_delay_attach_on_connect(self: PZsock; DelayAttachOnConnect: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2773 2774 // Get socket option `hwm`. 2775 // Available from libzmq 2.0.0 to 3.0.0. zsock_hwmnull2776 function zsock_hwm(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2777 2778 // Set socket option `hwm`. 2779 // Available from libzmq 2.0.0 to 3.0.0. 2780 procedure zsock_set_hwm(self: PZsock; Hwm: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2781 2782 // Get socket option `swap`. 2783 // Available from libzmq 2.0.0 to 3.0.0. zsock_swapnull2784 function zsock_swap(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2785 2786 // Set socket option `swap`. 2787 // Available from libzmq 2.0.0 to 3.0.0. 2788 procedure zsock_set_swap(self: PZsock; Swap: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2789 2790 // Get socket option `affinity`. 2791 // Available from libzmq 2.0.0. zsock_affinitynull2792 function zsock_affinity(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2793 2794 // Set socket option `affinity`. 2795 // Available from libzmq 2.0.0. 2796 procedure zsock_set_affinity(self: PZsock; Affinity: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2797 2798 // Get socket option `identity`. 2799 // Available from libzmq 2.0.0. zsock_identitynull2800 function zsock_identity(self: PZsock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2801 2802 // Set socket option `identity`. 2803 // Available from libzmq 2.0.0. 2804 procedure zsock_set_identity(self: PZsock; Identity: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2805 2806 // Get socket option `rate`. 2807 // Available from libzmq 2.0.0. zsock_ratenull2808 function zsock_rate(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2809 2810 // Set socket option `rate`. 2811 // Available from libzmq 2.0.0. 2812 procedure zsock_set_rate(self: PZsock; Rate: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2813 2814 // Get socket option `recovery_ivl`. 2815 // Available from libzmq 2.0.0. zsock_recovery_ivlnull2816 function zsock_recovery_ivl(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2817 2818 // Set socket option `recovery_ivl`. 2819 // Available from libzmq 2.0.0. 2820 procedure zsock_set_recovery_ivl(self: PZsock; RecoveryIvl: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2821 2822 // Get socket option `recovery_ivl_msec`. 2823 // Available from libzmq 2.0.0 to 3.0.0. zsock_recovery_ivl_msecnull2824 function zsock_recovery_ivl_msec(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2825 2826 // Set socket option `recovery_ivl_msec`. 2827 // Available from libzmq 2.0.0 to 3.0.0. 2828 procedure zsock_set_recovery_ivl_msec(self: PZsock; RecoveryIvlMsec: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2829 2830 // Get socket option `mcast_loop`. 2831 // Available from libzmq 2.0.0 to 3.0.0. zsock_mcast_loopnull2832 function zsock_mcast_loop(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2833 2834 // Set socket option `mcast_loop`. 2835 // Available from libzmq 2.0.0 to 3.0.0. 2836 procedure zsock_set_mcast_loop(self: PZsock; McastLoop: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2837 2838 // Get socket option `rcvtimeo`. 2839 // Available from libzmq 2.2.0. zsock_rcvtimeonull2840 function zsock_rcvtimeo(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2841 2842 // Set socket option `rcvtimeo`. 2843 // Available from libzmq 2.2.0. 2844 procedure zsock_set_rcvtimeo(self: PZsock; Rcvtimeo: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2845 2846 // Get socket option `sndtimeo`. 2847 // Available from libzmq 2.2.0. zsock_sndtimeonull2848 function zsock_sndtimeo(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2849 2850 // Set socket option `sndtimeo`. 2851 // Available from libzmq 2.2.0. 2852 procedure zsock_set_sndtimeo(self: PZsock; Sndtimeo: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2853 2854 // Get socket option `sndbuf`. 2855 // Available from libzmq 2.0.0. zsock_sndbufnull2856 function zsock_sndbuf(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2857 2858 // Set socket option `sndbuf`. 2859 // Available from libzmq 2.0.0. 2860 procedure zsock_set_sndbuf(self: PZsock; Sndbuf: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2861 2862 // Get socket option `rcvbuf`. 2863 // Available from libzmq 2.0.0. zsock_rcvbufnull2864 function zsock_rcvbuf(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2865 2866 // Set socket option `rcvbuf`. 2867 // Available from libzmq 2.0.0. 2868 procedure zsock_set_rcvbuf(self: PZsock; Rcvbuf: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2869 2870 // Get socket option `linger`. 2871 // Available from libzmq 2.0.0. zsock_lingernull2872 function zsock_linger(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2873 2874 // Set socket option `linger`. 2875 // Available from libzmq 2.0.0. 2876 procedure zsock_set_linger(self: PZsock; Linger: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2877 2878 // Get socket option `reconnect_ivl`. 2879 // Available from libzmq 2.0.0. zsock_reconnect_ivlnull2880 function zsock_reconnect_ivl(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2881 2882 // Set socket option `reconnect_ivl`. 2883 // Available from libzmq 2.0.0. 2884 procedure zsock_set_reconnect_ivl(self: PZsock; ReconnectIvl: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2885 2886 // Get socket option `reconnect_ivl_max`. 2887 // Available from libzmq 2.0.0. zsock_reconnect_ivl_maxnull2888 function zsock_reconnect_ivl_max(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2889 2890 // Set socket option `reconnect_ivl_max`. 2891 // Available from libzmq 2.0.0. 2892 procedure zsock_set_reconnect_ivl_max(self: PZsock; ReconnectIvlMax: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2893 2894 // Get socket option `backlog`. 2895 // Available from libzmq 2.0.0. zsock_backlognull2896 function zsock_backlog(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2897 2898 // Set socket option `backlog`. 2899 // Available from libzmq 2.0.0. 2900 procedure zsock_set_backlog(self: PZsock; Backlog: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2901 2902 // Set socket option `subscribe`. 2903 // Available from libzmq 2.0.0. 2904 procedure zsock_set_subscribe(self: PZsock; Subscribe: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2905 2906 // Set socket option `unsubscribe`. 2907 // Available from libzmq 2.0.0. 2908 procedure zsock_set_unsubscribe(self: PZsock; Unsubscribe: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2909 2910 // Get socket option `type`. 2911 // Available from libzmq 2.0.0. zsock_typenull2912 function zsock_type(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2913 2914 // Get socket option `rcvmore`. 2915 // Available from libzmq 2.0.0. zsock_rcvmorenull2916 function zsock_rcvmore(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2917 2918 // Get socket option `fd`. 2919 // Available from libzmq 2.0.0. zsock_fdnull2920 function zsock_fd(self: PZsock): TSocket; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2921 2922 // Get socket option `events`. 2923 // Available from libzmq 2.0.0. zsock_eventsnull2924 function zsock_events(self: PZsock): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2925 2926 // Self test of this class. 2927 procedure zsock_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2928 2929 (* Zstr *) 2930 (* sending and receiving strings *) 2931 2932 // Receive C string from socket. Caller must free returned string using 2933 // zstr_free(). Returns NULL if the context is being terminated or the 2934 // process was interrupted. zstr_recvnull2935 function zstr_recv(Source: PZSock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2936 2937 // Receive a series of strings (until NULL) from multipart data. 2938 // Each string is allocated and filled with string data; if there 2939 // are not enough frames, unallocated strings are set to NULL. 2940 // Returns -1 if the message could not be read, else returns the 2941 // number of strings filled, zero or more. Free each returned string 2942 // using zstr_free(). If not enough strings are provided, remaining 2943 // multipart frames in the message are dropped. zstr_recvxnull2944 function zstr_recvx(Source: PZSock; var StringP: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2945 2946 // De-compress and receive C string from socket, received as a message 2947 // with two frames: size of the uncompressed string, and the string itself. 2948 // Caller must free returned string using zstr_free(). Returns NULL if the 2949 // context is being terminated or the process was interrupted. zstr_recv_compressnull2950 function zstr_recv_compress(Source: PZSock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2951 2952 // Send a C string to a socket, as a frame. The string is sent without 2953 // trailing null byte; to read this you can use zstr_recv, or a similar 2954 // method that adds a null terminator on the received string. String 2955 // may be NULL, which is sent as "". zstr_sendnull2956 function zstr_send(Dest: PZSock; &String: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2957 2958 // Send a C string to a socket, as zstr_send(), with a MORE flag, so that 2959 // you can send further strings in the same multi-part message. zstr_sendmnull2960 function zstr_sendm(Dest: PZSock; &String: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2961 2962 // Send a formatted string to a socket. Note that you should NOT use 2963 // user-supplied strings in the format (they may contain '%' which 2964 // will create security holes). zstr_sendfnull2965 function zstr_sendf(Dest: PZSock; Format: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2966 2967 // Send a formatted string to a socket, as for zstr_sendf(), with a 2968 // MORE flag, so that you can send further strings in the same multi-part 2969 // message. zstr_sendfmnull2970 function zstr_sendfm(Dest: PZSock; Format: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2971 2972 // Send a series of strings (until NULL) as multipart data 2973 // Returns 0 if the strings could be sent OK, or -1 on error. zstr_sendxnull2974 function zstr_sendx(Dest: PZSock; &String: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2975 2976 // Compress and send a C string to a socket, as a message with two frames: 2977 // size of the uncompressed string, and the string itself. The string is 2978 // sent without trailing null byte; to read this you can use 2979 // zstr_recv_compress, or a similar method that de-compresses and adds a 2980 // null terminator on the received string. zstr_send_compressnull2981 function zstr_send_compress(Dest: PZSock; &String: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2982 2983 // Compress and send a C string to a socket, as zstr_send_compress(), 2984 // with a MORE flag, so that you can send further strings in the same 2985 // multi-part message. zstr_sendm_compressnull2986 function zstr_sendm_compress(Dest: PZSock; &String: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2987 2988 // Accepts a void pointer and returns a fresh character string. If source 2989 // is null, returns an empty string. zstr_strnull2990 function zstr_str(Source: PZSock): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2991 2992 // Free a provided string, and nullify the parent pointer. Safe to call on 2993 // a null pointer. 2994 procedure zstr_free(var StringP: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2995 2996 // Self test of this class. 2997 procedure zstr_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 2998 2999 (* Zsys *) 3000 (* *) 3001 3002 type 3003 3004 // Callback for interrupt signal handler 3005 TZsysHandlerFn = procedure(SignalValue: Integer); stdcall; 3006 PZsysHandlerFn = ^TZsysHandlerFn; 3007 3008 // Initialize CZMQ zsys layer; this happens automatically when you create 3009 // a socket or an actor; however this call lets you force initialization 3010 // earlier, so e.g. logging is properly set-up before you start working. 3011 // Not threadsafe, so call only from main thread. Safe to call multiple 3012 // times. Returns global CZMQ context. zsys_initnull3013 function zsys_init: Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3014 3015 // Optionally shut down the CZMQ zsys layer; this normally happens automatically 3016 // when the process exits; however this call lets you force a shutdown 3017 // earlier, avoiding any potential problems with atexit() ordering, especially 3018 // with Windows dlls. 3019 procedure zsys_shutdown; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3020 3021 // Get a new ZMQ socket, automagically creating a ZMQ context if this is 3022 // the first time. Caller is responsible for destroying the ZMQ socket 3023 // before process exits, to avoid a ZMQ deadlock. Note: you should not use 3024 // this method in CZMQ apps, use zsock_new() instead. 3025 // *** This is for CZMQ internal use only and may change arbitrarily *** zsys_socketnull3026 function zsys_socket(&Type: Integer; Filename: PAnsiChar; LineNbr: NativeUInt): Pointer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3027 3028 // Destroy/close a ZMQ socket. You should call this for every socket you 3029 // create using zsys_socket(). 3030 // *** This is for CZMQ internal use only and may change arbitrarily *** zsys_closenull3031 function zsys_close(Handle: Pointer; Filename: PAnsiChar; LineNbr: NativeUInt): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3032 3033 // Return ZMQ socket name for socket type 3034 // *** This is for CZMQ internal use only and may change arbitrarily *** zsys_socknamenull3035 function zsys_sockname(Socktype: Integer): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3036 3037 // Create a pipe, which consists of two PAIR sockets connected over inproc. 3038 // The pipe is configured to use the zsys_pipehwm setting. Returns the 3039 // frontend socket successful, NULL if failed. zsys_create_pipenull3040 function zsys_create_pipe(var BackendP: PZsock): PZsock; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3041 3042 // Set interrupt handler; this saves the default handlers so that a 3043 // zsys_handler_reset () can restore them. If you call this multiple times 3044 // then the last handler will take affect. If handler_fn is NULL, disables 3045 // default SIGINT/SIGTERM handling in CZMQ. 3046 procedure zsys_handler_set(HandlerFn: PZsysHandlerFn); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3047 3048 // Reset interrupt handler, call this at exit if needed 3049 procedure zsys_handler_reset; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3050 3051 // Set default interrupt handler, so Ctrl-C or SIGTERM will set 3052 // zsys_interrupted. Idempotent; safe to call multiple times. 3053 // Can be suppressed by ZSYS_SIGHANDLER=false 3054 // *** This is for CZMQ internal use only and may change arbitrarily *** 3055 procedure zsys_catch_interrupts; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3056 3057 // Check if default interrupt handler of Ctrl-C or SIGTERM was called. 3058 // Does not work if ZSYS_SIGHANDLER is false and code does not call 3059 // set interrupted on signal. zsys_is_interruptednull3060 function zsys_is_interrupted: Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3061 3062 // Set interrupted flag. This is done by default signal handler, however 3063 // this can be handy for language bindings or cases without default 3064 // signal handler. 3065 procedure zsys_set_interrupted; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3066 3067 // Return 1 if file exists, else zero zsys_file_existsnull3068 function zsys_file_exists(Filename: PAnsiChar): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3069 3070 // Return file modification time. Returns 0 if the file does not exist. zsys_file_modifiednull3071 function zsys_file_modified(Filename: PAnsiChar): Int64; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3072 3073 // Return file mode; provides at least support for the POSIX S_ISREG(m) 3074 // and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes. 3075 // Returns a mode_t cast to int, or -1 in case of error. zsys_file_modenull3076 function zsys_file_mode(Filename: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3077 3078 // Delete file. Does not complain if the file is absent zsys_file_deletenull3079 function zsys_file_delete(Filename: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3080 3081 // Check if file is 'stable' zsys_file_stablenull3082 function zsys_file_stable(Filename: PAnsiChar): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3083 3084 // Create a file path if it doesn't exist. The file path is treated as 3085 // printf format. 3086 function zsys_dir_create(Pathname: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3087 3088 // Remove a file path if empty; the pathname is treated as printf format. 3089 function zsys_dir_delete(Pathname: PAnsiChar): Integer; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3090 3091 // Move to a specified working directory. Returns 0 if OK, -1 if this failed. 3092 function zsys_dir_change(Pathname: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3093 3094 // Set private file creation mode; all files created from here will be 3095 // readable/writable by the owner only. 3096 procedure zsys_file_mode_private; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3097 3098 // Reset default file creation mode; all files created from here will use 3099 // process file mode defaults. 3100 procedure zsys_file_mode_default; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3101 3102 // Return the CZMQ version for run-time API detection; returns version 3103 // number into provided fields, providing reference isn't null in each case. 3104 procedure zsys_version(var Major: Integer; var Minor: Integer; var Patch: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3105 3106 // Format a string using printf formatting, returning a freshly allocated 3107 // buffer. If there was insufficient memory, returns NULL. Free the returned 3108 // string using zstr_free(). The hinted version allows to optimize by using 3109 // a larger starting buffer size (known to/assumed by the developer) and so 3110 // avoid reallocations. zsys_sprintf_hintnull3111 function zsys_sprintf_hint(Hint: Integer; Format: PAnsiChar): PAnsiChar; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3112 3113 // Format a string using printf formatting, returning a freshly allocated 3114 // buffer. If there was insufficient memory, returns NULL. Free the returned 3115 // string using zstr_free(). zsys_sprintfnull3116 function zsys_sprintf(Format: PAnsiChar): PAnsiChar; cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3117 3118 // Format a string with a va_list argument, returning a freshly allocated 3119 // buffer. If there was insufficient memory, returns NULL. Free the returned 3120 // string using zstr_free(). zsys_vprintfnull3121 function zsys_vprintf(Format: PAnsiChar; Argptr: va_list): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3122 3123 // Create UDP beacon socket; if the routable option is true, uses 3124 // multicast (not yet implemented), else uses broadcast. This method 3125 // and related ones might _eventually_ be moved to a zudp class. 3126 // *** This is for CZMQ internal use only and may change arbitrarily *** zsys_udp_newnull3127 function zsys_udp_new(Routable: Boolean): TSocket; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3128 3129 // Close a UDP socket 3130 // *** This is for CZMQ internal use only and may change arbitrarily *** zsys_udp_closenull3131 function zsys_udp_close(Handle: TSocket): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3132 3133 // Send zframe to UDP socket, return -1 if sending failed due to 3134 // interface having disappeared (happens easily with WiFi) 3135 // *** This is for CZMQ internal use only and may change arbitrarily *** zsys_udp_sendnull3136 function zsys_udp_send(Udpsock: TSocket; Frame: PZframe; Address: Pointer; Addrlen: Integer): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3137 3138 // Receive zframe from UDP socket, and set address of peer that sent it 3139 // The peername must be a char [INET_ADDRSTRLEN] array if IPv6 is disabled or 3140 // NI_MAXHOST if it's enabled. Returns NULL when failing to get peer address. 3141 // *** This is for CZMQ internal use only and may change arbitrarily *** 3142 function zsys_udp_recv(Udpsock: TSocket; Peername: PAnsiChar; Peerlen: Integer): PZframe; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3143 3144 // Handle an I/O error on some socket operation; will report and die on 3145 // fatal errors, and continue silently on "try again" errors. 3146 // *** This is for CZMQ internal use only and may change arbitrarily *** 3147 procedure zsys_socket_error(Reason: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3148 3149 // Return current host name, for use in public tcp:// endpoints. Caller gets 3150 // a freshly allocated string, should free it using zstr_free(). If the host 3151 // name is not resolvable, returns NULL. 3152 function zsys_hostname: PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3153 3154 // Move the current process into the background. The precise effect depends 3155 // on the operating system. On POSIX boxes, moves to a specified working 3156 // directory (if specified), closes all file handles, reopens stdin, stdout, 3157 // and stderr to the null device, and sets the process to ignore SIGHUP. On 3158 // Windows, does nothing. Returns 0 if OK, -1 if there was an error. 3159 function zsys_daemonize(Workdir: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3160 3161 // Drop the process ID into the lockfile, with exclusive lock, and switch 3162 // the process to the specified group and/or user. Any of the arguments 3163 // may be null, indicating a no-op. Returns 0 on success, -1 on failure. 3164 // Note if you combine this with zsys_daemonize, run after, not before 3165 // that method, or the lockfile will hold the wrong process ID. 3166 function zsys_run_as(Lockfile: PAnsiChar; Group: PAnsiChar; User: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3167 3168 // Returns true if the underlying libzmq supports CURVE security. 3169 // Uses a heuristic probe according to the version of libzmq being used. 3170 function zsys_has_curve: Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3171 3172 // Configure the number of I/O threads that ZeroMQ will use. A good 3173 // rule of thumb is one thread per gigabit of traffic in or out. The 3174 // default is 1, sufficient for most applications. If the environment 3175 // variable ZSYS_IO_THREADS is defined, that provides the default. 3176 // Note that this method is valid only before any socket is created. 3177 procedure zsys_set_io_threads(IoThreads: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3178 3179 // Configure the scheduling policy of the ZMQ context thread pool. 3180 // Not available on Windows. See the sched_setscheduler man page or sched.h 3181 // for more information. If the environment variable ZSYS_THREAD_SCHED_POLICY 3182 // is defined, that provides the default. 3183 // Note that this method is valid only before any socket is created. 3184 procedure zsys_set_thread_sched_policy(Policy: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3185 3186 // Configure the scheduling priority of the ZMQ context thread pool. 3187 // Not available on Windows. See the sched_setscheduler man page or sched.h 3188 // for more information. If the environment variable ZSYS_THREAD_PRIORITY is 3189 // defined, that provides the default. 3190 // Note that this method is valid only before any socket is created. 3191 procedure zsys_set_thread_priority(Priority: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3192 3193 // Configure the numeric prefix to each thread created for the internal 3194 // context's thread pool. This option is only supported on Linux. 3195 // If the environment variable ZSYS_THREAD_NAME_PREFIX is defined, that 3196 // provides the default. 3197 // Note that this method is valid only before any socket is created. 3198 procedure zsys_set_thread_name_prefix(Prefix: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3199 3200 // Return thread name prefix. zsys_thread_name_prefixnull3201 function zsys_thread_name_prefix: Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3202 3203 // Configure the numeric prefix to each thread created for the internal 3204 // context's thread pool. This option is only supported on Linux. 3205 // If the environment variable ZSYS_THREAD_NAME_PREFIX_STR is defined, that 3206 // provides the default. 3207 // Note that this method is valid only before any socket is created. 3208 procedure zsys_set_thread_name_prefix_str(Prefix: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3209 3210 // Return thread name prefix. 3211 function zsys_thread_name_prefix_str: PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3212 3213 // Adds a specific CPU to the affinity list of the ZMQ context thread pool. 3214 // This option is only supported on Linux. 3215 // Note that this method is valid only before any socket is created. 3216 procedure zsys_thread_affinity_cpu_add(Cpu: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3217 3218 // Removes a specific CPU to the affinity list of the ZMQ context thread pool. 3219 // This option is only supported on Linux. 3220 // Note that this method is valid only before any socket is created. 3221 procedure zsys_thread_affinity_cpu_remove(Cpu: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3222 3223 // Configure the number of sockets that ZeroMQ will allow. The default 3224 // is 1024. The actual limit depends on the system, and you can query it 3225 // by using zsys_socket_limit (). A value of zero means "maximum". 3226 // Note that this method is valid only before any socket is created. 3227 procedure zsys_set_max_sockets(MaxSockets: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3228 3229 // Return maximum number of ZeroMQ sockets that the system will support. 3230 function zsys_socket_limit: NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3231 3232 // Configure the maximum allowed size of a message sent. 3233 // The default is INT_MAX. 3234 procedure zsys_set_max_msgsz(MaxMsgsz: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3235 3236 // Return maximum message size. 3237 function zsys_max_msgsz: Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3238 3239 // Configure whether to use zero copy strategy in libzmq. If the environment 3240 // variable ZSYS_ZERO_COPY_RECV is defined, that provides the default. 3241 // Otherwise the default is 1. 3242 procedure zsys_set_zero_copy_recv(ZeroCopy: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3243 3244 // Return ZMQ_ZERO_COPY_RECV option. 3245 function zsys_zero_copy_recv: Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3246 3247 // Configure the threshold value of filesystem object age per st_mtime 3248 // that should elapse until we consider that object "stable" at the 3249 // current zclock_time() moment. 3250 // The default is S_DEFAULT_ZSYS_FILE_STABLE_AGE_MSEC defined in zsys.c 3251 // which generally depends on host OS, with fallback value of 5000. 3252 procedure zsys_set_file_stable_age_msec(FileStableAgeMsec: Int64); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3253 3254 // Return current threshold value of file stable age in msec. 3255 // This can be used in code that chooses to wait for this timeout 3256 // before testing if a filesystem object is "stable" or not. 3257 function zsys_file_stable_age_msec: Int64; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3258 3259 // Configure the default linger timeout in msecs for new zsock instances. 3260 // You can also set this separately on each zsock_t instance. The default 3261 // linger time is zero, i.e. any pending messages will be dropped. If the 3262 // environment variable ZSYS_LINGER is defined, that provides the default. 3263 // Note that process exit will typically be delayed by the linger time. 3264 procedure zsys_set_linger(Linger: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3265 3266 // Configure the default outgoing pipe limit (HWM) for new zsock instances. 3267 // You can also set this separately on each zsock_t instance. The default 3268 // HWM is 1,000, on all versions of ZeroMQ. If the environment variable 3269 // ZSYS_SNDHWM is defined, that provides the default. Note that a value of 3270 // zero means no limit, i.e. infinite memory consumption. 3271 procedure zsys_set_sndhwm(Sndhwm: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3272 3273 // Configure the default incoming pipe limit (HWM) for new zsock instances. 3274 // You can also set this separately on each zsock_t instance. The default 3275 // HWM is 1,000, on all versions of ZeroMQ. If the environment variable 3276 // ZSYS_RCVHWM is defined, that provides the default. Note that a value of 3277 // zero means no limit, i.e. infinite memory consumption. 3278 procedure zsys_set_rcvhwm(Rcvhwm: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3279 3280 // Configure the default HWM for zactor internal pipes; this is set on both 3281 // ends of the pipe, for outgoing messages only (sndhwm). The default HWM is 3282 // 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is 3283 // defined, that provides the default. Note that a value of zero means no 3284 // limit, i.e. infinite memory consumption. 3285 procedure zsys_set_pipehwm(Pipehwm: NativeUInt); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3286 3287 // Return the HWM for zactor internal pipes. 3288 function zsys_pipehwm: NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3289 3290 // Configure use of IPv6 for new zsock instances. By default sockets accept 3291 // and make only IPv4 connections. When you enable IPv6, sockets will accept 3292 // and connect to both IPv4 and IPv6 peers. You can override the setting on 3293 // each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the 3294 // environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the 3295 // default. Note: has no effect on ZMQ v2. 3296 procedure zsys_set_ipv6(Ipv6: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3297 3298 // Return use of IPv6 for zsock instances. 3299 function zsys_ipv6: Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3300 3301 // Test if ipv6 is available on the system. Return true if available. 3302 // The only way to reliably check is to actually open a socket and 3303 // try to bind it. (ported from libzmq) 3304 function zsys_ipv6_available: Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3305 3306 // Set network interface name to use for broadcasts, particularly zbeacon. 3307 // This lets the interface be configured for test environments where required. 3308 // For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is 3309 // the default when there is no specified interface. If the environment 3310 // variable ZSYS_INTERFACE is set, use that as the default interface name. 3311 // Setting the interface to "*" means "use all available interfaces". 3312 procedure zsys_set_interface(Value: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3313 3314 // Return network interface to use for broadcasts, or "" if none was set. 3315 function zsys_interface: PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3316 3317 // Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon. 3318 // This needs to be set IPv6 is enabled as IPv6 can have multiple addresses 3319 // on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set, 3320 // use that as the default IPv6 address. 3321 procedure zsys_set_ipv6_address(Value: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3322 3323 // Return IPv6 address to use for zbeacon reception, or "" if none was set. 3324 function zsys_ipv6_address: PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3325 3326 // Set IPv6 milticast address to use for sending zbeacon messages. This needs 3327 // to be set if IPv6 is enabled. If the environment variable 3328 // ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast 3329 // address. 3330 procedure zsys_set_ipv6_mcast_address(Value: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3331 3332 // Return IPv6 multicast address to use for sending zbeacon, or "" if none was 3333 // set. 3334 function zsys_ipv6_mcast_address: PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3335 3336 // Set IPv4 multicast address to use for sending zbeacon messages. By default 3337 // IPv4 multicast is NOT used. If the environment variable 3338 // ZSYS_IPV4_MCAST_ADDRESS is set, use that as the default IPv4 multicast 3339 // address. Calling this function or setting ZSYS_IPV4_MCAST_ADDRESS 3340 // will enable IPv4 zbeacon messages. 3341 procedure zsys_set_ipv4_mcast_address(Value: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3342 3343 // Return IPv4 multicast address to use for sending zbeacon, or NULL if none was 3344 // set. 3345 function zsys_ipv4_mcast_address: PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3346 3347 // Set multicast TTL default is 1 3348 procedure zsys_set_mcast_ttl(Value: Byte); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3349 3350 // Get multicast TTL 3351 function zsys_mcast_ttl: Byte; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3352 3353 // Configure the automatic use of pre-allocated FDs when creating new sockets. 3354 // If 0 (default), nothing will happen. Else, when a new socket is bound, the 3355 // system API will be used to check if an existing pre-allocated FD with a 3356 // matching port (if TCP) or path (if IPC) exists, and if it does it will be 3357 // set via the ZMQ_USE_FD socket option so that the library will use it 3358 // instead of creating a new socket. 3359 procedure zsys_set_auto_use_fd(AutoUseFd: Integer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3360 3361 // Return use of automatic pre-allocated FDs for zsock instances. 3362 function zsys_auto_use_fd: Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3363 3364 // Print formatted string. Format is specified by variable names 3365 // in Python-like format style 3366 // 3367 // "%(KEY)s=%(VALUE)s", KEY=key, VALUE=value 3368 // become 3369 // "key=value" 3370 // 3371 // Returns freshly allocated string or NULL in a case of error. 3372 // Not enough memory, invalid format specifier, name not in args 3373 function zsys_zprintf(Format: PAnsiChar; Args: PZhash): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3374 3375 // Return error string for given format/args combination. 3376 function zsys_zprintf_error(Format: PAnsiChar; Args: PZhash): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3377 3378 // Print formatted string. Format is specified by variable names 3379 // in Python-like format style 3380 // 3381 // "%(KEY)s=%(VALUE)s", KEY=key, VALUE=value 3382 // become 3383 // "key=value" 3384 // 3385 // Returns freshly allocated string or NULL in a case of error. 3386 // Not enough memory, invalid format specifier, name not in args 3387 function zsys_zplprintf(Format: PAnsiChar; Args: PZconfig): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3388 3389 // Return error string for given format/args combination. 3390 function zsys_zplprintf_error(Format: PAnsiChar; Args: PZconfig): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3391 3392 // Set log identity, which is a string that prefixes all log messages sent 3393 // by this process. The log identity defaults to the environment variable 3394 // ZSYS_LOGIDENT, if that is set. 3395 procedure zsys_set_logident(Value: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3396 3397 // Set stream to receive log traffic. By default, log traffic is sent to 3398 // stdout. If you set the stream to NULL, no stream will receive the log 3399 // traffic (it may still be sent to the system facility). 3400 procedure zsys_set_logstream(Stream: Pointer); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3401 3402 // Sends log output to a PUB socket bound to the specified endpoint. To 3403 // collect such log output, create a SUB socket, subscribe to the traffic 3404 // you care about, and connect to the endpoint. Log traffic is sent as a 3405 // single string frame, in the same format as when sent to stdout. The 3406 // log system supports a single sender; multiple calls to this method will 3407 // bind the same sender to multiple endpoints. To disable the sender, call 3408 // this method with a null argument. 3409 procedure zsys_set_logsender(Endpoint: PAnsiChar); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3410 3411 // Enable or disable logging to the system facility (syslog on POSIX boxes, 3412 // event log on Windows). By default this is disabled. 3413 procedure zsys_set_logsystem(Logsystem: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3414 3415 // Log error condition - highest priority 3416 procedure zsys_error(Format: PAnsiChar); cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3417 3418 // Log warning condition - high priority 3419 procedure zsys_warning(Format: PAnsiChar); cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3420 3421 // Log normal, but significant, condition - normal priority 3422 procedure zsys_notice(Format: PAnsiChar); cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3423 3424 // Log informational message - low priority 3425 procedure zsys_info(Format: PAnsiChar); cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3426 3427 // Log debug-level message - lowest priority 3428 procedure zsys_debug(Format: PAnsiChar); cdecl; varargs; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3429 3430 // Self test of this class. 3431 procedure zsys_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3432 3433 (* Zuuid *) 3434 (* UUID support class *) 3435 3436 // Create a new UUID object. 3437 function zuuid_new: PZuuid; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3438 3439 // Create UUID object from supplied ZUUID_LEN-octet value. 3440 function zuuid_new_from(Source: PByte): PZuuid; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3441 3442 // Destroy a specified UUID object. 3443 procedure zuuid_destroy(var self: PZuuid); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3444 3445 // Set UUID to new supplied ZUUID_LEN-octet value. 3446 procedure zuuid_set(self: PZuuid; Source: PByte); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3447 3448 // Set UUID to new supplied string value skipping '-' and '{' '}' 3449 // optional delimiters. Return 0 if OK, else returns -1. 3450 function zuuid_set_str(self: PZuuid; Source: PAnsiChar): Integer; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3451 3452 // Return UUID binary data. 3453 function zuuid_data(self: PZuuid): PByte; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3454 3455 // Return UUID binary size 3456 function zuuid_size(self: PZuuid): NativeUInt; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3457 3458 // Returns UUID as string 3459 function zuuid_str(self: PZuuid): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3460 3461 // Return UUID in the canonical string format: 8-4-4-4-12, in lower 3462 // case. Caller does not modify or free returned value. See 3463 // http://en.wikipedia.org/wiki/Universally_unique_identifier 3464 function zuuid_str_canonical(self: PZuuid): PAnsiChar; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3465 3466 // Store UUID blob in target array 3467 procedure zuuid_export(self: PZuuid; Target: PByte); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3468 3469 // Check if UUID is same as supplied value 3470 function zuuid_eq(self: PZuuid; Compare: PByte): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3471 3472 // Check if UUID is different from supplied value 3473 function zuuid_neq(self: PZuuid; Compare: PByte): Boolean; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3474 3475 // Make copy of UUID object; if uuid is null, or memory was exhausted, 3476 // returns null. 3477 function zuuid_dup(self: PZuuid): PZuuid; cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3478 3479 // Self test of this class. 3480 procedure zuuid_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3481 3482 (* Zauth *) 3483 (* *) 3484 3485 // Self test of this class. 3486 procedure zauth_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3487 3488 (* Zbeacon *) 3489 (* *) 3490 3491 // Self test of this class. 3492 procedure zbeacon_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3493 3494 (* Zgossip *) 3495 (* *) 3496 3497 // Self test of this class. 3498 procedure zgossip_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3499 3500 (* Zmonitor *) 3501 (* *) 3502 3503 // Self test of this class. 3504 procedure zmonitor_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3505 3506 (* Zproxy *) 3507 (* *) 3508 3509 // Self test of this class. 3510 procedure zproxy_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3511 3512 (* Zrex *) 3513 (* *) 3514 3515 // Self test of this class. 3516 procedure zrex_test(Verbose: Boolean); cdecl; external lib_czmq {$IFDEF MSWINDOWS}delayed{$ENDIF}; 3517 implementation 3518 end. 3519