Netservices modded to read fragmented HTTP respsonse/payload from special purpose server - 180 bytes only

Committer:
RodColeman
Date:
Thu Sep 08 10:41:36 2011 +0000
Revision:
0:8f5825f330b0
setDataLen hacked to 180bytes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RodColeman 0:8f5825f330b0 1
RodColeman 0:8f5825f330b0 2 /*
RodColeman 0:8f5825f330b0 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
RodColeman 0:8f5825f330b0 4
RodColeman 0:8f5825f330b0 5 Permission is hereby granted, free of charge, to any person obtaining a copy
RodColeman 0:8f5825f330b0 6 of this software and associated documentation files (the "Software"), to deal
RodColeman 0:8f5825f330b0 7 in the Software without restriction, including without limitation the rights
RodColeman 0:8f5825f330b0 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
RodColeman 0:8f5825f330b0 9 copies of the Software, and to permit persons to whom the Software is
RodColeman 0:8f5825f330b0 10 furnished to do so, subject to the following conditions:
RodColeman 0:8f5825f330b0 11
RodColeman 0:8f5825f330b0 12 The above copyright notice and this permission notice shall be included in
RodColeman 0:8f5825f330b0 13 all copies or substantial portions of the Software.
RodColeman 0:8f5825f330b0 14
RodColeman 0:8f5825f330b0 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
RodColeman 0:8f5825f330b0 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
RodColeman 0:8f5825f330b0 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
RodColeman 0:8f5825f330b0 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
RodColeman 0:8f5825f330b0 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
RodColeman 0:8f5825f330b0 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
RodColeman 0:8f5825f330b0 21 THE SOFTWARE.
RodColeman 0:8f5825f330b0 22 */
RodColeman 0:8f5825f330b0 23
RodColeman 0:8f5825f330b0 24 /** \file
RodColeman 0:8f5825f330b0 25 Ethernet network interface header file
RodColeman 0:8f5825f330b0 26 */
RodColeman 0:8f5825f330b0 27
RodColeman 0:8f5825f330b0 28 #ifndef ETHERNETNETIF_H
RodColeman 0:8f5825f330b0 29 #define ETHERNETNETIF_H
RodColeman 0:8f5825f330b0 30
RodColeman 0:8f5825f330b0 31 struct netif;
RodColeman 0:8f5825f330b0 32
RodColeman 0:8f5825f330b0 33 #include "mbed.h"
RodColeman 0:8f5825f330b0 34
RodColeman 0:8f5825f330b0 35 #include "if/lwip/LwipNetIf.h"
RodColeman 0:8f5825f330b0 36 #include "lwip/dhcp.h"
RodColeman 0:8f5825f330b0 37
RodColeman 0:8f5825f330b0 38 ///Ethernet network interface return codes
RodColeman 0:8f5825f330b0 39 enum EthernetErr
RodColeman 0:8f5825f330b0 40 {
RodColeman 0:8f5825f330b0 41 __ETH_MIN = -0xFFFF,
RodColeman 0:8f5825f330b0 42 ETH_TIMEOUT, ///<Timeout during setup
RodColeman 0:8f5825f330b0 43 ETH_OK = 0 ///<Success
RodColeman 0:8f5825f330b0 44 };
RodColeman 0:8f5825f330b0 45
RodColeman 0:8f5825f330b0 46 ///Ethernet network interface
RodColeman 0:8f5825f330b0 47 /**
RodColeman 0:8f5825f330b0 48 This class provides Ethernet connectivity to the stack
RodColeman 0:8f5825f330b0 49 */
RodColeman 0:8f5825f330b0 50 class EthernetNetIf : public LwipNetIf
RodColeman 0:8f5825f330b0 51 {
RodColeman 0:8f5825f330b0 52 public:
RodColeman 0:8f5825f330b0 53 ///Instantiates the Interface and register it against the stack, DHCP will be used
RodColeman 0:8f5825f330b0 54 /**
RodColeman 0:8f5825f330b0 55 * An optional hostname can be specified which will be passed to the DHCP server.
RodColeman 0:8f5825f330b0 56 * Examples without and with hostname specified:
RodColeman 0:8f5825f330b0 57 *
RodColeman 0:8f5825f330b0 58 * @code
RodColeman 0:8f5825f330b0 59 * EthernetNetIf eth();
RodColeman 0:8f5825f330b0 60 * @endcode
RodColeman 0:8f5825f330b0 61 * @code
RodColeman 0:8f5825f330b0 62 * EthernetNetIf eth("mbedSE");
RodColeman 0:8f5825f330b0 63 * @endcode
RodColeman 0:8f5825f330b0 64 */
RodColeman 0:8f5825f330b0 65 EthernetNetIf(const char* hostname = NULL); //W/ DHCP
RodColeman 0:8f5825f330b0 66
RodColeman 0:8f5825f330b0 67 ///Instantiates the Interface and register it against the stack, DHCP will not be used
RodColeman 0:8f5825f330b0 68 /**
RodColeman 0:8f5825f330b0 69 IpAddr is a container class that can be constructed with either 4 bytes or no parameters for a null IP address.
RodColeman 0:8f5825f330b0 70 */
RodColeman 0:8f5825f330b0 71 EthernetNetIf(IpAddr ip, IpAddr netmask, IpAddr gateway, IpAddr dns); //W/o DHCP
RodColeman 0:8f5825f330b0 72 virtual ~EthernetNetIf();
RodColeman 0:8f5825f330b0 73
RodColeman 0:8f5825f330b0 74 ///Brings the interface up
RodColeman 0:8f5825f330b0 75 /**
RodColeman 0:8f5825f330b0 76 Uses DHCP if necessary
RodColeman 0:8f5825f330b0 77 @param timeout_ms : You can set the timeout parameter in milliseconds, if not it defaults to 15s
RodColeman 0:8f5825f330b0 78 @return : ETH_OK on success or ETH_TIMEOUT on timeout
RodColeman 0:8f5825f330b0 79 */
RodColeman 0:8f5825f330b0 80 EthernetErr setup(int timeout_ms = 15000);
RodColeman 0:8f5825f330b0 81
RodColeman 0:8f5825f330b0 82 virtual void poll();
RodColeman 0:8f5825f330b0 83
RodColeman 0:8f5825f330b0 84 ///Returns an array containing the hardware address
RodColeman 0:8f5825f330b0 85 const char* getHwAddr() const;
RodColeman 0:8f5825f330b0 86
RodColeman 0:8f5825f330b0 87 ///Returns a pointer to the hostname set in the constructor
RodColeman 0:8f5825f330b0 88 const char* getHostname() const;
RodColeman 0:8f5825f330b0 89
RodColeman 0:8f5825f330b0 90 private:
RodColeman 0:8f5825f330b0 91 Timer m_ethArpTimer;
RodColeman 0:8f5825f330b0 92 Timer m_dhcpCoarseTimer;
RodColeman 0:8f5825f330b0 93 Timer m_dhcpFineTimer;
RodColeman 0:8f5825f330b0 94 Timer m_igmpTimer;
RodColeman 0:8f5825f330b0 95
RodColeman 0:8f5825f330b0 96 bool m_useDhcp;
RodColeman 0:8f5825f330b0 97
RodColeman 0:8f5825f330b0 98 netif* m_pNetIf;
RodColeman 0:8f5825f330b0 99
RodColeman 0:8f5825f330b0 100 IpAddr m_netmask;
RodColeman 0:8f5825f330b0 101 IpAddr m_gateway;
RodColeman 0:8f5825f330b0 102
RodColeman 0:8f5825f330b0 103 const char* m_hostname;
RodColeman 0:8f5825f330b0 104 dhcp* m_pDhcp;
RodColeman 0:8f5825f330b0 105 bool m_setup;
RodColeman 0:8f5825f330b0 106 };
RodColeman 0:8f5825f330b0 107
RodColeman 0:8f5825f330b0 108 #endif
RodColeman 0:8f5825f330b0 109