Voffcon Esp32 device server
 All Classes Functions
IPAddressList Class Reference

A list to store IP addresses More...

Inheritance diagram for IPAddressList:
LinkedList< IPAddress * >

Public Member Functions

bool add (uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
 Add an ip address by providing four numbers of the IP addres each in the range of 0 - 255 More...
 
bool add (IPAddress address)
 Add an ip address to the list by providing a IP address More...
 
bool add (const char *strIpAddress)
 Add an ip address to the list by providing a string with a valid IP address More...
 
bool exists (IPAddress address)
 Checks if a ip address exists in the list More...
 
bool exists (String strIpaddress)
 Checks if a ip address exists in the list More...
 
int indexOf (IPAddress address)
 Searches for the index of a ip address in the list. More...
 
bool isEmpty ()
 Checks if there are any ip addresses in the list More...
 
bool remove (const char *strIpAddress)
 Removes a given IPAddress from the list More...
 
bool remove (IPAddress address)
 Removes a given IPAddress from the list More...
 
String toJson ()
 Bundles all Ip addresses into a JSON array string More...
 
 ~IPAddressList ()
 The deconstructor, which cleans up when the list is no longer needed. More...
 
- Public Member Functions inherited from LinkedList< IPAddress * >
 LinkedList ()
 The list constructor More...
 
virtual int size ()
 Returns current size of LinkedList More...
 
virtual bool add (int index, IPAddress *)
 Adds a T object in the specified index; Unlinkand link the LinkedList correcly; Increment _size More...
 
virtual bool add (IPAddress *)
 Adds a T object in the end of the LinkedList; Increment _size; More...
 
virtual bool unshift (IPAddress *)
 Adds a T object in the start of the LinkedList; Increment _size; More...
 
virtual bool set (int index, IPAddress *)
 Set the object at index, with T; Increment _size; More...
 
virtual IPAddress * remove (int index)
 Remove object at index; If index is not reachable, returns false; else, decrement _size More...
 
virtual IPAddress * pop ()
 Remove last object; More...
 
virtual IPAddress * shift ()
 Remove first object; More...
 
virtual IPAddress * get (int index)
 Get the index'th element on the list; Return Element if accessible, else, return false; More...
 
virtual void clear ()
 Clear the entire array That is remove all objects from the list and delete them from memory More...
 

Additional Inherited Members

- Protected Member Functions inherited from LinkedList< IPAddress * >
ListNode< IPAddress * > * getNode (int index)
 
- Protected Attributes inherited from LinkedList< IPAddress * >
int _size
 
ListNode< IPAddress * > * root
 
ListNode< IPAddress * > * last
 
ListNode< IPAddress * > * lastNodeGot
 
int lastIndexGot
 
bool isCached
 

Detailed Description

A list to store IP addresses

Constructor & Destructor Documentation

IPAddressList::~IPAddressList ( )

The deconstructor, which cleans up when the list is no longer needed.

Member Function Documentation

bool IPAddressList::add ( uint8_t  first_octet,
uint8_t  second_octet,
uint8_t  third_octet,
uint8_t  fourth_octet 
)

Add an ip address by providing four numbers of the IP addres each in the range of 0 - 255

Parameters
first_octetFirst number of the ip address
second_octetSecond number of the ip address
third_octetThird number of the ip address
fourth_octetFourth number of the ip address
bool IPAddressList::add ( IPAddress  ipAddress)

Add an ip address to the list by providing a IP address

Parameters
ipAddressThe IPAddress object to be added to the list
bool IPAddressList::add ( const char *  strIpAddress)

Add an ip address to the list by providing a string with a valid IP address

Parameters
strIpAddressa string with a valid IP address. The ip address "0.0.0.0" will be considered as an invalid ipaddress
Returns
True if the add succeded, otherwise false
bool IPAddressList::exists ( IPAddress  address)

Checks if a ip address exists in the list

Parameters
addressThe ip address to search for
Returns
True if the add ip address was found in the list, otherwise false.
bool IPAddressList::exists ( String  strIpAddress)

Checks if a ip address exists in the list

Parameters
strIpAddressThe ip address to search for
int IPAddressList::indexOf ( IPAddress  ipAddress)

Searches for the index of a ip address in the list.

Parameters
addressThe ip address to search for.
Returns
Success:The index of the ip address in the list. fail : -1 if string is not found.
bool IPAddressList::isEmpty ( )

Checks if there are any ip addresses in the list

bool IPAddressList::remove ( const char *  strIpAddress)

Removes a given IPAddress from the list

Parameters
strIpAddressA string containing the ipAddress to be removed.
Returns
Success: Returns true if the address was removed. Fail: Returns false if the address was not removed
bool IPAddressList::remove ( IPAddress  ipAddress)

Removes a given IPAddress from the list

Parameters
ipAddressThe ipAddress to be removed.
Returns
Success: Returns true if the address was removed. Fail: Returns false if the address was not removed
String IPAddressList::toJson ( )

Bundles all Ip addresses into a JSON array string

Returns
A string containing a valid JSON array of ip addresses. Example of a returned string: ["192.168.1.54","10.1.1.15","10.1.1.1","255.255.255.0"]

The documentation for this class was generated from the following file: