Ethernetwebsoc

Dependencies:   C12832_lcd LM75B WebSocketClient mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Committer:
GordonSin
Date:
Fri May 31 04:09:54 2013 +0000
Revision:
0:0ed2a7c7190c
31/5/2013;

Who changed what in which revision?

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