8 #ifndef LIBFOSSSCHEDULER_H_INCLUDE
9 #define LIBFOSSSCHEDULER_H_INCLUDE
13 #include <libfossdbmanager.h>
73 #define LOG_FATAL(...) { \
74 fprintf(stdout, "FATAL %s.%d: ", __FILE__, __LINE__); \
75 fprintf(stdout, __VA_ARGS__); \
76 fprintf(stdout, "\n"); \
83 #define LOG_PQ_FATAL(pg_r, ...) { \
84 fprintf(stdout, "FATAL %s.%d: ", __FILE__, __LINE__); \
85 fprintf(stdout, __VA_ARGS__); \
86 fprintf(stdout, "FATAL postgresql error: %s\n", PQresultErrorMessage(pg_r)); \
93 #define LOG_ERROR(...) { \
94 fprintf(stdout, "ERROR %s.%d: ", __FILE__, __LINE__); \
95 fprintf(stdout, __VA_ARGS__); \
96 fprintf(stdout, "\n"); \
104 #define LOG_PQ_ERROR(pg_r, ...) { \
105 fprintf(stdout, "ERROR %s.%d: ", __FILE__, __LINE__); \
106 fprintf(stdout, __VA_ARGS__); \
107 fprintf(stdout, "ERROR postgresql error: %s\n", PQresultErrorMessage(pg_r)); \
114 #define LOG_WARNING(...) { \
115 fprintf(stdout, "WARNING %s.%d: ", __FILE__, __LINE__); \
116 fprintf(stdout, __VA_ARGS__); \
117 fprintf(stdout, "\n"); \
124 #define LOG_DEBUG(...) { \
125 fprintf(stdout, "DEBUG %s.%d: ", __FILE__, __LINE__); \
126 fprintf(stdout, __VA_ARGS__); \
127 fprintf(stdout, "\n"); \
134 #define LOG_NOTICE(...) { \
135 fprintf(stdout, "NOTICE %s.%d: ", __FILE__, __LINE__); \
136 fprintf(stdout, __VA_ARGS__); \
137 fprintf(stdout, "\n"); \
140 #define TVERBOSE agent_verbose
141 #define TVERBOSE0 (agent_verbose & (1 << 0))
142 #define TVERBOSE1 (agent_verbose & (1 << 1))
143 #define TVERBOSE2 (agent_verbose & (1 << 2))
144 #define TVERBOSE3 (agent_verbose & (1 << 3))
145 #define TVERBOSE4 (agent_verbose & (1 << 4))
146 #define TVERBOSE5 (agent_verbose & (1 << 5))
147 #define TVERBOSE6 (agent_verbose & (1 << 6))
148 #define TVERBOSE7 (agent_verbose & (1 << 7))
159 #define LOG_VERBOSE(...) if(TVERBOSE) LOG_NOTICE(__VA_ARGS__);
160 #define LOG_VERBOSE0(...) if(TVERBOSE0) LOG_NOTICE(__VA_ARGS__);
161 #define LOG_VERBOSE1(...) if(TVERBOSE1) LOG_NOTICE(__VA_ARGS__);
162 #define LOG_VERBOSE2(...) if(TVERBOSE2) LOG_NOTICE(__VA_ARGS__);
163 #define LOG_VERBOSE3(...) if(TVERBOSE3) LOG_NOTICE(__VA_ARGS__);
164 #define LOG_VERBOSE4(...) if(TVERBOSE4) LOG_NOTICE(__VA_ARGS__);
165 #define LOG_VERBOSE5(...) if(TVERBOSE5) LOG_NOTICE(__VA_ARGS__);
166 #define LOG_VERBOSE6(...) if(TVERBOSE6) LOG_NOTICE(__VA_ARGS__);
167 #define LOG_VERBOSE7(...) if(TVERBOSE7) LOG_NOTICE(__VA_ARGS__);
175 #define SPECIAL_NOKILL (1 << 0)
187 #define NOTIFY_EMAIL(...) \
188 fprintf(stdout, "EMAIL "); \
189 fprintf(stdout, __VA_ARGS__); \
190 fprintf(stdout, "\n"); \
209 char*
fo_sysconfig(
const char* sectionname,
const char* variablename);
FOSSology library to read config file.
void fo_scheduler_disconnect(int retcode)
Disconnect the scheduler connection.
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...
void fo_scheduler_set_special(int option, int value)
Sets something special about the agent within the scheduler.
char * fo_sysconfig(const char *sectionname, const char *variablename)
gets a system configuration variable from the configuration data.
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.
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_userID()
Gets the id of the user that created the job that the agent is running.
char * fo_scheduler_current()
Get the last read string from the scheduler.
int fo_scheduler_jobId()
Gets the id of the job that the agent is running.
char * fo_scheduler_next()
Get the next data to process from the scheduler.
void fo_scheduler_connect(int *argc, char **argv, PGconn **db_conn)
Establish a connection between an agent and the scheduler.
int fo_scheduler_groupID()
Gets the id of the group that created the job that the agent is running.
fo_dbManager * dbManager
fo_dbManager object
PGconn * db_conn
The connection to Database.