ipAddrToAsciiAsynchronous.h

Convert ip addresses to ASCII asynchronously.

ipAddrToAsciiEngine is the first class needed to convert an ipAddr to an ASCII address. From the engine, you can use createTransaction() to create a transaction object. The transaction object lets you attach callbacks and convert an address to ASCII.

class ipAddrToAsciiCallBack
#include <ipAddrToAsciiAsynchronous.h>

Users implement this virtual class to use ipAddrToAsciiTransaction.

In order to use ipAddrToAsciiTranaction, users should implement this virtual class to handle events that occur asynchronously while converting the IP address.

Public Functions

virtual void transactionComplete(const char *pHostName) = 0

Called once the ip address is converted to ASCII.

virtual void show(unsigned level) const

Called by the show() method of ipAddrToAsciiTransaction or ipAddrToAsciiEngine when passed a level >= 1.

virtual ~ipAddrToAsciiCallBack() = 0
class ipAddrToAsciiTransaction
#include <ipAddrToAsciiAsynchronous.h>

Class which convert an ipAddr to ascii and call a user-supplied callback when finished.

Public Functions

virtual void release() = 0

Destroy this transaction object and remove from the parent engine object.

virtual void ipAddrToAscii(const osiSockAddr &addrIn, ipAddrToAsciiCallBack &cbIn) = 0

Convert an IP address to ascii, asynchronously.

Note

The ipAddrToAsciiCallBack referenced must remain valid until release() is called on this transaction.

Parameters:
  • addrIn – Reference to the address to convert

  • cbIn – Reference to the user supplied callbacks to call when the result is available

virtual osiSockAddr address() const = 0

Get the conversion address currently set.

Returns:

Get the last (or current) address converted to ascii

virtual void show(unsigned level) const = 0

Prints the converted IP address.

Prints to stdout

Parameters:

level – 0 prints basic info, greater than 0 prints information from the callback’s show() method too

Protected Functions

virtual ~ipAddrToAsciiTransaction() = 0
class ipAddrToAsciiEngine
#include <ipAddrToAsciiAsynchronous.h>

Class which manages creating transactions for converting ipAddr’s to ASCII.

Public Functions

virtual void release() = 0

Cancel any pending transactions and destroy this ipAddrToAsciiEngine object.

virtual ipAddrToAsciiTransaction &createTransaction() = 0

Create a new transaction object used to do IP address conversions.

Note

Caller must release() the returned transaction

Returns:

The newly created transaction object

virtual void show(unsigned level) const = 0

Print information about this engine object and how many requests its processing.

Prints to stdout

Parameters:

level – 0 for basic information, 1 for extra info

Public Static Functions

static ipAddrToAsciiEngine &allocate()

Creates a new ipAddrToAsciiEngine to convert IP addresses.

Note

Caller must release() this engine.

Returns:

Newly created engine object

Protected Functions

virtual ~ipAddrToAsciiEngine() = 0