lwIP 2.0.0  lwIP 2.0.0
LightweightIPstack
autoip.c File Reference
#include "lwip/opt.h"
#include "lwip/mem.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h"
#include "lwip/autoip.h"
#include "lwip/etharp.h"
#include <stdlib.h>
#include <string.h>

Macros

#define LWIP_AUTOIP_RAND(netif)
 
#define LWIP_AUTOIP_CREATE_SEED_ADDR(netif)
 

Functions

void autoip_set_struct (struct netif *netif, struct autoip *autoip)
 
err_t autoip_start (struct netif *netif)
 
void autoip_network_changed (struct netif *netif)
 
err_t autoip_stop (struct netif *netif)
 
void autoip_tmr (void)
 
void autoip_arp_reply (struct netif *netif, struct etharp_hdr *hdr)
 
u8_t autoip_supplied_address (const struct netif *netif)
 

Detailed Description

AutoIP Automatic LinkLocal IP Configuration

Macro Definition Documentation

#define LWIP_AUTOIP_CREATE_SEED_ADDR (   netif)
Value:
htonl(AUTOIP_RANGE_START + ((u32_t)(((u8_t)(netif->hwaddr[4])) | \
((u32_t)((u8_t)(netif->hwaddr[5]))) << 8)))
u8_t hwaddr[6U]
Definition: netif.h:282
Definition: netif.h:197

Macro that generates the initial IP address to be tried by AUTOIP. If you want to override this, define it to something else in lwipopts.h.

#define LWIP_AUTOIP_RAND (   netif)
Value:
( (((u32_t)((netif->hwaddr[5]) & 0xff) << 24) | \
((u32_t)((netif->hwaddr[3]) & 0xff) << 16) | \
((u32_t)((netif->hwaddr[2]) & 0xff) << 8) | \
((u32_t)((netif->hwaddr[4]) & 0xff))) + \
u8_t hwaddr[6U]
Definition: netif.h:282
u8_t tried_llipaddr
Definition: autoip.h:77
struct autoip * autoip
Definition: netif.h:256
Definition: netif.h:197

Pseudo random macro based on netif informations. You could use "rand()" from the C Library if you define LWIP_AUTOIP_RAND in lwipopts.h

Function Documentation

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
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.

u8_t autoip_supplied_address ( const struct netif netif)

check if AutoIP supplied netif->ip_addr

Parameters
netifthe netif to check
Returns
1 if AutoIP supplied netif->ip_addr (state BOUND or ANNOUNCING), 0 otherwise
void autoip_tmr ( void  )

Has to be called in loop every AUTOIP_TMR_INTERVAL milliseconds