summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-10-30 12:34:23 -0400
committerAndrew Opalach <andrew@akon.city> 2025-10-30 12:34:23 -0400
commit5edcdda9efadd7c6ff5a47bef2897c0eb995057f (patch)
tree022b48f98bd3395724ee6a1fb7df4d5b4e2e7118 /src
parent9b7755c4c868cbf05da934644a3a3be2ea594170 (diff)
downloadlibnaunet-5edcdda9efadd7c6ff5a47bef2897c0eb995057f.tar.gz
libnaunet-5edcdda9efadd7c6ff5a47bef2897c0eb995057f.tar.bz2
libnaunet-5edcdda9efadd7c6ff5a47bef2897c0eb995057f.zip
Add opaque field back to packet
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src')
-rw-r--r--src/util/packet.c4
-rw-r--r--src/util/packet.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/src/util/packet.c b/src/util/packet.c
index c991a7f..dfac9af 100644
--- a/src/util/packet.c
+++ b/src/util/packet.c
@@ -17,6 +17,7 @@ struct nn_packet *nn_packet_clone(struct nn_packet *packet)
al_memcpy(nn_buffer_get_ptr(&c->buffer, 0), nn_buffer_get_ptr(&packet->buffer, 0), size);
c->windex = packet->windex;
c->rindex = packet->rindex;
+ c->opaque = packet->opaque;
return c;
}
@@ -25,6 +26,7 @@ void nn_packet_reset(struct nn_packet *packet)
nn_buffer_ensure_space(&packet->buffer, NNWT_PACKET_HEADER_LENGTH);
packet->rindex = NNWT_PACKET_HEADER_LENGTH;
packet->windex = NNWT_PACKET_HEADER_LENGTH;
+ packet->opaque = NULL;
}
void nn_packet_write_size(struct nn_packet *packet)
@@ -116,7 +118,7 @@ void nn_packet_read_buffer(struct nn_packet *packet, struct nn_buffer *buf)
{
u64 size;
NNWT_PACKET_READ_TYPE(packet, u64, size);
- al_assert((sizeof(size_t) > 4 || size <= INT32_MAX));
+ al_assert(sizeof(size_t) > 4 || size <= INT32_MAX);
buf->size = (size_t)size;
NNWT_PACKET_READ_DATA(packet, buf->size, buf->data);
buf->alloc = 0;
diff --git a/src/util/packet.h b/src/util/packet.h
index 1f76559..c8d9400 100644
--- a/src/util/packet.h
+++ b/src/util/packet.h
@@ -13,6 +13,7 @@ struct nn_packet {
struct nn_buffer buffer;
u32 rindex;
u32 windex;
+ void *opaque;
};
#define NNWT_PACKET_WRITE_TYPE(p, type, v) \