2010-08-02 20:59:44 +02:00
|
|
|
#ifndef ethernet_h
|
|
|
|
#define ethernet_h
|
2008-07-30 16:47:36 +02:00
|
|
|
|
|
|
|
#include <inttypes.h>
|
2010-08-02 20:59:44 +02:00
|
|
|
//#include "w5100.h"
|
2011-01-16 21:11:50 +01:00
|
|
|
#include "IPAddress.h"
|
2011-08-29 23:36:28 +02:00
|
|
|
#include "EthernetClient.h"
|
|
|
|
#include "EthernetServer.h"
|
2010-08-02 20:59:44 +02:00
|
|
|
|
|
|
|
#define MAX_SOCK_NUM 4
|
2008-07-30 16:47:36 +02:00
|
|
|
|
|
|
|
class EthernetClass {
|
|
|
|
private:
|
2011-01-16 21:11:50 +01:00
|
|
|
IPAddress _dnsServerAddress;
|
2008-07-30 16:47:36 +02:00
|
|
|
public:
|
|
|
|
static uint8_t _state[MAX_SOCK_NUM];
|
|
|
|
static uint16_t _server_port[MAX_SOCK_NUM];
|
2011-01-16 21:11:50 +01:00
|
|
|
// Initialise the Ethernet shield to use the provided MAC address and gain the rest of the
|
|
|
|
// configuration through DHCP.
|
|
|
|
// Returns 0 if the DHCP configuration failed, and 1 if it succeeded
|
|
|
|
int begin(uint8_t *mac_address);
|
|
|
|
void begin(uint8_t *mac_address, IPAddress local_ip);
|
2011-06-12 23:02:25 +02:00
|
|
|
void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server);
|
|
|
|
void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway);
|
|
|
|
void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet);
|
2011-01-16 21:11:50 +01:00
|
|
|
|
|
|
|
IPAddress localIP();
|
|
|
|
IPAddress subnetMask();
|
|
|
|
IPAddress gatewayIP();
|
|
|
|
IPAddress dnsServerIP();
|
|
|
|
|
2011-08-29 23:36:28 +02:00
|
|
|
friend class EthernetClient;
|
|
|
|
friend class EthernetServer;
|
2008-07-30 16:47:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern EthernetClass Ethernet;
|
|
|
|
|
|
|
|
#endif
|