Merged from trunk: removed empty function autoip_init() (converted to an empty define)

This commit is contained in:
goldsimon 2011-12-14 21:46:47 +01:00
parent 3306641708
commit a91d8e7395
2 changed files with 13 additions and 22 deletions

View File

@ -122,14 +122,6 @@ static err_t autoip_bind(struct netif *netif);
/* start sending probes for llipaddr */ /* start sending probes for llipaddr */
static void autoip_start_probing(struct netif *netif); static void autoip_start_probing(struct netif *netif);
/**
* Initialize this module
*/
void
autoip_init(void)
{
LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, ("autoip_init()\n"));
}
/** Set a statically allocated struct autoip to work with. /** Set a statically allocated struct autoip to work with.
* Using this prevents autoip_start to allocate it using mem_malloc. * Using this prevents autoip_start to allocate it using mem_malloc.
@ -170,8 +162,8 @@ autoip_handle_arp_conflict(struct netif *netif)
/* Somehow detect if we are defending or retreating */ /* Somehow detect if we are defending or retreating */
unsigned char defend = 1; /* tbd */ unsigned char defend = 1; /* tbd */
if(defend) { if (defend) {
if(netif->autoip->lastconflict > 0) { if (netif->autoip->lastconflict > 0) {
/* retreat, there was a conflicting ARP in the last /* retreat, there was a conflicting ARP in the last
* DEFEND_INTERVAL seconds * DEFEND_INTERVAL seconds
*/ */
@ -295,7 +287,7 @@ autoip_start(struct netif *netif)
struct autoip *autoip = netif->autoip; struct autoip *autoip = netif->autoip;
err_t result = ERR_OK; err_t result = ERR_OK;
if(netif_is_up(netif)) { if (netif_is_up(netif)) {
netif_set_down(netif); netif_set_down(netif);
} }
@ -309,12 +301,12 @@ autoip_start(struct netif *netif)
LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
("autoip_start(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], ("autoip_start(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0],
netif->name[1], (u16_t)netif->num)); netif->name[1], (u16_t)netif->num));
if(autoip == NULL) { if (autoip == NULL) {
/* no AutoIP client attached yet? */ /* no AutoIP client attached yet? */
LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE,
("autoip_start(): starting new AUTOIP client\n")); ("autoip_start(): starting new AUTOIP client\n"));
autoip = (struct autoip *)mem_malloc(sizeof(struct autoip)); autoip = (struct autoip *)mem_malloc(sizeof(struct autoip));
if(autoip == NULL) { if (autoip == NULL) {
LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE,
("autoip_start(): could not allocate autoip\n")); ("autoip_start(): could not allocate autoip\n"));
return ERR_MEM; return ERR_MEM;
@ -360,7 +352,7 @@ autoip_start_probing(struct netif *netif)
* accquiring and probing address * accquiring and probing address
* compliant to RFC 3927 Section 2.2.1 * compliant to RFC 3927 Section 2.2.1
*/ */
if(autoip->tried_llipaddr > MAX_CONFLICTS) { if (autoip->tried_llipaddr > MAX_CONFLICTS) {
autoip->ttw = RATE_LIMIT_INTERVAL * AUTOIP_TICKS_PER_SECOND; autoip->ttw = RATE_LIMIT_INTERVAL * AUTOIP_TICKS_PER_SECOND;
} }
} }
@ -404,7 +396,7 @@ autoip_tmr()
while (netif != NULL) { while (netif != NULL) {
/* only act on AutoIP configured interfaces */ /* only act on AutoIP configured interfaces */
if (netif->autoip != NULL) { if (netif->autoip != NULL) {
if(netif->autoip->lastconflict > 0) { if (netif->autoip->lastconflict > 0) {
netif->autoip->lastconflict--; netif->autoip->lastconflict--;
} }
@ -414,10 +406,10 @@ autoip_tmr()
switch(netif->autoip->state) { switch(netif->autoip->state) {
case AUTOIP_STATE_PROBING: case AUTOIP_STATE_PROBING:
if(netif->autoip->ttw > 0) { if (netif->autoip->ttw > 0) {
netif->autoip->ttw--; netif->autoip->ttw--;
} else { } else {
if(netif->autoip->sent_num >= PROBE_NUM) { if (netif->autoip->sent_num >= PROBE_NUM) {
netif->autoip->state = AUTOIP_STATE_ANNOUNCING; netif->autoip->state = AUTOIP_STATE_ANNOUNCING;
netif->autoip->sent_num = 0; netif->autoip->sent_num = 0;
netif->autoip->ttw = ANNOUNCE_WAIT * AUTOIP_TICKS_PER_SECOND; netif->autoip->ttw = ANNOUNCE_WAIT * AUTOIP_TICKS_PER_SECOND;
@ -439,10 +431,10 @@ autoip_tmr()
break; break;
case AUTOIP_STATE_ANNOUNCING: case AUTOIP_STATE_ANNOUNCING:
if(netif->autoip->ttw > 0) { if (netif->autoip->ttw > 0) {
netif->autoip->ttw--; netif->autoip->ttw--;
} else { } else {
if(netif->autoip->sent_num == 0) { if (netif->autoip->sent_num == 0) {
/* We are here the first time, so we waited ANNOUNCE_WAIT seconds /* We are here the first time, so we waited ANNOUNCE_WAIT seconds
* Now we can bind to an IP address and use it. * Now we can bind to an IP address and use it.
* *
@ -458,7 +450,7 @@ autoip_tmr()
netif->autoip->ttw = ANNOUNCE_INTERVAL * AUTOIP_TICKS_PER_SECOND; netif->autoip->ttw = ANNOUNCE_INTERVAL * AUTOIP_TICKS_PER_SECOND;
netif->autoip->sent_num++; netif->autoip->sent_num++;
if(netif->autoip->sent_num >= ANNOUNCE_NUM) { if (netif->autoip->sent_num >= ANNOUNCE_NUM) {
netif->autoip->state = AUTOIP_STATE_BOUND; netif->autoip->state = AUTOIP_STATE_BOUND;
netif->autoip->sent_num = 0; netif->autoip->sent_num = 0;
netif->autoip->ttw = 0; netif->autoip->ttw = 0;

View File

@ -89,8 +89,7 @@ struct autoip
}; };
/** Init srand, has to be called before entering mainloop */ #define autoip_init() /* Compatibility define, no init needed. */
void autoip_init(void);
/** Set a struct autoip allocated by the application to work with */ /** Set a struct autoip allocated by the application to work with */
void autoip_set_struct(struct netif *netif, struct autoip *autoip); void autoip_set_struct(struct netif *netif, struct autoip *autoip);