00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef PTLIB_REMOTECONNECTION_H
00035 #define PTLIB_REMOTECONNECTION_H
00036
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040
00041 #include <ptlib/pipechan.h>
00042
00043 #ifdef _WIN32
00044 #include <ras.h>
00045 #include <raserror.h>
00046 #endif
00047
00050 class PRemoteConnection : public PObject
00051 {
00052 PCLASSINFO(PRemoteConnection, PObject);
00053
00054 public:
00057
00058 PRemoteConnection();
00059
00063 PRemoteConnection(
00064 const PString & name
00065 );
00066
00068 ~PRemoteConnection();
00070
00076 virtual Comparison Compare(
00077 const PObject & obj
00078 ) const;
00079
00083 virtual PINDEX HashFunction() const;
00085
00090 PBoolean Open(
00091 PBoolean existing = PFalse
00092 );
00093
00096 PBoolean Open(
00097 const PString & name,
00098 PBoolean existing = PFalse
00099 );
00100
00103 PBoolean Open(
00104 const PString & name,
00105 const PString & username,
00106 const PString & password,
00107 PBoolean existing = PFalse
00108 );
00109
00114 void Close();
00116
00119
00120 enum Status {
00122 Idle,
00124 Connected,
00126 InProgress,
00128 LineBusy,
00130 NoDialTone,
00132 NoAnswer,
00134 PortInUse,
00136 NoNameOrNumber,
00138 AccessDenied,
00140 HardwareFailure,
00142 GeneralFailure,
00144 ConnectionLost,
00146 NotInstalled,
00147 NumStatuses
00148 };
00149
00155 Status GetStatus() const;
00156
00162 DWORD GetErrorCode() const { return osError; }
00164
00172 const PString & GetName() const { return remoteName; }
00173
00179 PString GetAddress();
00180
00187 static PStringArray GetAvailableNames();
00189
00192
00193 struct Configuration {
00195 PString device;
00197 PString phoneNumber;
00199 PString ipAddress;
00201 PString dnsAddress;
00203 PString script;
00205 PINDEX subEntries;
00207 PBoolean dialAllSubEntries;
00208 };
00209
00218 Status GetConfiguration(
00219 Configuration & config
00220 );
00221
00230 static Status GetConfiguration(
00231 const PString & name,
00232 Configuration & config
00233 );
00234
00243 Status SetConfiguration(
00244 const Configuration & config,
00245 PBoolean create = PFalse
00246 );
00247
00256 static Status SetConfiguration(
00257 const PString & name,
00258 const Configuration & config,
00259 PBoolean create = PFalse
00260 );
00261
00270 static Status RemoveConfiguration(
00271 const PString & name
00272 );
00274
00275 protected:
00276 PString remoteName;
00277 PString userName;
00278 PString password;
00279 DWORD osError;
00280
00281 private:
00282 PRemoteConnection(const PRemoteConnection &) { }
00283 void operator=(const PRemoteConnection &) { }
00284 void Construct();
00285
00286
00287
00288 #ifdef _WIN32
00289 #include "msos/ptlib/remconn.h"
00290 #else
00291 #include "unix/ptlib/remconn.h"
00292 #endif
00293 };
00294
00295
00296 #endif // PTLIB_REMOTECONNECTION_H
00297
00298
00299