cleaned up

This commit is contained in:
Markus Fröschle
2014-01-07 05:57:17 +00:00
parent e365f91254
commit 785ca43b11
8 changed files with 24 additions and 18 deletions

View File

@@ -11,7 +11,7 @@
#include <stdbool.h>
#include <stddef.h>
#define DBG_ARP
//#define DBG_ARP
#ifdef DBG_ARP
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0)
#else

View File

@@ -11,7 +11,7 @@
#include <stddef.h>
#include "bas_printf.h"
#define DBG_BOOTP
//#define DBG_BOOTP
#ifdef DBG_BOOTP
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0)
#else

View File

@@ -18,7 +18,7 @@
#include "bas_printf.h"
#include "util.h"
#include "am79c874.h"
#include "bcm5222.h"
//#include "bcm5222.h"
#include <stdbool.h>
#if defined(MACHINE_FIREBEE)

View File

@@ -289,6 +289,8 @@ void ip_handler(NIF *nif, NBUF *pNbuf)
*/
if (!validate_ip_hdr(nif, ipframe))
{
dbg("%s: not a valid IP packet!\r\n", __FUNCTION__);
nbuf_free(pNbuf);
return;
}
@@ -308,6 +310,8 @@ void ip_handler(NIF *nif, NBUF *pNbuf)
udp_handler(nif,pNbuf);
break;
default:
dbg("%s: no protocol handler registered for protocol %d\r\n",
__FUNCTION__, IP_PROTOCOL(ipframe));
nbuf_free(pNbuf);
break;
}

View File

@@ -39,6 +39,7 @@ void udp_init(void)
for (index = 0; index < UDP_MAX_PORTS; ++index)
{
udp_port_table[index].port = 0;
udp_port_table[index].handler = 0;
}
udp_port = DEFAULT_UDP_PORT; /* next free port */
@@ -88,7 +89,7 @@ static void *udp_port_handler(uint16_t port)
{
if (udp_port_table[index].port == port)
{
return (void *)udp_port_table[index].handler;
return (void *) udp_port_table[index].handler;
}
}
return NULL;
@@ -116,7 +117,7 @@ int udp_send(NIF *nif, uint8_t *dest, int sport, int dport, NBUF *pNbuf)
}
/*
* This function takes data and creates a UDP frame and
* This function takes data, creates a UDP frame from it and
* passes it onto the IP layer
*/
udp_frame_hdr *udpframe;