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
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 #ifndef _PREMOTECONNECTION
00088 #define _PREMOTECONNECTION
00089
00090 #ifdef P_USE_PRAGMA
00091 #pragma interface
00092 #endif
00093
00094 #include <ptlib/pipechan.h>
00095
00096 #ifdef _WIN32
00097 #include <ras.h>
00098 #include <raserror.h>
00099 #endif
00100
00103 class PRemoteConnection : public PObject
00104 {
00105 PCLASSINFO(PRemoteConnection, PObject);
00106
00107 public:
00110
00111 PRemoteConnection();
00112
00116 PRemoteConnection(
00117 const PString & name
00118 );
00119
00121 ~PRemoteConnection();
00123
00129 virtual Comparison Compare(
00130 const PObject & obj
00131 ) const;
00132
00136 virtual PINDEX HashFunction() const;
00138
00143 BOOL Open(
00144 BOOL existing = FALSE
00145 );
00146
00149 BOOL Open(
00150 const PString & name,
00151 BOOL existing = FALSE
00152 );
00153
00156 BOOL Open(
00157 const PString & name,
00158 const PString & username,
00159 const PString & password,
00160 BOOL existing = FALSE
00161 );
00162
00167 void Close();
00169
00172
00173 enum Status {
00175 Idle,
00177 Connected,
00179 InProgress,
00181 LineBusy,
00183 NoDialTone,
00185 NoAnswer,
00187 PortInUse,
00189 NoNameOrNumber,
00191 AccessDenied,
00193 HardwareFailure,
00195 GeneralFailure,
00197 ConnectionLost,
00199 NotInstalled,
00200 NumStatuses
00201 };
00202
00208 Status GetStatus() const;
00209
00215 DWORD GetErrorCode() const { return osError; }
00217
00225 const PString & GetName() const { return remoteName; }
00226
00232 PString GetAddress();
00233
00240 static PStringArray GetAvailableNames();
00242
00245
00246 struct Configuration {
00248 PString device;
00250 PString phoneNumber;
00252 PString ipAddress;
00254 PString dnsAddress;
00256 PString script;
00258 PINDEX subEntries;
00260 BOOL dialAllSubEntries;
00261 };
00262
00271 Status GetConfiguration(
00272 Configuration & config
00273 );
00274
00283 static Status GetConfiguration(
00284 const PString & name,
00285 Configuration & config
00286 );
00287
00296 Status SetConfiguration(
00297 const Configuration & config,
00298 BOOL create = FALSE
00299 );
00300
00309 static Status SetConfiguration(
00310 const PString & name,
00311 const Configuration & config,
00312 BOOL create = FALSE
00313 );
00314
00323 static Status RemoveConfiguration(
00324 const PString & name
00325 );
00327
00328 protected:
00329 PString remoteName;
00330 PString userName;
00331 PString password;
00332 DWORD osError;
00333
00334 private:
00335 PRemoteConnection(const PRemoteConnection &) { }
00336 void operator=(const PRemoteConnection &) { }
00337 void Construct();
00338
00339
00340
00341 #ifdef _WIN32
00342 #include "msos/ptlib/remconn.h"
00343 #else
00344 #include "unix/ptlib/remconn.h"
00345 #endif
00346 };
00347
00348 #endif
00349
00350