diff options
Diffstat (limited to 'src/send.c')
-rw-r--r-- | src/send.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -44,22 +44,22 @@ static inline bool send_neigh(gmrf_t *gmrf, const gp_babel_neigh_t *neigh, const } void gp_babel_send_ack(gmrf_t *gmrf, gmrf_context_t *ctx, gp_babel_neigh_t *neigh, uint16_t nonce) { - gp_babel_packet_t *packet = gp_babel_packet_alloca(GP_BABEL_PACKET_MAX); + gp_babel_packet_buf_t *buf = gp_babel_packet_alloca(GP_BABEL_PACKET_MAX); - gp_babel_tlv_ack_t *ack = gp_babel_tlv_add(packet, GP_BABEL_PACKET_MAX, TLV_ACK, sizeof(gp_babel_tlv_ack_t)); + gp_babel_tlv_ack_t *ack = gp_babel_tlv_add(buf, TLV_ACK, sizeof(gp_babel_tlv_ack_t)); if (!ack) return; ack->nonce = htons(nonce); - send_neigh(gmrf, neigh, packet); + send_neigh(gmrf, neigh, &buf->packet); } -static void add_ihus(gmrf_t *gmrf, gp_babel_packet_t *packet, size_t max_len, const gp_babel_iface_t *iface) { +static void add_ihus(gmrf_t *gmrf, gp_babel_packet_buf_t *buf, const gp_babel_iface_t *iface) { const gp_babel_neigh_t *neigh; for (neigh = iface->neighbours; neigh; neigh = neigh->next) { - gp_babel_tlv_ihu_t *ihu = gp_babel_tlv_add(packet, GP_BABEL_PACKET_MAX, TLV_IHU, sizeof(gp_babel_tlv_ihu_t)+sizeof(gmrf_addr_t)); + gp_babel_tlv_ihu_t *ihu = gp_babel_tlv_add(buf, TLV_IHU, sizeof(gp_babel_tlv_ihu_t)+sizeof(gmrf_addr_t)); if (!ihu) return; @@ -74,25 +74,25 @@ static void add_ihus(gmrf_t *gmrf, gp_babel_packet_t *packet, size_t max_len, co void gp_babel_send_hellos(gmrf_t *gmrf, gmrf_context_t *ctx) { gmrf_logf(gmrf, LOG_DEBUG, "sending hellos..."); - gp_babel_packet_t *packet = gp_babel_packet_alloca(GP_BABEL_PACKET_MAX); + gp_babel_packet_buf_t *buf = gp_babel_packet_alloca(GP_BABEL_PACKET_MAX); - gp_babel_tlv_hello_t *hello = gp_babel_tlv_add(packet, GP_BABEL_PACKET_MAX, TLV_HELLO, sizeof(gp_babel_tlv_hello_t)); + gp_babel_tlv_hello_t *hello = gp_babel_tlv_add(buf, TLV_HELLO, sizeof(gp_babel_tlv_hello_t)); if (!hello) return; hello->reserved = 0; hello->interval = htons(GP_BABEL_HELLO_INTERVAL); - uint16_t len = packet->len; + uint16_t len = buf->packet.len; gp_babel_iface_t *iface; for (iface = ctx->interfaces; iface; iface = iface->next) { hello->seqno = htons(iface->seqno++); - packet->len = len; + buf->packet.len = len; - add_ihus(gmrf, packet, GP_BABEL_PACKET_MAX, iface); + add_ihus(gmrf, buf, iface); - gmrf_iface_send_bc(gmrf, iface->gmrf_iface, packet, gp_babel_packet_size(packet)); + gmrf_iface_send_bc(gmrf, iface->gmrf_iface, &buf->packet, gp_babel_packet_size(&buf->packet)); } } |