chiark / gitweb /
integer and buffer overflows: introduce safe_malloc_ary
[secnet.git] / secnet.h
index c3cadb9737a0feb03301017c6a04dd0afd4e6e21..18500c5cf3742421dddeb7d161082dfc4b4871c0 100644 (file)
--- a/secnet.h
+++ b/secnet.h
@@ -34,6 +34,18 @@ typedef enum {False,True} bool_t;
 #define ASSERT(x) do { if (!(x)) { fatal("assertion failed line %d file " \
                                         __FILE__,__LINE__); } } while(0)
 
+/* from version.c */
+
+extern char version[];
+
+/* from logmsg.c */
+extern uint32_t message_level;
+extern bool_t secnet_is_daemon;
+extern struct log_if *system_log;
+
+/* from process.c */
+extern void start_signal_handling(void);
+
 /***** CONFIGURATION support *****/
 
 extern bool_t just_check_config; /* If True then we're going to exit after
@@ -114,6 +126,7 @@ extern string_t dict_read_string(dict_t *dict, cstring_t key, bool_t required,
 extern uint32_t dict_read_number(dict_t *dict, cstring_t key, bool_t required,
                                 cstring_t desc, struct cloc loc,
                                 uint32_t def);
+  /* return value can safely be assigned to int32_t */
 extern bool_t dict_read_bool(dict_t *dict, cstring_t key, bool_t required,
                             cstring_t desc, struct cloc loc, bool_t def);
 struct flagstr {
@@ -131,6 +144,7 @@ extern uint32_t string_list_to_word(list_t *l, struct flagstr *f,
 
 extern char *safe_strdup(const char *string, const char *message);
 extern void *safe_malloc(size_t size, const char *message);
+extern void *safe_malloc_ary(size_t size, size_t count, const char *message);
 
 extern int sys_cmd(const char *file, const char *argc, ...);
 
@@ -198,6 +212,23 @@ extern cstring_t require_root_privileges_explanation;
    modules it's called "secnet_module". */
 typedef void init_module(dict_t *dict);
 
+extern void init_builtin_modules(dict_t *dict);
+
+extern init_module resolver_module;
+extern init_module random_module;
+extern init_module udp_module;
+extern init_module util_module;
+extern init_module site_module;
+extern init_module transform_module;
+extern init_module netlink_module;
+extern init_module rsa_module;
+extern init_module dh_module;
+extern init_module md5_module;
+extern init_module slip_module;
+extern init_module tun_module;
+extern init_module sha1_module;
+extern init_module log_module;
+
 /***** END of module support *****/
 
 /***** CLOSURE TYPES and interface definitions *****/
@@ -295,9 +326,11 @@ struct log_if {
     log_msg_fn *log;
     log_vmsg_fn *vlog;
 };
-/* (convenience function, defined in util.c) */
+/* (convenience functions, defined in util.c) */
 extern void slilog(struct log_if *lf, int class, const char *message, ...)
 FORMAT(printf,3,4);
+extern void vslilog(struct log_if *lf, int class, const char *message, va_list)
+FORMAT(printf,3,0);
 
 /* SITE interface */