PTLib
Version 2.10.4
|
00001 /* 00002 * remconn.h 00003 * 00004 * Remote networking connection class. 00005 * 00006 * Portable Windows Library 00007 * 00008 * Copyright (c) 1993-1998 Equivalence Pty. Ltd. 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Portable Windows Library. 00021 * 00022 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00023 * 00024 * Portions are Copyright (C) 1993 Free Software Foundation, Inc. 00025 * All Rights Reserved. 00026 * 00027 * Contributor(s): ______________________________________. 00028 * 00029 * $Revision: 24177 $ 00030 * $Author: rjongbloed $ 00031 * $Date: 2010-04-05 06:52:04 -0500 (Mon, 05 Apr 2010) $ 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 = false 00092 ); 00093 00096 PBoolean Open( 00097 const PString & name, 00098 PBoolean existing = false 00099 ); 00100 00103 PBoolean Open( 00104 const PString & name, 00105 const PString & username, 00106 const PString & password, 00107 PBoolean existing = false 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 = false 00246 ); 00247 00256 static Status SetConfiguration( 00257 const PString & name, 00258 const Configuration & config, 00259 PBoolean create = false 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 // Include platform dependent part of class 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 // End Of File ///////////////////////////////////////////////////////////////