# OpalTransportAddress Class Reference

`#include <transports.h>`

Inheritance diagram for OpalTransportAddress:

List of all members.

## Operations

enum | BindOptions { NoBinding, HostOnly, FullTSAP, Streamed, Datagram, RouteInterface, NumBindOptions }
PBoolean | IsEquivalent (const OpalTransportAddress &address) const
PBoolean | IsCompatible (const OpalTransportAddress &address) const
PBoolean | GetIpAddress (PIPSocket::Address &ip) const
PBoolean | GetIpAndPort (PIPSocket::Address &ip, WORD &port) const
virtual PString | GetHostName () const
OpalListener * | CreateListener (OpalEndPoint &endpoint, BindOptions option) const
virtual OpalTransport * | CreateTransport (OpalEndPoint &endpoint, BindOptions option=HostOnly) const

## Protected Member Functions

void | SetInternalTransport (WORD port, const char *proto)

## Protected Attributes

OpalInternalTransport * | transport

## Member Enumeration Documentation

enum OpalTransportAddress::BindOptions

Enumerator:

  NoBinding |
  HostOnly |
  FullTSAP |
  Streamed |
  Datagram |
  RouteInterface |
  NumBindOptions |

## Constructor & Destructor Documentation

OpalTransportAddress::OpalTransportAddress | ( |  | ) |

OpalTransportAddress::OpalTransportAddress | ( | const char * | address,
|  | WORD | port = `0`,
|  | const char * | proto = `NULL` |
| ) |  |  |

Parameters:

  address | Address string to parse
  port | Default port number
  proto | Default is "tcp"

OpalTransportAddress::OpalTransportAddress | ( | const PString & | address,
|  | WORD | port = `0`,
|  | const char * | proto = `NULL` |
| ) |  |  |

Parameters:

  address | Address string to parse
  port | Default port number
  proto | Default is "tcp"

OpalTransportAddress::OpalTransportAddress | ( | const PIPSocket::Address & | ip,
|  | WORD | port,
|  | const char * | proto = `NULL` |
| ) |  |  |

Parameters:

  proto | Default is "tcp"

OpalTransportAddress::OpalTransportAddress | ( |  | ) |

OpalTransportAddress::OpalTransportAddress | ( | const char * | address,
|  | WORD | port = `0`,
|  | const char * | proto = `NULL` |
| ) |  |  |

Parameters:

  address | Address string to parse
  port | Default port number
  proto | Default is "tcp"

OpalTransportAddress::OpalTransportAddress | ( | const PString & | address,
|  | WORD | port = `0`,
|  | const char * | proto = `NULL` |
| ) |  |  |

Parameters:

  address | Address string to parse
  port | Default port number
  proto | Default is "tcp"

OpalTransportAddress::OpalTransportAddress | ( | const PIPSocket::Address & | ip,
|  | WORD | port,
|  | const char * | proto = `NULL` |
| ) |  |  |

Parameters:

  proto | Default is "tcp"

## Member Function Documentation

PBoolean OpalTransportAddress::IsEquivalent | ( | const OpalTransportAddress & | address | ) | const

Determine if the two transport addresses are equivalent.

PBoolean OpalTransportAddress::IsCompatible | ( | const OpalTransportAddress & | address | ) | const

Determine if the two transport addresses are compatible.

PBoolean OpalTransportAddress::GetIpAddress | ( | PIPSocket::Address & | ip | ) | const

Extract the ip address from transport address. Returns PFalse, if the address is not an IP transport address.

PBoolean OpalTransportAddress::GetIpAndPort | ( | PIPSocket::Address & | ip,
|  | WORD & | port |
| ) |  |  | const

Extract the ip address and port number from transport address. Returns PFalse, if the address is not an IP transport address.

virtual PString OpalTransportAddress::GetHostName | ( |  | ) | const`[virtual]`

Translate the transport address to a more human readable form. Returns the hostname if using IP.

OpalListener* OpalTransportAddress::CreateListener | ( | OpalEndPoint & | endpoint,
|  | BindOptions | option |
| ) |  |  | const

Create a listener based on this transport address. The BindOptions parameter indicates how the listener is to be created. Note that some transport types may not use this parameter.

With FullTSAP the the full address is used for any local binding, for example, an address of "tcp$10.0.0.1:1720" would create a TCP listening socket that would be bound to the specific interface 10.0.0.1 and listens on port 1720. Note that the address "tcp$*:1720" can be used to bind to INADDR_ANY, and a port number of zero indicates allocate a new random port number.

With HostOnly it would be equivalent to translating the above example to "tcp$10.0.0.1:0" before using it.

Using Streamed or Datagram is similar to HostOnly as only the host part of the address is used, but instead of using the protocol type specifed by the address it guarentees the specifeid type. In the above example Streamed would be identical to HostOnly and Datagram would translate the address to udp$10.0.0.1:0 before using it.

With NoBinding then a compatible listener is created and no local binding is made. This is equivalent to translating the address to "tcp$*:0" so that only the overall protocol type is used.

With RouteInterface, the address is considered a remote address and the created transport is bound only to the address associated with the interface that would be used to get to that address.

Also note that if the address has a trailing '+' character then the socket will be bound using the REUSEADDR option, where relevant.

Parameters:

  endpoint | Endpoint object for transport creation.
  option | Options for how to create listener

virtual OpalTransport* OpalTransportAddress::CreateTransport | ( | OpalEndPoint & | endpoint,
|  | BindOptions | option = `HostOnly` |
| ) |  |  | const`[virtual]`

Create a transport suitable for this address type. The BindOptions parameter indicates how the transport is to be created. Note that some transport types may not use this parameter.

With FullTSAP the the full address is used for any local binding, for example, an address of "tcp$10.0.0.1:1720" would create a TCP transport socket that would be bound to the specific interface 10.0.0.1 and port 1720. Note that the address "tcp$*:1720" can be used to bind to INADDR_ANY, and a port number of zero indicates allocate a new random port number.

With HostOnly it would be equivalent to translating the above example to "tcp$10.0.0.1:0" before using it.

Using Streamed or Datagram is similar to HostOnly as only the host part of the address is used, but instead of using the protocol type specifed by the address it guarentees the specifeid type. In the above example Streamed would be identical to HostOnly and Datagram would translate the address to udp$10.0.0.1:0 before using it.

With NoBinding then a compatible transport is created and no local binding is made. This is equivalent to translating the address to "tcp$*:0" so that only the overall protocol type is used.

Also note that if the address has a trailing '+' character then the socket will be bound using the REUSEADDR option.

Parameters:

  endpoint | Endpoint object for transport creation.
  option | Options for how to create transport

void OpalTransportAddress::SetInternalTransport | ( | WORD | port,
|  | const char * | proto |
| ) |  |  | `[protected]`

Parameters:

  port | Default port number
  proto | Default is "tcp"

## Member Data Documentation

OpalInternalTransport* OpalTransportAddress::transport `[protected]`

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

- transports.h