C:/fscan/HTTPCore/HTTPCore.h File Reference

#include "Build.h"
#include "HTTP.h"
#include "Authentication/base64.h"
#include "Authentication/ntlm.h"
#include "Authentication/digest.h"
#include <sys/timeb.h>
#include <process.h>
#include <time.h>
#include <wininet.h>

Include dependency graph for HTTPCore.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _HTTPmapping_struct_
struct  conexiones
struct  _hhandle
 This struct is the information used by FHScan to manage HTTP requests. This struct does not manage sockets, however a pointer to an STABLISHED_CONNECTION is provided. For the user point of view, this handle is only a pointer. an user must not tweak data stored in this struct. More...

Defines

#define MAX_OPEN_CONNECTIONS   512
#define PURGETIME   20
#define MAX_OPEN_CONNETIONS_AGAINST_SAME_HOST   10
#define BUFFSIZE   4096
#define TARGET_FREE   0
#define MAX_INACTIVE_CONNECTION   10000000 *PURGETIME
#define MAXIMUM_OPENED_HANDLES   1024

Typedefs

typedef struct _HTTPmapping_struct_ HTTPIOMapping
typedef struct
_HTTPmapping_struct_
PHTTPIOMapping
typedef struct conexiones STABLISHED_CONNECTION
typedef struct _hhandlePHHANDLE

Functions

int HTTPCoreCancelHTTPRequest (HTTPHANDLE HTTPHandle, int what)
 This function is used to clean the connection struct and cancel I/O request.
void FreeConnection (STABLISHED_CONNECTION *connection)
 This function is used to clean the status of a connection struct when the conexion socket is closed or when there is a problem reading the HTTP stream (like timeouts).
static void * CleanConnectionTable (void *foo)
static unsigned int GetNumberOfConnectionsAgainstTarget (PHHANDLE HTTPHandle)
static int GetFirstIdleConnectionAgainstTarget (PHHANDLE HTTPHandle)
static int GetFirstUnUsedConnectionAgainstTarget (PHHANDLE HTTPHandle)
int RemovePipeLineRequest (STABLISHED_CONNECTION *connection)
 This function Adds a pending request struct to the connection pool.
static unsigned long AddPipeLineRequest (STABLISHED_CONNECTION *connection, PHTTP_DATA request)
static STABLISHED_CONNECTIONGetSocketConnection (PHHANDLE HTTPHandle, PHTTP_DATA request, unsigned long *id)
PHTTP_DATA DispatchHTTPRequest (PHHANDLE HTTPHandle, PHTTP_DATA request)
int InitHTTPApiCore (void)
 This function is used to start the HTTP Core Engine and must be called only once.
void CloseHTTPApiCore (void)
 This function stops the HTTP Core Engine.
PHTTP_DATA InitHTTPData (char *header, char *postdata)
 This function Initializes an HTTP_DATA struct with the headers and and data sent or returned by a client or an http server.
void FreeHTTPData (HTTP_DATA *data)
 This function deallocates the memory of an an HTTP_DATA struct.


Define Documentation

#define BUFFSIZE   4096

Definition at line 49 of file HTTPCore.h.

Referenced by ReadHTTPResponseData().

#define MAX_INACTIVE_CONNECTION   10000000 *PURGETIME

Definition at line 51 of file HTTPCore.h.

#define MAX_OPEN_CONNECTIONS   512

Definition at line 46 of file HTTPCore.h.

#define MAX_OPEN_CONNETIONS_AGAINST_SAME_HOST   10

Definition at line 48 of file HTTPCore.h.

#define MAXIMUM_OPENED_HANDLES   1024

Definition at line 52 of file HTTPCore.h.

#define PURGETIME   20

Definition at line 47 of file HTTPCore.h.

#define TARGET_FREE   0

Definition at line 50 of file HTTPCore.h.

Referenced by FreeConnection(), and GetFirstUnUsedConnectionAgainstTarget().


Typedef Documentation

typedef struct _HTTPmapping_struct_ HTTPIOMapping

typedef struct _hhandle * PHHANDLE

typedef struct _HTTPmapping_struct_ * PHTTPIOMapping

typedef struct conexiones STABLISHED_CONNECTION


Function Documentation

static unsigned long AddPipeLineRequest ( STABLISHED_CONNECTION connection,
PHTTP_DATA  request 
) [static]

static void* CleanConnectionTable ( void *  foo  )  [static]

void CloseHTTPApiCore ( void   ) 

This function stops the HTTP Core Engine.

Note:
this function is exported but must be called only from the HTTP.cpp and must not be called manually.

As CallBacks table will be erased (This also include user registered callbacks)

Definition at line 578 of file HTTPCore.cpp.

Referenced by CloseHTTPApi().

PHTTP_DATA DispatchHTTPRequest ( PHHANDLE  HTTPHandle,
PHTTP_DATA  request 
)

This function gets an stablished connection against the remote host, sends the generated HTTP the request and Waits for a response. Callbacks are called at this point.

Parameters:
HTTPHandle Handle to the remote host.
request struct that stores both header and post data that will be delivered to the remote HTTP Host.
Returns:
: returns a PHTTP_DATA struct however, if the remote host can not be reached, NULL is returned instead.
Note:
If the remote host does not return data, and empty struct is returned.

This function shouldnt be called remotely as for example, does not suport authentication. Instead, use SendHTTPRequest() exported at the public interface.

Registered CallBacks are called from this point.

Definition at line 455 of file HTTPCore.cpp.

Referenced by SendHttpRequest().

void FreeConnection ( STABLISHED_CONNECTION connection  ) 

This function is used to clean the status of a connection struct when the conexion socket is closed or when there is a problem reading the HTTP stream (like timeouts).

Parameters:
connection Pointer to a CONEXION struct
Note:
All the internal counters are reset and the first pipelined request is removed.

If there are pending pipelined requests this function will also reconnect the socket and send those requests to the server

Definition at line 67 of file HTTPCore.cpp.

References conexiones::datasock, _data::Header, conexiones::io, conexiones::NeedSSL, conexiones::NumberOfRequests, conexiones::PENDING_PIPELINE_REQUESTS, conexiones::PIPELINE_Request, conexiones::port, RemovePipeLineRequest(), SendHTTPRequestData(), StablishConnection(), conexiones::target, TARGET_FREE, and conexiones::tlastused.

Referenced by GetSocketConnection(), and ReadHTTPResponseData().

Here is the call graph for this function:

void FreeHTTPData ( HTTP_DATA data  ) 

This function deallocates the memory of an an HTTP_DATA struct.

Parameters:
data pointer to an HTTP_DATA struct allocated by a previous call to InitHTTPData().
Note:
This function also tries to match if the assigned memory to HTTP_DATA->Data is a memory mapping. If so, the file mapping will be removed

Definition at line 652 of file HTTPCore.cpp.

Referenced by FreeRequest(), and ParseReturnedBuffer().

static int GetFirstIdleConnectionAgainstTarget ( PHHANDLE  HTTPHandle  )  [static]

static int GetFirstUnUsedConnectionAgainstTarget ( PHHANDLE  HTTPHandle  )  [static]

static unsigned int GetNumberOfConnectionsAgainstTarget ( PHHANDLE  HTTPHandle  )  [static]

static STABLISHED_CONNECTION* GetSocketConnection ( PHHANDLE  HTTPHandle,
PHTTP_DATA  request,
unsigned long *  id 
) [static]

int HTTPCoreCancelHTTPRequest ( HTTPHANDLE  HTTPHandle,
int  what 
)

This function is used to clean the connection struct and cancel I/O request.

Parameters:
HTTPHandle Handle of the remote connection.
what Cancel only the current request HTTP_REQUEST_CURRENT or blocks all connections against the remote HTTP host with HTTP_REQUEST_ALL.
Note:
This function is needed when for example a CONNECT call is sent against a remote HTTP proxy server.

Definition at line 41 of file HTTPCore.cpp.

References _hhandle::conexion, conexiones::datasock, lock, LockMutex(), conexiones::NumberOfRequests, and UnLockMutex().

Referenced by CancelHttpRequest().

Here is the call graph for this function:

int InitHTTPApiCore ( void   ) 

This function is used to start the HTTP Core Engine and must be called only once.

Note:
this function is exported but must be called only from HTTP.cpp and must not be called manually.

Under Win32, WSA Sockets are also initialized.

Supported Core Callbacks must be registered here. Example Chunk encoding, gzip compression..

Definition at line 517 of file HTTPCore.cpp.

Referenced by InitHTTPApi().

PHTTP_DATA InitHTTPData ( char *  header,
char *  postdata 
)

This function Initializes an HTTP_DATA struct with the headers and and data sent or returned by a client or an http server.

Parameters:
header pointer to an string that contains HTTP headers. This value can be null
postdata pointer to an string that contains HTTP data. This value can be null.
Returns:
pointer to an initialized HTTP_DATA struct.
Note:
if header or postdata is null and empy string will be allocated.

Definition at line 622 of file HTTPCore.cpp.

Referenced by ReadHTTPResponseData(), and SendHttpRequest().

int RemovePipeLineRequest ( STABLISHED_CONNECTION connection  ) 

This function Adds a pending request struct to the connection pool.

Parameters:
connection CONEXION struct returned by a previous call to GetSocketConnection. From this connection the first added request struct will be removed (FIFO)
Returns:
This function returns the number of pending pipelined request.

Definition at line 247 of file HTTPCore.cpp.

Referenced by FreeConnection(), and ReadHTTPResponseData().


Generated on Sun Jan 18 00:32:04 2009 for Fast HTTP Vulnerability Scanner by  doxygen 1.5.4