aboutsummaryrefslogtreecommitdiff
path: root/src/gnsrecord/gnsrecord_serialization.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnsrecord/gnsrecord_serialization.c')
-rw-r--r--src/gnsrecord/gnsrecord_serialization.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gnsrecord/gnsrecord_serialization.c b/src/gnsrecord/gnsrecord_serialization.c
index e2cabafd3..190f62fc2 100644
--- a/src/gnsrecord/gnsrecord_serialization.c
+++ b/src/gnsrecord/gnsrecord_serialization.c
@@ -48,7 +48,7 @@ struct NetworkRecord
48 48
49 /** 49 /**
50 * Expiration time for the DNS record; relative or absolute depends 50 * Expiration time for the DNS record; relative or absolute depends
51 * on 'flags', network byte order. 51 * on @e flags, network byte order.
52 */ 52 */
53 uint64_t expiration_time GNUNET_PACKED; 53 uint64_t expiration_time GNUNET_PACKED;
54 54
@@ -119,24 +119,26 @@ GNUNET_GNSRECORD_records_serialize (unsigned int rd_count,
119 off = 0; 119 off = 0;
120 for (i=0;i<rd_count;i++) 120 for (i=0;i<rd_count;i++)
121 { 121 {
122#if 0
123 LOG (GNUNET_ERROR_TYPE_DEBUG, 122 LOG (GNUNET_ERROR_TYPE_DEBUG,
124 "Serializing record %u with flags %d and expiration time %llu\n", 123 "Serializing record %u with flags %d and expiration time %llu\n",
125 i, 124 i,
126 rd[i].flags, 125 rd[i].flags,
127 (unsigned long long) rd[i].expiration_time); 126 (unsigned long long) rd[i].expiration_time);
128#endif
129 rec.expiration_time = GNUNET_htonll (rd[i].expiration_time); 127 rec.expiration_time = GNUNET_htonll (rd[i].expiration_time);
130 rec.data_size = htonl ((uint32_t) rd[i].data_size); 128 rec.data_size = htonl ((uint32_t) rd[i].data_size);
131 rec.record_type = htonl (rd[i].record_type); 129 rec.record_type = htonl (rd[i].record_type);
132 rec.flags = htonl (rd[i].flags); 130 rec.flags = htonl (rd[i].flags);
133 if (off + sizeof (rec) > dest_size) 131 if (off + sizeof (rec) > dest_size)
134 return -1; 132 return -1;
135 GNUNET_memcpy (&dest[off], &rec, sizeof (rec)); 133 GNUNET_memcpy (&dest[off],
134 &rec,
135 sizeof (rec));
136 off += sizeof (rec); 136 off += sizeof (rec);
137 if (off + rd[i].data_size > dest_size) 137 if (off + rd[i].data_size > dest_size)
138 return -1; 138 return -1;
139 GNUNET_memcpy (&dest[off], rd[i].data, rd[i].data_size); 139 GNUNET_memcpy (&dest[off],
140 rd[i].data,
141 rd[i].data_size);
140 off += rd[i].data_size; 142 off += rd[i].data_size;
141 } 143 }
142 return off; 144 return off;
@@ -177,13 +179,11 @@ GNUNET_GNSRECORD_records_deserialize (size_t len,
177 return GNUNET_SYSERR; 179 return GNUNET_SYSERR;
178 dest[i].data = &src[off]; 180 dest[i].data = &src[off];
179 off += dest[i].data_size; 181 off += dest[i].data_size;
180#if 0
181 LOG (GNUNET_ERROR_TYPE_DEBUG, 182 LOG (GNUNET_ERROR_TYPE_DEBUG,
182 "Deserialized record %u with flags %d and expiration time %llu\n", 183 "Deserialized record %u with flags %d and expiration time %llu\n",
183 i, 184 i,
184 dest[i].flags, 185 dest[i].flags,
185 (unsigned long long) dest[i].expiration_time); 186 (unsigned long long) dest[i].expiration_time);
186#endif
187 } 187 }
188 return GNUNET_OK; 188 return GNUNET_OK;
189} 189}