netchck.h
Upload User: dangjiwu
Upload Date: 2013-07-19
Package Size: 42019k
Code Size: 6k
Category:

Symbian

Development Platform:

Visual C++

  1. /* ***** BEGIN LICENSE BLOCK *****
  2.  * Source last modified: $Id: netchck.h,v 1.1.1.1.58.1 2004/07/09 02:07:52 hubbe Exp $
  3.  * 
  4.  * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
  5.  * 
  6.  * The contents of this file, and the files included with this file,
  7.  * are subject to the current version of the RealNetworks Public
  8.  * Source License (the "RPSL") available at
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed
  10.  * the file under the current version of the RealNetworks Community
  11.  * Source License (the "RCSL") available at
  12.  * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
  13.  * will apply. You may also obtain the license terms directly from
  14.  * RealNetworks.  You may not use this file except in compliance with
  15.  * the RPSL or, if you have a valid RCSL with RealNetworks applicable
  16.  * to this file, the RCSL.  Please see the applicable RPSL or RCSL for
  17.  * the rights, obligations and limitations governing use of the
  18.  * contents of the file.
  19.  * 
  20.  * Alternatively, the contents of this file may be used under the
  21.  * terms of the GNU General Public License Version 2 or later (the
  22.  * "GPL") in which case the provisions of the GPL are applicable
  23.  * instead of those above. If you wish to allow use of your version of
  24.  * this file only under the terms of the GPL, and not to allow others
  25.  * to use your version of this file under the terms of either the RPSL
  26.  * or RCSL, indicate your decision by deleting the provisions above
  27.  * and replace them with the notice and other provisions required by
  28.  * the GPL. If you do not delete the provisions above, a recipient may
  29.  * use your version of this file under the terms of any one of the
  30.  * RPSL, the RCSL or the GPL.
  31.  * 
  32.  * This file is part of the Helix DNA Technology. RealNetworks is the
  33.  * developer of the Original Code and owns the copyrights in the
  34.  * portions it created.
  35.  * 
  36.  * This file, and the files included with this file, is distributed
  37.  * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
  38.  * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
  39.  * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
  40.  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
  41.  * ENJOYMENT OR NON-INFRINGEMENT.
  42.  * 
  43.  * Technology Compatibility Kit Test Suite(s) Location:
  44.  *    http://www.helixcommunity.org/content/tck
  45.  * 
  46.  * Contributor(s):
  47.  * 
  48.  * ***** END LICENSE BLOCK ***** */
  49. #ifndef _NETCHCK_H
  50. #define _NETCHCK_H
  51. #include "xnetchck.h"
  52. #include "hxengin.h"
  53. #include "hxstring.h"
  54. #ifndef _WIN16
  55. #include <ras.h>
  56. #ifndef __PNDX5032_H__
  57. #define __PNDX5032_H__
  58. #define _16BIT_DLLNAME "PNDX5016.DLL"
  59. #define _32BIT_DLLNAME "PNDX5032.DLL"
  60. #define WININET_DLL "WININET.DLL"
  61. #ifdef _WIN32
  62. #define DLLEXPORT __declspec(dllexport)
  63. extern "C" DLLEXPORT DWORD WINAPI GetDevNodeStatus32Call(LPSTR szDeviceID, LPDWORD pdwStatus, LPDWORD pdwProblemNumber);
  64. #endif
  65. #endif // __PNDX5032_H__
  66. // horrible netcard hack stuff
  67. #ifndef _WINCE
  68. #include "regstr.h"
  69. #endif
  70. #define STRINGSIZE  256
  71. #define ENUM_MAX  6
  72. #define DRIVERFILENAMELENGTH STRINGSIZE
  73. #define ADAPTERSTRINGLENGTH STRINGSIZE
  74. #define BACKSLASH   "\"
  75. ////////////////////////////////////
  76. typedef DWORD (HXEXPORT_PTR FPRASENUMCONNECTIONS)(LPRASCONN lpRasConn, LPDWORD lpcb, 
  77. LPDWORD lpcConnections);
  78. typedef DWORD (HXEXPORT_PTR FPRASENUMENTRIES)(LPTSTR reserver, LPTSTR lpszPhonebook, 
  79.     LPRASENTRYNAME lpRasEntryname, LPDWORD lpcb, LPDWORD lpcEntries);
  80. typedef DWORD (HXEXPORT_PTR FPRASENUMDEVICES)(LPRASDEVINFO lpRasDevInfo, LPDWORD lpcb, LPDWORD lpcDevices);
  81. #endif
  82. class CHXNetCheck : public XHXNetCheck, public IHXTCPResponse
  83. {
  84. public:
  85. CHXNetCheck(UINT32 timeout = 30000);
  86. virtual ~CHXNetCheck();
  87. virtual BOOL FInternetAvailable(BOOL fPing = FALSE, BOOL fProxy = FALSE);
  88. BOOL Ping(const char *szHostName, UINT16 nPort, BOOL fAsynchronous);
  89. BOOL SmartPing();
  90. void SleepWell(ULONG32 ulInterval);
  91. void GetDNSAddress(CHXString& strDNS);
  92. #ifndef _WIN16
  93. void GetNameServerKey(HKEY hKey, const char* szKeyName, CHXString& strDNS);
  94. #endif
  95. HX_RESULT Init(IUnknown *pContext);
  96.     /*
  97.      *  IUnknown methods
  98.      */
  99.     STDMETHOD(QueryInterface) (THIS_
  100. REFIID riid,
  101. void** ppvObj);
  102.     STDMETHOD_(ULONG32,AddRef) (THIS);
  103.     STDMETHOD_(ULONG32,Release) (THIS);
  104.     /*
  105.      * IHXTCPResponse methods
  106.      */
  107.     /************************************************************************
  108.      * Method:
  109.      *     IHXTCPResponse::ConnectDone
  110.      * Purpose:
  111.      *     A Connect operation has been completed or an error has occurred.
  112.      */
  113.     STDMETHOD(ConnectDone) (THIS_
  114. HX_RESULT status);
  115.     /************************************************************************
  116.      * Method:
  117.      *     IHXTCPResponse::ReadDone
  118.      * Purpose:
  119.      *     A Read operation has been completed or an error has occurred.
  120.      *     The data is returned in the IHXBuffer.
  121.      */
  122.     STDMETHOD(ReadDone) (THIS_
  123. HX_RESULT status,
  124. IHXBuffer* pBuffer);
  125.     /************************************************************************
  126.      * Method:
  127.      *     IHXTCPResponse::WriteReady
  128.      * Purpose:
  129.      *     This is the response method for WantWrite.
  130.      *     If HX_RESULT is ok, then the TCP channel is ok to Write to.
  131.      */
  132.     STDMETHOD(WriteReady) (THIS_
  133.      HX_RESULT status);
  134.     /************************************************************************
  135.      * Method:
  136.      *     IHXTCPResponse::Closed
  137.      * Purpose:
  138.      *     This method is called to inform you that the TCP channel has
  139.      *     been closed by the peer or closed due to error.
  140.      */
  141.     STDMETHOD(Closed) (THIS_
  142. HX_RESULT status);
  143. protected:
  144. IHXNetworkServices *m_pRmaNetServices;
  145. IHXTCPSocket *m_pRmaTCPSocket;
  146. LONG32       m_lRefCount;
  147. IUnknown  *m_pContext;
  148. BOOL  m_fConnected;
  149. BOOL m_fFailed;
  150. BOOL FNetCardActive();
  151. BOOL DevNodeIsActive(const char *szDeviceID);
  152. HX_RESULT WinInetGetConnected(BOOL& bConnected);
  153. #ifndef _WIN16
  154. HMODULE m_hRasApiModule;
  155. FPRASENUMCONNECTIONS m_pRasEnumConnections;
  156. #endif
  157. };
  158. #endif //_NETCHCK_H