Geiger counter http://geigermaps.jp/Create/Tutorials/mbed_geiger/ja

Dependencies:   mbed

Committer:
okini3939
Date:
Fri Apr 15 16:51:30 2011 +0000
Revision:
0:5b2e60110d9b

        

Who changed what in which revision?

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