IPAddress

From chipKIT
Jump to: navigation, search
IPAddress
Quick Look
Hardware WF32 or Wi-Fire
Include IPAddress.h


The IPAdress class is a chipKIT core base class.

Detailed Introduction

The IPAddress class represents an IP Address and provides multiple constuctors and conversion operators to make it easier to handle and pass around IP addresses.


Full library usage

IPAddress


Constructors


IPAddress()

IPAddress();

IPAddress(uint32_t address)

IPAddress(uint32_t address);

IPAddress(const uint8_t *address)

IPAddress(const uint8_t *address);

IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)

IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet);


Virtual Public Functions


printTo(Print& p)

virtual size_t printTo(Print& p) const;

Base class printTo function.


Conversion Operators


uint32_t()

operator uint32_t() const { return _address.dword; };

Overloaded cast operator to allow IPAddress objects to be used where a pointer to a four-byte uint8_t array is expected

==

bool operator==(const uint8_t* addr) const;
bool operator==(const IPAddress& addr) const { return _address.dword == addr._address.dword; };

Overloaded cast operator to allow IPAddress objects to be used where a pointer to a four-byte uint8_t array is expected


[]

uint8_t operator[](int index) const { return _address.bytes[index]; };
uint8_t& operator[](int index) { return _address.bytes[index]; };

Overloaded index operator to allow getting and setting individual octets of the address

=

IPAddress& operator=(const uint8_t *address);
IPAddress& operator=(uint32_t address);

Overloaded copy operators to allow initialisation of IPAddress objects from other types

External Links