Stripped down version of Segundos NetService library (http://mbed.org/users/segundo/libraries/NetServices ). I have removed all NetServices, and all functions which had been disabled. Use this version when you need only pure TCP or UDP functions - this library compiles faster.

Dependencies:   lwip lwip-sys

Dependents:   christmasLights device_server pop3demo device_server_udp ... more

Committer:
hlipka
Date:
Mon Jan 10 21:03:11 2011 +0000
Revision:
0:8b387bed54c2
initial version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hlipka 0:8b387bed54c2 1 /*
hlipka 0:8b387bed54c2 2 * Redistribution and use in source and binary forms, with or without modification,
hlipka 0:8b387bed54c2 3 * are permitted provided that the following conditions are met:
hlipka 0:8b387bed54c2 4 *
hlipka 0:8b387bed54c2 5 * 1. Redistributions of source code must retain the above copyright notice,
hlipka 0:8b387bed54c2 6 * this list of conditions and the following disclaimer.
hlipka 0:8b387bed54c2 7 * 2. Redistributions in binary form must reproduce the above copyright notice,
hlipka 0:8b387bed54c2 8 * this list of conditions and the following disclaimer in the documentation
hlipka 0:8b387bed54c2 9 * and/or other materials provided with the distribution.
hlipka 0:8b387bed54c2 10 * 3. The name of the author may not be used to endorse or promote products
hlipka 0:8b387bed54c2 11 * derived from this software without specific prior written permission.
hlipka 0:8b387bed54c2 12 *
hlipka 0:8b387bed54c2 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
hlipka 0:8b387bed54c2 14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
hlipka 0:8b387bed54c2 15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
hlipka 0:8b387bed54c2 16 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
hlipka 0:8b387bed54c2 17 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
hlipka 0:8b387bed54c2 18 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
hlipka 0:8b387bed54c2 19 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
hlipka 0:8b387bed54c2 20 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
hlipka 0:8b387bed54c2 21 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
hlipka 0:8b387bed54c2 22 * OF SUCH DAMAGE.
hlipka 0:8b387bed54c2 23 *
hlipka 0:8b387bed54c2 24 * This file is part of the lwIP TCP/IP stack.
hlipka 0:8b387bed54c2 25 *
hlipka 0:8b387bed54c2 26 */
hlipka 0:8b387bed54c2 27
hlipka 0:8b387bed54c2 28 #ifndef __LWIP_NETIFAPI_H__
hlipka 0:8b387bed54c2 29 #define __LWIP_NETIFAPI_H__
hlipka 0:8b387bed54c2 30
hlipka 0:8b387bed54c2 31 #include "lwip/opt.h"
hlipka 0:8b387bed54c2 32
hlipka 0:8b387bed54c2 33 #if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */
hlipka 0:8b387bed54c2 34
hlipka 0:8b387bed54c2 35 #include "lwip/sys.h"
hlipka 0:8b387bed54c2 36 #include "lwip/netif.h"
hlipka 0:8b387bed54c2 37 #include "lwip/dhcp.h"
hlipka 0:8b387bed54c2 38 #include "lwip/autoip.h"
hlipka 0:8b387bed54c2 39
hlipka 0:8b387bed54c2 40 #ifdef __cplusplus
hlipka 0:8b387bed54c2 41 extern "C" {
hlipka 0:8b387bed54c2 42 #endif
hlipka 0:8b387bed54c2 43
hlipka 0:8b387bed54c2 44 typedef void (*netifapi_void_fn)(struct netif *netif);
hlipka 0:8b387bed54c2 45 typedef err_t (*netifapi_errt_fn)(struct netif *netif);
hlipka 0:8b387bed54c2 46
hlipka 0:8b387bed54c2 47 struct netifapi_msg_msg {
hlipka 0:8b387bed54c2 48 #if !LWIP_TCPIP_CORE_LOCKING
hlipka 0:8b387bed54c2 49 sys_sem_t sem;
hlipka 0:8b387bed54c2 50 #endif /* !LWIP_TCPIP_CORE_LOCKING */
hlipka 0:8b387bed54c2 51 err_t err;
hlipka 0:8b387bed54c2 52 struct netif *netif;
hlipka 0:8b387bed54c2 53 union {
hlipka 0:8b387bed54c2 54 struct {
hlipka 0:8b387bed54c2 55 ip_addr_t *ipaddr;
hlipka 0:8b387bed54c2 56 ip_addr_t *netmask;
hlipka 0:8b387bed54c2 57 ip_addr_t *gw;
hlipka 0:8b387bed54c2 58 void *state;
hlipka 0:8b387bed54c2 59 netif_init_fn init;
hlipka 0:8b387bed54c2 60 netif_input_fn input;
hlipka 0:8b387bed54c2 61 } add;
hlipka 0:8b387bed54c2 62 struct {
hlipka 0:8b387bed54c2 63 netifapi_void_fn voidfunc;
hlipka 0:8b387bed54c2 64 netifapi_errt_fn errtfunc;
hlipka 0:8b387bed54c2 65 } common;
hlipka 0:8b387bed54c2 66 } msg;
hlipka 0:8b387bed54c2 67 };
hlipka 0:8b387bed54c2 68
hlipka 0:8b387bed54c2 69 struct netifapi_msg {
hlipka 0:8b387bed54c2 70 void (* function)(struct netifapi_msg_msg *msg);
hlipka 0:8b387bed54c2 71 struct netifapi_msg_msg msg;
hlipka 0:8b387bed54c2 72 };
hlipka 0:8b387bed54c2 73
hlipka 0:8b387bed54c2 74
hlipka 0:8b387bed54c2 75 /* API for application */
hlipka 0:8b387bed54c2 76 err_t netifapi_netif_add ( struct netif *netif,
hlipka 0:8b387bed54c2 77 ip_addr_t *ipaddr,
hlipka 0:8b387bed54c2 78 ip_addr_t *netmask,
hlipka 0:8b387bed54c2 79 ip_addr_t *gw,
hlipka 0:8b387bed54c2 80 void *state,
hlipka 0:8b387bed54c2 81 netif_init_fn init,
hlipka 0:8b387bed54c2 82 netif_input_fn input);
hlipka 0:8b387bed54c2 83
hlipka 0:8b387bed54c2 84 err_t netifapi_netif_set_addr ( struct netif *netif,
hlipka 0:8b387bed54c2 85 ip_addr_t *ipaddr,
hlipka 0:8b387bed54c2 86 ip_addr_t *netmask,
hlipka 0:8b387bed54c2 87 ip_addr_t *gw );
hlipka 0:8b387bed54c2 88
hlipka 0:8b387bed54c2 89 err_t netifapi_netif_common ( struct netif *netif,
hlipka 0:8b387bed54c2 90 netifapi_void_fn voidfunc,
hlipka 0:8b387bed54c2 91 netifapi_errt_fn errtfunc);
hlipka 0:8b387bed54c2 92
hlipka 0:8b387bed54c2 93 #define netifapi_netif_remove(n) netifapi_netif_common(n, netif_remove, NULL)
hlipka 0:8b387bed54c2 94 #define netifapi_netif_set_up(n) netifapi_netif_common(n, netif_set_up, NULL)
hlipka 0:8b387bed54c2 95 #define netifapi_netif_set_down(n) netifapi_netif_common(n, netif_set_down, NULL)
hlipka 0:8b387bed54c2 96 #define netifapi_netif_set_default(n) netifapi_netif_common(n, netif_set_default, NULL)
hlipka 0:8b387bed54c2 97 #define netifapi_dhcp_start(n) netifapi_netif_common(n, NULL, dhcp_start)
hlipka 0:8b387bed54c2 98 #define netifapi_dhcp_stop(n) netifapi_netif_common(n, dhcp_stop, NULL)
hlipka 0:8b387bed54c2 99 #define netifapi_autoip_start(n) netifapi_netif_common(n, NULL, autoip_start)
hlipka 0:8b387bed54c2 100 #define netifapi_autoip_stop(n) netifapi_netif_common(n, NULL, autoip_stop)
hlipka 0:8b387bed54c2 101
hlipka 0:8b387bed54c2 102 #ifdef __cplusplus
hlipka 0:8b387bed54c2 103 }
hlipka 0:8b387bed54c2 104 #endif
hlipka 0:8b387bed54c2 105
hlipka 0:8b387bed54c2 106 #endif /* LWIP_NETIF_API */
hlipka 0:8b387bed54c2 107
hlipka 0:8b387bed54c2 108 #endif /* __LWIP_NETIFAPI_H__ */