Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

remconn.h

Go to the documentation of this file.
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  * $Log: remconn.h,v $
00030  * Revision 1.17  2003/09/17 05:41:59  csoutheren
00031  * Removed recursive includes
00032  *
00033  * Revision 1.16  2003/09/17 01:18:02  csoutheren
00034  * Removed recursive include file system and removed all references
00035  * to deprecated coooperative threading support
00036  *
00037  * Revision 1.15  2002/09/16 01:08:59  robertj
00038  * Added #define so can select if #pragma interface/implementation is used on
00039  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00040  *
00041  * Revision 1.14  2001/05/22 12:49:32  robertj
00042  * Did some seriously wierd rewrite of platform headers to eliminate the
00043  *   stupid GNU compiler warning about braces not matching.
00044  *
00045  * Revision 1.13  1999/03/09 02:59:50  robertj
00046  * Changed comments to doc++ compatible documentation.
00047  *
00048  * Revision 1.12  1999/02/16 08:11:10  robertj
00049  * MSVC 6.0 compatibility changes.
00050  *
00051  * Revision 1.11  1998/09/23 06:21:17  robertj
00052  * Added open source copyright license.
00053  *
00054  * Revision 1.10  1998/07/24 06:58:27  robertj
00055  * Added ability to get IP number of RAS connection.
00056  *
00057  * Revision 1.9  1998/02/03 06:28:46  robertj
00058  * Added more error codes.
00059  *
00060  * Revision 1.8  1998/01/26 00:34:51  robertj
00061  * Added parameter to PRemoteConnection to open only if already connected.
00062  * Added function to PRemoteConnection to get at OS error code.
00063  *
00064  * Revision 1.7  1997/04/01 06:00:05  robertj
00065  * Added Remove Configuration.
00066  *
00067  * Revision 1.6  1997/01/12 04:15:11  robertj
00068  * Added ability to add/change new connections.
00069  *
00070  * Revision 1.5  1996/11/04 03:40:43  robertj
00071  * Added more debugging for remote drop outs.
00072  *
00073  * Revision 1.4  1996/08/11 07:03:45  robertj
00074  * Changed remote connection to late bind DLL.
00075  *
00076  * Revision 1.3  1996/04/23 11:33:04  robertj
00077  * Added username and password.
00078  *
00079  * Revision 1.2  1996/03/02 03:09:48  robertj
00080  * Added function to get all possible remote access connection names.
00081  *
00082  * Revision 1.1  1995/12/10 13:04:46  robertj
00083  * Initial revision
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  // Configuration of remote connection
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 // Include platform dependent part of class
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 // End Of File ///////////////////////////////////////////////////////////////

Generated on Wed Sep 28 10:27:33 2005 for PWLib by  doxygen 1.4.4