Microchip® Advanced Software Framework

autoip.h File Reference

AutoIP Automatic LinkLocal IP Configuration.

#include "lwip/opt.h"
#include "lwip/netif.h"
#include "lwip/udp.h"
#include "netif/etharp.h"

Data Structures

struct  autoip
 

Macros

#define ANNOUNCE_INTERVAL   2 /* seconds (time between announcement packets) */
 
#define ANNOUNCE_NUM   2 /* (number of announcement packets) */
 
#define ANNOUNCE_WAIT   2 /* seconds (delay before announcing) */
 
#define autoip_init()   /* Compatibility define, no init needed. */
 
#define autoip_remove_struct(netif)   do { (netif)->autoip = NULL; } while (0)
 Remove a struct autoip previously set to the netif using autoip_set_struct() More...
 
#define AUTOIP_STATE_ANNOUNCING   2
 
#define AUTOIP_STATE_BOUND   3
 
#define AUTOIP_STATE_OFF   0
 
#define AUTOIP_STATE_PROBING   1
 
#define AUTOIP_TICKS_PER_SECOND   (1000 / AUTOIP_TMR_INTERVAL)
 
#define AUTOIP_TMR_INTERVAL   100
 
#define DEFEND_INTERVAL   10 /* seconds (min. wait between defensive ARPs) */
 
#define MAX_CONFLICTS   10 /* (max conflicts before rate limiting) */
 
#define PROBE_MAX   2 /* seconds (maximum delay till repeated probe) */
 
#define PROBE_MIN   1 /* second (minimum delay till repeated probe) */
 
#define PROBE_NUM   3 /* (number of probe packets) */
 
#define PROBE_WAIT   1 /* second (initial random delay) */
 
#define RATE_LIMIT_INTERVAL   60 /* seconds (delay between successive attempts) */
 

Functions

void autoip_arp_reply (struct netif *netif, struct etharp_hdr *hdr)
 Handles every incoming ARP Packet, called by etharp_arp_input. More...
 
void autoip_network_changed (struct netif *netif)
 Handle a possible change in the network configuration. More...
 
void autoip_set_struct (struct netif *netif, struct autoip *autoip)
 Set a struct autoip allocated by the application to work with. More...
 
err_t autoip_start (struct netif *netif)
 Start AutoIP client. More...
 
err_t autoip_stop (struct netif *netif)
 Stop AutoIP client. More...
 
void autoip_tmr (void)
 Has to be called in loop every AUTOIP_TMR_INTERVAL milliseconds. More...
 

#define ANNOUNCE_INTERVAL   2 /* seconds (time between announcement packets) */

Referenced by autoip_tmr().

#define ANNOUNCE_NUM   2 /* (number of announcement packets) */

Referenced by autoip_tmr().

#define ANNOUNCE_WAIT   2 /* seconds (delay before announcing) */

Referenced by autoip_tmr().

#define autoip_init ( )    /* Compatibility define, no init needed. */

Referenced by lwip_init().

#define autoip_remove_struct (   netif)    do { (netif)->autoip = NULL; } while (0)

Remove a struct autoip previously set to the netif using autoip_set_struct()

#define AUTOIP_STATE_ANNOUNCING   2

Referenced by autoip_arp_reply(), and autoip_tmr().

#define AUTOIP_STATE_BOUND   3

Referenced by autoip_tmr().

#define AUTOIP_STATE_OFF   0
#define AUTOIP_STATE_PROBING   1
#define AUTOIP_TICKS_PER_SECOND   (1000 / AUTOIP_TMR_INTERVAL)
#define AUTOIP_TMR_INTERVAL   100

Referenced by autoip_timer(), and sys_timeouts_init().

#define DEFEND_INTERVAL   10 /* seconds (min. wait between defensive ARPs) */
#define MAX_CONFLICTS   10 /* (max conflicts before rate limiting) */

Referenced by autoip_start_probing().

#define PROBE_MAX   2 /* seconds (maximum delay till repeated probe) */

Referenced by autoip_tmr().

#define PROBE_MIN   1 /* second (minimum delay till repeated probe) */

Referenced by autoip_tmr().

#define PROBE_NUM   3 /* (number of probe packets) */

Referenced by autoip_tmr().

#define PROBE_WAIT   1 /* second (initial random delay) */

Referenced by autoip_start_probing().

#define RATE_LIMIT_INTERVAL   60 /* seconds (delay between successive attempts) */

Referenced by autoip_start_probing().

void autoip_arp_reply ( struct netif netif,
struct etharp_hdr hdr 
)

Handles every incoming ARP Packet, called by etharp_arp_input.

Parameters
netifnetwork interface to use for autoip processing
hdrIncoming ARP packet

References netif::autoip, AUTOIP_DEBUG, autoip_handle_arp_conflict(), autoip_restart(), AUTOIP_STATE_ANNOUNCING, AUTOIP_STATE_OFF, AUTOIP_STATE_PROBING, eth_addr_cmp, ETHADDR16_COPY, netif::hwaddr, ip_addr_cmp, IPADDR2_COPY, autoip::llipaddr, LWIP_DBG_LEVEL_WARNING, LWIP_DBG_STATE, LWIP_DBG_TRACE, LWIP_DEBUGF, NULL, autoip::sent_num, and autoip::state.

Referenced by etharp_arp_input().

void autoip_network_changed ( struct netif netif)

Handle a possible change in the network configuration.

If there is an AutoIP address configured, take the interface down and begin probing with the same address.

References netif::autoip, autoip_start_probing(), AUTOIP_STATE_OFF, netif_set_down(), and autoip::state.

Referenced by netif_set_link_up().

void autoip_set_struct ( struct netif netif,
struct autoip autoip 
)

Set a struct autoip allocated by the application to work with.

Set a struct autoip allocated by the application to work with.

Using this prevents autoip_start to allocate it using mem_malloc.

Parameters
netifthe netif for which to set the struct autoip
dhcp(uninitialised) dhcp struct allocated by the application

References netif::autoip, LWIP_ASSERT, and NULL.

err_t autoip_stop ( struct netif netif)

Stop AutoIP client.

Parameters
netifnetwork interface on which stop the AutoIP client

References netif::autoip, AUTOIP_STATE_OFF, ERR_OK, netif_set_down(), and autoip::state.

Referenced by dhcp_bind(), dhcp_network_changed(), dhcp_stop(), and net_interface_down_imp().