bytecode_detect.h
00001 /*
00002  *  Copyright (C) 2009 Sourcefire, Inc.
00003  *  All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  *
00014  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND
00015  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00017  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00018  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00019  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00020  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00021  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00022  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00023  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00024  * SUCH DAMAGE.
00025  */
00026 #ifndef BYTECODE_DETECT_H
00027 #define BYTECODE_DETECT_H
00028 /* mostly from m4/acinclude.m4 */
00029 enum arch_list {
00030   arch_unknown=0,
00031   arch_i386,
00032   arch_x86_64,
00033   arch_ppc32,
00034   arch_ppc64,
00035   arch_arm,
00036   arch_sparc,
00037   arch_sparc64,
00038   arch_mips,
00039   arch_mips64,
00040   arch_alpha,
00041   arch_hppa1,
00042   arch_hppa2,
00043   arch_m68k,
00044   arch_ANY = 0xf
00045 };
00046 
00047 /* from ClamAV's configure.in */
00048 enum os_kind_conf {
00049   os_unknown=0,
00050   os_aix,
00051   os_beos,
00052   os_bsd,
00053   os_darwin,
00054   os_gnu_hurd,
00055   os_hpux,
00056   os_interix,
00057   os_irix,
00058   os_kfreebsd_gnu,
00059   os_linux,
00060   os_os2,
00061   os_osf,
00062   os_qnx6,
00063   os_solaris,
00064   os_win32,
00065   os_win64,
00066   os_ANY = 0xff
00067 };
00068 
00069 enum os_kind_llvm {
00070   llvm_os_UnknownOS=0,
00071   llvm_os_AuroraUX,
00072   llvm_os_Cygwin,
00073   llvm_os_Darwin,
00074   llvm_os_DragonFly,
00075   llvm_os_FreeBSD,
00076   llvm_os_Linux,
00077   llvm_os_Lv2,
00078   llvm_os_MinGW32,
00079   llvm_os_MinGW64,
00080   llvm_os_NetBSD,
00081   llvm_os_OpenBSD,
00082   llvm_os_Psp,
00083   llvm_os_Solaris,
00084   llvm_os_Win32,
00085   llvm_os_Haiku,
00086   llvm_os_ANY = 0xff
00087 };
00088 
00089 /* the ones from clamconf */
00090 enum compiler_list {
00091   compiler_unknown = 0,
00092   compiler_gnuc,
00093   compiler_llvm,
00094   compiler_clang,
00095   compiler_intel,
00096   compiler_msc,
00097   compiler_sun,
00098   compiler_other,
00099   compiler_ANY = 0xf
00100 };
00101 
00102 enum endian_list {
00103     endian_little=0,
00104     endian_big=1,
00105     endian_ANY=0xf
00106 };
00107 
00108 enum os_feature_bits {
00109     feature_map_rwx = 0,
00110     feature_selinux = 1,
00111     feature_selinux_enforcing = 2,
00112     feature_pax = 3,
00113     feature_pax_mprotect = 4
00114 };
00115 
00116 struct cli_environment {
00117     uint32_t platform_id_a;
00118     uint32_t platform_id_b;
00119     uint32_t platform_id_c;
00120     uint32_t c_version;
00121     uint32_t cpp_version; /* LLVM only */
00122     /* engine */
00123     uint32_t functionality_level;
00124     uint32_t dconf_level;
00125     int8_t   engine_version[65];
00126     /* detailed runtime info */
00127     int8_t    triple[65];/* LLVM only */
00128     int8_t    cpu[65];/* LLVM only */
00129     /* uname */
00130     int8_t    sysname[65];
00131     int8_t    release[65];
00132     int8_t    version[65];
00133     int8_t    machine[65];
00134     /* build time */
00135     uint8_t big_endian;
00136     uint8_t sizeof_ptr;
00137     uint8_t arch;
00138     uint8_t os_category;/* from configure */
00139     uint8_t os;/* from LLVM if available */
00140     uint8_t compiler;
00141     uint8_t has_jit_compiled;
00142     uint8_t os_features;
00143     uint8_t reserved0;
00144 };
00145 
00146 #ifndef __CLAMBC__
00147 #define MAKE_VERSION(a,b,c,d) ((a << 24) | (b << 16) | (c << 8) | d)
00148 #define INIT_STRFIELD(field, value) do {\
00149     strncpy((char*)(field), (value), sizeof(field)-1);\
00150     (field)[sizeof(field)-1]=0;\
00151 } while (0)
00152 #endif
00153 
00154 #endif
 All Data Structures Files Functions Variables Enumerations Enumerator Defines