Export headers for logging, and also headers required for external code to use agent libraries like libmhost, libmnetwork &c.
Also standardise the naming convention by removing the mh_ prefix from the headers that were previously exported. Their presence in the matahari/ directory is sufficient to prevent naming collisions.
Signed-off-by: Zane Bitter zbitter@redhat.com --- matahari.spec | 13 ++- src/CMakeLists.txt | 13 ++- src/host/host-dbus.c | 2 src/host/host-qmf.cpp | 2 src/include/matahari/agent.h | 100 +++++++++++++++++++++++ src/include/matahari/dbus_common.h | 135 +++++++++++++++++++++++++++++++ src/include/matahari/gobject_class.h | 56 +++++++++++++ src/include/matahari/mh_agent.h | 100 ----------------------- src/include/matahari/mh_dbus_common.h | 135 ------------------------------- src/include/matahari/mh_gobject_class.h | 56 ------------- src/lib/mh_agent.cpp | 2 src/lib/mh_dbus_common.c | 2 src/network/network-dbus.c | 2 src/network/network-qmf.cpp | 2 src/postboot/postboot-qmf.cpp | 2 src/service/service-dbus.c | 2 src/service/service-qmf-console.cpp | 2 src/service/service-qmf.cpp | 2 18 files changed, 321 insertions(+), 307 deletions(-) create mode 100644 src/include/matahari/agent.h create mode 100644 src/include/matahari/dbus_common.h create mode 100644 src/include/matahari/gobject_class.h delete mode 100644 src/include/matahari/mh_agent.h delete mode 100644 src/include/matahari/mh_dbus_common.h delete mode 100644 src/include/matahari/mh_gobject_class.h
diff --git a/matahari.spec b/matahari.spec index 49f9eca..80adf30 100644 --- a/matahari.spec +++ b/matahari.spec @@ -391,17 +391,24 @@ test "x%{buildroot}" != "x" && rm -rf %{buildroot}
%{_libdir}/libm*.so %{_includedir}/matahari.h +%{_includedir}/matahari/logging.h +%{_includedir}/matahari/utilities.h +%{_includedir}/matahari/dnssrv.h +%{_includedir}/matahari/host.h +%{_includedir}/matahari/network.h +%{_includedir}/matahari/postboot.h +%{_includedir}/matahari/services.h %{_datadir}/cmake/Modules/FindMatahari.cmake
%if %{with qmf} -%{_includedir}/matahari/mh_agent.h +%{_includedir}/matahari/agent.h %{_includedir}/matahari/mainloop.h %{_datadir}/cmake/Modules/FindQPID.cmake %endif
%if %{with dbus} -%{_includedir}/matahari/mh_dbus_common.h -%{_includedir}/matahari/mh_gobject_class.h +%{_includedir}/matahari/dbus_common.h +%{_includedir}/matahari/gobject_class.h %{_datadir}/cmake/Modules/MatahariMacros.cmake %{_datadir}/matahari/schema-to-dbus.xsl %{_datadir}/matahari/dbus-to-c.xsl diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 227e89c..28a3ef3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -144,20 +144,27 @@ add_subdirectory(tests) ### Installation install(FILES ${SCHEMAS} DESTINATION share/matahari) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/matahari.h DESTINATION include) +install(FILES include/matahari/logging.h DESTINATION include/matahari) +install(FILES include/matahari/utilities.h DESTINATION include/matahari) +install(FILES include/matahari/dnssrv.h DESTINATION include/matahari) +install(FILES include/matahari/host.h DESTINATION include/matahari) +install(FILES include/matahari/network.h DESTINATION include/matahari) +install(FILES include/matahari/postboot.h DESTINATION include/matahari) +install(FILES include/matahari/services.h DESTINATION include/matahari) install(FILES cmake/modules/FindMatahari.cmake DESTINATION share/cmake/Modules) install(FILES cmake/modules/MatahariMacros.cmake DESTINATION share/cmake/Modules)
if(WITH-QMF) install(FILES cmake/modules/FindQPID.cmake DESTINATION share/cmake/Modules) - install(FILES include/matahari/mh_agent.h DESTINATION include/matahari) + install(FILES include/matahari/agent.h DESTINATION include/matahari) install(FILES include/matahari/mainloop.h DESTINATION include/matahari) endif(WITH-QMF)
if(WITH-DBUS) install(FILES schema-to-dbus.xsl DESTINATION share/matahari) install(FILES dbus-to-c.xsl DESTINATION share/matahari) - install(FILES include/matahari/mh_dbus_common.h DESTINATION include/matahari) - install(FILES include/matahari/mh_gobject_class.h DESTINATION include/matahari) + install(FILES include/matahari/dbus_common.h DESTINATION include/matahari) + install(FILES include/matahari/gobject_class.h DESTINATION include/matahari) endif(WITH-DBUS)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) diff --git a/src/host/host-dbus.c b/src/host/host-dbus.c index 0c7284e..117b97f 100644 --- a/src/host/host-dbus.c +++ b/src/host/host-dbus.c @@ -23,7 +23,7 @@ #include <stdio.h> #include <string.h>
-#include "matahari/mh_dbus_common.h" +#include "matahari/dbus_common.h"
/* Host methods */ #include "matahari/host.h" diff --git a/src/host/host-qmf.cpp b/src/host/host-qmf.cpp index 0a5fd08..5658dd7 100644 --- a/src/host/host-qmf.cpp +++ b/src/host/host-qmf.cpp @@ -27,7 +27,7 @@ #endif
#include <set> -#include "matahari/mh_agent.h" +#include "matahari/agent.h" #include <qmf/Data.h> #include "qmf/org/matahariproject/QmfPackage.h"
diff --git a/src/include/matahari/agent.h b/src/include/matahari/agent.h new file mode 100644 index 0000000..20eca51 --- /dev/null +++ b/src/include/matahari/agent.h @@ -0,0 +1,100 @@ +/* mh_agent.cpp - Copyright (C) 2010 Red Hat, Inc. + * Written by Andrew Beekhof andrew@beekhof.net + * + * + * 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.1 of the License, or (at your option) any later version. + * + * This software 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** + * \file + * \brief Matahari Agent API + * \ingroup coreapi + */ + +#ifndef __MATAHARI_DAEMON_H +#define __MATAHARI_DAEMON_H + +#include <string> +#include <qpid/sys/Time.h> +#include <qpid/agent/ManagementAgent.h> +#include <qpid/management/Manageable.h> +#include <qpid/messaging/Connection.h> +#include <qmf/AgentEvent.h> +#include <qmf/AgentSession.h> +#include <qmf/Data.h> + +extern "C" { +#include "matahari/mainloop.h" +#ifdef WIN32 +int no_argument = 0; +int required_argument = 1; +#else +# include <getopt.h> +#endif +} + +#define MH_NOT_IMPLEMENTED "Not implemented" + +using namespace qpid::management; +using namespace std; + +namespace _qtype = ::qpid::types; + +typedef struct mainloop_qmf_s { + GSource source; + qmf::AgentSession session; + qmf::AgentEvent event; + guint id; + void *user_data; + GDestroyNotify dnotify; + gboolean (*dispatch)(qmf::AgentSession session, qmf::AgentEvent event, + gpointer user_data); +} mainloop_qmf_t; + +extern int mh_add_option( + int code, int has_arg, const char *name, const char *description, + void *userdata, int(*callback)(int code, const char *name, const char *arg, void *userdata)); + +extern string mh_parse_options( + const char *proc_name, int argc, char **argv, qpid::types::Variant::Map &options); + +extern mainloop_qmf_t *mainloop_add_qmf(int priority, qmf::AgentSession session, + gboolean (*dispatch)(qmf::AgentSession session, qmf::AgentEvent event, + gpointer userdata), + GDestroyNotify notify, gpointer userdata); + +extern gboolean mainloop_destroy_qmf(mainloop_qmf_t *source); + +class MatahariAgent +{ +public: + MatahariAgent() {}; + virtual ~MatahariAgent(); + + virtual int setup(qmf::AgentSession session) { return 0; }; + virtual gboolean invoke(qmf::AgentSession session, qmf::AgentEvent event, + gpointer user_data) { return FALSE; }; + int init(int argc, char **argv, const char* proc_name); + void run(); + +protected: + GMainLoop *mainloop; + mainloop_qmf_t *qpid_source; + + qmf::AgentSession _agent_session; + qpid::messaging::Connection _amqp_connection; +}; + +#endif // __MATAHARI_DAEMON_H diff --git a/src/include/matahari/dbus_common.h b/src/include/matahari/dbus_common.h new file mode 100644 index 0000000..3df3f75 --- /dev/null +++ b/src/include/matahari/dbus_common.h @@ -0,0 +1,135 @@ +/* + * mh_dbus_common.h + * + * Copyright (C) 2011 Red Hat, Inc. + * Written by Radek Novacek rnovacek@redhat.com + * + * 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MH_DBUS_COMMON_H +#define MH_DBUS_COMMON_H + +#include <glib.h> +#include <dbus/dbus-glib.h> + +/* GObject class definition */ +#include "matahari/gobject_class.h" + +/* Private struct in Matahari class */ +#define MATAHARI_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ + MATAHARI_TYPE, MatahariPrivate)) + +// Matahari error codes +#define MATAHARI_ERROR matahari_error_quark () +enum { MATAHARI_AUTHENTICATION_ERROR, MATAHARI_NOT_IMPLEMENTED }; + +GQuark +matahari_error_quark (void); + +/** + * Check the authorization for given 'action' using PolicyKit. Returns TRUE if + * user is authorized, otherwise return FALSE and 'error' is set. + */ +gboolean +check_authorization(const gchar *action, GError** error, + DBusGMethodInvocation *context); + +typedef struct { + int prop; + gchar *name, *nick, *desc; + GParamFlags flags; + char type; +} Property; + +// This array is defined in auto-generated matahari-module-properties.h +extern Property properties[]; + +/** + * Start DBus server with name 'bus_name' and object path 'object_path' + */ +int +run_dbus_server(char *bus_name, char *object_path); + +/** + * Check the authorization for getting the parameter 'name' using PolicyKit + * action interface.name + */ +gboolean +matahari_get(Matahari* matahari, const char *interface, const char *name, + DBusGMethodInvocation *context); + +/** + * Check the authorization for setting the parameter 'name' using PolicyKit + * action interface.name + */ +gboolean +matahari_set(Matahari *matahari, const char *interface, const char *name, + GValue *value, DBusGMethodInvocation *context); + +/** + * This method is used for getting value of DBus property. + * It must be implemented in each module. + * Set the value of property_id parameter to parameter value. + */ +void +matahari_get_property(GObject *object, guint property_id, GValue *value, + GParamSpec *pspec); + +/** + * This method is used for setting value of DBus property. + * It must be implemented in each module. + * New value of property_id is in parameter value. + */ +void +matahari_set_property(GObject *object, guint property_id, const GValue *value, + GParamSpec *pspec); + +/** + * This method is used to determine type of value in all dictionary parameters. + * It must be implemented in each module. + */ +GType +matahari_dict_type(int prop); + +/** + * Dictionary type. Key is always string, value is set in constructor dict_new. + */ +typedef struct +{ + GValue *value; + GValue *key; + DBusGTypeSpecializedAppendContext appendctx; +} Dict; + +/** + * Constructor of dictionary type. Key is string, type of value is defined + * by type of 'value'. + * New value will be stored in 'value'. Use dict_free after setting all values. + */ +Dict *dict_new(GValue *value); + +/** + * Add 'value' to the dictionary 'dict'. + */ +void dict_add(Dict *dict, const gchar *key, GValue *value); + +/** + * Frees memory allocated by dict_new. + */ +void dict_free(Dict *dict); + +#endif diff --git a/src/include/matahari/gobject_class.h b/src/include/matahari/gobject_class.h new file mode 100644 index 0000000..fe13d1e --- /dev/null +++ b/src/include/matahari/gobject_class.h @@ -0,0 +1,56 @@ +/* + * mh_gobject_class.h + * + * Copyright (C) 2010 Red Hat, Inc. + * Written by Roman Rakus rrakus@redhat.com + * + * 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MHGOBJECTCLASS_H_ +#define MHGOBJECTCLASS_H_ + +#define MATAHARI_TYPE (matahari_get_type()) +#define MATAHARI(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), \ + MATAHARI_TYPE, Matahari)) +#define MATAHARI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \ + MATAHARI_TYPE, MatahariClass)) +#define IS_MATAHARI(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), \ + MATAHARI_TYPE)) +#define IS_MATAHARI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + MATAHARI_TYPE)) +#define MATAHARI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + MATAHARI_TYPE, MatahariClass)) + +typedef struct _Matahari Matahari; +typedef struct _MatahariClass MatahariClass; +typedef struct _MatahariPrivate MatahariPrivate; + +GType +matahari_get_type(void); + +struct _Matahari +{ + GObject parent; + MatahariPrivate *priv; +}; + +struct _MatahariClass +{ + GObjectClass parent; +}; + +#endif /* MHGOBJECTCLASS_H_ */ diff --git a/src/include/matahari/mh_agent.h b/src/include/matahari/mh_agent.h deleted file mode 100644 index 20eca51..0000000 --- a/src/include/matahari/mh_agent.h +++ /dev/null @@ -1,100 +0,0 @@ -/* mh_agent.cpp - Copyright (C) 2010 Red Hat, Inc. - * Written by Andrew Beekhof andrew@beekhof.net - * - * - * 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.1 of the License, or (at your option) any later version. - * - * This software 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/** - * \file - * \brief Matahari Agent API - * \ingroup coreapi - */ - -#ifndef __MATAHARI_DAEMON_H -#define __MATAHARI_DAEMON_H - -#include <string> -#include <qpid/sys/Time.h> -#include <qpid/agent/ManagementAgent.h> -#include <qpid/management/Manageable.h> -#include <qpid/messaging/Connection.h> -#include <qmf/AgentEvent.h> -#include <qmf/AgentSession.h> -#include <qmf/Data.h> - -extern "C" { -#include "matahari/mainloop.h" -#ifdef WIN32 -int no_argument = 0; -int required_argument = 1; -#else -# include <getopt.h> -#endif -} - -#define MH_NOT_IMPLEMENTED "Not implemented" - -using namespace qpid::management; -using namespace std; - -namespace _qtype = ::qpid::types; - -typedef struct mainloop_qmf_s { - GSource source; - qmf::AgentSession session; - qmf::AgentEvent event; - guint id; - void *user_data; - GDestroyNotify dnotify; - gboolean (*dispatch)(qmf::AgentSession session, qmf::AgentEvent event, - gpointer user_data); -} mainloop_qmf_t; - -extern int mh_add_option( - int code, int has_arg, const char *name, const char *description, - void *userdata, int(*callback)(int code, const char *name, const char *arg, void *userdata)); - -extern string mh_parse_options( - const char *proc_name, int argc, char **argv, qpid::types::Variant::Map &options); - -extern mainloop_qmf_t *mainloop_add_qmf(int priority, qmf::AgentSession session, - gboolean (*dispatch)(qmf::AgentSession session, qmf::AgentEvent event, - gpointer userdata), - GDestroyNotify notify, gpointer userdata); - -extern gboolean mainloop_destroy_qmf(mainloop_qmf_t *source); - -class MatahariAgent -{ -public: - MatahariAgent() {}; - virtual ~MatahariAgent(); - - virtual int setup(qmf::AgentSession session) { return 0; }; - virtual gboolean invoke(qmf::AgentSession session, qmf::AgentEvent event, - gpointer user_data) { return FALSE; }; - int init(int argc, char **argv, const char* proc_name); - void run(); - -protected: - GMainLoop *mainloop; - mainloop_qmf_t *qpid_source; - - qmf::AgentSession _agent_session; - qpid::messaging::Connection _amqp_connection; -}; - -#endif // __MATAHARI_DAEMON_H diff --git a/src/include/matahari/mh_dbus_common.h b/src/include/matahari/mh_dbus_common.h deleted file mode 100644 index e7b4936..0000000 --- a/src/include/matahari/mh_dbus_common.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * mh_dbus_common.h - * - * Copyright (C) 2011 Red Hat, Inc. - * Written by Radek Novacek rnovacek@redhat.com - * - * 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 - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef MH_DBUS_COMMON_H -#define MH_DBUS_COMMON_H - -#include <glib.h> -#include <dbus/dbus-glib.h> - -/* GObject class definition */ -#include "mh_gobject_class.h" - -/* Private struct in Matahari class */ -#define MATAHARI_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - MATAHARI_TYPE, MatahariPrivate)) - -// Matahari error codes -#define MATAHARI_ERROR matahari_error_quark () -enum { MATAHARI_AUTHENTICATION_ERROR, MATAHARI_NOT_IMPLEMENTED }; - -GQuark -matahari_error_quark (void); - -/** - * Check the authorization for given 'action' using PolicyKit. Returns TRUE if - * user is authorized, otherwise return FALSE and 'error' is set. - */ -gboolean -check_authorization(const gchar *action, GError** error, - DBusGMethodInvocation *context); - -typedef struct { - int prop; - gchar *name, *nick, *desc; - GParamFlags flags; - char type; -} Property; - -// This array is defined in auto-generated matahari-module-properties.h -extern Property properties[]; - -/** - * Start DBus server with name 'bus_name' and object path 'object_path' - */ -int -run_dbus_server(char *bus_name, char *object_path); - -/** - * Check the authorization for getting the parameter 'name' using PolicyKit - * action interface.name - */ -gboolean -matahari_get(Matahari* matahari, const char *interface, const char *name, - DBusGMethodInvocation *context); - -/** - * Check the authorization for setting the parameter 'name' using PolicyKit - * action interface.name - */ -gboolean -matahari_set(Matahari *matahari, const char *interface, const char *name, - GValue *value, DBusGMethodInvocation *context); - -/** - * This method is used for getting value of DBus property. - * It must be implemented in each module. - * Set the value of property_id parameter to parameter value. - */ -void -matahari_get_property(GObject *object, guint property_id, GValue *value, - GParamSpec *pspec); - -/** - * This method is used for setting value of DBus property. - * It must be implemented in each module. - * New value of property_id is in parameter value. - */ -void -matahari_set_property(GObject *object, guint property_id, const GValue *value, - GParamSpec *pspec); - -/** - * This method is used to determine type of value in all dictionary parameters. - * It must be implemented in each module. - */ -GType -matahari_dict_type(int prop); - -/** - * Dictionary type. Key is always string, value is set in constructor dict_new. - */ -typedef struct -{ - GValue *value; - GValue *key; - DBusGTypeSpecializedAppendContext appendctx; -} Dict; - -/** - * Constructor of dictionary type. Key is string, type of value is defined - * by type of 'value'. - * New value will be stored in 'value'. Use dict_free after setting all values. - */ -Dict *dict_new(GValue *value); - -/** - * Add 'value' to the dictionary 'dict'. - */ -void dict_add(Dict *dict, const gchar *key, GValue *value); - -/** - * Frees memory allocated by dict_new. - */ -void dict_free(Dict *dict); - -#endif diff --git a/src/include/matahari/mh_gobject_class.h b/src/include/matahari/mh_gobject_class.h deleted file mode 100644 index fe13d1e..0000000 --- a/src/include/matahari/mh_gobject_class.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * mh_gobject_class.h - * - * Copyright (C) 2010 Red Hat, Inc. - * Written by Roman Rakus rrakus@redhat.com - * - * 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef MHGOBJECTCLASS_H_ -#define MHGOBJECTCLASS_H_ - -#define MATAHARI_TYPE (matahari_get_type()) -#define MATAHARI(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), \ - MATAHARI_TYPE, Matahari)) -#define MATAHARI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \ - MATAHARI_TYPE, MatahariClass)) -#define IS_MATAHARI(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), \ - MATAHARI_TYPE)) -#define IS_MATAHARI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - MATAHARI_TYPE)) -#define MATAHARI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - MATAHARI_TYPE, MatahariClass)) - -typedef struct _Matahari Matahari; -typedef struct _MatahariClass MatahariClass; -typedef struct _MatahariPrivate MatahariPrivate; - -GType -matahari_get_type(void); - -struct _Matahari -{ - GObject parent; - MatahariPrivate *priv; -}; - -struct _MatahariClass -{ - GObjectClass parent; -}; - -#endif /* MHGOBJECTCLASS_H_ */ diff --git a/src/lib/mh_agent.cpp b/src/lib/mh_agent.cpp index 9eeb37f..adb137e 100644 --- a/src/lib/mh_agent.cpp +++ b/src/lib/mh_agent.cpp @@ -39,7 +39,7 @@ int use_stderr = 0; #include <qpid/client/ConnectionSettings.h> // #include <qpid/sys/ssl/util.h> #include <qmf/DataAddr.h> -#include "matahari/mh_agent.h" +#include "matahari/agent.h"
extern "C" { #include "matahari/logging.h" diff --git a/src/lib/mh_dbus_common.c b/src/lib/mh_dbus_common.c index 89405ed..4e1359b 100644 --- a/src/lib/mh_dbus_common.c +++ b/src/lib/mh_dbus_common.c @@ -20,7 +20,7 @@ * */
-#include "matahari/mh_dbus_common.h" +#include "matahari/dbus_common.h" #include "matahari/logging.h" #include <glib/gi18n.h>
diff --git a/src/network/network-dbus.c b/src/network/network-dbus.c index c639cb3..7b18810 100644 --- a/src/network/network-dbus.c +++ b/src/network/network-dbus.c @@ -23,7 +23,7 @@ #include <stdio.h> #include <string.h>
-#include "matahari/mh_dbus_common.h" +#include "matahari/dbus_common.h"
/* Network methods */ #include "matahari/network.h" diff --git a/src/network/network-qmf.cpp b/src/network/network-qmf.cpp index 3efe70f..6692d83 100644 --- a/src/network/network-qmf.cpp +++ b/src/network/network-qmf.cpp @@ -20,7 +20,7 @@ #include "config.h" #endif
-#include "matahari/mh_agent.h" +#include "matahari/agent.h"
#include "qmf/org/matahariproject/QmfPackage.h"
diff --git a/src/postboot/postboot-qmf.cpp b/src/postboot/postboot-qmf.cpp index fa3bbdf..fa69751 100644 --- a/src/postboot/postboot-qmf.cpp +++ b/src/postboot/postboot-qmf.cpp @@ -20,7 +20,7 @@ #include "config.h" #endif
-#include "matahari/mh_agent.h" +#include "matahari/agent.h"
#include "qmf/org/matahariproject/QmfPackage.h"
diff --git a/src/service/service-dbus.c b/src/service/service-dbus.c index 4964713..879163d 100644 --- a/src/service/service-dbus.c +++ b/src/service/service-dbus.c @@ -22,7 +22,7 @@
#include <string.h>
-#include "matahari/mh_dbus_common.h" +#include "matahari/dbus_common.h"
/* Services methods */ #include "matahari/services.h" diff --git a/src/service/service-qmf-console.cpp b/src/service/service-qmf-console.cpp index dac8bca..f89bd1c 100644 --- a/src/service/service-qmf-console.cpp +++ b/src/service/service-qmf-console.cpp @@ -28,7 +28,7 @@ #include <qmf/Query.h> #include <qpid/types/Variant.h>
-#include <matahari/mh_agent.h> +#include <matahari/agent.h>
#include <string> #include <iostream> diff --git a/src/service/service-qmf.cpp b/src/service/service-qmf.cpp index 492a803..9da1866 100644 --- a/src/service/service-qmf.cpp +++ b/src/service/service-qmf.cpp @@ -28,7 +28,7 @@ extern "C" { #include <string> #include <qpid/management/Manageable.h> #include <qpid/agent/ManagementAgent.h> -#include "matahari/mh_agent.h" +#include "matahari/agent.h"
#include "qmf/org/matahariproject/QmfPackage.h"
ACK
-- Russell Bryant
On Wed, Jul 20, 2011 at 11:59 AM, Zane Bitter zbitter@redhat.com wrote:
Export headers for logging, and also headers required for external code to use agent libraries like libmhost, libmnetwork &c.
Also standardise the naming convention by removing the mh_ prefix from the headers that were previously exported. Their presence in the matahari/ directory is sufficient to prevent naming collisions.
Signed-off-by: Zane Bitter zbitter@redhat.com
matahari.spec | 13 ++- src/CMakeLists.txt | 13 ++- src/host/host-dbus.c | 2 src/host/host-qmf.cpp | 2 src/include/matahari/agent.h | 100 +++++++++++++++++++++++ src/include/matahari/dbus_common.h | 135 +++++++++++++++++++++++++++++++ src/include/matahari/gobject_class.h | 56 +++++++++++++ src/include/matahari/mh_agent.h | 100 ----------------------- src/include/matahari/mh_dbus_common.h | 135 ------------------------------- src/include/matahari/mh_gobject_class.h | 56 ------------- src/lib/mh_agent.cpp | 2 src/lib/mh_dbus_common.c | 2 src/network/network-dbus.c | 2 src/network/network-qmf.cpp | 2 src/postboot/postboot-qmf.cpp | 2 src/service/service-dbus.c | 2 src/service/service-qmf-console.cpp | 2 src/service/service-qmf.cpp | 2 18 files changed, 321 insertions(+), 307 deletions(-) create mode 100644 src/include/matahari/agent.h create mode 100644 src/include/matahari/dbus_common.h create mode 100644 src/include/matahari/gobject_class.h delete mode 100644 src/include/matahari/mh_agent.h delete mode 100644 src/include/matahari/mh_dbus_common.h delete mode 100644 src/include/matahari/mh_gobject_class.h
diff --git a/matahari.spec b/matahari.spec index 49f9eca..80adf30 100644 --- a/matahari.spec +++ b/matahari.spec @@ -391,17 +391,24 @@ test "x%{buildroot}" != "x" && rm -rf %{buildroot}
%{_libdir}/libm*.so %{_includedir}/matahari.h +%{_includedir}/matahari/logging.h +%{_includedir}/matahari/utilities.h +%{_includedir}/matahari/dnssrv.h +%{_includedir}/matahari/host.h +%{_includedir}/matahari/network.h +%{_includedir}/matahari/postboot.h +%{_includedir}/matahari/services.h %{_datadir}/cmake/Modules/FindMatahari.cmake
%if %{with qmf} -%{_includedir}/matahari/mh_agent.h +%{_includedir}/matahari/agent.h %{_includedir}/matahari/mainloop.h %{_datadir}/cmake/Modules/FindQPID.cmake %endif
%if %{with dbus} -%{_includedir}/matahari/mh_dbus_common.h -%{_includedir}/matahari/mh_gobject_class.h +%{_includedir}/matahari/dbus_common.h +%{_includedir}/matahari/gobject_class.h %{_datadir}/cmake/Modules/MatahariMacros.cmake %{_datadir}/matahari/schema-to-dbus.xsl %{_datadir}/matahari/dbus-to-c.xsl diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 227e89c..28a3ef3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -144,20 +144,27 @@ add_subdirectory(tests) ### Installation install(FILES ${SCHEMAS} DESTINATION share/matahari) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/matahari.h DESTINATION include) +install(FILES include/matahari/logging.h DESTINATION include/matahari) +install(FILES include/matahari/utilities.h DESTINATION include/matahari) +install(FILES include/matahari/dnssrv.h DESTINATION include/matahari) +install(FILES include/matahari/host.h DESTINATION include/matahari) +install(FILES include/matahari/network.h DESTINATION include/matahari) +install(FILES include/matahari/postboot.h DESTINATION include/matahari) +install(FILES include/matahari/services.h DESTINATION include/matahari) install(FILES cmake/modules/FindMatahari.cmake DESTINATION share/cmake/Modules) install(FILES cmake/modules/MatahariMacros.cmake DESTINATION share/cmake/Modules)
if(WITH-QMF) install(FILES cmake/modules/FindQPID.cmake DESTINATION share/cmake/Modules)
- install(FILES include/matahari/mh_agent.h DESTINATION include/matahari)
- install(FILES include/matahari/agent.h DESTINATION include/matahari)
install(FILES include/matahari/mainloop.h DESTINATION include/matahari) endif(WITH-QMF)
if(WITH-DBUS) install(FILES schema-to-dbus.xsl DESTINATION share/matahari) install(FILES dbus-to-c.xsl DESTINATION share/matahari)
- install(FILES include/matahari/mh_dbus_common.h DESTINATION include/matahari)
- install(FILES include/matahari/mh_gobject_class.h DESTINATION include/matahari)
- install(FILES include/matahari/dbus_common.h DESTINATION include/matahari)
- install(FILES include/matahari/gobject_class.h DESTINATION include/matahari)
endif(WITH-DBUS)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) diff --git a/src/host/host-dbus.c b/src/host/host-dbus.c index 0c7284e..117b97f 100644 --- a/src/host/host-dbus.c +++ b/src/host/host-dbus.c @@ -23,7 +23,7 @@ #include <stdio.h> #include <string.h>
-#include "matahari/mh_dbus_common.h" +#include "matahari/dbus_common.h"
/* Host methods */ #include "matahari/host.h" diff --git a/src/host/host-qmf.cpp b/src/host/host-qmf.cpp index 0a5fd08..5658dd7 100644 --- a/src/host/host-qmf.cpp +++ b/src/host/host-qmf.cpp @@ -27,7 +27,7 @@ #endif
#include <set> -#include "matahari/mh_agent.h" +#include "matahari/agent.h" #include <qmf/Data.h> #include "qmf/org/matahariproject/QmfPackage.h"
diff --git a/src/include/matahari/agent.h b/src/include/matahari/agent.h new file mode 100644 index 0000000..20eca51 --- /dev/null +++ b/src/include/matahari/agent.h @@ -0,0 +1,100 @@ +/* mh_agent.cpp - Copyright (C) 2010 Red Hat, Inc.
- Written by Andrew Beekhof andrew@beekhof.net
- 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.1 of the License, or (at your option) any later version.
- This software 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
- General Public License for more details.
- You should have received a copy of the GNU General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
+/**
- \file
- \brief Matahari Agent API
- \ingroup coreapi
- */
+#ifndef __MATAHARI_DAEMON_H +#define __MATAHARI_DAEMON_H
+#include <string> +#include <qpid/sys/Time.h> +#include <qpid/agent/ManagementAgent.h> +#include <qpid/management/Manageable.h> +#include <qpid/messaging/Connection.h> +#include <qmf/AgentEvent.h> +#include <qmf/AgentSession.h> +#include <qmf/Data.h>
+extern "C" { +#include "matahari/mainloop.h" +#ifdef WIN32 +int no_argument = 0; +int required_argument = 1; +#else +# include <getopt.h> +#endif +}
+#define MH_NOT_IMPLEMENTED "Not implemented"
+using namespace qpid::management; +using namespace std;
+namespace _qtype = ::qpid::types;
+typedef struct mainloop_qmf_s {
- GSource source;
- qmf::AgentSession session;
- qmf::AgentEvent event;
- guint id;
- void *user_data;
- GDestroyNotify dnotify;
- gboolean (*dispatch)(qmf::AgentSession session, qmf::AgentEvent event,
- gpointer user_data);
+} mainloop_qmf_t;
+extern int mh_add_option(
- int code, int has_arg, const char *name, const char *description,
- void *userdata, int(*callback)(int code, const char *name, const char *arg, void *userdata));
+extern string mh_parse_options(
- const char *proc_name, int argc, char **argv, qpid::types::Variant::Map &options);
+extern mainloop_qmf_t *mainloop_add_qmf(int priority, qmf::AgentSession session,
- gboolean (*dispatch)(qmf::AgentSession session, qmf::AgentEvent event,
- gpointer userdata),
- GDestroyNotify notify, gpointer userdata);
+extern gboolean mainloop_destroy_qmf(mainloop_qmf_t *source);
+class MatahariAgent +{ +public:
- MatahariAgent() {};
- virtual ~MatahariAgent();
- virtual int setup(qmf::AgentSession session) { return 0; };
- virtual gboolean invoke(qmf::AgentSession session, qmf::AgentEvent event,
- gpointer user_data) { return FALSE; };
- int init(int argc, char **argv, const char* proc_name);
- void run();
+protected:
- GMainLoop *mainloop;
- mainloop_qmf_t *qpid_source;
- qmf::AgentSession _agent_session;
- qpid::messaging::Connection _amqp_connection;
+};
+#endif // __MATAHARI_DAEMON_H diff --git a/src/include/matahari/dbus_common.h b/src/include/matahari/dbus_common.h new file mode 100644 index 0000000..3df3f75 --- /dev/null +++ b/src/include/matahari/dbus_common.h @@ -0,0 +1,135 @@ +/*
- mh_dbus_common.h
- Copyright (C) 2011 Red Hat, Inc.
- Written by Radek Novacek rnovacek@redhat.com
- 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
- 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+#ifndef MH_DBUS_COMMON_H +#define MH_DBUS_COMMON_H
+#include <glib.h> +#include <dbus/dbus-glib.h>
+/* GObject class definition */ +#include "matahari/gobject_class.h"
+/* Private struct in Matahari class */ +#define MATAHARI_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- MATAHARI_TYPE, MatahariPrivate))
+// Matahari error codes +#define MATAHARI_ERROR matahari_error_quark () +enum { MATAHARI_AUTHENTICATION_ERROR, MATAHARI_NOT_IMPLEMENTED };
+GQuark +matahari_error_quark (void);
+/**
- Check the authorization for given 'action' using PolicyKit. Returns TRUE if
- user is authorized, otherwise return FALSE and 'error' is set.
- */
+gboolean +check_authorization(const gchar *action, GError** error,
- DBusGMethodInvocation *context);
+typedef struct {
- int prop;
- gchar *name, *nick, *desc;
- GParamFlags flags;
- char type;
+} Property;
+// This array is defined in auto-generated matahari-module-properties.h +extern Property properties[];
+/**
- Start DBus server with name 'bus_name' and object path 'object_path'
- */
+int +run_dbus_server(char *bus_name, char *object_path);
+/**
- Check the authorization for getting the parameter 'name' using PolicyKit
- action interface.name
- */
+gboolean +matahari_get(Matahari* matahari, const char *interface, const char *name,
- DBusGMethodInvocation *context);
+/**
- Check the authorization for setting the parameter 'name' using PolicyKit
- action interface.name
- */
+gboolean +matahari_set(Matahari *matahari, const char *interface, const char *name,
- GValue *value, DBusGMethodInvocation *context);
+/**
- This method is used for getting value of DBus property.
- It must be implemented in each module.
- Set the value of property_id parameter to parameter value.
- */
+void +matahari_get_property(GObject *object, guint property_id, GValue *value,
- GParamSpec *pspec);
+/**
- This method is used for setting value of DBus property.
- It must be implemented in each module.
- New value of property_id is in parameter value.
- */
+void +matahari_set_property(GObject *object, guint property_id, const GValue *value,
- GParamSpec *pspec);
+/**
- This method is used to determine type of value in all dictionary parameters.
- It must be implemented in each module.
- */
+GType +matahari_dict_type(int prop);
+/**
- Dictionary type. Key is always string, value is set in constructor dict_new.
- */
+typedef struct +{
- GValue *value;
- GValue *key;
- DBusGTypeSpecializedAppendContext appendctx;
+} Dict;
+/**
- Constructor of dictionary type. Key is string, type of value is defined
- by type of 'value'.
- New value will be stored in 'value'. Use dict_free after setting all values.
- */
+Dict *dict_new(GValue *value);
+/**
- Add 'value' to the dictionary 'dict'.
- */
+void dict_add(Dict *dict, const gchar *key, GValue *value);
+/**
- Frees memory allocated by dict_new.
- */
+void dict_free(Dict *dict);
+#endif diff --git a/src/include/matahari/gobject_class.h b/src/include/matahari/gobject_class.h new file mode 100644 index 0000000..fe13d1e --- /dev/null +++ b/src/include/matahari/gobject_class.h @@ -0,0 +1,56 @@ +/*
- mh_gobject_class.h
- Copyright (C) 2010 Red Hat, Inc.
- Written by Roman Rakus rrakus@redhat.com
- 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+#ifndef MHGOBJECTCLASS_H_ +#define MHGOBJECTCLASS_H_
+#define MATAHARI_TYPE (matahari_get_type()) +#define MATAHARI(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), \
- MATAHARI_TYPE, Matahari))
+#define MATAHARI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
- MATAHARI_TYPE, MatahariClass))
+#define IS_MATAHARI(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), \
- MATAHARI_TYPE))
+#define IS_MATAHARI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- MATAHARI_TYPE))
+#define MATAHARI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- MATAHARI_TYPE, MatahariClass))
+typedef struct _Matahari Matahari; +typedef struct _MatahariClass MatahariClass; +typedef struct _MatahariPrivate MatahariPrivate;
+GType +matahari_get_type(void);
+struct _Matahari +{
- GObject parent;
- MatahariPrivate *priv;
+};
+struct _MatahariClass +{
- GObjectClass parent;
+};
+#endif /* MHGOBJECTCLASS_H_ */ diff --git a/src/include/matahari/mh_agent.h b/src/include/matahari/mh_agent.h deleted file mode 100644 index 20eca51..0000000 --- a/src/include/matahari/mh_agent.h +++ /dev/null @@ -1,100 +0,0 @@ -/* mh_agent.cpp - Copyright (C) 2010 Red Hat, Inc.
- Written by Andrew Beekhof andrew@beekhof.net
- 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.1 of the License, or (at your option) any later version.
- This software 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
- General Public License for more details.
- You should have received a copy of the GNU General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-/**
- \file
- \brief Matahari Agent API
- \ingroup coreapi
- */
-#ifndef __MATAHARI_DAEMON_H -#define __MATAHARI_DAEMON_H
-#include <string> -#include <qpid/sys/Time.h> -#include <qpid/agent/ManagementAgent.h> -#include <qpid/management/Manageable.h> -#include <qpid/messaging/Connection.h> -#include <qmf/AgentEvent.h> -#include <qmf/AgentSession.h> -#include <qmf/Data.h>
-extern "C" { -#include "matahari/mainloop.h" -#ifdef WIN32 -int no_argument = 0; -int required_argument = 1; -#else -# include <getopt.h> -#endif -}
-#define MH_NOT_IMPLEMENTED "Not implemented"
-using namespace qpid::management; -using namespace std;
-namespace _qtype = ::qpid::types;
-typedef struct mainloop_qmf_s {
- GSource source;
- qmf::AgentSession session;
- qmf::AgentEvent event;
- guint id;
- void *user_data;
- GDestroyNotify dnotify;
- gboolean (*dispatch)(qmf::AgentSession session, qmf::AgentEvent event,
- gpointer user_data);
-} mainloop_qmf_t;
-extern int mh_add_option(
- int code, int has_arg, const char *name, const char *description,
- void *userdata, int(*callback)(int code, const char *name, const char *arg, void *userdata));
-extern string mh_parse_options(
- const char *proc_name, int argc, char **argv, qpid::types::Variant::Map &options);
-extern mainloop_qmf_t *mainloop_add_qmf(int priority, qmf::AgentSession session,
- gboolean (*dispatch)(qmf::AgentSession session, qmf::AgentEvent event,
- gpointer userdata),
- GDestroyNotify notify, gpointer userdata);
-extern gboolean mainloop_destroy_qmf(mainloop_qmf_t *source);
-class MatahariAgent -{ -public:
- MatahariAgent() {};
- virtual ~MatahariAgent();
- virtual int setup(qmf::AgentSession session) { return 0; };
- virtual gboolean invoke(qmf::AgentSession session, qmf::AgentEvent event,
- gpointer user_data) { return FALSE; };
- int init(int argc, char **argv, const char* proc_name);
- void run();
-protected:
- GMainLoop *mainloop;
- mainloop_qmf_t *qpid_source;
- qmf::AgentSession _agent_session;
- qpid::messaging::Connection _amqp_connection;
-};
-#endif // __MATAHARI_DAEMON_H diff --git a/src/include/matahari/mh_dbus_common.h b/src/include/matahari/mh_dbus_common.h deleted file mode 100644 index e7b4936..0000000 --- a/src/include/matahari/mh_dbus_common.h +++ /dev/null @@ -1,135 +0,0 @@ -/*
- mh_dbus_common.h
- Copyright (C) 2011 Red Hat, Inc.
- Written by Radek Novacek rnovacek@redhat.com
- 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
- 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-#ifndef MH_DBUS_COMMON_H -#define MH_DBUS_COMMON_H
-#include <glib.h> -#include <dbus/dbus-glib.h>
-/* GObject class definition */ -#include "mh_gobject_class.h"
-/* Private struct in Matahari class */ -#define MATAHARI_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- MATAHARI_TYPE, MatahariPrivate))
-// Matahari error codes -#define MATAHARI_ERROR matahari_error_quark () -enum { MATAHARI_AUTHENTICATION_ERROR, MATAHARI_NOT_IMPLEMENTED };
-GQuark -matahari_error_quark (void);
-/**
- Check the authorization for given 'action' using PolicyKit. Returns TRUE if
- user is authorized, otherwise return FALSE and 'error' is set.
- */
-gboolean -check_authorization(const gchar *action, GError** error,
- DBusGMethodInvocation *context);
-typedef struct {
- int prop;
- gchar *name, *nick, *desc;
- GParamFlags flags;
- char type;
-} Property;
-// This array is defined in auto-generated matahari-module-properties.h -extern Property properties[];
-/**
- Start DBus server with name 'bus_name' and object path 'object_path'
- */
-int -run_dbus_server(char *bus_name, char *object_path);
-/**
- Check the authorization for getting the parameter 'name' using PolicyKit
- action interface.name
- */
-gboolean -matahari_get(Matahari* matahari, const char *interface, const char *name,
- DBusGMethodInvocation *context);
-/**
- Check the authorization for setting the parameter 'name' using PolicyKit
- action interface.name
- */
-gboolean -matahari_set(Matahari *matahari, const char *interface, const char *name,
- GValue *value, DBusGMethodInvocation *context);
-/**
- This method is used for getting value of DBus property.
- It must be implemented in each module.
- Set the value of property_id parameter to parameter value.
- */
-void -matahari_get_property(GObject *object, guint property_id, GValue *value,
- GParamSpec *pspec);
-/**
- This method is used for setting value of DBus property.
- It must be implemented in each module.
- New value of property_id is in parameter value.
- */
-void -matahari_set_property(GObject *object, guint property_id, const GValue *value,
- GParamSpec *pspec);
-/**
- This method is used to determine type of value in all dictionary parameters.
- It must be implemented in each module.
- */
-GType -matahari_dict_type(int prop);
-/**
- Dictionary type. Key is always string, value is set in constructor dict_new.
- */
-typedef struct -{
- GValue *value;
- GValue *key;
- DBusGTypeSpecializedAppendContext appendctx;
-} Dict;
-/**
- Constructor of dictionary type. Key is string, type of value is defined
- by type of 'value'.
- New value will be stored in 'value'. Use dict_free after setting all values.
- */
-Dict *dict_new(GValue *value);
-/**
- Add 'value' to the dictionary 'dict'.
- */
-void dict_add(Dict *dict, const gchar *key, GValue *value);
-/**
- Frees memory allocated by dict_new.
- */
-void dict_free(Dict *dict);
-#endif diff --git a/src/include/matahari/mh_gobject_class.h b/src/include/matahari/mh_gobject_class.h deleted file mode 100644 index fe13d1e..0000000 --- a/src/include/matahari/mh_gobject_class.h +++ /dev/null @@ -1,56 +0,0 @@ -/*
- mh_gobject_class.h
- Copyright (C) 2010 Red Hat, Inc.
- Written by Roman Rakus rrakus@redhat.com
- 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-#ifndef MHGOBJECTCLASS_H_ -#define MHGOBJECTCLASS_H_
-#define MATAHARI_TYPE (matahari_get_type()) -#define MATAHARI(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), \
- MATAHARI_TYPE, Matahari))
-#define MATAHARI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
- MATAHARI_TYPE, MatahariClass))
-#define IS_MATAHARI(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), \
- MATAHARI_TYPE))
-#define IS_MATAHARI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- MATAHARI_TYPE))
-#define MATAHARI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- MATAHARI_TYPE, MatahariClass))
-typedef struct _Matahari Matahari; -typedef struct _MatahariClass MatahariClass; -typedef struct _MatahariPrivate MatahariPrivate;
-GType -matahari_get_type(void);
-struct _Matahari -{
- GObject parent;
- MatahariPrivate *priv;
-};
-struct _MatahariClass -{
- GObjectClass parent;
-};
-#endif /* MHGOBJECTCLASS_H_ */ diff --git a/src/lib/mh_agent.cpp b/src/lib/mh_agent.cpp index 9eeb37f..adb137e 100644 --- a/src/lib/mh_agent.cpp +++ b/src/lib/mh_agent.cpp @@ -39,7 +39,7 @@ int use_stderr = 0; #include <qpid/client/ConnectionSettings.h> // #include <qpid/sys/ssl/util.h> #include <qmf/DataAddr.h> -#include "matahari/mh_agent.h" +#include "matahari/agent.h"
extern "C" { #include "matahari/logging.h" diff --git a/src/lib/mh_dbus_common.c b/src/lib/mh_dbus_common.c index 89405ed..4e1359b 100644 --- a/src/lib/mh_dbus_common.c +++ b/src/lib/mh_dbus_common.c @@ -20,7 +20,7 @@ * */
-#include "matahari/mh_dbus_common.h" +#include "matahari/dbus_common.h" #include "matahari/logging.h" #include <glib/gi18n.h>
diff --git a/src/network/network-dbus.c b/src/network/network-dbus.c index c639cb3..7b18810 100644 --- a/src/network/network-dbus.c +++ b/src/network/network-dbus.c @@ -23,7 +23,7 @@ #include <stdio.h> #include <string.h>
-#include "matahari/mh_dbus_common.h" +#include "matahari/dbus_common.h"
/* Network methods */ #include "matahari/network.h" diff --git a/src/network/network-qmf.cpp b/src/network/network-qmf.cpp index 3efe70f..6692d83 100644 --- a/src/network/network-qmf.cpp +++ b/src/network/network-qmf.cpp @@ -20,7 +20,7 @@ #include "config.h" #endif
-#include "matahari/mh_agent.h" +#include "matahari/agent.h"
#include "qmf/org/matahariproject/QmfPackage.h"
diff --git a/src/postboot/postboot-qmf.cpp b/src/postboot/postboot-qmf.cpp index fa3bbdf..fa69751 100644 --- a/src/postboot/postboot-qmf.cpp +++ b/src/postboot/postboot-qmf.cpp @@ -20,7 +20,7 @@ #include "config.h" #endif
-#include "matahari/mh_agent.h" +#include "matahari/agent.h"
#include "qmf/org/matahariproject/QmfPackage.h"
diff --git a/src/service/service-dbus.c b/src/service/service-dbus.c index 4964713..879163d 100644 --- a/src/service/service-dbus.c +++ b/src/service/service-dbus.c @@ -22,7 +22,7 @@
#include <string.h>
-#include "matahari/mh_dbus_common.h" +#include "matahari/dbus_common.h"
/* Services methods */ #include "matahari/services.h" diff --git a/src/service/service-qmf-console.cpp b/src/service/service-qmf-console.cpp index dac8bca..f89bd1c 100644 --- a/src/service/service-qmf-console.cpp +++ b/src/service/service-qmf-console.cpp @@ -28,7 +28,7 @@ #include <qmf/Query.h> #include <qpid/types/Variant.h>
-#include <matahari/mh_agent.h> +#include <matahari/agent.h>
#include <string> #include <iostream> diff --git a/src/service/service-qmf.cpp b/src/service/service-qmf.cpp index 492a803..9da1866 100644 --- a/src/service/service-qmf.cpp +++ b/src/service/service-qmf.cpp @@ -28,7 +28,7 @@ extern "C" { #include <string> #include <qpid/management/Manageable.h> #include <qpid/agent/ManagementAgent.h> -#include "matahari/mh_agent.h" +#include "matahari/agent.h"
#include "qmf/org/matahariproject/QmfPackage.h"
matahari@lists.fedorahosted.org