5e1f920cedda16369f70367aa7e27c8ffa6acaa9
[ossec-hids.git] / src / client-agent / event-forward.c
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 /* Part of the OSSEC HIDS
13  * Available at http://www.ossec.net/hids/
14  */
15
16
17 #include "shared.h"
18 #include "agentd.h"
19
20 #include "os_net/os_net.h"
21
22 #include "sec.h"
23
24
25
26 /* Receives a message locally on the agent and forwards to the
27  * manager.
28  */
29 void *EventForward()
30 {
31     int recv_b;
32     char msg[OS_MAXSTR +1];
33
34
35     /* Initializing variables */
36     msg[0] = '\0';
37     msg[OS_MAXSTR] = '\0';
38
39
40     while((recv_b = recv(logr->m_queue, msg, OS_MAXSTR, MSG_DONTWAIT)) > 0)
41     {
42         msg[recv_b] = '\0';
43
44         send_msg(0, msg);
45
46         run_notify();
47     }
48
49     return(NULL);
50 }
51
52
53
54 /* EOF */