Imported Upstream version 2.7
[ossec-hids.git] / src / headers / read-agents.h
1 /* @(#) $Id: ./src/headers/read-agents.h, 2011/09/08 dcid Exp $
2  */
3
4 /* Copyright (C) 2009 Trend Micro Inc.
5  * All right reserved.
6  *
7  * This program is a free software; you can redistribute it
8  * and/or modify it under the terms of the GNU General Public
9  * License (version 2) as published by the FSF - Free Software
10  * Foundation
11  */
12
13
14
15 #ifndef __CRAGENT_H
16 #define __CRAGENT_H
17
18
19 /* Unique key for each agent. */
20 typedef struct _agent_info
21 {
22     char *last_keepalive;
23     char *syscheck_time;
24     char *syscheck_endtime;
25     char *rootcheck_time;
26     char *rootcheck_endtime;
27     char *os;
28     char *version;
29 }agent_info;
30
31
32 /* Print syscheck db (of modified files). */
33 int print_syscheck(char *sk_name, char *sk_ip, char *fname, int print_registry,
34                    int all_files, int csv_output, int update_counter);
35
36 /* Print rootcheck db. */
37 int print_rootcheck(char *sk_name, char *sk_ip, char *fname, int resolved,
38                     int csv_output, int show_last);
39
40 /* Delete syscheck db */
41 int delete_syscheck(char *sk_name, char *sk_ip, int full_delete);
42
43 /* Delete rootcheck db. */
44 int delete_rootcheck(char *sk_name, char *sk_ip, int full_delete);
45
46 /* Delete agent information */
47 int delete_agentinfo(char *name);
48
49 /* Get all available agents */
50 char **get_agents(int flag);
51
52 /* Free the agent list */
53 void free_agents(char **agent_list);
54
55 /** char *print_agent_status(int status)
56  * Prints the text representation of the agent status.
57  */
58 char *print_agent_status(int status);
59
60 /** int get_agent_status(char *agent_name, char *agent_ip)
61  * Gets the status of an agent, based on the name/ip.
62  */
63 int get_agent_status(char *agent_name, char *agent_ip);
64
65 /** agent_info *get_agent_info(char *agent_name, char *agent_ip)
66  * Get information from an agent.
67  */
68 agent_info *get_agent_info(char *agent_name, char *agent_ip);
69
70
71 /** int connect_to_remoted()
72  * Connects to remoted to be able to send messages to the agents.
73  * Returns the socket on success or -1 on failure.
74  */
75 int connect_to_remoted();
76
77 /** int send_msg_to_agent(int socket, char *msg)
78  * Sends a message to an agent.
79  * returns -1 on error.
80  */
81 int send_msg_to_agent(int msocket, char *msg, char *agt_id, char *exec);
82
83
84
85
86 #define GA_NOTACTIVE    2
87 #define GA_ACTIVE       3
88 #define GA_ALL          5
89 #define GA_ALL_WSTATUS  7
90
91 /* Status */
92 #define GA_STATUS_ACTIVE    12
93 #define GA_STATUS_NACTIVE   13
94 #define GA_STATUS_INV       14
95
96
97
98 #endif