mace::MaceKey Class Reference

#include <MaceKey.h>

Inheritance diagram for mace::MaceKey:

Inheritance graph
[legend]
Collaboration diagram for mace::MaceKey:

Collaboration graph
[legend]

List of all members.


Detailed Description

The base class of Mace addresses.

Definition at line 284 of file MaceKey.h.


Public Member Functions

bool isUnroutable () const
 Returns true if you cannot open a socket to the address.
bool isNullAddress () const
 Returns true if the address is "NULL".
std::string toHex () const
 Returns the address in a hexidecimal string format.
std::string addressString () const
 Returns the string in a canonical string format (IP address not hostname).
bool isBitArrMaceKey () const
 Return true if the address family is a bitstring family, currently SHA32 or SHA160.
size_t hashOf () const
 return an integer hash value for the MaceKey
const MaceAddrgetMaceAddr () const throw (InvalidMaceKeyException)
 If an IPV4 MaceKey, returns the MaceAddr. Otherwise throws an exception.
int bitLength () const throw (InvalidMaceKeyException)
 If a BitArr MaceKey, returns the length in bits, otherwise throws an exception.
uint32_t getNthDigit (int position, uint32_t digitBits=4) const throw (Exception)
 Returns the digit of length digitBits at position.
void setNthDigit (uint32_t digit, int position, uint32_t digitBits=4) throw (Exception)
 Sets the digit at position of length digitBits to value.
int sharedPrefixLength (const MaceKey &key, uint32_t digitBits=4) const throw (InvalidMaceKeyException)
 Returns the number of digits of length digitBits in common from the beginning of key.
virtual void serialize (std::string &str) const
 Encode the current object at the end of str as a bytestring in a compact format (and which doesn't require delimiters to parse).
virtual int deserialize (std::istream &in) throw (SerializationException)
 Replace the current object value from the bytes read from in, returning the number of bytes read.
virtual void serializeXML_RPC (std::string &str) const throw (SerializationException)
 serialize this object onto the end of str in XML_RPC format
virtual int deserializeXML_RPC (std::istream &in) throw (SerializationException)
 deserialize this object from XML_RPC format from in
 MaceKey (const MaceKey &right)
 Standard copy constructor.
 MaceKey (ipv4_type t)
 Creates a "null" IPV4 MaceKey.
 MaceKey (ipv4_type t, uint32_t ipaddr, uint16_t port=0, uint32_t pIp=INADDR_NONE, uint16_t pport=0)
 old constructor to pass in each port and ip address separately.
 MaceKey (ipv4_type t, const std::string &addr)
 performs MaceAddr parsing and DNS lookup for string addr.
 MaceKey (ipv4_type t, const MaceAddr &maddr)
 wraps passed MaceAddr in a MaceKey
 MaceKey (sha160_type t)
 Creates a "null" SHA160 MaceKey.
 MaceKey (sha160_type t, int toHash)
 Computes the sha1 of toHash, and stores that as the address.
 MaceKey (sha160_type t, const uint32_t arr[5])
 Sets the int array to the provided int array.
 MaceKey (sha160_type t, const char arr[5 *4])
 Initializes the int array based on the characters given. Note, often differs from the int array version in byte ordering.
 MaceKey (sha160_type t, const std::string &toHash)
 Computes the sha1 of toHash, and stores that as the address.
 MaceKey (sha32_type t)
 Creates a "null" SHA32 MaceKey.
 MaceKey (sha32_type t, int toHash)
 Computes the sha1 of toHash, and stores the first 32 bits as the address.
 MaceKey (sha32_type t, const uint32_t arr[1])
 Sets the int array to the provided int array.
 MaceKey (sha32_type t, const char arr[4])
 Initializes the int array based on the characters given. Note, often differs from the int array version in byte ordering.
 MaceKey (sha32_type t, const std::string &toHash)
 Computes the sha1 of toHash, and stores the first 32 bits as the address.
 MaceKey (string_type t)
 Createas a "null" string address.
 MaceKey (string_type t, const mace::string &u)
 Sets the address to be string u.
 MaceKey (const mace::string &a)
 Parses the address family prefix, and constructs an appropriate MaceKey.

Static Public Member Functions

static const char * addressFamilyName (int addressFamily)
 Returns a string from an address family number.
static const char * addressFamilyVar (int addressFamily)
 Returns a MaceKey address prefix based on the addressFamily.

Static Public Attributes

static const MaceKey null = mace::MaceKey()
 An easy reference to one null MaceKey.

Member Data Documentation

An easy reference to one null MaceKey.

This is not the only "null" MaceKey. DO NOT COMPARE TO THIS. Instead, call MaceKey::isNullAddress().

Definition at line 290 of file MaceKey.h.

Referenced by mace::AddressCache::query().


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

Generated on Sat Oct 4 21:30:39 2008 for Mace Library by  doxygen 1.5.5