Main Page | Modules | Data Structures | File List | Data Fields | Globals

# testhook.c File Reference

## Detailed Description

A sample http-plugin for IPS.

This file implements a simple plugin for the HTTP module in IPS. It implements the three functions that IPS will expect to find in an HTTP-plugin.

Revision
  1.6

Author:
  Harald Eilertsen (haraldei@anduin.net)

## Functions

IPSBOOL IPSEXPORT | ipsInitialize (PIPSHOOKINFO pHookInfo)
| Initialize the Hook DLL.
IPSBOOL IPSEXPORT | ipsHttpRequest (PIPSHOOKINFO pHookInfo)
| Process the http-requestst.
IPSBOOL IPSEXPORT | ipsFinalize (PIPSHOOKINFO pHookInfo)
| Finalize processing.

## Function Documentation

IPSBOOL IPSEXPORT ipsInitialize | ( | PIPSHOOKINFO | pHookInfo | ) |

| Initialize the Hook DLL. This method is called by IPS when the Hook-DLL is first loaded. The method should return `TRUE` (1) if the initialization succeeded and the DLL will stay loaded. In the other case it should return `FALSE` (0) and IPS will unload the DLL (without calling `ipsFinalize`).

At this stage, the only valid IPS callback function that can be called is `Log()` with the `ILC_MAIN_LOG` or `ILC_CONSOLE` classes.

Parameters:

  pHookInfo | IN Pointer to HookInfo provided by IPS

Returns:
  TRUE if ok, FALSE if DLL should not be loaded.

Version:
  6-okt-2003 /hei/ Created.

IPSBOOL IPSEXPORT ipsHttpRequest | ( | PIPSHOOKINFO | pHookInfo | ) |

| Process the http-requestst. This function is called by IPS to process the http request. The URL and parameters of the request can be queried from IPS using the `GetValue` callback. This example function will generate a web-page displaying the IPS and plugin system version information, and send this to the client.

Parameters:

  pHookInfo | IN The information passed from IPS to the plugin.

Returns:
  TRUE (1) if sucessfull, FALSE (0) to fail the request.

Warning:
  This function is subject to buffer overflows.

Version:
  6-okt-2003 /hei/ Changed to call IPS callbacks directly

IPSBOOL IPSEXPORT ipsFinalize | ( | PIPSHOOKINFO | pHookInfo | ) |

| Finalize processing. This method is called by IPS when the Hook-DLL is about to be unloaded. The same restrictions as for `ipsInitialize` also applies to this method.

Parameters:

  pHookInfo | IN Pointer to HookInfo provided by IPS.

Returns:
  This function should always return TRUE.

Version:
  6-okt-2003 /hei/ Created.