diff --git a/Doxyfile b/Doxyfile index 57f185a9..aa6bd4ed 100644 --- a/Doxyfile +++ b/Doxyfile @@ -297,7 +297,7 @@ SYMBOL_CACHE_SIZE = 0 # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES -EXTRACT_ALL = YES +EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. @@ -313,7 +313,7 @@ EXTRACT_STATIC = NO # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. -EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_CLASSES = NO # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in @@ -396,7 +396,7 @@ INLINE_INFO = YES # alphabetically by member name. If set to NO the members will appear in # declaration order. -SORT_MEMBER_DOCS = YES +SORT_MEMBER_DOCS = NO # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically @@ -470,7 +470,7 @@ SHOW_USED_FILES = YES # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. -SHOW_DIRECTORIES = NO +SHOW_DIRECTORIES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the @@ -511,7 +511,7 @@ LAYOUT_FILE = # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. -QUIET = NO +QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank @@ -538,7 +538,7 @@ WARN_IF_DOC_ERROR = YES # wrong or incomplete parameter documentation, but not about the absence of # documentation. -WARN_NO_PARAMDOC = NO +WARN_NO_PARAMDOC = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text @@ -564,7 +564,8 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = . common dbus daemon gui lib proxies +#INPUT = . common dbus daemon gui lib proxies +INPUT = daemon/app_supervisor.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is diff --git a/daemon/app_supervisor.h b/daemon/app_supervisor.h index 10feac71..d2baeb99 100644 --- a/daemon/app_supervisor.h +++ b/daemon/app_supervisor.h @@ -23,49 +23,132 @@ * or write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ +/** @file app_supervisor.h */ #ifndef APP_SUPERVISOR_H__712E6589_DCB1_4CE9_9812_4F250D55E8A2__INCLUDED #define APP_SUPERVISOR_H__712E6589_DCB1_4CE9_9812_4F250D55E8A2__INCLUDED #include "common.h" -typedef struct ladish_app_supervisor_tag { int unused; } * ladish_app_supervisor_handle; -typedef struct ladish_app_tag { int unused; } * ladish_app_handle; +/** + * App supervisor object handle (pointer to opaque data) + */ +typedef struct ladish_app_supervisor_tag { int unused; /**< fake */ } * ladish_app_supervisor_handle; -/* create app supervisor */ +/** + * App object handle (pointer to opaque data) + * + * The app objects are owned by the app supervisor objects (there is not refcounting) + */ +typedef struct ladish_app_tag { int unused; /**< fake */ } * ladish_app_handle; + +/** + * Type of function that is called when app is renamed + * + * @param[in] context User defined context that was supplied to ladish_app_supervisor_create() + * @param[in] old_name Old name of the app + * @param[in] new_name New name of the app + */ +typedef void (* ladish_app_supervisor_on_app_renamed_callback)( + void * context, + const char * old_name, + const char * new_app_name); + +/** + * Type of function that is called during app enumeration + * + * @param[in] context User defined context that was supplied to ladish_app_supervisor_enum() + * @param[in] name Name of the app + * @param[in] running Whether the app is currently running + * @param[in] command Commandline that is used to start the app + * @param[in] terminal Whether the app is started in terminal + * @param[in] level The level that app was started in + * @param[in] pid PID of the app; Zero if app is not start + */ +typedef bool (* ladish_app_supervisor_enum_callback)( + void * context, + const char * name, + bool running, + const char * command, + bool terminal, + uint8_t level, + pid_t pid); + +/** + * Create app supervisor object + * + * @param[out] supervisor_handle_ptr Pointer to variable that will receive supervisor handle + * @param[in] opath Unique D-Bus object path for supervisor being created + * @param[in] name Name of the supervisor + * @param[in] context User defined context to be supplied when the callback suppiled through the @c on_app_renamed parameter is called + * @param[in] on_app_renamed Callback to call when app is renamed + * + * @return success status + */ bool ladish_app_supervisor_create( ladish_app_supervisor_handle * supervisor_handle_ptr, const char * opath, const char * name, void * context, - void (* on_app_renamed)(void * context, const char * old_name, const char * new_app_name)); + ladish_app_supervisor_on_app_renamed_callback on_app_renamed); -/* destroy app supervisor */ +/** + * Destroy app supervisor object + * + * @param[in] supervisor_handle supervisor object handle + */ void ladish_app_supervisor_destroy( ladish_app_supervisor_handle supervisor_handle); -/* mark that app has quit */ +/** + * Mark that app has quit + * + * This function is called to mark that app has quit. Must not be called from signal handler because app supervisor object is not thread safe. + * + * @param[in] supervisor_handle supervisor object handle + * @param[in] pid of the app whose termination was detected + */ bool ladish_app_supervisor_child_exit( ladish_app_supervisor_handle supervisor_handle, pid_t pid); -/* iterate apps */ +/** + * Iterate apps that are owned by supervisor + * + * @param[in] supervisor_handle supervisor object handle + * @param[in] context User defined context to be supplied when the callback suppiled through the @c callback parameter is called + * @param[in] callback Callback to call for each app + */ bool ladish_app_supervisor_enum( ladish_app_supervisor_handle supervisor_handle, void * context, - bool (* callback)(void * context, const char * name, bool running, const char * command, bool terminal, uint8_t level, pid_t pid)); + ladish_app_supervisor_enum_callback callback); -/* It is not clear what this function is supposed to do */ +/** + * It is not clear what this function is supposed to do + * + * @param[in] supervisor_handle supervisor object handle + */ void ladish_app_supervisor_clear( ladish_app_supervisor_handle supervisor_handle); -/* Add app; on success, app handle is returned; on failure, NULL is returned; - apps are added in stopped state; autorun parameter is just a hint for ladish_app_supervisor_autorun() */ +/** + * Add app. Apps are added in stopped state + * + * @param[in] supervisor_handle supervisor object handle + * @param[in] name Name of the app + * @param[in] autorun whether to start the app when ladish_app_supervisor_autorun() is called + * @param[in] command Commandline that is used to start the app + * @param[in] terminal Whether the app is started in terminal + * @param[in] level The level that app was started in + * + * @return app handle on success; NULL on failure; the app handle is owned by the app supervisor object + */ ladish_app_handle ladish_app_supervisor_add( ladish_app_supervisor_handle supervisor_handle, @@ -75,53 +158,140 @@ ladish_app_supervisor_add( bool terminal, uint8_t level); -/* Initiate stop of all apps owned by this supervisor */ +/** + * Initiate stop of all apps owned by this supervisor + * + * @param[in] supervisor_handle supervisor object handle + */ void ladish_app_supervisor_stop( ladish_app_supervisor_handle supervisor_handle); -/* Start all apps that were added with autorun enabled */ +/** + * Start all apps that were added with autorun enabled + * + * @param[in] supervisor_handle supervisor object handle + */ void ladish_app_supervisor_autorun( ladish_app_supervisor_handle supervisor_handle); -/* TODO: this should be renamed to match the fact that it returns app name and not app handle */ -/* Implementing ladish_app_supervisor_find_app_by_pid() makes sense as well */ +/** + * Search app by pid and return its name + * + * TODO: this should be renamed to match the fact that it returns app name and not app handle. + * Implementing ladish_app_supervisor_find_app_by_pid() makes sense as well. + * + * @param[in] supervisor_handle supervisor object handle + * @param[in] pid pid of the app to search for + * + * @return app name on success; NULL if app is not found + */ char * ladish_app_supervisor_search_app( ladish_app_supervisor_handle supervisor_handle, pid_t pid); -/* TODO: This should be probably removed in favour of ladish_app_supervisor_get_opath(); it is used for debuging purposes only */ +/** + * Get name of the supervisor + * + * TODO: This should be probably removed in favour of ladish_app_supervisor_get_opath(); it is used for debuging purposes only + * + * @param[in] supervisor_handle supervisor object handle + * + * @retval app name; the buffer is owned by the app supervisor object + */ const char * ladish_app_supervisor_get_name(ladish_app_supervisor_handle supervisor_handle); -/* Get number of apps that are currently running */ +/** + * Get number of apps that are currently running + * + * @param[in] supervisor_handle supervisor object handle + * + * @return Number of apps that are currently running + */ unsigned int ladish_app_supervisor_get_running_app_count(ladish_app_supervisor_handle supervisor_handle); -/* TODO: ladish_app_supervisor_check_app_name() should be created and exported instead */ +/** + * Find app by name + * + * TODO: ladish_app_supervisor_check_app_name() should be created and exported instead + * + * @param[in] supervisor_handle supervisor object handle + * @param[in] name name of the app to search for + * + * @return app handle on success; NULL if app is not found; the app handle is owned by the app supervisor object + */ ladish_app_handle ladish_app_supervisor_find_app_by_name(ladish_app_supervisor_handle supervisor_handle, const char * name); -/* find app by id; returns NULL if app is not found */ +/** + * Find app by id (as exposed through the D-Bus interface) + * + * @param[in] supervisor_handle supervisor object handle + * @param[in] id id of the app + * + * @return app handle on success; NULL if app is not found; the app handle is owned by the app supervisor object + */ ladish_app_handle ladish_app_supervisor_find_app_by_id(ladish_app_supervisor_handle supervisor_handle, uint64_t id); -/* the D-Bus object path for the supervisor */ +/** + * The the D-Bus object path for the supervisor. + * + * @param[in] supervisor_handle supervisor object handle + * + * @retval supervisor name; the buffer is owned by the app supervisor object + */ const char * ladish_app_supervisor_get_opath(ladish_app_supervisor_handle supervisor_handle); -/* start an app; returns success status; app must be in stopped state */ +/** + * Start an app. The app must be in stopped state. + * + * @param[in] supervisor_handle supervisor object handle + * @param[in] app_handle Handle of app to start + * + * @return success status + */ bool ladish_app_supervisor_run(ladish_app_supervisor_handle supervisor_handle, ladish_app_handle app_handle); -/* remove an app; app must be in stopped state */ +/** + * Remove an app. The app must be in stopped state. + * + * @param[in] supervisor_handle supervisor object handle + * @param[in] app_handle Handle of app to start + */ void ladish_app_supervisor_remove(ladish_app_supervisor_handle supervisor_handle, ladish_app_handle app_handle); -/* get commandline for app */ +/** + * Get commandline for an app. + * + * @param[in] app_handle app object handle + * + * @retval app commandline; the buffer is owned by the app supervisor object + */ const char * ladish_app_get_commandline(ladish_app_handle app_handle); -/* check whether app is currently running */ +/** + * Check whether app is currently running + * + * @param[in] app_handle app object handle + * + * @retval true App is running + * @retval false App is not running + */ bool ladish_app_is_running(ladish_app_handle app_handle); -/* get app name; the returned pointer is owned by the app supervisor */ +/** + * Get app name + * + * @param[in] app_handle app object handle + * + * @retval app name; the buffer is owned by the app supervisor + */ const char * ladish_app_get_name(ladish_app_handle app_handle); +/** + * D-Bus interface descriptor for the app supervisor interface. The call context must be a ::ladish_app_supervisor_handle + */ extern const struct dbus_interface_descriptor g_iface_app_supervisor; #endif /* #ifndef APP_SUPERVISOR_H__712E6589_DCB1_4CE9_9812_4F250D55E8A2__INCLUDED */