Replaced function with macro.

This commit is contained in:
oliverschmidt 2007-05-20 00:04:18 +00:00
parent 61f54204d7
commit c32b2ca581
2 changed files with 11 additions and 11 deletions

View File

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: tcpip.c,v 1.6 2007/05/08 08:28:59 bg- Exp $
* $Id: tcpip.c,v 1.7 2007/05/20 00:04:18 oliverschmidt Exp $
*/
#include "contiki-conf.h"
@ -66,23 +66,17 @@ enum {
PACKET_INPUT
};
static unsigned char forwarding; /* Forwarding enabled. */
unsigned char tcpip_do_forwarding; /* Forwarding enabled. */
unsigned char tcpip_is_forwarding; /* Forwarding right now? */
PROCESS(tcpip_process, "TCP/IP stack");
/*---------------------------------------------------------------------------*/
void
tcpip_set_forwarding(unsigned char f)
{
forwarding = f;
}
/*---------------------------------------------------------------------------*/
static void
packet_input(void)
{
if(uip_len > 0) {
if(forwarding) {
if(tcpip_do_forwarding) {
tcpip_is_forwarding = 1;
if(uip_fw_forward() == UIP_FW_LOCAL) {
tcpip_is_forwarding = 0;

View File

@ -60,7 +60,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: tcpip.h,v 1.8 2007/05/08 08:29:18 bg- Exp $
* $Id: tcpip.h,v 1.9 2007/05/20 00:04:18 oliverschmidt Exp $
*/
#ifndef __TCPIP_H__
#define __TCPIP_H__
@ -297,13 +297,19 @@ CCIF extern process_event_t tcpip_event;
CCIF void tcpip_input(void);
void tcpip_output(void);
void tcpip_set_forwarding(unsigned char f);
/*
* Is forwarding generally enabled?
*/
extern unsigned char tcpip_do_forwarding;
/*
* Are we at the moment forwarding the contents of uip_buf[]?
*/
extern unsigned char tcpip_is_forwarding;
#define tcpip_set_forwarding(forwarding) tcpip_do_forwarding = (forwarding)
/** @} */
PROCESS_NAME(tcpip_process);