lwIP Wiki
Explore
Main Page
All Pages
Community
Interactive Maps
Recent Blog Posts
Wiki Content
Recently Changed Pages
Application API layers
License
TCP
Porting for an OS
Netconn receive timeout
LwIP Wiki
Raw/UDP
LwIP Application Developers Manual
LwIP with or without an operating system
Netconn API
Application API layers
SNMP
Socket API
Initialization for simple lwIP
LwIP IPv4/IPv6 stacks
Blog posts
Bellphin/TCP/IP Listen issue
Johnwilliamhoffman/Missing ACKs using LWIP 1.3.2
Doriano dotsys/RFC (Request for Comment) implemented in LwIP
Cuc0ach1ng/UDP transmit timing query
Kausiknathan/Lwip Stack 2.0.2 Integration with Infineon Aurix TC299 MCAL Source
Ddlawrence/lwIP on the Beaglebone UDP problem
Shahrukhkk/LWIP with NS3
Community
Help
FANDOM
Fan Central
BETA
Games
Anime
Movies
TV
Video
Wikis
Explore Wikis
Community Central
Start a Wiki
Don't have an account?
Register
Sign In
Sign In
Register
lwIP Wiki
91
pages
Explore
Main Page
All Pages
Community
Interactive Maps
Recent Blog Posts
Wiki Content
Recently Changed Pages
Application API layers
License
TCP
Porting for an OS
Netconn receive timeout
LwIP Wiki
Raw/UDP
LwIP Application Developers Manual
LwIP with or without an operating system
Netconn API
Application API layers
SNMP
Socket API
Initialization for simple lwIP
LwIP IPv4/IPv6 stacks
Blog posts
Bellphin/TCP/IP Listen issue
Johnwilliamhoffman/Missing ACKs using LWIP 1.3.2
Doriano dotsys/RFC (Request for Comment) implemented in LwIP
Cuc0ach1ng/UDP transmit timing query
Kausiknathan/Lwip Stack 2.0.2 Integration with Infineon Aurix TC299 MCAL Source
Ddlawrence/lwIP on the Beaglebone UDP problem
Shahrukhkk/LWIP with NS3
Community
Help
Editing
Network interfaces management
(section)
Back to page
Edit
Edit source
View history
Talk (2)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Step One: Add the interface === To create a new network interface, the user allocates space for a new <code>struct netif</code> (but does not initialize any part of it) and calls <code>netif_add</code><nowiki>: </nowiki> struct *netif netif_add(struct netif *mynetif, struct ip_addr *ipaddr, struct ip_addr *netmask, struct ip_addr *gw, void *state, err_t (* init)(struct netif *netif), err_t (* input)(struct pbuf *p, struct netif *netif)); The user specifies an IP address for the interface, its net mask, and gateway address (see IP stack for more details). These can be changed later. '''<code>state</code>''' is a driver-specific structure that defines any other "state" information necessary for the driver to function. Some drivers may require the state variable to be set prior to calling netif_add, but many require this argument to be NULL. Check your driver for more information. The '''<code>init</code>''' parameter specifies a driver-initialization function that should be called once the <code>netif</code> structure has been prepared by <code>netif_add</code>. This parameter may be <code>NULL</code> if the driver has already been initialized in your code elsewhere. The final parameter '''<code>input</code>''' is the function that a driver will call when it has received a new packet. This parameter typically takes one of the following values: * <code>ethernet_input</code><nowiki>: If you are not using a threaded environment and the driver should use ARP (such as for an Ethernet device), the driver will call this function which permits ARP packets to be handled, as well as IP packets. </nowiki> * <code>ip_input</code><nowiki>: If you are not using a threaded environment and the interface is not an Ethernet device, the driver will directly call the IP stack. </nowiki> * <code>tcpip_ethinput</code><nowiki>: If you are using the tcpip application thread (see lwIP and threads), the driver uses ARP, and has defined the </nowiki><code>ETHARP_TCPIP_ETHINPUT</code> lwIP option. This function is used for drivers that passes all IP and ARP packets to the input function. * <code>tcpip_input</code><nowiki>: If you are using the tcpip application thread and have defined </nowiki><code>ETHARP_TCPIP_INPUT</code> option. This function is used for drivers that pass only IP packets to the input function. (The driver probably separates out ARP packets and passes these directly to the ARP module). (Someone please recheck this: in lwip 1.4.1 there is no tcpip_ethinput() ; tcp_input() handles ARP packets as well).
Summary:
Please note that all contributions to the lwIP Wiki are considered to be released under the CC-BY-SA
Cancel
Editing help
(opens in new window)
Follow on IG
TikTok
Join Fan Lab