Author: ahmed Date: 2009-08-04 13:10:58 +0000 (Tue, 04 Aug 2009) New Revision: 6
Added: include/fkiptc.h Modified: src/CMakeLists.txt src/fkiptc.c tests/CMakeLists.txt Log: Adding fkiptc.h file, modifying CMakeLists
Added: include/fkiptc.h =================================================================== --- include/fkiptc.h (rev 0) +++ include/fkiptc.h 2009-08-04 13:10:58 UTC (rev 6) @@ -0,0 +1 @@ +void flush_input_chain(void);
Modified: src/CMakeLists.txt =================================================================== --- src/CMakeLists.txt 2009-08-01 13:46:32 UTC (rev 5) +++ src/CMakeLists.txt 2009-08-04 13:10:58 UTC (rev 6) @@ -0,0 +1 @@ +ADD_LIBRARY(fkiptc fkiptc.c)
Modified: src/fkiptc.c =================================================================== --- src/fkiptc.c 2009-08-01 13:46:32 UTC (rev 5) +++ src/fkiptc.c 2009-08-04 13:10:58 UTC (rev 6) @@ -15,6 +15,8 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Copyright 2009 Ahmed Kamal
+#pragma once +#include "fkiptc.h" #include <getopt.h> #include <sys/errno.h> #include <stdio.h> @@ -26,43 +28,48 @@ #include "libiptc/libiptc.h" #include "/usr/src/kernels/2.6.29.6-213.fc11.x86_64/include/config/ip/nf/iptables.h"
-int main(void) +// int main(void) +// { +// struct iptc_handle *h; +// const char *chain = NULL; +// const char *tablename = "filter"; +// struct ipt_counters counters; +// const char *policy = NULL; +// int retcoz = 7; +// +// // program_name = "p1"; +// // program_version = NETFILTER_VERSION; +// +// h = iptc_init(tablename); +// if ( !h ) { +// printf("Error initializing: %s\n", iptc_strerror(errno)); +// exit(errno); +// } +// +// for (chain = iptc_first_chain(h); chain; chain = iptc_next_chain(h)) { +// // printf("%s\n", chain); +// if ( (policy = iptc_get_policy(chain, &counters, h)) ) { +// printf("%-10s %-10s\n", +// chain, policy); +// } +// +// } +// // Flush INPUT chain +// chain = iptc_first_chain(h); +// printf("Resetting chain %-10s ", chain); +// //ipt_chainlabel xx = "INPUT"; +// retcoz = iptc_flush_entries( chain , h); +// printf("Return code : %d\n", retcoz); +// retcoz = iptc_commit(h); +// if (!retcoz) +// { +// printf("Commit Error"); +// } +// exit(0); +// +// } /* main */ + +void flush_input_chain(void) { - struct iptc_handle *h; - const char *chain = NULL; - const char *tablename = "filter"; - struct ipt_counters counters; - const char *policy = NULL; - int retcoz = 7; - -// program_name = "p1"; -// program_version = NETFILTER_VERSION; - - h = iptc_init(tablename); - if ( !h ) { - printf("Error initializing: %s\n", iptc_strerror(errno)); - exit(errno); - } - - for (chain = iptc_first_chain(h); chain; chain = iptc_next_chain(h)) { -// printf("%s\n", chain); - if ( (policy = iptc_get_policy(chain, &counters, h)) ) { - printf("%-10s %-10s\n", - chain, policy); - } - - } -// Flush INPUT chain - chain = iptc_first_chain(h); - printf("Resetting chain %-10s ", chain); - //ipt_chainlabel xx = "INPUT"; - retcoz = iptc_flush_entries( chain , h); - printf("Return code : %d\n", retcoz); - retcoz = iptc_commit(h); - if (!retcoz) - { - printf("Commit Error"); - } - exit(0); - -} /* main */ + printf("Inside flush Input\n"); +}
Modified: tests/CMakeLists.txt =================================================================== --- tests/CMakeLists.txt 2009-08-01 13:46:32 UTC (rev 5) +++ tests/CMakeLists.txt 2009-08-04 13:10:58 UTC (rev 6) @@ -0,0 +1,2 @@ +ADD_EXECUTABLE(fkiptc-test1 fkiptc-test1.c) +TARGET_LINK_LIBRARIES(fkiptc-test1 fkiptc)
firekit-devel@lists.fedorahosted.org