Symbols
loading...
Files
loading...

LwIP library

LwIP is a library defining the following symbols:

Most used functions

Name
Location
Summary
Dereference a pbuf chain or queue and deallocate any no-longer-used pbufs at the head of this chain or queue. Decrements the pbuf reference count. If it reaches zero, the pbuf is deallocated. For a pbuf chain, this is repeated for each pbuf in the chain, up to the first pbuf which has a non-zero reference count after decrementing. So, when all reference counts are one, the whole chain is free'd. @internal examples: Assuming existing chains a->b->c with the following reference counts, calling pbuf_free(a) results in: 1->2->3 becomes ...1->3 3->3->3 becomes 2->3->3 1->1->2 becomes ......1 2->1->1 becomes 1->1->1 1->1->1 becomes .......
Convert an u16_t from host- to network byte order.
Convert numeric IP address into decimal dotted ASCII representation. returns ptr to static buffer; not reentrant!
Returns the current time in milliseconds, may be the same as sys_jiffies or at least based on it. Don't care for wraparound, this is only used for time diffs. Not implementing this function means you cannot use some modules (e.g. TCP timestamps, internal timeouts for NO_SYS==1).
Bring an interface down, disabling any traffic processing.
Bring an interface up, available for processing traffic.
Called by a driver when its link goes up
Called by a driver when its link goes down
Convert an u32_t from host- to network byte order.
Specifies the callback function that should be called when data has successfully been received (i.e., acknowledged) by the remote host. The len argument passed to the callback function gives the amount bytes that was acknowledged by the last acknowledgment.
Start DHCP negotiation for a network interface. If no DHCP client instance was attached to this interface, a new client is created first. If a DHCP client instance was already present, it restarts negotiation.
Allocates a pbuf of the given type (possibly a chain for PBUF_POOL type). The actual memory allocated for the pbuf is determined by the layer at which the pbuf is allocated and the requested size (from the size parameter). - PBUF_RAM: buffer memory for pbuf is allocated as one large chunk. This includes protocol headers as well. - PBUF_ROM: no buffer memory is allocated for the pbuf, even for protocol headers. Additional headers must be prepended by allocating another pbuf and chain in to the front of the ROM pbuf. It is assumed that the memory used is really similar to ROM in that it is immutable and will not be changed. Memory which is dynamic should generally not be attached to PBUF_ROM pbufs. Use PBUF_REF instead. - PBUF_REF: no buffer memory is allocated for the pbuf, even for protocol headers. It is assumed that the pbuf is only being used in a single thread. If the pbuf gets queued, then pbuf_take should be called to copy the buffer. - PBUF_POOL: the pbuf is allocated as a pbuf chain, with pbufs from the pbuf pool that is allocated during pbuf_init().
Add a network interface to the list of lwIP netifs.
Set a network interface as the default network interface (used to output all packets for which no specific route is found)
Resolve and fill-in Ethernet address header for outgoing IP packet. For IP multicast and broadcast, corresponding Ethernet addresses are selected and the packet is transmitted on the link. For unicast addresses, the packet is submitted to etharp_query(). In case the IP address is outside the local network, the IP address of the gateway is used.
Signals a semaphore
Blocks the thread while waiting for the semaphore to be signaled. If the "timeout" argument is non-zero, the thread should only be blocked for the specified time (measured in milliseconds). If the "timeout" argument is zero, the thread should be blocked until the semaphore is signalled. The return value is SYS_ARCH_TIMEOUT if the semaphore wasn't signaled within the specified time or any other value if it was signaled (with or without waiting). Notice that lwIP implements a function with a similar name, sys_sem_wait(), that uses the sys_arch_sem_wait() function.
Change IP address configuration for a network interface (including netmask and default gateway).
Send data over a TCP netconn.
Set a receive callback for a UDP PCB. This callback will be called when receiving a datagram for the pcb.
check if DHCP supplied netif->ip_addr
Initialize a custom pbuf (already allocated). Example of custom pbuf usage: zerocopyrx
Initialize custom memory pool. Related functions: memp_malloc_pool, memp_free_pool
Get an element from a custom pool.
Set callback to be called when link is brought up/down
Put a custom pool element back into its pool.
Process received ethernet frames. Using this function instead of directly calling ip_input and passing ARP frames through etharp in ethernetif_input, the ARP cache is protected from concurrent access.\n Don't call directly, pass to netif_add() and call netif->input(). @see LWIP_HOOK_UNKNOWN_ETH_PROTOCOL @see ETHARP_SUPPORT_VLAN @see LWIP_HOOK_VLAN_CHECK
Put a struct mem back on the heap
Put an element back into its pool.
Get an element from a specific pool.
This function should be called by the application when it has processed the data. The purpose is to advertise a larger window when the data has been processed.
Returns 1 if the mailbox is valid, 0 if it is not valid. When using pointers, a simple way is to check the pointer for != NULL. When directly using OS structures, implementing this may be more complex. This may also be a define, in which case the function is not prototyped.
Releases the mutex previously locked through 'sys_mutex_lock()'.
Specifies the polling interval and the callback function that should be called to poll the application. The interval is specified in number of TCP coarse grained timer shots, which typically occurs twice a second. An interval of 10 means that the application would be polled every 5 seconds. When a connection is idle (i.e., no data is either transmitted or received), lwIP will repeatedly poll the application by calling a specified callback function. This can be used either as a watchdog timer for killing connections that have stayed idle for too long, or as a method of waiting for memory to become available. For instance, if a call to tcp_write() has failed because memory wasn't available, the application may use the polling functionality to call tcp_write() again when the connection has been idle for a while.
Allocate a block of memory with a minimum of 'size' bytes. Note that the returned value will always be aligned (as defined by MEM_ALIGNMENT).
Sets the callback function that will be called when new data arrives. The callback function will be passed a NULL pbuf to indicate that the remote host has closed the connection. If the callback function returns ERR_OK or ERR_ABRT it must have freed the pbuf, otherwise it must not have freed it.
Handle timeouts for NO_SYS==1 (i.e. without using tcpip_thread/sys_timeouts_mbox_fetch(). Uses sys_now() to call timeout handler functions when timeouts expire. Must be called periodically from your main loop.
Specifies the program specific state that should be passed to all other callback functions. The "pcb" argument is the current TCP connection control block, and the "arg" argument is the argument that will be passed to the callbacks.
Initialize all modules. Use this in NO_SYS mode. Use tcpip_init() otherwise.
Blocks the thread until the mutex can be grabbed.
Removes and deallocates the pcb. @see udp_new()
Increment the reference count of the pbuf.
Bind an UDP PCB. ipaddr & port are expected to be in the same byte order as in the pcb. @see udp_disconnect()
Creates a new UDP pcb which can be used for UDP communication. The pcb is not active until it has either been bound to a local address or connected to a remote address. @see udp_remove()
Close a netconn 'connection' and free its resources. UDP and RAW connection are completely closed, TCP pcbs might still be in a waitstate after this returns.
Map a externally used socket index to the internal socket representation.
Initialize this module: - initialize all sub modules - start the tcpip_thread
Find out what we can send and send it
Aborts the connection by sending a RST (reset) segment to the remote host. The pcb is deallocated. This function never fails. ATTENTION: When calling this from one of the TCP callbacks, make sure you always return ERR_ABRT (and never return ERR_ABRT otherwise or you will risk accessing deallocated memory or memory leaks!
Adjusts the payload pointer to hide headers in the payload. Adjusts the ->payload pointer so that space for a header disappears in the pbuf payload. The ->payload, ->tot_len and ->len fields are adjusted.
Used to specify the function that should be called when a fatal error has occurred on the connection. If a connection is aborted because of an error, the application is alerted of this event by the err callback. Errors that might abort a connection are when there is a shortage of memory. The callback function to be called is set using the tcp_err() function.
Deallocate a netbuf allocated by netbuf_new().
Closes the connection held by the PCB. Listening pcbs are freed and may not be referenced any more. Connection pcbs are freed if not yet connected and may not be referenced any more. If a connection is established (at least SYN received or in a closing state), the connection is closed, and put in a closing state. The pcb is then automatically freed in tcp_slowtmr(). It is therefore unsafe to reference it (unless an error is returned). The function may return ERR_MEM if no memory was available for closing the connection. If so, the application should wait and try again either by using the acknowledgment callback or the polling functionality. If the close succeeds, the function returns ERR_OK.
Count number of pbufs in a chain
Copy (part of) the contents of a packet buffer to an application supplied buffer.
Create a new netconn (of a specific type) that has a callback function. The corresponding pcb is also created.
The only thread function: Starts a new thread named "name" with priority "prio" that will begin its execution in the function "thread()". The "arg" argument will be passed as an argument to the thread() function. The stack size to used for this thread is the "stacksize" parameter. The id of the new thread is returned. Both the id and the priority are system dependent. ATTENTION: although this function returns a value, it MUST NOT FAIL (ports have to assert this!)
Remove the remote end of the pcb. This function does not generate any network traffic, but only removes the remote address of the pcb.
Try to post a message to an mbox - may fail if full. Can be used from ISR (if the sys arch layer allows this). Returns ERR_MEM if it is full, else, ERR_OK if the "msg" is posted.
Call the lower part of a netconn_* function This function is then running in the thread context of tcpip_thread and has exclusive access to lwIP core code.
Get and reset pending error on a netconn
Bind a netconn to a specific local IP address and port. Binding one netconn twice might not always be checked correctly!
Free a tcp pcb
Write data for sending (but does not send it immediately). It waits in the expectation of more data being sent soon (as it can send them more efficiently by combining them together). To prompt the system to send data now, call tcp_output() after calling tcp_write(). This function enqueues the data pointed to by the argument dataptr. The length of the data is passed as the len parameter. The apiflags can be one or more of: - TCP_WRITE_FLAG_COPY: indicates whether the new memory should be allocated for the data to be copied into. If this flag is not given, no new memory should be allocated and the data should only be referenced by pointer. This also means that the memory behind dataptr must not change until the data is ACKed by the remote host - TCP_WRITE_FLAG_MORE: indicates that more data follows. If this is omitted, the PSH flag is set in the last segment created by this call to tcp_write. If this flag is given, the PSH flag is not set. The tcp_write() function will fail and return ERR_MEM if the length of the data exceeds the current send buffer size or if the length of the queue of outgoing segment is larger than the upper limit defined in lwipopts.h. The number of bytes available in the output queue can be retrieved with the tcp_sndbuf() function. The proper way to use this function is to call the function with at most tcp_sndbuf() bytes of data. If the function returns ERR_MEM, the application should wait until some of the currently enqueued data has been successfully received by the other host and try again.
Pass a received packet to tcpip_thread for input processing with ethernet_input or ip_input. Don't call directly, pass to netif_add() and call netif->input().
Receive data (in form of a netbuf containing a packet buffer) from a netconn
Determine if an address is a broadcast address on a network interface
Used for specifying the function that should be called when a LISTENing connection has been connected to another host.
Frees one or more addrinfo structures returned by getaddrinfo(), along with any additional storage associated with those structures. If the ai_next field of the structure is not null, the entire list of structures is freed.
Translates the name of a service location (for example, a host name) and/or a service name and returns a set of socket addresses and associated information to be used in creating a socket with which to address the specified service. Memory for the result is allocated internally and must be freed by calling lwip_freeaddrinfo()! Due to a limitation in dns_gethostbyname, only the first address of a host is returned. Also, service names are not supported (only port numbers)! @todo: implement AI_V4MAPPED, AI_ADDRCONFIG
Concatenate two pbufs (each may be a pbuf chain) and take over the caller's reference of the tail pbuf. This function explicitly does not check for tot_len overflow to prevent failing to queue too long pbufs. This can produce invalid pbufs, so handle with care! @see pbuf_chain()
Send a TCP RESET packet (empty segment with RST flag set) either to abort a connection or to show that there is no matching local connection for a received segment. Called by tcp_abort() (to abort a local connection), tcp_input() (if no matching local pcb was found), tcp_listen_input() (if incoming segment has ACK flag set) and tcp_process() (received segment in the wrong state) Since a RST segment is in most cases not sent for an active connection, tcp_rst() has a number of arguments that are taken from a tcp_pcb for most other segment output functions.
Create a DHCP request, fill in common headers
Add a DHCP message trailer Adds the END option to the DHCP message, and if necessary, up to three padding bytes.
Send data to a specified address using UDP. dst_ip & dst_port are expected to be in the same byte order as in the pcb. If the PCB already has a remote address association, it will be restored after the data is sent. @see udp_disconnect() udp_send()
Sets the remote end of the pcb. This function does not generate any network traffic, but only sets the remote address of the pcb. ipaddr & port are expected to be in the same byte order as in the pcb. The udp pcb is bound to a random local port if not already bound. @see udp_disconnect()
Copy application supplied data into a pbuf. This function can only be used to copy the equivalent of buf->tot_len data.
Set a TCP netconn into listen mode
Accept a new connection on a TCP listening netconn.
Creates a new TCP protocol control block but doesn't place it on any of the TCP PCB lists. The pcb is not put on any list until binding using tcp_bind(). If memory is not available for creating the new pcb, NULL is returned. @internal: Maybe there should be a idle TCP PCB list where these PCBs are put on. Port reservation using tcp_bind() is implemented but allocated pcbs that are not bound can't be killed automatically if wanting to allocate a pcb with higher prio (@see tcp_kill_prio())
Finds the appropriate network interface for a given IP address. It searches the list of network interfaces linearly. A match is found if the masked IP address of the network interface equals the masked IP address given to the function.
Create a new semaphore Creates a new semaphore. The semaphore is allocated to the memory that 'sem' points to (which can be both a pointer or the actual OS structure). The "count" argument specifies the initial state of the semaphore (which is either 0 or 1). If the semaphore has been created, ERR_OK should be returned. Returning any other error will provide a hint what went wrong, but except for assertions, no real error handling is implemented.
Called from TCP_REG when registering a new PCB: the reason is to have the TCP timer only running when there are active (or time-wait) PCBs.
Purges a TCP PCB. Removes any buffered data and frees the buffer memory (pcb->ooseq, pcb->unsent and pcb->unacked are freed).
Binds the connection to a local port number and IP address. If the IP address is not given (i.e., ipaddr == IP_ANY_TYPE), the connection is bound to all local IP addresses. If another connection is bound to the same port, the function will return ERR_USE, otherwise ERR_OK is returned.
Sends the pbuf p using UDP. The pbuf is not deallocated. The datagram will be sent to the current remote_ip & remote_port stored in pcb. If the pcb is not bound to a port, it will automatically be bound to a random port. @see udp_disconnect() udp_sendto()
Get the data pointer and length of the data inside a netbuf.
Close a TCP netconn (doesn't delete it).
Send data to a specified address using UDP. The netif used for sending can be specified. This function exists mainly for DHCP, to be able to send UDP packets on a netif that is still down. dst_ip & dst_port are expected to be in the same byte order as in the pcb. @see udp_disconnect() udp_send()
Adjusts the payload pointer to reveal headers in the payload. Adjusts the ->payload pointer so that space for a header appears in the pbuf payload. The ->payload, ->tot_len and ->len fields are adjusted. PBUF_ROM and PBUF_REF type buffers cannot have their sizes increased, so the call will fail. A check is made that the increase in header size does not move the payload pointer in front of the start of the buffer.
Get one byte from the specified position in a pbuf
Deallocates a semaphore.
Deallocates a mailbox. If there are messages still present in the mailbox when the mailbox is deallocated, it is an indication of a programming error in lwIP and the developer should be notified.
Purges the PCB and removes it from a PCB list. Any delayed ACKs are sent first.
Send an ACK without data.
Called by tcp_process. Checks if the given segment is an ACK for outstanding data, and if so frees the memory of the buffered data. Next, it places the segment on any of the receive queues (pcb->recved or pcb->ooseq). If the segment is buffered, the pbuf is referenced by pbuf_ref so that it will not be freed until it has been removed from the buffer. If the incoming segment constitutes an ACK for a segment that was used for RTT estimation, the RTT is estimated here as well. Called from tcp_process().
Send data over a UDP or RAW netconn (that is already connected).
Set the state of the connection to be LISTEN, which means that it is able to accept incoming connections. The protocol control block is reallocated in order to consume less memory. Setting the connection to LISTEN is an irreversible process. When an incoming connection is accepted, the function specified with the tcp_accept() function will be called. The pcb has to be bound to a local port with the tcp_bind() function. The tcp_listen() function returns a new connection identifier, and the one passed as an argument to the function will be deallocated. The reason for this behavior is that less memory is needed for a connection that is listening, so tcp_listen() will reclaim the memory needed for the original connection and allocate a new smaller memory block for the listening connection. tcp_listen() may return NULL if no memory was available for the listening connection. If so, the memory associated with the pcb passed as an argument to tcp_listen() will not be deallocated. The backlog limits the number of outstanding connections in the listen queue to the value specified by the backlog argument. To use it, your need to set TCP_LISTEN_BACKLOG=1 in your lwipopts.h.
Close one end of a full-duplex connection.
Set a socket into listen mode. The socket may not have been used for another connection previously.
A minimal implementation of fcntl. Currently only the commands F_GETFL and F_SETFL are implemented. The flag O_NONBLOCK and access modes are supported for F_GETFL, only the flag O_NONBLOCK is implemented for F_SETFL.
Return the interface for the netif index
Sends an IP packet on a network interface. This function constructs the IP header and calculates the IP header checksum. If the source IP address is NULL, the IP address of the outgoing network interface is filled in as source address. If the destination IP address is LWIP_IP_HDRINCL, p is assumed to already include an IP header and p->payload points to it instead of the data.
lwIP default implementation for strnstr() non-standard function. This can be \#defined to strnstr() depending on your platform port.
Release a DHCP lease and stop DHCP statemachine (and AUTOIP if LWIP_DHCP_AUTOIP_COOP).
Send an ethernet packet on the network using netif->linkoutput(). The ethernet header is filled in before sending. @see LWIP_HOOK_VLAN_SET
Invalidate a mailbox so that sys_mbox_valid() returns 0. ATTENTION: This does NOT mean that the mailbox shall be deallocated: sys_mbox_free() is always called before calling this function! This may also be a define, in which case the function is not prototyped.
Deallocates a list of TCP segments (tcp_seg structures).
Frees a TCP segment (tcp_seg structure).
Start the DHCP process, discover a DHCP server.
Call tcp_write() in a loop trying smaller and smaller length
The connection shall be actively closed. Reset the sent- and recv-callbacks.
Sets the priority of a connection.
Same as udp_sendto_if, but with source address
Check whether "cp" is a valid ascii representation of an Internet address and convert to a binary address. Returns 1 if the address is valid, 0 if not. This replaces inet_addr, the return value from which cannot distinguish between failure and a local broadcast address.
Shrink a pbuf chain to a desired length. Depending on the desired length, the first few pbufs in a chain might be skipped and left unchanged. The new last pbuf in the chain will be resized, and any remaining pbufs will be freed.
Send an ARP request packet asking for ipaddr.
Blocks the thread until a message arrives in the mailbox, but does not block the thread longer than "timeout" milliseconds (similar to the sys_arch_sem_wait() function). If "timeout" is 0, the thread should be blocked until a message arrives. The "msg" argument is a result parameter that is set by the function (i.e., by doing "*msg = ptr"). The "msg" parameter maybe NULL to indicate that the message should be dropped. The return values are the same as for the sys_arch_sem_wait() function: SYS_ARCH_TIMEOUT if there was a timeout, any other value if a messages is received. Note that a function with a similar name, sys_mbox_fetch(), is implemented by lwIP.
This is similar to sys_arch_mbox_fetch, however if a message is not present in the mailbox, it immediately returns with the code SYS_MBOX_EMPTY. On success 0 is returned. To allow for efficient implementations, this can be defined as a function-like macro in sys_arch.h instead of a normal function. For example, a naive implementation could be: \#define sys_arch_mbox_tryfetch(mbox,msg) sys_arch_mbox_fetch(mbox,msg,1) although this would introduce unnecessary delays.
Calculates the effective send mss that can be used for a specific IP address by calculating the minimum of TCP_MSS and the mtu (if set) of the target netif (if not NULL).
Internal helper function to close a TCP netconn: since this sometimes doesn't work at the first attempt, this function is called from multiple places.
dns_call_found() - call the found callback and check if there are duplicate entries for the given hostname. If there are any, their found callback will be called and they will be removed.
Chain two pbufs (or pbuf chains) together. The caller MUST call pbuf_free(t) once it has stopped using it. Use pbuf_cat() instead if you no longer use t. The ->tot_len fields of all pbufs of the head chain are adjusted. The ->next field of the last pbuf of the head chain is adjusted. The ->ref field of the first pbuf of the tail chain is adjusted.
Connect a netconn to a specific remote IP address and port.
Connects to another host. The function given as the "connected" argument will be called when the connection has been established. Sets up the pcb to connect to the remote host and sends the initial SYN segment which opens the connection. The tcp_connect() function returns immediately; it does not wait for the connection to be properly setup. Instead, it will call the function specified as the fourth argument (the "connected" argument) when the connection is established. If the connection could not be properly established, either because the other host refused the connection or because the other host didn't answer, the "err" callback function of this pcb (registered with tcp_err, see below) will be called. The tcp_connect() function can return ERR_MEM if no memory is available for enqueueing the SYN segment. If the SYN indeed was enqueued successfully, the tcp_connect() function returns ERR_OK.
This function is called by the network interface device driver when an IP packet is received. The function does the basic checks of the IP header such as packet size being at least larger than the header size etc. If the packet was not destined for us, the packet is forwarded (using ip_forward). The IP checksum is always checked. Finally, the packet is sent to the upper layer protocol input function.
Returns 1 if the semaphore is valid, 0 if it is not valid. When using pointers, a simple way is to check the pointer for != NULL. When directly using OS structures, implementing this may be more complex. This may also be a define, in which case the function is not prototyped.
Creates an empty mailbox for maximum "size" elements. Elements stored in mailboxes are pointers. You have to define macros "_MBOX_SIZE" in your lwipopts.h, or ignore this parameter in your implementation and use a default size. If the mailbox has been created, ERR_OK should be returned. Returning any other error will provide a hint what went wrong, but except for assertions, no real error handling is implemented.
Free the packet buffer included in a netbuf
Get the local or remote IP address and port of a netconn. For RAW netconns, this returns the protocol instead of a port!
Receive data: actual implementation that doesn't care whether pbuf or netbuf is received (this is internal, it's just here for describing common errors)
Close or shutdown a TCP netconn (doesn't delete it).
Called by tcp_close() to send a segment including FIN flag but not data. This FIN may be added to an existing segment or a new, otherwise empty segment is enqueued.
Enqueue SYN or FIN for transmission. Called by tcp_connect, tcp_listen_input, and tcp_close (via tcp_send_fin)
Default receive callback that is called if the user didn't register a recv callback for the pcb.
Abandons a connection and optionally sends a RST to the remote host. Deletes the local protocol control block. This is done when a connection is killed because of shortage of memory.
Allocate a new tcp_pcb structure.
Delete a netconn and all its resources. The pcb is NOT freed (since we might not be in the right thread context do this).
See if more data needs to be written from a previous call to netconn_write. Called initially from lwip_netconn_do_write. If the first call can't send all data (because of low memory or empty send-buffer), this function is called again from sent_tcp() or poll_tcp() to send more data. If all data is sent, the blocking application thread (waiting in netconn_write) is released.
Delete rcvmbox and acceptmbox of a netconn and free the left-over data in these mboxes
Setup a tcp_pcb with the correct callback function pointers and their arguments.
Send ARP/IGMP/MLD/RS events, e.g. on link-up/netif-up or addr-change
Output a control segment pbuf to IP. Called from tcp_rst, tcp_send_empty_ack, tcp_keepalive and tcp_zero_window_probe, this function combines selecting a netif for transmission, generating the tcp header checksum and calling ip_output_if while handling netif hints and stats.
Check if a segment's pbufs are used by someone else than TCP. This can happen on retransmission if the pbuf of this segment is still referenced by the netif driver due to deferred transmission. This is the case (only!) if someone down the TX call path called pbuf_ref() on one of the pbufs! @arg seg the tcp segment to check
Bind the interface to the offered IP address.
Dequeues a datagram from the datagram queue. Doesn't deallocate the pbufs.
Callback registered in the netconn layer for each socket-netconn. Processes recvevent (data available) and wakes up tasks waiting for select.
Clears expired entries in the ARP table. This function should be called every ARP_TMR_INTERVAL milliseconds (1 second), in order to expire entries in the ARP table.
Move the current data pointer of a packet buffer contained in a netbuf to the next part. The packet buffer itself is not modified.
Find a network interface by searching for its name
Same as ip_output_if() but 'src' address is not replaced by netif address when it is 'any'.
lwIP default implementation for strnicmp() non-standard function. This can be \#defined to strnicmp() depending on your platform port.
Create a UDP PCB for specific IP type. The pcb is not active until it has either been bound to a local address or connected to a remote address. @see udp_remove()
Bind an UDP PCB to a specific netif. After calling this function, all packets received via this PCB are guaranteed to have come in via the specified netif, and all outgoing packets will go out via the specified netif. @see udp_disconnect()
Same as ip4addr_ntoa, but reentrant since a user-supplied buffer is used.
Same as pbuf_header but does not check if 'header_size > 0' is allowed. This is used internally only, to allow PBUF_REF for RX.
Create PBUF_RAM copies of pbufs. Used to queue packets on behalf of the lwIP stack, such as ARP based queueing.
Same as pbuf_take() but puts data at an offset
Skip a number of bytes at the start of a pbuf
Allocates a new pbuf of same length (via pbuf_alloc()) and copies the source pbuf into this new pbuf (using pbuf_copy()).
Put one byte to the specified position in a pbuf WARNING: silently ignores offset >= p->tot_len
Create a new mutex. Note that mutexes are expected to not be taken recursively by the lwIP code, so both implementation types (recursive or non-recursive) should work. The mutex is allocated to the memory that 'mutex' points to (which can be both a pointer or the actual OS structure). If the mutex has been created, ERR_OK should be returned. Returning any other error will provide a hint what went wrong, but except for assertions, no real error handling is implemented.
Send an ARP request for the given IP address and/or queue a packet. If the IP address was not yet in the cache, a pending ARP cache entry is added and an ARP request is sent for the given address. The packet is queued on this entry. If the IP address was already pending in the cache, a new ARP request is sent for the given address. The packet is queued on this entry. If the IP address was already stable in the cache, and a packet is given, it is directly sent and no ARP request is sent out. If the IP address was already stable in the cache, and no packet is given, an ARP request is sent out.
Pass a received packet to tcpip_thread for input processing
Call a specific function in the thread context of tcpip_thread for easy access synchronization. A function called in that way may access lwIP core code without fearing concurrent access. Does NOT block when the request cannot be posted because the tcpip_mbox is full, but returns ERR_MEM instead. Can be called from interrupt context. @see tcpip_callback
Send vectorized data atomically over a TCP netconn.
Close a netconn 'connection' and free all its resources but not the netconn itself. UDP and RAW connection are completely closed, TCP pcbs might still be in a waitstate after this returns.
Calculates a new initial sequence number for new connections.
Binds the connection to a netif and IP address. After calling this function, all packets received via this PCB are guaranteed to have come in via the specified netif, and all outgoing packets will go out via the specified netif.
Set the state of the connection to be LISTEN, which means that it is able to accept incoming connections. The protocol control block is reallocated in order to consume less memory. Setting the connection to LISTEN is an irreversible process.
Requeue the first unacked segment for retransmission Called by tcp_receive() for fast retransmit.
Requeue all unacked segments for retransmission Called by tcp_slowtmr() for slow retransmission.
Requeue all unacked segments for retransmission Called by tcp_slowtmr() for slow retransmission.
Update the state that tracks the available window space to advertise. Returns how much extra window would be advertised if we sent an update now.
Pass pcb->refused_data to the recv callback
Called periodically to dispatch TCP timers.
Creates a new TCP protocol control block but doesn't place it on any of the TCP PCB lists. The pcb is not put on any list until binding using tcp_bind().
Create a new netconn (of a specific type) that has a callback function. The corresponding pcb is NOT created!
Sends a message to TCPIP thread to call a function. Caller thread blocks on on a provided semaphore, which ist NOT automatically signalled by TCPIP thread, this has to be done by the user. It is recommended to use LWIP_TCPIP_CORE_LOCKING since this is the way with least runtime overhead.
Send an icmp 'destination unreachable' packet, called from ip_input() if the transport layer protocol is unknown and from udp_input() if the local port is not bound.
Translate an error to a unique void* passed via an mbox
Adjusts the payload pointer to reveal headers in the payload. @see pbuf_add_header.
Closes the TX side of a connection held by the PCB. For tcp_close(), a RST is sent if the application didn't receive all data (tcp_recved() not called for all data passed to recv callback). Listening pcbs are freed and may not be referenced any more. Connection pcbs are freed if not yet connected and may not be referenced any more. If a connection is established (at least SYN received or in a closing state), the connection is closed, and put in a closing state. The pcb is then automatically freed in tcp_slowtmr(). It is therefore unsafe to reference it.
Allocate a new local TCP port.
Called from tcp_input to check for TF_CLOSED flag. This results in closing and deallocating a pcb at the correct place to ensure noone references it any more.
Parses the options contained in the incoming segment. Called from tcp_listen_input() and tcp_process(). Currently, only the MSS option is supported!
Create a TCP segment with prefilled header. Called by tcp_write, tcp_enqueue_flags and tcp_split_unsent_seg
Allocate a pbuf and create a tcphdr at p->payload, used for output functions other than the default tcp_output -> tcp_output_segment (e.g. tcp_send_empty_ack, etc.)
Timer callback function that calls cyclic->handler() and reschedules itself.
Free DHCP PCB if the last netif stops using it
Select a DHCP server offer out of all offers. Simply select the first offer received.
Enter REBOOTING state to verify an existing lease
Clean up ARP table entries
Search the ARP table for a matching or new entry. If an IP address is given, return a pending or stable ARP entry that matches the address. If no match is found, create a new entry with this address set, but in state ETHARP_EMPTY. The caller must check and possibly change the state of the returned entry. If ipaddr is NULL, return a initialized new entry in state ETHARP_EMPTY. In all cases, attempt to create new entries from an empty entry. If no empty entries are available and ETHARP_FLAG_TRY_HARD flag is set, recycle old entries. Heuristic choose the least important entry for recycling.
Send an ARP request packet asking for ipaddr to a specific eth address. Used to send unicast request to refresh the ARP table just before an entry times out
Send a raw ARP packet (opcode and all addresses can be modified)
Send an icmp packet in response to an incoming packet.
Free a datagram (struct ip_reassdata) and all its pbufs. Updates the total count of enqueued pbufs (ip_reass_pbufcount), SNMP counters and sends an ICMP time exceeded packet.
End of file: either close the connection (Connection: close) or close the file (Connection: keep-alive)
Try to send more data on this pcb.
The poll function is called every 2nd second. If there has been no data sent (which resets the retries) in 8 seconds, close. If the last portion of a file has not been sent in 2 seconds, close. This could be increased, but we don't want to waste resources for bad connections.
Like dns_gethostbyname, but returned address type can be controlled:
Go through the readset and writeset lists and see which socket of the sockets set in the sets has events. On return, readset, writeset and exceptset have the sockets enabled that had events.
Update revents in each struct pollfd. Optionally update select_waiting in struct lwip_sock.
Same as get_socket but doesn't set errno
dns_check_entry() - see if entry has not yet been queried and, if so, sends out a query. Check an entry in the dns_table: - send out query for new entries - retry old pending entries on timeout (also with different servers) - remove completed entries from the table if their TTL has expired
Initialize the httpd: set up a listening PCB and bind it to the defined port
Set an array of CGI filenames/handler functions
Set the SSI handler function.
lwIP default implementation for itoa() non-standard function. This can be \#defined to itoa() or snprintf(result, bufsize, "%d", number) depending on your platform port.
lwIP default implementation for stricmp() non-standard function. This can be \#defined to stricmp() depending on your platform port.
Process an incoming UDP datagram. Given an incoming UDP datagram (as a chain of pbufs) this function finds a corresponding UDP PCB and hands over the pbuf to the pcbs recv function. If no pcb is found or the datagram is incorrect, the pbuf is freed.
Initialize this module.
This function is called from netif.c when address is changed
Renew an existing DHCP lease at the involved DHCP server.
Handle a possible change in the network configuration. This enters the REBOOTING state to verify that the currently bound address is still valid.
Match an ARP reply with the offered IP address: check whether the offered IP address is not in use using ARP
The DHCP timer that checks for lease renewal/rebind timeouts. Must be called once a minute (see ).
DHCP transaction timeout handling (this function must be called every 500ms, see ). A DHCP server is expected to respond within a short period of time. This timer checks whether an outstanding DHCP request is timed out.
Allocates a pbuf for referenced data. Referenced data can be volatile (PBUF_REF) or long-lived (PBUF_ROM). The actual memory allocated for the pbuf is determined by the layer at which the pbuf is allocated and the requested size (from the size parameter). - PBUF_ROM: It is assumed that the memory used is really similar to ROM in that it is immutable and will not be changed. Memory which is dynamic should generally not be attached to PBUF_ROM pbufs. Use PBUF_REF instead. - PBUF_REF: It is assumed that the pbuf is only being used in a single thread. If the pbuf gets queued, then pbuf_take should be called to copy the buffer.
Similar to pbuf_header(-size) but de-refs header pbufs for (size >= p->len)
Get one byte from the specified position in a pbuf WARNING: returns zero for offset >= p->tot_len
Compare pbuf contents at specified offset with memory s2, both of length n
Find occurrence of mem (with length mem_len) in pbuf p, starting at offset start_offset.
Zero the heap and initialize start, end and lowest-free
Shrink memory returned by mem_malloc().
Initializes lwIP built-in pools. Related functions: memp_malloc, memp_free Carves out memp_memory into linked lists for each pool-type.
Remove all ARP table entries of the specified netif.
Responds to ARP requests to us. Upon ARP replies to us, add entry to cache send out queued IP packets. Updates cache with snooped address pairs. Should be called for incoming ARP packets. The pbuf in the argument is freed by this function. @see pbuf_free()
Invalidate a semaphore so that sys_sem_valid() returns 0. ATTENTION: This does NOT mean that the semaphore shall be deallocated: sys_sem_free() is always called before calling this function! This may also be a define, in which case the function is not prototyped.
Post a message to an mbox - may not fail -> blocks if full, only to be used from tasks NOT from ISR!
Try to post a message to an mbox - may fail if full. To be be used from ISR. Returns ERR_MEM if it is full, else, ERR_OK if the "msg" is posted.
sys_init() must be called before anything else. Initialize the sys_arch layer.
Initialize this module
Return the time left before the next timeout is due. If no timeouts are enqueued, returns 0xffffffff
Let a netbuf reference existing (non-volatile) data.
Shut down one or both sides of a TCP netconn (doesn't delete it).
Disconnect a netconn from its current peer (only valid for UDP netconns).
Receive data (in form of a netbuf) from a UDP or RAW netconn
Receive data (in form of a pbuf) from a TCP netconn
Send keepalive packets to keep a connection active although no data is sent over it. Called by tcp_slowtmr()
Split segment on the head of the unsent queue. If return is not ERR_OK, existing head remains intact The split is accomplished by creating a new TCP segment and pbuf which holds the remainder payload after the split. The original pbuf is trimmed to new length. This allows splitting of read-only pbufs
Send persist timer zero-window probes to keep a connection active when a window update is lost. Called by tcp_slowtmr()
This function is called from netif.c when address is changed or netif is removed
Requeue all unacked segments for retransmission Called by tcp_process() only, tcp_slowtmr() needs to do some things between "prepare" and "commit".
Handle retransmission after three dupacks received
Causes all or part of a full-duplex connection of this PCB to be shut down. This doesn't deallocate the PCB unless shutting down both sides! Shutting down both sides is the same as calling tcp_close, so if it succeds (i.e. returns ER_OK), the PCB must not be referenced any more!
Initialize this module.
Called every 500 ms and implements the retransmission timer and the timer that removes PCBs that have been in TIME-WAIT for enough time. It also increments various timers such as the inactivity timer in each PCB. Automatically called from tcp_tmr().
Is called every TCP_FAST_INTERVAL (250 ms) and process data previously "refused" by upper layer (application) and sends delayed ACKs or pending FINs. Automatically called from tcp_tmr().
The initial input processing of TCP. It verifies the TCP header, demultiplexes the segment between the PCBs and passes it on to tcp_process(), which implements the TCP finite state machine. This function is called by the IP layer (in ip_input()).
Create a new pcb of a specific type inside a netconn. Called from netconn_new_with_proto_and_callback.
Delete the pcb inside a netconn. Called from netconn_delete.
Bind a pcb contained in a netconn Called from netconn_bind.
Bind a pcb contained in a netconn to an interface Called from netconn_bind_if.
Connect a pcb contained inside a netconn Called from netconn_connect.
Disconnect a pcb contained inside a netconn Only used for UDP netconns. Called from netconn_disconnect.
Set a TCP pcb contained in a netconn into listen mode Called from netconn_listen.
Send some data on a RAW or UDP pcb contained in a netconn Called from netconn_send
Indicate data has been received from a TCP pcb contained in a netconn Called from netconn_recv
Send some data on a TCP pcb contained in a netconn Called from netconn_write
Return a connection's local or remote address Called from netconn_getaddr
Close or half-shutdown a TCP pcb contained in a netconn Called from netconn_close In contrast to closing sockets, the netconn is not deallocated.
Processes ICMP input packets, called from ip_input(). Currently only processes icmp echo requests and sends out the echo response.
Send a 'time exceeded' packet, called from ip_forward() if TTL is 0.
Sent callback function for TCP netconns. Signals the conn->sem and calls API_EVENT. netconn_write waits for conn->sem if send buffer is low. @see tcp.h (struct tcp_pcb.sent) for parameters and return value
Poll callback function for TCP netconns. Wakes up an application thread that waits for a connection to close or data to be sent. The application thread then takes the appropriate action to go on. Signals the conn->sem. netconn_close waits for conn->sem if closing failed. @see tcp.h (struct tcp_pcb.poll) for parameters and return value
Error callback function for TCP netconns. Signals conn->sem, posts to all conn mboxes and calls API_EVENT. The application thread has then to decide what to do. @see tcp.h (struct tcp_pcb.err) for parameters
Calculate a checksum over a chain of pbufs (without pseudo-header, much like inet_chksum only pbufs are used).
Reassembly timer base function for both NO_SYS == 0 and 1 (!). Should be called every 1000 msec (defined by IP_TMR_INTERVAL).
Reassembles incoming IP fragments into an IP datagram.
Fragment an IP datagram if too large for the netif. Chop the datagram in MTU sized chunks and send them in order by pointing PBUF_REFs into p.
Dummy IPv4 output function for netifs not supporting IPv4
Kills the oldest connection that is in specific state. Called from tcp_alloc() for LAST_ACK and CLOSING if no more connections are available.
Helper function for tcp_netif_ip_addr_changed() that iterates a pcb list
Called by tcp_input() when a segment arrives for a listening connection (from tcp_input()).
Called by tcp_input() when a segment arrives for a connection in TIME_WAIT.
Implements the TCP state machine. Called by tcp_input. In some states tcp_receive() is called to receive data. The tcp_seg argument will be freed by the caller (tcp_input()) unless the recv_data pointer in the pcb is set.
Remove segments from a list if the incoming ACK acknowledges them
Allocate a PBUF_RAM pbuf, perhaps with extra space at the end. This function is like pbuf_alloc(layer, length, PBUF_RAM) except there may be extra bytes available at the end. Called by tcp_write
Called by tcp_output() to actually send a TCP segment over IP.
Timer callback function that calls tcp_tmr() and reschedules itself.
Checks if the offered IP address is already in use. It does so by sending an ARP request for the offered address and entering CHECKING state. If no ARP reply is received within a small interval, the address is assumed to be free for use by us.
Ensure DHCP PCB is allocated and bound
A DHCP negotiation transaction, or ARP request, has timed out. The timer that was started with the DHCP or ARP request has timed out, indicating no response was received in time.
The renewal period has timed out.
The rebind period has timed out.
Handle a DHCP ACK packet
Rebind with a DHCP server for an existing DHCP lease.
Decline an offered lease. Tell the DHCP server we do not accept the offered address. One reason to decline the lease is when we find out the address is already in use by another host (through ARP).
If an incoming DHCP message is in response to us, then trigger the state machine
Just a small helper function that sends a pbuf to an ethernet address in the arp_table specified by the index 'arp_idx'.
Return true if the current input packet should be accepted on this netif
Free the oldest datagram to make room for enqueueing new fragments. The datagram 'fraghdr' belongs to is not freed!
Free a struct pbuf_custom_ref
Get the file struct for a 404 error page. Tries some file names and returns NULL if none found.
Free a struct http_state. Also frees the file data if dynamic.
The connection shall be actively closed (using RST to close from fault states). Reset the sent- and recv-callbacks.
Sub-function of http_send(): end-of-file (or block) is reached, either close the file or read the next block (if supported). @returns: 0 if the file is finished or no data has been read 1 if the file is not finished and data has been read
Try to find the file specified by uri and, if found, initialize hs accordingly.
Initialize a http connection with a file to send (if found). Called by http_find_file and http_find_error_file.
Execute a DNS query Called from netconn_gethostbyname
Initialize the resolver: set up the UDP pcb and configure the default server (if DNS_SERVER_ADDRESS is set).
The DNS resolver client timer - handle retries and timeouts and should be called every DNS_TMR_INTERVAL milliseconds (every second by default).
Initialize one of the DNS servers.
lwip_getsockopt_impl: the actual implementation of getsockopt: same argument as lwip_getsockopt, either called directly or through callback
Check if any select waiters are waiting on this socket and its events
lwip_setsockopt_impl: the actual implementation of setsockopt: same argument as lwip_setsockopt, either called directly or through callback
Free a socket (under lock)
Free a socket's leftover members.
Allocate a new socket for a given netconn.
Free a socket. The socket's netconn must have been delete before!
Send a DNS query packet.
Call dns_check_entry for each entry in dns_table - check all entries.
Receive input function for DNS response packets arriving for the dns UDP pcb.
Check whether there are other backup DNS servers available to try
This function calls dhcp_release_and_stop() internally. @deprecated Use dhcp_release_and_stop() instead.
Add a network interface to the list of lwIP netifs. Same as netif_add but without IPv4 addresses
Remove a network interface from the list of lwIP netifs.
Change the IP address of a network interface
Change the netmask of a network interface
Change the default gateway for a network interface
Forwards a received packet for input processing with ethernet_input() or ip_input() depending on netif flags. Don't call directly, pass to netif_add() and call netif->input(). Only works if the netif driver correctly sets NETIF_FLAG_ETHARP and/or NETIF_FLAG_ETHERNET flag!
Return the interface index for the netif with name or NETIF_NO_INDEX if not found/on error
Return the interface name for the netif matching index or NULL if not found/on error
Simple interface to ip_output_if. It finds the outgoing network interface and calls upon ip_output_if to do the actual work.
Set a statically allocated struct dhcp to work with. Using this prevents dhcp_start to allocate it using mem_malloc.
Removes a struct dhcp from a netif. ATTENTION: Only use this when not using dhcp_set_struct() to allocate the struct dhcp since the memory is passed back to the heap.
This function calls dhcp_release_and_stop() internally. @deprecated Use dhcp_release_and_stop() instead.
Inform a DHCP server of our manual configuration. This informs DHCP servers of our fixed IP address configuration by sending an INFORM message. It does not involve DHCP address configuration, it is just here to be nice to the network.
Checks if a netmask is valid (starting with ones, then only zeros)
Ascii internet address interpretation routine. The value returned is in network order.
Adjusts the payload pointer to hide or reveal headers in the payload. Adjusts the ->payload pointer so that space for a header (dis)appears in the pbuf payload. The ->payload, ->tot_len and ->len fields are adjusted. PBUF_ROM and PBUF_REF type buffers cannot have their sizes increased, so the call will fail. A check is made that the increase in header size does not move the payload pointer in front of the start of the buffer.
Same as pbuf_add_header but does not check if 'header_size > 0' is allowed. This is used internally only, to allow PBUF_REF for RX.
Dechains the first pbuf from its succeeding pbufs in the chain. Makes p->tot_len field equal to p->len.
Get part of a pbuf's payload as contiguous memory. The returned memory is either a pointer into the pbuf's payload or, if split over multiple pbufs, a copy into the user-supplied buffer.
Creates a single pbuf out of a queue of pbufs. @remark: Either the source pbuf 'p' is freed by this function or the original pbuf 'p' is returned, therefore the caller has to check the result!
Find occurrence of substr with length substr_len in pbuf p, start at offset start_offset WARNING: in contrast to strstr(), this one does not stop at the first \0 in the pbuf/source string!
Contiguously allocates enough space for count objects that are size bytes of memory each and returns a pointer to the allocated memory. The allocated memory is filled with bytes of value zero.
Deallocates a mutex.
Finds (stable) ethernet/IP address pair from ARP table using interface and IP address index.
Possibility to iterate over stable ARP table entries
Call a specific function in the thread context of tcpip_thread for easy access synchronization. A function called in that way may access lwIP core code without fearing concurrent access. Blocks until the request is posted. Must not be called from interrupt context! @see tcpip_try_callback
Allocate a structure for a static callback message and initialize it. The message has a special type such that lwIP never frees it. This is intended to be used to send "static" messages from interrupt context, e.g. the message is allocated once and posted several times from an IRQ using tcpip_callbackmsg_trycallback(). Example usage: Trigger execution of an ethernet IRQ DPC routine in lwIP thread context. @see tcpip_callbackmsg_trycallback() @see tcpip_callbackmsg_delete()
Free a callback message allocated by tcpip_callbackmsg_new(). @see tcpip_callbackmsg_new()
Try to post a callback-message to the tcpip_thread tcpip_mbox. @see tcpip_callbackmsg_new()
Try to post a callback-message to the tcpip_thread mbox. Same as tcpip_callbackmsg_trycallback but calls sys_mbox_trypost_fromisr(), mainly to help FreeRTOS, where calls differ between task level and ISR level. @see tcpip_callbackmsg_new()
A simple wrapper function that allows you to free a pbuf from interrupt context.
A simple wrapper function that allows you to free heap memory from interrupt context.
Sleep for some ms. Timeouts are NOT processed while sleeping.
Go through timeout list (for this task only) and remove the first matching entry (subsequent entries remain untouched), even though the timeout has not triggered yet.
Rebase the timeout times to the current time. This is necessary if sys_check_timeouts() hasn't been called for a long time (e.g. while saving energy) to prevent all timer functions of that period being called.
Chain one netbuf to another (@see pbuf_chain)
Move the current data pointer of a packet buffer contained in a netbuf to the beginning of the packet. The packet buffer itself is not modified.
Create (allocate) and initialize a new netbuf. The netbuf doesn't yet contain a packet buffer!
Allocate memory for a packet buffer for a given netbuf.
Send data (in form of a netbuf) to a specific remote IP address and port. Only to be used for UDP and RAW netconns (not TCP).
Bind a netconn to a specific interface and port. Binding one netconn twice might not always be checked correctly!
Receive data (in form of a netbuf) from a UDP or RAW netconn
Receive data (in form of a pbuf) from a TCP netconn
Call tcp_output for all active pcbs that have TF_NAGLEMEMERR set
Synchronously calls function in TCPIP thread and waits for its completion. It is recommended to use LWIP_TCPIP_CORE_LOCKING (preferred) or LWIP_NETCONN_SEM_PER_THREAD. If not, a semaphore is created and destroyed on every call which is usually an expensive/slow operation.
TCP callback function if a connection (opened by tcp_connect/lwip_netconn_do_connect) has been established (or reset by the remote host). @see tcp.h (struct tcp_pcb.connected) for parameters and return values
Receive callback function for TCP netconns. Posts the packet to conn->recvmbox, but doesn't delete it on errors. @see tcp.h (struct tcp_pcb.recv) for parameters and return value
Receive callback function for UDP netconns. Posts the packet to conn->recvmbox or deletes it on memory error. @see udp.h (struct udp_pcb.recv) for parameters
Create a new pcb of a specific type. Called from lwip_netconn_do_newconn().
Accept callback function for TCP netconns. Allocates a new netconn and posts that to conn->acceptmbox. @see tcp.h (struct tcp_pcb_listen.accept) for parameters and return value
Wait (forever) for a message to arrive in an mbox. While waiting, timeouts are processed.
The main lwIP thread. This thread has exclusive access to lwIP core functions (unless access to them is not locked). Other threads communicate with this thread using message boxes. It also starts all the timers to make sure they are running in the right thread context.
Simple callback function used with tcpip_callback to free a pbuf (pbuf_free has a wrong signature for tcpip_callback)
Parts of the pseudo checksum which are common to IPv4 and IPv6
Parts of the pseudo checksum which are common to IPv4 and IPv6
"Plug holes" by combining adjacent empty struct mems. After this function is through, there should not exist one empty struct mem pointing to another empty struct mem. This assumes access to the heap is protected by the calling function already.
Free a tcp listen pcb
Called when a listen pcb is closed. Iterates one pcb list and removes the closed listener pcb from pcb->listener if matching.
Called when a listen pcb is closed. Iterates all pcb lists and removes the closed listener pcb from pcb->listener if matching.
Kills the oldest active connection that has a lower priority than 'prio'.
Kills the oldest connection that is in TIME_WAIT state. Called from tcp_alloc() if no more connections are available.
Default accept callback if no accept callback is specified by the user.
Checks if tcp_write is allowed or not (checks state, snd_buf and snd_queuelen).
Allocate a new local UDP port.
Common code to see if the current input packet matches the pcb (current input packet is accessed via ip(4/6)_current_* macros)
Remember the configuration offered by a DHCP server.
Back-off the DHCP client (because of a received NAK response). Back-off the DHCP client because of a received NAK. Receiving a NAK means the client asked for something non-sensible, for example when it tries to renew a lease obtained on another network. We clear any existing set IP address and restart DHCP negotiation afresh (as per RFC2131 3.2.3).
Extract the DHCP message and the DHCP options. Extract the DHCP message and the DHCP options, each into a contiguous piece of memory. As a DHCP message is variable sized by its options, and also allows overriding some fields for options, the easy approach is to first unfold the options into a contiguous piece of memory, and use that further on.
Update (or insert) a IP/MAC address pair in the ARP cache. If a pending entry is resolved, any queued packets will be sent at this point. @see pbuf_free()
Enqueues a new fragment into the fragment queue
Chain a new pbuf into the pbuf list that composes the datagram. The pbuf list will grow over time as new pbufs are rx. Also checks that the datagram passes basic continuity checks (if the last fragment was received at least once).
Allocate a new struct pbuf_custom_ref
Free-callback function to free a 'struct pbuf_custom_ref', called by pbuf_free.
When data has been received in the correct state, try to parse it as a HTTP request.
Initialize a struct http_state.
Allocate a struct http_state.
Free a struct http_state. Also frees the file data if dynamic.
Sub-function of http_send(): This is the normal send-routine for non-ssi files @returns: - 1: data has been written (so call tcp_ouput) - 0: no data has been written (no need to call tcp_output)
The pcb had an error and is already deallocated. The argument might still be valid (if != NULL).
Data has been sent and acknowledged by the remote host. This means that more data can be sent.
Data has been received on this pcb. For HTTP 1.0, this should normally only happen once (if the request fits in one packet).
A new incoming connection has been accepted.
Returns an entry containing addresses of address family AF_INET for the host with name name. Due to dns_gethostbyname limitations, only one address is returned.
Thread-safe variant of lwip_gethostbyname: instead of using a static buffer, this function takes buffer and errno pointers as arguments and uses these for the result.
LWIP_NETCONN_SEM_PER_THREAD==1: initialize thread-local semaphore
LWIP_NETCONN_SEM_PER_THREAD==1: destroy thread-local semaphore
Callback function that is called when DNS name is resolved (or on timeout). A waiting application thread is waked up by signaling the semaphore.
Obtain one of the currently configured DNS server.
Resolve a hostname (string) into an IP address. NON-BLOCKING callback version for use with raw API!!! Returns immediately with one of err_t return codes: - ERR_OK if hostname is a valid IP address string or the host name is already in the local names table. - ERR_INPROGRESS enqueue a request to be sent to the DNS server for resolution if no errors are present. - ERR_ARG: dns client not initialized or invalid hostname
Check whether event_callback should wake up a thread waiting in lwip_poll.
dns_alloc_pcb() - allocates a new pcb (or reuses an existing one) to be used for sending a request
Look up a hostname in the array of known hostnames.
Compare the "dotted" name "query" with the encoded name "response" to make sure an answer from the DNS server matches the current dns_table entry (otherwise, answers might arrive late for hostname not on the list any more). For now, this function compares case-insensitive to cope with all kinds of servers. This also means that "dns 0x20 bit encoding" must be checked externally, if we want to implement it. Currently, the request is sent exactly as passed in by he user request.
Walk through a compact encoded DNS name and return the end of the name.
Save TTL and call dns_call_found for correct response.
Queues a new hostname to resolve and sends out a DNS query for that hostname
Sub-function of http_send(): This is the send-routine for ssi files @returns: - 1: data has been written (so call tcp_ouput) - 0: no data has been written (no need to call tcp_output)
Allocate as struct http_ssi_state.
Free a struct http_ssi_state.
Extract URI parameters from the parameter-part of an URI in the form "test.cgi?x=y" @todo: better explanation! Pointers to the parameters are stored in hs->param_vals.
Insert a tag (found in an shtml in the form of "" into the file. The tag's name is stored in ssi->tag_name (NULL-terminated), the replacement should be written to hs->tag_insert (up to a length of LWIP_HTTPD_MAX_TAG_INSERT_LEN). The amount of data written is stored to ssi->tag_insert_len. @todo: return tag_insert_len - maybe it can be removed from struct http_state?
Returns 1 if the mutes is valid, 0 if it is not valid. When using pointers, a simple way is to check the pointer for != NULL. When directly using OS structures, implementing this may be more complex. This may also be a define, in which case the function is not prototyped.
Invalidate a mutex so that sys_mutex_valid() returns 0. ATTENTION: This does NOT mean that the mutex shall be deallocated: sys_mutex_free() is always called before calling this function! This may also be a define, in which case the function is not prototyped.
Ticks/jiffies since power up.

Other commonly used symbols

Name
Location
Summary
This is the aligned version of ip4_addr_t, used as local variable, on the stack, etc.
Main packet buffer struct
Generic data structure used for all lwIP network interfaces. The following fields should be filled in by the initialization function for the device driver: hwaddr_len, hwaddr[], mtu, flags
the TCP protocol control block
No error, everything OK.
the UDP protocol control block
link level hardware address of this interface
length of this buffer
next pbuf in singly linked pbuf chain
total length of this buffer and all next buffers in chain belonging to the same packet. For non-queue packet chains this is the invariant: p->tot_len == p->len + (p->next? p->next->tot_len: 0)
A netconn descriptor
pointer to the actual data in the buffer
flags (@see netif_flags)
A custom pbuf: like a pbuf, but following a function pointer to free it.
LWIP_IPV6==1: Enable IPv6
IP address configuration in network byte order
LWIP_IPV4==1: Enable IPv4
The netconn which to process - always needed: it includes the semaphore which is used to block the application thread until the function finished.
the lwIP internal protocol control block
Eliminates compiler warning about unused arguments (GCC -Wextra -Wunused).
protocol specific PCB members
"Network buffer" - contains data and addressing info
Illegal argument.
This struct includes everything that is necessary to execute a function for a netconn in another thread context (mainly used to process netconns in the tcpip_thread context to be thread safe).
sockets currently are built on netconns, each socket has one netconn
Depending on the executed function, one of these union members is used
Out of memory error.
Contains all internal pointers and states used for a socket
This function is called by the IP module when it wants to send a packet on the interface. This function typically first resolves the hardware address, then sends the packet. For ethernet physical layer, this is usually etharp_output()
descriptive abbreviation
This function is called by ethernet_output() when it wants to send a packet on the interface. This function outputs the pbuf as-is on the link medium.
This function is called by the network device driver to pass a packet up the TCP/IP stack.
A callback function that is informed about events for this netconn
Macro/function to check whether lwIP's threading/locking requirements are satisfied during current function call. This macro usually calls a function that is implemented in the OS-dependent sys layer and performs the following checks: - Not in ISR (this should be checked for NO_SYS==1, too!) - If = 1: TCPIP core lock is held - If = 0: function is called from TCPIP thread @see multithreading
Global data for both IPv4 and IPv6
An Ethernet MAC address
Memory pool descriptor
This function is called when pbuf_free deallocates this pbuf(_custom)
retries of current request
Illegal value.
TCP: when data passed to netconn_write doesn't fit into the send buffer, this temporarily stores the message. Also used during connect and close.
protocol specific PCB members
type of the netconn (TCP, UDP or RAW)
The heap is made up as a list of structs of this type. This does not have to be aligned since for getting its size, we only use the macro SIZEOF_STRUCT_MEM, which automatically aligns.
The global semaphore to lock the stack.
maximum transfer unit (in bytes)
minimum set of fields of any DHCP message
LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname field.
If set, the netif is an ethernet device using ARP. Set by the netif driver in its init function.
number of bytes used in hwaddr
index (-> ram[next]) of the next struct
Use this for input packets in a netif driver when calling netif->input() in the most common case - ethernet-layer netif driver.
LWIP_TCPIP_CORE_LOCKING Creates a global mutex that is held during TCPIP thread operations. Can be locked by client code to perform lwIP operations without changing into TCPIP thread using callbacks. See LOCK_TCPIP_CORE() and UNLOCK_TCPIP_CORE(). Your system should provide mutexes supporting priority inversion to use this.
flags holding more netconn-internal state, see NETCONN_FLAG_* defines
IP reassembly helper struct. This is exported because memp needs to know the size.
If set, the netif has broadcast capability.
LWIP_IGMP==1: Turn on IGMP module.
current DHCP state machine state
LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
used for lwip_netconn_do_write
current state of the netconn
pbuf comes from the pbuf pool. Much like PBUF_ROM but payload might change so it has to be duplicated when queued before transmitting, depending on who has a 'ref' to it.
Get client data. Obtain ID from netif_alloc_client_data_id().
Destination IP address of current_header
Low-level netif error
DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread. The stack size value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created.
Declare a private memory pool Private mempools example: .h: only when pool is used in multiple .c files: LWIP_MEMPOOL_PROTOTYPE(my_private_pool); .c: - in global variables section: LWIP_MEMPOOL_DECLARE(my_private_pool, 10, sizeof(foo), "Some description") - call ONCE before using pool (e.g. in some init() function): LWIP_MEMPOOL_INIT(my_private_pool); - allocate: void* my_new_mem = LWIP_MEMPOOL_ALLOC(my_private_pool); - free: LWIP_MEMPOOL_FREE(my_private_pool, my_new_mem); To relocate a pool, declare it as extern in cc.h. Example for GCC: extern u8_t \_\_attribute\_\_((section(".onchip_mem"))) memp_memory_my_private_pool_base[];
Initialize a private memory pool
Allocate from a private memory pool
Free element from a private memory pool
LWIP_WND_SCALE and TCP_RCV_SCALE: Set LWIP_WND_SCALE to 1 to enable window scaling. Set TCP_RCV_SCALE to the desired scaling factor (shift count in the range of [0..14]). When LWIP_WND_SCALE is enabled but TCP_RCV_SCALE is 0, we can use a large send window while having a small receive window only.
SYS_ARCH_UNPROTECT Perform a "fast" set of the protection level to "lev". This could be implemented by setting the interrupt level to "lev" within the MACRO or by using a semaphore or mutex. This macro will default to calling the sys_arch_unprotect() function which should be implemented in sys_arch.c. If a particular port needs a different implementation, then this macro may be defined in sys_arch.h
The return value of the function executed in tcpip_thread.
List of all TCP PCBs that are in a state in which they accept or send data.
SYS_LIGHTWEIGHT_PROT==1: enable inter-task protection (and task-vs-interrupt protection) for certain critical regions during buffer allocation, deallocation and memory allocation and deallocation. ATTENTION: This is required when using lwIP from more than one context! If you disable this, you must be sure what you are doing!
DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread. The priority value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created.
the TCP protocol control block for listening pcbs
Connection aborted.
MEMP_OVERFLOW_CHECK: memp overflow protection reserves a configurable amount of bytes before and after each memp element in every pool and fills it with a prominent default value. MEMP_OVERFLOW_CHECK == 0 no checking MEMP_OVERFLOW_CHECK == 1 checks each element when it is freed MEMP_OVERFLOW_CHECK >= 2 checks each element in every pool every time memp_malloc() or memp_free() is called (useful but slow!)
LWIP_NETCONN_FULLDUPLEX==1: Enable code that allows reading from one thread, writing from a 2nd thread and closing from a 3rd thread at the same time. ATTENTION: This is currently really alpha! Some requirements: - LWIP_NETCONN_SEM_PER_THREAD==1 is required to use one socket/netconn from multiple threads at once - sys_mbox_free() has to unblock receive tasks waiting on recvmbox/acceptmbox and prevent a task pending on this during/after deletion
protocol specific PCB members
Packed structs support. Wraps u8_t members, where some compilers warn that packing is not necessary.\n For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
mbox where received packets are stored until they are fetched by the netconn application thread (can grow quite big)
common PCB members
LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS transport.
Can be used as a fixed/const ip_addr_t for the IP wildcard. Defined to when IPv4 is enabled. Defined to IP6_ADDR_ANY in IPv6 only systems. Use this if you can handle IPv4 _AND_ IPv6 addresses. Use or IP6_ADDR_ANY when the IP type matters.
Address in use.
TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb.
Includes spare room for transport layer header, e.g. UDP header. Use this if you intend to pass the pbuf to functions like udp_send().
LWIP_ARP==1: Enable ARP functionality.
ARP_TABLE_SIZE: Number of active MAC-IP address pairs cached.
LWIP_NETIF_EXT_STATUS_CALLBACK==1: Support an extended callback function for several netif related event that supports multiple subscribers. @see netif_ext_status_callback
LWIP_NETCONN_SEM_PER_THREAD==1: Use one (thread-local) semaphore per thread calling socket/netconn functions instead of allocating one semaphore per netconn (and per select etc.) ATTENTION: a thread-local semaphore for API calls is needed: - LWIP_NETCONN_THREAD_SEM_GET() returning a sys_sem_t* - LWIP_NETCONN_THREAD_SEM_ALLOC() creating the semaphore - LWIP_NETCONN_THREAD_SEM_FREE() freeing the semaphore The latter 2 can be invoked up by calling netconn_thread_init()/netconn_thread_cleanup(). Ports may call these for threads created with sys_thread_new().
LWIP_IPV6_MLD==1: Enable multicast listener discovery protocol. If LWIP_IPV6 is enabled but this setting is disabled, the MAC layer must indiscriminately pass all inbound IPv6 multicast traffic to lwIP.
Set this to 1 to support SSI (Server-Side-Includes) In contrast to other http servers, this only calls a preregistered callback function (@see http_set_ssi_handler) for each tag (in the format of ) encountered in SSI-enabled pages. SSI-enabled pages must have one of the predefined SSI-enabled file extensions. All files with one of these extensions are parsed when sent. A downside of the current SSI implementation is that persistent connections don't work, as the file length is not known in advance (and httpd currently relies on the Content-Length header for persistent connections). To save memory, the maximum tag length is limited (@see LWIP_HTTPD_MAX_TAG_NAME_LEN). To save memory, the maximum insertion string length is limited (@see LWIP_HTTPD_MAX_TAG_INSERT_LEN). If this is not enought, can be used.
Calculate memory size for an aligned buffer - returns the next highest multiple of MEM_ALIGNMENT (e.g. LWIP_MEM_ALIGN_SIZE(3) and LWIP_MEM_ALIGN_SIZE(4) will both yield 4 for MEM_ALIGNMENT == 4).
common PCB members
Description for a task waiting in select
pbuf payload refers to RAM. This one comes from a pool and should be used for RX. Payload can be chained (scatter-gather RX) but like PBUF_RAM, struct pbuf and its payload are allocated in one piece of contiguous memory (so the first payload byte can be calculated from struct pbuf). Don't use this for TX, if the pool becomes empty e.g. because of TCP queuing, you are unable to receive TCP acks!
number of this interface. Used for if_api and netifapi_netif, as well as for IPv6 zones
Common members of all PCB types
MEMCPY: override this if you have a faster implementation at hand than the one included in your C library
LWIP_CHECKSUM_ON_COPY==1: Calculate checksum when copying data from application buffers to pbufs.
mbox where new connections are stored until processed by the application thread
TCPIP_THREAD_NAME: The name assigned to the main tcpip thread.
TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread. The stack size value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created.
TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages The queue size value itself is platform-dependent, but is passed to sys_mbox_new() when tcpip_init is called.
DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a NETCONN_UDP. The queue size value itself is platform-dependent, but is passed to sys_mbox_new() when the recvmbox is created.
DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a NETCONN_TCP. The queue size value itself is platform-dependent, but is passed to sys_mbox_new() when the recvmbox is created.
DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections. The queue size value itself is platform-dependent, but is passed to sys_mbox_new() when the acceptmbox is created.
TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread. The priority value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created.
TCP_OVERSIZE: The maximum number of bytes that tcp_write may allocate ahead of time in an attempt to create shorter pbuf chains for transmission. The meaningful range is 0 to TCP_MSS. Some suggested values are: 0: Disable oversized allocation. Each tcp_write() allocates a new pbuf (old behaviour). 1: Allocate size-aligned pbufs with minimal excess. Use this if your scatter-gather DMA requires aligned fragments. 128: Limit the pbuf/memory overhead to 20%. TCP_MSS: Try to create unfragmented TCP packets. TCP_MSS/4: Try to create 4 fragments or less per TCP packet.
SYS_ARCH_PROTECT Perform a "fast" protect. This could be implemented by disabling interrupts for an embedded system or by using a semaphore or mutex. The implementation should allow calling SYS_ARCH_PROTECT when already protected. The old protection level is returned in the variable "lev". This macro will default to calling the sys_arch_protect() function which should be implemented in sys_arch.c. If a particular port needs a different implementation, then this macro may be defined in sys_arch.h
pointer to the lowest free block, this is used for faster search
The one and only timeout list
SO_REUSE==1: Enable SO_REUSEADDR option.
Ask if an interface is up
Source IP address of current_header
Not connected.
pbuf data is stored in RAM, used for TX mostly, struct pbuf and its payload are allocated in one piece of contiguous memory (so the first payload byte can be calculated from struct pbuf). pbuf_alloc() allocates PBUF_RAM pbufs as unchained pbufs (although that might change in future versions). This should be used for all OUTGOING packets (TX).
LWIP_DNS_SECURE: controls the security level of the DNS implementation Use all DNS security features by default. This is overridable but should only be needed by very small targets or when using against non standard DNS servers.
1: this area is used; 0: this area is unused
Structure defining the base filename (URL) of a CGI and the associated function which is to be called when that URL is requested.
LWIP_AUTOIP==1: Enable AUTOIP module.
LWIP_TCP_SACK_OUT==1: TCP will support sending selective acknowledgements (SACKs).
SYS_LIGHTWEIGHT_PROT define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection for certain critical regions during buffer allocation, deallocation and memory allocation and deallocation. SYS_ARCH_DECL_PROTECT declare a protection variable. This macro will default to defining a variable of type sys_prot_t. If a particular port needs a different implementation, then this macro may be defined in sys_arch.h.
sem that is used to synchronously execute functions in the core context
Set this to 1 to support HTTP POST
protocol specific PCB members
index (-> ram[prev]) of the previous struct
Buffer error.
MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator. Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution speed (heap alloc can be much slower than pool alloc) and usage from interrupts (especially if your netif driver allocates PBUF_POOL pbufs for received frames from interrupt)! ATTENTION: Currently, this uses the heap for ALL pools (also for private pools, not only for internal pools defined in memp_std.h)!
LWIP_MULTICAST_TX_OPTIONS==1: Enable multicast TX support like the socket options IP_MULTICAST_TTL/IP_MULTICAST_IF/IP_MULTICAST_LOOP, as well as (currently only) core support for the corresponding IPv6 options.
LWIP_TCP_TIMESTAMPS==1: support the TCP timestamp option. The timestamp option is currently only used to help remote hosts, it is not really used locally. Therefore, it is only enabled when a TS option is received in the initial SYN packet from a remote host.
LWIP_SO_SNDTIMEO==1: Enable send timeout for sockets/netconns and SO_SNDTIMEO processing.
used for lwip_netconn_do_bind and lwip_netconn_do_connect
List of all TCP PCBs in TIME-WAIT state
Holds a flag which option was received and is contained in dhcp_rx_options_val, only valid while in dhcp_recv. @todo: move this into struct dhcp?
data that was left from the previous read
counter of how many threads are waiting for this socket using select
DNS table entry
pointer to next in linked list
The list of network interfaces.
SMEMCPY: override this with care! Some compilers (e.g. gcc) can inline a call to memcpy() if the length is known at compile time and is small.
DNS maximum number of entries to maintain locally.
LWIP_SOCKET_SELECT==1 (default): enable select() for sockets (uses a netconn callback to keep track of events). This saves RAM (counters per socket) and code (netconn event callback), which should improve performance a bit).
LWIP_SOCKET_POLL==1 (default): enable poll() for sockets (including struct pollfd, nfds_t, and constants)
Can be used as a fixed/const ip_addr_t for the IPv4 wildcard and the broadcast address
Can be used as a fixed/const ip4_addr_t for the wildcard and the broadcast address
Split an u32_t in two u16_ts and add them up
the last entry, always unused!
If set, the interface has an active link (set by the network interface driver). Either set by the netif driver in its init function (if the link is up at that time) or at a later point once the link comes up
Operation in progress
Packed structs support. Wraps members that are packed structs themselves, where some compilers warn that packing is not necessary.\n For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
LWIP_NETIF_TX_SINGLE_PBUF: if this is set to 1, lwIP *tries* to put all data to be sent into one single pbuf. This is for compatibility with DMA-enabled MACs that do not support scatter-gather. Beware that this might involve CPU-memcpy before transmitting that would not be needed without this flag! Use this only if you need to! ATTENTION: a driver should *NOT* rely on getting single pbufs but check TX pbufs for being in one piece. If not, pbuf_clone can be used to get a single pbuf: if (p->next != NULL) { struct pbuf *q = pbuf_clone(PBUF_RAW, PBUF_RAM, p); if (q == NULL) { return ERR_MEM; } p = q; ATTENTION: do NOT free the old 'p' as the ref belongs to the caller! }
LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
LWIP_SO_LINGER==1: Enable SO_LINGER processing.
used for lwip_netconn_do_getaddr
Routing problem.
Connection closed.
C++ const_cast(val) equivalent to remove constness from a value (GCC -Wcast-qual)
LWIP_MPU_COMPATIBLE: enables special memory management mechanism which makes lwip able to work on MPU (Memory Protection Unit) system by not passing stack-pointers to other threads (this decreases performance as memory is allocated from pools instead of keeping it on the stack)
MEM_OVERFLOW_CHECK: mem overflow protection reserves a configurable amount of bytes before and after each heap allocation chunk and fills it with a prominent default value. MEM_OVERFLOW_CHECK == 0 no checking MEM_OVERFLOW_CHECK == 1 checks each element when it is freed MEM_OVERFLOW_CHECK >= 2 checks all heap elements every time mem_malloc() or mem_free() is called (useful but slow!)
LWIP_SINGLE_NETIF==1: use a single netif only. This is the common case for small real-life targets. Some code like routing etc. can be left out.
LWIP_SOCKET_OFFSET==n: Increases the file descriptor number created by LwIP with n. This can be useful when there are multiple APIs which create file descriptors. When they all start with a different offset and you won't make them overlap you can re implement read/write/close/ioctl/fnctl to send the requested action to the right library (sharing select will need more work though).
common PCB members
Holds the decoded option values, only valid while in dhcp_recv. @todo: move this into struct dhcp?
Pointer to a single pending outgoing packet on this ARP entry.
Set this to 1 to support CGI (old style). This old style CGI support works by registering an array of URLs and associated CGI handler functions (http_set_cgi_handlers). This list is scanned just before fs_open is called from request handling. The handler can return a new URL that is used internally by the httpd to load the returned page (passed to fs_open). Use this CGI type e.g. to execute specific actions and return a page that does not depend on the CGI parameters.
ports are in host byte order
The maximum of DNS servers The first server can be initialized automatically by defining DNS_SERVER_ADDRESS(ipaddr), where 'ipaddr' is an 'ip_addr_t*'
LWIP_UDPLITE==1: Turn on UDP-Lite. (Requires LWIP_UDP)
UDP_DEBUG: Enable debugging in UDP.
Function prototype for functions passed to tcpip_callback()
Current state of the netconn. Non-TCP netconns are always in state NETCONN_NONE!
used for lwip_netconn_do_close (/shutdown)
PPP_SUPPORT==1: Enable PPP.
concurrent access protection
A custom pbuf that holds a reference to another pbuf, which is freed when this custom pbuf is freed. This is used to create a custom PBUF_REF that points into the original pbuf.
Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores should be used instead
Create new netconn connection
the reference count always equals the number of pointers that refer to this pbuf. This can be pointers from an application, the stack itself, or pbuf->next pointers from a chain.
Set this to 1 if you want to free PBUF_RAM pbufs (or call mem_free()) from interrupt context (or another context that doesn't allow waiting for a semaphore). If set to 1, mem_malloc will be protected by a semaphore and SYS_ARCH_PROTECT, while mem_free will only use SYS_ARCH_PROTECT. mem_malloc SYS_ARCH_UNPROTECTs with each loop so that mem_free can run. ATTENTION: As you can see from the above description, this leads to dis-/ enabling interrupts often, which can be slow! Also, on low memory, mem_malloc can need longer. If you don't want that, at least for NO_SYS=0, you can still use the following functions to enqueue a deallocation call which then runs in the tcpip_thread context: - pbuf_free_callback(p); - mem_free_callback(m);
Set this to 1 to enable querying ".local" names via mDNS using a One-Shot Multicast DNS Query
LWIP_TCP_PCB_NUM_EXT_ARGS: When this is > 0, every tcp pcb (including listen pcb) includes a number of additional argument entries in an array (see tcp_ext_arg_alloc_id)
SOCKETS_DEBUG: Enable debugging in sockets.c.
Protocol family and type of the netconn
This vector type is passed to netconn_write_vectors_partly to send multiple buffers at once. ATTENTION: This type has to directly map struct iovec since one is casted into the other!
Set this to 0 to not send the SSI tag (default is on, so the tag will be sent in the HTML page
Set this to 1 to support fs_read() to dynamically read file data. Without this (default=off), only one-block files are supported, and the contents must be ready after fs_open().
offset into total length/output of bytes written when err == ERR_OK
List of all TCP PCBs in LISTEN state
pointer to the heap (ram_heap): for alignment, ram is now a pointer instead of an array
As lwip_netconn_do_gethostbyname requires more arguments but doesn't require a netconn, it has its own struct (to avoid struct api_msg getting bigger than necessary). lwip_netconn_do_gethostbyname must be called using tcpip_callback instead of tcpip_apimsg (see netconn_gethostbyname).
A struct sockaddr replacement that has the same alignment as sockaddr_in/ sockaddr_in6 if instantiated.
The global array of available sockets
misc flags
Function prototype for netif->input functions. This function is saved as 'input' callback function in the netif struct. Call it when a packet has been received.
The default network interface.
IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that this option does not affect outgoing packet sizes, which can be controlled via IP_FRAG.
DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address.
LWIP_DHCP_BOOTP_FILE==1: Store offered_si_addr and boot_file_name.
DNS maximum host name length supported in the name table.
DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled, you have to define an initializer: \#define DNS_LOCAL_HOSTLIST_INIT {DNS_LOCAL_HOSTLIST_ELEM("host_ip4", IPADDR4_INIT_BYTES(1,2,3,4)), \ DNS_LOCAL_HOSTLIST_ELEM("host_ip6", IPADDR6_INIT_HOST(123, 234, 345, 456)} Instead, you can also use an external function: \#define DNS_LOOKUP_LOCAL_EXTERN(x) extern err_t my_lookup_function(const char *name, ip_addr_t *addr, u8_t dns_addrtype) that looks up the IP address and returns ERR_OK if found (LWIP_DNS_ADDRTYPE_xxx is passed in dns_addrtype).
LWIP_NETBUF_RECVINFO==1: append destination addr and port to every netbuf.
PBUF_LINK_ENCAPSULATION_HLEN: the number of bytes that should be allocated for an additional encapsulation header before ethernet headers (e.g. 802.11)
Set this to 1 to implement an SSI tag handler callback that gets a const char* to the tag (instead of an index into a pre-registered array of known tags) If this is 0, the SSI handler callback function is only called pre-registered tags.
LWIP_HTTPD_SSI_MULTIPART==1: SSI handler function is called with 2 more arguments indicating a counter for insert string that are too long to be inserted at once: the SSI handler function must then set 'next_tag_part' which will be passed back to it in the next call.
Set this to 1 if you want to include code that creates HTTP headers at runtime. Default is off: HTTP headers are then created statically by the makefsdata tool. Static headers mean smaller code size, but the (readonly) fsdata will grow a bit as every file includes the HTTP header.
Set this to 1 to support HTTP request coming in in multiple packets/pbufs
common PCB members
List of all TCP PCBs bound but not yet (connected || listening)
only used for socket layer
The interface that received the packet for the current callback invocation.
Common members of all PCB types
First free element of each pool. Elements form a linked list.
MEM_USE_POOLS==1: Use an alternative to malloc() by allocating from a set of memory pools of various sizes. When mem_malloc is called, an element of the smallest pool that can provide the length needed is returned. To use this, MEMP_USE_CUSTOM_POOLS also has to be enabled.
ARP_QUEUEING==1: Multiple outgoing packets are queued during hardware address resolution. By default, only the most recent packet is queued per IP address. This is sufficient for most protocols and mainly reduces TCP connection startup time. Set this to 1 if you know your application sends more than one packet in a row to an IP address that is not in the ARP cache.
ETHARP_SUPPORT_STATIC_ENTRIES==1: enable code to support static ARP table entries (using etharp_add_static_entry/etharp_remove_static_entry).
LWIP_DHCP_GETS_NTP==1: Request NTP servers with discover/select. For each response packet, an callback is called, which has to be provided by the port: void dhcp_set_ntp_servers(u8_t num_ntp_servers, ip_addr_t* ntp_server_addrs);
LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1). This is only needed when no real netifs are available. If at least one other netif is available, loopback traffic uses this netif.
LWIP_SO_RCVTIMEO==1: Enable receive timeout for sockets/netconns and SO_RCVTIMEO processing.
Internet protocol v4
Function prototype for a timeout callback function. Register such a function using sys_timeout().
Set this to 1 to include an application state argument per file that is opened. This allows to keep a state per connection/file.
offset into current vector
Swap the bytes in an u16_t: much like lwip_htons() for little-endian
allow this to be configured in lwipopts.h, but not too small
number of times data was received, set by event_callback(), tested by the receive and select functions
number of times data was ACKed (free send buffer), set by event_callback(), tested by select
Pointer to the next waiting task
semaphore to wake up a task waiting for select
The global list of tasks waiting for select
DNS query message structure. No packing needed: only used locally on the stack.
This function is called when the netif link is set to up or down
a bit field indicating pbuf type and allocation sources (see PBUF_TYPE_FLAG_*, PBUF_ALLOC_FLAG_* and PBUF_TYPE_ALLOC_SRC_MASK)
LWIP_TCPIP_CORE_LOCKING_INPUT: when LWIP_TCPIP_CORE_LOCKING is enabled, this lets tcpip_input() grab the mutex for input packets as well, instead of allocating a message and passing it to tcpip_thread. ATTENTION: this does not work when tcpip_input() is called from interrupt context!
MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library instead of the lwip internal allocator. Can save code size if you already use it.
LWIP_ETHERNET==1: enable ethernet support even though ARP might be disabled
LWIP_DHCP_AUTOIP_COOP==1: Allow DHCP and AUTOIP to be both enabled on the same interface at the same time.
TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really sends, the 'effective send MSS,' MUST be the smaller of the send MSS (which reflects the available reassembly buffer size at the remote host) and the largest size permitted by the IP layer" (RFC 1122) Setting this to 1 enables code that checks TCP_MSS against the MTU of the netif used for a connection and limits the MSS if it would be too big otherwise.
LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names through defines. LWIP_COMPAT_SOCKETS==2: Same as ==1 but correctly named functions are created. While this helps code completion, it might conflict with existing libraries. (only used if you use sockets.c)
LWIP_IPV6_SCOPES==1: Enable support for IPv6 address scopes, ensuring that e.g. link-local addresses are really treated as link-local. Disable this setting only for single-interface configurations. All addresses that have a scope according to the default policy (link-local unicast addresses, interface-local and link-local multicast addresses) should now have a zone set on them before being passed to the core API, although lwIP will currently attempt to select a zone on the caller's behalf when necessary. Applications that directly assign IPv6 addresses to interfaces (which is NOT recommended) must now ensure that link-local addresses carry the netif's zone. See the new ip6_zone.h header file for more information and relevant macros. For now it is still possible to turn off scopes support through the new LWIP_IPV6_SCOPES option. When upgrading an implementation that uses the core API directly, it is highly recommended to enable LWIP_IPV6_SCOPES_DEBUG at least for a while, to ensure e.g. proper address initialization.
TCP_DEBUG: Enable debugging for TCP.
TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug.
Whether the network interface is 'up'. This is a software flag used to control whether this network interface is enabled and processes traffic. It must be set by the startup code before this netif can be used (also for dhcp/autoip).
Ethernet header
the ARP message, see RFC 826 ("Packet format")
This struct contains information about a stack-internal timer function that has to be called at a defined interval
Same as sys_mbox_valid() but taking a value, not a pointer
size of the application data to send
Set this to 1 to enable HTTP/1.1 persistent connections. ATTENTION: If the generated file system includes HTTP headers, these must include the "Connection: keep-alive" header (pass argument "-11" to makefsdata).
LWIP_HTTPD_FS_ASYNC_READ==1: support asynchronous read operations (fs_read_async returns FS_READ_DELAYED and calls a callback when finished).
protocol specific PCB members
used for lwip_netconn_do_send
current vector to write
Common members of all PCB types
Protocol specific PCB members
An array with all (non-temporary) PCB lists, mainly used for smaller code size
This semaphore is posted when the name is resolved, the application thread should wait on it.
Errors are given back here
Callback which is invoked when a hostname is found. A function of this type must be implemented by the application using the DNS resolver.
Pointer to the previous waiting task
DNS message header
The interface that accepted the packet for the current callback invocation.
Operation would block.
Connection reset.
Common members of all PCB types
ports are in host byte order
track PCB allocation state
Align a memory pointer to the alignment defined by MEM_ALIGNMENT so that ADDR % MEM_ALIGNMENT == 0
IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note that this option does not affect incoming packet sizes, which can be controlled via IP_REASSEMBLY.
TCP_SNDLOWAT: TCP writable space (bytes). This must be less than TCP_SND_BUF. It is the amount of space which must be available in the TCP snd_buf for select to return writable (combined with TCP_SNDQUEUELOWAT).
The maximum allowed backlog for TCP listen netconns. This backlog is used unless another is explicitly specified. 0xff is the maximum (u8_t).
LWIP_EVENT_API and LWIP_CALLBACK_API: Only one of these should be set to 1. LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all events (accept, sent, etc) that happen in the system. LWIP_CALLBACK_API==1: The PCB callback function is called directly for the event. This is the default.
LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface changes its up/down status (i.e., due to DHCP IP acquisition)
LWIP_NETIF_HWADDRHINT==1: Cache link-layer-address hints (e.g. table indices) in struct netif. TCP and UDP can make use of this to prevent scanning the ARP table for every sent packet. While this is faster for big ARP tables or many concurrent connections, it might be counterproductive if you have a tiny ARP table or if there never are concurrent connections.
LWIP_NUM_NETIF_CLIENT_DATA: Number of clients that may store data in client_data member array of struct netif (max. 256).
LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP address equal to the netif IP address, looping them back up the stack.
LWIP_TCPIP_TIMEOUT==1: Enable tcpip_timeout/tcpip_untimeout to create timers running in tcpip_thread from another thread.
LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set in seconds. (does not require sockets.c, and will affect tcp.c)
LWIP_SUPPORT_CUSTOM_PBUF==1: Custom pbufs behave much like their pbuf type but they are allocated by external code (initialised by calling pbuf_alloced_custom()) and when pbuf_free gives up their last reference, they are freed by calling pbuf_custom->custom_free_function(). Currently, the pbuf_custom code is only needed for one specific configuration of IP_FRAG, unless required by external driver/application code.
This array contains all stack-internal cyclic timers. To get the number of timers, use LWIP_ARRAYSIZE()
Used to inform the callback function about changes Event explanation: In the netconn implementation, there are three ways to block a client: - accept mbox (sys_arch_mbox_fetch(&conn->acceptmbox, &accept_ptr, 0); in netconn_accept()) - receive mbox (sys_arch_mbox_fetch(&conn->recvmbox, &buf, 0); in netconn_recv_data()) - send queue is full (sys_arch_sem_wait(LWIP_API_MSG_SEM(msg), 0); in lwip_netconn_do_write()) The events have to be seen as events signaling the state of these mboxes/semaphores. For non-blocking connections, you need to know in advance whether a call to a netconn function call would block or not, and these events tell you about that. RCVPLUS events say: Safe to perform a potentially blocking call call once more. They are counted in sockets - three RCVPLUS events for accept mbox means you are safe to call netconn_accept 3 times without being blocked. Same thing for receive mbox. RCVMINUS events say: Your call to to a possibly blocking function is "acknowledged". Socket implementation decrements the counter. For TX, there is no need to count, its merely a flag. SENDPLUS means you may send something. SENDPLUS occurs when enough data was delivered to peer so netconn_send() can be called again. A SENDMINUS event occurs when the next call to a netconn_send() would be blocking.
A callback prototype to inform about events for a netconn
the last asynchronous unreported error this netconn had
Set this to 1 to support CGI (new style). This new style CGI support works by calling a global function (tCGIHandler) for all URLs that are found. fs_open is called first and the URL can not be written by the CGI handler. Instead, this handler gets passed the http file state, an object where it can store information derived from the CGI URL or parameters. This file state is later passed to SSI, so the SSI code can return data depending on CGI input. Use this CGI handler if you want CGI information passed on to SSI.
Set this to 1 and provide the functions: - "int fs_open_custom(struct fs_file *file, const char *name)" Called first for every opened file to allow opening files that are not included in fsdata(_custom).c - "void fs_close_custom(struct fs_file *file)" Called to free resources allocated by fs_open_custom().
number of unwritten vectors
total length across vectors
Function prototype for tcp error callback functions. Called when the pcb receives a RST or is unexpectedly closed for any other reason.
DHCP_OPTION_MAX_MSG_SIZE is set to the MTU
The IP reassembly code currently has the following limitations: - IP header options are not supported - fragments must not overlap (e.g. due to different routes), currently, overlapping or duplicate fragments are thrown away if IP_REASS_CHECK_OVERLAP=1 (the default)! @todo: work with IP header options Setting this to 0, you can turn off checking the fragments for overlapping regions. The code gets a little smaller. Only use this if you know that overlapping won't occur on your network!
helper struct for gethostbyname_r to access the char* buffer
error happened for this socket, set by event_callback(), tested by select
Function pointer for the SSI tag handler callback. This function will be called each time the HTTPD server detects a tag of the form in files with extensions mentioned in the g_pcSSIExtensions array (currently .shtml, .shtm, .ssi, .xml, .json) where "name" appears as one of the tags supplied to http_set_ssi_handler in the tags array. The returned insert string, which will be appended after the the string "" in file sent back to the client, should be written to pointer pcInsert. iInsertLen contains the size of the buffer pointed to by pcInsert. The iIndex parameter provides the zero-based index of the tag as found in the tags array and identifies the tag that is to be processed. The handler returns the number of characters written to pcInsert excluding any terminating NULL or HTTPD_SSI_TAG_UNKNOWN when tag is not recognized. Note that the behavior of this SSI mechanism is somewhat different from the "normal" SSI processing as found in, for example, the Apache web server. In this case, the inserted text is appended following the SSI tag rather than replacing the tag entirely. This allows for an implementation that does not require significant additional buffering of output data yet which will still offer usable SSI functionality. One downside to this approach is when attempting to use SSI within JavaScript. The SSI tag is structured to resemble an HTML comment but this syntax does not constitute a comment within JavaScript and, hence, leaving the tag in place will result in problems in these cases. In order to avoid these problems, define LWIP_HTTPD_SSI_INCLUDE_TAG as zero in your lwip options file, or use JavaScript style block comments in the form / * # name * / (without the spaces).
Argument supplied to netif_ext_callback_fn.
receive callback function
Includes spare room for link layer header (ethernet header). Use this if you intend to pass the pbuf to functions like ethernet_output(). @see PBUF_LINK_HLEN
pbuf data is stored in ROM, i.e. struct pbuf and its payload are located in totally different memory areas. Since it points to ROM, payload does not have to be copied when queued for transmission.
Function prototype for netif init functions. Set up flags and output/linkoutput callback functions in this function.
ETHARP_TABLE_MATCH_NETIF==1: Match netif for ARP table entries. If disabled, duplicate IP address on multiple netifs are not supported (but this should only occur for AutoIP).
TCP_SNDQUEUELOWAT: TCP writable bufs (pbuf count). This must be less than TCP_SND_QUEUELEN. If the number of pbufs queued on a pcb drops below this number, select returns writable (combined with TCP_SNDLOWAT).
LWIP_ALTCP==1: enable the altcp API. altcp is an abstraction layer that prevents applications linking against the tcp.h functions but provides the same functionality. It is used to e.g. add SSL/TLS or proxy-connect support to an application written for the tcp callback API without that application knowing the protocol details. With LWIP_ALTCP==0, applications written against the altcp API can still be compiled but are directly linked against the tcp.h callback API and then cannot use layered protocols. See altcp_api
LWIP_NETIF_REMOVE_CALLBACK==1: Support a callback function that is called when a netif has been removed
LWIP_CHECKSUM_CTRL_PER_NETIF==1: Checksum generation/check can be enabled/disabled per netif. ATTENTION: if enabled, the CHECKSUM_GEN_* and CHECKSUM_CHECK_* defines must be enabled!
LWIP_ICMP6==1: Enable ICMPv6 (mandatory per RFC)
Determine if two address are on the same network. @arg addr1 IP address 1 @arg addr2 IP address 2 @arg mask network identifier mask
Indicates that the payload directly follows the struct pbuf.
This is the common part of all PCB types. It needs to be at the beginning of a PCB type definition. It is located here so that changes to this common part are made in one location instead of
If a nonblocking write has been rejected before, poll_tcp needs to
Set this to 1 to enable timing each file sent
Set this to 1 to kill the oldest connection when running out of memory for 'struct http_state' or 'struct http_ssi_state'. ATTENTION: This puts all connections on a linked list, so may be kind of slow.
HTTPD_PRECALCULATED_CHECKSUM==1: include precompiled checksums for predefined (MSS-sized) chunks of the files to prevent having to calculate the checksums at runtime.
common PCB members
ICMP destination unreachable codes
ICMP time exceeded codes
Common members of all PCB types
Protocol specific PCB members
PPPOE_SUPPORT==1: Enable PPP Over Ethernet
Set to 0 to prevent freeing the oldest datagram when the reassembly buffer is full (IP_REASS_MAX_PBUFS pbufs are enqueued). The code gets a little smaller. Datagrams will be freed by timeout only. Especially useful when MEMP_NUM_REASSDATA is set to 1, so one datagram can be reassembled at a time, only.
DNS answer message structure. No packing needed: only used locally on the stack.
DNS request table entry: used when dns_gehostbyname cannot answer the request from the DNS table
Function prototype for netif status- or link-callback functions.
Header of the input packet currently being processed.
Total header length of current_ip4/6_header (i.e. after this, the UDP/TCP header starts)
Function prototype for udp pcb receive callback functions addr and port are in same byte order as in the pcb The callback is responsible for freeing the pbuf if it's not used any more. ATTENTION: Be aware that 'addr' might point into the pbuf 'p' so freeing this pbuf can make 'addr' invalid, too.
user-supplied argument for the recv callback
transaction identifier of last sent request
IP address types for use in ip_addr_t.type member. @see tcp_new_ip_type(), udp_new_ip_type(), raw_new_ip_type().
Includes spare room for IP header. Use this if you intend to pass the pbuf to functions like raw_send().
For incoming packets, this contains the input netif's index
Helper struct for const-correctness only. The only meaning of this one is to provide a const payload pointer for PBUF_ROM type.
pointer to the actual data in the buffer
@name Debug message types (LWIP_DBG_TYPES_ON)
MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h that defines additional pools beyond the "standard" ones required by lwIP. If you set this to 1, you must have lwippools.h in your include path somewhere.
the time an ARP entry stays valid after its last update, for ARP_TMR_INTERVAL = 1000, this is (60 * 5) seconds = 5 minutes.
ETHARP_SUPPORT_VLAN==1: support receiving and sending ethernet packets with VLAN header. See the description of LWIP_HOOK_VLAN_CHECK and LWIP_HOOK_VLAN_SET hooks to check/set VLAN headers. Additionally, you can define ETHARP_VLAN_CHECK to an u16_t VLAN ID to check. If ETHARP_VLAN_CHECK is defined, only VLAN-traffic for this VLAN is accepted. If ETHARP_VLAN_CHECK is not defined, all traffic is accepted. Alternatively, define a function/define ETHARP_VLAN_CHECK_FN(eth_hdr, vlan) that returns 1 to accept a packet or 0 to drop a packet.
ETH_PAD_SIZE: number of bytes added before the ethernet header to ensure alignment of payload after that header. Since the header is 14 bytes long, without this padding e.g. addresses in the IP header will not be aligned on a 32-bit boundary, so setting this to 2 can speed up 32-bit-platforms.
IP_FORWARD==1: Enables the ability to forward IP packets across network interfaces. If you are going to run lwIP on a device with only one network interface, define this to 0.
IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled. Since the received pbufs are enqueued, be sure to configure PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive packets even if the maximum amount of fragments is enqueued for reassembly! When IPv4 *and* IPv6 are enabled, this even changes to (PBUF_POOL_SIZE > 2 * IP_REASS_MAX_PBUFS)!
IP_SOF_BROADCAST_RECV (requires IP_SOF_BROADCAST=1) enable the broadcast filter on recv operations.
ICMP_TTL: Default value for Time-To-Live used by ICMP packets.
TCP_MAXRTX: Maximum number of retransmissions of data segments.
TCP_SYNMAXRTX: Maximum number of retransmissions of SYN segments.
LWIP_PBUF_REF_T: Refcount type in pbuf. Default width of u8_t can be increased if 255 refs are not enough for you.
LWIP_NETIF_API==1: Support netif api (in netifapi.c)
LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names. Disable this option if you use a POSIX operating system that uses the same names (read, write & close). (only used if you use sockets.c)
LWIP_IPV6_FRAG==1: Fragment outgoing IPv6 packets that are too big.
LWIP_IPV6_REASS==1: reassemble incoming IPv6 packets that fragmented
LWIP_ND6_TCP_REACHABILITY_HINTS==1: Allow TCP to provide Neighbor Discovery with reachability hints for connected destinations. This helps avoid sending unicast neighbor solicitation messages.
LWIP_IPV6_DHCP6==1: enable DHCPv6 stateful/stateless address autoconfiguration.
NETIF_DEBUG: Enable debugging in netif.c.
DNS_DEBUG: Enable debugging for DNS.
LWIP_TESTMODE: Changes to make unit test possible
Indicates the data stored in this pbuf can change. If this pbuf needs
indicates this is a custom pbuf: pbuf_free calls pbuf_custom->custom_free_function()
Must be the maximum of all used hardware address lengths across all types of interfaces in use. This does not have to be changed, normally.
Set client data. Obtain ID from netif_alloc_client_data_id().
Get the interface that accepted the current packet. This may or may not be the receiving netif, depending on your netif/network setup. This function must only be called from a receive callback (udp_recv,
Function prototype for the init_done function passed to tcpip_init
sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate. For now we use the same magic value, but we allow this to change in future.
For now, we map straight to sys_arch implementation.
Enable https support?
Set this to 0 to drop support for HTTP/0.9 clients (to save some bytes)
Defines the maximum length of a HTTP request line (up to the first CRLF, copied from pbuf into this a global buffer when pbuf- or packet-queues are received - otherwise the input pbuf is used directly)
This is the size of a static buffer used when URIs end with '/'. In this buffer, the directory requested is concatenated with all the configured default file names. Set to 0 to disable checking default filenames on non-root directories.
Function prototype for tcp accept callback functions. Called when a new connection can be accepted on a listening pcb.
Function prototype for tcp receive callback functions. Called when data has been received.
Function prototype for tcp sent callback functions. Called when sent data has been acknowledged by the remote side. Use it to free corresponding resources. This also means that the pcb has now space available to send new data.
Function prototype for tcp poll callback functions. Called periodically as specified by @see tcp_poll.
Function prototype for tcp connected callback functions. Called when a pcb is connected to the remote side after initiating a connection attempt by calling tcp_connect().
Protocol specific PCB members
common PCB members
pointer to the original pbuf that is referenced
global variable that shows if the tcp timer is currently scheduled or not
Try hard to create a new entry - we want the IP address to appear in
The resolved address is stored here
readset passed to select
writeset passed to select
unimplemented: exceptset passed to select
fds passed to poll; NULL if select
Options for the lwip_pollscan function.
Global variables of this module, kept in a struct for efficient access using base+index.
Already connecting.
Conn already established.
Common members of all PCB types
IPv4+IPv6 ("dual-stack")
The actual pbuf
Allocates a memory buffer of specified size that is of sufficient size to align its start address using LWIP_MEM_ALIGN. You can declare your own version here e.g. to enforce alignment without adding trailing padding bytes (see LWIP_MEM_ALIGN_BUFFER) or your own section placement requirements.\n e.g. if you use gcc and need 32 bit alignment:\n \#define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u8_t variable_name[size] \_\_attribute\_\_((aligned(4)))\n or more portable:\n \#define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u32_t variable_name[(size + sizeof(u32_t) - 1) / sizeof(u32_t)]
Calculate safe memory size for an aligned buffer when using an unaligned type as storage. This includes a safety-margin on (MEM_ALIGNMENT - 1) at the start (e.g. if buffer is u8_t[] and actual data will be u32_t*)
LWIP_TIMERS_CUSTOM==1: Provide your own timer implementation. Function prototypes in timeouts.h and the array of lwip-internal cyclic timers are still included, but the implementation is not. The following functions will be required: sys_timeouts_init(), sys_timeout(), sys_untimeout(), sys_timeouts_mbox_fetch()
MEMP_SANITY_CHECK==1: run a sanity check after each memp_free() to make sure that there are no cycles in the linked lists.
MEM_SANITY_CHECK==1: run a sanity check after each mem_free() to make sure that the linked list of heap elements is not corrupted.
MEMP_NUM_NETCONN: the number of struct netconns. (only needed if you use the sequential API, like api_lib.c)
IP_SOF_BROADCAST=1: Use the SOF_BROADCAST field to enable broadcast filter per pcb on udp and raw send operations. To enable broadcast filter on recv operations, you also have to set IP_SOF_BROADCAST_RECV=1.
LWIP_BROADCAST_PING==1: respond to broadcast pings (default is unicast only)
LWIP_MULTICAST_PING==1: respond to multicast pings (default is unicast only)
LWIP_DHCP_MAX_DNS_SERVERS > 0: Request DNS servers with discover/select. DNS servers received in the response are passed to DNS via dns_setserver() (up to the maximum limit defined here).
DNS maximum number of retries when asking for a name, before "timeout".
If this is turned on, the local host-list can be dynamically changed at runtime.
Define this to something that triggers a watchdog. This is called from tcpip_thread after processing a message.
By default, TCP socket/netconn close waits 20 seconds max to send the FIN
LWIP_ND6_ALLOW_RA_UPDATES==1: Allow Router Advertisement messages to update Reachable time and retransmission timers, and netif MTU.
ICMP_DEBUG: Enable debugging in icmp.c.
IP_DEBUG: Enable debugging for IP.
TCP_CWND_DEBUG: Enable debugging for TCP congestion window.
TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions.
4 bits are reserved for 16 allocation sources (e.g. heap, pool1, pool2, etc)
Define this to 0 to prevent freeing ooseq pbufs when the PBUF_POOL is empty
The size of a fully constructed netif name which the netif can be identified by in APIs. Composed of 2 chars, 3 (max) digits, and 1 \0
If set, the netif is an ethernet device. It might not use ARP or TCP/IP if it is used for PPPoE only.
pbufs passed to IP must have a ref-count of 1 as their payload pointer gets altered as the packet is passed down the stack
Function prototype for thread functions
Address resolution protocol
Returned by sys_timeouts_sleeptime() to indicate there is no timer, so we can sleep forever.
MEMCPY-like copying of IP addresses where addresses are known to be 16-bit-aligned if the port is correctly configured (so a port could define this to copying 2 u16_t's) - no NULL-pointer-checking needed.
MEMCPY-like copying of IP addresses where addresses are known to be 16-bit-aligned if the port is correctly configured (so a port could define this to copying 2 u16_t's) - no NULL-pointer-checking needed.
Raw connection IPv4
pointer to the application buffer that contains the data to send
Set this to 0 to prevent parsing the file extension at runtime to decide if a file should be scanned for SSI tags or not. Default is 1 (file extensions are checked using the g_pcSSIExtensions array) Set to 2 to override this runtime test function. This is enabled by default, but if you only use a newer version of makefsdata supporting the "-ssi" option, this info is already present in
Set this to 1 to use a memp pool for allocating struct http_state instead of the heap. If enabled, you'll need to define MEMP_NUM_PARALLEL_HTTPD_CONNS (and MEMP_NUM_PARALLEL_HTTPD_SSI_CONNS for SSI) to set the size of the pool(s).
The poll delay is X*500ms
Priority for tcp pcbs created by HTTPD (very low by default). Lower priorities get killed first when running out of memory.
Number of rx pbufs to enqueue to parse an incoming request (up to the first newline)
used for lwip_netconn_do_recv
Common members of all PCB types
Protocol specific PCB members
members common to struct tcp_pcb and struct tcp_listen_pcb
Flags used on input processing, not on pcb->flags
Table to quickly map an lwIP error (err_t) to a socket error by using -err as an index
LWIP_PPP_API==1: Enable PPP API (in pppapi.c)
'base class'
DHCP_CREATE_RAND_XID: if this is set to 1, the xid is created using LWIP_RAND() (this overrides DHCP_GLOBAL_XID)
Small optimization: set to 0 if incoming PBUF_POOL pbuf always can be used to modify and send a response packet (and to 1 if this is not the case, e.g. when link header is stripped off when receiving)
The IP header ID of the next outgoing IP packet
HTTP request is copied here from pbufs for simple parsing
h_errno is exported in netdb.h for access by applications.
define "hostent" variables storage: 0 if we use a static (but unprotected) set of variables for lwip_gethostbyname, 1 if we use a local storage
nfds passed to poll; 0 if select
don't signal the same semaphore twice: set to 1 when signalled
Clear revents in each struct pollfd.
Increment select_waiting in each struct lwip_sock.
Decrement select_waiting in each struct lwip_sock.
Random generator function to create random TXIDs and source ports for queries
DNS resource record max. TTL (one week as default)
Function prototype for netif->linkoutput functions. Only used for ethernet netifs. This function is called by ARP when a packet shall be sent.
This field can be set by the device driver and could point to state information for the device.
Extended netif status callback (NSC) reasons flags. May be extended in the future!
Args to LWIP_NSC_LINK_CHANGED callback
Args to LWIP_NSC_STATUS_CHANGED callback
Args to LWIP_NSC_IPV4_ADDRESS_CHANGED|LWIP_NSC_IPV4_GATEWAY_CHANGED|LWIP_NSC_IPV4_NETMASK_CHANGED|LWIP_NSC_IPV4_SETTINGS_CHANGED callback
Args to LWIP_NSC_IPV6_SET callback
Args to LWIP_NSC_IPV6_ADDR_STATE_CHANGED callback
Common members of all PCB types
Prototype for a function to free a custom pbuf
Element size
Number of elements
Base address
Function prototype for netif->output functions. Called by lwIP when a packet shall be sent. For ethernet netif, set this to 'etharp_output' and set 'linkoutput'.
Define this to 1 in arch/cc.h of your port if you do not want to include stddef.h header to get size_t. You need to typedef size_t by yourself in this case.
Define this to 1 in arch/cc.h of your port if your compiler does not provide the stdint.h header. You need to typedef the generic types listed in lwip/arch.h yourself in this case (u8_t, u16_t...).
Define this to 1 in arch/cc.h of your port if your compiler does not provide the inttypes.h header. You need to define the format strings listed in lwip/arch.h yourself in this case (X8_F, U16_F...).
Define this to 1 in arch/cc.h of your port if your compiler does not provide the limits.h header. You need to define the type limits yourself in this case (e.g. INT_MAX, SSIZE_MAX).
Define this to 1 in arch/cc.h of your port if your compiler does not provide the ctype.h header. If ctype.h is available, a few character functions are mapped to the appropriate functions (lwip_islower, lwip_isdigit...), if not, a private implementation is provided.
Called as first thing in the lwIP TCPIP thread. Can be used in conjunction with to check core locking. @see multithreading
MEMP_MEM_INIT==1: Force use of memset to initialize pool memory. Useful if pool are moved in uninitialized section of memory. This will ensure default values in pcbs struct are well initialized in all conditions.
MEMP_NUM_RAW_PCB: Number of raw connection PCBs (requires the LWIP_RAW option)
MEMP_NUM_REASSDATA: the number of IP packets simultaneously queued for reassembly (whole packets, not fragments!)
MEMP_NUM_ARP_QUEUE: the number of simultaneously queued outgoing packets (pbufs) that are waiting for an ARP request (to resolve their destination address) to finish. (requires the ARP_QUEUEING option)
MEMP_NUM_IGMP_GROUP: The number of multicast groups whose network interfaces can be members at the same time (one per netif - allsystems group -, plus one per netif membership). (requires the LWIP_IGMP option)
The number of sys timeouts used by the core stack (not apps) The default number of timeouts is calculated here for all enabled modules.
MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used for callback/timeout API communication. (only needed if you use tcpip.c)
IP_OPTIONS_ALLOWED: Defines the behavior for IP options. IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped. IP_OPTIONS_ALLOWED==1: IP options are allowed (but not parsed).
IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally) a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived in this time, the whole packet is discarded.
IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
LWIP_MIB2_CALLBACKS==1: Turn on SNMP MIB2 callbacks. Turn this on to get callbacks needed to implement MIB2. Usually MIB2_STATS should be enabled, too.
LWIP_TCP_MAX_SACK_NUM: The maximum number of SACK values to include in TCP segments. Must be at least 1, but is only used if LWIP_TCP_SACK_OUT is enabled. NOTE: Even though we never send more than 3 or 4 SACK ranges in a single segment (depending on other options), setting this option to values greater than 4 is not pointless. This is basically the max number of SACK ranges we want to keep track of. As new data is delivered, some of the SACK ranges may be removed or merged. In that case some of those older SACK ranges may be used again. The amount of memory used to store SACK ranges is LWIP_TCP_MAX_SACK_NUM * 8 bytes for each TCP PCB.
TCP_OOSEQ_MAX_BYTES: The default maximum number of bytes queued on ooseq per pcb if TCP_OOSEQ_BYTES_LIMIT is not defined. Default is 0 (no limit). Only valid for TCP_QUEUE_OOSEQ==1.
TCP_OOSEQ_MAX_PBUFS: The default maximum number of pbufs queued on ooseq per pcb if TCP_OOSEQ_BYTES_LIMIT is not defined. Default is 0 (no limit). Only valid for TCP_QUEUE_OOSEQ==1.
TCP_WND_UPDATE_THRESHOLD: difference in window to trigger an explicit window update
LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback sending for each netif (0 = disabled)
LWIP_SO_SNDRCVTIMEO_NONSTANDARD==1: SO_RCVTIMEO/SO_SNDTIMEO take an int (milliseconds, much like winsock does) instead of a struct timeval (default).
SO_REUSE_RXTOALL==1: Pass a copy of incoming broadcast/multicast packets to all local matches if SO_REUSEADDR is turned on. WARNING: Adds a memcpy for every packet if passing to more than one pcb!
LWIP_FIONREAD_LINUXMODE==0 (default): ioctl/FIONREAD returns the amount of pending data in the network buffer. This is the way windows does it. It's the default for lwIP since it is smaller. LWIP_FIONREAD_LINUXMODE==1: ioctl/FIONREAD returns the size of the next pending datagram in bytes. This is the way linux does it. This code is only here for compatibility.
CHECKSUM_CHECK_ICMP==1: Check checksums in software for incoming ICMP packets.
LWIP_IPV6_SEND_ROUTER_SOLICIT==1: Send router solicitation messages during network startup.
LWIP_IPV6_AUTOCONFIG==1: Enable stateless address autoconfiguration as per RFC 4862.
LWIP_ND6_QUEUEING==1: queue outgoing IPv6 packets while MAC address is being resolved.
LWIP_ND6_NUM_DESTINATIONS: number of entries in IPv6 destination cache
TCP_WND_DEBUG: Enable debugging in tcp_in.c for window updating.
LWIP_PERF: Enable performance testing for lwIP (if enabled, arch/perf.h is included)
PBUF_NEEDS_COPY(p): return a boolean value indicating whether the given pbuf needs to be copied in order to be kept around beyond the current call stack without risking being corrupted. The default setting provides safety: it will make a copy iof any pbuf chain that does not consist entirely of PBUF_ROM type pbufs. For setups with zero-copy support, it may be redefined to evaluate to true in all cases, for example. However, doing so also has an effect on the application side: any buffers that are *not* copied must also *not* be reused by the application after passing them to lwIP. For example, when setting PBUF_NEEDS_COPY to (0), after using udp_send() with a PBUF_RAM pbuf, the application must free the pbuf immediately, rather than reusing it for other purposes. For more background information on this, see tasks #6735 and #7896, and bugs #11400 and #49914.
Indicates this pbuf is used for RX (if not set, indicates use for TX). This information can be used to keep some spare RX buffers e.g. for
@file lwIP internal memory pools (do not use in application code) This file is deliberately included multiple times: once with empty definition of LWIP_MEMPOOL() to handle all includes and multiple times to build up various lists of mem pools.
Get the interface that received the current packet. This function must only be called from a receive callback (udp_recv,
Get the IPv4 header of the current packet. This function must only be called from a receive callback (udp_recv,
Function prototype for a stack-internal timer function that has to be called at a defined interval
Array size of lwip_cyclic_timers[]
Same as sys_sem_valid() but taking a value, not a pointer
Same as sys_sem_set_invalid() but taking a value, not a pointer
Same as sys_mbox_set_invalid() but taking a value, not a pointer
Define this to 1 and define LWIP_ARP_FILTER_NETIF_FN(pbuf, netif, type) to a filter function that returns the correct netif when using multiple netifs on one hardware interface where the netif's low-level receive routine cannot decide for the correct netif (e.g. when mapping multiple IP addresses to one hardware interface).
For Ethernet network interfaces, we might want to send "gratuitous ARP"; this is an ARP packet sent by a node in order to spontaneously cause other nodes to update an entry in their ARP cache.
UDP IPv4 no checksum
Define FS_FILE_EXTENSION_T_DEFINED if you have typedef'ed to your private pointer type (defaults to 'void' so the default usage is 'void*')
The server port for HTTPD to use
Maximum retries before the connection is aborted/closed. - number of times pcb->poll is called -> default is 4*500ms = 2s; - reset when pcb->sent is called
Set this to one to show error pages when parsing a request fails instead of simply closing the connection.
Number of (TCP payload-) bytes (in pbufs) to enqueue to parse and incoming request (up to the first double-newline)
Set this to 1 to call tcp_abort when tcp_close fails with memory error. This can be used to prevent consuming all memory in situations where the HTTP server has low priority compared to other communication.
Default: Tags are sent from struct http_state and are therefore volatile
Filename (including path) to use as FS data file
used for lwip_netconn_do_newconn
protocol unreachable
port unreachable
fragment reassembly time exceeded
Function prototype for deallocation of arguments. Called *just before* the pcb is freed, so don't expect to be able to do anything with this pcb!
Function prototype to transition arguments from a listening pcb to an accepted pcb
Common members of all PCB types
Common members of all PCB types
Protocol specific PCB members
This is the Nagle algorithm: try to combine user data to send as few TCP segments as possible. Only send if - no previously transmitted data on the connection remains unacknowledged or - the TF_NODELAY flag is set (nagle algorithm turned off for this pcb) or - the only unsent segment is at least pcb->mss bytes long (or there is more than one unsent segment - with lwIP, this can happen although unsent->len < mss) - or if we are in fast-retransmit (TF_INFR)
For release candidates, this is set to 1..254 For official releases, this is set to 255 (LWIP_RC_RELEASE)
PPPOL2TP_SUPPORT==1: Enable PPP Over L2TP
PPPOS_SUPPORT==1: Enable PPP Over Serial
If you want to relocate the heap to external memory, simply define LWIP_RAM_HEAP_POINTER as a void-pointer to that location. If so, make sure the memory at that location is big enough (see below on how that space is calculated). the heap. we need one struct mem at the end and some room for alignment
All allocated blocks will be MIN_SIZE bytes big, at least! MIN_SIZE can be overridden to suit your needs. Smaller values save space, larger values could prevent too small blocks to fragment the RAM too much.
Timer counter to handle calling slow-timer from tcp_tmr()
Define this to 1 for an extra check that the output checksum is valid (usefule when the checksum is generated by the application, not the stack)
The size of segment pbufs created when TCP_OVERSIZE is enabled
Re-request a used ARP entry 1 minute before it would expire to prevent
the time an ARP entry stays pending after first request, for ARP_TMR_INTERVAL = 1000, this is 10 seconds. @internal Keep this number at least 2, otherwise it might run out instantly if the timeout occurs directly after a request.
This is overridable for the rare case where more than 255 threads select on the same socket...
DNS server port address
Limits the source port to be >= 1024 by default
Function pointer for a CGI script handler. This function is called each time the HTTPD server is asked for a file whose name was previously registered as a CGI function using a call to http_set_cgi_handlers. The iIndex parameter provides the index of the CGI within the cgis array passed to http_set_cgi_handlers. Parameters pcParam and pcValue provide access to the parameters provided along with the URI. iNumParams provides a count of the entries in the pcParam and pcValue arrays. Each entry in the pcParam array contains the name of a parameter with the corresponding entry in the pcValue array containing the value for that parameter. Note that pcParam may contain multiple elements with the same name if, for example, a multi-selection list control is used in the form generating the data. The function should return a pointer to a character string which is the path and filename of the response that is to be sent to the connected browser, for example "/thanks.htm" or "/response/error.ssi". The maximum number of parameters that will be passed to this function via iNumParams is defined by LWIP_HTTPD_MAX_CGI_PARAMETERS. Any parameters in the incoming HTTP request above this number will be discarded. Requests intended for use by this CGI mechanism must be sent using the GET method (which encodes all parameters within the URI rather than in a block later in the request). Attempts to use the POST method will result in the request being ignored.
Number of Router Solicitation messages that remain to be sent.
1: up; 0: down
Args to LWIP_NSC_LINK_CHANGED callback
1: up; 0: down
Args to LWIP_NSC_STATUS_CHANGED callback
Old IPv4 address
Args to LWIP_NSC_IPV4_ADDRESS_CHANGED|LWIP_NSC_IPV4_GATEWAY_CHANGED|LWIP_NSC_IPV4_NETMASK_CHANGED|LWIP_NSC_IPV4_SETTINGS_CHANGED callback
Index of changed IPv6 address
Old IPv6 address
Args to LWIP_NSC_IPV6_SET callback
Index of affected IPv6 address
Old IPv6 address state
Affected IPv6 address
Args to LWIP_NSC_IPV6_ADDR_STATE_CHANGED callback
Function used for extended netif status callbacks Note: When parsing reason argument, keep in mind that more reasons may be added in the future!
Includes spare room for additional encapsulation header before ethernet headers (e.g. 802.11). Use this if you intend to pass the pbuf to functions like netif->linkoutput(). @see PBUF_LINK_ENCAPSULATION_HLEN
next pbuf in singly linked pbuf chain
MAC Filter Actions, these are passed to a netif's igmp_mac_filter or mld_mac_filter callback function.
Delete a filter entry
@file lwIP Options Configuration
@file Debug messages infrastructure
@file Support for different processor and compiler architectures
Platform specific diagnostic output.\n Note the default implementation pulls in printf, which may in turn pull in a lot of standard libary code. In resource-constrained systems, this should be defined to something less resource-consuming.
Get rid of alignment cast warnings (GCC -Wcast-align)
Get rid of warnings related to pointer-to-numeric and vice-versa casts, e.g. "conversion from 'u8_t' to 'void *' of greater size"
Avoid warnings/errors related to implicitly casting away packed attributes by doing a explicit cast
@name Debug level (LWIP_DBG_MIN_LEVEL)
@name Enable/disable debug messages completely (LWIP_DBG_TYPES_ON)
MEMMOVE: override this if you have a faster implementation at hand than the one included in your C library. lwIP currently uses MEMMOVE only when IPv6 fragmentation support is enabled.
MEM_USE_POOLS_TRY_BIGGER_POOL==1: if one malloc-pool is empty, try the next bigger pool - WARNING: THIS MIGHT WASTE MEMORY but it can make a system more reliable.
MEMP_NUM_ALTCP_PCB: the number of simultaneously active altcp layer pcbs. (requires the LWIP_ALTCP option) Connections with multiple layers require more than one altcp_pcb (e.g. TLS over TCP requires 2 altcp_pcbs, one for TLS and one for TCP).
MEMP_NUM_FRAG_PBUF: the number of IP fragments simultaneously sent (fragments, not whole packets!). This is only used with LWIP_NETIF_TX_SINGLE_PBUF==0 and only has to be > 1 with DMA-enabled MACs where the packet is not yet sent when netif->output returns.
MEMP_NUM_NETBUF: the number of struct netbufs. (only needed if you use the sequential API, like api_lib.c)
MEMP_NUM_SELECT_CB: the number of struct lwip_select_cb. (Only needed if you have LWIP_MPU_COMPATIBLE==1 and use the socket API. In that case, you need one per thread calling lwip_select.)
MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used for incoming packets. (only needed if you use tcpip.c)
MEMP_NUM_NETDB: the number of concurrently running lwip_addrinfo() calls (before freeing the corresponding memory using lwip_freeaddrinfo()).
MEMP_NUM_LOCALHOSTLIST: the number of host entries in the local host list if DNS_LOCAL_HOSTLIST_IS_DYNAMIC==1.
MEMP_NUM_API_MSG: the number of concurrently active calls to various socket, netconn, and tcpip functions
MEMP_NUM_DNS_API_MSG: the number of concurrently active calls to netconn_gethostbyname
MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA: the number of concurrently active calls to getsockopt/setsockopt
MEMP_NUM_NETIFAPI_MSG: the number of concurrently active calls to the netifapi functions
The maximum number of packets which may be queued for each unresolved address by other network layers. Defaults to 3, 0 means disabled. Old packets are dropped, new packets are queued.
IP_FORWARD_ALLOW_TX_ON_RX_NETIF==1: allow ip_forward() to send packets back out on the netif where it was received. This should only be used for wireless networks. ATTENTION: When this is 1, make sure your netif driver correctly marks incoming link-layer-broadcast/multicast packets as such using the corresponding pbuf flags!
LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
The maximum of NTP servers requested
LWIP_DHCP_AUTOIP_COOP_TRIES: Set to the number of DHCP DISCOVER probes that should be sent before falling back on AUTOIP (the DHCP client keeps running in this case). This can be set as low as 1 to get an AutoIP address very quickly, but you should be prepared to handle a changing IP address when DHCP overrides AutoIP.
DNS do a name checking between the query and the response.
LWIP_ALTCP_TLS==1: enable TLS support for altcp API. This needs a port of the functions in altcp_tls.h to a TLS library. A port to ARM mbedtls is provided with lwIP, see apps/altcp_tls/ directory and LWIP_ALTCP_TLS_MBEDTLS option.
LWIP_LOOPIF_MULTICAST==1: Support multicast/IGMP on loop interface (127.0.0.1).
LWIP_NETIF_LOOPBACK_MULTITHREADING: Indicates whether threading is enabled in the system, as netifs must change how they behave depending on this setting for the LWIP_NETIF_LOOPBACK option to work. Setting this is needed to avoid reentering non-reentrant functions like tcp_input(). LWIP_NETIF_LOOPBACK_MULTITHREADING==1: Indicates that the user is using a multithreaded environment like tcpip.c. In this case, netif->input() is called directly. LWIP_NETIF_LOOPBACK_MULTITHREADING==0: Indicates a polling (or NO_SYS) setup. The packets are put on a list and netif_poll() must be called in the main application loop.
SLIPIF_THREAD_NAME: The name assigned to the slipif_loop thread.
SLIP_THREAD_STACKSIZE: The stack size used by the slipif_loop thread. The stack size value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created.
SLIPIF_THREAD_PRIO: The priority assigned to the slipif_loop thread. The priority value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created.
DEFAULT_THREAD_NAME: The name assigned to any other lwIP thread.
DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a NETCONN_RAW. The queue size value itself is platform-dependent, but is passed to sys_mbox_new() when the recvmbox is created.
If LWIP_SO_RCVBUF is used, this is the default value for recv_bufsize.
CHECKSUM_GEN_ICMP6==1: Generate checksums in software for outgoing ICMP6 packets.
CHECKSUM_CHECK_ICMP6==1: Check checksums in software for incoming ICMPv6 packets
IPV6_REASS_MAXAGE: Maximum time (in multiples of IP6_REASS_TMR_INTERVAL - so seconds, normally) a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived in this time, the whole packet is discarded.
LWIP_IPV6_SCOPES_DEBUG==1: Perform run-time checks to verify that addresses are properly zoned (see ip6_zone.h on what that means) where it matters. Enabling this setting is highly recommended when upgrading from an existing installation that is not yet scope-aware; otherwise it may be too expensive.
LWIP_IPV6_NUM_ADDRESSES: Number of IPv6 addresses per netif.
LWIP_IPV6_FORWARD==1: Forward IPv6 packets across netifs
LWIP_IPV6_ADDRESS_LIFETIMES==1: Keep valid and preferred lifetimes for each IPv6 address. Required for LWIP_IPV6_AUTOCONFIG. May still be enabled otherwise, in which case the application may assign address lifetimes with the appropriate macros. Addresses with no lifetime are assumed to be static. If this option is disabled, all addresses are assumed to be static.
LWIP_IPV6_DUP_DETECT_ATTEMPTS=[0..7]: Number of duplicate address detection attempts.
LWIP_ICMP6_DATASIZE: bytes from original packet to send back in ICMPv6 error messages.
LWIP_ICMP6_HL: default hop limit for ICMPv6 messages
MEMP_NUM_MLD6_GROUP: Max number of IPv6 multicast groups that can be joined. There must be enough groups so that each netif can join the solicited-node multicast group for each of its local addresses, plus one for MDNS if applicable, plus any number of groups to be joined on UDP sockets.
MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC resolution.
LWIP_ND6_NUM_NEIGHBORS: Number of entries in IPv6 neighbor cache
LWIP_ND6_NUM_PREFIXES: number of entries in IPv6 on-link prefixes cache
LWIP_ND6_NUM_ROUTERS: number of entries in IPv6 default router cache
LWIP_ND6_MAX_MULTICAST_SOLICIT: max number of multicast solicit messages to send (neighbor solicit and router solicit)
LWIP_ND6_MAX_UNICAST_SOLICIT: max number of unicast neighbor solicitation messages to send during neighbor reachability detection.
Unused: See ND RFC (time in milliseconds).
LWIP_ND6_REACHABLE_TIME: default neighbor reachable time (in milliseconds). May be updated by router advertisement messages.
LWIP_ND6_RETRANS_TIMER: default retransmission timer for solicitation messages
LWIP_ND6_DELAY_FIRST_PROBE_TIME: Delay before first unicast neighbor solicitation message is sent, during neighbor reachability detection.
LWIP_ND6_RDNSS_MAX_DNS_SERVERS > 0: Use IPv6 Router Advertisement Recursive DNS Server Option (as per RFC 6106) to copy a defined maximum number of DNS servers to the DNS module.
LWIP_IPV6_DHCP6_STATEFUL==1: enable DHCPv6 stateful address autoconfiguration. (not supported, yet!)
LWIP_IPV6_DHCP6_STATELESS==1: enable DHCPv6 stateless address autoconfiguration.
LWIP_DHCP6_GETS_NTP==1: Request NTP servers via DHCPv6. For each response packet, a callback is called, which has to be provided by the port: void dhcp6_set_ntp_servers(u8_t num_ntp_servers, ip_addr_t* ntp_server_addrs);
The maximum of NTP servers requested
LWIP_DHCP6_MAX_DNS_SERVERS > 0: Request DNS servers via DHCPv6. DNS servers received in the response are passed to DNS via dns_setserver() (up to the maximum limit defined here).
LWIP_DBG_MIN_LEVEL: After masking, the value of the debug is compared against this value. If it is smaller, then debugging messages are written. @see debugging_levels
LWIP_DBG_TYPES_ON: A mask that can be used to globally enable/disable debug messages of certain types. @see debugging_levels
ETHARP_DEBUG: Enable debugging in etharp.c.
PBUF_DEBUG: Enable debugging in pbuf.c.
API_LIB_DEBUG: Enable debugging in api_lib.c.
API_MSG_DEBUG: Enable debugging in api_msg.c.
IGMP_DEBUG: Enable debugging in igmp.c.
INET_DEBUG: Enable debugging in inet.c.
IP_REASS_DEBUG: Enable debugging in ip_frag.c for both frag & reass.
RAW_DEBUG: Enable debugging in raw.c.
MEM_DEBUG: Enable debugging in mem.c.
MEMP_DEBUG: Enable debugging in memp.c.
SYS_DEBUG: Enable debugging in sys.c.
TIMERS_DEBUG: Enable debugging in timers.c.
TCP_FR_DEBUG: Enable debugging in tcp_in.c for fast retransmit.
TCP_RTO_DEBUG: Enable debugging in TCP for retransmit timeout.
TCP_RST_DEBUG: Enable debugging for TCP with the RST message.
TCP_QLEN_DEBUG: Enable debugging for TCP queue lengths.
TCPIP_DEBUG: Enable debugging in tcpip.c.
SLIP_DEBUG: Enable debugging in slipif.c.
DHCP_DEBUG: Enable debugging in dhcp.c.
AUTOIP_DEBUG: Enable debugging in autoip.c.
IP6_DEBUG: Enable debugging for IPv6.
DHCP6_DEBUG: Enable debugging in dhcp6.c.
@file DHCP client API
@file netif API (to be used from TCPIP thread)
@file lwIP Error codes
@file IP address API (common IPv4 and IPv6)
@file various utility macros All defines related to this section must not be placed in lwipopts.h, but in arch/perf.h! Measurement calls made throughout lwip, these can be defined to nothing. - PERF_START: start measuring something. - PERF_STOP(x): stop measuring something, and record the result.
@file IPv4 address API
Safely copy one IP address to another and change byte order
@file IPv6 addresses.
@file pbuf API
@file Statistics API (to be used from TCPIP thread)
@file Heap API
@file Memory pool API
@file memory pools lwIP internal implementations (do not use in application code)
@file lwIP internal memory implementations (do not use in application code)
Declare prototype for private memory pool if it is used in multiple files
If set, the netif has IGMP capability.
If set, the netif has MLD6 capability.
netif administrative status changed.\n up is called AFTER netif is set up.\n
@file UDP API (to be used from TCPIP thread)\n See also udp_raw
@file IP API
@file IPv4 API
@file IPv4 protocol definitions
@file IPv6 layer.
@file IP protocol definitions
@file UDP protocol definitions
A list of often ethtypes (although lwIP does not use all of them).
Virtual local area network
Internet protocol v6
PPP Over Ethernet Discovery Stage
PPP Over Ethernet Session Stage
Process field network
Ethernet for control automation technology
Link layer discovery protocol
Serial real-time communication system
Media redundancy protocol
Precision time protocol
Q-in-Q, 802.1ad
VLAN header inserted between ethernet header and payload if 'type' in ethernet header is ETHTYPE_VLAN. See IEEE802.Q
@file Timer implementations
@file OS abstraction layer
@file Ethernet input function - handles INCOMING ethernet level traffic To be used in most low-level netif implementations
@file Ethernet protocol definitions
@file IEEE assigned numbers
@file Ethernet output function - handles OUTGOING ethernet level traffic, implements ARP resolving. To be used in most low-level netif implementations
@file ARP protocol definitions
@file SNMP support API for implementing netifs and statitics for MIB2
@file Functions to sync with TCPIP thread
@deprecated use tcpip_try_callback() or tcpip_callback() instead
Port numbers https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt
@file netconn API (to be used from non-TCPIP threads)
@file netbuf API (for netconn API)
@file HTTP server options list
@file IANA assigned numbers (RFC 1700 and successors)
This string is passed in the HTTP header as "Server: "
The https server port for HTTPD to use
Set this to 1 to enable timing each file sent
Maximum length of the filename to send as response to a POST request, filled in by the application when a POST is finished.
Set this to 1 to send URIs without extension without headers (who uses this at all??)
net unreachable
host unreachable
fragmentation needed and DF set
source route failed
time to live exceeded in transit
A table of callback functions that is invoked for ext arguments
Common members of all PCB types
@file raw API (to be used from TCPIP thread)\n See also raw_raw
@file netconn API lwIP internal implementations (do not use in application code)
@file IGMP API
@file TCPIP API internal implementations (do not use in application code)
@file TCP internal implementations (do not use in application code)
@file TCP API (to be used from TCPIP thread)\n See also tcp_raw
@file Base TCP API definitions shared by TCP and ALTCP\n See also tcp_raw
@file ICMP API
@file ICMP protocol definitions
@file TCP protocol definitions
@file DNS API lwip DNS resolver header file. Author: Jim Pettinato April 2007 ported from uIP resolv.c Copyright (c) 2002-2003, Adam Dunkels. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@file Multicast listener discovery for IPv6. Aims to be compliant with RFC 2710. No support for MLDv2.
@file Posix Errno defines
@file NETDB API (sockets)
@file lwIP initialization API
@file IP checksum calculation functions
@file Socket API (to be used from non-TCPIP threads)
@file Neighbor discovery and stateless address autoconfiguration for IPv6. Aims to be compliant with RFC 4861 (Neighbor discovery) and RFC 4862 (Address autoconfiguration).
PPPOL2TP_AUTH_SUPPORT==1: Enable PPP Over L2TP Auth (enable MD5 support)
ppp.h - Network Point to Point Protocol header file. Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. portions Copyright (c) 1997 Global Election Systems Inc. The authors hereby grant permission to use, copy, modify, distribute, and license this software and its documentation for any purpose, provided that existing copyright notices are retained in all copies and that this notice and the following disclaimer are included verbatim in any distributions. No written agreement, license, or royalty fee is required for any of the authorized uses. THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. REVISION HISTORY 03-01-01 Marc Boucher <marc@mbsi.ca> Ported to lwIP. 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc. Original derived from BSD codes.
@file Application layered TCP connection API (to be used from TCPIP thread)\n This file contains the generic API. For more details see altcp_api.
@file IP fragmentation/reassembly
@file Sockets API internal implementations (do not use in application code)
@file Neighbor discovery and stateless address autoconfiguration for IPv6. Aims to be compliant with RFC 4861 (Neighbor discovery) and RFC 4862 (Address autoconfiguration).
@file IPv6 fragmentation and reassembly.
@file raw API internal implementations (do not use in application code)
@file AutoIP Automatic LinkLocal IP Configuration
@file DHCPv6 client: IPv6 address autoconfiguration as per RFC 3315 (stateful DHCPv6) and RFC 3736 (stateless DHCPv6).
Private experimentation
Reserved for expansion of error messages
Multicast listener query
Multicast listener report
Multicast listener done
Router solicitation
Router advertisement
Neighbor solicitation
Neighbor advertisement
Multicast router advertisement
Multicast router solicitation
Multicast router termination
Private experimentation
Private experimentation
Reserved for expansion of informational messages
ICMP destination unreachable codes
No route to destination
Communication with destination administratively prohibited
Beyond scope of source address
Address unreachable
Port unreachable
Source address failed ingress/egress policy
Reject route to destination
ICMP time exceeded codes
Hop limit exceeded in transit
Fragment reassembly time exceeded
ICMP parameter code
Erroneous header field encountered
Unrecognized next header type encountered
Unrecognized IPv6 option encountered
Destination unreachable
Packet too big
Parameter problem
Private experimentation
@file IPv6 version of ICMP, as per RFC 4443.
@file ICMP6 protocol definitions
Option handling: options are parsed in dhcp_parse_reply and saved in an array where other functions can load them from. This might be moved into the struct dhcp (not necessarily since lwIP is single-threaded and the array is only used while in recv callback).
@file DHCP protocol definitions
@file Application layered TCP connection API (to be used from TCPIP thread)\n This interface mimics the tcp callback API to the application while preventing direct linking (much like virtual functions). This way, an application can make use of other application layer protocols on top of TCP without knowing the details (e.g. TLS, proxy connection). This file contains the base implementation calling into tcp.
Default: dynamic headers are sent from ROM (non-dynamic headers are handled like file data)
This variable is initialized by the system to contain the wildcard IPv6 address.
@file This file (together with sockets.h) aims to provide structs and functions from - arpa/inet.h - netinet/in.h
This macro can be used to initialize a variable of type struct in6_addr
This macro can be used to initialize a variable of type struct in6_addr
@file DNS - host name to IP address resolver.
UDP port for multicast DNS queries
@file 6LowPAN output for IPv6. Uses ND tables for link-layer addressing. Fragments packets to 6LowPAN units.
@file 6LowPAN options list
LWIP_6LOWPAN_NUM_CONTEXTS: define the number of compression contexts per netif type
LWIP_6LOWPAN_INFER_SHORT_ADDRESS: set this to 0 to disable creating short addresses for matching addresses (debug only)
LWIP_6LOWPAN_IPHC: set this to 0 to disable IP header compression as per RFC 6282 (which is mandatory for BLE)
Set this to 1 if your IEEE 802.15.4 interface can calculate and check the CRC in hardware. This means TX packets get 2 zero bytes added on transmission which are to be filled with the CRC.
If LWIP_6LOWPAN_802154_HW_CRC==0, this can override the default slow implementation of the CRC used for 6LoWPAN over IEEE 802.15.4 (which uses a shift register).
Debug level for 6LoWPAN in general
Debug level for 6LoWPAN over IEEE 802.15.4
LWIP_LOWPAN6_IP_COMPRESSED_DEBUG: enable compressed IP frame output debugging
LWIP_LOWPAN6_DECOMPRESSION_DEBUG: enable decompression debug output
LWIP_RFC7668_IP_UNCOMPRESSED_DEBUG: enable decompressed IP frame output debugging
LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS: Currently, the linux kernel driver for 6lowpan sets/clears a bit in the address, depending on the BD address (either public or not). Might not be RFC7668 conform, so you may select to do that (=1) or not (=0)
For LWIP_HTTPD_SSI_RAW==1, return this to indicate the tag is unknown. In this case, the webserver writes a warning into the page. You can also just return 0 to write nothing for unknown tags.

Dependencies

LwIP depends on the following libraries: