SHOHEI FUJIMOTO / Mbed 2 deprecated SimpleOscTester

Dependencies:   mbed

Fork of myOSC_test by Alvaro Cassinelli

Committer:
mbedalvaro
Date:
Sat Oct 15 14:15:55 2011 +0000
Revision:
0:f76708a93fb3
First working test of this simple OSC library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedalvaro 0:f76708a93fb3 1 /*
mbedalvaro 0:f76708a93fb3 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
mbedalvaro 0:f76708a93fb3 3 * All rights reserved.
mbedalvaro 0:f76708a93fb3 4 *
mbedalvaro 0:f76708a93fb3 5 * Redistribution and use in source and binary forms, with or without modification,
mbedalvaro 0:f76708a93fb3 6 * are permitted provided that the following conditions are met:
mbedalvaro 0:f76708a93fb3 7 *
mbedalvaro 0:f76708a93fb3 8 * 1. Redistributions of source code must retain the above copyright notice,
mbedalvaro 0:f76708a93fb3 9 * this list of conditions and the following disclaimer.
mbedalvaro 0:f76708a93fb3 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbedalvaro 0:f76708a93fb3 11 * this list of conditions and the following disclaimer in the documentation
mbedalvaro 0:f76708a93fb3 12 * and/or other materials provided with the distribution.
mbedalvaro 0:f76708a93fb3 13 * 3. The name of the author may not be used to endorse or promote products
mbedalvaro 0:f76708a93fb3 14 * derived from this software without specific prior written permission.
mbedalvaro 0:f76708a93fb3 15 *
mbedalvaro 0:f76708a93fb3 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
mbedalvaro 0:f76708a93fb3 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mbedalvaro 0:f76708a93fb3 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
mbedalvaro 0:f76708a93fb3 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
mbedalvaro 0:f76708a93fb3 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
mbedalvaro 0:f76708a93fb3 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mbedalvaro 0:f76708a93fb3 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mbedalvaro 0:f76708a93fb3 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
mbedalvaro 0:f76708a93fb3 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
mbedalvaro 0:f76708a93fb3 25 * OF SUCH DAMAGE.
mbedalvaro 0:f76708a93fb3 26 *
mbedalvaro 0:f76708a93fb3 27 * This file is part of the lwIP TCP/IP stack.
mbedalvaro 0:f76708a93fb3 28 *
mbedalvaro 0:f76708a93fb3 29 * Author: Adam Dunkels <adam@sics.se>
mbedalvaro 0:f76708a93fb3 30 *
mbedalvaro 0:f76708a93fb3 31 */
mbedalvaro 0:f76708a93fb3 32 #ifndef __LWIP_ICMP_H__
mbedalvaro 0:f76708a93fb3 33 #define __LWIP_ICMP_H__
mbedalvaro 0:f76708a93fb3 34
mbedalvaro 0:f76708a93fb3 35 #include "lwip/opt.h"
mbedalvaro 0:f76708a93fb3 36 #include "lwip/pbuf.h"
mbedalvaro 0:f76708a93fb3 37 #include "lwip/ip_addr.h"
mbedalvaro 0:f76708a93fb3 38 #include "lwip/netif.h"
mbedalvaro 0:f76708a93fb3 39
mbedalvaro 0:f76708a93fb3 40 #ifdef __cplusplus
mbedalvaro 0:f76708a93fb3 41 extern "C" {
mbedalvaro 0:f76708a93fb3 42 #endif
mbedalvaro 0:f76708a93fb3 43
mbedalvaro 0:f76708a93fb3 44 #define ICMP_ER 0 /* echo reply */
mbedalvaro 0:f76708a93fb3 45 #define ICMP_DUR 3 /* destination unreachable */
mbedalvaro 0:f76708a93fb3 46 #define ICMP_SQ 4 /* source quench */
mbedalvaro 0:f76708a93fb3 47 #define ICMP_RD 5 /* redirect */
mbedalvaro 0:f76708a93fb3 48 #define ICMP_ECHO 8 /* echo */
mbedalvaro 0:f76708a93fb3 49 #define ICMP_TE 11 /* time exceeded */
mbedalvaro 0:f76708a93fb3 50 #define ICMP_PP 12 /* parameter problem */
mbedalvaro 0:f76708a93fb3 51 #define ICMP_TS 13 /* timestamp */
mbedalvaro 0:f76708a93fb3 52 #define ICMP_TSR 14 /* timestamp reply */
mbedalvaro 0:f76708a93fb3 53 #define ICMP_IRQ 15 /* information request */
mbedalvaro 0:f76708a93fb3 54 #define ICMP_IR 16 /* information reply */
mbedalvaro 0:f76708a93fb3 55
mbedalvaro 0:f76708a93fb3 56 enum icmp_dur_type {
mbedalvaro 0:f76708a93fb3 57 ICMP_DUR_NET = 0, /* net unreachable */
mbedalvaro 0:f76708a93fb3 58 ICMP_DUR_HOST = 1, /* host unreachable */
mbedalvaro 0:f76708a93fb3 59 ICMP_DUR_PROTO = 2, /* protocol unreachable */
mbedalvaro 0:f76708a93fb3 60 ICMP_DUR_PORT = 3, /* port unreachable */
mbedalvaro 0:f76708a93fb3 61 ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */
mbedalvaro 0:f76708a93fb3 62 ICMP_DUR_SR = 5 /* source route failed */
mbedalvaro 0:f76708a93fb3 63 };
mbedalvaro 0:f76708a93fb3 64
mbedalvaro 0:f76708a93fb3 65 enum icmp_te_type {
mbedalvaro 0:f76708a93fb3 66 ICMP_TE_TTL = 0, /* time to live exceeded in transit */
mbedalvaro 0:f76708a93fb3 67 ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */
mbedalvaro 0:f76708a93fb3 68 };
mbedalvaro 0:f76708a93fb3 69
mbedalvaro 0:f76708a93fb3 70 #ifdef PACK_STRUCT_USE_INCLUDES
mbedalvaro 0:f76708a93fb3 71 # include "arch/bpstruct.h"
mbedalvaro 0:f76708a93fb3 72 #endif
mbedalvaro 0:f76708a93fb3 73 /* This is the standard ICMP header only that the u32_t data
mbedalvaro 0:f76708a93fb3 74 * is splitted to two u16_t like ICMP echo needs it.
mbedalvaro 0:f76708a93fb3 75 * This header is also used for other ICMP types that do not
mbedalvaro 0:f76708a93fb3 76 * use the data part.
mbedalvaro 0:f76708a93fb3 77 */
mbedalvaro 0:f76708a93fb3 78 PACK_STRUCT_BEGIN
mbedalvaro 0:f76708a93fb3 79 struct icmp_echo_hdr {
mbedalvaro 0:f76708a93fb3 80 PACK_STRUCT_FIELD(u8_t type);
mbedalvaro 0:f76708a93fb3 81 PACK_STRUCT_FIELD(u8_t code);
mbedalvaro 0:f76708a93fb3 82 PACK_STRUCT_FIELD(u16_t chksum);
mbedalvaro 0:f76708a93fb3 83 PACK_STRUCT_FIELD(u16_t id);
mbedalvaro 0:f76708a93fb3 84 PACK_STRUCT_FIELD(u16_t seqno);
mbedalvaro 0:f76708a93fb3 85 } PACK_STRUCT_STRUCT;
mbedalvaro 0:f76708a93fb3 86 PACK_STRUCT_END
mbedalvaro 0:f76708a93fb3 87 #ifdef PACK_STRUCT_USE_INCLUDES
mbedalvaro 0:f76708a93fb3 88 # include "arch/epstruct.h"
mbedalvaro 0:f76708a93fb3 89 #endif
mbedalvaro 0:f76708a93fb3 90
mbedalvaro 0:f76708a93fb3 91 #define ICMPH_TYPE(hdr) ((hdr)->type)
mbedalvaro 0:f76708a93fb3 92 #define ICMPH_CODE(hdr) ((hdr)->code)
mbedalvaro 0:f76708a93fb3 93
mbedalvaro 0:f76708a93fb3 94 /* Combines type and code to an u16_t */
mbedalvaro 0:f76708a93fb3 95 #define ICMPH_TYPE_SET(hdr, t) ((hdr)->type = (t))
mbedalvaro 0:f76708a93fb3 96 #define ICMPH_CODE_SET(hdr, c) ((hdr)->code = (c))
mbedalvaro 0:f76708a93fb3 97
mbedalvaro 0:f76708a93fb3 98
mbedalvaro 0:f76708a93fb3 99 #if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */
mbedalvaro 0:f76708a93fb3 100
mbedalvaro 0:f76708a93fb3 101 void icmp_input(struct pbuf *p, struct netif *inp);
mbedalvaro 0:f76708a93fb3 102 void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t);
mbedalvaro 0:f76708a93fb3 103 void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t);
mbedalvaro 0:f76708a93fb3 104
mbedalvaro 0:f76708a93fb3 105 #endif /* LWIP_ICMP */
mbedalvaro 0:f76708a93fb3 106
mbedalvaro 0:f76708a93fb3 107 #ifdef __cplusplus
mbedalvaro 0:f76708a93fb3 108 }
mbedalvaro 0:f76708a93fb3 109 #endif
mbedalvaro 0:f76708a93fb3 110
mbedalvaro 0:f76708a93fb3 111 #endif /* __LWIP_ICMP_H__ */