remconn.h
Go to the documentation of this file.
/*
* remconn.h
*
* Remote networking connection class.
*
* Portable Windows Library
*
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
* All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
* $Revision: 24177 $
* $Author: rjongbloed $
* $Date: 2010-04-05 06:52:04 -0500 (Mon, 05 Apr 2010) $
*/
#ifndef PTLIB_REMOTECONNECTION_H
#define PTLIB_REMOTECONNECTION_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <ptlib/pipechan.h>
#ifdef _WIN32
#include <ras.h>
#include <raserror.h>
#endif
class PRemoteConnection : public PObject
{
PCLASSINFO(PRemoteConnection, PObject);
public:
PRemoteConnection();
PRemoteConnection(
const PString & name
);
~PRemoteConnection();
virtual Comparison Compare(
const PObject & obj
) const;
virtual PINDEX HashFunction() const;
PBoolean Open(
PBoolean existing = false
);
PBoolean Open(
const PString & name,
PBoolean existing = false
);
PBoolean Open(
const PString & name,
const PString & username,
const PString & password,
PBoolean existing = false
);
void Close();
enum Status {
Idle,
Connected,
InProgress,
LineBusy,
NoDialTone,
NoAnswer,
PortInUse,
NoNameOrNumber,
AccessDenied,
HardwareFailure,
GeneralFailure,
ConnectionLost,
NotInstalled,
NumStatuses
};
Status GetStatus() const;
DWORD GetErrorCode() const { return osError; }
const PString & GetName() const { return remoteName; }
PString GetAddress();
static PStringArray GetAvailableNames();
struct Configuration {
PString device;
PString phoneNumber;
PString ipAddress;
PString dnsAddress;
PString script;
PINDEX subEntries;
PBoolean dialAllSubEntries;
};
Status GetConfiguration(
Configuration & config
);
static Status GetConfiguration(
const PString & name,
Configuration & config
);
Status SetConfiguration(
const Configuration & config,
PBoolean create = false
);
static Status SetConfiguration(
const PString & name,
const Configuration & config,
PBoolean create = false
);
static Status RemoveConfiguration(
const PString & name
);
protected:
PString remoteName;
PString userName;
PString password;
DWORD osError;
private:
PRemoteConnection(const PRemoteConnection &) { }
void operator=(const PRemoteConnection &) { }
void Construct();
// Include platform dependent part of class
#ifdef _WIN32
#include "msos/ptlib/remconn.h"
#else
#include "unix/ptlib/remconn.h"
#endif
};
#endif // PTLIB_REMOTECONNECTION_H
// End Of File ///////////////////////////////////////////////////////////////
PRemoteConnection::Configuration
Structure for a RAS configuration.
Definition: remconn.h:193
PRemoteConnection::Configuration::device
PString device
Device name for connection eg /dev/modem.
Definition: remconn.h:195
PRemoteConnection::GetConfiguration
Status GetConfiguration(Configuration &config)
Get the configuration of the specified remote access connection.
PRemoteConnection::ConnectionLost
Connection was lost after successful establishment.
Definition: remconn.h:144
PRemoteConnection::Compare
virtual Comparison Compare(const PObject &obj) const
Compare two connections.
PRemoteConnection::GetErrorCode
DWORD GetErrorCode() const
Get the error code for the last operation.
Definition: remconn.h:162
PRemoteConnection::GetStatus
Status GetStatus() const
Get the current status of the RAS connection.
PRemoteConnection::NoNameOrNumber
Connection failed due to the RAS setting name/number being incorrect.
Definition: remconn.h:136
PRemoteConnection::Configuration::dialAllSubEntries
PBoolean dialAllSubEntries
Always establish maximum bandwidth when Multi-link PPP is used.
Definition: remconn.h:207
PRemoteConnection::Configuration::phoneNumber
PString phoneNumber
Telephone number to call to make the connection.
Definition: remconn.h:197
PObject::Comparison
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:1184
PRemoteConnection::osError
DWORD osError
Definition: remconn.h:279
PRemoteConnection::NoDialTone
Connection failed due to the line havin no dial tone.
Definition: remconn.h:130
PRemoteConnection::Configuration::script
PString script
Script name for doing remote log in.
Definition: remconn.h:203
PStringArray
This is an array collection class of PString objects.
Definition: pstring.h:2024
PRemoteConnection::NotInstalled
The Remote Access Operating System support is not installed.
Definition: remconn.h:146
PRemoteConnection
Remote Access Connection class.
Definition: remconn.h:50
PRemoteConnection::Connected
Connection is completed and active.
Definition: remconn.h:124
PRemoteConnection::PortInUse
Connection failed due to the port being in use.
Definition: remconn.h:134
pipechan.h
PRemoteConnection::password
PString password
Definition: remconn.h:278
PRemoteConnection::NumStatuses
Definition: remconn.h:147
PRemoteConnection::LineBusy
Connection failed due to the line being busy.
Definition: remconn.h:128
PRemoteConnection::~PRemoteConnection
~PRemoteConnection()
Disconnect remote connection.
PBoolean
BOOL PBoolean
Definition: object.h:102
PRemoteConnection::AccessDenied
Connection failed due to insufficient privilege.
Definition: remconn.h:138
PRemoteConnection::InProgress
Connection is in progress.
Definition: remconn.h:126
PRemoteConnection::Open
PBoolean Open(PBoolean existing=false)
Open the remote connection.
PRemoteConnection::NoAnswer
Connection failed due to the remote not answering.
Definition: remconn.h:132
PRemoteConnection::Idle
Connection has not been made and no attempt is being made.
Definition: remconn.h:122
PRemoteConnection::PRemoteConnection
PRemoteConnection()
Create a new remote connection.
PRemoteConnection::GeneralFailure
Connection failed due to a general failure.
Definition: remconn.h:142
PString
The character string class.
Definition: pstring.h:108
PRemoteConnection::Configuration::dnsAddress
PString dnsAddress
DNS host on remote site.
Definition: remconn.h:201
PRemoteConnection::Configuration::subEntries
PINDEX subEntries
Sub-entry number when Multi-link PPP is used.
Definition: remconn.h:205
PRemoteConnection::Configuration::ipAddress
PString ipAddress
IP address of local machine after connection is made.
Definition: remconn.h:199
PRemoteConnection::remoteName
PString remoteName
Definition: remconn.h:276
PRemoteConnection::GetAddress
PString GetAddress()
Get the IP address in dotted decimal form for the RAS connection.
PRemoteConnection::SetConfiguration
Status SetConfiguration(const Configuration &config, PBoolean create=false)
Set the configuration of the specified remote access connection.
PRemoteConnection::GetAvailableNames
static PStringArray GetAvailableNames()
Get an array of names for all of the available remote connections on this system. ...
PRemoteConnection::Close
void Close()
Close the remote connection.
PRemoteConnection::GetName
const PString & GetName() const
Get the name of the RAS connection.
Definition: remconn.h:172
PRemoteConnection::HardwareFailure
Connection failed due to a hardware failure.
Definition: remconn.h:140
PRemoteConnection::Status
Status
Status codes for remote connection.
Definition: remconn.h:120
PRemoteConnection::RemoveConfiguration
static Status RemoveConfiguration(const PString &name)
Remove the specified remote access connection.
PObject
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PRemoteConnection::userName
PString userName
Definition: remconn.h:277
PRemoteConnection::HashFunction
virtual PINDEX HashFunction() const
Get has value for the connection.