完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
本帖最后由 mr.pengyongche 于 2013-4-30 03:17 编辑 //-------------------------------------------------------------------------- // IP Stack Client Demo //-------------------------------------------------------------------------- // webpage.c // // Web page and CGI function // // Author: Michael A. Denio // Copyright 2000, 2001 by Texas Instruments Inc. //------------------------------------------------------------------------- #include #include #include #include #include "netmain.h" #include "thrControl.h" #pragma DATA_SECTION(DEFAULT, "OBJMEM"); #include "webdatadefault.c" #pragma DATA_SECTION(TIBUG, "OBJMEM"); #include "webdatatibug.c" #pragma DATA_SECTION(JAVA1, "OBJMEM"); #include "webdatajava1.c" #pragma DATA_SECTION(JAVA2, "OBJMEM"); #include "webdatajava2.c" static int cgiConfig(SOCKET htmlSock, int ContentLength, char *pArgs ); extern char *cgiParseVars(char PostIn[], int *pParseIndex ); void AddWebFiles(void) { efs_createfile("index.html", DEFAULT_SIZE, DEFAULT); efs_createfile("tibug.jpg", TIBUG_SIZE, TIBUG); efs_createfile("easyCam.class", JAVA1_SIZE, JAVA1); efs_createfile("easyCam$1.class", JAVA2_SIZE, JAVA2); efs_createfile("cfgquality.cgi", 0, (UINT8*)cgiConfig); } void RemoveWebFiles(void) { efs_destroyfile("index.html"); efs_destroyfile("tibug.jpg"); efs_destroyfile("cfgquality.cgi"); efs_destroyfile("easyCam.class"); efs_destroyfile("easyCam$1.class"); } #define html(str) httpSendClientStr(SOCKET htmlSock, (char *)str) // // cgiConfig() // static int cgiConfig(SOCKET htmlSock, int ContentLength, char *pArgs ) { char *qualstr = 0; char *buffer, *key, *value; int len,quality; int parseIndex; // CGI Functions can now support URI arguments as well if the // pArgs pointer is not NULL, and the ContentLength were zero, // we could parse the arguments off of pArgs instead. // First, allocate a buffer for the request buffer = (char*) mmBulkAlloc( ContentLength + 1 ); if ( !buffer ) goto ERROR; // Now read the data from the client len = recv( htmlSock, buffer, ContentLength, MSG_WAITALL ); if ( len < 1 ) goto ERROR; // Setup to parse the post data parseIndex = 0; buffer[ContentLength] = ' |