r8 - include
by abd4lla@fedoraproject.org
Author: abd4lla
Date: 2009-08-07 02:30:13 +0000 (Fri, 07 Aug 2009)
New Revision: 8
Added:
include/firedbus.h
Log:
Adds initial dbus object header
Added: include/firedbus.h
===================================================================
--- include/firedbus.h (rev 0)
+++ include/firedbus.h 2009-08-07 02:30:13 UTC (rev 8)
@@ -0,0 +1,50 @@
+/*
+ * Copyright/Licensing information.
+ */
+
+/* inclusion guard */
+#ifndef __FIRED_FDBUS_H__
+#define __FIRED_FDBUS_H__
+
+#include <glib-object.h>
+/*
+ * Potentially, include other headers on which this header depends.
+ */
+
+/*
+ * Type macros.
+ */
+#define FIRED_TYPE_FDBUS (fired_fdbus_get_type())
+#define FIRED_FDBUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FIRED_TYPE_FDBUS, FiredFDBus))
+#define FIRED_IS_FDBUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FIRED_TYPE_FDBUS))
+#define FIRED_FDBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FIRED_TYPE_FDBUS, FiredFDBusClass))
+#define FIRED_IS_FDBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FIRED_TYPE_FDBUS))
+#define FIRED_FDBUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FIRED_TYPE_FDBUS, FiredFDBusClass))
+
+typedef struct _FiredFDBus FiredFDBus;
+typedef struct _FiredFDBusClass FiredFDBusClass;
+
+struct _FiredFDBus
+{
+ GObject parent_instance;
+
+ /* instance members */
+ gint open_port(void);
+};
+
+struct _FiredFDBusClass
+{
+ GObjectClass parent_class;
+
+ /* class members */
+};
+
+/* used by MAMAN_TYPE_BAR */
+GType fired_fdbus_get_type (void);
+
+/*
+ * Method definitions.
+ */
+
+#endif /* __FIRED_FDBUS_H__ */
+
14 years, 9 months
r7 - include src tests
by abd4lla@fedoraproject.org
Author: abd4lla
Date: 2009-08-05 05:45:45 +0000 (Wed, 05 Aug 2009)
New Revision: 7
Added:
include/fired.h
src/fired.c
Modified:
src/CMakeLists.txt
tests/CMakeLists.txt
Log:
Added initial daemon files, code stub only
Added: include/fired.h
===================================================================
--- include/fired.h (rev 0)
+++ include/fired.h 2009-08-05 05:45:45 UTC (rev 7)
@@ -0,0 +1,34 @@
+// Author: Abd4llA "Ahmed Abdalla" <abd4lla(a)fedoraproject.org>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Library General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// Copyright 2009 Abd4llA
+
+#ifndef FIRED_H
+#define FIRED_H
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <syslog.h>
+#include <string.h>
+
+
+int32_t fired_init_daemon(void);
+int32_t fired_register_to_dbus(void);
+
+#endif
Modified: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt 2009-08-04 13:10:58 UTC (rev 6)
+++ src/CMakeLists.txt 2009-08-05 05:45:45 UTC (rev 7)
@@ -1 +1,2 @@
+ADD_EXECUTABLE(fired fired.c)
ADD_LIBRARY(fkiptc fkiptc.c)
Added: src/fired.c
===================================================================
--- src/fired.c (rev 0)
+++ src/fired.c 2009-08-05 05:45:45 UTC (rev 7)
@@ -0,0 +1,76 @@
+// Author: Abd4llA "Ahmed Abdalla" <abd4lla(a)fedoraproject.org>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Library General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// Copyright 2009 Abd4llA
+#include "fired.h"
+int main(void) {
+
+ /* Our process ID and Session ID */
+ pid_t pid, sid;
+
+ /* Fork off the parent process */
+ pid = fork();
+ if (pid < 0) {
+ exit(EXIT_FAILURE);
+ }
+ /* If we got a good PID, then
+ * we can exit the parent process. */
+ if (pid > 0) {
+ exit(EXIT_SUCCESS);
+ }
+
+ /* Change the file mode mask */
+ umask(0);
+
+ /* Open any logs here */
+
+ /* Create a new SID for the child process */
+ sid = setsid();
+ if (sid < 0) {
+ /* Log the failure */
+ exit(EXIT_FAILURE);
+ }
+
+
+
+ /* Change the current working directory */
+ if ((chdir("/")) < 0) {
+ /* Log the failure */
+ exit(EXIT_FAILURE);
+ }
+
+ /* Close out the standard file descriptors */
+ close(STDIN_FILENO);
+ close(STDOUT_FILENO);
+ close(STDERR_FILENO);
+
+ int32_t logFile = open("/tmp/fired.log",O_RDWR | O_CREAT);
+ if (logFile < 0){
+ exit(EXIT_FAILURE);
+ }
+
+ char * msg = "Registering to dbus\n";
+
+ /* Register ourselves to dbus daemon */
+ //register_to_dbus();
+
+ /* The Big Loop */
+ while (1) {
+ /* Do some task here ... */
+ write(logFile, msg, strlen(msg));
+ sleep(30); /* wait 30 seconds */
+ }
+ exit(EXIT_SUCCESS);
+}
Modified: tests/CMakeLists.txt
===================================================================
--- tests/CMakeLists.txt 2009-08-04 13:10:58 UTC (rev 6)
+++ tests/CMakeLists.txt 2009-08-05 05:45:45 UTC (rev 7)
@@ -1,2 +1,2 @@
-ADD_EXECUTABLE(fkiptc-test1 fkiptc-test1.c)
-TARGET_LINK_LIBRARIES(fkiptc-test1 fkiptc)
+#ADD_EXECUTABLE(fkiptc-test1 fkiptc-test1.c)
+#TARGET_LINK_LIBRARIES(fkiptc-test1 fkiptc)
14 years, 9 months
r6 - include src tests
by ahmed@fedoraproject.org
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)
14 years, 9 months
r5 - include src tests
by ahmed@fedoraproject.org
Author: ahmed
Date: 2009-08-01 13:46:32 +0000 (Sat, 01 Aug 2009)
New Revision: 5
Removed:
include/test.h
src/test.c
tests/test.c
Modified:
src/CMakeLists.txt
src/fkiptc.c
tests/CMakeLists.txt
Log:
Added GPL info, and removed cmake testing files
Deleted: include/test.h
===================================================================
--- include/test.h 2009-08-01 09:07:17 UTC (rev 4)
+++ include/test.h 2009-08-01 13:46:32 UTC (rev 5)
@@ -1,4 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-
-void printTest();
Modified: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt 2009-08-01 09:07:17 UTC (rev 4)
+++ src/CMakeLists.txt 2009-08-01 13:46:32 UTC (rev 5)
@@ -1 +0,0 @@
-ADD_EXECUTABLE(Demo test.c)
Modified: src/fkiptc.c
===================================================================
--- src/fkiptc.c 2009-08-01 09:07:17 UTC (rev 4)
+++ src/fkiptc.c 2009-08-01 13:46:32 UTC (rev 5)
@@ -1,3 +1,19 @@
+// Author: Ahmed Kamal <ahmed(a)fedoraproject.org>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Library General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// Copyright 2009 Ahmed Kamal
#include <getopt.h>
#include <sys/errno.h>
Deleted: src/test.c
===================================================================
--- src/test.c 2009-08-01 09:07:17 UTC (rev 4)
+++ src/test.c 2009-08-01 13:46:32 UTC (rev 5)
@@ -1,10 +0,0 @@
-#include "test.h"
-
-void printTest() {
- printf("This is a test function\n");
-}
-
-int main (){
- printTest();
- exit(0);
-}
Modified: tests/CMakeLists.txt
===================================================================
--- tests/CMakeLists.txt 2009-08-01 09:07:17 UTC (rev 4)
+++ tests/CMakeLists.txt 2009-08-01 13:46:32 UTC (rev 5)
@@ -1 +0,0 @@
-ADD_EXECUTABLE(test test)
Deleted: tests/test.c
===================================================================
--- tests/test.c 2009-08-01 09:07:17 UTC (rev 4)
+++ tests/test.c 2009-08-01 13:46:32 UTC (rev 5)
@@ -1,10 +0,0 @@
-#include "test.h"
-
-void printTest() {
- printf("This is a test function\n");
-}
-
-int main (){
- printTest();
- exit(0);
-}
14 years, 9 months
r4 - src
by ahmed@fedoraproject.org
Author: ahmed
Date: 2009-08-01 09:07:17 +0000 (Sat, 01 Aug 2009)
New Revision: 4
Added:
src/fkiptc.c
Log:
Adding FK iptc interface code
Added: src/fkiptc.c
===================================================================
--- src/fkiptc.c (rev 0)
+++ src/fkiptc.c 2009-08-01 09:07:17 UTC (rev 4)
@@ -0,0 +1,52 @@
+
+#include <getopt.h>
+#include <sys/errno.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+#include <time.h>
+#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)
+{
+ 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 */
14 years, 9 months