#include <filter.h>
Inherits BazisLib::Win32::NetworkFilterBase.
Classes | |
class | ConnectionContext |
Used internally to maintain connection context. More... | |
Public Member Functions | |
BasicHTTPFilter () | |
Protected Types | |
enum | Operation { DoNotFilterFile, GetHeaderAndFilter, SkipRequestAndFilter } |
enum | { TrackHeadRequests = 0x02 } |
enum | { MaximumFirstLineLength = 1024, MaximumHeaderSize = 131072 } |
Protected Member Functions | |
std::string | ExtractURLFromRequest (const std::string &HTTPRequestHeader) |
Extracts URL from a HTTP request body. | |
virtual Operation | OnFileRequested (std::string &HTTPRequest, void *pSystemContext) |
Called when a HTTP request is issued. | |
virtual ManagedPointer< AIFile > | GetReplacementForFile (const std::string &HTTPRequest, const char *pHTTPReply, void *pSystemContext) |
Called to get a managed file to replace the original HTTP reply. | |
Protected Attributes | |
unsigned | m_ModeFlags |
Private Member Functions | |
virtual BazisLib::ActionStatus | OnStartConnect (BazisLib::Network::_PlatformSpecificInternetAddress *pAddr, void **ppUserContext) override |
virtual void | OnDisconnect (void *pSystemContext, void *pUserContext) override |
virtual size_t | OnSend (void *pSystemContext, void *pSystemContext2, void *pBuf, size_t MaxSize, void *pUserContext, bool ForceBlockingMode) override |
virtual size_t | OnReceive (void *pSystemContext, void *pSystemContext2, void *pBuf, size_t MaxSize, void *pUserContext, bool ForceBlockingMode) override |
virtual void | FreeUserContext (void *pContext) override |
This class performs analyzis of intercepted network connections, extracts HTTP sessions and parses them in order to extract request headers and reply headers. Basically, it allows doing the following:
enum BazisLib::Network::Filters::BasicHTTPFilter::Operation [protected] |
BazisLib::Network::Filters::BasicHTTPFilter::BasicHTTPFilter | ( | ) |
std::string BazisLib::Network::Filters::BasicHTTPFilter::ExtractURLFromRequest | ( | const std::string & | HTTPRequestHeader | ) | [inline, protected] |
virtual void BazisLib::Network::Filters::BasicHTTPFilter::FreeUserContext | ( | void * | pContext | ) | [override, private, virtual] |
Reimplemented from BazisLib::Win32::NetworkFilterBase.
virtual ManagedPointer<AIFile> BazisLib::Network::Filters::BasicHTTPFilter::GetReplacementForFile | ( | const std::string & | HTTPRequest, | |
const char * | pHTTPReply, | |||
void * | pSystemContext | |||
) | [inline, protected, virtual] |
Called to get a managed file to replace the original HTTP reply.
This method is called after OnFileRequested() call either immediately, or when a HTTP reply is fetched. If the call was immediate (OnFileRequested() returned SkipRequestAndFilter), the pHTTPReply parameter will be NULL, as no reply header is available in that case.
HTTPRequest | Contains a HTTP request header (and body, if exists). | |
pHTTPReply | Contains HTTP reply header (and no body). This parameter can be NULL, if SkipRequestAndFilter was returned by OnFileRequested(). Otherwise, it points to a NULL-terminated ASCII string containing the header. |
virtual void BazisLib::Network::Filters::BasicHTTPFilter::OnDisconnect | ( | void * | pSystemContext, | |
void * | pUserContext | |||
) | [override, private, virtual] |
Reimplemented from BazisLib::Win32::NetworkFilterBase.
virtual Operation BazisLib::Network::Filters::BasicHTTPFilter::OnFileRequested | ( | std::string & | HTTPRequest, | |
void * | pSystemContext | |||
) | [inline, protected, virtual] |
Called when a HTTP request is issued.
This method is called by the filter when a HTTP request was detected. Child class can override it.
HTTPRequest | Contains HTTP request (header + body, if one exists). Note that in current version modifying HTTPRequest from this method gives no effect, as the header was already sent to the server. In future versions this behaviour may change. | |
pSystemContext | Contains system context that can be used to call OnSend()/OnReceive()/etc Note that in this version calling one of this functions from this handler can make the filter to become unstable if the hooked application uses asynchronous/non-blocking API. |
virtual size_t BazisLib::Network::Filters::BasicHTTPFilter::OnReceive | ( | void * | pSystemContext, | |
void * | pSystemContext2, | |||
void * | pBuf, | |||
size_t | MaxSize, | |||
void * | pUserContext, | |||
bool | ForceBlockingMode | |||
) | [override, private, virtual] |
Reimplemented from BazisLib::Win32::NetworkFilterBase.
virtual size_t BazisLib::Network::Filters::BasicHTTPFilter::OnSend | ( | void * | pSystemContext, | |
void * | pSystemContext2, | |||
void * | pBuf, | |||
size_t | MaxSize, | |||
void * | pUserContext, | |||
bool | ForceBlockingMode | |||
) | [override, private, virtual] |
Reimplemented from BazisLib::Win32::NetworkFilterBase.
virtual BazisLib::ActionStatus BazisLib::Network::Filters::BasicHTTPFilter::OnStartConnect | ( | BazisLib::Network::_PlatformSpecificInternetAddress * | pAddr, | |
void ** | ppUserContext | |||
) | [override, private, virtual] |
Reimplemented from BazisLib::Win32::NetworkFilterBase.
unsigned BazisLib::Network::Filters::BasicHTTPFilter::m_ModeFlags [protected] |