110 #ifndef SCHEDULER_H_INCLUDE 111 #define SCHEDULER_H_INCLUDE 125 #include <libpq-fe.h> 131 #define CHECKOUT_SIZE 100 133 #define AGENT_BINARY "%s/%s/%s/agent/%s" 134 #define AGENT_CONF "mods-enabled" 140 #define SafePQclear(pgres) if (pgres) {PQclear(pgres); pgres = NULL;} 230 #define NOOP(val) val 256 #define CONF_VARIABLES_TYPES(apply) \ 257 apply(uint32_t, fork_backoff_time, atoi, %d, 5) \ 258 apply(uint32_t, agent_death_timer, atoi, %d, 180) \ 259 apply(uint32_t, agent_update_interval, atoi, %d, 120) \ 260 apply(uint32_t, agent_update_number, atoi, %d, 5) \ 261 apply(gint, interface_nthreads, atoi, %d, 10) 264 #define SELECT_DECLS(type, name, l_op, w_op, val) extern type CONF_##name; 269 #define MK_STRING_LIT(passed) #passed 277 gint
string_compare(gconstpointer a, gconstpointer b, gpointer user_data);
278 gint
int_compare(gconstpointer a, gconstpointer b, gpointer user_data);
PGconn * db_conn
The database connection.
void scheduler_agent_config(scheduler_t *scheduler)
Loads a particular agents configuration file.
void scheduler_clear_config(scheduler_t *scheduler)
Clears any information that is loaded when loading the configuration.
gchar * email_header
The beginning of the email message.
gboolean default_footer
Is the footer the default footer.
GTree * host_list
List of all hosts available to the scheduler.
scheduler_t * scheduler_init(gchar *sysconfigdir, log_t *log)
Create a new scheduler object.
GTree * meta_agents
List of all meta agents available to the scheduler.
FOSSology library to read config file.
void set_usr_grp(gchar *process_name, fo_conf *config)
gint string_compare(gconstpointer a, gconstpointer b, gpointer user_data)
GRegex * parse_db_email
Parses database email text.
fo_conf * sysconfig
Configuration information loaded from the configuration file.
GCancellable * cancel
Used to stop the listening thread when it is running.
void scheduler_destroy(scheduler_t *scheduler)
Free any memory associated with a scheduler_t.
gboolean s_pause
Has the scheduler been paused.
gboolean default_header
Is the header the default header.
GRegex * parse_interface_cmd
Parses the commands received by the interface.
GList * host_queue
Round-robin queue for choosing which host use next.
gboolean i_created
Has the interface been created.
uint16_t i_port
The port that the scheduler is listening on.
GThread * server
Thread that is listening to the server socket.
void scheduler_config_event(scheduler_t *scheduler, void *)
Load both the fossology configuration and all the agent configurations.
gchar * sysconfigdir
The system directory that contain fossology.conf.
gboolean logcmdline
Was the log file set by the command line.
GSequence * job_queue
heap of jobs that still need to be started
gchar * host_url
The url that is used to get to the FOSSology instance.
#define CONF_VARIABLES_TYPES(apply)
gint int_compare(gconstpointer a, gconstpointer b, gpointer user_data)
gint string_is_num(gchar *str)
Checks if a string is entirely composed of numeric characters.
void g_tree_clear(GTree *tree)
Clears the contents of a GTree.
GTree * job_list
List of jobs that have been created.
void scheduler_close_event(scheduler_t *scheduler, void *)
Sets the closing flag and possibly kills all currently running agents.
gboolean s_daemon
Is the scheduler being run as a daemon.
gchar * email_footer
The end of the email message.
void scheduler_sig_handle(int signo)
Handles any signals sent to the scheduler that are not SIGCHLD.
void scheduler_update(scheduler_t *scheduler)
Update function called after every event.
gboolean i_terminate
Has the interface been terminated.
GTree * agents
List of any currently running agents.
gchar * email_command
The command that will sends emails, usually mailx.
#define SELECT_DECLS(type, name, l_op, w_op, val)
void scheduler_signal(scheduler_t *scheduler)
Function that handles certain signals being delivered to the scheduler.
void scheduler_test_agents(scheduler_t *scheduler, void *)
Event used when the scheduler tests the agents.
gboolean s_startup
Has the scheduler finished startup tests.
void scheduler_foss_config(scheduler_t *scheduler)
Loads the configuration data from fossology.conf.
GRegex * parse_agent_msg
Parses messages coming from the agents.
gboolean s_pid
The pid of the scheduler process.
GThread * main_thread
Pointer to the main thread.
int closing
Set if scheduler is shutting down.
log_t * main_log
The main log file for the scheduler.
GThreadPool * workers
Threads to handle incoming network communication.
int verbose
The verbose flag for the cli.
gchar * logdir
The directory to put the log file in.
gchar * email_subject
The subject to be used for emails.
int scheduler_daemonize(scheduler_t *scheduler)
Daemonizes the scheduler.
int kill_scheduler(int force)
Kills all other running scheduler.
gchar * process_name
The name of the scheduler process.