libclamav/type_desc.h
cf0cd429
 /*
  *  ClamAV bytecode internal API
  *
  *  Copyright (C) 2009 Sourcefire, Inc.
  *
  *  Authors: Török Edvin
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  *  MA 02110-1301, USA.
  */
 #ifndef TYPE_DESC_H
 #define TYPE_DESC_H
 
88815fd8
 #include "clambc.h"
1a486dca
 struct cli_bc_ctx;
 
8cc286f5
 enum derived_t {
c466339d
   DFunctionType,
   DPointerType,
   DStructType,
   DPackedStructType,
   DArrayType
8cc286f5
 };
 
 struct cli_bc_type {
     enum derived_t kind;
     uint16_t *containedTypes;
     unsigned numElements;
70ab1a08
     uint32_t size;
7a14dc4c
     unsigned align;
8cc286f5
 };
 
d0af4afe
 typedef uint32_t (*cli_apicall_int2)(struct cli_bc_ctx *, uint32_t, uint32_t);
 typedef uint32_t (*cli_apicall_pointer)(struct cli_bc_ctx *, void*, uint32_t);
2d45ef06
 typedef uint32_t (*cli_apicall_int1)(struct cli_bc_ctx *, uint32_t);
 typedef void* (*cli_apicall_malloclike)(struct cli_bc_ctx *, uint32_t);
50829fbf
 typedef int32_t (*cli_apicall_ptrbuffdata)(struct cli_bc_ctx *, void*, uint32_t, uint32_t, uint32_t, uint32_t);
75e18b29
 typedef int32_t (*cli_apicall_allocobj)(struct cli_bc_ctx *);
6ad39a40
 typedef void* (*cli_apicall_bufget)(struct cli_bc_ctx *, int32_t, uint32_t);
 typedef int32_t (*cli_apicall_int3)(struct cli_bc_ctx *, int32_t, int32_t, int32_t);
7a7365ef
 typedef int32_t (*cli_apicall_2bufs)(struct cli_bc_ctx *, void*, int32_t, void*, int32_t);
 typedef int32_t (*cli_apicall_ptrbufid)(struct cli_bc_ctx *, void*, int32_t, int32_t);
8cc286f5
 
 struct cli_apicall {
     const char *name;
cf0cd429
     uint16_t type;/* type id in cli_apicall_types array */
     uint16_t idx;
8cc286f5
     uint8_t kind;
 };
 
4bcd07ff
 struct cli_apiglobal {
     const char *name;
     enum bc_global globalid;
     uint16_t type;
88815fd8
     unsigned offset;
4bcd07ff
 };
 
853b6e5d
 #ifdef __cplusplus
 extern "C" {
 #endif
8cc286f5
 extern const struct cli_bc_type cli_apicall_types[];
cf0cd429
 extern const unsigned cli_apicall_maxtypes;
8cc286f5
 
4bcd07ff
 extern const struct cli_apiglobal cli_globals[];
 
8cc286f5
 extern const struct cli_apicall cli_apicalls[];
 extern const cli_apicall_int2 cli_apicalls0[];
 extern const cli_apicall_pointer cli_apicalls1[];
2d45ef06
 extern const cli_apicall_int1 cli_apicalls2[];
 extern const cli_apicall_malloclike cli_apicalls3[];
b56bea54
 extern const cli_apicall_ptrbuffdata cli_apicalls4[];
75e18b29
 extern const cli_apicall_allocobj cli_apicalls5[];
6ad39a40
 extern const cli_apicall_bufget cli_apicalls6[];
 extern const cli_apicall_int3 cli_apicalls7[];
7a7365ef
 extern const cli_apicall_2bufs cli_apicalls8[];
 extern const cli_apicall_ptrbufid cli_apicalls9[];
8cc286f5
 extern const unsigned cli_apicall_maxapi;
4bcd07ff
 extern const unsigned cli_apicall_maxglobal;
853b6e5d
 
 #ifdef __cplusplus
 }
 #endif
cf0cd429
 #endif