PTLib  Version 2.18.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
30 #ifndef PTLIB_REMOTECONNECTION_H
31 #define PTLIB_REMOTECONNECTION_H
32 
33 #ifdef P_USE_PRAGMA
34 #pragma interface
35 #endif
36 
37 #if P_REMCONN
38 
39 #include <ptlib/pipechan.h>
40 
41 #ifdef _WIN32
42 #include <ras.h>
43 #include <raserror.h>
44 #endif
45 
48 class PRemoteConnection : public PObject
49 {
50  PCLASSINFO(PRemoteConnection, PObject);
51 
52  public:
55  PRemoteConnection();
57 
61  PRemoteConnection(
62  const PString & name
63  );
64 
66  ~PRemoteConnection();
68 
74  virtual Comparison Compare(
75  const PObject & obj
76  ) const;
77 
81  virtual PINDEX HashFunction() const;
83 
88  PBoolean Open(
89  PBoolean existing = false
90  );
91 
94  PBoolean Open(
95  const PString & name,
96  PBoolean existing = false
97  );
98 
101  PBoolean Open(
102  const PString & name,
103  const PString & username,
104  const PString & password,
105  PBoolean existing = false
106  );
107 
112  void Close();
114 
117  enum Status {
120  Idle,
122  Connected,
124  InProgress,
126  LineBusy,
128  NoDialTone,
130  NoAnswer,
132  PortInUse,
134  NoNameOrNumber,
136  AccessDenied,
138  HardwareFailure,
140  GeneralFailure,
142  ConnectionLost,
144  NotInstalled,
145  NumStatuses
146  };
147 
153  Status GetStatus() const;
154 
160  DWORD GetErrorCode() const { return osError; }
162 
170  const PString & GetName() const { return remoteName; }
171 
177  PString GetAddress();
178 
185  static PStringArray GetAvailableNames();
187 
190  struct Configuration {
193  PString device;
195  PString phoneNumber;
197  PString ipAddress;
199  PString dnsAddress;
201  PString script;
203  PINDEX subEntries;
205  PBoolean dialAllSubEntries;
206  };
207 
216  Status GetConfiguration(
217  Configuration & config
218  );
219 
228  static Status GetConfiguration(
229  const PString & name,
230  Configuration & config
231  );
232 
241  Status SetConfiguration(
242  const Configuration & config,
243  PBoolean create = false
244  );
245 
254  static Status SetConfiguration(
255  const PString & name,
256  const Configuration & config,
257  PBoolean create = false
258  );
259 
268  static Status RemoveConfiguration(
269  const PString & name
270  );
272 
273  protected:
274  PString remoteName;
275  PString userName;
276  PString password;
277  DWORD osError;
278 
279  private:
280  PRemoteConnection(const PRemoteConnection &) { }
281  void operator=(const PRemoteConnection &) { }
282  void Construct();
283 
284 
285 // Include platform dependent part of class
286 #ifdef _WIN32
287 #include "msos/ptlib/remconn.h"
288 #else
289 #include "unix/ptlib/remconn.h"
290 #endif
291 };
292 
293 
294 #endif // P_REMCONN
295 
296 #endif // PTLIB_REMOTECONNECTION_H
297 
298 
299 // End Of File ///////////////////////////////////////////////////////////////
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:2164
This is an array collection class of PString objects.
Definition: pstring.h:2365
virtual PINDEX HashFunction() const
This function yields a hash value required by the PDictionary class.
bool PBoolean
Definition: object.h:174
The character string class.
Definition: pstring.h:108
virtual Comparison Compare(const PObject &obj) const
Compare the two objects and return their relative rank.
Ultimate parent class for all objects in the class library.
Definition: object.h:2204