not sure why I have to do this

Dependencies:   Socket lwip-eth lwip-sys lwip

Dependents:   IoT IoT_Security_Ethernet IoT_V3

Fork of EthernetInterface by ECE4180

Committer:
emilmont
Date:
Mon Jul 23 11:53:01 2012 +0000
Revision:
14:cec293071eed
Parent:
4:9a52c802be61
Child:
15:fd9597f1b81b
tidyup

Who changed what in which revision?

UserRevisionLine numberNew contents of line
donatien 3:f5776537f27f 1 /* EthernetInterface.h */
donatien 3:f5776537f27f 2 /* Copyright (C) 2012 mbed.org, MIT License
donatien 3:f5776537f27f 3 *
donatien 3:f5776537f27f 4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
donatien 3:f5776537f27f 5 * and associated documentation files (the "Software"), to deal in the Software without restriction,
donatien 3:f5776537f27f 6 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
donatien 3:f5776537f27f 7 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
donatien 3:f5776537f27f 8 * furnished to do so, subject to the following conditions:
donatien 3:f5776537f27f 9 *
donatien 3:f5776537f27f 10 * The above copyright notice and this permission notice shall be included in all copies or
donatien 3:f5776537f27f 11 * substantial portions of the Software.
donatien 3:f5776537f27f 12 *
donatien 3:f5776537f27f 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
donatien 3:f5776537f27f 14 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
donatien 3:f5776537f27f 15 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
donatien 3:f5776537f27f 16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
donatien 3:f5776537f27f 17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
donatien 3:f5776537f27f 18 */
donatien 3:f5776537f27f 19
donatien 3:f5776537f27f 20 #ifndef ETHERNETINTERFACE_H_
donatien 3:f5776537f27f 21 #define ETHERNETINTERFACE_H_
donatien 3:f5776537f27f 22
donatien 3:f5776537f27f 23 #include "rtos.h"
donatien 3:f5776537f27f 24 #include "lwip/netif.h"
donatien 3:f5776537f27f 25
donatien 4:9a52c802be61 26 /** Interface using Ethernet to connect to an IP-based network
donatien 3:f5776537f27f 27 *
donatien 3:f5776537f27f 28 */
emilmont 14:cec293071eed 29 class EthernetInterface {
donatien 3:f5776537f27f 30 public:
donatien 4:9a52c802be61 31 /** Initialize the interface with DHCP.
donatien 4:9a52c802be61 32 * Initialize the interface and configure it to use DHCP (no connection at this point).
donatien 4:9a52c802be61 33 * \return 0 on success, a negative number on failure
donatien 4:9a52c802be61 34 */
emilmont 14:cec293071eed 35 static int init(); //With DHCP
donatien 3:f5776537f27f 36
donatien 4:9a52c802be61 37 /** Initialize the interface with a static IP address.
donatien 4:9a52c802be61 38 * Initialize the interface and configure it with the following static configuration (no connection at this point).
donatien 4:9a52c802be61 39 * \param ip the IP address to use
donatien 4:9a52c802be61 40 * \param mask the IP address mask
donatien 4:9a52c802be61 41 * \param gateway the gateway to use
donatien 4:9a52c802be61 42 * \return 0 on success, a negative number on failure
donatien 4:9a52c802be61 43 */
emilmont 14:cec293071eed 44 static int init(const char* ip, const char* mask, const char* gateway);
donatien 3:f5776537f27f 45
donatien 4:9a52c802be61 46 /** Connect
donatien 4:9a52c802be61 47 * Bring the interface up, start DHCP if needed.
donatien 4:9a52c802be61 48 * \return 0 on success, a negative number on failure
donatien 4:9a52c802be61 49 */
emilmont 14:cec293071eed 50 static int connect();
donatien 4:9a52c802be61 51
donatien 4:9a52c802be61 52 /** Disconnect
donatien 4:9a52c802be61 53 * Bring the interface down
donatien 4:9a52c802be61 54 * \return 0 on success, a negative number on failure
donatien 4:9a52c802be61 55 */
emilmont 14:cec293071eed 56 static int disconnect();
donatien 3:f5776537f27f 57
emilmont 14:cec293071eed 58 static char* getIPAddress();
donatien 3:f5776537f27f 59 };
donatien 3:f5776537f27f 60
donatien 3:f5776537f27f 61 //As a helper, include TCPSocket.h & UDPSocket.h here
donatien 3:f5776537f27f 62 #include "TCPSocket.h"
donatien 3:f5776537f27f 63 #include "UDPSocket.h"
donatien 3:f5776537f27f 64
donatien 3:f5776537f27f 65 #endif /* ETHERNETINTERFACE_H_ */