|
-
-
- #if ARDUINO >= 100
- #ifndef IPAddress_h
- #define IPAddress_h
-
- #include <Printable.h>
-
-
-
- class IPAddress : public Printable {
- private:
- uint8_t _address[4];
-
-
-
-
- uint8_t* raw_address() { return _address; };
-
- public:
-
- IPAddress();
- IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet);
- IPAddress(uint32_t address);
- IPAddress(const uint8_t *address);
-
-
-
- operator uint32_t() { return *((uint32_t*)_address); };
- bool operator==(const IPAddress& addr) { return (*((uint32_t*)_address)) == (*((uint32_t*)addr._address)); };
- bool operator==(const uint8_t* addr);
-
-
- uint8_t operator[](int index) const { return _address[index]; };
- uint8_t& operator[](int index) { return _address[index]; };
-
-
- IPAddress& operator=(const uint8_t *address);
- IPAddress& operator=(uint32_t address);
-
- virtual size_t printTo(Print& p) const;
-
- friend class EthernetClass;
- friend class UDP;
- friend class Client;
- friend class Server;
- friend class DhcpClass;
- friend class DNSClient;
- };
-
- const IPAddress INADDR_NONE(0,0,0,0);
-
-
- #endif
- #endif
|