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 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
lorcansmith 0:2a53a4c3238c 3 * All rights reserved.
lorcansmith 0:2a53a4c3238c 4 *
lorcansmith 0:2a53a4c3238c 5 * Redistribution and use in source and binary forms, with or without modification,
lorcansmith 0:2a53a4c3238c 6 * are permitted provided that the following conditions are met:
lorcansmith 0:2a53a4c3238c 7 *
lorcansmith 0:2a53a4c3238c 8 * 1. Redistributions of source code must retain the above copyright notice,
lorcansmith 0:2a53a4c3238c 9 * this list of conditions and the following disclaimer.
lorcansmith 0:2a53a4c3238c 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
lorcansmith 0:2a53a4c3238c 11 * this list of conditions and the following disclaimer in the documentation
lorcansmith 0:2a53a4c3238c 12 * and/or other materials provided with the distribution.
lorcansmith 0:2a53a4c3238c 13 * 3. The name of the author may not be used to endorse or promote products
lorcansmith 0:2a53a4c3238c 14 * derived from this software without specific prior written permission.
lorcansmith 0:2a53a4c3238c 15 *
lorcansmith 0:2a53a4c3238c 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
lorcansmith 0:2a53a4c3238c 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
lorcansmith 0:2a53a4c3238c 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
lorcansmith 0:2a53a4c3238c 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
lorcansmith 0:2a53a4c3238c 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
lorcansmith 0:2a53a4c3238c 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
lorcansmith 0:2a53a4c3238c 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
lorcansmith 0:2a53a4c3238c 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
lorcansmith 0:2a53a4c3238c 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
lorcansmith 0:2a53a4c3238c 25 * OF SUCH DAMAGE.
lorcansmith 0:2a53a4c3238c 26 *
lorcansmith 0:2a53a4c3238c 27 * This file is part of the lwIP TCP/IP stack.
lorcansmith 0:2a53a4c3238c 28 *
lorcansmith 0:2a53a4c3238c 29 * Author: Adam Dunkels <adam@sics.se>
lorcansmith 0:2a53a4c3238c 30 *
lorcansmith 0:2a53a4c3238c 31 */
lorcansmith 0:2a53a4c3238c 32 #ifndef __LWIP_RAW_H__
lorcansmith 0:2a53a4c3238c 33 #define __LWIP_RAW_H__
lorcansmith 0:2a53a4c3238c 34
lorcansmith 0:2a53a4c3238c 35 #include "lwip/opt.h"
lorcansmith 0:2a53a4c3238c 36
lorcansmith 0:2a53a4c3238c 37 #if LWIP_RAW /* don't build if not configured for use in lwipopts.h */
lorcansmith 0:2a53a4c3238c 38
lorcansmith 0:2a53a4c3238c 39 #include "lwip/pbuf.h"
lorcansmith 0:2a53a4c3238c 40 #include "lwip/def.h"
lorcansmith 0:2a53a4c3238c 41 #include "lwip/ip.h"
lorcansmith 0:2a53a4c3238c 42 #include "lwip/ip_addr.h"
lorcansmith 0:2a53a4c3238c 43
lorcansmith 0:2a53a4c3238c 44 #ifdef __cplusplus
lorcansmith 0:2a53a4c3238c 45 extern "C" {
lorcansmith 0:2a53a4c3238c 46 #endif
lorcansmith 0:2a53a4c3238c 47
lorcansmith 0:2a53a4c3238c 48 struct raw_pcb;
lorcansmith 0:2a53a4c3238c 49
lorcansmith 0:2a53a4c3238c 50 /** Function prototype for raw pcb receive callback functions.
lorcansmith 0:2a53a4c3238c 51 * @param arg user supplied argument (raw_pcb.recv_arg)
lorcansmith 0:2a53a4c3238c 52 * @param pcb the raw_pcb which received data
lorcansmith 0:2a53a4c3238c 53 * @param p the packet buffer that was received
lorcansmith 0:2a53a4c3238c 54 * @param addr the remote IP address from which the packet was received
lorcansmith 0:2a53a4c3238c 55 * @return 1 if the packet was 'eaten' (aka. deleted),
lorcansmith 0:2a53a4c3238c 56 * 0 if the packet lives on
lorcansmith 0:2a53a4c3238c 57 * If returning 1, the callback is responsible for freeing the pbuf
lorcansmith 0:2a53a4c3238c 58 * if it's not used any more.
lorcansmith 0:2a53a4c3238c 59 */
lorcansmith 0:2a53a4c3238c 60 typedef u8_t (*raw_recv_fn)(void *arg, struct raw_pcb *pcb, struct pbuf *p,
lorcansmith 0:2a53a4c3238c 61 ip_addr_t *addr);
lorcansmith 0:2a53a4c3238c 62
lorcansmith 0:2a53a4c3238c 63 struct raw_pcb {
lorcansmith 0:2a53a4c3238c 64 /* Common members of all PCB types */
lorcansmith 0:2a53a4c3238c 65 IP_PCB;
lorcansmith 0:2a53a4c3238c 66
lorcansmith 0:2a53a4c3238c 67 struct raw_pcb *next;
lorcansmith 0:2a53a4c3238c 68
lorcansmith 0:2a53a4c3238c 69 u8_t protocol;
lorcansmith 0:2a53a4c3238c 70
lorcansmith 0:2a53a4c3238c 71 /** receive callback function */
lorcansmith 0:2a53a4c3238c 72 raw_recv_fn recv;
lorcansmith 0:2a53a4c3238c 73 /* user-supplied argument for the recv callback */
lorcansmith 0:2a53a4c3238c 74 void *recv_arg;
lorcansmith 0:2a53a4c3238c 75 };
lorcansmith 0:2a53a4c3238c 76
lorcansmith 0:2a53a4c3238c 77 /* The following functions is the application layer interface to the
lorcansmith 0:2a53a4c3238c 78 RAW code. */
lorcansmith 0:2a53a4c3238c 79 struct raw_pcb * raw_new (u8_t proto);
lorcansmith 0:2a53a4c3238c 80 void raw_remove (struct raw_pcb *pcb);
lorcansmith 0:2a53a4c3238c 81 err_t raw_bind (struct raw_pcb *pcb, ip_addr_t *ipaddr);
lorcansmith 0:2a53a4c3238c 82 err_t raw_connect (struct raw_pcb *pcb, ip_addr_t *ipaddr);
lorcansmith 0:2a53a4c3238c 83
lorcansmith 0:2a53a4c3238c 84 void raw_recv (struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg);
lorcansmith 0:2a53a4c3238c 85 err_t raw_sendto (struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr);
lorcansmith 0:2a53a4c3238c 86 err_t raw_send (struct raw_pcb *pcb, struct pbuf *p);
lorcansmith 0:2a53a4c3238c 87
lorcansmith 0:2a53a4c3238c 88 /* The following functions are the lower layer interface to RAW. */
lorcansmith 0:2a53a4c3238c 89 u8_t raw_input (struct pbuf *p, struct netif *inp);
lorcansmith 0:2a53a4c3238c 90 #define raw_init() /* Compatibility define, not init needed. */
lorcansmith 0:2a53a4c3238c 91
lorcansmith 0:2a53a4c3238c 92 #ifdef __cplusplus
lorcansmith 0:2a53a4c3238c 93 }
lorcansmith 0:2a53a4c3238c 94 #endif
lorcansmith 0:2a53a4c3238c 95
lorcansmith 0:2a53a4c3238c 96 #endif /* LWIP_RAW */
lorcansmith 0:2a53a4c3238c 97
lorcansmith 0:2a53a4c3238c 98 #endif /* __LWIP_RAW_H__ */