Introduction Manual Class Reference Header Reference

ZCom_Address Class Reference

List of all members.

Detailed Description

Zoidcom network address.


Public Member Functions

eZCom_HostnameResult checkHostname ()
 Check if async hostname resolution finished.
const char * getAddressHostname () const
 Returns the previously set hostname in a static buffer.
const char * getAddressIP (eZCom_GetIPAddressOption _with_port=eZCom_AddressWithPort) const
 Returns string representation of IP-address in a static buffer.
zU8 getControlID (void) const
 Get control ID.
zU8 getIP (zU8 _pos) const
 Get IP components separately.
zU32 getIP (void) const
 Get IP as one 32bit value.
zU16 getPort (void) const
 Get port.
eZCom_AddressType getType (void) const
 Get type.
ZCom_Addressoperator= (const ZCom_Address &_s)
 Assignment.
bool operator== (const ZCom_Address &_c) const
 Compare 2 addresses.
bool resolveHostname (bool _async, zU32 _timeout)
 Resolve previously set hostname to IP address.
bool setAddress (eZCom_AddressType _type, zU8 _control_id, const char *_addr)
 Set IP and port from string representation.
void setControlID (zU8 _id)
 Set control id.
void setIP (zU32 _ip)
 Set IP address (host byte order).
void setIP (zU8 _a, zU8 _b, zU8 _c, zU8 _d)
 Set IP address.
void setPort (zU16 _port)
 Set port.
void setType (eZCom_AddressType _type)
 Set type.
const char * toString () const
 Get string representation of address.
 ZCom_Address (const ZCom_Address &)
 Copy constructor.
 ZCom_Address (void)
 Constructor.
 ~ZCom_Address (void)
 Destructor.


Constructor & Destructor Documentation

ZCom_Address::ZCom_Address void   ) 
 

Constructor.

ZCom_Address::ZCom_Address const ZCom_Address  ) 
 

Copy constructor.

ZCom_Address::~ZCom_Address void   ) 
 

Destructor.


Member Function Documentation

bool ZCom_Address::setAddress eZCom_AddressType  _type,
zU8  _control_id,
const char *  _addr
 

Set IP and port from string representation.

Parameters:
_type Address type, only eZCom_AddressUDP currently supported by this function.
_control_id Address control id. See also: ZCom_Control::ZCom_setControlID(), Sharing UDP Sockets
_addr C-String in the form of a.b.c.d:port or hostname:port.
Returns:
false if the address has invalid syntax
The hostname will be resolved when the address is used to connect somewhere, or if resolveHostname() is called.

const char* ZCom_Address::getAddressIP eZCom_GetIPAddressOption  _with_port = eZCom_AddressWithPort  )  const
 

Returns string representation of IP-address in a static buffer.

Returns:
Pointer to static buffer containing address in w.x.y.z:port format.
Note:
Works only for IP addresses. If address has been set by hostname, resolveHostname() has to be called first.
This function is threadsafe.

const char* ZCom_Address::getAddressHostname  )  const
 

Returns the previously set hostname in a static buffer.

Returns:
Pointer to static buffer containing previously set hostname in hostname:port format.
Note:
Returns NULL if address has not been set as a hostname string before.
This function is threadsafe.

const char* ZCom_Address::toString  )  const
 

Get string representation of address.

Returns:
Pointer to a static C-str. Result will be invalidated by next call to this function.
Returns string in format [local]port or [udp]:x.x.x.x:port or [udp]:hostname:port if no ip is available.

This function is threadsafe.

void ZCom_Address::setIP zU8  _a,
zU8  _b,
zU8  _c,
zU8  _d
 

Set IP address.

void ZCom_Address::setIP zU32  _ip  ) 
 

Set IP address (host byte order).

void ZCom_Address::setPort zU16  _port  ) 
 

Set port.

void ZCom_Address::setType eZCom_AddressType  _type  ) 
 

Set type.

void ZCom_Address::setControlID zU8  _id  ) 
 

Set control id.

zU16 ZCom_Address::getPort void   )  const
 

Get port.

Returns:
Port.

zU32 ZCom_Address::getIP void   )  const
 

Get IP as one 32bit value.

Returns:
IP as 32bit value, access it as ((char*)getIP())[0-3]

zU8 ZCom_Address::getIP zU8  _pos  )  const
 

Get IP components separately.

Parameters:
_pos 0-3, indicating which component should be returned.
Returns:
Component of IP address.

eZCom_AddressType ZCom_Address::getType void   )  const
 

Get type.

Returns:
Type of this address.

zU8 ZCom_Address::getControlID void   )  const
 

Get control ID.

Returns:
Control ID of this address.

bool ZCom_Address::operator== const ZCom_Address _c  )  const
 

Compare 2 addresses.

Parameters:
_c Second address for comparison.
Returns:
'true' if addresses are equal.

ZCom_Address& ZCom_Address::operator= const ZCom_Address _s  ) 
 

Assignment.

Parameters:
_s Source address to copy from.

bool ZCom_Address::resolveHostname bool  _async,
zU32  _timeout
 

Resolve previously set hostname to IP address.

Parameters:
_async 'true' if you want the method to return immediately, 'false' if you want the method to return when the hostname is resolved or failed to resolve.
_timeout Set timeout for _synchronous_ lookups in msecs. If _async is 'true', the _timeout parameter will be ignored.
Returns:
'true' if _async==true and resolving could be started
'true' if _async==false and resolving was successful
'false' otherwise
If _async is true, the application has to poll regularly until the result is available.

eZCom_HostnameResult ZCom_Address::checkHostname  ) 
 

Check if async hostname resolution finished.

Returns:
eZCom_HostnameResult


This file is part of the documentation for Zoidcom. Documentation copyright © 2004-2008 by Jörg Rüppel. Generated on Sat Aug 16 15:26:49 2008 for Zoidcom by doxygen 1.4.6-NO