Ethernet Interface Networking Library

Dependencies:   LwIPNetworking lwip-eth

Dependents:   CPPSocketsTest

Fork of EthernetNetworkLib by Donatien Garnier

Committer:
donatien
Date:
Fri Jun 22 16:18:28 2012 +0000
Revision:
11:1463ea588862
Parent:
10:7336d3d9cf64
DebugLib up

Who changed what in which revision?

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