38 #define LOG(kind, ...) GNUNET_log_from (kind, "gnsrecord", __VA_ARGS__) 44 #define DEBUG_GNSRECORDS 0 97 for (
unsigned int i = 0; i < rd_count; i++)
140 return (ssize_t)
ret;
163 for (
unsigned int i = 0; i < rd_count; i++)
166 "Serializing record %u with flags %d and expiration time %llu\n",
173 rec.
flags = htonl (rd[i].flags);
174 if ((off +
sizeof(rec) > dest_size) ||
175 (off +
sizeof(rec) < off))
184 if ((off + rd[i].data_size > dest_size) ||
229 unsigned int rd_count,
236 for (
unsigned int i = 0; i < rd_count; i++)
238 if ((off +
sizeof(rec) > len) ||
239 (off +
sizeof(rec) < off))
258 dest[i].
data = &src[off];
260 #if GNUNET_EXTRA_LOGGING 276 "Deserialized record %u with flags %d and expiration time %llu\n",
uint32_t data_size
Number of bytes in 'data', network byte order.
GNUNET_NETWORK_STRUCT_END ssize_t GNUNET_GNSRECORD_records_get_size(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Calculate how many bytes we will need to serialize the given records.
ssize_t GNUNET_GNSRECORD_records_serialize(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, size_t dest_size, char *dest)
Serialize the given records to the given destination buffer.
uint32_t flags
Flags for the record, network byte order.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
static int ret
Return value of the commandline.
size_t data_size
Number of bytes in data.
int GNUNET_GNSRECORD_records_deserialize(size_t len, const char *src, unsigned int rd_count, struct GNUNET_GNSRECORD_Data *dest)
Deserialize the given records to the given destination.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
const void * data
Binary value stored in the DNS record.
#define GNUNET_GNSRECORD_TYPE_PKEY
Record type for GNS zone transfer ("PKEY").
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
uint64_t expiration_time
Expiration time for the DNS record.
uint64_t expiration_time
Expiration time for the DNS record; relative or absolute depends on flags, network byte order...
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
uint32_t record_type
Type of the GNS/DNS record.
#define GNUNET_PACKED
gcc-ism to get packed structs.
uint32_t record_type
Type of the GNS/DNS record, network byte order.
enum GNUNET_GNSRECORD_Flags flags
Flags for the record.
uint32_t data
The data value.
char * GNUNET_GNSRECORD_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the 'value' of a record to a string.
Internal format of a record in the serialized form.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
#define GNUNET_free(ptr)
Wrapper around free.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...