LwIP with PPP & Ethernet integration

Dependents:   NetworkingCoreLib

This is the mbed port of the LwIP stack: http://savannah.nongnu.org/projects/lwip/

It includes contributed content from NXP's port for LPCxxxx devices: http://www.lpcware.com/content/project/lightweight-ip-lwip-networking-stack

Licence

LwIP is licenced under the BSD licence:

Copyright (c) 2001-2004 Swedish Institute of Computer Science. 
All rights reserved. 
Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met: 
1. Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer. 
2. Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation 
and/or other materials provided with the distribution. 
3. The name of the author may not be used to endorse or promote products 
derived from this software without specific prior written permission. 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.
Committer:
donatien
Date:
Fri May 25 08:56:35 2012 +0000
Revision:
2:1a87f74b8e3b
Parent:
0:8e01dca41002
Removed compilation of EMAC driver when using PPP

Who changed what in which revision?

UserRevisionLine numberNew contents of line
donatien 0:8e01dca41002 1 /*
donatien 0:8e01dca41002 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
donatien 0:8e01dca41002 3 * All rights reserved.
donatien 0:8e01dca41002 4 *
donatien 0:8e01dca41002 5 * Redistribution and use in source and binary forms, with or without modification,
donatien 0:8e01dca41002 6 * are permitted provided that the following conditions are met:
donatien 0:8e01dca41002 7 *
donatien 0:8e01dca41002 8 * 1. Redistributions of source code must retain the above copyright notice,
donatien 0:8e01dca41002 9 * this list of conditions and the following disclaimer.
donatien 0:8e01dca41002 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
donatien 0:8e01dca41002 11 * this list of conditions and the following disclaimer in the documentation
donatien 0:8e01dca41002 12 * and/or other materials provided with the distribution.
donatien 0:8e01dca41002 13 * 3. The name of the author may not be used to endorse or promote products
donatien 0:8e01dca41002 14 * derived from this software without specific prior written permission.
donatien 0:8e01dca41002 15 *
donatien 0:8e01dca41002 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
donatien 0:8e01dca41002 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
donatien 0:8e01dca41002 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
donatien 0:8e01dca41002 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
donatien 0:8e01dca41002 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
donatien 0:8e01dca41002 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
donatien 0:8e01dca41002 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
donatien 0:8e01dca41002 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
donatien 0:8e01dca41002 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
donatien 0:8e01dca41002 25 * OF SUCH DAMAGE.
donatien 0:8e01dca41002 26 *
donatien 0:8e01dca41002 27 * This file is part of the lwIP TCP/IP stack.
donatien 0:8e01dca41002 28 */
donatien 0:8e01dca41002 29
donatien 0:8e01dca41002 30 /*
donatien 0:8e01dca41002 31 * This is the interface to the platform specific serial IO module
donatien 0:8e01dca41002 32 * It needs to be implemented by those platforms which need SLIP or PPP
donatien 0:8e01dca41002 33 */
donatien 0:8e01dca41002 34
donatien 0:8e01dca41002 35 #ifndef __SIO_H__
donatien 0:8e01dca41002 36 #define __SIO_H__
donatien 0:8e01dca41002 37
donatien 0:8e01dca41002 38 #include "lwip/arch.h"
donatien 0:8e01dca41002 39
donatien 0:8e01dca41002 40 #ifdef __cplusplus
donatien 0:8e01dca41002 41 extern "C" {
donatien 0:8e01dca41002 42 #endif
donatien 0:8e01dca41002 43
donatien 0:8e01dca41002 44 /* If you want to define sio_fd_t elsewhere or differently,
donatien 0:8e01dca41002 45 define this in your cc.h file. */
donatien 0:8e01dca41002 46 #ifndef __sio_fd_t_defined
donatien 0:8e01dca41002 47 typedef void * sio_fd_t;
donatien 0:8e01dca41002 48 #endif
donatien 0:8e01dca41002 49
donatien 0:8e01dca41002 50 /* The following functions can be defined to something else in your cc.h file
donatien 0:8e01dca41002 51 or be implemented in your custom sio.c file. */
donatien 0:8e01dca41002 52
donatien 0:8e01dca41002 53 #ifndef sio_open
donatien 0:8e01dca41002 54 /**
donatien 0:8e01dca41002 55 * Opens a serial device for communication.
donatien 0:8e01dca41002 56 *
donatien 0:8e01dca41002 57 * @param devnum device number
donatien 0:8e01dca41002 58 * @return handle to serial device if successful, NULL otherwise
donatien 0:8e01dca41002 59 */
donatien 0:8e01dca41002 60 sio_fd_t sio_open(u8_t devnum);
donatien 0:8e01dca41002 61 #endif
donatien 0:8e01dca41002 62
donatien 0:8e01dca41002 63 #ifndef sio_send
donatien 0:8e01dca41002 64 /**
donatien 0:8e01dca41002 65 * Sends a single character to the serial device.
donatien 0:8e01dca41002 66 *
donatien 0:8e01dca41002 67 * @param c character to send
donatien 0:8e01dca41002 68 * @param fd serial device handle
donatien 0:8e01dca41002 69 *
donatien 0:8e01dca41002 70 * @note This function will block until the character can be sent.
donatien 0:8e01dca41002 71 */
donatien 0:8e01dca41002 72 void sio_send(u8_t c, sio_fd_t fd);
donatien 0:8e01dca41002 73 #endif
donatien 0:8e01dca41002 74
donatien 0:8e01dca41002 75 #ifndef sio_recv
donatien 0:8e01dca41002 76 /**
donatien 0:8e01dca41002 77 * Receives a single character from the serial device.
donatien 0:8e01dca41002 78 *
donatien 0:8e01dca41002 79 * @param fd serial device handle
donatien 0:8e01dca41002 80 *
donatien 0:8e01dca41002 81 * @note This function will block until a character is received.
donatien 0:8e01dca41002 82 */
donatien 0:8e01dca41002 83 u8_t sio_recv(sio_fd_t fd);
donatien 0:8e01dca41002 84 #endif
donatien 0:8e01dca41002 85
donatien 0:8e01dca41002 86 #ifndef sio_read
donatien 0:8e01dca41002 87 /**
donatien 0:8e01dca41002 88 * Reads from the serial device.
donatien 0:8e01dca41002 89 *
donatien 0:8e01dca41002 90 * @param fd serial device handle
donatien 0:8e01dca41002 91 * @param data pointer to data buffer for receiving
donatien 0:8e01dca41002 92 * @param len maximum length (in bytes) of data to receive
donatien 0:8e01dca41002 93 * @return number of bytes actually received - may be 0 if aborted by sio_read_abort
donatien 0:8e01dca41002 94 *
donatien 0:8e01dca41002 95 * @note This function will block until data can be received. The blocking
donatien 0:8e01dca41002 96 * can be cancelled by calling sio_read_abort().
donatien 0:8e01dca41002 97 */
donatien 0:8e01dca41002 98 u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len);
donatien 0:8e01dca41002 99 #endif
donatien 0:8e01dca41002 100
donatien 0:8e01dca41002 101 #ifndef sio_tryread
donatien 0:8e01dca41002 102 /**
donatien 0:8e01dca41002 103 * Tries to read from the serial device. Same as sio_read but returns
donatien 0:8e01dca41002 104 * immediately if no data is available and never blocks.
donatien 0:8e01dca41002 105 *
donatien 0:8e01dca41002 106 * @param fd serial device handle
donatien 0:8e01dca41002 107 * @param data pointer to data buffer for receiving
donatien 0:8e01dca41002 108 * @param len maximum length (in bytes) of data to receive
donatien 0:8e01dca41002 109 * @return number of bytes actually received
donatien 0:8e01dca41002 110 */
donatien 0:8e01dca41002 111 u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len);
donatien 0:8e01dca41002 112 #endif
donatien 0:8e01dca41002 113
donatien 0:8e01dca41002 114 #ifndef sio_write
donatien 0:8e01dca41002 115 /**
donatien 0:8e01dca41002 116 * Writes to the serial device.
donatien 0:8e01dca41002 117 *
donatien 0:8e01dca41002 118 * @param fd serial device handle
donatien 0:8e01dca41002 119 * @param data pointer to data to send
donatien 0:8e01dca41002 120 * @param len length (in bytes) of data to send
donatien 0:8e01dca41002 121 * @return number of bytes actually sent
donatien 0:8e01dca41002 122 *
donatien 0:8e01dca41002 123 * @note This function will block until all data can be sent.
donatien 0:8e01dca41002 124 */
donatien 0:8e01dca41002 125 u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len);
donatien 0:8e01dca41002 126 #endif
donatien 0:8e01dca41002 127
donatien 0:8e01dca41002 128 #ifndef sio_read_abort
donatien 0:8e01dca41002 129 /**
donatien 0:8e01dca41002 130 * Aborts a blocking sio_read() call.
donatien 0:8e01dca41002 131 *
donatien 0:8e01dca41002 132 * @param fd serial device handle
donatien 0:8e01dca41002 133 */
donatien 0:8e01dca41002 134 void sio_read_abort(sio_fd_t fd);
donatien 0:8e01dca41002 135 #endif
donatien 0:8e01dca41002 136
donatien 0:8e01dca41002 137 #ifdef __cplusplus
donatien 0:8e01dca41002 138 }
donatien 0:8e01dca41002 139 #endif
donatien 0:8e01dca41002 140
donatien 0:8e01dca41002 141 #endif /* __SIO_H__ */