PS2SDK
PS2 Homebrew Libraries
tcpip.h File Reference
#include <tamtypes.h>
+ Include dependency graph for tcpip.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pbuf
 
struct  ip4_addr
 
struct  ip6_addr
 
struct  netif
 
struct  in_addr
 
struct  in6_addr
 
struct  sockaddr_in
 
struct  sockaddr
 
struct  sockaddr_storage
 
struct  fd_set
 
struct  hostent
 
struct  addrinfo
 
struct  t_ip_info
 
union  in6_addr.un
 

Macros

#define PS2IP_DNS
 
#define PS2IP_DHCP   1
 
#define LWIP_IPV4   1
 
#define LWIP_IPV6   0
 
#define LWIP_IPV6_MLD   0
 
#define LWIP_CHECKSUM_CTRL_PER_NETIF   0
 
#define LWIP_NETIF_REMOVE_CALLBACK   0
 
#define LWIP_IPV6_AUTOCONFIG   0
 
#define LWIP_MULTICAST_TX_OPTIONS   0
 
#define LWIP_DHCP   1
 
#define LWIP_TCP   1
 
#define LWIP_UDP   1
 
#define LWIP_UDPLITE   0
 
#define MIB2_STATS   0
 
#define ENABLE_LOOPBACK   0
 
#define DNS_LOCAL_HOSTLIST   0
 
#define MEMP_NUM_UDP_PCB   4
 
#define MEMP_NUM_TCP_PCB   5
 
#define MEMP_NUM_NETCONN   (MEMP_NUM_TCP_PCB + MEMP_NUM_UDP_PCB)
 
#define LWIP_NETIF_STATUS_CALLBACK   0
 
#define LWIP_NETIF_LINK_CALLBACK   0
 
#define LWIP_AUTOIP   0
 
#define LWIP_NETIF_HOSTNAME   0
 
#define LWIP_SNMP   0
 
#define LWIP_IGMP   0
 
#define LWIP_NETIF_HWADDRHINT   0
 
#define LWIP_LOOPBACK_MAX_PBUFS   0
 
#define LWIP_NUM_NETIF_CLIENT_DATA   0
 
#define LWIP_SOCKET_OFFSET   0
 
#define LWIP_IPV6_SEND_ROUTER_SOLICIT   1
 
#define DNS_MAX_SERVERS   2
 
#define PBUF_TRANSPORT_HLEN   20
 
#define PBUF_IP_HLEN   20
 
#define IPADDR_NONE   ((u32)0xffffffffUL)
 
#define IPADDR_LOOPBACK   ((u32)0x7f000001UL)
 
#define IPADDR_ANY   ((u32)0x00000000UL)
 
#define IPADDR_BROADCAST   ((u32)0xffffffffUL)
 
#define IP_CLASSA(a)   ((((u32)(a)) & 0x80000000UL) == 0)
 
#define IP_CLASSA_NET   0xff000000
 
#define IP_CLASSA_NSHIFT   24
 
#define IP_CLASSA_HOST   (0xffffffff & ~IP_CLASSA_NET)
 
#define IP_CLASSA_MAX   128
 
#define IP_CLASSB(a)   ((((u32)(a)) & 0xc0000000UL) == 0x80000000UL)
 
#define IP_CLASSB_NET   0xffff0000
 
#define IP_CLASSB_NSHIFT   16
 
#define IP_CLASSB_HOST   (0xffffffff & ~IP_CLASSB_NET)
 
#define IP_CLASSB_MAX   65536
 
#define IP_CLASSC(a)   ((((u32)(a)) & 0xe0000000UL) == 0xc0000000UL)
 
#define IP_CLASSC_NET   0xffffff00
 
#define IP_CLASSC_NSHIFT   8
 
#define IP_CLASSC_HOST   (0xffffffff & ~IP_CLASSC_NET)
 
#define IP_CLASSD(a)   (((u32)(a)&0xf0000000UL) == 0xe0000000UL)
 
#define IP_CLASSD_NET   0xf0000000 /* These ones aren't really */
 
#define IP_CLASSD_NSHIFT   28 /* net and host fields, but */
 
#define IP_CLASSD_HOST   0x0fffffff /* routing needn't know. */
 
#define IP_MULTICAST(a)   IP_CLASSD(a)
 
#define IP_EXPERIMENTAL(a)   (((u32)(a)&0xf0000000UL) == 0xf0000000UL)
 
#define IP_BADCLASS(a)   (((u32)(a)&0xf0000000UL) == 0xf0000000UL)
 
#define IP_LOOPBACKNET   127 /* official! */
 
#define IP4_ADDR(ipaddr, a, b, c, d)
 
#define IPADDR2_COPY(dest, src)   memcpy(dest, src, sizeof(ip4_addr_t))
 
#define ip4_addr_copy(dest, src)   ((dest).addr = (src).addr)
 
#define ip4_addr_set(dest, src)
 
#define ip4_addr_set_zero(ipaddr)   ((ipaddr)->addr = 0)
 
#define ip4_addr_set_any(ipaddr)   ((ipaddr)->addr = IPADDR_ANY)
 
#define ip4_addr_set_loopback(ipaddr)   ((ipaddr)->addr = PP_HTONL(IPADDR_LOOPBACK))
 
#define ip4_addr_isloopback(ipaddr)   (((ipaddr)->addr & PP_HTONL(IP_CLASSA_NET)) == PP_HTONL(((u32)IP_LOOPBACKNET) << 24))
 
#define ip4_addr_set_hton(dest, src)
 
#define ip4_addr_set_u32(dest_ipaddr, src_u32)   ((dest_ipaddr)->addr = (src_u32))
 
#define ip4_addr_get_u32(src_ipaddr)   ((src_ipaddr)->addr)
 
#define ip4_addr_get_network(target, host, netmask)
 
#define ip4_addr_netcmp(addr1, addr2, mask)
 
#define ip4_addr_cmp(addr1, addr2)   ((addr1)->addr == (addr2)->addr)
 
#define ip4_addr_isany_val(addr1)   ((addr1).addr == IPADDR_ANY)
 
#define ip4_addr_isany(addr1)   ((addr1) == NULL || ip4_addr_isany_val(*(addr1)))
 
#define ip4_addr_isbroadcast(addr1, netif)   ip4_addr_isbroadcast_u32((addr1)->addr, netif)
 
#define ip_addr_netmask_valid(netmask)   ip4_addr_netmask_valid((netmask)->addr)
 
#define ip4_addr_ismulticast(addr1)   (((addr1)->addr & PP_HTONL(0xf0000000UL)) == PP_HTONL(0xe0000000UL))
 
#define ip4_addr_islinklocal(addr1)   (((addr1)->addr & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xa9fe0000UL))
 
#define ip4_addr_debug_print_parts(debug, a, b, c, d)   LWIP_DEBUGF(debug, ("%" U16_F ".%" U16_F ".%" U16_F ".%" U16_F, a, b, c, d))
 
#define ip4_addr_debug_print(debug, ipaddr)
 
#define ip4_addr_debug_print_val(debug, ipaddr)
 
#define ip4_addr1(ipaddr)   (((const u8 *)(&(ipaddr)->addr))[0])
 
#define ip4_addr2(ipaddr)   (((const u8 *)(&(ipaddr)->addr))[1])
 
#define ip4_addr3(ipaddr)   (((const u8 *)(&(ipaddr)->addr))[2])
 
#define ip4_addr4(ipaddr)   (((const u8 *)(&(ipaddr)->addr))[3])
 
#define ip4_addr1_16(ipaddr)   ((u16)ip4_addr1(ipaddr))
 
#define ip4_addr2_16(ipaddr)   ((u16)ip4_addr2(ipaddr))
 
#define ip4_addr3_16(ipaddr)   ((u16)ip4_addr3(ipaddr))
 
#define ip4_addr4_16(ipaddr)   ((u16)ip4_addr4(ipaddr))
 
#define IP4ADDR_STRLEN_MAX   16
 
#define IP6_ADDR_PART(ip6addr, index, a, b, c, d)
 
#define IP6_ADDR(ip6addr, idx0, idx1, idx2, idx3)
 
#define IP6_ADDR_BLOCK1(ip6addr)   ((u16)((lwip_htonl((ip6addr)->addr[0]) >> 16) & 0xffff))
 
#define IP6_ADDR_BLOCK2(ip6addr)   ((u16)((lwip_htonl((ip6addr)->addr[0])) & 0xffff))
 
#define IP6_ADDR_BLOCK3(ip6addr)   ((u16)((lwip_htonl((ip6addr)->addr[1]) >> 16) & 0xffff))
 
#define IP6_ADDR_BLOCK4(ip6addr)   ((u16)((lwip_htonl((ip6addr)->addr[1])) & 0xffff))
 
#define IP6_ADDR_BLOCK5(ip6addr)   ((u16)((lwip_htonl((ip6addr)->addr[2]) >> 16) & 0xffff))
 
#define IP6_ADDR_BLOCK6(ip6addr)   ((u16)((lwip_htonl((ip6addr)->addr[2])) & 0xffff))
 
#define IP6_ADDR_BLOCK7(ip6addr)   ((u16)((lwip_htonl((ip6addr)->addr[3]) >> 16) & 0xffff))
 
#define IP6_ADDR_BLOCK8(ip6addr)   ((u16)((lwip_htonl((ip6addr)->addr[3])) & 0xffff))
 
#define ip6_addr_copy(dest, src)
 
#define ip6_addr_set(dest, src)
 
#define ip6_addr_set_zero(ip6addr)
 
#define ip6_addr_set_any(ip6addr)   ip6_addr_set_zero(ip6addr)
 
#define ip6_addr_set_loopback(ip6addr)
 
#define ip6_addr_set_hton(dest, src)
 
#define ip6_addr_netcmp(addr1, addr2)
 
#define ip6_addr_cmp(addr1, addr2)
 
#define ip6_get_subnet_id(ip6addr)   (lwip_htonl((ip6addr)->addr[2]) & 0x0000ffffUL)
 
#define ip6_addr_isany_val(ip6addr)
 
#define ip6_addr_isany(ip6addr)   (((ip6addr) == NULL) || ip6_addr_isany_val(*(ip6addr)))
 
#define ip6_addr_isloopback(ip6addr)
 
#define ip6_addr_isglobal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xe0000000UL)) == PP_HTONL(0x20000000UL))
 
#define ip6_addr_islinklocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xffc00000UL)) == PP_HTONL(0xfe800000UL))
 
#define ip6_addr_issitelocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xffc00000UL)) == PP_HTONL(0xfec00000UL))
 
#define ip6_addr_isuniquelocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xfe000000UL)) == PP_HTONL(0xfc000000UL))
 
#define ip6_addr_isipv6mappedipv4(ip6addr)   (((ip6addr)->addr[0] == 0) && ((ip6addr)->addr[1] == 0) && (((ip6addr)->addr[2]) == PP_HTONL(0x0000FFFFUL)))
 
#define ip6_addr_ismulticast(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xff000000UL)) == PP_HTONL(0xff000000UL))
 
#define ip6_addr_multicast_transient_flag(ip6addr)   ((ip6addr)->addr[0] & PP_HTONL(0x00100000UL))
 
#define ip6_addr_multicast_prefix_flag(ip6addr)   ((ip6addr)->addr[0] & PP_HTONL(0x00200000UL))
 
#define ip6_addr_multicast_rendezvous_flag(ip6addr)   ((ip6addr)->addr[0] & PP_HTONL(0x00400000UL))
 
#define ip6_addr_multicast_scope(ip6addr)   ((lwip_htonl((ip6addr)->addr[0]) >> 16) & 0xf)
 
#define IP6_MULTICAST_SCOPE_RESERVED   0x0
 
#define IP6_MULTICAST_SCOPE_RESERVED0   0x0
 
#define IP6_MULTICAST_SCOPE_INTERFACE_LOCAL   0x1
 
#define IP6_MULTICAST_SCOPE_LINK_LOCAL   0x2
 
#define IP6_MULTICAST_SCOPE_RESERVED3   0x3
 
#define IP6_MULTICAST_SCOPE_ADMIN_LOCAL   0x4
 
#define IP6_MULTICAST_SCOPE_SITE_LOCAL   0x5
 
#define IP6_MULTICAST_SCOPE_ORGANIZATION_LOCAL   0x8
 
#define IP6_MULTICAST_SCOPE_GLOBAL   0xe
 
#define IP6_MULTICAST_SCOPE_RESERVEDF   0xf
 
#define ip6_addr_ismulticast_iflocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xff8f0000UL)) == PP_HTONL(0xff010000UL))
 
#define ip6_addr_ismulticast_linklocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xff8f0000UL)) == PP_HTONL(0xff020000UL))
 
#define ip6_addr_ismulticast_adminlocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xff8f0000UL)) == PP_HTONL(0xff040000UL))
 
#define ip6_addr_ismulticast_sitelocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xff8f0000UL)) == PP_HTONL(0xff050000UL))
 
#define ip6_addr_ismulticast_orglocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xff8f0000UL)) == PP_HTONL(0xff080000UL))
 
#define ip6_addr_ismulticast_global(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xff8f0000UL)) == PP_HTONL(0xff0e0000UL))
 
#define ip6_addr_isallnodes_iflocal(ip6addr)
 
#define ip6_addr_isallnodes_linklocal(ip6addr)
 
#define ip6_addr_set_allnodes_linklocal(ip6addr)
 
#define ip6_addr_isallrouters_linklocal(ip6addr)
 
#define ip6_addr_set_allrouters_linklocal(ip6addr)
 
#define ip6_addr_issolicitednode(ip6addr)
 
#define ip6_addr_set_solicitednode(ip6addr, if_id)
 
#define ip6_addr_cmp_solicitednode(ip6addr, sn_addr)
 
#define IP6_ADDR_INVALID   0x00
 
#define IP6_ADDR_TENTATIVE   0x08
 
#define IP6_ADDR_TENTATIVE_1   0x09 /* 1 probe sent */
 
#define IP6_ADDR_TENTATIVE_2   0x0a /* 2 probes sent */
 
#define IP6_ADDR_TENTATIVE_3   0x0b /* 3 probes sent */
 
#define IP6_ADDR_TENTATIVE_4   0x0c /* 4 probes sent */
 
#define IP6_ADDR_TENTATIVE_5   0x0d /* 5 probes sent */
 
#define IP6_ADDR_TENTATIVE_6   0x0e /* 6 probes sent */
 
#define IP6_ADDR_TENTATIVE_7   0x0f /* 7 probes sent */
 
#define IP6_ADDR_VALID   0x10 /* This bit marks an address as valid (preferred or deprecated) */
 
#define IP6_ADDR_PREFERRED   0x30
 
#define IP6_ADDR_DEPRECATED   0x10 /* Same as VALID (valid but not preferred) */
 
#define IP6_ADDR_TENTATIVE_COUNT_MASK   0x07 /* 1-7 probes sent */
 
#define ip6_addr_isinvalid(addr_state)   (addr_state == IP6_ADDR_INVALID)
 
#define ip6_addr_istentative(addr_state)   (addr_state & IP6_ADDR_TENTATIVE)
 
#define ip6_addr_isvalid(addr_state)   (addr_state & IP6_ADDR_VALID) /* Include valid, preferred, and deprecated. */
 
#define ip6_addr_ispreferred(addr_state)   (addr_state == IP6_ADDR_PREFERRED)
 
#define ip6_addr_isdeprecated(addr_state)   (addr_state == IP6_ADDR_DEPRECATED)
 
#define ip6_addr_debug_print_parts(debug, a, b, c, d, e, f, g, h)
 
#define ip6_addr_debug_print(debug, ipaddr)
 
#define ip6_addr_debug_print_val(debug, ipaddr)
 
#define IP6ADDR_STRLEN_MAX   46
 
#define IP_ADDR_PCB_VERSION_MATCH(addr, pcb)   1
 
#define IP_ADDR_PCB_VERSION_MATCH_EXACT(pcb, ipaddr)   1
 
#define IPADDR4_INIT(u32val)
 
#define IP_IS_V4_VAL(ipaddr)   1
 
#define IP_IS_V6_VAL(ipaddr)   0
 
#define IP_IS_V4(ipaddr)   1
 
#define IP_IS_V6(ipaddr)   0
 
#define IP_IS_ANY_TYPE_VAL(ipaddr)   0
 
#define IP_SET_TYPE_VAL(ipaddr, iptype)
 
#define IP_SET_TYPE(ipaddr, iptype)
 
#define IP_GET_TYPE(ipaddr)   IPADDR_TYPE_V4
 
#define ip_2_ip4(ipaddr)   (ipaddr)
 
#define IP_ADDR4(ipaddr, a, b, c, d)   IP4_ADDR(ipaddr, a, b, c, d)
 
#define ip_addr_copy(dest, src)   ip4_addr_copy(dest, src)
 
#define ip_addr_copy_from_ip4(dest, src)   ip4_addr_copy(dest, src)
 
#define ip_addr_set_ip4_u32(ipaddr, val)   ip4_addr_set_u32(ip_2_ip4(ipaddr), val)
 
#define ip_addr_get_ip4_u32(ipaddr)   ip4_addr_get_u32(ip_2_ip4(ipaddr))
 
#define ip_addr_set(dest, src)   ip4_addr_set(dest, src)
 
#define ip_addr_set_ipaddr(dest, src)   ip4_addr_set(dest, src)
 
#define ip_addr_set_zero(ipaddr)   ip4_addr_set_zero(ipaddr)
 
#define ip_addr_set_zero_ip4(ipaddr)   ip4_addr_set_zero(ipaddr)
 
#define ip_addr_set_any(is_ipv6, ipaddr)   ip4_addr_set_any(ipaddr)
 
#define ip_addr_set_loopback(is_ipv6, ipaddr)   ip4_addr_set_loopback(ipaddr)
 
#define ip_addr_set_hton(dest, src)   ip4_addr_set_hton(dest, src)
 
#define ip_addr_get_network(target, host, mask)   ip4_addr_get_network(target, host, mask)
 
#define ip_addr_netcmp(addr1, addr2, mask)   ip4_addr_netcmp(addr1, addr2, mask)
 
#define ip_addr_cmp(addr1, addr2)   ip4_addr_cmp(addr1, addr2)
 
#define ip_addr_isany(ipaddr)   ip4_addr_isany(ipaddr)
 
#define ip_addr_isany_val(ipaddr)   ip4_addr_isany_val(ipaddr)
 
#define ip_addr_isloopback(ipaddr)   ip4_addr_isloopback(ipaddr)
 
#define ip_addr_islinklocal(ipaddr)   ip4_addr_islinklocal(ipaddr)
 
#define ip_addr_isbroadcast(addr, netif)   ip4_addr_isbroadcast(addr, netif)
 
#define ip_addr_ismulticast(ipaddr)   ip4_addr_ismulticast(ipaddr)
 
#define ip_addr_debug_print(debug, ipaddr)   ip4_addr_debug_print(debug, ipaddr)
 
#define ip_addr_debug_print_val(debug, ipaddr)   ip4_addr_debug_print_val(debug, ipaddr)
 
#define ipaddr_ntoa(ipaddr)   ip4addr_ntoa(ipaddr)
 
#define ipaddr_ntoa_r(ipaddr, buf, buflen)   ip4addr_ntoa_r(ipaddr, buf, buflen)
 
#define ipaddr_aton(cp, addr)   ip4addr_aton(cp, addr)
 
#define IPADDR_STRLEN_MAX   IP4ADDR_STRLEN_MAX
 
#define IP_ADDR_ANY   IP4_ADDR_ANY
 
#define IP4_ADDR_ANY   (&ip_addr_any)
 
#define IP4_ADDR_ANY4   (ip_2_ip4(&ip_addr_any))
 
#define IP_ADDR_BROADCAST   (&ip_addr_broadcast)
 
#define IP4_ADDR_BROADCAST   (ip_2_ip4(&ip_addr_broadcast))
 
#define IP_ANY_TYPE   IP_ADDR_ANY
 
#define NETIF_MAX_HWADDR_LEN   6U
 
#define NETIF_FLAG_UP   0x01U
 
#define NETIF_FLAG_BROADCAST   0x02U
 
#define NETIF_FLAG_LINK_UP   0x04U
 
#define NETIF_FLAG_ETHARP   0x08U
 
#define NETIF_FLAG_ETHERNET   0x10U
 
#define NETIF_FLAG_IGMP   0x20U
 
#define NETIF_FLAG_MLD6   0x40U
 
#define netif_set_client_data(netif, id, data)   netif_get_client_data(netif, id) = (data)
 
#define netif_get_client_data(netif, id)   (netif)->client_data[(id)]
 
#define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags)
 
#define IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag)
 
#define netif_ip4_addr(netif)   ((const ip4_addr_t *)ip_2_ip4(&((netif)->ip_addr)))
 
#define netif_ip4_netmask(netif)   ((const ip4_addr_t *)ip_2_ip4(&((netif)->netmask)))
 
#define netif_ip4_gw(netif)   ((const ip4_addr_t *)ip_2_ip4(&((netif)->gw)))
 
#define netif_ip_addr4(netif)   ((const ip_addr_t *)&((netif)->ip_addr))
 
#define netif_ip_netmask4(netif)   ((const ip_addr_t *)&((netif)->netmask))
 
#define netif_ip_gw4(netif)   ((const ip_addr_t *)&((netif)->gw))
 
#define netif_is_up(netif)   (((netif)->flags & NETIF_FLAG_UP) ? (u8)1 : (u8)0)
 
#define netif_is_link_up(netif)   (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8)1 : (u8)0)
 
#define NETIF_SET_HWADDRHINT(netif, hint)
 
#define s6_addr   un.u8_addr
 
#define INADDR_NONE   IPADDR_NONE
 
#define INADDR_LOOPBACK   IPADDR_LOOPBACK
 
#define INADDR_ANY   IPADDR_ANY
 
#define INADDR_BROADCAST   IPADDR_BROADCAST
 
#define SIN_ZERO_LEN   8
 
#define SOCKLEN_T_DEFINED   1
 
#define SOCK_STREAM   1
 
#define SOCK_DGRAM   2
 
#define SOCK_RAW   3
 
#define SO_REUSEADDR   0x0004 /* Allow local address reuse */
 
#define SO_KEEPALIVE   0x0008 /* keep connections alive */
 
#define SO_BROADCAST   0x0020 /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */
 
#define SO_DEBUG   0x0001 /* Unimplemented: turn on debugging info recording */
 
#define SO_ACCEPTCONN   0x0002 /* socket has had listen() */
 
#define SO_DONTROUTE   0x0010 /* Unimplemented: just use interface addresses */
 
#define SO_USELOOPBACK   0x0040 /* Unimplemented: bypass hardware when possible */
 
#define SO_LINGER   0x0080 /* linger on close if data present */
 
#define SO_DONTLINGER   ((int)(~SO_LINGER))
 
#define SO_OOBINLINE   0x0100 /* Unimplemented: leave received OOB data in line */
 
#define SO_REUSEPORT   0x0200 /* Unimplemented: allow local address & port reuse */
 
#define SO_SNDBUF   0x1001 /* Unimplemented: send buffer size */
 
#define SO_RCVBUF   0x1002 /* receive buffer size */
 
#define SO_SNDLOWAT   0x1003 /* Unimplemented: send low-water mark */
 
#define SO_RCVLOWAT   0x1004 /* Unimplemented: receive low-water mark */
 
#define SO_SNDTIMEO   0x1005 /* send timeout */
 
#define SO_RCVTIMEO   0x1006 /* receive timeout */
 
#define SO_ERROR   0x1007 /* get error status and clear */
 
#define SO_TYPE   0x1008 /* get socket type */
 
#define SO_CONTIMEO   0x1009 /* Unimplemented: connect timeout */
 
#define SO_NO_CHECK   0x100a /* don't create UDP checksum */
 
#define SOL_SOCKET   0xfff /* options for socket level */
 
#define AF_UNSPEC   0
 
#define AF_INET   2
 
#define AF_INET6   AF_UNSPEC
 
#define PF_INET   AF_INET
 
#define PF_INET6   AF_INET6
 
#define PF_UNSPEC   AF_UNSPEC
 
#define IPPROTO_IP   0
 
#define IPPROTO_ICMP   1
 
#define IPPROTO_TCP   6
 
#define IPPROTO_UDP   17
 
#define IPPROTO_UDPLITE   136
 
#define IPPROTO_RAW   255
 
#define MSG_PEEK   0x01 /* Peeks at an incoming message */
 
#define MSG_WAITALL   0x02 /* Unimplemented: Requests that the function block until the full amount of data requested can be returned */
 
#define MSG_OOB   0x04 /* Unimplemented: Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific */
 
#define MSG_DONTWAIT   0x08 /* Nonblocking i/o for this operation only */
 
#define MSG_MORE   0x10 /* Sender will send more */
 
#define IP_TOS   1
 
#define IP_TTL   2
 
#define TCP_NODELAY   0x01 /* don't delay send to coalesce packets */
 
#define TCP_KEEPALIVE   0x02 /* send KEEPALIVE probes when idle for pcb->keep_idle milliseconds */
 
#define TCP_KEEPIDLE   0x03 /* set pcb->keep_idle - Same as TCP_KEEPALIVE, but use seconds for get/setsockopt */
 
#define TCP_KEEPINTVL   0x04 /* set pcb->keep_intvl - Use seconds for get/setsockopt */
 
#define TCP_KEEPCNT   0x05 /* set pcb->keep_cnt - Use number of probes sent for get/setsockopt */
 
#define IPTOS_TOS_MASK   0x1E
 
#define IPTOS_TOS(tos)   ((tos)&IPTOS_TOS_MASK)
 
#define IPTOS_LOWDELAY   0x10
 
#define IPTOS_THROUGHPUT   0x08
 
#define IPTOS_RELIABILITY   0x04
 
#define IPTOS_LOWCOST   0x02
 
#define IPTOS_MINCOST   IPTOS_LOWCOST
 
#define IPTOS_PREC_MASK   0xe0
 
#define IPTOS_PREC(tos)   ((tos)&IPTOS_PREC_MASK)
 
#define IPTOS_PREC_NETCONTROL   0xe0
 
#define IPTOS_PREC_INTERNETCONTROL   0xc0
 
#define IPTOS_PREC_CRITIC_ECP   0xa0
 
#define IPTOS_PREC_FLASHOVERRIDE   0x80
 
#define IPTOS_PREC_FLASH   0x60
 
#define IPTOS_PREC_IMMEDIATE   0x40
 
#define IPTOS_PREC_PRIORITY   0x20
 
#define IPTOS_PREC_ROUTINE   0x00
 
#define IOCPARM_MASK   0x7fU /* parameters must be < 128 bytes */
 
#define IOC_VOID   0x20000000UL /* no parameters */
 
#define IOC_OUT   0x40000000UL /* copy out parameters */
 
#define IOC_IN   0x80000000UL /* copy in parameters */
 
#define IOC_INOUT   (IOC_IN | IOC_OUT)
 
#define _IO(x, y)   (IOC_VOID | ((x) << 8) | (y))
 
#define _IOR(x, y, t)   (IOC_OUT | (((long)sizeof(t) & IOCPARM_MASK) << 16) | ((x) << 8) | (y))
 
#define _IOW(x, y, t)   (IOC_IN | (((long)sizeof(t) & IOCPARM_MASK) << 16) | ((x) << 8) | (y))
 
#define FIONREAD   _IOR('f', 127, unsigned long) /* get # bytes to read */
 
#define FIONBIO   _IOW('f', 126, unsigned long) /* set/clear non-blocking i/o */
 
#define SIOCSHIWAT   _IOW('s', 0, unsigned long) /* set high watermark */
 
#define SIOCGHIWAT   _IOR('s', 1, unsigned long) /* get high watermark */
 
#define SIOCSLOWAT   _IOW('s', 2, unsigned long) /* set low watermark */
 
#define SIOCGLOWAT   _IOR('s', 3, unsigned long) /* get low watermark */
 
#define SIOCATMARK   _IOR('s', 7, unsigned long) /* at oob mark? */
 
#define F_GETFL   3
 
#define F_SETFL   4
 
#define O_NONBLOCK   1 /* nonblocking I/O */
 
#define O_NDELAY   1 /* same as O_NONBLOCK, for compatibility */
 
#define SHUT_RD   0
 
#define SHUT_WR   1
 
#define SHUT_RDWR   2
 
#define FD_SETSIZE   MEMP_NUM_NETCONN
 
#define FDSETSAFESET(n, code)
 
#define FDSETSAFEGET(n, code)
 
#define FD_SET(n, p)   FDSETSAFESET(n, (p)->fd_bits[((n)-LWIP_SOCKET_OFFSET) / 8] |= (1 << (((n)-LWIP_SOCKET_OFFSET) & 7)))
 
#define FD_CLR(n, p)   FDSETSAFESET(n, (p)->fd_bits[((n)-LWIP_SOCKET_OFFSET) / 8] &= ~(1 << (((n)-LWIP_SOCKET_OFFSET) & 7)))
 
#define FD_ISSET(n, p)   FDSETSAFEGET(n, (p)->fd_bits[((n)-LWIP_SOCKET_OFFSET) / 8] & (1 << (((n)-LWIP_SOCKET_OFFSET) & 7)))
 
#define FD_ZERO(p)   memset((void *)(p), 0, sizeof(*(p)))
 
#define DNS_TMR_INTERVAL   1000
 
#define LWIP_DNS_ADDRTYPE_IPV4   0
 
#define LWIP_DNS_ADDRTYPE_IPV6   1
 
#define LWIP_DNS_ADDRTYPE_IPV4_IPV6   2 /* try to resolve IPv4 first, try IPv6 if IPv4 fails only */
 
#define LWIP_DNS_ADDRTYPE_IPV6_IPV4   3 /* try to resolve IPv6 first, try IPv4 if IPv6 fails only */
 
#define LWIP_DNS_ADDRTYPE_DEFAULT   LWIP_DNS_ADDRTYPE_IPV4
 
#define LWIP_DNS_API_DECLARE_H_ERRNO   1
 
#define LWIP_DNS_API_DEFINE_ERRORS   1
 
#define LWIP_DNS_API_DEFINE_FLAGS   1
 
#define LWIP_DNS_API_DECLARE_STRUCTS   1
 
#define EAI_NONAME   200
 
#define EAI_SERVICE   201
 
#define EAI_FAIL   202
 
#define EAI_MEMORY   203
 
#define EAI_FAMILY   204
 
#define HOST_NOT_FOUND   210
 
#define NO_DATA   211
 
#define NO_RECOVERY   212
 
#define TRY_AGAIN   213
 
#define AI_PASSIVE   0x01
 
#define AI_CANONNAME   0x02
 
#define AI_NUMERICHOST   0x04
 
#define AI_NUMERICSERV   0x08
 
#define AI_V4MAPPED   0x10
 
#define AI_ALL   0x20
 
#define AI_ADDRCONFIG   0x40
 
#define h_addr   h_addr_list[0] /* for backward compatibility */
 
#define NETDB_ELEM_SIZE   (sizeof(struct addrinfo) + sizeof(struct sockaddr_storage) + DNS_MAX_NAME_LENGTH + 1)
 
#define htons(x)   lwip_htons(x)
 
#define ntohs(x)   lwip_ntohs(x)
 
#define htonl(x)   lwip_htonl(x)
 
#define ntohl(x)   lwip_ntohl(x)
 
#define lwip_htons(x)   PP_HTONS(x)
 
#define lwip_ntohs(x)   PP_NTOHS(x)
 
#define lwip_htonl(x)   PP_HTONL(x)
 
#define lwip_ntohl(x)   PP_NTOHL(x)
 
#define PP_HTONS(x)   ((((x)&0xff) << 8) | (((x)&0xff00) >> 8))
 
#define PP_NTOHS(x)   PP_HTONS(x)
 
#define PP_HTONL(x)
 
#define PP_NTOHL(x)   PP_HTONL(x)
 

Typedefs

typedef signed char err_t
 
typedef struct ip4_addr ip4_addr_t
 
typedef struct ip4_addr_packed ip4_addr_p_t
 
typedef struct ip6_addr ip6_addr_t
 
typedef struct ip6_addr_packed ip6_addr_p_t
 
typedef ip4_addr_t ip_addr_t
 
typedef err_t(* netif_init_fn) (struct netif *netif)
 
typedef err_t(* netif_input_fn) (struct pbuf *p, struct netif *inp)
 
typedef err_t(* netif_output_fn) (struct netif *netif, struct pbuf *p, const ip4_addr_t *ipaddr)
 
typedef err_t(* netif_linkoutput_fn) (struct netif *netif, struct pbuf *p)
 
typedef void(* netif_status_callback_fn) (struct netif *netif)
 
typedef u8 sa_family_t
 
typedef u16 in_port_t
 
typedef int socklen_t
 
typedef struct fd_set fd_set
 
typedef void(* dns_found_callback) (const char *name, const ip_addr_t *ipaddr, void *callback_arg)
 

Enumerations

enum  pbuf_layer {
  PBUF_TRANSPORT, PBUF_IP, PBUF_LINK, PBUF_RAW_TX,
  PBUF_RAW
}
 
enum  pbuf_type { PBUF_RAM, PBUF_ROM, PBUF_REF, PBUF_POOL }
 
enum  lwip_ip_addr_type { IPADDR_TYPE_V4 = 0U, IPADDR_TYPE_V6 = 6U, IPADDR_TYPE_ANY = 46U }
 
enum  lwip_internal_netif_client_data_index { LWIP_NETIF_CLIENT_DATA_INDEX_DHCP, LWIP_NETIF_CLIENT_DATA_INDEX_MAX }
 
enum  netif_mac_filter_action { NETIF_DEL_MAC_FILTER = 0, NETIF_ADD_MAC_FILTER = 1 }
 
enum  dhcp_state_enum_t {
  DHCP_STATE_OFF = 0, DHCP_STATE_REQUESTING = 1, DHCP_STATE_INIT = 2, DHCP_STATE_REBOOTING = 3,
  DHCP_STATE_REBINDING = 4, DHCP_STATE_RENEWING = 5, DHCP_STATE_SELECTING = 6, DHCP_STATE_INFORMING = 7,
  DHCP_STATE_CHECKING = 8, DHCP_STATE_PERMANENT = 9, DHCP_STATE_BOUND = 10, DHCP_STATE_RELEASING = 11,
  DHCP_STATE_BACKING_OFF = 12
}
 

Functions

u8 netif_alloc_client_data_id (void)
 

Variables

const ip_addr_t ip_addr_any
 
const ip_addr_t ip_addr_broadcast
 
struct netifnetif_list
 
struct netifnetif_default
 

Detailed Description

Common definitions file for the LWIP v2.0.0 port.

Definition in file tcpip.h.


Data Structure Documentation

◆ pbuf

struct pbuf

Main packet buffer struct

Definition at line 229 of file tcpip.h.

+ Collaboration diagram for pbuf:
Data Fields
struct pbuf * next

next pbuf in singly linked pbuf chain

void * payload

pointer to the actual data in the buffer

u16 tot_len

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)

u16 len

length of this buffer

u8 type

pbuf_type as u8 instead of enum to save space

u8 flags

misc flags

u16 ref

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.

◆ ip4_addr

struct ip4_addr

This is the aligned version of ip4_addr_t, used as local variable, on the stack, etc.

Definition at line 266 of file tcpip.h.

Data Fields
u32 addr

◆ ip6_addr

struct ip6_addr

This is the aligned version of ip6_addr_t, used as local variable, on the stack, etc.

Definition at line 420 of file tcpip.h.

Data Fields
u32 addr[4]

◆ netif

struct netif

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

Definition at line 1262 of file tcpip.h.

+ Collaboration diagram for netif:
Data Fields
struct netif * next

pointer to next in linked list

ip_addr_t ip_addr

IP address configuration in network byte order

ip_addr_t netmask
ip_addr_t gw
netif_input_fn input

This function is called by the network device driver to pass a packet up the TCP/IP stack.

netif_output_fn output

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()

netif_linkoutput_fn linkoutput

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.

void * state

This field can be set by the device driver and could point to state information for the device.

void * client_data[LWIP_NETIF_CLIENT_DATA_INDEX_MAX+LWIP_NUM_NETIF_CLIENT_DATA]
u8 rs_count

Number of Router Solicitation messages that remain to be sent.

u16 mtu

maximum transfer unit (in bytes)

u8 hwaddr_len

number of bytes used in hwaddr

u8 hwaddr[NETIF_MAX_HWADDR_LEN]

link level hardware address of this interface

u8 flags

flags (

See also
Flags)
char name[2]

descriptive abbreviation

u8 num

number of this interface

◆ in_addr

struct in_addr

Definition at line 1502 of file tcpip.h.

Data Fields
u32 s_addr

◆ in6_addr

struct in6_addr

Definition at line 1507 of file tcpip.h.

Data Fields
union in6_addr un

◆ sockaddr_in

struct sockaddr_in

Definition at line 1539 of file tcpip.h.

+ Collaboration diagram for sockaddr_in:
Data Fields
u8 sin_len
sa_family_t sin_family
in_port_t sin_port
struct in_addr sin_addr
char sin_zero[SIN_ZERO_LEN]

◆ sockaddr

struct sockaddr

Definition at line 1562 of file tcpip.h.

Data Fields
u8 sa_len
sa_family_t sa_family
char sa_data[14]

◆ sockaddr_storage

struct sockaddr_storage

Definition at line 1569 of file tcpip.h.

Data Fields
u8 s2_len
sa_family_t ss_family
char s2_data1[2]
u32 s2_data2[3]

◆ fd_set

struct fd_set

Definition at line 1838 of file tcpip.h.

Data Fields
unsigned char fd_bits[(FD_SETSIZE+7)/8]

◆ hostent

struct hostent

Definition at line 1940 of file tcpip.h.

Data Fields
char * h_name
char ** h_aliases
int h_addrtype
int h_length
char ** h_addr_list

◆ addrinfo

struct addrinfo

Definition at line 1952 of file tcpip.h.

+ Collaboration diagram for addrinfo:
Data Fields
int ai_flags
int ai_family
int ai_socktype
int ai_protocol
socklen_t ai_addrlen
struct sockaddr * ai_addr
char * ai_canonname
struct addrinfo * ai_next

◆ in6_addr.un

union in6_addr.un

Definition at line 1509 of file tcpip.h.

Data Fields
u32 u32_addr[4]
u8 u8_addr[16]

Macro Definition Documentation

◆ IPADDR_NONE

#define IPADDR_NONE   ((u32)0xffffffffUL)

255.255.255.255

Definition at line 277 of file tcpip.h.

◆ IPADDR_LOOPBACK

#define IPADDR_LOOPBACK   ((u32)0x7f000001UL)

127.0.0.1

Definition at line 279 of file tcpip.h.

◆ IPADDR_ANY

#define IPADDR_ANY   ((u32)0x00000000UL)

0.0.0.0

Definition at line 281 of file tcpip.h.

◆ IPADDR_BROADCAST

#define IPADDR_BROADCAST   ((u32)0xffffffffUL)

255.255.255.255

Definition at line 283 of file tcpip.h.

◆ IP4_ADDR

#define IP4_ADDR (   ipaddr,
  a,
  b,
  c,
 
)
Value:
(ipaddr)->addr = ((u32)((d)&0xff) << 24) | \
((u32)((c)&0xff) << 16) | \
((u32)((b)&0xff) << 8) | \
(u32)((a)&0xff)

Set an IP address given by the four byte-parts. Little-endian version that prevents the use of lwip_htonl.

Definition at line 320 of file tcpip.h.

◆ IPADDR2_COPY

#define IPADDR2_COPY (   dest,
  src 
)    memcpy(dest, src, sizeof(ip4_addr_t))

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's) - no NULL-pointer-checking needed.

Definition at line 330 of file tcpip.h.

◆ ip4_addr_copy

#define ip4_addr_copy (   dest,
  src 
)    ((dest).addr = (src).addr)

Copy IP address - faster than ip4_addr_set: no NULL check

Definition at line 334 of file tcpip.h.

◆ ip4_addr_set

#define ip4_addr_set (   dest,
  src 
)
Value:
((dest)->addr = \
((src) == NULL ? 0 : \
(src)->addr))

Safely copy one IP address to another (src may be NULL)

Definition at line 336 of file tcpip.h.

◆ ip4_addr_set_zero

#define ip4_addr_set_zero (   ipaddr)    ((ipaddr)->addr = 0)

Set complete address to zero

Definition at line 340 of file tcpip.h.

◆ ip4_addr_set_any

#define ip4_addr_set_any (   ipaddr)    ((ipaddr)->addr = IPADDR_ANY)

Set address to IPADDR_ANY (no need for lwip_htonl())

Definition at line 342 of file tcpip.h.

◆ ip4_addr_set_loopback

#define ip4_addr_set_loopback (   ipaddr)    ((ipaddr)->addr = PP_HTONL(IPADDR_LOOPBACK))

Set address to loopback address

Definition at line 344 of file tcpip.h.

◆ ip4_addr_isloopback

#define ip4_addr_isloopback (   ipaddr)    (((ipaddr)->addr & PP_HTONL(IP_CLASSA_NET)) == PP_HTONL(((u32)IP_LOOPBACKNET) << 24))

Check if an address is in the loopback region

Definition at line 346 of file tcpip.h.

◆ ip4_addr_set_hton

#define ip4_addr_set_hton (   dest,
  src 
)
Value:
((dest)->addr = \
((src) == NULL ? 0 : \
lwip_htonl((src)->addr)))

Safely copy one IP address to another and change byte order from host- to network-order.

Definition at line 349 of file tcpip.h.

◆ ip4_addr_set_u32

#define ip4_addr_set_u32 (   dest_ipaddr,
  src_u32 
)    ((dest_ipaddr)->addr = (src_u32))

IPv4 only: set the IP address given as an u32

Definition at line 353 of file tcpip.h.

◆ ip4_addr_get_u32

#define ip4_addr_get_u32 (   src_ipaddr)    ((src_ipaddr)->addr)

IPv4 only: get the IP address as an u32

Definition at line 355 of file tcpip.h.

◆ ip4_addr_get_network

#define ip4_addr_get_network (   target,
  host,
  netmask 
)
Value:
do { \
((target)->addr = ((host)->addr) & ((netmask)->addr)); \
} while (0)

Get the network address by combining host address with netmask

Definition at line 358 of file tcpip.h.

◆ ip4_addr_netcmp

#define ip4_addr_netcmp (   addr1,
  addr2,
  mask 
)
Value:
(((addr1)->addr & \
(mask)->addr) == \
((addr2)->addr & \
(mask)->addr))

Determine if two address are on the same network.

  • addr1 IP address 1
  • addr2 IP address 2
  • mask network identifier mask
    Returns
    !0 if the network identifiers of both address match

Definition at line 371 of file tcpip.h.

◆ ip4_addr_debug_print

#define ip4_addr_debug_print (   debug,
  ipaddr 
)
Value:
ip4_addr_debug_print_parts(debug, \
(u16)((ipaddr) != NULL ? ip4_addr1_16(ipaddr) : 0), \
(u16)((ipaddr) != NULL ? ip4_addr2_16(ipaddr) : 0), \
(u16)((ipaddr) != NULL ? ip4_addr3_16(ipaddr) : 0), \
(u16)((ipaddr) != NULL ? ip4_addr4_16(ipaddr) : 0))

Definition at line 390 of file tcpip.h.

◆ ip4_addr_debug_print_val

#define ip4_addr_debug_print_val (   debug,
  ipaddr 
)
Value:
ip4_addr_debug_print_parts(debug, \
ip4_addr1_16(&(ipaddr)), \
ip4_addr2_16(&(ipaddr)), \
ip4_addr3_16(&(ipaddr)), \
ip4_addr4_16(&(ipaddr)))

Definition at line 396 of file tcpip.h.

◆ IP6_ADDR_PART

#define IP6_ADDR_PART (   ip6addr,
  index,
  a,
  b,
  c,
 
)
Value:
(ip6addr)->addr[index] = ((u32)((d)&0xff) << 24) | \
((u32)((c)&0xff) << 16) | \
((u32)((b)&0xff) << 8) | \
(u32)((a)&0xff)

Set an IPv6 partial address given by byte-parts. Little-endian version, stored in network order (no lwip_htonl).

Definition at line 431 of file tcpip.h.

◆ IP6_ADDR

#define IP6_ADDR (   ip6addr,
  idx0,
  idx1,
  idx2,
  idx3 
)
Value:
do { \
(ip6addr)->addr[0] = idx0; \
(ip6addr)->addr[1] = idx1; \
(ip6addr)->addr[2] = idx2; \
(ip6addr)->addr[3] = idx3; \
} while (0)

Set a full IPv6 address by passing the 4 u32 indices in network byte order (use PP_HTONL() for constants)

Definition at line 439 of file tcpip.h.

◆ IP6_ADDR_BLOCK1

#define IP6_ADDR_BLOCK1 (   ip6addr)    ((u16)((lwip_htonl((ip6addr)->addr[0]) >> 16) & 0xffff))

Access address in 16-bit block

Definition at line 448 of file tcpip.h.

◆ IP6_ADDR_BLOCK2

#define IP6_ADDR_BLOCK2 (   ip6addr)    ((u16)((lwip_htonl((ip6addr)->addr[0])) & 0xffff))

Access address in 16-bit block

Definition at line 450 of file tcpip.h.

◆ IP6_ADDR_BLOCK3

#define IP6_ADDR_BLOCK3 (   ip6addr)    ((u16)((lwip_htonl((ip6addr)->addr[1]) >> 16) & 0xffff))

Access address in 16-bit block

Definition at line 452 of file tcpip.h.

◆ IP6_ADDR_BLOCK4

#define IP6_ADDR_BLOCK4 (   ip6addr)    ((u16)((lwip_htonl((ip6addr)->addr[1])) & 0xffff))

Access address in 16-bit block

Definition at line 454 of file tcpip.h.

◆ IP6_ADDR_BLOCK5

#define IP6_ADDR_BLOCK5 (   ip6addr)    ((u16)((lwip_htonl((ip6addr)->addr[2]) >> 16) & 0xffff))

Access address in 16-bit block

Definition at line 456 of file tcpip.h.

◆ IP6_ADDR_BLOCK6

#define IP6_ADDR_BLOCK6 (   ip6addr)    ((u16)((lwip_htonl((ip6addr)->addr[2])) & 0xffff))

Access address in 16-bit block

Definition at line 458 of file tcpip.h.

◆ IP6_ADDR_BLOCK7

#define IP6_ADDR_BLOCK7 (   ip6addr)    ((u16)((lwip_htonl((ip6addr)->addr[3]) >> 16) & 0xffff))

Access address in 16-bit block

Definition at line 460 of file tcpip.h.

◆ IP6_ADDR_BLOCK8

#define IP6_ADDR_BLOCK8 (   ip6addr)    ((u16)((lwip_htonl((ip6addr)->addr[3])) & 0xffff))

Access address in 16-bit block

Definition at line 462 of file tcpip.h.

◆ ip6_addr_copy

#define ip6_addr_copy (   dest,
  src 
)
Value:
do { \
(dest).addr[0] = (src).addr[0]; \
(dest).addr[1] = (src).addr[1]; \
(dest).addr[2] = (src).addr[2]; \
(dest).addr[3] = (src).addr[3]; \
} while (0)

Copy IPv6 address - faster than ip6_addr_set: no NULL check

Definition at line 465 of file tcpip.h.

◆ ip6_addr_set

#define ip6_addr_set (   dest,
  src 
)
Value:
do { \
(dest)->addr[0] = (src) == NULL ? 0 : (src)->addr[0]; \
(dest)->addr[1] = (src) == NULL ? 0 : (src)->addr[1]; \
(dest)->addr[2] = (src) == NULL ? 0 : (src)->addr[2]; \
(dest)->addr[3] = (src) == NULL ? 0 : (src)->addr[3]; \
} while (0)

Safely copy one IPv6 address to another (src may be NULL)

Definition at line 473 of file tcpip.h.

◆ ip6_addr_set_zero

#define ip6_addr_set_zero (   ip6addr)
Value:
do { \
(ip6addr)->addr[0] = 0; \
(ip6addr)->addr[1] = 0; \
(ip6addr)->addr[2] = 0; \
(ip6addr)->addr[3] = 0; \
} while (0)

Set complete address to zero

Definition at line 482 of file tcpip.h.

◆ ip6_addr_set_any

#define ip6_addr_set_any (   ip6addr)    ip6_addr_set_zero(ip6addr)

Set address to ipv6 'any' (no need for lwip_htonl())

Definition at line 491 of file tcpip.h.

◆ ip6_addr_set_loopback

#define ip6_addr_set_loopback (   ip6addr)
Value:
do { \
(ip6addr)->addr[0] = 0; \
(ip6addr)->addr[1] = 0; \
(ip6addr)->addr[2] = 0; \
(ip6addr)->addr[3] = PP_HTONL(0x00000001UL); \
} while (0)

Set address to ipv6 loopback address

Definition at line 493 of file tcpip.h.

◆ ip6_addr_set_hton

#define ip6_addr_set_hton (   dest,
  src 
)
Value:
do { \
(dest)->addr[0] = (src) == NULL ? 0 : lwip_htonl((src)->addr[0]); \
(dest)->addr[1] = (src) == NULL ? 0 : lwip_htonl((src)->addr[1]); \
(dest)->addr[2] = (src) == NULL ? 0 : lwip_htonl((src)->addr[2]); \
(dest)->addr[3] = (src) == NULL ? 0 : lwip_htonl((src)->addr[3]); \
} while (0)

Safely copy one IPv6 address to another and change byte order from host- to network-order.

Definition at line 502 of file tcpip.h.

◆ ip6_addr_netcmp

#define ip6_addr_netcmp (   addr1,
  addr2 
)
Value:
(((addr1)->addr[0] == (addr2)->addr[0]) && \
((addr1)->addr[1] == (addr2)->addr[1]))

Determine if two IPv6 address are on the same network.

  • addr1 IPv6 address 1
  • addr2 IPv6 address 2
    Returns
    !0 if the network identifiers of both address match

Definition at line 518 of file tcpip.h.

◆ ip6_addr_cmp

#define ip6_addr_cmp (   addr1,
  addr2 
)
Value:
(((addr1)->addr[0] == (addr2)->addr[0]) && \
((addr1)->addr[1] == (addr2)->addr[1]) && \
((addr1)->addr[2] == (addr2)->addr[2]) && \
((addr1)->addr[3] == (addr2)->addr[3]))

Definition at line 521 of file tcpip.h.

◆ ip6_addr_isany_val

#define ip6_addr_isany_val (   ip6addr)
Value:
(((ip6addr).addr[0] == 0) && \
((ip6addr).addr[1] == 0) && \
((ip6addr).addr[2] == 0) && \
((ip6addr).addr[3] == 0))

Definition at line 528 of file tcpip.h.

◆ ip6_addr_isloopback

#define ip6_addr_isloopback (   ip6addr)
Value:
(((ip6addr)->addr[0] == 0UL) && \
((ip6addr)->addr[1] == 0UL) && \
((ip6addr)->addr[2] == 0UL) && \
((ip6addr)->addr[3] == PP_HTONL(0x00000001UL)))

Definition at line 534 of file tcpip.h.

◆ ip6_addr_isallnodes_iflocal

#define ip6_addr_isallnodes_iflocal (   ip6addr)
Value:
(((ip6addr)->addr[0] == PP_HTONL(0xff010000UL)) && \
((ip6addr)->addr[1] == 0UL) && \
((ip6addr)->addr[2] == 0UL) && \
((ip6addr)->addr[3] == PP_HTONL(0x00000001UL)))

Definition at line 572 of file tcpip.h.

◆ ip6_addr_isallnodes_linklocal

#define ip6_addr_isallnodes_linklocal (   ip6addr)
Value:
(((ip6addr)->addr[0] == PP_HTONL(0xff020000UL)) && \
((ip6addr)->addr[1] == 0UL) && \
((ip6addr)->addr[2] == 0UL) && \
((ip6addr)->addr[3] == PP_HTONL(0x00000001UL)))

Definition at line 577 of file tcpip.h.

◆ ip6_addr_set_allnodes_linklocal

#define ip6_addr_set_allnodes_linklocal (   ip6addr)
Value:
do { \
(ip6addr)->addr[0] = PP_HTONL(0xff020000UL); \
(ip6addr)->addr[1] = 0; \
(ip6addr)->addr[2] = 0; \
(ip6addr)->addr[3] = PP_HTONL(0x00000001UL); \
} while (0)

Definition at line 581 of file tcpip.h.

◆ ip6_addr_isallrouters_linklocal

#define ip6_addr_isallrouters_linklocal (   ip6addr)
Value:
(((ip6addr)->addr[0] == PP_HTONL(0xff020000UL)) && \
((ip6addr)->addr[1] == 0UL) && \
((ip6addr)->addr[2] == 0UL) && \
((ip6addr)->addr[3] == PP_HTONL(0x00000002UL)))

Definition at line 589 of file tcpip.h.

◆ ip6_addr_set_allrouters_linklocal

#define ip6_addr_set_allrouters_linklocal (   ip6addr)
Value:
do { \
(ip6addr)->addr[0] = PP_HTONL(0xff020000UL); \
(ip6addr)->addr[1] = 0; \
(ip6addr)->addr[2] = 0; \
(ip6addr)->addr[3] = PP_HTONL(0x00000002UL); \
} while (0)

Definition at line 593 of file tcpip.h.

◆ ip6_addr_issolicitednode

#define ip6_addr_issolicitednode (   ip6addr)
Value:
(((ip6addr)->addr[0] == PP_HTONL(0xff020000UL)) && \
((ip6addr)->addr[2] == PP_HTONL(0x00000001UL)) && \
(((ip6addr)->addr[3] & PP_HTONL(0xff000000UL)) == PP_HTONL(0xff000000UL)))

Definition at line 601 of file tcpip.h.

◆ ip6_addr_set_solicitednode

#define ip6_addr_set_solicitednode (   ip6addr,
  if_id 
)
Value:
do { \
(ip6addr)->addr[0] = PP_HTONL(0xff020000UL); \
(ip6addr)->addr[1] = 0; \
(ip6addr)->addr[2] = PP_HTONL(0x00000001UL); \
(ip6addr)->addr[3] = (PP_HTONL(0xff000000UL) | (if_id)); \
} while (0)

Definition at line 605 of file tcpip.h.

◆ ip6_addr_cmp_solicitednode

#define ip6_addr_cmp_solicitednode (   ip6addr,
  sn_addr 
)
Value:
(((ip6addr)->addr[0] == PP_HTONL(0xff020000UL)) && \
((ip6addr)->addr[1] == 0) && \
((ip6addr)->addr[2] == PP_HTONL(0x00000001UL)) && \
((ip6addr)->addr[3] == (PP_HTONL(0xff000000UL) | (sn_addr)->addr[3])))

Definition at line 613 of file tcpip.h.

◆ ip6_addr_debug_print_parts

#define ip6_addr_debug_print_parts (   debug,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
 
)
Value:
LWIP_DEBUGF(debug, ("%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F, \
a, b, c, d, e, f, g, h))

Definition at line 640 of file tcpip.h.

◆ ip6_addr_debug_print

#define ip6_addr_debug_print (   debug,
  ipaddr 
)
Value:
ip6_addr_debug_print_parts(debug, \
(u16)((ipaddr) != NULL ? IP6_ADDR_BLOCK1(ipaddr) : 0), \
(u16)((ipaddr) != NULL ? IP6_ADDR_BLOCK2(ipaddr) : 0), \
(u16)((ipaddr) != NULL ? IP6_ADDR_BLOCK3(ipaddr) : 0), \
(u16)((ipaddr) != NULL ? IP6_ADDR_BLOCK4(ipaddr) : 0), \
(u16)((ipaddr) != NULL ? IP6_ADDR_BLOCK5(ipaddr) : 0), \
(u16)((ipaddr) != NULL ? IP6_ADDR_BLOCK6(ipaddr) : 0), \
(u16)((ipaddr) != NULL ? IP6_ADDR_BLOCK7(ipaddr) : 0), \
(u16)((ipaddr) != NULL ? IP6_ADDR_BLOCK8(ipaddr) : 0))

Definition at line 643 of file tcpip.h.

◆ ip6_addr_debug_print_val

#define ip6_addr_debug_print_val (   debug,
  ipaddr 
)
Value:
ip6_addr_debug_print_parts(debug, \
IP6_ADDR_BLOCK1(&(ipaddr)), \
IP6_ADDR_BLOCK2(&(ipaddr)), \
IP6_ADDR_BLOCK3(&(ipaddr)), \
IP6_ADDR_BLOCK4(&(ipaddr)), \
IP6_ADDR_BLOCK5(&(ipaddr)), \
IP6_ADDR_BLOCK6(&(ipaddr)), \
IP6_ADDR_BLOCK7(&(ipaddr)), \
IP6_ADDR_BLOCK8(&(ipaddr)))

Definition at line 653 of file tcpip.h.

◆ IPADDR4_INIT

#define IPADDR4_INIT (   u32val)
Value:
{ \
u32val \
}

Definition at line 938 of file tcpip.h.

◆ IP_ADDR_ANY

#define IP_ADDR_ANY   IP4_ADDR_ANY

Provided for compatibility. Use IP4_ADDR_ANY for better readability.

Definition at line 1039 of file tcpip.h.

◆ IP4_ADDR_ANY

#define IP4_ADDR_ANY   (&ip_addr_any)

Can be used as a fixed/const ip_addr_t for the IPv4 wildcard and the broadcast address

Definition at line 1045 of file tcpip.h.

◆ IP4_ADDR_ANY4

#define IP4_ADDR_ANY4   (ip_2_ip4(&ip_addr_any))

Can be used as a fixed/const ip4_addr_t for the wildcard and the broadcast address

Definition at line 1051 of file tcpip.h.

◆ NETIF_MAX_HWADDR_LEN

#define NETIF_MAX_HWADDR_LEN   6U

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.

Definition at line 1101 of file tcpip.h.

◆ netif_set_client_data

#define netif_set_client_data (   netif,
  id,
  data 
)    netif_get_client_data(netif, id) = (data)

Set client data. Obtain ID from netif_alloc_client_data_id().

Definition at line 1252 of file tcpip.h.

◆ netif_get_client_data

#define netif_get_client_data (   netif,
  id 
)    (netif)->client_data[(id)]

Get client data. Obtain ID from netif_alloc_client_data_id().

Definition at line 1256 of file tcpip.h.

◆ netif_is_up

#define netif_is_up (   netif)    (((netif)->flags & NETIF_FLAG_UP) ? (u8)1 : (u8)0)

Ask if an interface is up

Definition at line 1415 of file tcpip.h.

◆ netif_is_link_up

#define netif_is_link_up (   netif)    (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8)1 : (u8)0)

Ask if a link is up

Definition at line 1418 of file tcpip.h.

◆ INADDR_NONE

#define INADDR_NONE   IPADDR_NONE

255.255.255.255

Definition at line 1518 of file tcpip.h.

◆ INADDR_LOOPBACK

#define INADDR_LOOPBACK   IPADDR_LOOPBACK

127.0.0.1

Definition at line 1520 of file tcpip.h.

◆ INADDR_ANY

#define INADDR_ANY   IPADDR_ANY

0.0.0.0

Definition at line 1522 of file tcpip.h.

◆ INADDR_BROADCAST

#define INADDR_BROADCAST   IPADDR_BROADCAST

255.255.255.255

Definition at line 1524 of file tcpip.h.

◆ FDSETSAFESET

#define FDSETSAFESET (   n,
  code 
)
Value:
do { \
if (((n)-LWIP_SOCKET_OFFSET < MEMP_NUM_NETCONN) && (((int)(n)-LWIP_SOCKET_OFFSET) >= 0)) { \
code; \
} \
} while (0)

Definition at line 1824 of file tcpip.h.

◆ FDSETSAFEGET

#define FDSETSAFEGET (   n,
  code 
)
Value:
(((n)-LWIP_SOCKET_OFFSET < MEMP_NUM_NETCONN) && (((int)(n)-LWIP_SOCKET_OFFSET) >= 0) ? \
(code) : \
0)

Definition at line 1830 of file tcpip.h.

◆ DNS_TMR_INTERVAL

#define DNS_TMR_INTERVAL   1000

DNS timer period

Definition at line 1851 of file tcpip.h.

◆ EAI_NONAME

#define EAI_NONAME   200

Errors used by the DNS API functions, h_errno can be one of them

Definition at line 1916 of file tcpip.h.

◆ PP_HTONL

#define PP_HTONL (   x)
Value:
((((x)&0xff) << 24) | \
(((x)&0xff00) << 8) | \
(((x)&0xff0000UL) >> 8) | \
(((x)&0xff000000UL) >> 24))

Definition at line 1983 of file tcpip.h.

Typedef Documentation

◆ ip4_addr_t

typedef struct ip4_addr ip4_addr_t

ip4_addr_t uses a struct for convenience only, so that the same defines can operate both on ip4_addr_t as well as on ip4_addr_p_t.

Definition at line 273 of file tcpip.h.

◆ ip6_addr_t

typedef struct ip6_addr ip6_addr_t

IPv6 address

Definition at line 426 of file tcpip.h.

◆ netif_init_fn

typedef err_t(* netif_init_fn) (struct netif *netif)

Function prototype for netif init functions. Set up flags and output/linkoutput callback functions in this function.

Parameters
netifThe netif to initialize

Definition at line 1192 of file tcpip.h.

◆ netif_input_fn

typedef err_t(* netif_input_fn) (struct pbuf *p, struct netif *inp)

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.

Parameters
pThe received packet, copied into a pbuf
inpThe netif which received the packet

Definition at line 1199 of file tcpip.h.

◆ netif_output_fn

typedef err_t(* netif_output_fn) (struct netif *netif, struct pbuf *p, const ip4_addr_t *ipaddr)

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

Parameters
netifThe netif which shall send a packet
pThe packet to send (p->payload points to IP header)
ipaddrThe IP address to which the packet shall be sent

Definition at line 1210 of file tcpip.h.

◆ netif_linkoutput_fn

typedef err_t(* netif_linkoutput_fn) (struct netif *netif, struct pbuf *p)

Function prototype for netif->linkoutput functions. Only used for ethernet netifs. This function is called by ARP when a packet shall be sent.

Parameters
netifThe netif which shall send a packet
pThe packet to send (raw ethernet packet)

Definition at line 1233 of file tcpip.h.

◆ netif_status_callback_fn

typedef void(* netif_status_callback_fn) (struct netif *netif)

Function prototype for netif status- or link-callback functions.

Definition at line 1235 of file tcpip.h.

◆ dns_found_callback

typedef void(* dns_found_callback) (const char *name, const ip_addr_t *ipaddr, void *callback_arg)

Callback which is invoked when a hostname is found. A function of this type must be implemented by the application using the DNS resolver.

Parameters
namepointer to the name that was looked up.
ipaddrpointer to an ip_addr_t containing the IP address of the hostname, or NULL if the name could not be found (or on any other error).
callback_arga user-specified callback argument passed to dns_gethostbyname

Definition at line 1893 of file tcpip.h.

Enumeration Type Documentation

◆ pbuf_layer

enum pbuf_layer

Enumeration of pbuf layers

Enumerator
PBUF_TRANSPORT 

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

PBUF_IP 

Includes spare room for IP header. Use this if you intend to pass the pbuf to functions like raw_send().

PBUF_LINK 

Includes spare room for link layer header (ethernet header). Use this if you intend to pass the pbuf to functions like ethernet_output().

See also
PBUF_LINK_HLEN
PBUF_RAW_TX 

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 also
PBUF_LINK_ENCAPSULATION_HLEN
PBUF_RAW 

Use this for input packets in a netif driver when calling netif->input() in the most common case - ethernet-layer netif driver.

Definition at line 174 of file tcpip.h.

◆ pbuf_type

enum pbuf_type

Enumeration of pbuf types

Enumerator
PBUF_RAM 

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

PBUF_ROM 

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.

PBUF_REF 

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.

PBUF_POOL 

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!

Definition at line 203 of file tcpip.h.

◆ lwip_ip_addr_type

IP address types for use in ip_addr_t.type member.

See also
tcp_new_ip_type(), udp_new_ip_type(), raw_new_ip_type().
Enumerator
IPADDR_TYPE_V4 

IPv4

IPADDR_TYPE_V6 

IPv6

IPADDR_TYPE_ANY 

IPv4+IPv6 ("dual-stack")

Definition at line 672 of file tcpip.h.

◆ netif_mac_filter_action

MAC Filter Actions, these are passed to a netif's igmp_mac_filter or mld_mac_filter callback function.

Enumerator
NETIF_DEL_MAC_FILTER 

Delete a filter entry

NETIF_ADD_MAC_FILTER 

Add a filter entry

Definition at line 1180 of file tcpip.h.

Variable Documentation

◆ netif_list

struct netif* netif_list

The list of network interfaces.

◆ netif_default

struct netif* netif_default

The default network interface.

IP6_ADDR_BLOCK5
#define IP6_ADDR_BLOCK5(ip6addr)
Definition: tcpip.h:456
IP6_ADDR_BLOCK1
#define IP6_ADDR_BLOCK1(ip6addr)
Definition: tcpip.h:448
IP6_ADDR_BLOCK8
#define IP6_ADDR_BLOCK8(ip6addr)
Definition: tcpip.h:462
IP6_ADDR_BLOCK6
#define IP6_ADDR_BLOCK6(ip6addr)
Definition: tcpip.h:458
IP6_ADDR_BLOCK4
#define IP6_ADDR_BLOCK4(ip6addr)
Definition: tcpip.h:454
IP6_ADDR_BLOCK7
#define IP6_ADDR_BLOCK7(ip6addr)
Definition: tcpip.h:460
IP6_ADDR_BLOCK2
#define IP6_ADDR_BLOCK2(ip6addr)
Definition: tcpip.h:450
IP6_ADDR_BLOCK3
#define IP6_ADDR_BLOCK3(ip6addr)
Definition: tcpip.h:452