… | |
… | |
34 | #ifndef UTIL_H__ |
34 | #ifndef UTIL_H__ |
35 | #define UTIL_H__ |
35 | #define UTIL_H__ |
36 | |
36 | |
37 | #include <cstring> |
37 | #include <cstring> |
38 | #include <sys/types.h> |
38 | #include <sys/types.h> |
39 | |
|
|
40 | #include <openssl/rsa.h> |
|
|
41 | |
39 | |
42 | #include "gettext.h" |
40 | #include "gettext.h" |
43 | |
41 | |
44 | #include "slog.h" |
42 | #include "slog.h" |
45 | #include "ev_cpp.h" |
43 | #include "ev_cpp.h" |
… | |
… | |
133 | u8 *base64_encode (const u8 *data, unsigned int len); |
131 | u8 *base64_encode (const u8 *data, unsigned int len); |
134 | #endif |
132 | #endif |
135 | |
133 | |
136 | /*****************************************************************************/ |
134 | /*****************************************************************************/ |
137 | |
135 | |
|
|
136 | void rand_fill (void *data, int len); |
|
|
137 | |
|
|
138 | template<class T> |
|
|
139 | inline void rand_fill (T &t) |
|
|
140 | { |
|
|
141 | rand_fill (&t, sizeof (T)); |
|
|
142 | } |
|
|
143 | |
|
|
144 | /*****************************************************************************/ |
|
|
145 | |
138 | // run work_cb in another thread, call done_cb in main thread when finished |
146 | // run work_cb in another thread, call done_cb in main thread when finished |
139 | // only one work_cb will execute at any one time. |
147 | // only one work_cb will execute at any one time. |
140 | void async (callback<void ()> work_cb, callback<void ()> done_cb); |
148 | void async (callback<void ()> work_cb, callback<void ()> done_cb); |
141 | |
149 | |
142 | #endif |
150 | #endif |