HTP  0.3
hooks.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  * Copyright 2009-2010 Open Information Security Foundation
00003  * Copyright 2010-2011 Qualys, Inc.
00004  *
00005  * Licensed to You under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  ***************************************************************************/
00017 
00023 #ifndef _HOOKS_H
00024 #define _HOOKS_H
00025 
00026 #include "dslib.h"
00027 
00028 #ifdef _HTP_H
00029 #define HOOK_ERROR      HTP_ERROR
00030 #define HOOK_OK         HTP_OK
00031 #define HOOK_DECLINED   HTP_DECLINED
00032 #else
00033 #define HOOK_ERROR      -1
00034 #define HOOK_OK          0
00035 #define HOOK_DECLINED    1
00036 #endif
00037 
00038 typedef struct htp_hook_t htp_hook_t;
00039 typedef struct htp_callback_t htp_callback_t;
00040 typedef int (*htp_callback_fn_t) (void *);
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 struct htp_hook_t {
00047     list_t *callbacks;
00048 };
00049 
00050 struct htp_callback_t {
00051     htp_callback_fn_t fn;
00052 };
00053 
00054  int hook_register(htp_hook_t **hook, htp_callback_fn_t callback_fn);
00055  int hook_run_one(htp_hook_t *hook, void *data);
00056  int hook_run_all(htp_hook_t *hook, void *data);
00057 
00058 htp_hook_t *hook_create(void);
00059 htp_hook_t *hook_copy(htp_hook_t *hook);
00060        void hook_destroy(htp_hook_t *hook);
00061 
00062 
00063 #ifdef __cplusplus
00064 }
00065 #endif
00066 
00067 #endif  /* _HOOKS_H */
00068