-int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h,
- const struct GNUNET_CONTAINER_MetaData *m);
-
-
-
-/**
- * Write a float.
- *
- * @param h hande to open file
- * @param f float to write (must be a variable)
- */
-#define GNUNET_BIO_write_float(h, f) (sizeof(float) == GNUNET_BIO_write (h, &f, sizeof(float)))
-
-
-
-/**
- * Write a double.
- *
- * @param h hande to open file
- * @param f double to write (must be a variable)
- */
-#define GNUNET_BIO_write_float(h, f) (sizeof(double) == GNUNET_BIO_write (h, &f, sizeof(double)))
-
-
-/**
- * Write an (u)int32_t.
- *
- * @param h hande to open file
- * @param i address of 32-bit integer to write
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
- */
-int GNUNET_BIO_write_int32 (struct GNUNET_BIO_ReadHandle *h,
- int32_t i);
-
-
-/**
- * Write an (u)int64_t.
- *
- * @param h hande to open file
- * @param i address of 64-bit integer to write
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
- */
-int GNUNET_BIO_write_int64 (struct GNUNET_BIO_ReadHandle *h,
- int64_t i);
-
-
-
-
-
-typedef struct
-{
- int fd;
- unsigned int have;
- unsigned int size;
- char *buffer;
-} WriteBuffer;
-
-static void
-write_buffered (WriteBuffer * wb, const void *s, unsigned int size)
-{
- const char *src = s;
- unsigned int min;
- unsigned int pos;
- int ret;
-
- if (wb->fd == -1)
- return;
- pos = 0;
- do
- {
- /* first, just use buffer */
- min = wb->size - wb->have;
- if (min > size - pos)
- min = size - pos;
- memcpy (&wb->buffer[wb->have], &src[pos], min);
- pos += min;
- wb->have += min;
- if (pos == size)
- return; /* done */
- GNUNET_GE_ASSERT (NULL, wb->have == wb->size);
- ret = WRITE (wb->fd, wb->buffer, wb->size);
- if (ret != wb->size)
- {
- CLOSE (wb->fd);
- wb->fd = -1;
- return; /* error */
- }
- wb->have = 0;
- }
- while (pos < size); /* should always be true */
-}
-
-
-static void
-WRITEINT (WriteBuffer * wb, int val)
-{
- int big;
- big = htonl (val);
- write_buffered (wb, &big, sizeof (int));
-}
-
-static void
-WRITELONG (WriteBuffer * wb, long long val)
-{
- long long big;
- big = GNUNET_htonll (val);
- write_buffered (wb, &big, sizeof (long long));
-}
-
-static void
-writeURI (WriteBuffer * wb, const struct GNUNET_ECRS_URI *uri)