czmq-ffi-gen 0.9.2-x64-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 +92 -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_seh-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,298 @@
|
|
1
|
+
/* =========================================================================
|
2
|
+
zhashx - extended generic type-free hash container
|
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 __ZHASHX_H_INCLUDED__
|
15
|
+
#define __ZHASHX_H_INCLUDED__
|
16
|
+
|
17
|
+
#ifdef __cplusplus
|
18
|
+
extern "C" {
|
19
|
+
#endif
|
20
|
+
|
21
|
+
|
22
|
+
// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
|
23
|
+
// @warning Please edit the model at "api/zhashx.api" to make changes.
|
24
|
+
// @interface
|
25
|
+
// This is a stable class, and may not change except for emergencies. It
|
26
|
+
// is provided in stable builds.
|
27
|
+
// This class has draft methods, which may change over time. They are not
|
28
|
+
// in stable releases, by default. Use --enable-drafts to enable.
|
29
|
+
// This class has legacy methods, which will be removed over time. You
|
30
|
+
// should not use them, and migrate any code that is still using them.
|
31
|
+
// Destroy an item
|
32
|
+
typedef void (zhashx_destructor_fn) (
|
33
|
+
void **item);
|
34
|
+
|
35
|
+
// Duplicate an item
|
36
|
+
typedef void * (zhashx_duplicator_fn) (
|
37
|
+
const void *item);
|
38
|
+
|
39
|
+
// Compare two items, for sorting
|
40
|
+
typedef int (zhashx_comparator_fn) (
|
41
|
+
const void *item1, const void *item2);
|
42
|
+
|
43
|
+
// compare two items, for sorting
|
44
|
+
typedef void (zhashx_free_fn) (
|
45
|
+
void *data);
|
46
|
+
|
47
|
+
// compare two items, for sorting
|
48
|
+
typedef size_t (zhashx_hash_fn) (
|
49
|
+
const void *key);
|
50
|
+
|
51
|
+
// Serializes an item to a longstr.
|
52
|
+
// The caller takes ownership of the newly created object.
|
53
|
+
typedef char * (zhashx_serializer_fn) (
|
54
|
+
const void *item);
|
55
|
+
|
56
|
+
// Deserializes a longstr into an item.
|
57
|
+
// The caller takes ownership of the newly created object.
|
58
|
+
typedef void * (zhashx_deserializer_fn) (
|
59
|
+
const char *item_str);
|
60
|
+
|
61
|
+
// Callback function for zhashx_foreach method.
|
62
|
+
// This callback is deprecated and you should use zhashx_first/_next instead.
|
63
|
+
typedef int (zhashx_foreach_fn) (
|
64
|
+
const char *key, void *item, void *argument);
|
65
|
+
|
66
|
+
// Create a new, empty hash container
|
67
|
+
CZMQ_EXPORT zhashx_t *
|
68
|
+
zhashx_new (void);
|
69
|
+
|
70
|
+
// Unpack binary frame into a new hash table. Packed data must follow format
|
71
|
+
// defined by zhashx_pack. Hash table is set to autofree. An empty frame
|
72
|
+
// unpacks to an empty hash table.
|
73
|
+
CZMQ_EXPORT zhashx_t *
|
74
|
+
zhashx_unpack (zframe_t *frame);
|
75
|
+
|
76
|
+
// Destroy a hash container and all items in it
|
77
|
+
CZMQ_EXPORT void
|
78
|
+
zhashx_destroy (zhashx_t **self_p);
|
79
|
+
|
80
|
+
// Insert item into hash table with specified key and item.
|
81
|
+
// If key is already present returns -1 and leaves existing item unchanged
|
82
|
+
// Returns 0 on success.
|
83
|
+
CZMQ_EXPORT int
|
84
|
+
zhashx_insert (zhashx_t *self, const void *key, void *item);
|
85
|
+
|
86
|
+
// Update or insert item into hash table with specified key and item. If the
|
87
|
+
// key is already present, destroys old item and inserts new one. If you set
|
88
|
+
// a container item destructor, this is called on the old value. If the key
|
89
|
+
// was not already present, inserts a new item. Sets the hash cursor to the
|
90
|
+
// new item.
|
91
|
+
CZMQ_EXPORT void
|
92
|
+
zhashx_update (zhashx_t *self, const void *key, void *item);
|
93
|
+
|
94
|
+
// Remove an item specified by key from the hash table. If there was no such
|
95
|
+
// item, this function does nothing.
|
96
|
+
CZMQ_EXPORT void
|
97
|
+
zhashx_delete (zhashx_t *self, const void *key);
|
98
|
+
|
99
|
+
// Delete all items from the hash table. If the key destructor is
|
100
|
+
// set, calls it on every key. If the item destructor is set, calls
|
101
|
+
// it on every item.
|
102
|
+
CZMQ_EXPORT void
|
103
|
+
zhashx_purge (zhashx_t *self);
|
104
|
+
|
105
|
+
// Return the item at the specified key, or null
|
106
|
+
CZMQ_EXPORT void *
|
107
|
+
zhashx_lookup (zhashx_t *self, const void *key);
|
108
|
+
|
109
|
+
// Reindexes an item from an old key to a new key. If there was no such
|
110
|
+
// item, does nothing. Returns 0 if successful, else -1.
|
111
|
+
CZMQ_EXPORT int
|
112
|
+
zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key);
|
113
|
+
|
114
|
+
// Set a free function for the specified hash table item. When the item is
|
115
|
+
// destroyed, the free function, if any, is called on that item.
|
116
|
+
// Use this when hash items are dynamically allocated, to ensure that
|
117
|
+
// you don't have memory leaks. You can pass 'free' or NULL as a free_fn.
|
118
|
+
// Returns the item, or NULL if there is no such item.
|
119
|
+
CZMQ_EXPORT void *
|
120
|
+
zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn);
|
121
|
+
|
122
|
+
// Return the number of keys/items in the hash table
|
123
|
+
CZMQ_EXPORT size_t
|
124
|
+
zhashx_size (zhashx_t *self);
|
125
|
+
|
126
|
+
// Return a zlistx_t containing the keys for the items in the
|
127
|
+
// table. Uses the key_duplicator to duplicate all keys and sets the
|
128
|
+
// key_destructor as destructor for the list.
|
129
|
+
// Caller owns return value and must destroy it when done.
|
130
|
+
CZMQ_EXPORT zlistx_t *
|
131
|
+
zhashx_keys (zhashx_t *self);
|
132
|
+
|
133
|
+
// Return a zlistx_t containing the values for the items in the
|
134
|
+
// table. Uses the duplicator to duplicate all items and sets the
|
135
|
+
// destructor as destructor for the list.
|
136
|
+
// Caller owns return value and must destroy it when done.
|
137
|
+
CZMQ_EXPORT zlistx_t *
|
138
|
+
zhashx_values (zhashx_t *self);
|
139
|
+
|
140
|
+
// Simple iterator; returns first item in hash table, in no given order,
|
141
|
+
// or NULL if the table is empty. This method is simpler to use than the
|
142
|
+
// foreach() method, which is deprecated. To access the key for this item
|
143
|
+
// use zhashx_cursor(). NOTE: do NOT modify the table while iterating.
|
144
|
+
CZMQ_EXPORT void *
|
145
|
+
zhashx_first (zhashx_t *self);
|
146
|
+
|
147
|
+
// Simple iterator; returns next item in hash table, in no given order,
|
148
|
+
// or NULL if the last item was already returned. Use this together with
|
149
|
+
// zhashx_first() to process all items in a hash table. If you need the
|
150
|
+
// items in sorted order, use zhashx_keys() and then zlistx_sort(). To
|
151
|
+
// access the key for this item use zhashx_cursor(). NOTE: do NOT modify
|
152
|
+
// the table while iterating.
|
153
|
+
CZMQ_EXPORT void *
|
154
|
+
zhashx_next (zhashx_t *self);
|
155
|
+
|
156
|
+
// After a successful first/next method, returns the key for the item that
|
157
|
+
// was returned. This is a constant string that you may not modify or
|
158
|
+
// deallocate, and which lasts as long as the item in the hash. After an
|
159
|
+
// unsuccessful first/next, returns NULL.
|
160
|
+
CZMQ_EXPORT const void *
|
161
|
+
zhashx_cursor (zhashx_t *self);
|
162
|
+
|
163
|
+
// Add a comment to hash table before saving to disk. You can add as many
|
164
|
+
// comment lines as you like. These comment lines are discarded when loading
|
165
|
+
// the file. If you use a null format, all comments are deleted.
|
166
|
+
CZMQ_EXPORT void
|
167
|
+
zhashx_comment (zhashx_t *self, const char *format, ...) CHECK_PRINTF (2);
|
168
|
+
|
169
|
+
// Save hash table to a text file in name=value format. Hash values must be
|
170
|
+
// printable strings; keys may not contain '=' character. Returns 0 if OK,
|
171
|
+
// else -1 if a file error occurred.
|
172
|
+
CZMQ_EXPORT int
|
173
|
+
zhashx_save (zhashx_t *self, const char *filename);
|
174
|
+
|
175
|
+
// Load hash table from a text file in name=value format; hash table must
|
176
|
+
// already exist. Hash values must printable strings; keys may not contain
|
177
|
+
// '=' character. Returns 0 if OK, else -1 if a file was not readable.
|
178
|
+
CZMQ_EXPORT int
|
179
|
+
zhashx_load (zhashx_t *self, const char *filename);
|
180
|
+
|
181
|
+
// When a hash table was loaded from a file by zhashx_load, this method will
|
182
|
+
// reload the file if it has been modified since, and is "stable", i.e. not
|
183
|
+
// still changing. Returns 0 if OK, -1 if there was an error reloading the
|
184
|
+
// file.
|
185
|
+
CZMQ_EXPORT int
|
186
|
+
zhashx_refresh (zhashx_t *self);
|
187
|
+
|
188
|
+
// Serialize hash table to a binary frame that can be sent in a message.
|
189
|
+
// The packed format is compatible with the 'dictionary' type defined in
|
190
|
+
// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto:
|
191
|
+
//
|
192
|
+
// ; A list of name/value pairs
|
193
|
+
// dictionary = dict-count *( dict-name dict-value )
|
194
|
+
// dict-count = number-4
|
195
|
+
// dict-value = longstr
|
196
|
+
// dict-name = string
|
197
|
+
//
|
198
|
+
// ; Strings are always length + text contents
|
199
|
+
// longstr = number-4 *VCHAR
|
200
|
+
// string = number-1 *VCHAR
|
201
|
+
//
|
202
|
+
// ; Numbers are unsigned integers in network byte order
|
203
|
+
// number-1 = 1OCTET
|
204
|
+
// number-4 = 4OCTET
|
205
|
+
//
|
206
|
+
// Comments are not included in the packed data. Item values MUST be
|
207
|
+
// strings.
|
208
|
+
// Caller owns return value and must destroy it when done.
|
209
|
+
CZMQ_EXPORT zframe_t *
|
210
|
+
zhashx_pack (zhashx_t *self);
|
211
|
+
|
212
|
+
// Make a copy of the list; items are duplicated if you set a duplicator
|
213
|
+
// for the list, otherwise not. Copying a null reference returns a null
|
214
|
+
// reference. Note that this method's behavior changed slightly for CZMQ
|
215
|
+
// v3.x, as it does not set nor respect autofree. It does however let you
|
216
|
+
// duplicate any hash table safely. The old behavior is in zhashx_dup_v2.
|
217
|
+
// Caller owns return value and must destroy it when done.
|
218
|
+
CZMQ_EXPORT zhashx_t *
|
219
|
+
zhashx_dup (zhashx_t *self);
|
220
|
+
|
221
|
+
// Set a user-defined deallocator for hash items; by default items are not
|
222
|
+
// freed when the hash is destroyed.
|
223
|
+
CZMQ_EXPORT void
|
224
|
+
zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor);
|
225
|
+
|
226
|
+
// Set a user-defined duplicator for hash items; by default items are not
|
227
|
+
// copied when the hash is duplicated.
|
228
|
+
CZMQ_EXPORT void
|
229
|
+
zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator);
|
230
|
+
|
231
|
+
// Set a user-defined deallocator for keys; by default keys are freed
|
232
|
+
// when the hash is destroyed using free().
|
233
|
+
CZMQ_EXPORT void
|
234
|
+
zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor);
|
235
|
+
|
236
|
+
// Set a user-defined duplicator for keys; by default keys are duplicated
|
237
|
+
// using strdup.
|
238
|
+
CZMQ_EXPORT void
|
239
|
+
zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator);
|
240
|
+
|
241
|
+
// Set a user-defined comparator for keys; by default keys are
|
242
|
+
// compared using strcmp.
|
243
|
+
CZMQ_EXPORT void
|
244
|
+
zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator);
|
245
|
+
|
246
|
+
// Set a user-defined comparator for keys; by default keys are
|
247
|
+
// compared using strcmp.
|
248
|
+
CZMQ_EXPORT void
|
249
|
+
zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher);
|
250
|
+
|
251
|
+
// Make copy of hash table; if supplied table is null, returns null.
|
252
|
+
// Does not copy items themselves. Rebuilds new table so may be slow on
|
253
|
+
// very large tables. NOTE: only works with item values that are strings
|
254
|
+
// since there's no other way to know how to duplicate the item value.
|
255
|
+
CZMQ_EXPORT zhashx_t *
|
256
|
+
zhashx_dup_v2 (zhashx_t *self);
|
257
|
+
|
258
|
+
// *** Deprecated method, slated for removal: avoid using it ***
|
259
|
+
// Set hash for automatic value destruction. This method is deprecated
|
260
|
+
// and you should use set_destructor instead.
|
261
|
+
CZMQ_EXPORT void
|
262
|
+
zhashx_autofree (zhashx_t *self);
|
263
|
+
|
264
|
+
// *** Deprecated method, slated for removal: avoid using it ***
|
265
|
+
// Apply function to each item in the hash table. Items are iterated in no
|
266
|
+
// defined order. Stops if callback function returns non-zero and returns
|
267
|
+
// final return code from callback function (zero = success). This method
|
268
|
+
// is deprecated and you should use zhashx_first/_next instead.
|
269
|
+
CZMQ_EXPORT int
|
270
|
+
zhashx_foreach (zhashx_t *self, zhashx_foreach_fn callback, void *argument);
|
271
|
+
|
272
|
+
// Self test of this class.
|
273
|
+
CZMQ_EXPORT void
|
274
|
+
zhashx_test (bool verbose);
|
275
|
+
|
276
|
+
#ifdef CZMQ_BUILD_DRAFT_API
|
277
|
+
// *** Draft method, for development use, may change without warning ***
|
278
|
+
// Same as unpack but uses a user-defined deserializer function to convert
|
279
|
+
// a longstr back into item format.
|
280
|
+
CZMQ_EXPORT zhashx_t *
|
281
|
+
zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer);
|
282
|
+
|
283
|
+
// *** Draft method, for development use, may change without warning ***
|
284
|
+
// Same as pack but uses a user-defined serializer function to convert items
|
285
|
+
// into longstr.
|
286
|
+
// Caller owns return value and must destroy it when done.
|
287
|
+
CZMQ_EXPORT zframe_t *
|
288
|
+
zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer);
|
289
|
+
|
290
|
+
#endif // CZMQ_BUILD_DRAFT_API
|
291
|
+
// @end
|
292
|
+
|
293
|
+
|
294
|
+
#ifdef __cplusplus
|
295
|
+
}
|
296
|
+
#endif
|
297
|
+
|
298
|
+
#endif
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/* =========================================================================
|
2
|
+
ziflist - List of network interfaces available on system
|
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 __ZIFLIST_H_INCLUDED__
|
15
|
+
#define __ZIFLIST_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/ziflist.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
|
+
// Get a list of network interfaces currently defined on the system
|
27
|
+
CZMQ_EXPORT ziflist_t *
|
28
|
+
ziflist_new (void);
|
29
|
+
|
30
|
+
// Destroy a ziflist instance
|
31
|
+
CZMQ_EXPORT void
|
32
|
+
ziflist_destroy (ziflist_t **self_p);
|
33
|
+
|
34
|
+
// Reload network interfaces from system
|
35
|
+
CZMQ_EXPORT void
|
36
|
+
ziflist_reload (ziflist_t *self);
|
37
|
+
|
38
|
+
// Return the number of network interfaces on system
|
39
|
+
CZMQ_EXPORT size_t
|
40
|
+
ziflist_size (ziflist_t *self);
|
41
|
+
|
42
|
+
// Get first network interface, return NULL if there are none
|
43
|
+
CZMQ_EXPORT const char *
|
44
|
+
ziflist_first (ziflist_t *self);
|
45
|
+
|
46
|
+
// Get next network interface, return NULL if we hit the last one
|
47
|
+
CZMQ_EXPORT const char *
|
48
|
+
ziflist_next (ziflist_t *self);
|
49
|
+
|
50
|
+
// Return the current interface IP address as a printable string
|
51
|
+
CZMQ_EXPORT const char *
|
52
|
+
ziflist_address (ziflist_t *self);
|
53
|
+
|
54
|
+
// Return the current interface broadcast address as a printable string
|
55
|
+
CZMQ_EXPORT const char *
|
56
|
+
ziflist_broadcast (ziflist_t *self);
|
57
|
+
|
58
|
+
// Return the current interface network mask as a printable string
|
59
|
+
CZMQ_EXPORT const char *
|
60
|
+
ziflist_netmask (ziflist_t *self);
|
61
|
+
|
62
|
+
// Return the list of interfaces.
|
63
|
+
CZMQ_EXPORT void
|
64
|
+
ziflist_print (ziflist_t *self);
|
65
|
+
|
66
|
+
// Self test of this class.
|
67
|
+
CZMQ_EXPORT void
|
68
|
+
ziflist_test (bool verbose);
|
69
|
+
|
70
|
+
// @end
|
71
|
+
|
72
|
+
|
73
|
+
#ifdef __cplusplus
|
74
|
+
}
|
75
|
+
#endif
|
76
|
+
|
77
|
+
#endif
|
@@ -0,0 +1,158 @@
|
|
1
|
+
/* =========================================================================
|
2
|
+
zlist - simple generic list container
|
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 __ZLIST_H_INCLUDED__
|
15
|
+
#define __ZLIST_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/zlist.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
|
+
// Comparison function e.g. for sorting and removing.
|
27
|
+
typedef int (zlist_compare_fn) (
|
28
|
+
void *item1, void *item2);
|
29
|
+
|
30
|
+
// Callback function for zlist_freefn method
|
31
|
+
typedef void (zlist_free_fn) (
|
32
|
+
void *data);
|
33
|
+
|
34
|
+
// Create a new list container
|
35
|
+
CZMQ_EXPORT zlist_t *
|
36
|
+
zlist_new (void);
|
37
|
+
|
38
|
+
// Destroy a list container
|
39
|
+
CZMQ_EXPORT void
|
40
|
+
zlist_destroy (zlist_t **self_p);
|
41
|
+
|
42
|
+
// Return the item at the head of list. If the list is empty, returns NULL.
|
43
|
+
// Leaves cursor pointing at the head item, or NULL if the list is empty.
|
44
|
+
CZMQ_EXPORT void *
|
45
|
+
zlist_first (zlist_t *self);
|
46
|
+
|
47
|
+
// Return the next item. If the list is empty, returns NULL. To move to
|
48
|
+
// the start of the list call zlist_first (). Advances the cursor.
|
49
|
+
CZMQ_EXPORT void *
|
50
|
+
zlist_next (zlist_t *self);
|
51
|
+
|
52
|
+
// Return the item at the tail of list. If the list is empty, returns NULL.
|
53
|
+
// Leaves cursor pointing at the tail item, or NULL if the list is empty.
|
54
|
+
CZMQ_EXPORT void *
|
55
|
+
zlist_last (zlist_t *self);
|
56
|
+
|
57
|
+
// Return first item in the list, or null, leaves the cursor
|
58
|
+
CZMQ_EXPORT void *
|
59
|
+
zlist_head (zlist_t *self);
|
60
|
+
|
61
|
+
// Return last item in the list, or null, leaves the cursor
|
62
|
+
CZMQ_EXPORT void *
|
63
|
+
zlist_tail (zlist_t *self);
|
64
|
+
|
65
|
+
// Return the current item of list. If the list is empty, returns NULL.
|
66
|
+
// Leaves cursor pointing at the current item, or NULL if the list is empty.
|
67
|
+
CZMQ_EXPORT void *
|
68
|
+
zlist_item (zlist_t *self);
|
69
|
+
|
70
|
+
// Append an item to the end of the list, return 0 if OK or -1 if this
|
71
|
+
// failed for some reason (out of memory). Note that if a duplicator has
|
72
|
+
// been set, this method will also duplicate the item.
|
73
|
+
CZMQ_EXPORT int
|
74
|
+
zlist_append (zlist_t *self, void *item);
|
75
|
+
|
76
|
+
// Push an item to the start of the list, return 0 if OK or -1 if this
|
77
|
+
// failed for some reason (out of memory). Note that if a duplicator has
|
78
|
+
// been set, this method will also duplicate the item.
|
79
|
+
CZMQ_EXPORT int
|
80
|
+
zlist_push (zlist_t *self, void *item);
|
81
|
+
|
82
|
+
// Pop the item off the start of the list, if any
|
83
|
+
CZMQ_EXPORT void *
|
84
|
+
zlist_pop (zlist_t *self);
|
85
|
+
|
86
|
+
// Checks if an item already is present. Uses compare method to determine if
|
87
|
+
// items are equal. If the compare method is NULL the check will only compare
|
88
|
+
// pointers. Returns true if item is present else false.
|
89
|
+
CZMQ_EXPORT bool
|
90
|
+
zlist_exists (zlist_t *self, void *item);
|
91
|
+
|
92
|
+
// Remove the specified item from the list if present
|
93
|
+
CZMQ_EXPORT void
|
94
|
+
zlist_remove (zlist_t *self, void *item);
|
95
|
+
|
96
|
+
// Make a copy of list. If the list has autofree set, the copied list will
|
97
|
+
// duplicate all items, which must be strings. Otherwise, the list will hold
|
98
|
+
// pointers back to the items in the original list. If list is null, returns
|
99
|
+
// NULL.
|
100
|
+
// Caller owns return value and must destroy it when done.
|
101
|
+
CZMQ_EXPORT zlist_t *
|
102
|
+
zlist_dup (zlist_t *self);
|
103
|
+
|
104
|
+
// Purge all items from list
|
105
|
+
CZMQ_EXPORT void
|
106
|
+
zlist_purge (zlist_t *self);
|
107
|
+
|
108
|
+
// Return number of items in the list
|
109
|
+
CZMQ_EXPORT size_t
|
110
|
+
zlist_size (zlist_t *self);
|
111
|
+
|
112
|
+
// Sort the list. If the compare function is null, sorts the list by
|
113
|
+
// ascending key value using a straight ASCII comparison. If you specify
|
114
|
+
// a compare function, this decides how items are sorted. The sort is not
|
115
|
+
// stable, so may reorder items with the same keys. The algorithm used is
|
116
|
+
// combsort, a compromise between performance and simplicity.
|
117
|
+
CZMQ_EXPORT void
|
118
|
+
zlist_sort (zlist_t *self, zlist_compare_fn compare);
|
119
|
+
|
120
|
+
// Set list for automatic item destruction; item values MUST be strings.
|
121
|
+
// By default a list item refers to a value held elsewhere. When you set
|
122
|
+
// this, each time you append or push a list item, zlist will take a copy
|
123
|
+
// of the string value. Then, when you destroy the list, it will free all
|
124
|
+
// item values automatically. If you use any other technique to allocate
|
125
|
+
// list values, you must free them explicitly before destroying the list.
|
126
|
+
// The usual technique is to pop list items and destroy them, until the
|
127
|
+
// list is empty.
|
128
|
+
CZMQ_EXPORT void
|
129
|
+
zlist_autofree (zlist_t *self);
|
130
|
+
|
131
|
+
// Sets a compare function for this list. The function compares two items.
|
132
|
+
// It returns an integer less than, equal to, or greater than zero if the
|
133
|
+
// first item is found, respectively, to be less than, to match, or be
|
134
|
+
// greater than the second item.
|
135
|
+
// This function is used for sorting, removal and exists checking.
|
136
|
+
CZMQ_EXPORT void
|
137
|
+
zlist_comparefn (zlist_t *self, zlist_compare_fn fn);
|
138
|
+
|
139
|
+
// Set a free function for the specified list item. When the item is
|
140
|
+
// destroyed, the free function, if any, is called on that item.
|
141
|
+
// Use this when list items are dynamically allocated, to ensure that
|
142
|
+
// you don't have memory leaks. You can pass 'free' or NULL as a free_fn.
|
143
|
+
// Returns the item, or NULL if there is no such item.
|
144
|
+
CZMQ_EXPORT void *
|
145
|
+
zlist_freefn (zlist_t *self, void *item, zlist_free_fn fn, bool at_tail);
|
146
|
+
|
147
|
+
// Self test of this class.
|
148
|
+
CZMQ_EXPORT void
|
149
|
+
zlist_test (bool verbose);
|
150
|
+
|
151
|
+
// @end
|
152
|
+
|
153
|
+
|
154
|
+
#ifdef __cplusplus
|
155
|
+
}
|
156
|
+
#endif
|
157
|
+
|
158
|
+
#endif
|