summaryrefslogtreecommitdiffstats
path: root/eurephiafw.c
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2008-08-25 02:05:48 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2008-08-25 02:05:48 +0200
commit32788f6eba3c51e0bea1fc23baea75dd1a01022e (patch)
tree038478862a06a29e371176932c7d1c05e31f5f81 /eurephiafw.c
parentc98902db2f6c89642eede09ed1d0d1de3318e2a2 (diff)
downloadeurephia-32788f6eba3c51e0bea1fc23baea75dd1a01022e.tar.gz
eurephia-32788f6eba3c51e0bea1fc23baea75dd1a01022e.tar.xz
eurephia-32788f6eba3c51e0bea1fc23baea75dd1a01022e.zip
Added first attempt to make the firewall interface communictate
Diffstat (limited to 'eurephiafw.c')
-rw-r--r--eurephiafw.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/eurephiafw.c b/eurephiafw.c
index aa84537..0866cf1 100644
--- a/eurephiafw.c
+++ b/eurephiafw.c
@@ -201,3 +201,28 @@ void eFW_StopFirewall(eurephiaCTX *ctx) {
eurephia_log(ctx, LOG_INFO, 3, "eurephia firewall interface is stopped");
}
+
+int eFW_UpdateFirewall(eurephiaCTX *ctx, int mode, const char *data) {
+ char buf[512];
+
+ switch( mode ) {
+ case FWRULE_ADD:
+ eurephia_log(ctx, LOG_INFO, 1, "Function call: eFW_UpdateFirewall(ctx, %s, '%s')",
+ "ADD", data);
+ snprintf(buf, 500, "ADD %s%c", data, 0);
+ mq_send((*ctx->fwcfg).thrdata.msgq, buf, strlen(buf)+1, 1);
+ return 1;
+
+ case FWRULE_DELETE:
+ eurephia_log(ctx, LOG_INFO, 1, "Function call: eFW_UpdateFirewall(ctx, %s, '%s')",
+ "DELETE", data);
+ snprintf(buf, 500, "DEL %s%c", data, 0);
+ mq_send((*ctx->fwcfg).thrdata.msgq, buf, strlen(buf)+1, 1);
+ return 1;
+
+ default:
+ eurephia_log(ctx, LOG_CRITICAL, 0,
+ "Function call: eFW_UpdateFirewall(ctx, %s, '%s') - UNKNOWN MODE", "(unknown)", data);
+ return 0;
+ }
+}