chipKIT® Development Platform

Inspired by Arduino™

Last edit: 2021-03-21 22:34 by Majenko

IPAddress

IPAddress
Quick Look
Hardware WF32 or Wi-Fire
Include IPAddress.h

The IPAdress class is a chipKIT core base class.

  1. Detailed Introduction

  2. Full library usage

    1. IPAddress

      1. Constructors

        1. IPAddress()

        2. IPAddress(uint32_t address)

        3. IPAddress(const uint8_t *address)

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

      2. Virtual Public Functions

        1. printTo(Print& p)

      3. Conversion Operators

        1. uint32_t()

        2. ==

        3. [ ]

        4. =

  3. External Links

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