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