PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

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 * $Revision: 28207 $
30 * $Author: rjongbloed $
31 * $Date: 2012-08-17 10:09:54 +1000 (Fri, 17 Aug 2012) $
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 #if P_REMCONN
42
43 #include <ptlib/pipechan.h>
44
45 #ifdef _WIN32
46 #include <ras.h>
47 #include <raserror.h>
48 #endif
49
52 class PRemoteConnection : public PObject
53 {
54 PCLASSINFO(PRemoteConnection, PObject);
55
56 public:
59
60 PRemoteConnection();
61
65 PRemoteConnection(
66 const PString & name
67 );
68
70 ~PRemoteConnection();
72
78 virtual Comparison Compare(
79 const PObject & obj
80 ) const;
81
85 virtual PINDEX HashFunction() const;
87
92 PBoolean Open(
93 PBoolean existing = false
94 );
95
98 PBoolean Open(
99 const PString & name,
100 PBoolean existing = false
101 );
102
105 PBoolean Open(
106 const PString & name,
107 const PString & username,
108 const PString & password,
109 PBoolean existing = false
110 );
111
116 void Close();
118
121
122 enum Status {
124 Idle,
126 Connected,
128 InProgress,
130 LineBusy,
132 NoDialTone,
134 NoAnswer,
136 PortInUse,
138 NoNameOrNumber,
140 AccessDenied,
142 HardwareFailure,
144 GeneralFailure,
146 ConnectionLost,
148 NotInstalled,
149 NumStatuses
150 };
151
157 Status GetStatus() const;
158
164 DWORD GetErrorCode() const { return osError; }
166
174 const PString & GetName() const { return remoteName; }
175
181 PString GetAddress();
182
189 static PStringArray GetAvailableNames();
191
194
195 struct Configuration {
197 PString device;
199 PString phoneNumber;
201 PString ipAddress;
203 PString dnsAddress;
205 PString script;
207 PINDEX subEntries;
209 PBoolean dialAllSubEntries;
210 };
211
220 Status GetConfiguration(
221 Configuration & config
222 );
223
232 static Status GetConfiguration(
233 const PString & name,
234 Configuration & config
235 );
236
245 Status SetConfiguration(
246 const Configuration & config,
247 PBoolean create = false
248 );
249
258 static Status SetConfiguration(
259 const PString & name,
260 const Configuration & config,
261 PBoolean create = false
262 );
263
272 static Status RemoveConfiguration(
273 const PString & name
274 );
276
277 protected:
278 PString remoteName;
279 PString userName;
280 PString password;
281 DWORD osError;
282
283 private:
284 PRemoteConnection(const PRemoteConnection &) { }
285 void operator=(const PRemoteConnection &) { }
286 void Construct();
287
288
289 // Include platform dependent part of class
290 #ifdef _WIN32
291 #include "msos/ptlib/remconn.h"
292 #else
293 #include "unix/ptlib/remconn.h"
294 #endif
295 };
296
297
298 #endif // P_REMCONN
299
300 #endif // PTLIB_REMOTECONNECTION_H
301
302
303 // End Of File ///////////////////////////////////////////////////////////////