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

Generated on Fri Mar 7 06:25:02 2008 for PTLib by  doxygen 1.5.1