SNMP agent attached to SPI slave

Dependencies:   mbed

Committer:
lorcansmith
Date:
Mon Aug 13 15:07:40 2012 +0000
Revision:
0:2a53a4c3238c
v1.1 release includes ioAlarm traps

Who changed what in which revision?

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