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