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