czmq-ffi-gen 0.9.1-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/AUTHORS +1 -0
- data/CHANGES.md +88 -0
- data/Gemfile +2 -0
- data/LICENSE +14 -0
- data/README.md +112 -0
- data/lib/czmq-ffi-gen.rb +7 -0
- data/lib/czmq-ffi-gen/czmq/ffi.rb +1210 -0
- data/lib/czmq-ffi-gen/czmq/ffi/version.rb +15 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zactor.rb +186 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zarmour.rb +286 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zcert.rb +307 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zcertstore.rb +222 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +388 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zclock.rb +140 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +442 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zdigest.rb +156 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zdir.rb +283 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb +194 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +353 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +359 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhash.rb +416 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhashx.rb +659 -0
- data/lib/czmq-ffi-gen/czmq/ffi/ziflist.rb +189 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zlist.rb +365 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +478 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zloop.rb +396 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zmsg.rb +515 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +194 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +294 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +3479 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zstr.rb +203 -0
- data/lib/czmq-ffi-gen/czmq/ffi/ztimerset.rb +203 -0
- data/lib/czmq-ffi-gen/czmq/ffi/ztrie.rb +221 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zuuid.rb +227 -0
- data/lib/czmq-ffi-gen/errors.rb +12 -0
- data/lib/czmq-ffi-gen/gem_version.rb +5 -0
- data/lib/czmq-ffi-gen/legacy.rb +16 -0
- data/lib/czmq-ffi-gen/libzmq.rb +18 -0
- data/lib/czmq-ffi-gen/signals.rb +27 -0
- data/lib/czmq-ffi-gen/vendor.rb +5 -0
- data/lib/czmq-ffi-gen/versions.rb +19 -0
- data/vendor/local/bin/inproc_lat.exe +0 -0
- data/vendor/local/bin/inproc_thr.exe +0 -0
- data/vendor/local/bin/libczmq.dll +0 -0
- data/vendor/local/bin/libgcc_s_sjlj-1.dll +0 -0
- data/vendor/local/bin/libstdc++-6.dll +0 -0
- data/vendor/local/bin/libzmq.dll +0 -0
- data/vendor/local/bin/local_lat.exe +0 -0
- data/vendor/local/bin/local_thr.exe +0 -0
- data/vendor/local/bin/remote_lat.exe +0 -0
- data/vendor/local/bin/remote_thr.exe +0 -0
- data/vendor/local/include/czmq.h +31 -0
- data/vendor/local/include/czmq_library.h +199 -0
- data/vendor/local/include/czmq_prelude.h +641 -0
- data/vendor/local/include/readme.txt +83 -0
- data/vendor/local/include/sha1.h +76 -0
- data/vendor/local/include/sha1.inc_c +335 -0
- data/vendor/local/include/slre.h +92 -0
- data/vendor/local/include/slre.inc_c +660 -0
- data/vendor/local/include/zactor.h +76 -0
- data/vendor/local/include/zarmour.h +114 -0
- data/vendor/local/include/zauth.h +100 -0
- data/vendor/local/include/zauth_v2.h +88 -0
- data/vendor/local/include/zbeacon.h +86 -0
- data/vendor/local/include/zbeacon_v2.h +75 -0
- data/vendor/local/include/zcert.h +136 -0
- data/vendor/local/include/zcertstore.h +100 -0
- data/vendor/local/include/zchunk.h +163 -0
- data/vendor/local/include/zclock.h +73 -0
- data/vendor/local/include/zconfig.h +185 -0
- data/vendor/local/include/zctx.h +107 -0
- data/vendor/local/include/zdigest.h +65 -0
- data/vendor/local/include/zdir.h +149 -0
- data/vendor/local/include/zdir_patch.h +82 -0
- data/vendor/local/include/zfile.h +177 -0
- data/vendor/local/include/zframe.h +176 -0
- data/vendor/local/include/zgossip.h +95 -0
- data/vendor/local/include/zgossip_engine.inc +927 -0
- data/vendor/local/include/zgossip_msg.h +129 -0
- data/vendor/local/include/zhash.h +195 -0
- data/vendor/local/include/zhash_primes.inc +329 -0
- data/vendor/local/include/zhashx.h +298 -0
- data/vendor/local/include/ziflist.h +77 -0
- data/vendor/local/include/zlist.h +158 -0
- data/vendor/local/include/zlistx.h +205 -0
- data/vendor/local/include/zloop.h +168 -0
- data/vendor/local/include/zmonitor.h +73 -0
- data/vendor/local/include/zmonitor_v2.h +56 -0
- data/vendor/local/include/zmq.h +617 -0
- data/vendor/local/include/zmq_utils.h +48 -0
- data/vendor/local/include/zmsg.h +280 -0
- data/vendor/local/include/zmutex.h +55 -0
- data/vendor/local/include/zpoller.h +92 -0
- data/vendor/local/include/zproc.h +168 -0
- data/vendor/local/include/zproxy.h +111 -0
- data/vendor/local/include/zproxy_v2.h +62 -0
- data/vendor/local/include/zrex.h +82 -0
- data/vendor/local/include/zsock.h +912 -0
- data/vendor/local/include/zsock_option.inc +4126 -0
- data/vendor/local/include/zsocket.h +110 -0
- data/vendor/local/include/zsockopt.h +256 -0
- data/vendor/local/include/zstr.h +110 -0
- data/vendor/local/include/zsys.h +386 -0
- data/vendor/local/include/zthread.h +50 -0
- data/vendor/local/include/ztimerset.h +90 -0
- data/vendor/local/include/ztrie.h +106 -0
- data/vendor/local/include/zuuid.h +96 -0
- data/vendor/local/lib/libczmq.dll.a +0 -0
- data/vendor/local/lib/liblibzmq.dll.a +0 -0
- data/vendor/local/lib/libzmq-static.a +0 -0
- data/vendor/local/lib/pkgconfig/libczmq.pc +23 -0
- data/vendor/local/lib/pkgconfig/libzmq.pc +11 -0
- data/vendor/local/share/zmq/AUTHORS.txt +147 -0
- data/vendor/local/share/zmq/COPYING.LESSER.txt +181 -0
- data/vendor/local/share/zmq/COPYING.txt +674 -0
- data/vendor/local/share/zmq/NEWS.txt +978 -0
- metadata +230 -0
@@ -0,0 +1,75 @@
|
|
1
|
+
/* =========================================================================
|
2
|
+
zbeacon - LAN discovery and presence (deprecated)
|
3
|
+
|
4
|
+
Copyright (c) the Contributors as noted in the AUTHORS file.
|
5
|
+
This file is part of CZMQ, the high-level C binding for 0MQ:
|
6
|
+
http://czmq.zeromq.org.
|
7
|
+
|
8
|
+
This Source Code Form is subject to the terms of the Mozilla Public
|
9
|
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
10
|
+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
11
|
+
=========================================================================
|
12
|
+
*/
|
13
|
+
|
14
|
+
#ifndef __ZBEACON_V2_H_INCLUDED__
|
15
|
+
#define __ZBEACON_V2_H_INCLUDED__
|
16
|
+
|
17
|
+
#ifdef __cplusplus
|
18
|
+
extern "C" {
|
19
|
+
#endif
|
20
|
+
|
21
|
+
// @interface
|
22
|
+
// Create a new beacon on a certain UDP port. If the system does not
|
23
|
+
// support UDP broadcasts (lacking a useful interface), returns NULL.
|
24
|
+
// To force the beacon to operate on a given port, set the environment
|
25
|
+
// variable ZSYS_INTERFACE, or call zsys_set_interface() beforehand.
|
26
|
+
// If you are using the new zsock API then pass NULL as the ctx here.
|
27
|
+
CZMQ_EXPORT zbeacon_t *
|
28
|
+
zbeacon_new (zctx_t *ctx, int port_nbr);
|
29
|
+
|
30
|
+
// Destroy a beacon
|
31
|
+
CZMQ_EXPORT void
|
32
|
+
zbeacon_destroy (zbeacon_t **self_p);
|
33
|
+
|
34
|
+
// Return our own IP address as printable string
|
35
|
+
CZMQ_EXPORT char *
|
36
|
+
zbeacon_hostname (zbeacon_t *self);
|
37
|
+
|
38
|
+
// Set broadcast interval in milliseconds (default is 1000 msec)
|
39
|
+
CZMQ_EXPORT void
|
40
|
+
zbeacon_set_interval (zbeacon_t *self, int interval);
|
41
|
+
|
42
|
+
// Filter out any beacon that looks exactly like ours
|
43
|
+
CZMQ_EXPORT void
|
44
|
+
zbeacon_noecho (zbeacon_t *self);
|
45
|
+
|
46
|
+
// Start broadcasting beacon to peers at the specified interval
|
47
|
+
CZMQ_EXPORT void
|
48
|
+
zbeacon_publish (zbeacon_t *self, byte *transmit, size_t size);
|
49
|
+
|
50
|
+
// Stop broadcasting beacons
|
51
|
+
CZMQ_EXPORT void
|
52
|
+
zbeacon_silence (zbeacon_t *self);
|
53
|
+
|
54
|
+
// Start listening to other peers; zero-sized filter means get everything
|
55
|
+
CZMQ_EXPORT void
|
56
|
+
zbeacon_subscribe (zbeacon_t *self, byte *filter, size_t size);
|
57
|
+
|
58
|
+
// Stop listening to other peers
|
59
|
+
CZMQ_EXPORT void
|
60
|
+
zbeacon_unsubscribe (zbeacon_t *self);
|
61
|
+
|
62
|
+
// Get beacon ZeroMQ socket, for polling or receiving messages
|
63
|
+
CZMQ_EXPORT void *
|
64
|
+
zbeacon_socket (zbeacon_t *self);
|
65
|
+
|
66
|
+
// Self test of this class
|
67
|
+
CZMQ_EXPORT void
|
68
|
+
zbeacon_v2_test (bool verbose);
|
69
|
+
// @end
|
70
|
+
|
71
|
+
#ifdef __cplusplus
|
72
|
+
}
|
73
|
+
#endif
|
74
|
+
|
75
|
+
#endif
|
@@ -0,0 +1,136 @@
|
|
1
|
+
/* =========================================================================
|
2
|
+
zcert - work with CURVE security certificates
|
3
|
+
|
4
|
+
Copyright (c) the Contributors as noted in the AUTHORS file.
|
5
|
+
This file is part of CZMQ, the high-level C binding for 0MQ:
|
6
|
+
http://czmq.zeromq.org.
|
7
|
+
|
8
|
+
This Source Code Form is subject to the terms of the Mozilla Public
|
9
|
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
10
|
+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
11
|
+
=========================================================================
|
12
|
+
*/
|
13
|
+
|
14
|
+
#ifndef __ZCERT_H_INCLUDED__
|
15
|
+
#define __ZCERT_H_INCLUDED__
|
16
|
+
|
17
|
+
#ifdef __cplusplus
|
18
|
+
extern "C" {
|
19
|
+
#endif
|
20
|
+
|
21
|
+
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
22
|
+
// @warning Please edit the model at "api/zcert.api" to make changes.
|
23
|
+
// @interface
|
24
|
+
// This is a stable class, and may not change except for emergencies. It
|
25
|
+
// is provided in stable builds.
|
26
|
+
// This class has draft methods, which may change over time. They are not
|
27
|
+
// in stable releases, by default. Use --enable-drafts to enable.
|
28
|
+
// This class has legacy methods, which will be removed over time. You
|
29
|
+
// should not use them, and migrate any code that is still using them.
|
30
|
+
// Create and initialize a new certificate in memory
|
31
|
+
CZMQ_EXPORT zcert_t *
|
32
|
+
zcert_new (void);
|
33
|
+
|
34
|
+
// Accepts public/secret key pair from caller
|
35
|
+
CZMQ_EXPORT zcert_t *
|
36
|
+
zcert_new_from (const byte *public_key, const byte *secret_key);
|
37
|
+
|
38
|
+
// Load certificate from file
|
39
|
+
CZMQ_EXPORT zcert_t *
|
40
|
+
zcert_load (const char *filename);
|
41
|
+
|
42
|
+
// Destroy a certificate in memory
|
43
|
+
CZMQ_EXPORT void
|
44
|
+
zcert_destroy (zcert_t **self_p);
|
45
|
+
|
46
|
+
// Return public part of key pair as 32-byte binary string
|
47
|
+
CZMQ_EXPORT const byte *
|
48
|
+
zcert_public_key (zcert_t *self);
|
49
|
+
|
50
|
+
// Return secret part of key pair as 32-byte binary string
|
51
|
+
CZMQ_EXPORT const byte *
|
52
|
+
zcert_secret_key (zcert_t *self);
|
53
|
+
|
54
|
+
// Return public part of key pair as Z85 armored string
|
55
|
+
CZMQ_EXPORT const char *
|
56
|
+
zcert_public_txt (zcert_t *self);
|
57
|
+
|
58
|
+
// Return secret part of key pair as Z85 armored string
|
59
|
+
CZMQ_EXPORT const char *
|
60
|
+
zcert_secret_txt (zcert_t *self);
|
61
|
+
|
62
|
+
// Set certificate metadata from formatted string.
|
63
|
+
CZMQ_EXPORT void
|
64
|
+
zcert_set_meta (zcert_t *self, const char *name, const char *format, ...) CHECK_PRINTF (3);
|
65
|
+
|
66
|
+
// Get metadata value from certificate; if the metadata value doesn't
|
67
|
+
// exist, returns NULL.
|
68
|
+
CZMQ_EXPORT const char *
|
69
|
+
zcert_meta (zcert_t *self, const char *name);
|
70
|
+
|
71
|
+
// Get list of metadata fields from certificate. Caller is responsible for
|
72
|
+
// destroying list. Caller should not modify the values of list items.
|
73
|
+
CZMQ_EXPORT zlist_t *
|
74
|
+
zcert_meta_keys (zcert_t *self);
|
75
|
+
|
76
|
+
// Save full certificate (public + secret) to file for persistent storage
|
77
|
+
// This creates one public file and one secret file (filename + "_secret").
|
78
|
+
CZMQ_EXPORT int
|
79
|
+
zcert_save (zcert_t *self, const char *filename);
|
80
|
+
|
81
|
+
// Save public certificate only to file for persistent storage
|
82
|
+
CZMQ_EXPORT int
|
83
|
+
zcert_save_public (zcert_t *self, const char *filename);
|
84
|
+
|
85
|
+
// Save secret certificate only to file for persistent storage
|
86
|
+
CZMQ_EXPORT int
|
87
|
+
zcert_save_secret (zcert_t *self, const char *filename);
|
88
|
+
|
89
|
+
// Apply certificate to socket, i.e. use for CURVE security on socket.
|
90
|
+
// If certificate was loaded from public file, the secret key will be
|
91
|
+
// undefined, and this certificate will not work successfully.
|
92
|
+
CZMQ_EXPORT void
|
93
|
+
zcert_apply (zcert_t *self, void *socket);
|
94
|
+
|
95
|
+
// Return copy of certificate; if certificate is NULL or we exhausted
|
96
|
+
// heap memory, returns NULL.
|
97
|
+
// Caller owns return value and must destroy it when done.
|
98
|
+
CZMQ_EXPORT zcert_t *
|
99
|
+
zcert_dup (zcert_t *self);
|
100
|
+
|
101
|
+
// Return true if two certificates have the same keys
|
102
|
+
CZMQ_EXPORT bool
|
103
|
+
zcert_eq (zcert_t *self, zcert_t *compare);
|
104
|
+
|
105
|
+
// Print certificate contents to stdout
|
106
|
+
CZMQ_EXPORT void
|
107
|
+
zcert_print (zcert_t *self);
|
108
|
+
|
109
|
+
// *** Deprecated method, slated for removal: avoid using it ***
|
110
|
+
// Print certificate contents to open stream. This method is deprecated
|
111
|
+
// and you should use the print method.
|
112
|
+
CZMQ_EXPORT void
|
113
|
+
zcert_fprint (zcert_t *self, FILE *file);
|
114
|
+
|
115
|
+
// Self test of this class
|
116
|
+
CZMQ_EXPORT void
|
117
|
+
zcert_test (bool verbose);
|
118
|
+
|
119
|
+
#ifdef CZMQ_BUILD_DRAFT_API
|
120
|
+
// *** Draft method, for development use, may change without warning ***
|
121
|
+
// Unset certificate metadata.
|
122
|
+
CZMQ_EXPORT void
|
123
|
+
zcert_unset_meta (zcert_t *self, const char *name);
|
124
|
+
|
125
|
+
#endif // CZMQ_BUILD_DRAFT_API
|
126
|
+
// @end
|
127
|
+
|
128
|
+
|
129
|
+
#ifdef __cplusplus
|
130
|
+
}
|
131
|
+
#endif
|
132
|
+
|
133
|
+
// Deprecated method aliases
|
134
|
+
#define zcert_dump(s) zcert_print(s)
|
135
|
+
|
136
|
+
#endif
|
@@ -0,0 +1,100 @@
|
|
1
|
+
/* =========================================================================
|
2
|
+
zcertstore - work with CURVE security certificate stores
|
3
|
+
|
4
|
+
Copyright (c) the Contributors as noted in the AUTHORS file.
|
5
|
+
This file is part of CZMQ, the high-level C binding for 0MQ:
|
6
|
+
http://czmq.zeromq.org.
|
7
|
+
|
8
|
+
This Source Code Form is subject to the terms of the Mozilla Public
|
9
|
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
10
|
+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
11
|
+
=========================================================================
|
12
|
+
*/
|
13
|
+
|
14
|
+
#ifndef __ZCERTSTORE_H_INCLUDED__
|
15
|
+
#define __ZCERTSTORE_H_INCLUDED__
|
16
|
+
|
17
|
+
#ifdef __cplusplus
|
18
|
+
extern "C" {
|
19
|
+
#endif
|
20
|
+
|
21
|
+
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
22
|
+
// @warning Please edit the model at "api/zcertstore.api" to make changes.
|
23
|
+
// @interface
|
24
|
+
// This is a stable class, and may not change except for emergencies. It
|
25
|
+
// is provided in stable builds.
|
26
|
+
// This class has draft methods, which may change over time. They are not
|
27
|
+
// in stable releases, by default. Use --enable-drafts to enable.
|
28
|
+
// This class has legacy methods, which will be removed over time. You
|
29
|
+
// should not use them, and migrate any code that is still using them.
|
30
|
+
// Create a new certificate store from a disk directory, loading and
|
31
|
+
// indexing all certificates in that location. The directory itself may be
|
32
|
+
// absent, and created later, or modified at any time. The certificate store
|
33
|
+
// is automatically refreshed on any zcertstore_lookup() call. If the
|
34
|
+
// location is specified as NULL, creates a pure-memory store, which you
|
35
|
+
// can work with by inserting certificates at runtime.
|
36
|
+
CZMQ_EXPORT zcertstore_t *
|
37
|
+
zcertstore_new (const char *location);
|
38
|
+
|
39
|
+
// Destroy a certificate store object in memory. Does not affect anything
|
40
|
+
// stored on disk.
|
41
|
+
CZMQ_EXPORT void
|
42
|
+
zcertstore_destroy (zcertstore_t **self_p);
|
43
|
+
|
44
|
+
// Look up certificate by public key, returns zcert_t object if found,
|
45
|
+
// else returns NULL. The public key is provided in Z85 text format.
|
46
|
+
CZMQ_EXPORT zcert_t *
|
47
|
+
zcertstore_lookup (zcertstore_t *self, const char *public_key);
|
48
|
+
|
49
|
+
// Insert certificate into certificate store in memory. Note that this
|
50
|
+
// does not save the certificate to disk. To do that, use zcert_save()
|
51
|
+
// directly on the certificate. Takes ownership of zcert_t object.
|
52
|
+
CZMQ_EXPORT void
|
53
|
+
zcertstore_insert (zcertstore_t *self, zcert_t **cert_p);
|
54
|
+
|
55
|
+
// Print list of certificates in store to logging facility
|
56
|
+
CZMQ_EXPORT void
|
57
|
+
zcertstore_print (zcertstore_t *self);
|
58
|
+
|
59
|
+
// *** Deprecated method, slated for removal: avoid using it ***
|
60
|
+
// Print list of certificates in store to open stream. This method is
|
61
|
+
// deprecated, and you should use the print method.
|
62
|
+
CZMQ_EXPORT void
|
63
|
+
zcertstore_fprint (zcertstore_t *self, FILE *file);
|
64
|
+
|
65
|
+
// Self test of this class
|
66
|
+
CZMQ_EXPORT void
|
67
|
+
zcertstore_test (bool verbose);
|
68
|
+
|
69
|
+
#ifdef CZMQ_BUILD_DRAFT_API
|
70
|
+
// Loaders retrieve certificates from an arbitrary source.
|
71
|
+
typedef void (zcertstore_loader) (
|
72
|
+
zcertstore_t *self);
|
73
|
+
|
74
|
+
// Destructor for loader state.
|
75
|
+
typedef void (zcertstore_destructor) (
|
76
|
+
void **self_p);
|
77
|
+
|
78
|
+
// *** Draft method, for development use, may change without warning ***
|
79
|
+
// Override the default disk loader with a custom loader fn.
|
80
|
+
CZMQ_EXPORT void
|
81
|
+
zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state);
|
82
|
+
|
83
|
+
// *** Draft method, for development use, may change without warning ***
|
84
|
+
// Empty certificate hashtable. This wrapper exists to be friendly to bindings,
|
85
|
+
// which don't usually have access to struct internals.
|
86
|
+
CZMQ_EXPORT void
|
87
|
+
zcertstore_empty (zcertstore_t *self);
|
88
|
+
|
89
|
+
#endif // CZMQ_BUILD_DRAFT_API
|
90
|
+
// @end
|
91
|
+
|
92
|
+
|
93
|
+
#ifdef __cplusplus
|
94
|
+
}
|
95
|
+
#endif
|
96
|
+
|
97
|
+
// Deprecated method aliases
|
98
|
+
#define zcertstore_dump(s) zcertstore_print(s)
|
99
|
+
|
100
|
+
#endif
|
@@ -0,0 +1,163 @@
|
|
1
|
+
/* =========================================================================
|
2
|
+
zchunk - work with memory chunks
|
3
|
+
|
4
|
+
Copyright (c) the Contributors as noted in the AUTHORS file.
|
5
|
+
This file is part of CZMQ, the high-level C binding for 0MQ:
|
6
|
+
http://czmq.zeromq.org.
|
7
|
+
|
8
|
+
This Source Code Form is subject to the terms of the Mozilla Public
|
9
|
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
10
|
+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
11
|
+
=========================================================================
|
12
|
+
*/
|
13
|
+
|
14
|
+
#ifndef __ZCHUNK_H_INCLUDED__
|
15
|
+
#define __ZCHUNK_H_INCLUDED__
|
16
|
+
|
17
|
+
#ifdef __cplusplus
|
18
|
+
extern "C" {
|
19
|
+
#endif
|
20
|
+
|
21
|
+
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
22
|
+
// @warning Please edit the model at "api/zchunk.api" to make changes.
|
23
|
+
// @interface
|
24
|
+
// This is a stable class, and may not change except for emergencies. It
|
25
|
+
// is provided in stable builds.
|
26
|
+
// Create a new chunk of the specified size. If you specify the data, it
|
27
|
+
// is copied into the chunk. If you do not specify the data, the chunk is
|
28
|
+
// allocated and left empty, and you can then add data using zchunk_append.
|
29
|
+
CZMQ_EXPORT zchunk_t *
|
30
|
+
zchunk_new (const void *data, size_t size);
|
31
|
+
|
32
|
+
// Destroy a chunk
|
33
|
+
CZMQ_EXPORT void
|
34
|
+
zchunk_destroy (zchunk_t **self_p);
|
35
|
+
|
36
|
+
// Resizes chunk max_size as requested; chunk_cur size is set to zero
|
37
|
+
CZMQ_EXPORT void
|
38
|
+
zchunk_resize (zchunk_t *self, size_t size);
|
39
|
+
|
40
|
+
// Return chunk cur size
|
41
|
+
CZMQ_EXPORT size_t
|
42
|
+
zchunk_size (zchunk_t *self);
|
43
|
+
|
44
|
+
// Return chunk max size
|
45
|
+
CZMQ_EXPORT size_t
|
46
|
+
zchunk_max_size (zchunk_t *self);
|
47
|
+
|
48
|
+
// Return chunk data
|
49
|
+
CZMQ_EXPORT byte *
|
50
|
+
zchunk_data (zchunk_t *self);
|
51
|
+
|
52
|
+
// Set chunk data from user-supplied data; truncate if too large. Data may
|
53
|
+
// be null. Returns actual size of chunk
|
54
|
+
CZMQ_EXPORT size_t
|
55
|
+
zchunk_set (zchunk_t *self, const void *data, size_t size);
|
56
|
+
|
57
|
+
// Fill chunk data from user-supplied octet
|
58
|
+
CZMQ_EXPORT size_t
|
59
|
+
zchunk_fill (zchunk_t *self, byte filler, size_t size);
|
60
|
+
|
61
|
+
// Append user-supplied data to chunk, return resulting chunk size. If the
|
62
|
+
// data would exceeded the available space, it is truncated. If you want to
|
63
|
+
// grow the chunk to accommodate new data, use the zchunk_extend method.
|
64
|
+
CZMQ_EXPORT size_t
|
65
|
+
zchunk_append (zchunk_t *self, const void *data, size_t size);
|
66
|
+
|
67
|
+
// Append user-supplied data to chunk, return resulting chunk size. If the
|
68
|
+
// data would exceeded the available space, the chunk grows in size.
|
69
|
+
CZMQ_EXPORT size_t
|
70
|
+
zchunk_extend (zchunk_t *self, const void *data, size_t size);
|
71
|
+
|
72
|
+
// Copy as much data from 'source' into the chunk as possible; returns the
|
73
|
+
// new size of chunk. If all data from 'source' is used, returns exhausted
|
74
|
+
// on the source chunk. Source can be consumed as many times as needed until
|
75
|
+
// it is exhausted. If source was already exhausted, does not change chunk.
|
76
|
+
CZMQ_EXPORT size_t
|
77
|
+
zchunk_consume (zchunk_t *self, zchunk_t *source);
|
78
|
+
|
79
|
+
// Returns true if the chunk was exhausted by consume methods, or if the
|
80
|
+
// chunk has a size of zero.
|
81
|
+
CZMQ_EXPORT bool
|
82
|
+
zchunk_exhausted (zchunk_t *self);
|
83
|
+
|
84
|
+
// Read chunk from an open file descriptor
|
85
|
+
// Caller owns return value and must destroy it when done.
|
86
|
+
CZMQ_EXPORT zchunk_t *
|
87
|
+
zchunk_read (FILE *handle, size_t bytes);
|
88
|
+
|
89
|
+
// Write chunk to an open file descriptor
|
90
|
+
CZMQ_EXPORT int
|
91
|
+
zchunk_write (zchunk_t *self, FILE *handle);
|
92
|
+
|
93
|
+
// Try to slurp an entire file into a chunk. Will read up to maxsize of
|
94
|
+
// the file. If maxsize is 0, will attempt to read the entire file and
|
95
|
+
// fail with an assertion if that cannot fit into memory. Returns a new
|
96
|
+
// chunk containing the file data, or NULL if the file could not be read.
|
97
|
+
// Caller owns return value and must destroy it when done.
|
98
|
+
CZMQ_EXPORT zchunk_t *
|
99
|
+
zchunk_slurp (const char *filename, size_t maxsize);
|
100
|
+
|
101
|
+
// Create copy of chunk, as new chunk object. Returns a fresh zchunk_t
|
102
|
+
// object, or null if there was not enough heap memory. If chunk is null,
|
103
|
+
// returns null.
|
104
|
+
// Caller owns return value and must destroy it when done.
|
105
|
+
CZMQ_EXPORT zchunk_t *
|
106
|
+
zchunk_dup (zchunk_t *self);
|
107
|
+
|
108
|
+
// Return chunk data encoded as printable hex string. Caller must free
|
109
|
+
// string when finished with it.
|
110
|
+
// Caller owns return value and must destroy it when done.
|
111
|
+
CZMQ_EXPORT char *
|
112
|
+
zchunk_strhex (zchunk_t *self);
|
113
|
+
|
114
|
+
// Return chunk data copied into freshly allocated string
|
115
|
+
// Caller must free string when finished with it.
|
116
|
+
// Caller owns return value and must destroy it when done.
|
117
|
+
CZMQ_EXPORT char *
|
118
|
+
zchunk_strdup (zchunk_t *self);
|
119
|
+
|
120
|
+
// Return TRUE if chunk body is equal to string, excluding terminator
|
121
|
+
CZMQ_EXPORT bool
|
122
|
+
zchunk_streq (zchunk_t *self, const char *string);
|
123
|
+
|
124
|
+
// Transform zchunk into a zframe that can be sent in a message.
|
125
|
+
// Caller owns return value and must destroy it when done.
|
126
|
+
CZMQ_EXPORT zframe_t *
|
127
|
+
zchunk_pack (zchunk_t *self);
|
128
|
+
|
129
|
+
// Transform a zframe into a zchunk.
|
130
|
+
// Caller owns return value and must destroy it when done.
|
131
|
+
CZMQ_EXPORT zchunk_t *
|
132
|
+
zchunk_unpack (zframe_t *frame);
|
133
|
+
|
134
|
+
// Calculate SHA1 digest for chunk, using zdigest class.
|
135
|
+
CZMQ_EXPORT const char *
|
136
|
+
zchunk_digest (zchunk_t *self);
|
137
|
+
|
138
|
+
// Dump chunk to FILE stream, for debugging and tracing.
|
139
|
+
CZMQ_EXPORT void
|
140
|
+
zchunk_fprint (zchunk_t *self, FILE *file);
|
141
|
+
|
142
|
+
// Dump message to stderr, for debugging and tracing.
|
143
|
+
// See zchunk_fprint for details
|
144
|
+
CZMQ_EXPORT void
|
145
|
+
zchunk_print (zchunk_t *self);
|
146
|
+
|
147
|
+
// Probe the supplied object, and report if it looks like a zchunk_t.
|
148
|
+
CZMQ_EXPORT bool
|
149
|
+
zchunk_is (void *self);
|
150
|
+
|
151
|
+
// Self test of this class.
|
152
|
+
CZMQ_EXPORT void
|
153
|
+
zchunk_test (bool verbose);
|
154
|
+
|
155
|
+
// @end
|
156
|
+
|
157
|
+
|
158
|
+
#ifdef __cplusplus
|
159
|
+
}
|
160
|
+
#endif
|
161
|
+
|
162
|
+
#endif
|
163
|
+
|