lwIP 2.1.2 Lightweight IP stack

Macros | Functions
IPv4 address handling
APIs » "raw" APIs » Network interface (NETIF)

## Macros
#define | netif_ip4_addr(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->ip_addr)))
#define | netif_ip4_netmask(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->netmask)))
#define | netif_ip4_gw(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->gw)))
#define | netif_ip_addr4(netif) ((const ip_addr_t*)&((netif)->ip_addr))
#define | netif_ip_netmask4(netif) ((const ip_addr_t*)&((netif)->netmask))
#define | netif_ip_gw4(netif) ((const ip_addr_t*)&((netif)->gw))

## Functions
void | netif_set_ipaddr (struct netif *netif, const ip4_addr_t *ipaddr)
void | netif_set_netmask (struct netif *netif, const ip4_addr_t *netmask)
void | netif_set_gw (struct netif *netif, const ip4_addr_t *gw)
void | netif_set_addr (struct netif *netif, const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw)

## Detailed Description

## Macro Definition Documentation

## ◆ netif_ip4_addr

#define netif_ip4_addr | ( |  | netif | ) | ((const ip4_addr_t*)ip_2_ip4(&((netif)->ip_addr)))

## ◆ netif_ip4_gw

#define netif_ip4_gw | ( |  | netif | ) | ((const ip4_addr_t*)ip_2_ip4(&((netif)->gw)))

## ◆ netif_ip4_netmask

#define netif_ip4_netmask | ( |  | netif | ) | ((const ip4_addr_t*)ip_2_ip4(&((netif)->netmask)))

## ◆ netif_ip_addr4

#define netif_ip_addr4 | ( |  | netif | ) | ((const ip_addr_t*)&((netif)->ip_addr))

## ◆ netif_ip_gw4

#define netif_ip_gw4 | ( |  | netif | ) | ((const ip_addr_t*)&((netif)->gw))

## ◆ netif_ip_netmask4

#define netif_ip_netmask4 | ( |  | netif | ) | ((const ip_addr_t*)&((netif)->netmask))

## Function Documentation

## ◆ netif_set_addr()

void netif_set_addr | ( | struct netif * | netif,
|  | const ip4_addr_t * | ipaddr,
|  | const ip4_addr_t * | netmask,
|  | const ip4_addr_t * | gw
| ) |  |

Change IP address configuration for a network interface (including netmask and default gateway).

Parameters

  netif | the network interface to change
  ipaddr | the new IP address
  netmask | the new netmask
  gw | the new default gateway

## ◆ netif_set_gw()

void netif_set_gw | ( | struct netif * | netif,
|  | const ip4_addr_t * | gw
| ) |  |

Change the default gateway for a network interface

Parameters

  netif | the network interface to change
  gw | the new default gateway

Note
  call netif_set_addr() if you also want to change ip address and netmask

## ◆ netif_set_ipaddr()

void netif_set_ipaddr | ( | struct netif * | netif,
|  | const ip4_addr_t * | ipaddr
| ) |  |

Change the IP address of a network interface

Parameters

  netif | the network interface to change
  ipaddr | the new IP address

Note
  call netif_set_addr() if you also want to change netmask and default gateway

## ◆ netif_set_netmask()

void netif_set_netmask | ( | struct netif * | netif,
|  | const ip4_addr_t * | netmask
| ) |  |

Change the netmask of a network interface

Parameters

  netif | the network interface to change
  netmask | the new netmask

Note
  call netif_set_addr() if you also want to change ip address and default gateway