Merge pull request #456 from adamdunkels/push/6lowpan-changes

6lowpan changes
This commit is contained in:
Nicolas Tsiftes 2013-11-24 15:37:12 -08:00
commit acee82abbb
2 changed files with 18 additions and 1 deletions

View file

@ -257,6 +257,8 @@ static struct timer reass_timer;
#define sicslowpan_len uip_len #define sicslowpan_len uip_len
#endif /* SICSLOWPAN_CONF_FRAG */ #endif /* SICSLOWPAN_CONF_FRAG */
static int last_rssi;
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* Rime Sniffer support for one single listener to enable powertrace of IP */ /* Rime Sniffer support for one single listener to enable powertrace of IP */
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
@ -1604,6 +1606,9 @@ input(void)
/* The MAC puts the 15.4 payload inside the RIME data buffer */ /* The MAC puts the 15.4 payload inside the RIME data buffer */
rime_ptr = packetbuf_dataptr(); rime_ptr = packetbuf_dataptr();
/* Save the RSSI of the incoming packet in case the upper layer will
want to query us for it later. */
last_rssi = (signed short)packetbuf_attr(PACKETBUF_ATTR_RSSI);
#if SICSLOWPAN_CONF_FRAG #if SICSLOWPAN_CONF_FRAG
/* if reassembly timed out, cancel it */ /* if reassembly timed out, cancel it */
if(timer_expired(&reass_timer)) { if(timer_expired(&reass_timer)) {
@ -1666,7 +1671,12 @@ input(void)
*/ */
#define PRIORITIZE_NEW_PACKETS 1 #define PRIORITIZE_NEW_PACKETS 1
#if PRIORITIZE_NEW_PACKETS #if PRIORITIZE_NEW_PACKETS
if(processed_ip_in_len > 0 && first_fragment
if(!is_fragment) {
/* Prioritize non-fragment packets too. */
sicslowpan_len = 0;
processed_ip_in_len = 0;
} else if(processed_ip_in_len > 0 && first_fragment
&& !rimeaddr_cmp(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER))) { && !rimeaddr_cmp(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER))) {
sicslowpan_len = 0; sicslowpan_len = 0;
processed_ip_in_len = 0; processed_ip_in_len = 0;
@ -1900,6 +1910,12 @@ sicslowpan_init(void)
#endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_HC06 */ #endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_HC06 */
} }
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
int
sicslowpan_get_last_rssi(void)
{
return last_rssi;
}
/*--------------------------------------------------------------------*/
const struct network_driver sicslowpan_driver = { const struct network_driver sicslowpan_driver = {
"sicslowpan", "sicslowpan",
sicslowpan_init, sicslowpan_init,

View file

@ -317,6 +317,7 @@ struct sicslowpan_nh_compressor {
}; };
int sicslowpan_get_last_rssi(void);
extern const struct network_driver sicslowpan_driver; extern const struct network_driver sicslowpan_driver;