Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ip4.h Source File

ip4.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  * IPv4 API
00004  */
00005 
00006 /*
00007  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
00008  * All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without modification,
00011  * are permitted provided that the following conditions are met:
00012  *
00013  * 1. Redistributions of source code must retain the above copyright notice,
00014  *    this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright notice,
00016  *    this list of conditions and the following disclaimer in the documentation
00017  *    and/or other materials provided with the distribution.
00018  * 3. The name of the author may not be used to endorse or promote products
00019  *    derived from this software without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00022  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00023  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00024  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00026  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00027  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00028  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00029  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00030  * OF SUCH DAMAGE.
00031  *
00032  * This file is part of the lwIP TCP/IP stack.
00033  *
00034  * Author: Adam Dunkels <adam@sics.se>
00035  *
00036  */
00037 #ifndef LWIP_HDR_IP4_H
00038 #define LWIP_HDR_IP4_H
00039 
00040 #include "lwip/opt.h"
00041 
00042 #if LWIP_IPV4
00043 
00044 #include "lwip/def.h"
00045 #include "lwip/pbuf.h"
00046 #include "lwip/ip4_addr.h"
00047 #include "lwip/err.h"
00048 #include "lwip/netif.h"
00049 #include "lwip/prot/ip4.h"
00050 
00051 #ifdef __cplusplus
00052 extern "C" {
00053 #endif
00054 
00055 #ifdef LWIP_HOOK_IP4_ROUTE_SRC
00056 #define LWIP_IPV4_SRC_ROUTING   1
00057 #else
00058 #define LWIP_IPV4_SRC_ROUTING   0
00059 #endif
00060 
00061 /** Currently, the function ip_output_if_opt() is only used with IGMP */
00062 #define IP_OPTIONS_SEND   (LWIP_IPV4 && LWIP_IGMP)
00063 
00064 #define ip_init() /* Compatibility define, no init needed. */
00065 struct netif *ip4_route(const ip4_addr_t *dest);
00066 #if LWIP_IPV4_SRC_ROUTING
00067 struct netif *ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src);
00068 #else /* LWIP_IPV4_SRC_ROUTING */
00069 #define ip4_route_src(dest, src) ip4_route(dest)
00070 #endif /* LWIP_IPV4_SRC_ROUTING */
00071 err_t ip4_input(struct pbuf *p, struct netif *inp);
00072 err_t ip4_output(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
00073        u8_t ttl, u8_t tos, u8_t proto);
00074 err_t ip4_output_if(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
00075        u8_t ttl, u8_t tos, u8_t proto, struct netif *netif);
00076 err_t ip4_output_if_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
00077        u8_t ttl, u8_t tos, u8_t proto, struct netif *netif);
00078 #if LWIP_NETIF_HWADDRHINT
00079 err_t ip4_output_hinted(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
00080        u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint);
00081 #endif /* LWIP_NETIF_HWADDRHINT */
00082 #if IP_OPTIONS_SEND
00083 err_t ip4_output_if_opt(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
00084        u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,
00085        u16_t optlen);
00086 err_t ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
00087        u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,
00088        u16_t optlen);
00089 #endif /* IP_OPTIONS_SEND */
00090 
00091 #if LWIP_MULTICAST_TX_OPTIONS
00092 void  ip4_set_default_multicast_netif(struct netif* default_multicast_netif);
00093 #endif /* LWIP_MULTICAST_TX_OPTIONS */
00094 
00095 #define ip4_netif_get_local_ip(netif) (((netif) != NULL) ? netif_ip_addr4(netif) : NULL)
00096 
00097 #if IP_DEBUG
00098 void ip4_debug_print(struct pbuf *p);
00099 #else
00100 #define ip4_debug_print(p)
00101 #endif /* IP_DEBUG */
00102 
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106 
00107 #endif /* LWIP_IPV4 */
00108 
00109 #endif /* LWIP_HDR_IP_H */
00110 
00111