commit 35c6cd0e100a9bf0cc9354f261b656d497fa34cd from: Omar Polo date: Mon Jan 10 19:16:27 2022 UTC move table definitions to table.h commit - 116ee6e420f66fb76dd885361d9d80765bbee07b commit + 35c6cd0e100a9bf0cc9354f261b656d497fa34cd blob - db48d7e0a64590177becf74fe80661d26f1c0d01 blob + db25c4112dcb5d9713a34fc25b24c1d432b60eab --- kamid/kamid.h +++ kamid/kamid.h @@ -53,30 +53,8 @@ struct kd_options_conf { /* ... */ }; -enum table_type { - T_NONE = 0, - T_HASH = 0x01, -}; +struct table; -struct table { - char t_name[LINE_MAX]; - enum table_type t_type; - char t_path[PATH_MAX]; - void *t_handle; - struct table_backend *t_backend; -}; - -struct table_backend { - const char *name; - int (*open)(struct table *); - int (*add)(struct table *, const char *, const char *); - int (*lookup)(struct table *, const char *, char **); - void (*close)(struct table *); -}; - -/* table_static.c */ -extern struct table_backend table_static; - #define L_NONE 0x0 #define L_TLS 0x1 struct kd_listen_conf { blob - 441a98c2d2203d5c5de63b34018689b42d132d86 blob + 349da7d484c5aa3cfe63cf34384860cdd7fcf814 --- kamid/table.h +++ kamid/table.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Omar Polo + * Copyright (c) 2021, 2022 Omar Polo * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -17,6 +17,30 @@ #ifndef TABLE_H #define TABLE_H +enum table_type { + T_NONE = 0, + T_HASH = 0x01, +}; + +struct table { + char t_name[LINE_MAX]; + enum table_type t_type; + char t_path[PATH_MAX]; + void *t_handle; + struct table_backend *t_backend; +}; + +struct table_backend { + const char *name; + int (*open)(struct table *); + int (*add)(struct table *, const char *, const char *); + int (*lookup)(struct table *, const char *, char **); + void (*close)(struct table *); +}; + +/* table_static.c */ +extern struct table_backend table_static; + int table_open(struct kd_conf *, const char *, const char *, const char *); int table_add(struct table *, const char *, const char *); int table_lookup(struct table *, const char *, char **); blob - 550bb623efc8f59242d5ce988876022df5e09e01 blob + b7e0bc26af5909933e7c490f75bcebff16a7a6ce --- kamid/table_static.c +++ kamid/table_static.c @@ -23,6 +23,7 @@ #include "utils.h" #include "kamid.h" +#include "table.h" static void *hash_alloc(size_t, void *); static void *hash_calloc(size_t, size_t, void *);