PRemoteConnection Class Reference

Remote Access Connection class. More...

`#include <remconn.h>`

Inheritance diagram for PRemoteConnection:

## Classes

struct | Configuration
| Structure for a RAS configuration. More...

## Public Member Functions

Construction
| PRemoteConnection ()
| Create a new remote connection. More...
| PRemoteConnection (const PString &name)
| Create a new remote connection. More...
| ~PRemoteConnection ()
| Disconnect remote connection. More...
Overrides from class PObject
virtual Comparison | Compare (const PObject &obj) const
| Compare two connections. More...
virtual PINDEX | HashFunction () const
| Get has value for the connection. More...
Dial/Hangup functions
PBoolean | Open (PBoolean existing=false)
| Open the remote connection. More...
PBoolean | Open (const PString &name, PBoolean existing=false)
| Open the remote connection. More...
PBoolean | Open (const PString &name, const PString &username, const PString &password, PBoolean existing=false)
| Open the remote connection. More...
void | Close ()
| Close the remote connection. More...
Public Member Functions inherited from PObject
virtual | ~PObject ()
virtual PObject * | Clone () const
| Create a copy of the class on the heap. More...
virtual const char * | GetClass (unsigned ancestor=0) const
| Get the current dynamic type of the object instance. More...
PBoolean | IsClass (const char *cls) const
virtual PBoolean | InternalIsDescendant (const char *clsName) const
| Determine if the dynamic type of the current instance is a descendent of the specified class. More...
virtual Comparison | CompareObjectMemoryDirect (const PObject &obj) const
| Determine the byte wise comparison of two objects. More...
bool | operator== (const PObject &obj) const
| Compare the two objects. More...
bool | operator!= (const PObject &obj) const
| Compare the two objects. More...
bool | operator< (const PObject &obj) const
| Compare the two objects. More...
bool | operator> (const PObject &obj) const
| Compare the two objects. More...
bool | operator<= (const PObject &obj) const
| Compare the two objects. More...
bool | operator>= (const PObject &obj) const
| Compare the two objects. More...
virtual void | PrintOn (ostream &strm) const
| Output the contents of the object to the stream. More...
virtual void | ReadFrom (istream &strm)
| Input the contents of the object from the stream. More...

## Protected Attributes

PString | remoteName
PString | userName
PString | password
DWORD | osError
PString | pppDeviceName
PPipeChannel * | pipeChannel
PBoolean | wasConnected
Status | status
PString | deviceStr

## Error/Status functions

enum | Status { Idle, Connected, InProgress, LineBusy, NoDialTone, NoAnswer, PortInUse, NoNameOrNumber, AccessDenied, HardwareFailure, GeneralFailure, ConnectionLost, NotInstalled, NumStatuses }
| Status codes for remote connection. More...
Status | GetStatus () const
| Get the current status of the RAS connection. More...
DWORD | GetErrorCode () const
| Get the error code for the last operation. More...

## Information functions

const PString & | GetName () const
| Get the name of the RAS connection. More...
PString | GetAddress ()
| Get the IP address in dotted decimal form for the RAS connection. More...
static PStringArray | GetAvailableNames ()
| Get an array of names for all of the available remote connections on this system. More...

## Configuration functions

Status | GetConfiguration (Configuration &config)
| Get the configuration of the specified remote access connection. More...
Status | SetConfiguration (const Configuration &config, PBoolean create=false)
| Set the configuration of the specified remote access connection. More...
static Status | GetConfiguration (const PString &name, Configuration &config)
| Get the configuration of the specified remote access connection. More...
static Status | SetConfiguration (const PString &name, const Configuration &config, PBoolean create=false)
| Set the configuration of the specified remote access connection. More...
static Status | RemoveConfiguration (const PString &name)
| Remove the specified remote access connection. More...

## Additional Inherited Members

Public Types inherited from PObject
enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
| Result of the comparison operation performed by the `Compare()` function. More...
Static Public Member Functions inherited from PObject
static const char * | Class ()
| Get the name of the class as a C string. More...
static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size)
| Internal function caled from CompareObjectMemoryDirect() More...
Protected Member Functions inherited from PObject
| PObject ()
| Constructor for PObject, made protected so cannot ever create one on its own. More...

## Detailed Description

Remote Access Connection class.

## Member Enumeration Documentation

## Status

enum PRemoteConnection::Status

Status codes for remote connection.

Enumerator
Idle | Connection has not been made and no attempt is being made.
Connected | Connection is completed and active.
InProgress | Connection is in progress.
LineBusy | Connection failed due to the line being busy.
NoDialTone | Connection failed due to the line havin no dial tone.
NoAnswer | Connection failed due to the remote not answering.
PortInUse | Connection failed due to the port being in use.
NoNameOrNumber | Connection failed due to the RAS setting name/number being incorrect.
AccessDenied | Connection failed due to insufficient privilege.
HardwareFailure | Connection failed due to a hardware failure.
GeneralFailure | Connection failed due to a general failure.
ConnectionLost | Connection was lost after successful establishment.
NotInstalled | The Remote Access Operating System support is not installed.
NumStatuses |

## Constructor & Destructor Documentation

## PRemoteConnection() [1/2]

PRemoteConnection::PRemoteConnection | ( |  | ) |

Create a new remote connection.

## PRemoteConnection() [2/2]

PRemoteConnection::PRemoteConnection | ( | const PString & | name | ) |

Create a new remote connection.

This will initiate the connection using the specified settings.

Parameters

  name | Name of RAS configuration.

## ~PRemoteConnection()

PRemoteConnection::~PRemoteConnection | ( |  | ) |

Disconnect remote connection.

## Member Function Documentation

## Close()

void PRemoteConnection::Close | ( |  | ) |

Close the remote connection.

This will hang up/dosconnect the connection, net access will no longer be available to this site.

## Compare()

virtual Comparison PRemoteConnection::Compare | ( | const PObject & | obj | ) | const

virtual

Compare two connections.

Returns
  EqualTo of same RAS connectionconfiguration.

Parameters

  obj | Another connection instance.

Reimplemented from PObject.

## GetAddress()

PString PRemoteConnection::GetAddress | ( |  | ) |

Get the IP address in dotted decimal form for the RAS connection.

Returns
  String for IP address, or empty string if none.

Referenced by GetName().

## GetAvailableNames()

static PStringArray PRemoteConnection::GetAvailableNames | ( |  | ) |

static

Get an array of names for all of the available remote connections on this system.

Returns
  Array of strings for remote connection names.

Referenced by GetName().

## GetConfiguration() [1/2]

Status PRemoteConnection::GetConfiguration | ( | Configuration & | config | ) |

Get the configuration of the specified remote access connection.

Returns
  `Connected` if the configuration information was obtained, `NoNameOrNumber` if the particular RAS name does not exist, `NotInstalled` if there is no RAS support in the operating system, `GeneralFailure` on any other error.

Parameters

  config | Configuration of remote connection

## GetConfiguration() [2/2]

static Status PRemoteConnection::GetConfiguration | ( | const PString & | name,
|  | Configuration & | config
| ) |  |

static

Get the configuration of the specified remote access connection.

Returns
  `Connected` if the configuration information was obtained, `NoNameOrNumber` if the particular RAS name does not exist, `NotInstalled` if there is no RAS support in the operating system, `GeneralFailure` on any other error.

Parameters

  name | Remote connection name to get configuration
  config | Configuration of remote connection

## GetErrorCode()

DWORD PRemoteConnection::GetErrorCode | ( |  | ) | const

inline

Get the error code for the last operation.

Returns
  Operating system error code.

References osError.

## GetName()

const PString& PRemoteConnection::GetName | ( |  | ) | const

inline

Get the name of the RAS connection.

Returns
  String for IP address, or empty string if none.

References GetAddress(), GetAvailableNames(), and remoteName.

## GetStatus()

Status PRemoteConnection::GetStatus | ( |  | ) | const

Get the current status of the RAS connection.

Returns
  Status code.

## HashFunction()

virtual PINDEX PRemoteConnection::HashFunction | ( |  | ) | const

virtual

Get has value for the connection.

Returns
  Hash value of the connection name string.

Reimplemented from PObject.

## Open() [1/3]

PBoolean PRemoteConnection::Open | ( | PBoolean | existing = `false` | ) |

Open the remote connection.

Parameters

  existing | Flag for open only if already connected.

## Open() [2/3]

PBoolean PRemoteConnection::Open | ( | const PString & | name,
|  | PBoolean | existing = `false`
| ) |  |

Open the remote connection.

Parameters

  name | RAS name of of connection to open.
  existing | Flag for open only if already connected.

## Open() [3/3]

PBoolean PRemoteConnection::Open | ( | const PString & | name,
|  | const PString & | username,
|  | const PString & | password,
|  | PBoolean | existing = `false`
| ) |  |

Open the remote connection.

Parameters

  name | RAS name of of connection to open.
  username | Username for remote log in.
  password | password for remote log in.
  existing | Flag for open only if already connected.

## RemoveConfiguration()

static Status PRemoteConnection::RemoveConfiguration | ( | const PString & | name | ) |

static

Remove the specified remote access connection.

Returns
  `Connected` if the configuration information was removed, `NoNameOrNumber` if the particular RAS name does not exist, `NotInstalled` if there is no RAS support in the operating system, `GeneralFailure` on any other error.

Parameters

  name | Remote connection name to configure

## SetConfiguration() [1/2]

Status PRemoteConnection::SetConfiguration | ( | const Configuration & | config,
|  | PBoolean | create = `false`
| ) |  |

Set the configuration of the specified remote access connection.

Returns
  `Connected` if the configuration information was set, `NoNameOrNumber` if the particular RAS name does not exist, `NotInstalled` if there is no RAS support in the operating system, `GeneralFailure` on any other error.

Parameters

  config | Configuration of remote connection
  create | Flag to create connection if not present

## SetConfiguration() [2/2]

static Status PRemoteConnection::SetConfiguration | ( | const PString & | name,
|  | const Configuration & | config,
|  | PBoolean | create = `false`
| ) |  |

static

Set the configuration of the specified remote access connection.

Returns
  `Connected` if the configuration information was set, `NoNameOrNumber` if the particular RAS name does not exist, `NotInstalled` if there is no RAS support in the operating system, `GeneralFailure` on any other error.

Parameters

  name | Remote connection name to configure
  config | Configuration of remote connection
  create | Flag to create connection if not present

## Member Data Documentation

## deviceStr

PString PRemoteConnection::deviceStr

protected

## osError

DWORD PRemoteConnection::osError

protected

Referenced by GetErrorCode().

## password

PString PRemoteConnection::password

protected

## pipeChannel

PPipeChannel* PRemoteConnection::pipeChannel

protected

## pppDeviceName

PString PRemoteConnection::pppDeviceName

protected

## remoteName

PString PRemoteConnection::remoteName

protected

Referenced by GetName().

## status

Status PRemoteConnection::status

protected

## userName

PString PRemoteConnection::userName

protected

## wasConnected

PBoolean PRemoteConnection::wasConnected

protected

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

- remconn.h