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

# ipsHookInterface.h

Go to the documentation of this file.

    00001 /*
    00002  * $Id: ipsHookInterface.h,v 1.4 2003/12/08 23:31:37 hei Exp $
    00003  * This unit defines standard type and function definitions used by the IPS
    00004  * plug-in interface.
    00005  *
    00006  * Translated from pascal by Harald Eilertsen
    00007  *
    00008  * $Log: ipsHookInterface.h,v $
    00009  * Revision 1.4  2003/12/08 23:31:37  hei
    00010  * Redid structs and constants for ips v1.0.0 beta
    00011  *
    00012  * Revision 1.3  2003/10/26 21:57:12  hei
    00013  * Added doxygen doc-comments.
    00014  * Added direct-call callback api (implemented in callbacks.c)
    00015  * Added ILC_MAIN_LOG and ILC_CONSOLE
    00016  *
    00017  * Revision 1.2  2003/10/06 22:00:39  hei
    00018  * Fixed calling convention issues for Windows (Watcom and Microsoft compilers).
    00019  * Changed IPSHOOKPROC struct so that member functions are callable directly.
    00020  * Changed calling convention for callbacks to IPSCALL, use IPSEXPORT only for
    00021  * functions to be exported.
    00022  * Added documentational comments.
    00023  *
    00024  * Revision 1.1.1.1  2003/09/22 23:06:39  hei
    00025  * Initial revision
    00026  *
    00027  */
    00028
    00029 #ifndef IPSHOOKINTERFACE_H
    00030 #define IPSHOOKINTERFACE_H
    00031
    00046 #ifdef __cplusplus
    00047 extern "C" {
    00048 #endif
    00049
    00050 #if defined(__WATCOMC__)
    00051 #pragma pack(1)
    00052 #endif
    00053
    00057 #define IPS_CHOOK_VERSION          1
    00058
    00063 typedef unsigned int IPSBOOL;             // 32 bit boolean type
    00064
    00065 /*
    00066  * Define TRUE and FALSE if not already defined.
    00067  */
    00068 #ifndef FALSE
    00069 #define FALSE  0
    00070 #endif
    00071 #ifndef TRUE
    00072 #define TRUE   !FALSE
    00073 #endif
    00074
    00087 #if defined (__WATCOMC__)                 // Windows and OS/2
    00088    #if defined(__OS2__)
    00089       #define IPSCALL __syscall
    00090    #elif defined(__NT__)
    00091       #define IPSCALL __stdcall
    00092    #endif
    00093    #define IPSEXPORT IPSCALL __export
    00094 #elif defined(_MSC_VER)                   // Windows
    00095    #define IPSCALL __stdcall
    00096    #define IPSEXPORT __declspec(dllexport)
    00097 #else                                     // Just to make doxygen happy
    00098    #define IPSCALL system calling convention
    00099    #define IPSEXPORT exported entry
    00100 #endif
    00101
    00102 /*
    00103  * Predeclare some types.
    00104  */
    00105 typedef struct _IPSHOOKPROC   IPSHOOKPROC;
    00106 typedef struct _IPSHOOKPROC   *PIPSHOOKPROC;
    00107
    00111 struct _IPSHOOKDATA
    00112 {
    00113    char  *arg;
    00114    char  *result;
    00115 };
    00116
    00117 typedef struct _IPSHOOKDATA IPSHOOKDATA;
    00118 typedef struct _IPSHOOKDATA *PIPSHOOKDATA;
    00119
    00124 struct _IPSHOOKINFO
    00125 {
    00126    char                 *ipsVersionString;
    00127    union {
    00128       unsigned int      ipsVersionID;
    00129       struct part {
    00130          unsigned char  subRevision;
    00131          unsigned char  revision;
    00132          unsigned char  minorVersion;
    00133          unsigned char  majorVersion;
    00134       };
    00135    } ver;
    00136    unsigned int         hookVersion;
    00137    unsigned int         sessionHandle;
    00138    PIPSHOOKPROC         pproc;
    00139    PIPSHOOKDATA         pdata;
    00140 };
    00141
    00142 typedef struct _IPSHOOKINFO   IPSHOOKINFO;
    00143 typedef struct _IPSHOOKINFO   *PIPSHOOKINFO;
    00144
    00145 typedef IPSBOOL (IPSCALL *PFIPSGETVALUE)(PIPSHOOKINFO, int, char*, char*, int);
    00146 typedef IPSBOOL (IPSCALL *PFIPSSETVALUE)(PIPSHOOKINFO, int, char*, char*);
    00147 typedef IPSBOOL (IPSCALL *PFIPSSEND)(PIPSHOOKINFO, void*, int);
    00148 typedef IPSBOOL (IPSCALL *PFIPSRECV)(PIPSHOOKINFO, void*, int);   // not implemented
    00149 typedef IPSBOOL (IPSCALL *PFIPSLOG)(PIPSHOOKINFO, unsigned, int, char*);
    00150
    00151
    00158 struct _IPSHOOKPROC
    00159 {
    00160    PFIPSGETVALUE GetValue;
    00161    PFIPSSETVALUE SetValue;
    00162    PFIPSSEND     Send;
    00163    PFIPSRECV     Recv;
    00164    PFIPSLOG      Log;
    00165 };
    00166
    00167 //
    00168 // IPS callback API
    00169 //
    00170 IPSBOOL IPSCALL IpsGetValue(PIPSHOOKINFO pHookInfo, int type, char* ident, char* buf, int size);
    00171 IPSBOOL IPSCALL IpsSetValue(PIPSHOOKINFO pHookInfo, int type, char* ident, char* text);
    00172
    00180 #define IVT_RESULTVALUE     0x00000000
    00181 #define IVT_VARIABLEVALUE   0x00000001
    00182 #define IVT_CONFIGVALUE     0x00000002
    00183 #define IVT_RESOURCEVALUE   0x00000003
    00184
    00186 IPSBOOL IPSCALL IpsSend(PIPSHOOKINFO pHookInfo, void* buf, int size);
    00187 IPSBOOL IPSCALL IpsRecv(PIPSHOOKINFO pHookInfo, void* buf, int size);
    00188 IPSBOOL IPSCALL IpsLog(PIPSHOOKINFO pHookInfo, unsigned code, int level, char* text);
    00189
    00200 // Constants for aCode in Log callback
    00201 #define ILC_DEFAULT         0xf0000000
    00202 #define ILC_SYSTEM_LOG      0xf1000000
    00203 #define ILC_SYSTEM_CONSOLE  0xf2000000
    00204 #define ILC_SYSTEM_LOG_CONSOLE   \
    00205       ILC_SYSTEM_LOG|ILC_SYSTEM_CONSOLE
    00206
    00208 #if defined(__WATCOMC__)
    00209 #pragma pack(pop)
    00210 #endif
    00211
    00212 #ifdef __cplusplus
    00213 }     // extern "C"
    00214 #endif
    00215
    00216
    00217 #endif  // IPSHOOKINTERFACE_H