Experimental HTTPClient with proxy support

Committer:
igorsk
Date:
Wed Jun 29 16:01:58 2011 +0000
Revision:
0:b56b6a05cad4

        

Who changed what in which revision?

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