new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / client-agent / event-forward.c
1 /* Copyright (C) 2009 Trend Micro Inc.
2  * All right 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 #include "shared.h"
11 #include "agentd.h"
12 #include "os_net/os_net.h"
13 #include "sec.h"
14
15
16 /* Receive a message locally on the agent and forward it to the manager */
17 void *EventForward()
18 {
19     ssize_t recv_b;
20     char msg[OS_MAXSTR + 1];
21
22     /* Initialize variables */
23     msg[0] = '\0';
24     msg[OS_MAXSTR] = '\0';
25
26     while ((recv_b = recv(agt->m_queue, msg, OS_MAXSTR, MSG_DONTWAIT)) > 0) {
27         msg[recv_b] = '\0';
28
29         send_msg(0, msg);
30
31         run_notify();
32     }
33
34     return (NULL);
35 }
36