diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-03-21 03:07:51 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-03-21 03:07:51 +0100 |
commit | 2d369f16e420f01f0fc5cbc168ccc662d3328a43 (patch) | |
tree | 03d083055370a031bebd23ec9d0fd37488445eb9 /src/tlv_types.c | |
parent | e099bddc24fad6c628e29284a585bd50404768b6 (diff) | |
download | babel-2d369f16e420f01f0fc5cbc168ccc662d3328a43.tar babel-2d369f16e420f01f0fc5cbc168ccc662d3328a43.zip |
Implement ACK request handling
Diffstat (limited to 'src/tlv_types.c')
-rw-r--r-- | src/tlv_types.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/tlv_types.c b/src/tlv_types.c index a3f1fbb..9c485f2 100644 --- a/src/tlv_types.c +++ b/src/tlv_types.c @@ -43,6 +43,24 @@ static inline gp_babel_neigh_t* get_tlv_neigh(handle_tlv_arg_t *arg) { return gp_babel_neigh_get(arg->iface, arg->source); } +static void handle_tlv_ack_req(gmrf_t *gmrf, gmrf_context_t *ctx, const gp_babel_tlv_ack_req_t *tlv_req, size_t len, handle_tlv_arg_t *arg) { + if (len < sizeof(gp_babel_tlv_ack_req_t)) { + gmrf_logf(gmrf, LOG_WARNING, "received short acknowledement request TLV."); + return; + } + + gp_babel_send_ack(gmrf, ctx, get_tlv_neigh(arg), ntohs(tlv_req->nonce)); +} + +static void handle_tlv_ack(gmrf_t *gmrf, gmrf_context_t *ctx, const gp_babel_tlv_ack_t *tlv_ack, size_t len, handle_tlv_arg_t *arg) { + if (len < sizeof(gp_babel_tlv_ack_t)) { + gmrf_logf(gmrf, LOG_WARNING, "received short acknowledement TLV."); + return; + } + + //gp_babel_ack_handle(ntohs(tlv_ack->nonce)); +} + static void handle_tlv_hello(gmrf_t *gmrf, gmrf_context_t *ctx, const gp_babel_tlv_hello_t *tlv_hello, size_t len, handle_tlv_arg_t *arg) { if (len < sizeof(gp_babel_tlv_hello_t)) { gmrf_logf(gmrf, LOG_WARNING, "received short hello TLV."); @@ -122,6 +140,14 @@ static void handle_tlv(gmrf_t *gmrf, gmrf_context_t *ctx, gp_babel_tlv_type_t ty handle_tlv_arg_t *tlv_arg = arg; switch (type) { + case TLV_ACK_REQ: + handle_tlv_ack_req(gmrf, ctx, data, len, tlv_arg); + return; + + case TLV_ACK: + handle_tlv_ack(gmrf, ctx, data, len, tlv_arg); + return; + case TLV_HELLO: handle_tlv_hello(gmrf, ctx, data, len, tlv_arg); return; |