2009-08-21 14:13:36 +02:00
|
|
|
/*
|
|
|
|
|
2020-11-27 13:52:35 +01:00
|
|
|
Copyright (c) 2009-2021 Artica ST.
|
2009-08-21 14:13:36 +02:00
|
|
|
Written by Ramon Novoa
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation,
|
|
|
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2008-12-11 11:20:07 +01:00
|
|
|
#ifndef __UDP_SERVER_H__
|
|
|
|
#define __UDP_SERVER_H__
|
|
|
|
|
|
|
|
#define MAX_PACKET_SIZE 1024
|
|
|
|
|
2010-05-19 17:21:10 +02:00
|
|
|
#include <algorithm>
|
2008-12-11 11:20:07 +01:00
|
|
|
#include "../pandora_windows_service.h"
|
|
|
|
|
|
|
|
namespace Pandora {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* UDP Server class.
|
|
|
|
*/
|
|
|
|
class UDP_Server {
|
|
|
|
public:
|
|
|
|
UDP_Server (Pandora_Windows_Service *service, string address, string auth_address, unsigned int port);
|
2009-09-22 Ramon Novoa <rnovoa@artica.es>
* debug_new.h, fast_mutex.h,
debug_new.cpp, static_assert.h: Added to repository. Wu Yongwei's
memory leak detection tool (part of Nvwa). Only compiled when
debugging is enabled.
* bin/util/tentacle_client.exe: Added to repository. Tentacle client
needed to build the installer.
* installer/pandora_2.0.mpi: moved to installer/pandora.mpi. Updated.
The installer can now be built directly from the installer
subdirectory.
* configure.in, Makefile.am, autogen.sh: Created a proper
configure.in and Makefile.am. The agent can now be cross-compiled
from Linux :-D
* bin/pandora_agent.conf: Fixed. A local configuration had been
uploaded.
* pandora_windows_service.h,pandora_windows_service.cc,
udp_server/udp_server.cc, udp_server/udp_server.h: Properly shutdown
the UDP server.
* modules/pandora_module_regexp.cc,
modules/pandora_module_inventory.cc,
modules/pandora_module_factory.cc,
modules/pandora_module.cc, pandora_strutils.cc,
pandora.h, pandora.cc: Fixed a couple of memory leaks. Small changes
to avoid compile warnings when cross-compiling from Linux.
* windows_service.cc: Removed the interactive service flag to avoid
'black windows'.
* main.cc: Include the memory leak detection tool if debugging is
enabled.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1966 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-09-22 13:48:25 +02:00
|
|
|
virtual ~UDP_Server ();
|
2009-03-24 15:06:23 +01:00
|
|
|
unsigned long getAddress ();
|
|
|
|
unsigned long getPort ();
|
|
|
|
Pandora_Windows_Service *getService ();
|
2008-12-11 11:20:07 +01:00
|
|
|
unsigned char isRunning ();
|
2015-09-22 14:54:48 +02:00
|
|
|
bool isAddressAuth (unsigned long ip);
|
2008-12-11 11:20:07 +01:00
|
|
|
|
|
|
|
int start ();
|
|
|
|
int stop ();
|
|
|
|
|
|
|
|
private:
|
|
|
|
unsigned long address;
|
2015-09-22 14:54:48 +02:00
|
|
|
list<unsigned long> auth_address;
|
|
|
|
list<unsigned long>::iterator it;
|
2008-12-11 11:20:07 +01:00
|
|
|
unsigned long port;
|
|
|
|
unsigned char running;
|
|
|
|
Pandora_Windows_Service *service;
|
2015-09-22 14:54:48 +02:00
|
|
|
void splitAuthAddress (string all_address);
|
2008-12-11 11:20:07 +01:00
|
|
|
};
|
|
|
|
|
2009-03-24 15:06:23 +01:00
|
|
|
void listen (UDP_Server *server);
|
2008-12-11 11:20:07 +01:00
|
|
|
int process_command (Pandora_Windows_Service *service, char *command);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|