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
00088
00089
00090 #ifndef _PREMOTECONNECTION
00091 #define _PREMOTECONNECTION
00092
00093 #ifdef P_USE_PRAGMA
00094 #pragma interface
00095 #endif
00096
00097 #include <ptlib/pipechan.h>
00098
00099 #ifdef _WIN32
00100 #include <ras.h>
00101 #include <raserror.h>
00102 #endif
00103
00106 class PRemoteConnection : public PObject
00107 {
00108 PCLASSINFO(PRemoteConnection, PObject);
00109
00110 public:
00113
00114 PRemoteConnection();
00115
00119 PRemoteConnection(
00120 const PString & name
00121 );
00122
00124 ~PRemoteConnection();
00126
00132 virtual Comparison Compare(
00133 const PObject & obj
00134 ) const;
00135
00139 virtual PINDEX HashFunction() const;
00141
00146 BOOL Open(
00147 BOOL existing = FALSE
00148 );
00149
00152 BOOL Open(
00153 const PString & name,
00154 BOOL existing = FALSE
00155 );
00156
00159 BOOL Open(
00160 const PString & name,
00161 const PString & username,
00162 const PString & password,
00163 BOOL existing = FALSE
00164 );
00165
00170 void Close();
00172
00175
00176 enum Status {
00178 Idle,
00180 Connected,
00182 InProgress,
00184 LineBusy,
00186 NoDialTone,
00188 NoAnswer,
00190 PortInUse,
00192 NoNameOrNumber,
00194 AccessDenied,
00196 HardwareFailure,
00198 GeneralFailure,
00200 ConnectionLost,
00202 NotInstalled,
00203 NumStatuses
00204 };
00205
00211 Status GetStatus() const;
00212
00218 DWORD GetErrorCode() const { return osError; }
00220
00228 const PString & GetName() const { return remoteName; }
00229
00235 PString GetAddress();
00236
00243 static PStringArray GetAvailableNames();
00245
00248
00249 struct Configuration {
00251 PString device;
00253 PString phoneNumber;
00255 PString ipAddress;
00257 PString dnsAddress;
00259 PString script;
00261 PINDEX subEntries;
00263 BOOL dialAllSubEntries;
00264 };
00265
00274 Status GetConfiguration(
00275 Configuration & config
00276 );
00277
00286 static Status GetConfiguration(
00287 const PString & name,
00288 Configuration & config
00289 );
00290
00299 Status SetConfiguration(
00300 const Configuration & config,
00301 BOOL create = FALSE
00302 );
00303
00312 static Status SetConfiguration(
00313 const PString & name,
00314 const Configuration & config,
00315 BOOL create = FALSE
00316 );
00317
00326 static Status RemoveConfiguration(
00327 const PString & name
00328 );
00330
00331 protected:
00332 PString remoteName;
00333 PString userName;
00334 PString password;
00335 DWORD osError;
00336
00337 private:
00338 PRemoteConnection(const PRemoteConnection &) { }
00339 void operator=(const PRemoteConnection &) { }
00340 void Construct();
00341
00342
00343
00344 #ifdef _WIN32
00345 #include "msos/ptlib/remconn.h"
00346 #else
00347 #include "unix/ptlib/remconn.h"
00348 #endif
00349 };
00350
00351 #endif
00352
00353