7 #ifndef AGENT_H_INCLUDE
8 #define AGENT_H_INCLUDE
16 #include <sys/types.h>
29 #define DEFAULT_RET -1
31 #define LOCAL_HOST "localhost"
33 #define SAG_NOKILL (1 << 0)
34 #define SAG_EXCLUSIVE (1 << 1)
35 #define SAG_NOEMAIL (1 << 2)
36 #define SAG_LOCAL (1 << 3)
50 #define AGENT_STATUS_TYPES(apply) \
65 #define SELECT_ENUM(passed) AG_##passed,
69 extern const char* agent_status_strings[];
void meta_agent_destroy(meta_agent_t *meta_agent)
void agent_ready_event(scheduler_t *scheduler, agent_t *agent)
Event created when an agent is ready for more data.
int aprintf(agent_t *agent, const char *fmt,...)
ssize_t agent_write(agent_t *agent, const void *buf, int count)
void agent_update_event(scheduler_t *scheduler, void *unused)
agent_t * agent_init(scheduler_t *scheduler, host_t *host, job_t *owner)
Allocate and spawn a new agent.
void agent_destroy(agent_t *agent)
Frees the memory associated with an agent.
#define MAX_CMD
the size of the agent's command buffer (arbitrary)
void agent_fail_event(scheduler_t *scheduler, agent_t *agent)
Fails an agent.
meta_agent_t * meta_agent_init(char *name, char *cmd, int max, int spc)
Creates a new meta agent.
void agent_kill(agent_t *agent)
Unclean kill of an agent.
void agent_pause(agent_t *agent)
#define SELECT_ENUM(passed)
int add_meta_agent(GTree *meta_agents, char *name, char *cmd, int max, int spc)
void meta_agent_increase_count(meta_agent_t *)
void agent_create_event(scheduler_t *scheduler, agent_t *agent)
Event created when a new agent has been created.
#define AGENT_STATUS_TYPES(apply)
void agent_transition(agent_t *agent, agent_status new_status)
void meta_agent_decrease_count(meta_agent_t *)
void agent_unpause(agent_t *agent)
void test_agents(scheduler_t *scheduler)
Calls the agent test function for every type of agent.
void kill_agents(scheduler_t *scheduler)
Call the agent_kill function for every agent within the system.
int is_agent_special(agent_t *agent, int special_type)
tests if a particular agent has a specific special flag set
void list_agents_event(scheduler_t *scheduler, GOutputStream *ostr)
Receive agent on interface.
void agent_death_event(scheduler_t *scheduler, pid_t *pids)
int is_meta_special(meta_agent_t *ma, int special_type)
tests if a particular meta agent has a specific special flag set
void agent_print_status(agent_t *agent, GOutputStream *ostr)
Prints the status of the agent to the output stream provided.
FUNCTION int max(int permGroup, int permPublic)
Get the maximum group privilege.
Header file for the scheduler.
time_t check_in
the time that the agent last generated anything
int to_child
file identifier to print to the child
agent_status status
the state of execution the agent is currently in
meta_agent_t * type
the type of agent this is i.e. bucket, copyright...
int from_child
file identifier to read from child
gchar * data
the data that has been sent to the agent for analysis
FILE * write
FILE* that abstracts the use of the to_child socket.
gboolean alive
flag to tell the scheduler if the agent is still alive
job_t * owner
the job that this agent is assigned to
FILE * read
FILE* that abstracts the use of the from_child socket.
uint32_t special
any special flags that the agent has set
int to_parent
file identifier to print to the parent (child stdout)
uint8_t n_updates
keeps track of the number of times the agent has updated
uint64_t total_analyzed
the total number that this agent has analyzed
host_t * host
the host that this agent will start on
GThread * thread
the thread that communicates with this agent
int from_parent
file identifier to read from the parent (child stdin)
uint8_t return_code
what was returned by the agent when it disconnected
pid_t pid
the pid of the process this agent is running in
gboolean updated
boolean flag to indicate if the scheduler has updated the data