autotools cleanups:
[framework/uifw/eet.git] / src / lib / Eet_private.h
1 /*
2  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3  */
4
5 #ifndef _EET_PRIVATE_H
6 #define _EET_PRIVATE_H
7
8 #ifdef __GNUC__
9 # if __GNUC__ >= 4
10 // BROKEN in gcc 4 on amd64
11 //#  pragma GCC visibility push(hidden)
12 # endif
13 #endif
14
15 #ifdef HAVE_CONFIG_H
16 # include <config.h>
17 #endif
18
19 #ifdef HAVE_OPENSSL
20 #include <openssl/evp.h>
21 #include <openssl/x509.h>
22 #include <openssl/pem.h>
23 #endif
24
25 typedef struct _Eet_String              Eet_String;
26
27 struct _Eet_String
28 {
29   const char            *mmap;
30   char                  *str;
31
32   int                    hash;
33   int                    len;
34
35   int                    next;
36   int                    prev;
37
38   union
39   {
40     float                f;
41     double               d;
42   } convert;
43
44   struct
45   {
46     unsigned int         converted : 1;
47     unsigned int         is_float : 1;
48   } flags;
49 };
50 struct _Eet_Dictionary
51 {
52   Eet_String   *all;
53
54   int           size;
55   int           offset;
56
57   int           hash[256];
58
59   int           count;
60   int           total;
61
62   const char   *start;
63   const char   *end;
64 };
65
66 struct _Eet_Key
67 {
68    int          references;
69 #ifdef HAVE_SIGNATURE
70    X509        *certificate;
71    EVP_PKEY    *private_key;
72 #endif
73 };
74
75 Eet_Dictionary  *eet_dictionary_add(void);
76 void             eet_dictionary_free(Eet_Dictionary *ed);
77 int              eet_dictionary_string_add(Eet_Dictionary *ed, const char *string);
78 int              eet_dictionary_string_get_size(const Eet_Dictionary *ed, int index);
79 const char      *eet_dictionary_string_get_char(const Eet_Dictionary *ed, int index);
80 int              eet_dictionary_string_get_float(const Eet_Dictionary *ed, int index, float *result);
81 int              eet_dictionary_string_get_double(const Eet_Dictionary *ed, int index, double *result);
82 int              eet_dictionary_string_get_hash(const Eet_Dictionary *ed, int index);
83
84 int   _eet_hash_gen(const char *key, int hash_size);
85
86 const void* eet_identity_check(const void *data_base, unsigned int data_length,
87                                const void *signature_base, unsigned int signature_length,
88                                int *x509_length);
89 Eet_Error eet_cypher(void *data, unsigned int size, const char *key, unsigned int length);
90 Eet_Error eet_decypher(void *data, unsigned int size, const char *key, unsigned int length);
91 Eet_Error eet_identity_sign(FILE *fp, Eet_Key *key);
92 void eet_identity_unref(Eet_Key *key);
93 void eet_identity_ref(Eet_Key *key);
94
95 #ifndef PATH_MAX
96 #define PATH_MAX 4096
97 #endif
98
99 #ifdef DNDEBUG
100 #define EET_ASSERT(Test, Do) if (Test == 0) Do;
101 #else
102 #define EET_ASSERT(Test, Do) if (Test == 0) abort();
103 #endif
104
105 #endif