20 #ifndef LIBFOSSSCHEDULER_H_INCLUDE 21 #define LIBFOSSSCHEDULER_H_INCLUDE 25 #include <libfossdbmanager.h> 85 #define LOG_FATAL(...) { \ 86 fprintf(stdout, "FATAL %s.%d: ", __FILE__, __LINE__); \ 87 fprintf(stdout, __VA_ARGS__); \ 88 fprintf(stdout, "\n"); \ 95 #define LOG_PQ_FATAL(pg_r, ...) { \ 96 fprintf(stdout, "FATAL %s.%d: ", __FILE__, __LINE__); \ 97 fprintf(stdout, __VA_ARGS__); \ 98 fprintf(stdout, "FATAL postgresql error: %s\n", PQresultErrorMessage(pg_r)); \ 105 #define LOG_ERROR(...) { \ 106 fprintf(stdout, "ERROR %s.%d: ", __FILE__, __LINE__); \ 107 fprintf(stdout, __VA_ARGS__); \ 108 fprintf(stdout, "\n"); \ 116 #define LOG_PQ_ERROR(pg_r, ...) { \ 117 fprintf(stdout, "ERROR %s.%d: ", __FILE__, __LINE__); \ 118 fprintf(stdout, __VA_ARGS__); \ 119 fprintf(stdout, "ERROR postgresql error: %s\n", PQresultErrorMessage(pg_r)); \ 126 #define LOG_WARNING(...) { \ 127 fprintf(stdout, "WARNING %s.%d: ", __FILE__, __LINE__); \ 128 fprintf(stdout, __VA_ARGS__); \ 129 fprintf(stdout, "\n"); \ 136 #define LOG_DEBUG(...) { \ 137 fprintf(stdout, "DEBUG %s.%d: ", __FILE__, __LINE__); \ 138 fprintf(stdout, __VA_ARGS__); \ 139 fprintf(stdout, "\n"); \ 146 #define LOG_NOTICE(...) { \ 147 fprintf(stdout, "NOTICE %s.%d: ", __FILE__, __LINE__); \ 148 fprintf(stdout, __VA_ARGS__); \ 149 fprintf(stdout, "\n"); \ 152 #define TVERBOSE agent_verbose 153 #define TVERBOSE0 (agent_verbose & (1 << 0)) 154 #define TVERBOSE1 (agent_verbose & (1 << 1)) 155 #define TVERBOSE2 (agent_verbose & (1 << 2)) 156 #define TVERBOSE3 (agent_verbose & (1 << 3)) 157 #define TVERBOSE4 (agent_verbose & (1 << 4)) 158 #define TVERBOSE5 (agent_verbose & (1 << 5)) 159 #define TVERBOSE6 (agent_verbose & (1 << 6)) 160 #define TVERBOSE7 (agent_verbose & (1 << 7)) 171 #define LOG_VERBOSE(...) if(TVERBOSE) LOG_NOTICE(__VA_ARGS__); 172 #define LOG_VERBOSE0(...) if(TVERBOSE0) LOG_NOTICE(__VA_ARGS__); 173 #define LOG_VERBOSE1(...) if(TVERBOSE1) LOG_NOTICE(__VA_ARGS__); 174 #define LOG_VERBOSE2(...) if(TVERBOSE2) LOG_NOTICE(__VA_ARGS__); 175 #define LOG_VERBOSE3(...) if(TVERBOSE3) LOG_NOTICE(__VA_ARGS__); 176 #define LOG_VERBOSE4(...) if(TVERBOSE4) LOG_NOTICE(__VA_ARGS__); 177 #define LOG_VERBOSE5(...) if(TVERBOSE5) LOG_NOTICE(__VA_ARGS__); 178 #define LOG_VERBOSE6(...) if(TVERBOSE6) LOG_NOTICE(__VA_ARGS__); 179 #define LOG_VERBOSE7(...) if(TVERBOSE7) LOG_NOTICE(__VA_ARGS__); 187 #define SPECIAL_NOKILL (1 << 0) 199 #define NOTIFY_EMAIL(...) \ 200 fprintf(stdout, "EMAIL "); \ 201 fprintf(stdout, __VA_ARGS__); \ 202 fprintf(stdout, "\n"); \ 221 char*
fo_sysconfig(
const char* sectionname,
const char* variablename);
FOSSology library to read config file.
int fo_scheduler_groupID()
Gets the id of the group that created the job that the agent is running.
char * fo_scheduler_current()
Get the last read string from the scheduler.
void fo_scheduler_disconnect(int retcode)
Disconnect the scheduler connection.
void fo_scheduler_connect(int *argc, char **argv, PGconn **db_conn)
Establish a connection between an agent and the scheduler.
void fo_scheduler_set_special(int option, int value)
Sets something special about the agent within the scheduler.
int agent_verbose
Common verbose flags for the agents, this is used so that the scheduler can change the verbose level ...
int fo_scheduler_get_special(int option)
Gets if a particular special attribute is set in the scheduler.
int fo_scheduler_userID()
Gets the id of the user that created the job that the agent is running.
fo_dbManager * dbManager
fo_dbManager object
void fo_scheduler_connect_dbMan(int *argc, char **argv, fo_dbManager **dbManager)
Make a connection from an agent to the scheduler and create a DB manager as well. ...
int fo_scheduler_jobId()
Gets the id of the job that the agent is running.
PGconn * db_conn
The connection to Database.
char * fo_scheduler_next()
Get the next data to process from the scheduler.
void fo_scheduler_heart(int i)
This function must be called by agents to let the scheduler know they are alive and how many items th...
char * fo_sysconfig(const char *sectionname, const char *variablename)
gets a system configuration variable from the configuration data.