summaryrefslogtreecommitdiffstats
path: root/src/fastd.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fastd.h')
-rw-r--r--src/fastd.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/fastd.h b/src/fastd.h
index 5e62fb0..f402be8 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -132,6 +132,11 @@ struct _fastd_context {
unsigned int randseed;
};
+struct _fastd_config_str {
+ fastd_config_str *next;
+ char str[];
+};
+
void fastd_printf(const fastd_context *ctx, const char *format, ...);
void fastd_read_config_dir(fastd_context *ctx, fastd_config *conf, const char *dir, int depth);
@@ -225,6 +230,22 @@ static inline size_t fastd_max_packet_size(const fastd_context *ctx) {
}
}
+static inline fastd_config_str* fastd_config_str_dup(const char *str) {
+ fastd_config_str *ret = malloc(sizeof(fastd_config_str) + strlen(str) + 1);
+ ret->next = NULL;
+ strcpy(ret->str, str);
+
+ return ret;
+}
+
+static inline void fastd_config_str_free(fastd_config_str *str) {
+ while(str) {
+ fastd_config_str *next = str->next;
+ free(str);
+ str = next;
+ }
+}
+
static inline bool timespec_after(const struct timespec *tp1, const struct timespec *tp2) {
return (tp1->tv_sec > tp2->tv_sec ||
(tp1->tv_sec == tp2->tv_sec && tp1->tv_nsec > tp2->tv_nsec));