czmq-ffi-gen 0.13.0-x64-mingw32 → 0.14.1-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +13 -0
  3. data/lib/czmq-ffi-gen/czmq/ffi.rb +224 -698
  4. data/lib/czmq-ffi-gen/czmq/ffi/zactor.rb +40 -7
  5. data/lib/czmq-ffi-gen/czmq/ffi/zargs.rb +259 -0
  6. data/lib/czmq-ffi-gen/czmq/ffi/zarmour.rb +3 -3
  7. data/lib/czmq-ffi-gen/czmq/ffi/zcert.rb +15 -6
  8. data/lib/czmq-ffi-gen/czmq/ffi/zcertstore.rb +25 -11
  9. data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +18 -18
  10. data/lib/czmq-ffi-gen/czmq/ffi/zclock.rb +6 -6
  11. data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +27 -17
  12. data/lib/czmq-ffi-gen/czmq/ffi/zdigest.rb +4 -4
  13. data/lib/czmq-ffi-gen/czmq/ffi/zdir.rb +36 -36
  14. data/lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb +1 -1
  15. data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +27 -19
  16. data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +22 -21
  17. data/lib/czmq-ffi-gen/czmq/ffi/zhash.rb +54 -54
  18. data/lib/czmq-ffi-gen/czmq/ffi/zhashx.rb +82 -80
  19. data/lib/czmq-ffi-gen/czmq/ffi/ziflist.rb +30 -0
  20. data/lib/czmq-ffi-gen/czmq/ffi/zlist.rb +30 -30
  21. data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +44 -44
  22. data/lib/czmq-ffi-gen/czmq/ffi/zloop.rb +39 -39
  23. data/lib/czmq-ffi-gen/czmq/ffi/zmsg.rb +46 -46
  24. data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +16 -16
  25. data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +237 -34
  26. data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +1201 -973
  27. data/lib/czmq-ffi-gen/czmq/ffi/zstr.rb +58 -19
  28. data/lib/czmq-ffi-gen/czmq/ffi/zsys.rb +836 -0
  29. data/lib/czmq-ffi-gen/czmq/ffi/ztimerset.rb +6 -6
  30. data/lib/czmq-ffi-gen/czmq/ffi/ztrie.rb +10 -10
  31. data/lib/czmq-ffi-gen/czmq/ffi/zuuid.rb +4 -4
  32. data/lib/czmq-ffi-gen/gem_version.rb +1 -1
  33. data/lib/czmq-ffi-gen/vendor.rb +9 -1
  34. data/vendor/local/bin/inproc_lat.exe +0 -0
  35. data/vendor/local/bin/inproc_thr.exe +0 -0
  36. data/vendor/local/bin/libczmq.dll +0 -0
  37. data/vendor/local/bin/libzmq.dll +0 -0
  38. data/vendor/local/bin/local_lat.exe +0 -0
  39. data/vendor/local/bin/local_thr.exe +0 -0
  40. data/vendor/local/bin/remote_lat.exe +0 -0
  41. data/vendor/local/bin/remote_thr.exe +0 -0
  42. data/vendor/local/bin/zmakecert.exe +0 -0
  43. data/vendor/local/include/czmq_library.h +18 -9
  44. data/vendor/local/include/czmq_prelude.h +104 -16
  45. data/vendor/local/include/zactor.h +25 -7
  46. data/vendor/local/include/zarmour.h +3 -3
  47. data/vendor/local/include/zcert.h +11 -6
  48. data/vendor/local/include/zcertstore.h +18 -9
  49. data/vendor/local/include/zchunk.h +18 -18
  50. data/vendor/local/include/zclock.h +6 -6
  51. data/vendor/local/include/zconfig.h +25 -16
  52. data/vendor/local/include/zdigest.h +4 -4
  53. data/vendor/local/include/zdir.h +36 -36
  54. data/vendor/local/include/zdir_patch.h +1 -1
  55. data/vendor/local/include/zfile.h +27 -19
  56. data/vendor/local/include/zframe.h +22 -21
  57. data/vendor/local/include/zgossip.h +5 -5
  58. data/vendor/local/include/zgossip_engine.inc +103 -22
  59. data/vendor/local/include/zgossip_msg.h +28 -30
  60. data/vendor/local/include/zhash.h +53 -53
  61. data/vendor/local/include/zhashx.h +75 -73
  62. data/vendor/local/include/ziflist.h +22 -1
  63. data/vendor/local/include/zlist.h +28 -28
  64. data/vendor/local/include/zlistx.h +41 -41
  65. data/vendor/local/include/zloop.h +36 -36
  66. data/vendor/local/include/zmsg.h +46 -46
  67. data/vendor/local/include/zpoller.h +16 -16
  68. data/vendor/local/include/zsock.h +414 -364
  69. data/vendor/local/include/zsock_option.inc +234 -1062
  70. data/vendor/local/include/zstr.h +44 -19
  71. data/vendor/local/include/zsys.h +63 -19
  72. data/vendor/local/include/zuuid.h +4 -4
  73. data/vendor/local/lib/libczmq.dll.a +0 -0
  74. data/vendor/local/lib/liblibzmq.dll.a +0 -0
  75. data/vendor/local/lib/pkgconfig/libczmq.pc +1 -1
  76. metadata +6 -3
@@ -1,13 +1,13 @@
1
1
  /* =========================================================================
2
2
  zgossip_msg - class description
3
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
-
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
8
  This Source Code Form is subject to the terms of the Mozilla Public
9
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/.
10
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
11
  =========================================================================
12
12
  */
13
13
 
@@ -18,8 +18,6 @@
18
18
  extern "C" {
19
19
  #endif
20
20
 
21
- typedef struct _zgossip_msg_t zgossip_msg_t;
22
-
23
21
  // @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
24
22
  // @warning Please edit the model at "api/zgossip_msg.api" to make changes.
25
23
  // @interface
@@ -27,96 +25,96 @@ typedef struct _zgossip_msg_t zgossip_msg_t;
27
25
  // stable builds by default. If you use this in applications, please ask
28
26
  // for it to be pushed to stable state. Use --enable-drafts to enable.
29
27
  #ifdef CZMQ_BUILD_DRAFT_API
30
- #define ZGOSSIP_MSG_HELLO 1 //
31
- #define ZGOSSIP_MSG_PUBLISH 2 //
32
- #define ZGOSSIP_MSG_PING 3 //
33
- #define ZGOSSIP_MSG_PONG 4 //
34
- #define ZGOSSIP_MSG_INVALID 5 //
28
+ #define ZGOSSIP_MSG_HELLO 1 //
29
+ #define ZGOSSIP_MSG_PUBLISH 2 //
30
+ #define ZGOSSIP_MSG_PING 3 //
31
+ #define ZGOSSIP_MSG_PONG 4 //
32
+ #define ZGOSSIP_MSG_INVALID 5 //
35
33
 
36
34
  // *** Draft method, for development use, may change without warning ***
37
35
  // Create a new empty zgossip_msg
38
- CZMQ_EXPORT zgossip_msg_t *
36
+ CZMQ_PRIVATE zgossip_msg_t *
39
37
  zgossip_msg_new (void);
40
38
 
41
39
  // *** Draft method, for development use, may change without warning ***
42
40
  // Destroy a zgossip_msg instance
43
- CZMQ_EXPORT void
41
+ CZMQ_PRIVATE void
44
42
  zgossip_msg_destroy (zgossip_msg_t **self_p);
45
43
 
46
44
  // *** Draft method, for development use, may change without warning ***
47
45
  // Receive a zgossip_msg from the socket. Returns 0 if OK, -1 if
48
- // there was an error. Blocks if there is no message waiting.
49
- CZMQ_EXPORT int
46
+ // there was an error. Blocks if there is no message waiting.
47
+ CZMQ_PRIVATE int
50
48
  zgossip_msg_recv (zgossip_msg_t *self, zsock_t *input);
51
49
 
52
50
  // *** Draft method, for development use, may change without warning ***
53
51
  // Send the zgossip_msg to the output socket, does not destroy it
54
- CZMQ_EXPORT int
52
+ CZMQ_PRIVATE int
55
53
  zgossip_msg_send (zgossip_msg_t *self, zsock_t *output);
56
54
 
57
55
  // *** Draft method, for development use, may change without warning ***
58
56
  // Print contents of message to stdout
59
- CZMQ_EXPORT void
57
+ CZMQ_PRIVATE void
60
58
  zgossip_msg_print (zgossip_msg_t *self);
61
59
 
62
60
  // *** Draft method, for development use, may change without warning ***
63
61
  // Get the message routing id, as a frame
64
- CZMQ_EXPORT zframe_t *
62
+ CZMQ_PRIVATE zframe_t *
65
63
  zgossip_msg_routing_id (zgossip_msg_t *self);
66
64
 
67
65
  // *** Draft method, for development use, may change without warning ***
68
66
  // Set the message routing id from a frame
69
- CZMQ_EXPORT void
67
+ CZMQ_PRIVATE void
70
68
  zgossip_msg_set_routing_id (zgossip_msg_t *self, zframe_t *routing_id);
71
69
 
72
70
  // *** Draft method, for development use, may change without warning ***
73
71
  // Get the zgossip_msg message id
74
- CZMQ_EXPORT int
72
+ CZMQ_PRIVATE int
75
73
  zgossip_msg_id (zgossip_msg_t *self);
76
74
 
77
75
  // *** Draft method, for development use, may change without warning ***
78
76
  // Set the zgossip_msg message id
79
- CZMQ_EXPORT void
77
+ CZMQ_PRIVATE void
80
78
  zgossip_msg_set_id (zgossip_msg_t *self, int id);
81
79
 
82
80
  // *** Draft method, for development use, may change without warning ***
83
81
  // Get the zgossip_msg message id as printable text
84
- CZMQ_EXPORT const char *
82
+ CZMQ_PRIVATE const char *
85
83
  zgossip_msg_command (zgossip_msg_t *self);
86
84
 
87
85
  // *** Draft method, for development use, may change without warning ***
88
86
  // Get the key field
89
- CZMQ_EXPORT const char *
87
+ CZMQ_PRIVATE const char *
90
88
  zgossip_msg_key (zgossip_msg_t *self);
91
89
 
92
90
  // *** Draft method, for development use, may change without warning ***
93
91
  // Set the key field
94
- CZMQ_EXPORT void
92
+ CZMQ_PRIVATE void
95
93
  zgossip_msg_set_key (zgossip_msg_t *self, const char *key);
96
94
 
97
95
  // *** Draft method, for development use, may change without warning ***
98
96
  // Get the value field
99
- CZMQ_EXPORT const char *
97
+ CZMQ_PRIVATE const char *
100
98
  zgossip_msg_value (zgossip_msg_t *self);
101
99
 
102
100
  // *** Draft method, for development use, may change without warning ***
103
101
  // Set the value field
104
- CZMQ_EXPORT void
102
+ CZMQ_PRIVATE void
105
103
  zgossip_msg_set_value (zgossip_msg_t *self, const char *value);
106
104
 
107
105
  // *** Draft method, for development use, may change without warning ***
108
106
  // Get the ttl field
109
- CZMQ_EXPORT uint32_t
107
+ CZMQ_PRIVATE uint32_t
110
108
  zgossip_msg_ttl (zgossip_msg_t *self);
111
109
 
112
110
  // *** Draft method, for development use, may change without warning ***
113
111
  // Set the ttl field
114
- CZMQ_EXPORT void
112
+ CZMQ_PRIVATE void
115
113
  zgossip_msg_set_ttl (zgossip_msg_t *self, uint32_t ttl);
116
114
 
117
115
  // *** Draft method, for development use, may change without warning ***
118
116
  // Self test of this class.
119
- CZMQ_EXPORT void
117
+ CZMQ_PRIVATE void
120
118
  zgossip_msg_test (bool verbose);
121
119
 
122
120
  #endif // CZMQ_BUILD_DRAFT_API
@@ -32,8 +32,8 @@ CZMQ_EXPORT zhash_t *
32
32
  zhash_new (void);
33
33
 
34
34
  // Unpack binary frame into a new hash table. Packed data must follow format
35
- // defined by zhash_pack. Hash table is set to autofree. An empty frame
36
- // unpacks to an empty hash table.
35
+ // defined by zhash_pack. Hash table is set to autofree. An empty frame
36
+ // unpacks to an empty hash table.
37
37
  CZMQ_EXPORT zhash_t *
38
38
  zhash_unpack (zframe_t *frame);
39
39
 
@@ -41,20 +41,20 @@ CZMQ_EXPORT zhash_t *
41
41
  CZMQ_EXPORT void
42
42
  zhash_destroy (zhash_t **self_p);
43
43
 
44
- // Insert item into hash table with specified key and item.
44
+ // Insert item into hash table with specified key and item.
45
45
  // If key is already present returns -1 and leaves existing item unchanged
46
- // Returns 0 on success.
46
+ // Returns 0 on success.
47
47
  CZMQ_EXPORT int
48
48
  zhash_insert (zhash_t *self, const char *key, void *item);
49
49
 
50
- // Update item into hash table with specified key and item.
51
- // If key is already present, destroys old item and inserts new one.
50
+ // Update item into hash table with specified key and item.
51
+ // If key is already present, destroys old item and inserts new one.
52
52
  // Use free_fn method to ensure deallocator is properly called on item.
53
53
  CZMQ_EXPORT void
54
54
  zhash_update (zhash_t *self, const char *key, void *item);
55
55
 
56
56
  // Remove an item specified by key from the hash table. If there was no such
57
- // item, this function does nothing.
57
+ // item, this function does nothing.
58
58
  CZMQ_EXPORT void
59
59
  zhash_delete (zhash_t *self, const char *key);
60
60
 
@@ -63,15 +63,15 @@ CZMQ_EXPORT void *
63
63
  zhash_lookup (zhash_t *self, const char *key);
64
64
 
65
65
  // Reindexes an item from an old key to a new key. If there was no such
66
- // item, does nothing. Returns 0 if successful, else -1.
66
+ // item, does nothing. Returns 0 if successful, else -1.
67
67
  CZMQ_EXPORT int
68
68
  zhash_rename (zhash_t *self, const char *old_key, const char *new_key);
69
69
 
70
70
  // Set a free function for the specified hash table item. When the item is
71
- // destroyed, the free function, if any, is called on that item.
72
- // Use this when hash items are dynamically allocated, to ensure that
73
- // you don't have memory leaks. You can pass 'free' or NULL as a free_fn.
74
- // Returns the item, or NULL if there is no such item.
71
+ // destroyed, the free function, if any, is called on that item.
72
+ // Use this when hash items are dynamically allocated, to ensure that
73
+ // you don't have memory leaks. You can pass 'free' or NULL as a free_fn.
74
+ // Returns the item, or NULL if there is no such item.
75
75
  CZMQ_EXPORT void *
76
76
  zhash_freefn (zhash_t *self, const char *key, zhash_free_fn free_fn);
77
77
 
@@ -79,10 +79,10 @@ CZMQ_EXPORT void *
79
79
  CZMQ_EXPORT size_t
80
80
  zhash_size (zhash_t *self);
81
81
 
82
- // Make copy of hash table; if supplied table is null, returns null.
83
- // Does not copy items themselves. Rebuilds new table so may be slow on
82
+ // Make copy of hash table; if supplied table is null, returns null.
83
+ // Does not copy items themselves. Rebuilds new table so may be slow on
84
84
  // very large tables. NOTE: only works with item values that are strings
85
- // since there's no other way to know how to duplicate the item value.
85
+ // since there's no other way to know how to duplicate the item value.
86
86
  // Caller owns return value and must destroy it when done.
87
87
  CZMQ_EXPORT zhash_t *
88
88
  zhash_dup (zhash_t *self);
@@ -92,80 +92,80 @@ CZMQ_EXPORT zhash_t *
92
92
  CZMQ_EXPORT zlist_t *
93
93
  zhash_keys (zhash_t *self);
94
94
 
95
- // Simple iterator; returns first item in hash table, in no given order,
96
- // or NULL if the table is empty. This method is simpler to use than the
95
+ // Simple iterator; returns first item in hash table, in no given order,
96
+ // or NULL if the table is empty. This method is simpler to use than the
97
97
  // foreach() method, which is deprecated. To access the key for this item
98
- // use zhash_cursor(). NOTE: do NOT modify the table while iterating.
98
+ // use zhash_cursor(). NOTE: do NOT modify the table while iterating.
99
99
  CZMQ_EXPORT void *
100
100
  zhash_first (zhash_t *self);
101
101
 
102
- // Simple iterator; returns next item in hash table, in no given order,
102
+ // Simple iterator; returns next item in hash table, in no given order,
103
103
  // or NULL if the last item was already returned. Use this together with
104
- // zhash_first() to process all items in a hash table. If you need the
105
- // items in sorted order, use zhash_keys() and then zlist_sort(). To
106
- // access the key for this item use zhash_cursor(). NOTE: do NOT modify
107
- // the table while iterating.
104
+ // zhash_first() to process all items in a hash table. If you need the
105
+ // items in sorted order, use zhash_keys() and then zlist_sort(). To
106
+ // access the key for this item use zhash_cursor(). NOTE: do NOT modify
107
+ // the table while iterating.
108
108
  CZMQ_EXPORT void *
109
109
  zhash_next (zhash_t *self);
110
110
 
111
111
  // After a successful first/next method, returns the key for the item that
112
- // was returned. This is a constant string that you may not modify or
113
- // deallocate, and which lasts as long as the item in the hash. After an
114
- // unsuccessful first/next, returns NULL.
112
+ // was returned. This is a constant string that you may not modify or
113
+ // deallocate, and which lasts as long as the item in the hash. After an
114
+ // unsuccessful first/next, returns NULL.
115
115
  CZMQ_EXPORT const char *
116
116
  zhash_cursor (zhash_t *self);
117
117
 
118
- // Add a comment to hash table before saving to disk. You can add as many
118
+ // Add a comment to hash table before saving to disk. You can add as many
119
119
  // comment lines as you like. These comment lines are discarded when loading
120
- // the file. If you use a null format, all comments are deleted.
120
+ // the file. If you use a null format, all comments are deleted.
121
121
  CZMQ_EXPORT void
122
122
  zhash_comment (zhash_t *self, const char *format, ...) CHECK_PRINTF (2);
123
123
 
124
124
  // Serialize hash table to a binary frame that can be sent in a message.
125
125
  // The packed format is compatible with the 'dictionary' type defined in
126
- // http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto:
127
- //
128
- // ; A list of name/value pairs
129
- // dictionary = dict-count *( dict-name dict-value )
130
- // dict-count = number-4
131
- // dict-value = longstr
132
- // dict-name = string
133
- //
134
- // ; Strings are always length + text contents
135
- // longstr = number-4 *VCHAR
136
- // string = number-1 *VCHAR
137
- //
138
- // ; Numbers are unsigned integers in network byte order
139
- // number-1 = 1OCTET
140
- // number-4 = 4OCTET
141
- //
142
- // Comments are not included in the packed data. Item values MUST be
143
- // strings.
126
+ // http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto:
127
+ //
128
+ // ; A list of name/value pairs
129
+ // dictionary = dict-count *( dict-name dict-value )
130
+ // dict-count = number-4
131
+ // dict-value = longstr
132
+ // dict-name = string
133
+ //
134
+ // ; Strings are always length + text contents
135
+ // longstr = number-4 *VCHAR
136
+ // string = number-1 *VCHAR
137
+ //
138
+ // ; Numbers are unsigned integers in network byte order
139
+ // number-1 = 1OCTET
140
+ // number-4 = 4OCTET
141
+ //
142
+ // Comments are not included in the packed data. Item values MUST be
143
+ // strings.
144
144
  // Caller owns return value and must destroy it when done.
145
145
  CZMQ_EXPORT zframe_t *
146
146
  zhash_pack (zhash_t *self);
147
147
 
148
148
  // Save hash table to a text file in name=value format. Hash values must be
149
- // printable strings; keys may not contain '=' character. Returns 0 if OK,
150
- // else -1 if a file error occurred.
149
+ // printable strings; keys may not contain '=' character. Returns 0 if OK,
150
+ // else -1 if a file error occurred.
151
151
  CZMQ_EXPORT int
152
152
  zhash_save (zhash_t *self, const char *filename);
153
153
 
154
- // Load hash table from a text file in name=value format; hash table must
154
+ // Load hash table from a text file in name=value format; hash table must
155
155
  // already exist. Hash values must printable strings; keys may not contain
156
- // '=' character. Returns 0 if OK, else -1 if a file was not readable.
156
+ // '=' character. Returns 0 if OK, else -1 if a file was not readable.
157
157
  CZMQ_EXPORT int
158
158
  zhash_load (zhash_t *self, const char *filename);
159
159
 
160
160
  // When a hash table was loaded from a file by zhash_load, this method will
161
161
  // reload the file if it has been modified since, and is "stable", i.e. not
162
- // still changing. Returns 0 if OK, -1 if there was an error reloading the
163
- // file.
162
+ // still changing. Returns 0 if OK, -1 if there was an error reloading the
163
+ // file.
164
164
  CZMQ_EXPORT int
165
165
  zhash_refresh (zhash_t *self);
166
166
 
167
167
  // Set hash for automatic value destruction. Note that this assumes that
168
- // values are NULL-terminated strings. Do not use with different types.
168
+ // values are NULL-terminated strings. Do not use with different types.
169
169
  CZMQ_EXPORT void
170
170
  zhash_autofree (zhash_t *self);
171
171
 
@@ -46,12 +46,12 @@ typedef void (zhashx_free_fn) (
46
46
  typedef size_t (zhashx_hash_fn) (
47
47
  const void *key);
48
48
 
49
- // Serializes an item to a longstr.
49
+ // Serializes an item to a longstr.
50
50
  // The caller takes ownership of the newly created object.
51
51
  typedef char * (zhashx_serializer_fn) (
52
52
  const void *item);
53
53
 
54
- // Deserializes a longstr into an item.
54
+ // Deserializes a longstr into an item.
55
55
  // The caller takes ownership of the newly created object.
56
56
  typedef void * (zhashx_deserializer_fn) (
57
57
  const char *item_str);
@@ -61,8 +61,8 @@ CZMQ_EXPORT zhashx_t *
61
61
  zhashx_new (void);
62
62
 
63
63
  // Unpack binary frame into a new hash table. Packed data must follow format
64
- // defined by zhashx_pack. Hash table is set to autofree. An empty frame
65
- // unpacks to an empty hash table.
64
+ // defined by zhashx_pack. Hash table is set to autofree. An empty frame
65
+ // unpacks to an empty hash table.
66
66
  CZMQ_EXPORT zhashx_t *
67
67
  zhashx_unpack (zframe_t *frame);
68
68
 
@@ -70,28 +70,28 @@ CZMQ_EXPORT zhashx_t *
70
70
  CZMQ_EXPORT void
71
71
  zhashx_destroy (zhashx_t **self_p);
72
72
 
73
- // Insert item into hash table with specified key and item.
73
+ // Insert item into hash table with specified key and item.
74
74
  // If key is already present returns -1 and leaves existing item unchanged
75
- // Returns 0 on success.
75
+ // Returns 0 on success.
76
76
  CZMQ_EXPORT int
77
77
  zhashx_insert (zhashx_t *self, const void *key, void *item);
78
78
 
79
79
  // Update or insert item into hash table with specified key and item. If the
80
80
  // key is already present, destroys old item and inserts new one. If you set
81
- // a container item destructor, this is called on the old value. If the key
82
- // was not already present, inserts a new item. Sets the hash cursor to the
83
- // new item.
81
+ // a container item destructor, this is called on the old value. If the key
82
+ // was not already present, inserts a new item. Sets the hash cursor to the
83
+ // new item.
84
84
  CZMQ_EXPORT void
85
85
  zhashx_update (zhashx_t *self, const void *key, void *item);
86
86
 
87
87
  // Remove an item specified by key from the hash table. If there was no such
88
- // item, this function does nothing.
88
+ // item, this function does nothing.
89
89
  CZMQ_EXPORT void
90
90
  zhashx_delete (zhashx_t *self, const void *key);
91
91
 
92
- // Delete all items from the hash table. If the key destructor is
92
+ // Delete all items from the hash table. If the key destructor is
93
93
  // set, calls it on every key. If the item destructor is set, calls
94
- // it on every item.
94
+ // it on every item.
95
95
  CZMQ_EXPORT void
96
96
  zhashx_purge (zhashx_t *self);
97
97
 
@@ -100,15 +100,15 @@ CZMQ_EXPORT void *
100
100
  zhashx_lookup (zhashx_t *self, const void *key);
101
101
 
102
102
  // Reindexes an item from an old key to a new key. If there was no such
103
- // item, does nothing. Returns 0 if successful, else -1.
103
+ // item, does nothing. Returns 0 if successful, else -1.
104
104
  CZMQ_EXPORT int
105
105
  zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key);
106
106
 
107
107
  // Set a free function for the specified hash table item. When the item is
108
- // destroyed, the free function, if any, is called on that item.
109
- // Use this when hash items are dynamically allocated, to ensure that
110
- // you don't have memory leaks. You can pass 'free' or NULL as a free_fn.
111
- // Returns the item, or NULL if there is no such item.
108
+ // destroyed, the free function, if any, is called on that item.
109
+ // Use this when hash items are dynamically allocated, to ensure that
110
+ // you don't have memory leaks. You can pass 'free' or NULL as a free_fn.
111
+ // Returns the item, or NULL if there is no such item.
112
112
  CZMQ_EXPORT void *
113
113
  zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn);
114
114
 
@@ -116,95 +116,95 @@ CZMQ_EXPORT void *
116
116
  CZMQ_EXPORT size_t
117
117
  zhashx_size (zhashx_t *self);
118
118
 
119
- // Return a zlistx_t containing the keys for the items in the
119
+ // Return a zlistx_t containing the keys for the items in the
120
120
  // table. Uses the key_duplicator to duplicate all keys and sets the
121
- // key_destructor as destructor for the list.
121
+ // key_destructor as destructor for the list.
122
122
  // Caller owns return value and must destroy it when done.
123
123
  CZMQ_EXPORT zlistx_t *
124
124
  zhashx_keys (zhashx_t *self);
125
125
 
126
- // Return a zlistx_t containing the values for the items in the
126
+ // Return a zlistx_t containing the values for the items in the
127
127
  // table. Uses the duplicator to duplicate all items and sets the
128
- // destructor as destructor for the list.
128
+ // destructor as destructor for the list.
129
129
  // Caller owns return value and must destroy it when done.
130
130
  CZMQ_EXPORT zlistx_t *
131
131
  zhashx_values (zhashx_t *self);
132
132
 
133
- // Simple iterator; returns first item in hash table, in no given order,
134
- // or NULL if the table is empty. This method is simpler to use than the
133
+ // Simple iterator; returns first item in hash table, in no given order,
134
+ // or NULL if the table is empty. This method is simpler to use than the
135
135
  // foreach() method, which is deprecated. To access the key for this item
136
- // use zhashx_cursor(). NOTE: do NOT modify the table while iterating.
136
+ // use zhashx_cursor(). NOTE: do NOT modify the table while iterating.
137
137
  CZMQ_EXPORT void *
138
138
  zhashx_first (zhashx_t *self);
139
139
 
140
- // Simple iterator; returns next item in hash table, in no given order,
140
+ // Simple iterator; returns next item in hash table, in no given order,
141
141
  // or NULL if the last item was already returned. Use this together with
142
- // zhashx_first() to process all items in a hash table. If you need the
143
- // items in sorted order, use zhashx_keys() and then zlistx_sort(). To
142
+ // zhashx_first() to process all items in a hash table. If you need the
143
+ // items in sorted order, use zhashx_keys() and then zlistx_sort(). To
144
144
  // access the key for this item use zhashx_cursor(). NOTE: do NOT modify
145
- // the table while iterating.
145
+ // the table while iterating.
146
146
  CZMQ_EXPORT void *
147
147
  zhashx_next (zhashx_t *self);
148
148
 
149
149
  // After a successful first/next method, returns the key for the item that
150
- // was returned. This is a constant string that you may not modify or
151
- // deallocate, and which lasts as long as the item in the hash. After an
152
- // unsuccessful first/next, returns NULL.
150
+ // was returned. This is a constant string that you may not modify or
151
+ // deallocate, and which lasts as long as the item in the hash. After an
152
+ // unsuccessful first/next, returns NULL.
153
153
  CZMQ_EXPORT const void *
154
154
  zhashx_cursor (zhashx_t *self);
155
155
 
156
- // Add a comment to hash table before saving to disk. You can add as many
156
+ // Add a comment to hash table before saving to disk. You can add as many
157
157
  // comment lines as you like. These comment lines are discarded when loading
158
- // the file. If you use a null format, all comments are deleted.
158
+ // the file. If you use a null format, all comments are deleted.
159
159
  CZMQ_EXPORT void
160
160
  zhashx_comment (zhashx_t *self, const char *format, ...) CHECK_PRINTF (2);
161
161
 
162
162
  // Save hash table to a text file in name=value format. Hash values must be
163
- // printable strings; keys may not contain '=' character. Returns 0 if OK,
164
- // else -1 if a file error occurred.
163
+ // printable strings; keys may not contain '=' character. Returns 0 if OK,
164
+ // else -1 if a file error occurred.
165
165
  CZMQ_EXPORT int
166
166
  zhashx_save (zhashx_t *self, const char *filename);
167
167
 
168
- // Load hash table from a text file in name=value format; hash table must
168
+ // Load hash table from a text file in name=value format; hash table must
169
169
  // already exist. Hash values must printable strings; keys may not contain
170
- // '=' character. Returns 0 if OK, else -1 if a file was not readable.
170
+ // '=' character. Returns 0 if OK, else -1 if a file was not readable.
171
171
  CZMQ_EXPORT int
172
172
  zhashx_load (zhashx_t *self, const char *filename);
173
173
 
174
174
  // When a hash table was loaded from a file by zhashx_load, this method will
175
- // reload the file if it has been modified since, and is "stable", i.e. not
176
- // still changing. Returns 0 if OK, -1 if there was an error reloading the
177
- // file.
175
+ // reload the file if it has been modified since, and is "stable", i.e. not
176
+ // still changing. Returns 0 if OK, -1 if there was an error reloading the
177
+ // file.
178
178
  CZMQ_EXPORT int
179
179
  zhashx_refresh (zhashx_t *self);
180
180
 
181
181
  // Serialize hash table to a binary frame that can be sent in a message.
182
182
  // The packed format is compatible with the 'dictionary' type defined in
183
- // http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto:
184
- //
185
- // ; A list of name/value pairs
186
- // dictionary = dict-count *( dict-name dict-value )
187
- // dict-count = number-4
188
- // dict-value = longstr
189
- // dict-name = string
190
- //
191
- // ; Strings are always length + text contents
192
- // longstr = number-4 *VCHAR
193
- // string = number-1 *VCHAR
194
- //
195
- // ; Numbers are unsigned integers in network byte order
196
- // number-1 = 1OCTET
197
- // number-4 = 4OCTET
198
- //
199
- // Comments are not included in the packed data. Item values MUST be
200
- // strings.
183
+ // http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto:
184
+ //
185
+ // ; A list of name/value pairs
186
+ // dictionary = dict-count *( dict-name dict-value )
187
+ // dict-count = number-4
188
+ // dict-value = longstr
189
+ // dict-name = string
190
+ //
191
+ // ; Strings are always length + text contents
192
+ // longstr = number-4 *VCHAR
193
+ // string = number-1 *VCHAR
194
+ //
195
+ // ; Numbers are unsigned integers in network byte order
196
+ // number-1 = 1OCTET
197
+ // number-4 = 4OCTET
198
+ //
199
+ // Comments are not included in the packed data. Item values MUST be
200
+ // strings.
201
201
  // Caller owns return value and must destroy it when done.
202
202
  CZMQ_EXPORT zframe_t *
203
203
  zhashx_pack (zhashx_t *self);
204
204
 
205
- // Make a copy of the list; items are duplicated if you set a duplicator
206
- // for the list, otherwise not. Copying a null reference returns a null
207
- // reference. Note that this method's behavior changed slightly for CZMQ
205
+ // Make a copy of the list; items are duplicated if you set a duplicator
206
+ // for the list, otherwise not. Copying a null reference returns a null
207
+ // reference. Note that this method's behavior changed slightly for CZMQ
208
208
  // v3.x, as it does not set nor respect autofree. It does however let you
209
209
  // duplicate any hash table safely. The old behavior is in zhashx_dup_v2.
210
210
  // Caller owns return value and must destroy it when done.
@@ -212,39 +212,41 @@ CZMQ_EXPORT zhashx_t *
212
212
  zhashx_dup (zhashx_t *self);
213
213
 
214
214
  // Set a user-defined deallocator for hash items; by default items are not
215
- // freed when the hash is destroyed.
215
+ // freed when the hash is destroyed.
216
216
  CZMQ_EXPORT void
217
217
  zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor);
218
218
 
219
219
  // Set a user-defined duplicator for hash items; by default items are not
220
- // copied when the hash is duplicated.
220
+ // copied when the hash is duplicated.
221
221
  CZMQ_EXPORT void
222
222
  zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator);
223
223
 
224
224
  // Set a user-defined deallocator for keys; by default keys are freed
225
- // when the hash is destroyed using free().
225
+ // when the hash is destroyed using free().
226
226
  CZMQ_EXPORT void
227
227
  zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor);
228
228
 
229
229
  // Set a user-defined duplicator for keys; by default keys are duplicated
230
- // using strdup.
230
+ // using strdup.
231
231
  CZMQ_EXPORT void
232
232
  zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator);
233
233
 
234
234
  // Set a user-defined comparator for keys; by default keys are
235
- // compared using strcmp.
235
+ // compared using strcmp.
236
+ // The callback function should return zero (0) on matching
237
+ // items.
236
238
  CZMQ_EXPORT void
237
239
  zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator);
238
240
 
239
- // Set a user-defined comparator for keys; by default keys are
240
- // compared using strcmp.
241
+ // Set a user-defined hash function for keys; by default keys are
242
+ // hashed by a modified Bernstein hashing function.
241
243
  CZMQ_EXPORT void
242
244
  zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher);
243
245
 
244
- // Make copy of hash table; if supplied table is null, returns null.
245
- // Does not copy items themselves. Rebuilds new table so may be slow on
246
+ // Make copy of hash table; if supplied table is null, returns null.
247
+ // Does not copy items themselves. Rebuilds new table so may be slow on
246
248
  // very large tables. NOTE: only works with item values that are strings
247
- // since there's no other way to know how to duplicate the item value.
249
+ // since there's no other way to know how to duplicate the item value.
248
250
  CZMQ_EXPORT zhashx_t *
249
251
  zhashx_dup_v2 (zhashx_t *self);
250
252
 
@@ -255,13 +257,13 @@ CZMQ_EXPORT void
255
257
  #ifdef CZMQ_BUILD_DRAFT_API
256
258
  // *** Draft method, for development use, may change without warning ***
257
259
  // Same as unpack but uses a user-defined deserializer function to convert
258
- // a longstr back into item format.
260
+ // a longstr back into item format.
259
261
  CZMQ_EXPORT zhashx_t *
260
262
  zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer);
261
263
 
262
264
  // *** Draft method, for development use, may change without warning ***
263
265
  // Same as pack but uses a user-defined serializer function to convert items
264
- // into longstr.
266
+ // into longstr.
265
267
  // Caller owns return value and must destroy it when done.
266
268
  CZMQ_EXPORT zframe_t *
267
269
  zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer);