]> git.ipfire.org Git - zone-sync.git/commitdiff
main: Create a new network manager
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 11 May 2026 09:13:28 +0000 (09:13 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 11 May 2026 09:13:28 +0000 (09:13 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
main.c

diff --git a/main.c b/main.c
index beb9b5ac4af6eecdd2c63109f62270f8cc0f8db9..4dbaf42dfee3721a22ea0f44779a579de8de3280 100644 (file)
--- a/main.c
+++ b/main.c
@@ -26,6 +26,7 @@
 
 #include <isc/loop.h>
 #include <isc/mem.h>
+#include <isc/netmgr.h>
 
 typedef struct ctx {
        int log_level;
@@ -35,6 +36,9 @@ typedef struct ctx {
 
        // Loop Manager
        isc_loopmgr_t* loopmgr;
+
+       // Network Manager
+       isc_nm_t* netmgr;
 } ctx_t;
 
 static void logger(ctx_t* ctx, int priority, const char* format, ...) {
@@ -142,6 +146,9 @@ int main(int argc, char* argv[]) {
        // Initialize the loop manager
        isc_loopmgr_create(ctx.memctx, 1, &ctx.loopmgr);
 
+       // Create a new netmgr
+       isc_netmgr_create(ctx.memctx, ctx.loopmgr, &ctx.netmgr);
+
        // Register a callback to be called when the loop starts
        isc_loopmgr_setup(ctx.loopmgr, run_loop, &ctx);
 
@@ -149,6 +156,7 @@ int main(int argc, char* argv[]) {
        isc_loopmgr_run(ctx.loopmgr);
 
 ERROR:
+       isc_netmgr_destroy(&ctx.netmgr);
        isc_loopmgr_destroy(&ctx.loopmgr);
 
        return 0;