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
This commit is contained in:
fros4943 2009-11-13 09:10:24 +00:00
parent 26bb5ecd21
commit 583dd11c55
2 changed files with 11 additions and 9 deletions

View file

@ -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;

View file

@ -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,7 +133,7 @@ rime_init(const struct mac_driver *m)
#endif /* ! RIME_CONF_NO_POLITE_ANNOUCEMENTS */
}
/*---------------------------------------------------------------------------*/
void
int
rime_output(void)
{
struct rime_sniffer *s;
@ -142,15 +142,17 @@ rime_output(void)
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;
}
/*---------------------------------------------------------------------------*/
/** @} */