1 /*
2  *  ClamAV bytecode internal API
3  *  This is an automatically generated file!
4  *
5  *  Copyright (C) 2013-2022 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
6  *  Copyright (C) 2009-2013 Sourcefire, Inc.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE
28  */
29 #ifndef BYTECODE_API_IMPL_H
30 #define BYTECODE_API_IMPL_H
31 
32 struct cli_bc_bctx;
33 struct cli_environment;
34 uint32_t cli_bcapi_test1(struct cli_bc_ctx *ctx , uint32_t, uint32_t);
35 int32_t cli_bcapi_read(struct cli_bc_ctx *ctx , uint8_t*, int32_t);
36 int32_t cli_bcapi_write(struct cli_bc_ctx *ctx , uint8_t*, int32_t);
37 int32_t cli_bcapi_seek(struct cli_bc_ctx *ctx , int32_t, uint32_t);
38 uint32_t cli_bcapi_setvirusname(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
39 uint32_t cli_bcapi_debug_print_str(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
40 uint32_t cli_bcapi_debug_print_uint(struct cli_bc_ctx *ctx , uint32_t);
41 uint32_t cli_bcapi_disasm_x86(struct cli_bc_ctx *ctx , struct DISASM_RESULT*, uint32_t);
42 uint32_t cli_bcapi_trace_directory(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
43 uint32_t cli_bcapi_trace_scope(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
44 uint32_t cli_bcapi_trace_source(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
45 uint32_t cli_bcapi_trace_op(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
46 uint32_t cli_bcapi_trace_value(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
47 uint32_t cli_bcapi_trace_ptr(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
48 uint32_t cli_bcapi_pe_rawaddr(struct cli_bc_ctx *ctx , uint32_t);
49 int32_t cli_bcapi_file_find(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
50 int32_t cli_bcapi_file_byteat(struct cli_bc_ctx *ctx , uint32_t);
51 uint8_t* cli_bcapi_malloc(struct cli_bc_ctx *ctx , uint32_t);
52 uint32_t cli_bcapi_test2(struct cli_bc_ctx *ctx , uint32_t);
53 int32_t cli_bcapi_get_pe_section(struct cli_bc_ctx *ctx , struct cli_exe_section*, uint32_t);
54 int32_t cli_bcapi_fill_buffer(struct cli_bc_ctx *ctx , uint8_t*, uint32_t, uint32_t, uint32_t, uint32_t);
55 int32_t cli_bcapi_extract_new(struct cli_bc_ctx *ctx , int32_t);
56 int32_t cli_bcapi_read_number(struct cli_bc_ctx *ctx , uint32_t);
57 int32_t cli_bcapi_hashset_new(struct cli_bc_ctx *ctx );
58 int32_t cli_bcapi_hashset_add(struct cli_bc_ctx *ctx , int32_t, uint32_t);
59 int32_t cli_bcapi_hashset_remove(struct cli_bc_ctx *ctx , int32_t, uint32_t);
60 int32_t cli_bcapi_hashset_contains(struct cli_bc_ctx *ctx , int32_t, uint32_t);
61 int32_t cli_bcapi_hashset_done(struct cli_bc_ctx *ctx , int32_t);
62 int32_t cli_bcapi_hashset_empty(struct cli_bc_ctx *ctx , int32_t);
63 int32_t cli_bcapi_buffer_pipe_new(struct cli_bc_ctx *ctx , uint32_t);
64 int32_t cli_bcapi_buffer_pipe_new_fromfile(struct cli_bc_ctx *ctx , uint32_t);
65 uint32_t cli_bcapi_buffer_pipe_read_avail(struct cli_bc_ctx *ctx , int32_t);
66 const uint8_t* cli_bcapi_buffer_pipe_read_get(struct cli_bc_ctx *ctx , int32_t, uint32_t);
67 int32_t cli_bcapi_buffer_pipe_read_stopped(struct cli_bc_ctx *ctx , int32_t, uint32_t);
68 uint32_t cli_bcapi_buffer_pipe_write_avail(struct cli_bc_ctx *ctx , int32_t);
69 uint8_t* cli_bcapi_buffer_pipe_write_get(struct cli_bc_ctx *ctx , int32_t, uint32_t);
70 int32_t cli_bcapi_buffer_pipe_write_stopped(struct cli_bc_ctx *ctx , int32_t, uint32_t);
71 int32_t cli_bcapi_buffer_pipe_done(struct cli_bc_ctx *ctx , int32_t);
72 int32_t cli_bcapi_inflate_init(struct cli_bc_ctx *ctx , int32_t, int32_t, int32_t);
73 int32_t cli_bcapi_inflate_process(struct cli_bc_ctx *ctx , int32_t);
74 int32_t cli_bcapi_inflate_done(struct cli_bc_ctx *ctx , int32_t);
75 int32_t cli_bcapi_bytecode_rt_error(struct cli_bc_ctx *ctx , int32_t);
76 int32_t cli_bcapi_jsnorm_init(struct cli_bc_ctx *ctx , int32_t);
77 int32_t cli_bcapi_jsnorm_process(struct cli_bc_ctx *ctx , int32_t);
78 int32_t cli_bcapi_jsnorm_done(struct cli_bc_ctx *ctx , int32_t);
79 int32_t cli_bcapi_ilog2(struct cli_bc_ctx *ctx , uint32_t, uint32_t);
80 int32_t cli_bcapi_ipow(struct cli_bc_ctx *ctx , int32_t, int32_t, int32_t);
81 uint32_t cli_bcapi_iexp(struct cli_bc_ctx *ctx , int32_t, int32_t, int32_t);
82 int32_t cli_bcapi_isin(struct cli_bc_ctx *ctx , int32_t, int32_t, int32_t);
83 int32_t cli_bcapi_icos(struct cli_bc_ctx *ctx , int32_t, int32_t, int32_t);
84 int32_t cli_bcapi_memstr(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, const uint8_t*, int32_t);
85 int32_t cli_bcapi_hex2ui(struct cli_bc_ctx *ctx , uint32_t, uint32_t);
86 int32_t cli_bcapi_atoi(struct cli_bc_ctx *ctx , const uint8_t*, int32_t);
87 uint32_t cli_bcapi_debug_print_str_start(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
88 uint32_t cli_bcapi_debug_print_str_nonl(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
89 uint32_t cli_bcapi_entropy_buffer(struct cli_bc_ctx *ctx , uint8_t*, int32_t);
90 int32_t cli_bcapi_map_new(struct cli_bc_ctx *ctx , int32_t, int32_t);
91 int32_t cli_bcapi_map_addkey(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, int32_t);
92 int32_t cli_bcapi_map_setvalue(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, int32_t);
93 int32_t cli_bcapi_map_remove(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, int32_t);
94 int32_t cli_bcapi_map_find(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, int32_t);
95 int32_t cli_bcapi_map_getvaluesize(struct cli_bc_ctx *ctx , int32_t);
96 uint8_t* cli_bcapi_map_getvalue(struct cli_bc_ctx *ctx , int32_t, int32_t);
97 int32_t cli_bcapi_map_done(struct cli_bc_ctx *ctx , int32_t);
98 int32_t cli_bcapi_file_find_limit(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t, int32_t);
99 uint32_t cli_bcapi_engine_functionality_level(struct cli_bc_ctx *ctx );
100 uint32_t cli_bcapi_engine_dconf_level(struct cli_bc_ctx *ctx );
101 uint32_t cli_bcapi_engine_scan_options(struct cli_bc_ctx *ctx );
102 uint32_t cli_bcapi_engine_db_options(struct cli_bc_ctx *ctx );
103 int32_t cli_bcapi_extract_set_container(struct cli_bc_ctx *ctx , uint32_t);
104 int32_t cli_bcapi_input_switch(struct cli_bc_ctx *ctx , int32_t);
105 uint32_t cli_bcapi_get_environment(struct cli_bc_ctx *ctx , struct cli_environment*, uint32_t);
106 uint32_t cli_bcapi_disable_bytecode_if(struct cli_bc_ctx *ctx , const int8_t*, uint32_t, uint32_t);
107 uint32_t cli_bcapi_disable_jit_if(struct cli_bc_ctx *ctx , const int8_t*, uint32_t, uint32_t);
108 int32_t cli_bcapi_version_compare(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t, const uint8_t*, uint32_t);
109 uint32_t cli_bcapi_check_platform(struct cli_bc_ctx *ctx , uint32_t, uint32_t, uint32_t);
110 int32_t cli_bcapi_pdf_get_obj_num(struct cli_bc_ctx *ctx );
111 int32_t cli_bcapi_pdf_get_flags(struct cli_bc_ctx *ctx );
112 int32_t cli_bcapi_pdf_set_flags(struct cli_bc_ctx *ctx , int32_t);
113 int32_t cli_bcapi_pdf_lookupobj(struct cli_bc_ctx *ctx , uint32_t);
114 uint32_t cli_bcapi_pdf_getobjsize(struct cli_bc_ctx *ctx , int32_t);
115 const uint8_t* cli_bcapi_pdf_getobj(struct cli_bc_ctx *ctx , int32_t, uint32_t);
116 int32_t cli_bcapi_pdf_getobjid(struct cli_bc_ctx *ctx , int32_t);
117 int32_t cli_bcapi_pdf_getobjflags(struct cli_bc_ctx *ctx , int32_t);
118 int32_t cli_bcapi_pdf_setobjflags(struct cli_bc_ctx *ctx , int32_t, int32_t);
119 int32_t cli_bcapi_pdf_get_offset(struct cli_bc_ctx *ctx , int32_t);
120 int32_t cli_bcapi_pdf_get_phase(struct cli_bc_ctx *ctx );
121 int32_t cli_bcapi_pdf_get_dumpedobjid(struct cli_bc_ctx *ctx );
122 int32_t cli_bcapi_matchicon(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, const uint8_t*, int32_t);
123 int32_t cli_bcapi_running_on_jit(struct cli_bc_ctx *ctx );
124 int32_t cli_bcapi_get_file_reliability(struct cli_bc_ctx *ctx );
125 int32_t cli_bcapi_json_is_active(struct cli_bc_ctx *ctx );
126 int32_t cli_bcapi_json_get_object(struct cli_bc_ctx *ctx , const int8_t*, int32_t, int32_t);
127 int32_t cli_bcapi_json_get_type(struct cli_bc_ctx *ctx , int32_t);
128 int32_t cli_bcapi_json_get_array_length(struct cli_bc_ctx *ctx , int32_t);
129 int32_t cli_bcapi_json_get_array_idx(struct cli_bc_ctx *ctx , int32_t, int32_t);
130 int32_t cli_bcapi_json_get_string_length(struct cli_bc_ctx *ctx , int32_t);
131 int32_t cli_bcapi_json_get_string(struct cli_bc_ctx *ctx , int8_t*, int32_t, int32_t);
132 int32_t cli_bcapi_json_get_boolean(struct cli_bc_ctx *ctx , int32_t);
133 int32_t cli_bcapi_json_get_int(struct cli_bc_ctx *ctx , int32_t);
134 uint32_t cli_bcapi_engine_scan_options_ex(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
135 int32_t cli_bcapi_lzma_init(struct cli_bc_ctx *ctx , int32_t, int32_t);
136 int32_t cli_bcapi_lzma_process(struct cli_bc_ctx *ctx , int32_t);
137 int32_t cli_bcapi_lzma_done(struct cli_bc_ctx *ctx , int32_t);
138 int32_t cli_bcapi_bzip2_init(struct cli_bc_ctx *ctx , int32_t, int32_t);
139 int32_t cli_bcapi_bzip2_process(struct cli_bc_ctx *ctx , int32_t);
140 int32_t cli_bcapi_bzip2_done(struct cli_bc_ctx *ctx , int32_t);
141 
142 #endif
143