1*5d5fbe79SDavid van Moolenbroek /** 2*5d5fbe79SDavid van Moolenbroek * @file 3*5d5fbe79SDavid van Moolenbroek * IPv4 API 4*5d5fbe79SDavid van Moolenbroek */ 5*5d5fbe79SDavid van Moolenbroek 6*5d5fbe79SDavid van Moolenbroek /* 7*5d5fbe79SDavid van Moolenbroek * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8*5d5fbe79SDavid van Moolenbroek * All rights reserved. 9*5d5fbe79SDavid van Moolenbroek * 10*5d5fbe79SDavid van Moolenbroek * Redistribution and use in source and binary forms, with or without modification, 11*5d5fbe79SDavid van Moolenbroek * are permitted provided that the following conditions are met: 12*5d5fbe79SDavid van Moolenbroek * 13*5d5fbe79SDavid van Moolenbroek * 1. Redistributions of source code must retain the above copyright notice, 14*5d5fbe79SDavid van Moolenbroek * this list of conditions and the following disclaimer. 15*5d5fbe79SDavid van Moolenbroek * 2. Redistributions in binary form must reproduce the above copyright notice, 16*5d5fbe79SDavid van Moolenbroek * this list of conditions and the following disclaimer in the documentation 17*5d5fbe79SDavid van Moolenbroek * and/or other materials provided with the distribution. 18*5d5fbe79SDavid van Moolenbroek * 3. The name of the author may not be used to endorse or promote products 19*5d5fbe79SDavid van Moolenbroek * derived from this software without specific prior written permission. 20*5d5fbe79SDavid van Moolenbroek * 21*5d5fbe79SDavid van Moolenbroek * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22*5d5fbe79SDavid van Moolenbroek * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23*5d5fbe79SDavid van Moolenbroek * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24*5d5fbe79SDavid van Moolenbroek * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25*5d5fbe79SDavid van Moolenbroek * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26*5d5fbe79SDavid van Moolenbroek * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27*5d5fbe79SDavid van Moolenbroek * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28*5d5fbe79SDavid van Moolenbroek * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29*5d5fbe79SDavid van Moolenbroek * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30*5d5fbe79SDavid van Moolenbroek * OF SUCH DAMAGE. 31*5d5fbe79SDavid van Moolenbroek * 32*5d5fbe79SDavid van Moolenbroek * This file is part of the lwIP TCP/IP stack. 33*5d5fbe79SDavid van Moolenbroek * 34*5d5fbe79SDavid van Moolenbroek * Author: Adam Dunkels <adam@sics.se> 35*5d5fbe79SDavid van Moolenbroek * 36*5d5fbe79SDavid van Moolenbroek */ 37*5d5fbe79SDavid van Moolenbroek #ifndef LWIP_HDR_IP4_H 38*5d5fbe79SDavid van Moolenbroek #define LWIP_HDR_IP4_H 39*5d5fbe79SDavid van Moolenbroek 40*5d5fbe79SDavid van Moolenbroek #include "lwip/opt.h" 41*5d5fbe79SDavid van Moolenbroek 42*5d5fbe79SDavid van Moolenbroek #if LWIP_IPV4 43*5d5fbe79SDavid van Moolenbroek 44*5d5fbe79SDavid van Moolenbroek #include "lwip/def.h" 45*5d5fbe79SDavid van Moolenbroek #include "lwip/pbuf.h" 46*5d5fbe79SDavid van Moolenbroek #include "lwip/ip4_addr.h" 47*5d5fbe79SDavid van Moolenbroek #include "lwip/err.h" 48*5d5fbe79SDavid van Moolenbroek #include "lwip/netif.h" 49*5d5fbe79SDavid van Moolenbroek #include "lwip/prot/ip4.h" 50*5d5fbe79SDavid van Moolenbroek 51*5d5fbe79SDavid van Moolenbroek #ifdef __cplusplus 52*5d5fbe79SDavid van Moolenbroek extern "C" { 53*5d5fbe79SDavid van Moolenbroek #endif 54*5d5fbe79SDavid van Moolenbroek 55*5d5fbe79SDavid van Moolenbroek #ifdef LWIP_HOOK_IP4_ROUTE_SRC 56*5d5fbe79SDavid van Moolenbroek #define LWIP_IPV4_SRC_ROUTING 1 57*5d5fbe79SDavid van Moolenbroek #else 58*5d5fbe79SDavid van Moolenbroek #define LWIP_IPV4_SRC_ROUTING 0 59*5d5fbe79SDavid van Moolenbroek #endif 60*5d5fbe79SDavid van Moolenbroek 61*5d5fbe79SDavid van Moolenbroek /** Currently, the function ip_output_if_opt() is only used with IGMP */ 62*5d5fbe79SDavid van Moolenbroek #define IP_OPTIONS_SEND (LWIP_IPV4 && LWIP_IGMP) 63*5d5fbe79SDavid van Moolenbroek 64*5d5fbe79SDavid van Moolenbroek #define ip_init() /* Compatibility define, no init needed. */ 65*5d5fbe79SDavid van Moolenbroek struct netif *ip4_route(const ip4_addr_t *dest); 66*5d5fbe79SDavid van Moolenbroek #if LWIP_IPV4_SRC_ROUTING 67*5d5fbe79SDavid van Moolenbroek struct netif *ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src); 68*5d5fbe79SDavid van Moolenbroek #else /* LWIP_IPV4_SRC_ROUTING */ 69*5d5fbe79SDavid van Moolenbroek #define ip4_route_src(dest, src) ip4_route(dest) 70*5d5fbe79SDavid van Moolenbroek #endif /* LWIP_IPV4_SRC_ROUTING */ 71*5d5fbe79SDavid van Moolenbroek err_t ip4_input(struct pbuf *p, struct netif *inp); 72*5d5fbe79SDavid van Moolenbroek err_t ip4_output(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, 73*5d5fbe79SDavid van Moolenbroek u8_t ttl, u8_t tos, u8_t proto); 74*5d5fbe79SDavid van Moolenbroek err_t ip4_output_if(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, 75*5d5fbe79SDavid van Moolenbroek u8_t ttl, u8_t tos, u8_t proto, struct netif *netif); 76*5d5fbe79SDavid van Moolenbroek err_t ip4_output_if_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, 77*5d5fbe79SDavid van Moolenbroek u8_t ttl, u8_t tos, u8_t proto, struct netif *netif); 78*5d5fbe79SDavid van Moolenbroek #if LWIP_NETIF_HWADDRHINT 79*5d5fbe79SDavid van Moolenbroek err_t ip4_output_hinted(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, 80*5d5fbe79SDavid van Moolenbroek u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint); 81*5d5fbe79SDavid van Moolenbroek #endif /* LWIP_NETIF_HWADDRHINT */ 82*5d5fbe79SDavid van Moolenbroek #if IP_OPTIONS_SEND 83*5d5fbe79SDavid van Moolenbroek err_t ip4_output_if_opt(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, 84*5d5fbe79SDavid van Moolenbroek u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options, 85*5d5fbe79SDavid van Moolenbroek u16_t optlen); 86*5d5fbe79SDavid van Moolenbroek err_t ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, 87*5d5fbe79SDavid van Moolenbroek u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options, 88*5d5fbe79SDavid van Moolenbroek u16_t optlen); 89*5d5fbe79SDavid van Moolenbroek #endif /* IP_OPTIONS_SEND */ 90*5d5fbe79SDavid van Moolenbroek 91*5d5fbe79SDavid van Moolenbroek #if LWIP_MULTICAST_TX_OPTIONS 92*5d5fbe79SDavid van Moolenbroek void ip4_set_default_multicast_netif(struct netif* default_multicast_netif); 93*5d5fbe79SDavid van Moolenbroek #endif /* LWIP_MULTICAST_TX_OPTIONS */ 94*5d5fbe79SDavid van Moolenbroek 95*5d5fbe79SDavid van Moolenbroek #define ip4_netif_get_local_ip(netif) (((netif) != NULL) ? netif_ip_addr4(netif) : NULL) 96*5d5fbe79SDavid van Moolenbroek 97*5d5fbe79SDavid van Moolenbroek #if IP_DEBUG 98*5d5fbe79SDavid van Moolenbroek void ip4_debug_print(struct pbuf *p); 99*5d5fbe79SDavid van Moolenbroek #else 100*5d5fbe79SDavid van Moolenbroek #define ip4_debug_print(p) 101*5d5fbe79SDavid van Moolenbroek #endif /* IP_DEBUG */ 102*5d5fbe79SDavid van Moolenbroek 103*5d5fbe79SDavid van Moolenbroek #ifdef __cplusplus 104*5d5fbe79SDavid van Moolenbroek } 105*5d5fbe79SDavid van Moolenbroek #endif 106*5d5fbe79SDavid van Moolenbroek 107*5d5fbe79SDavid van Moolenbroek #endif /* LWIP_IPV4 */ 108*5d5fbe79SDavid van Moolenbroek 109*5d5fbe79SDavid van Moolenbroek #endif /* LWIP_HDR_IP_H */ 110*5d5fbe79SDavid van Moolenbroek 111*5d5fbe79SDavid van Moolenbroek 112