diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-05 04:56:08 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-05 04:56:08 +0200 |
commit | 4cf3389fcf094c095d685a3e9f65a5d1fafff717 (patch) | |
tree | 28178dbd858ea08fda978c9aa63e8dd28bd16b6c /ffd/ffd.c | |
parent | bb7392551ed8578171941b81cf3ed2cfc4ad2b1b (diff) | |
download | ffd-4cf3389fcf094c095d685a3e9f65a5d1fafff717.tar ffd-4cf3389fcf094c095d685a3e9f65a5d1fafff717.zip |
Add ack request handling
Diffstat (limited to 'ffd/ffd.c')
-rw-r--r-- | ffd/ffd.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -191,6 +191,17 @@ static inline ffd_neigh_t* get_tlv_neigh(handle_tlv_arg_t *arg) { return ffd_neigh_get(arg->iface, arg->addr); } +static void handle_tlv_ack_req(const ffd_tlv_ack_req_t *tlv_req, size_t len, handle_tlv_arg_t *arg) { + if (len < sizeof(ffd_tlv_ack_req_t)) { + fprintf(stderr, "warn: received short acknowledement request TLV.\n"); + return; + } + + ffd_neigh_t *neigh = get_tlv_neigh(arg); + + ffd_send_ack(arg->iface, neigh, ntohs(tlv_req->nonce)); +} + static void handle_tlv_hello(const ffd_tlv_hello_t *tlv_hello, size_t len, handle_tlv_arg_t *arg) { if (len < sizeof(ffd_tlv_hello_t)) { fprintf(stderr, "warn: received short hello TLV.\n"); @@ -392,6 +403,14 @@ static void handle_tlv_announce_req(const ffd_tlv_announce_req_t *tlv_req, size_ static void handle_tlv(ffd_tlv_type_t type, const void *data, size_t len, void *arg) { switch (type) { + case TLV_ACK_REQ: + handle_tlv_ack_req(data, len, arg); + return; + + case TLV_ACK: + /* we don't send ack reqs */ + return; + case TLV_HELLO: handle_tlv_hello(data, len, arg); return; |