|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
-
-
- #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 _address[0] | (_address[1] << 8)
- | (_address[2] << 16) | (_address[3] << 24); }
- bool operator==(const IPAddress& addr) { return _address[0] == addr._address[0]
- && _address[1] == addr._address[1]
- && _address[2] == addr._address[2]
- && _address[3] == addr._address[3]; }
- 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
|