summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/s6-networking/accessrules.h53
-rw-r--r--src/include/s6-networking/ident.h26
-rw-r--r--src/include/s6-networking/s6net.h9
3 files changed, 88 insertions, 0 deletions
diff --git a/src/include/s6-networking/accessrules.h b/src/include/s6-networking/accessrules.h
new file mode 100644
index 0000000..ec7a0d5
--- /dev/null
+++ b/src/include/s6-networking/accessrules.h
@@ -0,0 +1,53 @@
+/* ISC license. */
+
+#ifndef S6NET_ACCESSRULES_H
+#define S6NET_ACCESSRULES_H
+
+#include <skalibs/cdb.h>
+#include <skalibs/stralloc.h>
+#include <skalibs/ip46.h>
+
+typedef struct s6net_accessrules_params_s s6net_accessrules_params_t, *s6net_accessrules_params_t_ref ;
+struct s6net_accessrules_params_s
+{
+ stralloc env ;
+ stralloc exec ;
+} ;
+#define S6NET_ACCESSRULES_PARAMS_ZERO { STRALLOC_ZERO, STRALLOC_ZERO }
+
+typedef enum s6net_accessrules_result_e s6net_accessrules_result_t, *s6net_accessrules_result_t_ref ;
+enum s6net_accessrules_result_e
+{
+ S6NET_ACCESSRULES_ERROR = -1,
+ S6NET_ACCESSRULES_DENY = 0,
+ S6NET_ACCESSRULES_ALLOW = 1,
+ S6NET_ACCESSRULES_NOTFOUND = 2
+} ;
+
+typedef s6net_accessrules_result_t s6net_accessrules_backend_func_t (char const *, unsigned int, void *, s6net_accessrules_params_t *) ;
+typedef s6net_accessrules_backend_func_t *s6net_accessrules_backend_func_t_ref ;
+
+extern s6net_accessrules_backend_func_t s6net_accessrules_backend_fs ;
+extern s6net_accessrules_backend_func_t s6net_accessrules_backend_cdb ;
+
+typedef s6net_accessrules_result_t s6net_accessrules_keycheck_func_t (void const *, void *, s6net_accessrules_params_t *, s6net_accessrules_backend_func_t_ref) ;
+typedef s6net_accessrules_keycheck_func_t *s6net_accessrules_keycheck_func_t_ref ;
+
+extern s6net_accessrules_keycheck_func_t s6net_accessrules_keycheck_uidgid ;
+extern s6net_accessrules_keycheck_func_t s6net_accessrules_keycheck_ip4 ;
+extern s6net_accessrules_keycheck_func_t s6net_accessrules_keycheck_ip6 ;
+extern s6net_accessrules_keycheck_func_t s6net_accessrules_keycheck_reversedns ;
+#define s6net_accessrules_keycheck_ip46(key, data, params, f) (ip46_is6((ip46_t const *)(key)) ? s6net_accessrules_keycheck_ip6(((ip46_t const *)(key))->ip, data, params, f) : s6net_accessrules_keycheck_ip4(((ip46_t const *)(key))->ip, data, params, f))
+
+extern s6net_accessrules_result_t s6net_accessrules_uidgid_cdb (unsigned int, unsigned int, struct cdb *, s6net_accessrules_params_t *) ;
+extern s6net_accessrules_result_t s6net_accessrules_uidgid_fs (unsigned int, unsigned int, char const *, s6net_accessrules_params_t *) ;
+#define s6net_accessrules_ip4_cdb(ip4, c, params) s6net_accessrules_keycheck_ip4(ip4, c, (params), &s6net_accessrules_backend_cdb)
+#define s6net_accessrules_ip4_fs(ip4, rulesdir, params) s6net_accessrules_keycheck_ip4(ip4, rulesdir, (params), &s6net_accessrules_backend_fs)
+#define s6net_accessrules_ip6_cdb(ip6, c, params) s6net_accessrules_keycheck_ip6(ip6, c, (params), &s6net_accessrules_backend_cdb)
+#define s6net_accessrules_ip6_fs(ip6, rulesdir, params) s6net_accessrules_keycheck_ip6(ip6, rulesdir, (params), &s6net_accessrules_backend_fs)
+#define s6net_accessrules_ip46_cdb(ip, c, params) s6net_accessrules_keycheck_ip46(ip, c, (params), &s6net_accessrules_backend_cdb)
+#define s6net_accessrules_ip46_fs(ip, rulesdir, params) s6net_accessrules_keycheck_ip46(ip, rulesdir, (params), &s6net_accessrules_backend_fs)
+#define s6net_accessrules_reversedns_cdb(name, c, params) s6net_accessrules_keycheck_reversedns(name, c, (params), &s6net_accessrules_backend_cdb)
+#define s6net_accessrules_reversedns_fs(name, c, params) s6net_accessrules_keycheck_reversedns(name, c, (params), &s6net_accessrules_backend_fs)
+
+#endif
diff --git a/src/include/s6-networking/ident.h b/src/include/s6-networking/ident.h
new file mode 100644
index 0000000..723fc89
--- /dev/null
+++ b/src/include/s6-networking/ident.h
@@ -0,0 +1,26 @@
+/* ISC license. */
+
+#ifndef IDENT1413_H
+#define IDENT1413_H
+
+#include <skalibs/uint16.h>
+#include <skalibs/tai.h>
+#include <skalibs/ip46.h>
+
+#define S6NET_IDENT_ID_SIZE 512
+#define S6NET_IDENT_REPLY_SIZE 1024
+
+ /* High-level */
+
+extern int s6net_ident_client (char *, unsigned int, ip46_t const *, uint16, ip46_t const *, uint16, tain_t const *, tain_t *) ;
+#define s6net_ident_client_g(s, max, ra, rp, la, lp, deadline) s6net_ident_client(s, max, ra, rp, la, lp, (deadline), &STAMP)
+extern char const *s6net_ident_error_str (int) ;
+
+
+ /* Low-level */
+
+extern int s6net_ident_reply_get (char *, ip46_t const *, uint16, ip46_t const *, uint16, tain_t const *, tain_t *) ;
+#define s6net_ident_reply_get_g(s, ra, rp, la, lp, deadline) s6net_ident_reply_get(s, ra, rp, la, lp, (deadline), &STAMP)
+extern int s6net_ident_reply_parse (char const *, uint16, uint16) ;
+
+#endif
diff --git a/src/include/s6-networking/s6net.h b/src/include/s6-networking/s6net.h
new file mode 100644
index 0000000..81d804e
--- /dev/null
+++ b/src/include/s6-networking/s6net.h
@@ -0,0 +1,9 @@
+/* ISC license. */
+
+#ifndef S6NET_H
+#define S6NET_H
+
+#include <s6-networking/accessrules.h>
+#include <s6-networking/ident.h>
+
+#endif