aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_bio_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_bio_lib.h')
-rw-r--r--src/include/gnunet_bio_lib.h68
1 files changed, 37 insertions, 31 deletions
diff --git a/src/include/gnunet_bio_lib.h b/src/include/gnunet_bio_lib.h
index a1fd0e6ac..5529ca8f4 100644
--- a/src/include/gnunet_bio_lib.h
+++ b/src/include/gnunet_bio_lib.h
@@ -55,7 +55,7 @@ struct GNUNET_BIO_ReadHandle;
55 * @return IO handle on success, NULL on error 55 * @return IO handle on success, NULL on error
56 */ 56 */
57struct GNUNET_BIO_ReadHandle * 57struct GNUNET_BIO_ReadHandle *
58GNUNET_BIO_read_open(const char *fn); 58GNUNET_BIO_read_open (const char *fn);
59 59
60 60
61/** 61/**
@@ -67,7 +67,7 @@ GNUNET_BIO_read_open(const char *fn);
67 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise 67 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
68 */ 68 */
69int 69int
70GNUNET_BIO_read_close(struct GNUNET_BIO_ReadHandle *h, char **emsg); 70GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg);
71 71
72 72
73/** 73/**
@@ -80,8 +80,8 @@ GNUNET_BIO_read_close(struct GNUNET_BIO_ReadHandle *h, char **emsg);
80 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure 80 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
81 */ 81 */
82int 82int
83GNUNET_BIO_read(struct GNUNET_BIO_ReadHandle *h, const char *what, 83GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, const char *what,
84 void *result, size_t len); 84 void *result, size_t len);
85 85
86 86
87/** 87/**
@@ -95,9 +95,9 @@ GNUNET_BIO_read(struct GNUNET_BIO_ReadHandle *h, const char *what,
95 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure 95 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
96 */ 96 */
97int 97int
98GNUNET_BIO_read_fn(struct GNUNET_BIO_ReadHandle *h, 98GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h,
99 const char *file, int line, 99 const char *file, int line,
100 void *result, size_t len); 100 void *result, size_t len);
101 101
102/** 102/**
103 * Read 0-terminated string from a file. 103 * Read 0-terminated string from a file.
@@ -110,8 +110,8 @@ GNUNET_BIO_read_fn(struct GNUNET_BIO_ReadHandle *h,
110 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure 110 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
111 */ 111 */
112int 112int
113GNUNET_BIO_read_string(struct GNUNET_BIO_ReadHandle *h, const char *what, 113GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, const char *what,
114 char **result, size_t max_length); 114 char **result, size_t max_length);
115 115
116 116
117/** 117/**
@@ -123,8 +123,8 @@ GNUNET_BIO_read_string(struct GNUNET_BIO_ReadHandle *h, const char *what,
123 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure 123 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
124 */ 124 */
125int 125int
126GNUNET_BIO_read_meta_data(struct GNUNET_BIO_ReadHandle *h, const char *what, 126GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, const char *what,
127 struct GNUNET_CONTAINER_MetaData **result); 127 struct GNUNET_CONTAINER_MetaData **result);
128 128
129 129
130/** 130/**
@@ -133,7 +133,8 @@ GNUNET_BIO_read_meta_data(struct GNUNET_BIO_ReadHandle *h, const char *what,
133 * @param h hande to open file 133 * @param h hande to open file
134 * @param f address of float to read 134 * @param f address of float to read
135 */ 135 */
136#define GNUNET_BIO_read_float(h, f) (GNUNET_BIO_read_fn(h, __FILE__, __LINE__, f, sizeof(float))) 136#define GNUNET_BIO_read_float(h, f) (GNUNET_BIO_read_fn (h, __FILE__, __LINE__, \
137 f, sizeof(float)))
137 138
138 139
139 140
@@ -143,7 +144,8 @@ GNUNET_BIO_read_meta_data(struct GNUNET_BIO_ReadHandle *h, const char *what,
143 * @param h hande to open file 144 * @param h hande to open file
144 * @param f address of double to read 145 * @param f address of double to read
145 */ 146 */
146#define GNUNET_BIO_read_double(h, f) (GNUNET_BIO_read_fn(h, __FILE__, __LINE__, f, sizeof(double))) 147#define GNUNET_BIO_read_double(h, f) (GNUNET_BIO_read_fn (h, __FILE__, __LINE__, \
148 f, sizeof(double)))
147 149
148 150
149/** 151/**
@@ -156,8 +158,8 @@ GNUNET_BIO_read_meta_data(struct GNUNET_BIO_ReadHandle *h, const char *what,
156 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 158 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
157 */ 159 */
158int 160int
159GNUNET_BIO_read_int32__(struct GNUNET_BIO_ReadHandle *h, const char *file, 161GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, const char *file,
160 int line, int32_t * i); 162 int line, int32_t *i);
161 163
162 164
163/** 165/**
@@ -166,7 +168,9 @@ GNUNET_BIO_read_int32__(struct GNUNET_BIO_ReadHandle *h, const char *file,
166 * @param h hande to open file 168 * @param h hande to open file
167 * @param i address of 32-bit integer to read 169 * @param i address of 32-bit integer to read
168 */ 170 */
169#define GNUNET_BIO_read_int32(h, i) GNUNET_BIO_read_int32__(h, __FILE__, __LINE__, (int32_t*)i) 171#define GNUNET_BIO_read_int32(h, i) GNUNET_BIO_read_int32__ (h, __FILE__, \
172 __LINE__, \
173 (int32_t*) i)
170 174
171 175
172/** 176/**
@@ -179,8 +183,8 @@ GNUNET_BIO_read_int32__(struct GNUNET_BIO_ReadHandle *h, const char *file,
179 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 183 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
180 */ 184 */
181int 185int
182GNUNET_BIO_read_int64__(struct GNUNET_BIO_ReadHandle *h, const char *file, 186GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, const char *file,
183 int line, int64_t * i); 187 int line, int64_t *i);
184 188
185 189
186/** 190/**
@@ -189,7 +193,9 @@ GNUNET_BIO_read_int64__(struct GNUNET_BIO_ReadHandle *h, const char *file,
189 * @param h hande to open file 193 * @param h hande to open file
190 * @param i address of 64-bit integer to read 194 * @param i address of 64-bit integer to read
191 */ 195 */
192#define GNUNET_BIO_read_int64(h, i) GNUNET_BIO_read_int64__(h, __FILE__, __LINE__, (int64_t*)i) 196#define GNUNET_BIO_read_int64(h, i) GNUNET_BIO_read_int64__ (h, __FILE__, \
197 __LINE__, \
198 (int64_t*) i)
193 199
194 200
195/** 201/**
@@ -204,7 +210,7 @@ struct GNUNET_BIO_WriteHandle;
204 * @return IO handle on success, NULL on error 210 * @return IO handle on success, NULL on error
205 */ 211 */
206struct GNUNET_BIO_WriteHandle * 212struct GNUNET_BIO_WriteHandle *
207GNUNET_BIO_write_open(const char *fn); 213GNUNET_BIO_write_open (const char *fn);
208 214
209 215
210/** 216/**
@@ -214,7 +220,7 @@ GNUNET_BIO_write_open(const char *fn);
214 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 220 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
215 */ 221 */
216int 222int
217GNUNET_BIO_write_close(struct GNUNET_BIO_WriteHandle *h); 223GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h);
218 224
219 225
220/** 226/**
@@ -226,8 +232,8 @@ GNUNET_BIO_write_close(struct GNUNET_BIO_WriteHandle *h);
226 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 232 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
227 */ 233 */
228int 234int
229GNUNET_BIO_write(struct GNUNET_BIO_WriteHandle *h, const void *buffer, 235GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer,
230 size_t n); 236 size_t n);
231 237
232 238
233/** 239/**
@@ -238,7 +244,7 @@ GNUNET_BIO_write(struct GNUNET_BIO_WriteHandle *h, const void *buffer,
238 * the file is closed 244 * the file is closed
239 */ 245 */
240int 246int
241GNUNET_BIO_flush(struct GNUNET_BIO_WriteHandle *h); 247GNUNET_BIO_flush (struct GNUNET_BIO_WriteHandle *h);
242 248
243 249
244/** 250/**
@@ -249,7 +255,7 @@ GNUNET_BIO_flush(struct GNUNET_BIO_WriteHandle *h);
249 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 255 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
250 */ 256 */
251int 257int
252GNUNET_BIO_write_string(struct GNUNET_BIO_WriteHandle *h, const char *s); 258GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, const char *s);
253 259
254 260
255/** 261/**
@@ -260,8 +266,8 @@ GNUNET_BIO_write_string(struct GNUNET_BIO_WriteHandle *h, const char *s);
260 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 266 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
261 */ 267 */
262int 268int
263GNUNET_BIO_write_meta_data(struct GNUNET_BIO_WriteHandle *h, 269GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h,
264 const struct GNUNET_CONTAINER_MetaData *m); 270 const struct GNUNET_CONTAINER_MetaData *m);
265 271
266 272
267 273
@@ -271,7 +277,7 @@ GNUNET_BIO_write_meta_data(struct GNUNET_BIO_WriteHandle *h,
271 * @param h hande to open file 277 * @param h hande to open file
272 * @param f float to write (must be a variable) 278 * @param f float to write (must be a variable)
273 */ 279 */
274#define GNUNET_BIO_write_float(h, f) GNUNET_BIO_write(h, &f, sizeof(float)) 280#define GNUNET_BIO_write_float(h, f) GNUNET_BIO_write (h, &f, sizeof(float))
275 281
276 282
277 283
@@ -281,7 +287,7 @@ GNUNET_BIO_write_meta_data(struct GNUNET_BIO_WriteHandle *h,
281 * @param h hande to open file 287 * @param h hande to open file
282 * @param f double to write (must be a variable) 288 * @param f double to write (must be a variable)
283 */ 289 */
284#define GNUNET_BIO_write_double(h, f) GNUNET_BIO_write(h, &f, sizeof(double)) 290#define GNUNET_BIO_write_double(h, f) GNUNET_BIO_write (h, &f, sizeof(double))
285 291
286 292
287/** 293/**
@@ -292,7 +298,7 @@ GNUNET_BIO_write_meta_data(struct GNUNET_BIO_WriteHandle *h,
292 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 298 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
293 */ 299 */
294int 300int
295GNUNET_BIO_write_int32(struct GNUNET_BIO_WriteHandle *h, int32_t i); 301GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, int32_t i);
296 302
297 303
298/** 304/**
@@ -303,7 +309,7 @@ GNUNET_BIO_write_int32(struct GNUNET_BIO_WriteHandle *h, int32_t i);
303 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 309 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
304 */ 310 */
305int 311int
306GNUNET_BIO_write_int64(struct GNUNET_BIO_WriteHandle *h, int64_t i); 312GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h, int64_t i);
307 313
308 314
309#if 0 /* keep Emacsens' auto-indent happy */ 315#if 0 /* keep Emacsens' auto-indent happy */