From 583dd11c55c773904cfc51b17575361ca9993ef3 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Fri, 13 Nov 2009 09:10:24 +0000 Subject: [PATCH] rime_output() now returns RIME_OK or RIME_ERR depending on the MAC return value. this patch may affect Rime sniffers running on top of MAC protocols that do not yet return generic MAC return values --- core/net/rime.h | 4 ++-- core/net/rime/rime.c | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/core/net/rime.h b/core/net/rime.h index 3512bedc8..db46f21d3 100644 --- a/core/net/rime.h +++ b/core/net/rime.h @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rime.h,v 1.23 2009/03/17 20:28:44 nvt-se Exp $ + * $Id: rime.h,v 1.24 2009/11/13 09:10:25 fros4943 Exp $ */ /** @@ -106,7 +106,7 @@ void rime_input(void); void rime_driver_send(void); void rime_set_output(void (*output_function)(void)); -void rime_output(void); +int rime_output(void); extern const struct mac_driver *rime_mac; diff --git a/core/net/rime/rime.c b/core/net/rime/rime.c index 08968e4bb..1e05f79be 100644 --- a/core/net/rime/rime.c +++ b/core/net/rime/rime.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rime.c,v 1.21 2009/03/12 21:58:21 adamdunkels Exp $ + * $Id: rime.c,v 1.22 2009/11/13 09:10:24 fros4943 Exp $ */ /** @@ -133,24 +133,26 @@ rime_init(const struct mac_driver *m) #endif /* ! RIME_CONF_NO_POLITE_ANNOUCEMENTS */ } /*---------------------------------------------------------------------------*/ -void +int rime_output(void) { struct rime_sniffer *s; - + RIMESTATS_ADD(tx); packetbuf_compact(); if(rime_mac) { - if(rime_mac->send()) { + if(rime_mac->send() == MAC_TX_OK) { /* Call sniffers, but only if the packet was sent. */ for(s = list_head(sniffers); s != NULL; s = s->next) { - if(s->output_callback != NULL) { - s->output_callback(); - } + if(s->output_callback != NULL) { + s->output_callback(); + } } + return RIME_OK; } } + return RIME_ERR; } /*---------------------------------------------------------------------------*/ /** @} */