Introduce generic host config and related helpers
Add generic host config struct and related helpers for TCP-based probes
and use them for ctrl probe.
This will be used in follow-up patch for OpenVPN probe as well.
Change-Id: Ie321655a92cdbefbfaa056ac0d583397c83beccb
diff --git a/src/client.h b/src/client.h
new file mode 100644
index 0000000..605ddd7
--- /dev/null
+++ b/src/client.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+
+enum match_kind {
+ MATCH_NAME,
+ MATCH_HOST,
+ MATCH_BOTH,
+ MATCH_EITHER,
+};
+
+/* a client config */
+struct host_cfg {
+ /* name of this client */
+ const char *name;
+ /* remote host/IP */
+ const char *remote_host;
+ /* remote port */
+ uint16_t remote_port;
+};
+
+struct host_cfg *host_cfg_alloc(void *ctx, const char *name, const char *host, uint16_t port);
+bool match_config(const struct host_cfg *cfg, const char *match, enum match_kind k);
+char *make_authority(void *ctx, const struct host_cfg *cfg);