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-03-24 04:28:33 +01:00
|
|
|
#include "IPAddress.h"
|
2010-08-03 15:36:47 +02:00
|
|
|
#include "Client.h"
|
|
|
|
#include "Server.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-03-24 04:28:33 +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-03-24 04:28:33 +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);
|
|
|
|
void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress gateway);
|
|
|
|
void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress gateway, IPAddress subnet);
|
|
|
|
|
|
|
|
IPAddress localIP();
|
|
|
|
IPAddress subnetMask();
|
|
|
|
IPAddress gatewayIP();
|
|
|
|
IPAddress dnsServerIP();
|
|
|
|
|
2008-07-30 16:47:36 +02:00
|
|
|
friend class Client;
|
|
|
|
friend class Server;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern EthernetClass Ethernet;
|
|
|
|
|
|
|
|
#endif
|