/--------------------------------------------------------------------------
// IP Stack Client Demo
//--------------------------------------------------------------------------
// webpage.c
//
// Web page and CGI function
//
// Author: Michael A. Denio
// Copyright 2000, 2001 by Texas Instruments Inc.
//-------------------------------------------------------------------------
#include <std.h>
#include <sys.h>
#include <sem.h>
#include <tsk.h>
#include "netmain.h"
#include "thrControl.h"
#pragma DATA_SECTION(DEFAULT, "OBJMEM");
#include "webdata\default.c"
#pragma DATA_SECTION(TIBUG, "OBJMEM");
#include "webdata\tibug.c"
#pragma DATA_SECTION(JAVA1, "OBJMEM");
#include "webdata\java1.c"
#pragma DATA_SECTION(JAVA2, "OBJMEM");
#include "webdata\java2.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] = '\0';
// Process request variables until there are none left
do
{
key = cgiParseVars( buffer, &parseIndex );
value = cgiParseVars( buffer, &parseIndex );
if( !strcmp("quality", key) )
qualstr = value;
} while ( parseIndex != -1 );
//
// Output the data we read in...
//
httpSendStatusLine(SOCKET htmlSock, HTTP_OK, CONTENT_TYPE_HTML);
// CRLF before entity
html( CRLF);
//
// Generate response
//
// If the password is incorrect or missing, generate an error
if( qualstr )
{
quality = 0;
while( *qualstr )
quality = quality * 10 + (*qualstr++ - '0');
if( quality > 0 && quality <= 100 )
thrControlSet( 1, quality );
}
// Send back the same default page
send(htmlSock, DEFAULT, DEFAULT_SIZE, 0 );
ERROR:
if( buffer )
mmBulkFree( buffer );
return( 1 );
}
"webpage.c", line 97: error: type name is not allowed
"webpage.c", line 97: error: too few arguments in function call
"webpage.c", line 97: error: expected a ")"
"webpage.c", line 99: error: type name is not allowed
"webpage.c", line 99: error: too few arguments in function call
"webpage.c", line 99: error: expected a ")"
麻烦各位大神帮忙解决,非常感谢。。
|