G:/ScriptBasic/source/httpd.c File Reference

#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
#include "thread.h"
#include "filesys.h"
#include "httpd.h"
#include "getopt.h"

Go to the source code of this file.

Data Structures

struct  _StateCode

Defines

#define Sleep   sleep
#define SLEEPER   1
#define MAXBINDTRIAL   1200
#define BINDSLEEP   1
#define MSPACE(x)   while( *x && isspace(*x)) x++
#define SSPACE(x)   if( *x && isspace(*x)) x++

Functions

void SEGV_handle (int i)
void InitSignalHandlers ()
static int unhex (int t)
static int strIcmp (char *a, char *b)
static char * _GetServerVariable (pThreadData ThisThread, char *VariableName)
static void _CloseClient (pThreadData ThisThread)
static int _WriteClient (pThreadData ThisThread, char *pszBuffer, int cbBuffer)
static int _WriteClientText (pThreadData ThisThread, char *pszBuffer)
static int _State (pThreadData ThisThread, int StateCode)
static int _ContentType (pThreadData ThisThread, char *pszContentType)
static int _Header (pThreadData ThisThread, char *pszHeaderKey, char *pszHeaderValue)
static int _StartBody (pThreadData ThisThread)
static int _ReadClient (pThreadData ThisThread, char *pszBuffer, int cbBuffer)
static char * _ScriptName (pThreadData ThisThread)
static char * _GetParam (pThreadData ThisThread, char *key)
static char * _PostParam (pThreadData ThisThread, char *key)
int httpd (int argc, char *argv[], int(*AppInit)(int argc, char *argv[], pHttpdThread pHT, void **AppData), int(*AppStart)(void **AppData), void(*HttpProc)(pHttpdThread pHT, pThreadData ThisThread), int(*FtpProc)(pHttpdThread pHT, pThreadData ThisThread, char *pszCommand))
pThreadData GetFreeThread (pHttpdThread pHT)
void ReleaseThreadData (pHttpdThread pHT, int index)
int CheckAllowDeny (pThreadData ThisThread)
void FinishConnection (pThreadData ThisThread)
void HitHandler (void *t)
void HandleFtpHit (pThreadData ThisThread)
void HandleHttpHit (pThreadData ThisThread)

Variables

static struct _StateCode StateMessages []


Define Documentation

#define BINDSLEEP   1
 

Definition at line 231 of file httpd.c.

#define MAXBINDTRIAL   1200
 

Definition at line 230 of file httpd.c.

Referenced by httpd().

#define MSPACE  )     while( *x && isspace(*x)) x++
 

Definition at line 825 of file httpd.c.

#define Sleep   sleep
 

Definition at line 221 of file httpd.c.

Referenced by GetFreeThread(), and InstallScriptBasic().

#define SLEEPER   1
 

Definition at line 222 of file httpd.c.

Referenced by GetFreeThread().

#define SSPACE  )     if( *x && isspace(*x)) x++
 

Definition at line 826 of file httpd.c.


Function Documentation

static void _CloseClient pThreadData  ThisThread  )  [static]
 

Definition at line 415 of file httpd.c.

static int _ContentType pThreadData  ThisThread,
char *  pszContentType
[static]
 

Definition at line 474 of file httpd.c.

References _WriteClient(), and _WriteClientText().

static char* _GetParam pThreadData  ThisThread,
char *  key
[static]
 

Definition at line 532 of file httpd.c.

References i, j, NULL, s, strcpy(), and unhex().

static char* _GetServerVariable pThreadData  ThisThread,
char *  VariableName
[static]
 

Definition at line 405 of file httpd.c.

References i, and strIcmp().

static int _Header pThreadData  ThisThread,
char *  pszHeaderKey,
char *  pszHeaderValue
[static]
 

Definition at line 481 of file httpd.c.

References _WriteClient(), and _WriteClientText().

static char* _PostParam pThreadData  ThisThread,
char *  key
[static]
 

Definition at line 577 of file httpd.c.

References NULL.

static int _ReadClient pThreadData  ThisThread,
char *  pszBuffer,
int  cbBuffer
[static]
 

Definition at line 494 of file httpd.c.

References i, and NULL.

static char* _ScriptName pThreadData  ThisThread  )  [static]
 

Definition at line 511 of file httpd.c.

References i, j, and NULL.

static int _StartBody pThreadData  ThisThread  )  [static]
 

Definition at line 490 of file httpd.c.

References _WriteClient().

static int _State pThreadData  ThisThread,
int  StateCode
[static]
 

Definition at line 458 of file httpd.c.

References _WriteClientText(), buffer, _StateCode::Code, i, sprintf(), _StateCode::StateMessage, and StateMessages.

static int _WriteClient pThreadData  ThisThread,
char *  pszBuffer,
int  cbBuffer
[static]
 

Definition at line 422 of file httpd.c.

References i, and NULL.

Referenced by _ContentType(), _Header(), and _StartBody().

static int _WriteClientText pThreadData  ThisThread,
char *  pszBuffer
[static]
 

Definition at line 438 of file httpd.c.

References i, and NULL.

Referenced by _ContentType(), _Header(), and _State().

int CheckAllowDeny pThreadData  ThisThread  ) 
 

Definition at line 829 of file httpd.c.

Referenced by HitHandler().

void FinishConnection pThreadData  ThisThread  ) 
 

Definition at line 886 of file httpd.c.

References ReleaseThreadData(), and thread_ExitThread().

Referenced by HandleFtpHit(), HandleHttpHit(), and HitHandler().

pThreadData GetFreeThread pHttpdThread  pHT  ) 
 

Definition at line 795 of file httpd.c.

References Sleep, SLEEPER, thread_LockMutex(), and thread_UnlockMutex().

void HandleFtpHit pThreadData  ThisThread  ) 
 

Definition at line 934 of file httpd.c.

References Buffer, cbBuffer, FinishConnection(), and NULL.

Referenced by HitHandler().

void HandleHttpHit pThreadData  ThisThread  ) 
 

Definition at line 972 of file httpd.c.

References Buffer, cbBuffer, FinishConnection(), j, NULL, and s.

Referenced by HitHandler().

void HitHandler void *  t  ) 
 

Definition at line 900 of file httpd.c.

References CheckAllowDeny(), FinishConnection(), HandleFtpHit(), HandleHttpHit(), memcpy(), and NULL.

int httpd int  argc,
char *  argv[],
int(*)(int argc, char *argv[], pHttpdThread pHT, void **AppData)  AppInit,
int(*)(void **AppData)  AppStart,
void(*)(pHttpdThread pHT, pThreadData ThisThread)  HttpProc,
int(*)(pHttpdThread pHT, pThreadData ThisThread, char *pszCommand)  FtpProc
 

Definition at line 598 of file httpd.c.

References AppInit(), getoptt(), i, InitSignalHandlers(), j, MAXBINDTRIAL, and NULL.

Referenced by main().

void InitSignalHandlers  ) 
 

Definition at line 347 of file httpd.c.

References SEGV_handle().

Referenced by httpd().

void ReleaseThreadData pHttpdThread  pHT,
int  index
 

Definition at line 815 of file httpd.c.

References thread_LockMutex(), and thread_UnlockMutex().

Referenced by FinishConnection().

void SEGV_handle int  i  ) 
 

Definition at line 328 of file httpd.c.

Referenced by InitSignalHandlers().

static int strIcmp char *  a,
char *  b
[static]
 

Definition at line 393 of file httpd.c.

Referenced by _GetServerVariable().

static int unhex int  t  )  [static]
 

Definition at line 387 of file httpd.c.

Referenced by _GetParam().


Variable Documentation

struct _StateCode StateMessages[] [static]
 

Referenced by _State().


Generated on Sun Mar 12 23:56:37 2006 for ScriptBasic by  doxygen 1.4.6-NO