1 /* Copyright (C) 2009 Trend Micro Inc.
4 * This program is a free software; you can redistribute it
5 * and/or modify it under the terms of the GNU General Public
6 * License (version 2) as published by the FSF - Free Software
13 #include <external/cJSON/cJSON.h>
16 /* Unique key for each agent */
17 typedef struct _agent_info {
20 char *syscheck_endtime;
22 char *rootcheck_endtime;
27 /* Print syscheck db (of modified files) */
28 int print_syscheck(const char *sk_name, const char *sk_ip, const char *fname, int print_registry,
29 int all_files, int csv_output, cJSON *json_output, int update_counter);
31 /* Print rootcheck db */
32 int print_rootcheck(const char *sk_name, const char *sk_ip, const char *fname, int resolved,
33 int csv_output, cJSON *json_output, int show_last);
36 /* Delete syscheck db */
37 int delete_syscheck(const char *sk_name, const char *sk_ip, int full_delete) __attribute__((nonnull));
39 /* Delete rootcheck db */
40 int delete_rootcheck(const char *sk_name, const char *sk_ip, int full_delete) __attribute__((nonnull));
42 /* Delete agent information */
43 int delete_agentinfo(const char *name) __attribute__((nonnull));
45 /* Get all available agents */
46 char **get_agents(int flag);
48 /* Get all available agents with specified timeout */
49 char **get_agents_with_timeout(int flag, int timeout);
51 /* Free the agent list */
52 void free_agents(char **agent_list);
54 /* Print the text representation of the agent status */
55 const char *print_agent_status(int status);
57 /* Gets the status of an agent, based on the name/IP address */
58 int get_agent_status(const char *agent_name, const char *agent_ip);
60 /* Get information from an agent */
61 agent_info *get_agent_info(const char *agent_name, const char *agent_ip) __attribute__((nonnull(2)));
63 /* Connect to remoted to be able to send messages to the agents
64 * Returns the socket on success or -1 on failure
66 int connect_to_remoted(void);
69 /* Return the unix permission string based on the syscheck db perm string
70 * agentless logs octal permissions, local syscheck decimal st_mode
71 * Returns a pointer to a local static array
73 const char *agent_file_perm(char *perm);
76 /* Sends a message to an agent
79 int send_msg_to_agent(int msocket, const char *msg, const char *agt_id, const char *exec) __attribute__((nonnull(2)));
81 #define GA_NOTACTIVE 2
84 #define GA_ALL_WSTATUS 7
87 #define GA_STATUS_ACTIVE 12
88 #define GA_STATUS_NACTIVE 13
89 #define GA_STATUS_INV 14