PTLib  Version 2.10.11
remconn.h
Go to the documentation of this file.
1 /*
2  * remconn.h
3  *
4  * Remote networking connection class.
5  *
6  * Portable Windows Library
7  *
8  * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25  * All Rights Reserved.
26  *
27  * Contributor(s): ______________________________________.
28  *
29  * $Revision: 24177 $
30  * $Author: rjongbloed $
31  * $Date: 2010-04-05 06:52:04 -0500 (Mon, 05 Apr 2010) $
32  */
33 
34 #ifndef PTLIB_REMOTECONNECTION_H
35 #define PTLIB_REMOTECONNECTION_H
36 
37 #ifdef P_USE_PRAGMA
38 #pragma interface
39 #endif
40 
41 #include <ptlib/pipechan.h>
42 
43 #ifdef _WIN32
44 #include <ras.h>
45 #include <raserror.h>
46 #endif
47 
50 class PRemoteConnection : public PObject
51 {
52  PCLASSINFO(PRemoteConnection, PObject);
53 
54  public:
59 
64  const PString & name
65  );
66 
70 
76  virtual Comparison Compare(
77  const PObject & obj
78  ) const;
79 
83  virtual PINDEX HashFunction() const;
85 
90  PBoolean Open(
91  PBoolean existing = false
92  );
93 
96  PBoolean Open(
97  const PString & name,
98  PBoolean existing = false
99  );
100 
103  PBoolean Open(
104  const PString & name,
105  const PString & username,
106  const PString & password,
107  PBoolean existing = false
108  );
109 
114  void Close();
116 
119  enum Status {
148  };
149 
155  Status GetStatus() const;
156 
162  DWORD GetErrorCode() const { return osError; }
164 
172  const PString & GetName() const { return remoteName; }
173 
180 
189 
192  struct Configuration {
205  PINDEX subEntries;
208  };
209 
219  Configuration & config
220  );
221 
230  static Status GetConfiguration(
231  const PString & name,
232  Configuration & config
233  );
234 
244  const Configuration & config,
245  PBoolean create = false
246  );
247 
256  static Status SetConfiguration(
257  const PString & name,
258  const Configuration & config,
259  PBoolean create = false
260  );
261 
271  const PString & name
272  );
274 
275  protected:
279  DWORD osError;
280 
281  private:
283  void operator=(const PRemoteConnection &) { }
284  void Construct();
285 
286 
287 // Include platform dependent part of class
288 #ifdef _WIN32
289 #include "msos/ptlib/remconn.h"
290 #else
291 #include "unix/ptlib/remconn.h"
292 #endif
293 };
294 
295 
296 #endif // PTLIB_REMOTECONNECTION_H
297 
298 
299 // End Of File ///////////////////////////////////////////////////////////////
Structure for a RAS configuration.
Definition: remconn.h:193
PString device
Device name for connection eg /dev/modem.
Definition: remconn.h:195
Status GetConfiguration(Configuration &config)
Get the configuration of the specified remote access connection.
Connection was lost after successful establishment.
Definition: remconn.h:144
virtual Comparison Compare(const PObject &obj) const
Compare two connections.
DWORD GetErrorCode() const
Get the error code for the last operation.
Definition: remconn.h:162
Status GetStatus() const
Get the current status of the RAS connection.
Connection failed due to the RAS setting name/number being incorrect.
Definition: remconn.h:136
PBoolean dialAllSubEntries
Always establish maximum bandwidth when Multi-link PPP is used.
Definition: remconn.h:207
PString phoneNumber
Telephone number to call to make the connection.
Definition: remconn.h:197
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:1184
DWORD osError
Definition: remconn.h:279
Connection failed due to the line havin no dial tone.
Definition: remconn.h:130
PString script
Script name for doing remote log in.
Definition: remconn.h:203
This is an array collection class of PString objects.
Definition: pstring.h:2024
The Remote Access Operating System support is not installed.
Definition: remconn.h:146
Remote Access Connection class.
Definition: remconn.h:50
Connection is completed and active.
Definition: remconn.h:124
Connection failed due to the port being in use.
Definition: remconn.h:134
PString password
Definition: remconn.h:278
Definition: remconn.h:147
Connection failed due to the line being busy.
Definition: remconn.h:128
~PRemoteConnection()
Disconnect remote connection.
BOOL PBoolean
Definition: object.h:102
Connection failed due to insufficient privilege.
Definition: remconn.h:138
Connection is in progress.
Definition: remconn.h:126
PBoolean Open(PBoolean existing=false)
Open the remote connection.
Connection failed due to the remote not answering.
Definition: remconn.h:132
Connection has not been made and no attempt is being made.
Definition: remconn.h:122
PRemoteConnection()
Create a new remote connection.
Connection failed due to a general failure.
Definition: remconn.h:142
The character string class.
Definition: pstring.h:108
PString dnsAddress
DNS host on remote site.
Definition: remconn.h:201
PINDEX subEntries
Sub-entry number when Multi-link PPP is used.
Definition: remconn.h:205
PString ipAddress
IP address of local machine after connection is made.
Definition: remconn.h:199
PString remoteName
Definition: remconn.h:276
PString GetAddress()
Get the IP address in dotted decimal form for the RAS connection.
Status SetConfiguration(const Configuration &config, PBoolean create=false)
Set the configuration of the specified remote access connection.
static PStringArray GetAvailableNames()
Get an array of names for all of the available remote connections on this system. ...
void Close()
Close the remote connection.
const PString & GetName() const
Get the name of the RAS connection.
Definition: remconn.h:172
Connection failed due to a hardware failure.
Definition: remconn.h:140
Status
Status codes for remote connection.
Definition: remconn.h:120
static Status RemoveConfiguration(const PString &name)
Remove the specified remote access connection.
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PString userName
Definition: remconn.h:277
virtual PINDEX HashFunction() const
Get has value for the connection.