dev

Dependents:   EthernetInterface

Fork of lwip by mbed official

Committer:
mbed_official
Date:
Fri Jun 22 09:25:39 2012 +0000
Revision:
0:51ac1d130fd4
Initial import from lwip-1.4.0: http://download.savannah.gnu.org/releases/lwip/lwip-1.4.0.zip

Who changed what in which revision?

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