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

# ipsHookInterface.h File Reference

## Detailed Description

This header describes the standard type and function definitions used by the IPS plugin interface.

With this header you will be able to write IPS hooks as a Windows or OS/2 DLL in C. Theese will be loaded by IPS on the conditions specified in the IPS documentation.

Revision
  1.4

Author:
  Harald Eilertsen (haraldei@anduin.net)

Go to the source code of this file.

## Data Structures

struct | _IPSHOOKDATA
| Structure for data passed directly to the plug-in routine. More...
struct | _IPSHOOKINFO
| Structure for the standard record passed as the only argument to most plug-in routines. More...
struct | _IPSHOOKPROC
| Structure defining the available callback methods provided by IPS. More...

## Defines

#define | IPS_CHOOK_VERSION 1
| Define the chook interface version.
#define | FALSE 0
| Symbolic constant for a false value.
#define | TRUE !FALSE
| Symbolic value for a TRUE value.
#define | IPSCALL system calling convention
| Define IPS calling convention.
#define | IPSEXPORT exported entry
| This is equivalent to IPSCALL but with the addition of the __export directive (Watcom) or __declspec(dllexport) (Microsoft).
#define | IVT_RESULTVALUE 0x00000000
| Used to set a simple Result value, no Ident required.
#define | IVT_VARIABLEVALUE 0x00000001
| Any internal variable, note that most are read only.
#define | IVT_CONFIGVALUE 0x00000002
| Not implemented.
#define | IVT_RESOURCEVALUE 0x00000003
| Not implemented.
#define | ILC_DEFAULT 0xf0000000
| Log to default log for the current session (Requires an active session).
#define | ILC_SYSTEM_LOG 0xf1000000
| Log to main log file (Also works from ipsInitialize and ipsFinalize without a session).
#define | ILC_SYSTEM_CONSOLE 0xf2000000
| Log to system console (Also works from ipsInitialize and ipsFinalize without a session).
#define | ILC_SYSTEM_LOG_CONSOLE ILC_SYSTEM_LOG|ILC_SYSTEM_CONSOLE
| Log to main log file and system console (Also works from ipsInitialize and ipsFinalize without a session).

## Typedefs

typedef unsigned int | IPSBOOL
| Define the return type used by all IPS hook functions.
typedef _IPSHOOKPROC | IPSHOOKPROC
| Type declaration for plugin callback functions.
typedef _IPSHOOKPROC * | PIPSHOOKPROC
| Pointer to plugin callback functions.
typedef _IPSHOOKDATA | IPSHOOKDATA
| Hook data type.
typedef _IPSHOOKINFO | IPSHOOKINFO
| IPS hook info type.
typedef _IPSHOOKINFO * | PIPSHOOKINFO
| Pointer to IPS hook info type.

## Functions

IPSBOOL IPSCALL | IpsGetValue (PIPSHOOKINFO pHookInfo, int type, char *ident, char *buf, int size)
| Retreive a value from IPS.
IPSBOOL IPSCALL | IpsSetValue (PIPSHOOKINFO pHookInfo, int type, char *ident, char *text)
| Set a value in IPS.
IPSBOOL IPSCALL | IpsSend (PIPSHOOKINFO pHookInfo, void *buf, int size)
| Send data to client.
IPSBOOL IPSCALL | IpsRecv (PIPSHOOKINFO pHookInfo, void *buf, int size)
| Receive data from client.
IPSBOOL IPSCALL | IpsLog (PIPSHOOKINFO pHookInfo, unsigned code, int level, char *text)
| Add a message to the logs.

## Define Documentation

#define IPS_CHOOK_VERSION 1

| Define the chook interface version.

#define FALSE 0

| Symbolic constant for a false value.

#define TRUE !FALSE

| Symbolic value for a TRUE value.

#define IPSCALL system calling convention

| Define IPS calling convention. On OS/2 this is equivalent to __syscall, on Windows it is equivalent to __stdcall.

#define IPSEXPORT exported entry

| This is equivalent to IPSCALL but with the addition of the __export directive (Watcom) or __declspec(dllexport) (Microsoft).

## Typedef Documentation

typedef unsigned int IPSBOOL

| Define the return type used by all IPS hook functions. Valid values are TRUE and FALSE.

typedef struct _IPSHOOKPROC IPSHOOKPROC

| Type declaration for plugin callback functions.

typedef struct _IPSHOOKPROC* PIPSHOOKPROC

| Pointer to plugin callback functions.

typedef struct _IPSHOOKDATA IPSHOOKDATA

| Hook data type.

typedef struct _IPSHOOKINFO IPSHOOKINFO

| IPS hook info type.

typedef struct _IPSHOOKINFO* PIPSHOOKINFO

| Pointer to IPS hook info type.

## Function Documentation

IPSBOOL IPSCALL IpsGetValue | ( | PIPSHOOKINFO | pHookInfo,
|  | int | type,
|  | char * | ident,
|  | char * | buf,
|  | int | size
| ) |

| Retreive a value from IPS.

Parameters:

  pHookInfo | IN Pointer to IPS Hook information.
  type | IN Type of value requested. (See Types of values)
  ident | IN A string that identifies the value.
  buf | OUT Pointer to a buffer to receive the requested value.
  size | IN Size of supplied buffer.

Returns:
  TRUE if the value was found, FALSE otherwise.

IPSBOOL IPSCALL IpsSetValue | ( | PIPSHOOKINFO | pHookInfo,
|  | int | type,
|  | char * | ident,
|  | char * | text
| ) |

| Set a value in IPS.

Parameters:

  pHookInfo | IN Pointer to IPS Hook information.
  type | IN Type of value requested.
  ident | IN A string that identifies the value.
  text | IN Pointer to zero terminated string to assign the value.

Returns:
  TRUE if the value was set, FALSE if an error occured.

IPSBOOL IPSCALL IpsSend | ( | PIPSHOOKINFO | pHookInfo,
|  | void * | buf,
|  | int | size
| ) |

| Send data to client. This function sends data to the client using the connection set up by IPS.

Parameters:

  pHookInfo | IN Pointer to IPS Hook information.
  buf | IN Pointer to buffer containing data to send.
  size | IN Size of supplied buffer.

Returns:
  TRUE if data was successfully sent, FALSE otherwise.

IPSBOOL IPSCALL IpsRecv | ( | PIPSHOOKINFO | pHookInfo,
|  | void * | buf,
|  | int | size
| ) |

| Receive data from client. This function is not yet implemented.

Parameters:

  pHookInfo | IN Pointer to IPS Hook information.
  buf | OUT Pointer to buffer to receive data to.
  size | IN Size of supplied buffer.

Returns:
  TRUE if data was successfully received, FALSE otherwise.

IPSBOOL IPSCALL IpsLog | ( | PIPSHOOKINFO | pHookInfo,
|  | unsigned | code,
|  | int | level,
|  | char * | text
| ) |

| Add a message to the logs. This functin will write the supplied message to one or more of the IPS log-files. Which log file the message is written to may depend on the `code` param, as well as the session where `Log` is called.

Parameters:

  pHookInfo | IN Pointer to IPS Hook information.
  code | IN Logging code. (See Logging codes)
  level | IN Level of the message, used by LogLevel to filter messages based on log level.
  text | IN Zero terminated ascii string to append to the log.

Returns:
  TRUE on success, FALSE on failure.