亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲在线免费播放| jizzjizzjizz欧美| 99久久精品免费看| 日韩精品中文字幕一区二区三区 | 久久综合色8888| 一区二区三区高清在线| 国产精选一区二区三区| 欧美日本视频在线| 综合久久给合久久狠狠狠97色 | 天天影视网天天综合色在线播放| 高清不卡在线观看av| 日韩免费一区二区三区在线播放| 亚洲一区二区三区四区的 | 欧美日本一区二区在线观看| 国产精品国产三级国产有无不卡 | 国产高清视频一区| 日韩欧美一区二区在线视频| 亚洲国产人成综合网站| 91美女福利视频| 18欧美亚洲精品| 成人一区二区视频| 国产午夜精品一区二区三区四区| 韩国理伦片一区二区三区在线播放| 欧美另类久久久品| 日韩和欧美一区二区| 欧美午夜电影网| 亚洲第四色夜色| 4438成人网| 美女视频一区二区| 精品久久久久香蕉网| 久久99久久精品| 日韩精品中文字幕在线不卡尤物 | 久久综合资源网| 国产毛片精品一区| 国产日本欧美一区二区| 国产不卡在线视频| 中文字幕亚洲精品在线观看| 成人国产精品免费观看| 亚洲免费资源在线播放| 色婷婷av久久久久久久| 亚洲成a人片在线不卡一二三区| 欧美无砖砖区免费| 视频一区二区中文字幕| 日韩精品一区二区三区在线播放 | 亚洲精品视频一区| 在线一区二区视频| 亚洲午夜久久久久久久久电影网 | 日韩精品中文字幕在线不卡尤物| 久久成人综合网| 国产欧美日韩另类一区| 91网站黄www| 亚洲成a人v欧美综合天堂| 日韩一级免费观看| 精品午夜久久福利影院| 国产女人18水真多18精品一级做 | 精品中文av资源站在线观看| 国产欧美日韩在线| 91福利国产成人精品照片| 蜜桃久久精品一区二区| 国产精品素人视频| 欧美三级日韩在线| 国产精品一区二区在线看| 亚洲欧美视频在线观看| 日韩欧美一区电影| av网站一区二区三区| 偷拍一区二区三区四区| 欧美国产在线观看| 欧美午夜精品一区二区三区| 国产一区二区三区黄视频| 亚洲少妇最新在线视频| 欧美v日韩v国产v| 91片黄在线观看| 国产一区二区三区在线观看免费 | av资源网一区| 日本欧美在线观看| 最新成人av在线| 欧美精品一区二区三区四区| 在线观看亚洲一区| 粉嫩av亚洲一区二区图片| 秋霞国产午夜精品免费视频| 中文字幕成人av| 欧美tickling挠脚心丨vk| 色又黄又爽网站www久久| 国产一区 二区 三区一级| 亚洲一区二区视频在线观看| 国产免费成人在线视频| 日韩欧美国产电影| 日本韩国一区二区三区| 成人午夜激情影院| 麻豆精品蜜桃视频网站| 亚洲一区二区三区爽爽爽爽爽| 中文在线资源观看网站视频免费不卡| 欧美乱熟臀69xxxxxx| 色婷婷久久一区二区三区麻豆| 国产成人日日夜夜| 精品一区二区三区影院在线午夜| 亚洲一二三区视频在线观看| 中文字幕在线免费不卡| 国产精品网站一区| 国产视频一区在线播放| 亚洲精品一区二区三区香蕉| 宅男在线国产精品| 制服丝袜成人动漫| 欧美日韩视频在线第一区 | 91麻豆国产自产在线观看| 国产成人啪免费观看软件| 久久精品国产亚洲aⅴ| 视频一区中文字幕国产| 天天影视涩香欲综合网| 婷婷开心激情综合| 日韩av电影一区| 三级在线观看一区二区| 免费日韩伦理电影| 麻豆精品国产传媒mv男同| 久久99精品久久久久| 久久9热精品视频| 国产综合久久久久久久久久久久| 另类的小说在线视频另类成人小视频在线| 五月天激情综合| 秋霞影院一区二区| 国产一区美女在线| 国产一区不卡在线| 国产ts人妖一区二区| 99久久精品国产导航| 91激情在线视频| 欧美精品三级日韩久久| 欧美不卡激情三级在线观看| 国产欧美一区二区精品仙草咪| 国产欧美日产一区| 中文字幕一区二| 亚洲123区在线观看| 另类小说综合欧美亚洲| 国产91精品一区二区麻豆网站| 91女人视频在线观看| 欧美三级欧美一级| 欧美成人精精品一区二区频| 国产人久久人人人人爽| 亚洲欧美色图小说| 蜜桃在线一区二区三区| 国产suv精品一区二区883| 972aa.com艺术欧美| 欧美性受xxxx黑人xyx性爽| 日韩一级免费观看| 1000部国产精品成人观看| 亚洲成人午夜影院| 国产一区二区美女诱惑| 色狠狠色狠狠综合| 精品少妇一区二区三区在线播放| 国产精品丝袜黑色高跟| 午夜视频在线观看一区| 国产凹凸在线观看一区二区 | 丁香婷婷综合色啪| 欧美在线视频全部完| 久久蜜桃一区二区| 亚洲一区视频在线观看视频| 激情五月婷婷综合| 91久久精品网| 国产午夜精品一区二区| 亚洲成人在线网站| 成人的网站免费观看| 91精品视频网| 亚洲欧美综合在线精品| 日本aⅴ免费视频一区二区三区| 国产suv一区二区三区88区| 欧美精品久久久久久久多人混战| 国产欧美1区2区3区| 免费人成在线不卡| 91福利在线看| 国产精品嫩草99a| 麻豆国产欧美一区二区三区| 欧美唯美清纯偷拍| 中文字幕中文在线不卡住| 另类的小说在线视频另类成人小视频在线 | 欧美日韩一卡二卡三卡| 国产精品视频在线看| 黄色精品一二区| 欧美一区二区二区| 亚洲国产成人av网| av电影在线观看一区| 久久色视频免费观看| 美女在线视频一区| 欧美日韩和欧美的一区二区| 日韩理论片网站| av亚洲产国偷v产偷v自拍| 国产日产亚洲精品系列| 精品一区二区在线观看| 日韩三级伦理片妻子的秘密按摩| 亚洲在线成人精品| 在线免费观看日本欧美| 一区二区三区中文字幕电影| 成人avav在线| 亚洲丝袜精品丝袜在线| 成人免费av网站| 国产精品福利一区二区| 91麻豆视频网站| 亚洲一区二区三区四区五区中文| 在线看国产一区二区| 一区二区三区成人| 欧美视频一区在线观看| 亚洲电影视频在线|