Open SCAP Library
/home/pvrabec/project/openscap/openscap-0.7.4/src/OVAL/probes/SEAP/public/sexp-types.h
00001 /*
00002  * Copyright 2009 Red Hat Inc., Durham, North Carolina.
00003  * All Rights Reserved.
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  *
00019  * Authors:
00020  *      "Daniel Kopecek" <dkopecek@redhat.com>
00021  */
00022 
00023 #pragma once
00024 #ifndef SEXP_TYPES_H
00025 #define SEXP_TYPES_H
00026 
00027 #include <stdint.h>
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 typedef uint8_t SEXP_numtype_t;
00034 
00035 /* Number types */
00036 #define SEXP_NUM_NONE    0x00
00037 #define SEXP_NUM_BOOL    0x01
00038 #define SEXP_NUM_INT8    0x07
00039 #define SEXP_NUM_UINT8   0x08
00040 #define SEXP_NUM_INT16   0x0f
00041 #define SEXP_NUM_UINT16  0x10
00042 #define SEXP_NUM_INT32   0x1f
00043 #define SEXP_NUM_UINT32  0x20
00044 #define SEXP_NUM_INT64   0x3f
00045 #define SEXP_NUM_UINT64  0x40
00046 #define SEXP_NUM_DOUBLE  0x41
00047 
00048 /* Aliases */
00049 
00050 #define SEXP_NUM_BOOLEAN       SEXP_NUM_BOOL
00051 #define SEXP_NUM_CHAR          SEXP_NUM_INT8
00052 #define SEXP_NUM_UCHAR         SEXP_NUM_UINT8
00053 #define SEXP_NUM_SHORTINT      SEXP_NUM_INT16
00054 #define SEXP_NUM_USHORTINT     SEXP_NUM_UINT16
00055 #define SEXP_NUM_SHORTUINT     SEXP_NUM_UINT16
00056 #define SEXP_NUM_INT           SEXP_NUM_INT32
00057 #define SEXP_NUM_LONGINT       SEXP_NUM_INT32
00058 #define SEXP_NUM_UINT          SEXP_NUM_UINT32
00059 #define SEXP_NUM_ULONGINT      SEXP_NUM_UINT32
00060 #define SEXP_NUM_LONGUINT      SEXP_NUM_UINT32
00061 #define SEXP_NUM_LONLONGINT    SEXP_NUM_INT64
00062 #define SEXP_NUM_ULONGLONGINT  SEXP_NUM_UINT64
00063 #define SEXP_NUM_LONGLONGUINT  SEXP_NUM_UINT64
00064 #define SEXP_NUM_FLOAT         SEXP_NUM_DOUBLE
00065 
00066 #if 0
00067 # define NUM_FRACT  0x0a /* Not implemented */
00068 # define NUM_BIGNUM 0x0b /* Not implemented */
00069 #endif
00070 
00071 /* S-expression format */
00072 typedef uint8_t SEXP_format_t;
00073 
00074 #define SEXP_FMT_UNDEFINED  0
00075 #define SEXP_FMT_TRANSPORT  1
00076 #define SEXP_FMT_CANONICAL  2
00077 #define SEXP_FMT_ADVANCED   3
00078 #define SEXP_FMT_AUTODETECT 4
00079 
00080 #include <assert.h>
00081 #ifndef _A
00082 # define _A(x) assert(x)
00083 #endif
00084 
00085 #define SEXP_TYPE_EMPTY  0
00086 #define SEXP_TYPE_STRING 1
00087 #define SEXP_TYPE_NUMBER 2
00088 #define SEXP_TYPE_LIST   3
00089 
00090 typedef uint8_t SEXP_type_t;
00091 
00092 struct SEXP {
00093 #if !defined(NDEBUG) || defined(VALIDATE_SEXP)
00094         volatile uint16_t __magic0;
00095 #endif
00096 
00097         void     *s_type;
00098         uintptr_t s_valp;
00099 
00100 #if !defined(NDEBUG) || defined(VALIDATE_SEXP)
00101         volatile uint16_t __magic1;
00102 #endif
00103 };
00104 
00105 typedef struct SEXP SEXP_t;
00106 
00107 #ifdef __cplusplus
00108 }
00109 #endif
00110 
00111 #endif /* SEXP_TYPES_H */