diff options
Diffstat (limited to 'src/tlv.c')
-rw-r--r-- | src/tlv.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -57,18 +57,18 @@ bool gp_babel_tlv_parse(gmrf_t *gmrf, gmrf_context_t *ctx, const gp_babel_packet return true; } -void* gp_babel_tlv_add(gp_babel_packet_t *packet, size_t max_len, gp_babel_tlv_type_t type, size_t len) { - size_t pktlen = ntohs(packet->len); +void* gp_babel_tlv_add(gp_babel_packet_buf_t *buf, gp_babel_tlv_type_t type, size_t len) { + size_t pktlen = ntohs(buf->packet.len); - if (pktlen+len+2 > max_len) + if (pktlen+len+2 > buf->max_len) return NULL; - uint8_t *data = packet->tlv+pktlen+2; + uint8_t *data = buf->packet.tlv+pktlen+2; data[-2] = type; data[-1] = len; - packet->len = htons(pktlen+len+2); + buf->packet.len = htons(pktlen+len+2); return data; } |