Ethernet Network Library

Dependencies:   NetworkingCoreLib

Dependents:   EthernetHTTPClientTest

Committer:
donatien
Date:
Fri May 25 08:58:41 2012 +0000
Revision:
3:89685182416b
Parent:
0:7b5b0d3a55d5
Core lib up

Who changed what in which revision?

UserRevisionLine numberNew contents of line
donatien 0:7b5b0d3a55d5 1 /* EthernetNetwork.h */
donatien 0:7b5b0d3a55d5 2 /*
donatien 0:7b5b0d3a55d5 3 Copyright (C) 2012 ARM Limited.
donatien 0:7b5b0d3a55d5 4
donatien 0:7b5b0d3a55d5 5 Permission is hereby granted, free of charge, to any person obtaining a copy of
donatien 0:7b5b0d3a55d5 6 this software and associated documentation files (the "Software"), to deal in
donatien 0:7b5b0d3a55d5 7 the Software without restriction, including without limitation the rights to
donatien 0:7b5b0d3a55d5 8 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
donatien 0:7b5b0d3a55d5 9 of the Software, and to permit persons to whom the Software is furnished to do
donatien 0:7b5b0d3a55d5 10 so, subject to the following conditions:
donatien 0:7b5b0d3a55d5 11
donatien 0:7b5b0d3a55d5 12 The above copyright notice and this permission notice shall be included in all
donatien 0:7b5b0d3a55d5 13 copies or substantial portions of the Software.
donatien 0:7b5b0d3a55d5 14
donatien 0:7b5b0d3a55d5 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
donatien 0:7b5b0d3a55d5 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
donatien 0:7b5b0d3a55d5 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
donatien 0:7b5b0d3a55d5 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
donatien 0:7b5b0d3a55d5 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
donatien 0:7b5b0d3a55d5 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
donatien 0:7b5b0d3a55d5 21 SOFTWARE.
donatien 0:7b5b0d3a55d5 22 */
donatien 0:7b5b0d3a55d5 23
donatien 0:7b5b0d3a55d5 24 #ifndef ETHERNETNETWORK_H_
donatien 0:7b5b0d3a55d5 25 #define ETHERNETNETWORK_H_
donatien 0:7b5b0d3a55d5 26
donatien 0:7b5b0d3a55d5 27
donatien 0:7b5b0d3a55d5 28 #include "core/fwk.h"
donatien 0:7b5b0d3a55d5 29
donatien 0:7b5b0d3a55d5 30 #include "rtos.h"
donatien 0:7b5b0d3a55d5 31
donatien 0:7b5b0d3a55d5 32 #include "LwIPInterface.h"
donatien 0:7b5b0d3a55d5 33
donatien 0:7b5b0d3a55d5 34 #include "lwip/netif.h"
donatien 0:7b5b0d3a55d5 35
donatien 0:7b5b0d3a55d5 36 /** Interface using Ethernet to connect to an IP-based network
donatien 0:7b5b0d3a55d5 37 *
donatien 0:7b5b0d3a55d5 38 */
donatien 0:7b5b0d3a55d5 39 class EthernetNetwork : public LwIPInterface
donatien 0:7b5b0d3a55d5 40 {
donatien 0:7b5b0d3a55d5 41 public:
donatien 0:7b5b0d3a55d5 42 EthernetNetwork();
donatien 0:7b5b0d3a55d5 43
donatien 0:7b5b0d3a55d5 44 int init(); //With DHCP
donatien 0:7b5b0d3a55d5 45
donatien 0:7b5b0d3a55d5 46 int init(const char* ip, const char* mask, const char* gateway, const char* dns1, const char* dns2); //No DHCP
donatien 0:7b5b0d3a55d5 47
donatien 0:7b5b0d3a55d5 48 virtual int connect();
donatien 0:7b5b0d3a55d5 49 virtual int disconnect();
donatien 0:7b5b0d3a55d5 50
donatien 0:7b5b0d3a55d5 51 private:
donatien 0:7b5b0d3a55d5 52 static void phySupervisorCb(void const* ctx);
donatien 0:7b5b0d3a55d5 53
donatien 0:7b5b0d3a55d5 54 RtosTimer m_supervisor;
donatien 0:7b5b0d3a55d5 55 struct netif m_lpcNetif;
donatien 0:7b5b0d3a55d5 56 bool m_useDHCP;
donatien 0:7b5b0d3a55d5 57 bool m_linkUp;
donatien 0:7b5b0d3a55d5 58 };
donatien 0:7b5b0d3a55d5 59
donatien 0:7b5b0d3a55d5 60 #endif /* ETHERNETNETWORK_H_ */