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