1 /* 2 * ModSecurity for Apache 2.x, http://www.modsecurity.org/ 3 * Copyright (c) 2004-2011 Trustwave Holdings, Inc. (http://www.trustwave.com/) 4 * 5 * You may not use this file except in compliance with 6 * the License. You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * If any of the files related to licensing are missing or if you have any 11 * other questions related to licensing please contact Trustwave Holdings, Inc. 12 * directly using the email address security@modsecurity.org. 13 */ 14 15 #ifndef _MSC_JSON_H_ 16 #define _MSC_JSON_H_ 17 #ifdef WITH_YAJL 18 19 typedef struct json_data json_data; 20 21 22 #include "modsecurity.h" 23 24 #include <yajl/yajl_parse.h> 25 //#ifdef WITH_YAJL 26 //#else 27 28 29 #include "modsecurity.h" 30 31 /* Structures */ 32 struct json_data { 33 /* yajl configuration and parser state */ 34 yajl_handle handle; 35 yajl_status status; 36 37 /* error reporting and JSON array flag */ 38 unsigned char *yajl_error; 39 40 /* prefix is used to create data hierarchy (i.e., 'parent.child.value') */ 41 unsigned char *prefix; 42 unsigned char *current_key; 43 }; 44 45 /* Functions */ 46 47 int DSOLOCAL json_init(modsec_rec *msr, char **error_msg); 48 49 int DSOLOCAL json_process(modsec_rec *msr, const char *buf, 50 unsigned int size, char **error_msg); 51 52 int DSOLOCAL json_complete(modsec_rec *msr, char **error_msg); 53 54 apr_status_t DSOLOCAL json_cleanup(modsec_rec *msr); 55 56 int DSOLOCAL json_process_chunk(modsec_rec *msr, const char *buf, 57 unsigned int size, char **error_msg); 58 59 #endif 60 #endif 61