亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? netdiagnostics.c

?? 基于高通的brew平臺上的手機網絡診斷程序netdiagnostics
?? C
?? 第 1 頁 / 共 4 頁
字號:
/******************************************************************************
FILE:  NetDiagnostics.c

SERVICES:  Network Diagnostics example application

GENERAL DESCRIPTION:

PUBLIC CLASSES AND STATIC FUNCTIONS:
	Uses of INetMgr, ISocket, IHtmlViewer, IWeb, IWebOpts, IWebResp, ISource, 
   ISourceUtil, IPeek, IGetLine interfaces. 

INITIALIZATION & SEQUENCING REQUIREMENTS:

	See Exported Routines

     Copyright ?1999-2002 QUALCOMM Incorporated.
               All Rights Reserved.
            QUALCOMM Proprietary/GTDR
******************************************************************************/

//*****************************************************************************
// INCLUDE FILES
//*****************************************************************************
#include "AEEModGen.h"
#include "AEEAppGen.h"
#include "AEEFile.h"
#include "AEEHtmlViewer.h"
#include "AEEMenu.h"
#include "AEEShell.h"
#include "AEEStdLib.h"
#include "AEEText.h"
#include "AEEWeb.h"

#include "netdiagnostics.bid"
#include "netdiagnostics.brh"
#include "nmdef.h"

//*****************************************************************************
// DEFINITIONS
//*****************************************************************************

#define MAX_RES_STRING_BUF_SIZE               200  // Used for allocating resource string buffers
#define SPLASH_TIMER_DURATION                 750  // Number of milliseconds the splash screen is displayed
#define MAX_HIST                                9

#define IPPORT_ECHO                           7

// Special URL bases
#define JUMP_ECHOTEST      "test:echo"                // starts echo test (expects form data)
#define JUMP_HTTPTEST      "test:http"                // starts HTTP test (expects form data)
#define JUMP_MAIN          "file:///ND_MainMenu.htm"

#define WEBBER_USERAGENT   "NetDiagnostics/1.0 (built on "__DATE__")\r\n"

#define STREQ(a,b)         (!STRCMP(a,b))

#define FORALL(p,a)        for (p = (a) + ARRAY_SIZE(a) - 1; p >= (a); --p)

#define FOR_ALL_WEBACTIONS(pApp, var, exp)     {WebAction *var; FORALL(var, (pApp)->m_awa) { exp; } }


//*****************************************************************************
// ENUMERATED TYPE DEFINITIONS
//*****************************************************************************


//*****************************************************************************
// GLOBAL APPLICATION DATA STRUCTURES
//*****************************************************************************
typedef struct _CNetDiagnosticsApp CNetDiagnosticsApp;

typedef void (*PFNCLEANUP)(CNetDiagnosticsApp *);

// A WebAction holds state necessary to perform 1 IWeb transaction

typedef struct WebAction
{
   CNetDiagnosticsApp * pParent;          // my parent
   AEECallback          cb;            // how to call me back
              
   IWebResp *           piWResp;       // the answer I get from IWeb
   IGetLine *           piGetLine;     // the body of the response, if any
   int                  nLines;        // count of lines in response
   int                  nBytes;        // count of bytes in response

   uint32               uStart;
   uint32               uRecvStart;

   IPeek                *pipPostData;  // POST stream, if any
   char                 *pszPostData;  // POST string

} WebAction;

// Applet Struct

struct _CNetDiagnosticsApp
{
   AEEApplet            a;                      // Mandatory AEEApplet data member appears first
   IFileMgr *           m_pFileMgr;             // Pointer to the apps IFileMgr object
   AEERect              m_rc;                   // Device Screen Rect     
   IHtmlViewer *        m_pHTMLViewer;          // The HTMLViewer control used to display HTML text
   INetMgr *            m_pINetMgr;             // Pointer to INetMgr
   IStatic *            m_pIStatic;             // Used for displaying messages
   char *               m_ppszHistory[MAX_HIST]; // history list
   int                  m_cntHistory;           // number of entries currently in the history list
   PFNCLEANUP           m_pfnViewCleanup;       // function to clean up after test (NULL => no test)

   // Form data

   char *               m_pszFormData;          // this points to the memory block holding all values
   char *               m_pszHost;              // "HOST" field
   char *               m_pszURL;               // "URL" field
   char *               m_pszMsg;               // "MSG" field
   flg                  m_bRS:1;                // "RS" field: Display response if TRUE
   flg                  m_bRT:1;                // "RT" field: Display response time if TRUE
   flg                  m_bTCP:1;               // "PROTOCOL" field == "1":  Use TCP as protocol if TRUE
   uint16               m_nDataLength;          // length of pszMsg (calculated when set)

   // Echoer state
   
   uint16               m_nTCPIdx;              // Index used for sending TCP data
   uint32               m_nTotalTime;           // Total Time
   uint32               m_nSendTime;            // Time to Send Data
   uint32               m_nReceiveTime;         // Time to Receive Data
   AEEDNSResult         m_dnsr;                 // DNS Result
   AEECallback          m_cb;                   // Callback for DNS
   ISocket *            m_pISocket;             // Pointer to socket

   // HTTP test state

   IWeb *               m_pIWeb;                // Pointer to IWeb for HTTP Tests
   WebAction            m_awa[1];               // array of WebActions.  By changing the '1' to any 
                                                // number, you can attempt to kick off multiple Web 
                                                // transactions simultaneously, testing Keep-Alive,
                                                // multiple-POST Keep-Alives, NOWAITCONN, FORCENEW, 
                                                // and request queueing.
};

//*****************************************************************************
// FUNCTION DECLARATIONS
//*****************************************************************************

static boolean ND_InitAppData(CNetDiagnosticsApp * pApp);
static void    ND_FreeAppData(CNetDiagnosticsApp * pApp);

static boolean ND_HandleEvent(CNetDiagnosticsApp * pApp, AEEEvent eCode, uint16 wParam, uint32 dwParam);

static void    ND_NotifyCB( void* pvUser, HViewNotify* pHViewNotify );
static void    ND_GoTo(CNetDiagnosticsApp *pApp, const char *pszURL);

static void    ND_DisplaySplashScreen(CNetDiagnosticsApp * pApp);
static void    ND_DisplaySplashScreenCB(CNetDiagnosticsApp* pApp);
static void    ND_DisplayMenu(CNetDiagnosticsApp* pApp, const char *pszURL);
static void    ND_EchoCleanup(CNetDiagnosticsApp* pApp);
static void    ND_HTTPCleanup(CNetDiagnosticsApp* pApp);
static void    ND_StartTest(CNetDiagnosticsApp* pApp, const char* pszURL);

static void    Echoer_Start(CNetDiagnosticsApp * pApp);
static void    Echoer_TCPConnected(void *p, int nErr);
static void    Echoer_TCPConnect(CNetDiagnosticsApp * pApp);
static void    Echoer_TCPDNSConnect(void *p);
static void    Echoer_TCPWrite(CNetDiagnosticsApp * pApp);
static void    Echoer_TCPRead(CNetDiagnosticsApp * pApp);
static void    Echoer_UDPWrite(CNetDiagnosticsApp * pApp);
static void    Echoer_UDPDNSWrite(void *p);
static void    Echoer_UDPRead(CNetDiagnosticsApp * pApp);

static void    WebAction_Start(WebAction *pwa, char *pszUrl);
static void    WebAction_GotResp(void *p);
static void    WebAction_Header(void *p, const char *cpszName, GetLine *pglVal);
static void    WebAction_Status(void *p, WebStatus ws, void *pVal);
static void    WebAction_Stop(WebAction *pwa);
static void    WebAction_ReadLines(void *p);

//*****************************************************************************
// UTILITY FUNCTIONS
//****************************************************************************


// Free the old pointer and fill with STRDUP(pszNew)
//
static void StrReplace(char **ppsz, const char *pszNew)
{
   FREE(*ppsz);   // FREE(NULL) is okay in BREW
   *ppsz = (pszNew ? STRDUP(pszNew) : (char*)pszNew);
}


static void ND_Print(CNetDiagnosticsApp *pApp, char *pszFmt, ...)
{
   char buf[512];
   va_list argptr;
   va_start(argptr, pszFmt);

   if( pApp->m_pIStatic )
   {
      if (VSNPRINTF(buf, sizeof(buf), pszFmt, argptr) >= 0) {
         ISTATIC_SetTextEx(pApp->m_pIStatic, (byte*)buf, NULL, TRUE);
         ISTATIC_Redraw(pApp->m_pIStatic);
      }
   }
   va_end(argptr);
}


//*****************************************************************************
// APPLICATION-WIDE INITIALIZATION/CLEANUP FUNCTIONS
//****************************************************************************

/*===========================================================================

FUNCTION: AEEClsCreateInstance

DESCRIPTION:
	This function is invoked while the app is being loaded. All Modules must provide this 
	function. Ensure to retain the same name and parameters for this function.
	In here, the module must verify the ClassID and then invoke the AEEApplet_New() function
	that has been provided in AEEAppGen.c. 

  After invoking AEEApplet_New(), this function can do app specific initialization. In this
  example, a generic structure is provided so that app developers need not change app specific
  initialization section every time except for a call to ND_InitAppData(). 
  This is done as follows: ND_InitAppData() is called to initialize AppletData 
  instance. It is app developers responsibility to fill-in app data initialization 
  code of ND_InitAppData(). App developer is also responsible to release memory 
  allocated for data contained in AppletData -- this can be done in 
  ND_FreeAppData().

PARAMETERS:
	clsID [in] - Specifies the ClassID of the applet which is being loaded

	pIShell [in] - Contains pointer to the IShell interface. 

	pIModule [pin] - Contains pointer to the IModule interface to the current module to which
    this app belongs

	ppObj [out] - On return, *ppObj must point to a valid IApplet structure. Allocation
	  of memory for this structure and initializing the base data members is done by AEEApplet_New().

DEPENDENCIES:
  None

RETURN VALUE:
  AEE_SUCCESS - If the app needs to be loaded and if AEEApplet_New() invocation was
     successful
  EFAILED - If the app does not need to be loaded or if errors occurred in 
     AEEApplet_New(). If this function returns FALSE, the app will not be loaded.

SIDE EFFECTS:
  None
===========================================================================*/
int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj)
{
   CNetDiagnosticsApp *   pApp = NULL; 

   if(!AEEApplet_New(sizeof(CNetDiagnosticsApp), ClsId, pIShell,po,(IApplet**)ppObj,(AEEHANDLER)ND_HandleEvent,(PFNFREEAPPDATA)ND_FreeAppData))
      return ENOMEMORY;
	
   pApp = (CNetDiagnosticsApp *)*ppObj;

   if (!ND_InitAppData(pApp)) {
      *ppObj = NULL;
		return EFAILED;
   }

   return(AEE_SUCCESS);
}

/*===========================================================================

FUNCTION: ND_InitAppData

DESCRIPTION:
  This function initializes app specific data allocates memory for app data 
  (AppletData) and sets it to pAppData of AEEApplet. It also functions to 
  create all necessary GUI objects.

PARAMETERS:
	pi [in] - Pointer to the IApplet structure. This structure contains 
    information specific to this applet. It was initialized during the 
    AEEClsCreateInstance().

DEPENDENCIES:
  Assumes pi is not NULL

RETURN VALUE:
  TRUE: If the app has app data is allocated and initialized successfully
  FALSE: Either app data could not be allocated or initialzied

SIDE EFFECTS:
  None
===========================================================================*/
static boolean ND_InitAppData(CNetDiagnosticsApp * pApp)
{
   AEEDeviceInfo di;
   IShell * pIShell = pApp->a.m_pIShell;

   // Create each of the controls used by the application.
   if((ISHELL_CreateInstance(pIShell, AEECLSID_FILEMGR, (void**)(&pApp->m_pFileMgr)) != SUCCESS) ||
      (ISHELL_CreateInstance(pIShell, AEECLSID_HTML, (void**)(&pApp->m_pHTMLViewer)) != SUCCESS) ||
      (ISHELL_CreateInstance(pIShell, AEECLSID_NET, (void**)(&pApp->m_pINetMgr)) != SUCCESS) ||
      (ISHELL_CreateInstance(pIShell, AEECLSID_WEB, (void **)(&pApp->m_pIWeb)) != SUCCESS))
   {
      IAPPLET_Release((IApplet*)pApp);
      return FALSE;
   }

   // Set callback for HTML viewer
   IHTMLVIEWER_SetNotifyFn(pApp->m_pHTMLViewer, (PFNHVIEWNOTIFY)ND_NotifyCB, pApp);
   IHTMLVIEWER_SetProperties(pApp->m_pHTMLViewer, HVP_SCROLLBAR);

   // Get device screen rect
   ISHELL_GetDeviceInfo(pApp->a.m_pIShell, &di);
   SETAEERECT(&pApp->m_rc, 0, 0, di.cxScreen, di.cyScreen);

   pApp->m_nTotalTime = pApp->m_nSendTime = pApp->m_nReceiveTime = 0;

   // Set Default
   pApp->m_bRS = pApp->m_bRT = pApp->m_bTCP = FALSE;

   // Initialize the IWeb with a few options
   {
      int    i = 0;
      WebOpt awo[10]; 

      // set the IWeb connect timeout to 10 seconds.  this also sets the 
      // failover timeout, if unset, or set to 0, IWeb uses the system 
      // default (30 seconds unless an OEM changes it)
      awo[i].nId  = WEBOPT_CONNECTTIMEOUT;
      awo[i].pVal = (void *)10000;
      i++;

      // test user-agent, uncomment this section to ship your own user-agent 
      // string. if unset, IWeb will send a default.  If set to NULL, no 
      // user agent header will be sent */

      // Set TEST_USER_AGENT in the NetDiagnostics project settings to all
      // shipping of your own user agent.

#ifdef TEST_USER_AGENT
      awo[i].nId  = WEBOPT_USERAGENT;
      awo[i].pVal = (void *)WEBBER_USERAGENT;
      i++;
#endif 

      // test nowaitconn, this only comes into effect if you build webber 
      // with multiple WebActions (see the definition of struct Webber)
      awo[i].nId  = WEBOPT_FLAGS;
      awo[i].pVal = (void *)WEBREQUEST_NOWAITCONN;
      i++;
      

      // test forcenew, uncomment this section to try multiple simultaneous
      // "forced" new connections. Forced new connections are not kept alive
      // unless they are the first forced new connection to a host
#ifdef TEST_FORCENEWCONN
      awo[i].nId  = WEBOPT_FLAGS;
      awo[i].pVal = (void *)WEBREQUEST_FORCENEWCONN;
      i++;
#endif 


      // turn off HTTP over HTTP proxying
      awo[i].nId  = WEBOPT_PROXYSPEC;
      awo[i].pVal = (void *)"http:///";
      i++;

      // turn on ALL proxying.  Proxyspecs are examined in WebOpt
      // order, so in this list, with the above and below PROXYSPECs,
      // everything except HTTP will be proxied through
      // http://webproxy.yourdomain.com:8080, (which you'll have to
      // set up to test, sorry
      awo[i].nId  = WEBOPT_PROXYSPEC;
      awo[i].pVal = (void *)"*:///http://webproxy.yourdomain.com:8080";
      i++;

      // Marks the end of the array of WebOpts
      awo[i].nId  = WEBOPT_END;
      
      // Add Options
      IWEB_AddOpt(pApp->m_pIWeb,awo);
   }

   // Initialize all my WebActions to point to NetDiagnostics applet
   FOR_ALL_WEBACTIONS(pApp, p, p->pParent = pApp);

   return TRUE;
}

/*===========================================================================

FUNCTION: ND_FreeAppData

DESCRIPTION:
  Frees data contained in app data and memory for app data itself.
  App developer needs to free data contained in AppletData.

PARAMETERS:
	pi [in] - Pointer to the IApplet structure. This structure contains 
    information specific to this applet. It was initialized during the 
    AEEClsCreateInstance().

DEPENDENCIES:
   Assumes pi is not NULL

RETURN VALUE:
   None

SIDE EFFECTS:
   None
===========================================================================*/
static void ReleaseObj(void ** ppObj)
{
   if (*ppObj) {
      (void)IBASE_Release(((IBase *)*ppObj));
      *ppObj = NULL;
   }
}

static void ND_FreeAppData( CNetDiagnosticsApp* pApp )
{
   int i;

   // Socket callbacks: Deleting the socket cancels any callbacks.  During app
   // cleanup, *all* references to the socket must be released, so the socket
   // will be deleted and canceling callbacks is not necessary.

   if (pApp->m_pfnViewCleanup) {
      pApp->m_pfnViewCleanup(pApp);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品欧美激情| 国产一区三区三区| 亚洲精品写真福利| 亚洲欧美日韩国产综合| 亚洲丝袜精品丝袜在线| 亚洲欧洲99久久| 日韩伦理免费电影| 亚洲人吸女人奶水| 一区二区三区波多野结衣在线观看| 中文字幕一区二区三区四区不卡| 中文字幕一区二区三区在线观看 | 国产精品久线观看视频| 精品国产凹凸成av人导航| 精品成人一区二区三区| 亚洲精品在线免费观看视频| 精品久久人人做人人爽| 日本一区二区视频在线观看| 国产嫩草影院久久久久| 国产精品福利一区二区| 亚洲永久免费av| 日本女人一区二区三区| 黑人精品欧美一区二区蜜桃| 国产91精品精华液一区二区三区 | 日韩午夜av电影| 日韩欧美国产系列| 久久亚洲一区二区三区四区| 亚洲欧洲日韩在线| 亚洲一级电影视频| 免费成人性网站| 国产精品一区二区久激情瑜伽| 99久久精品国产精品久久| 欧美亚洲国产一区二区三区va | 91精品啪在线观看国产60岁| 日韩视频免费观看高清完整版在线观看| 欧美不卡一区二区三区| 国产精品水嫩水嫩| 天堂蜜桃91精品| 国产91精品在线观看| 欧洲视频一区二区| 精品国产乱码久久久久久影片| 国产精品色哟哟| 亚洲尤物视频在线| 国产一区二区三区不卡在线观看 | 久久激情五月婷婷| 99热这里都是精品| 欧美一级欧美一级在线播放| 国产欧美精品一区二区色综合 | 国产午夜三级一区二区三| 亚洲欧美电影院| 美女视频黄a大片欧美| 成人美女在线视频| 69堂精品视频| 国产精品国产三级国产aⅴ中文| 婷婷丁香激情综合| 国产盗摄精品一区二区三区在线 | 亚洲国产成人自拍| 午夜影院在线观看欧美| 国产·精品毛片| 亚洲色图19p| 奇米888四色在线精品| av成人免费在线| 日韩欧美123| 一区二区三区中文在线观看| 国产美女娇喘av呻吟久久| 欧美色爱综合网| 国产精品美女久久久久久久| 美国一区二区三区在线播放| 色综合久久精品| 日本一区二区三区免费乱视频 | av一区二区三区| 日韩免费看网站| 无吗不卡中文字幕| 99re成人在线| 国产欧美精品国产国产专区 | 色av综合在线| 国产亚洲欧洲997久久综合| 三级在线观看一区二区| 91浏览器在线视频| 国产日韩v精品一区二区| 奇米影视7777精品一区二区| 欧美视频在线一区二区三区| 中文字幕综合网| 成人国产精品免费网站| 久久久www成人免费毛片麻豆| 日韩精品电影一区亚洲| 欧美日韩亚洲国产综合| 亚洲免费观看高清完整版在线观看熊 | 国产三级一区二区三区| 美国一区二区三区在线播放| 91精品一区二区三区久久久久久| 亚洲激情五月婷婷| 91色.com| 亚洲女同一区二区| www.66久久| 中文字幕一区二区三区四区不卡 | 美女久久久精品| 欧美精选午夜久久久乱码6080| 亚洲乱码国产乱码精品精小说 | 久久久亚洲高清| 精品一区二区三区在线观看国产| 69堂精品视频| 蜜臀av一区二区| 日韩欧美一二三| 精品一区二区成人精品| 亚洲精品一区二区三区四区高清| 青娱乐精品视频| 欧美不卡一区二区| 国模娜娜一区二区三区| 久久嫩草精品久久久久| 国产精品香蕉一区二区三区| 欧美激情一区二区三区| 成人18视频日本| 亚洲精品自拍动漫在线| 欧美日韩午夜在线| 日韩精品一二三| 精品久久久久久久人人人人传媒| 韩国一区二区在线观看| 欧美激情综合网| 色综合天天综合色综合av| 悠悠色在线精品| 欧美区在线观看| 国产综合色在线| 国产精品网曝门| 91福利在线看| 美女国产一区二区三区| 国产农村妇女毛片精品久久麻豆| 91小宝寻花一区二区三区| 亚洲一级二级三级| 日韩精品中文字幕一区二区三区| 国产精品自在在线| 亚洲人成网站精品片在线观看| 欧美日韩一区二区三区四区五区| 日韩黄色片在线观看| 久久精品亚洲精品国产欧美| 成年人午夜久久久| 午夜久久久影院| 久久久影院官网| 色欧美日韩亚洲| 蜜桃视频一区二区| 国产精品二三区| 7799精品视频| 成人午夜在线播放| 亚洲国产成人91porn| 精品成人一区二区三区| 色网站国产精品| 国产综合色在线| 亚洲一级不卡视频| 国产亚洲一二三区| 欧美亚洲综合网| 国产不卡在线一区| 香蕉成人啪国产精品视频综合网| 国产午夜亚洲精品羞羞网站| 欧美日韩一级片在线观看| 国产精品77777| 亚洲成av人片在线观看无码| 国产日韩欧美精品一区| 欧美日韩美少妇| 丁香啪啪综合成人亚洲小说| 日韩黄色片在线观看| 中文字幕在线不卡一区 | 悠悠色在线精品| 久久久久99精品国产片| 欧美日韩免费在线视频| 国产成人亚洲综合色影视| 亚洲成av人片在www色猫咪| 亚洲国产成人午夜在线一区| 欧美一区二区三区思思人| 91麻豆国产福利在线观看| 久久99精品国产.久久久久久| 亚洲精品午夜久久久| 国产色综合久久| 日韩亚洲欧美综合| 在线欧美小视频| av在线不卡免费看| 精品一区二区三区在线观看国产| 亚洲国产另类精品专区| 国产精品久久久久桃色tv| 欧美不卡一二三| 欧美精品久久一区| 色婷婷综合视频在线观看| 国产成人免费在线视频| 激情综合网av| 肉肉av福利一精品导航| 一区二区三区中文在线| 亚洲欧洲av一区二区三区久久| 久久久91精品国产一区二区精品| 欧美一级日韩不卡播放免费| 欧美日韩黄视频| 欧美视频在线观看一区| 色八戒一区二区三区| 99在线视频精品| 成人听书哪个软件好| 国产一区二区网址| 久久国产人妖系列| 日本不卡123| 日产精品久久久久久久性色| 天天色综合成人网| 丝袜亚洲精品中文字幕一区| 亚洲福利电影网| 石原莉奈在线亚洲三区|