1 /* Copyright (C) 2009 Trend Micro Inc. 2 * All rights reserved. 3 * 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 7 * Foundation 8 */ 9 10 #ifndef __AGENTD_H 11 #define __AGENTD_H 12 13 #include "config/config.h" 14 #include "config/client-config.h" 15 16 #ifndef WIN32 17 #include <imsg.h> 18 #endif //WIN32 19 20 /*** Function Prototypes ***/ 21 22 /* Client configuration */ 23 int ClientConf(const char *cfgfile); 24 25 /* Agentd init function */ 26 void AgentdStart(const char *dir, int uid, int gid, const char *user, const char *group) __attribute__((noreturn)); 27 28 /* Event Forwarder */ 29 #ifdef WIN32 30 void *EventForward(void); 31 #else 32 void *EventForward(void); 33 #endif //WIN32 34 35 /* Receiver messages */ 36 void *receive_msg(void); 37 38 /* Receiver messages for Windows */ 39 void *receiver_thread(void *none); 40 41 /* Send integrity checking information about a file to the server */ 42 int intcheck_file(const char *file_name, const char *dir); 43 44 /* Send message to server */ 45 int send_msg(int agentid, const char *msg); 46 47 /* Extract the shared files */ 48 char *getsharedfiles(void); 49 50 /* Initialize handshake to server */ 51 #ifdef WIN32 52 void start_agent(int is_startup); 53 #else 54 void start_agent(int is_startup); 55 #endif 56 57 /* Connect to the server */ 58 #ifdef WIN32 59 int connect_server(int initial_id); 60 #else 61 int connect_server(int initial_id); 62 #endif 63 64 /* Notify server */ 65 #ifdef WIN32 66 void run_notify(void); 67 #else 68 void run_notify(void); 69 #endif 70 71 /* libevent callback */ 72 void os_agent_cb(int fd, short ev, void *arg); 73 74 /*** Global variables ***/ 75 76 /* Global variables. Only modified during startup. */ 77 78 #include "shared.h" 79 #include "sec.h" 80 81 extern time_t available_server; 82 extern int run_foreground; 83 extern keystore keys; 84 extern agent *agt; 85 #ifndef WIN32 86 extern struct imsgbuf server_ibuf; 87 #endif //WIN32 88 89 #endif /* __AGENTD_H */ 90 91