2020-07-27 07:02:11 +02:00
|
|
|
/**
|
2022-03-12 10:22:42 +01:00
|
|
|
* (C) 2007-22 - ntop.org and contributors
|
2020-07-27 07:02:11 +02:00
|
|
|
*
|
|
|
|
* 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 3 of the License, 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 see see <http://www.gnu.org/licenses/>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-03-16 15:03:03 +01:00
|
|
|
#include "n2n.h"
|
|
|
|
|
|
|
|
static int keep_running;
|
|
|
|
|
2021-01-07 11:14:25 +01:00
|
|
|
int main () {
|
2020-03-16 15:03:03 +01:00
|
|
|
|
2021-01-07 11:14:25 +01:00
|
|
|
n2n_sn_t sss_node;
|
|
|
|
int rc;
|
2020-03-16 15:03:03 +01:00
|
|
|
|
2021-08-30 10:38:31 +02:00
|
|
|
sn_init_defaults(&sss_node);
|
2021-01-07 11:14:25 +01:00
|
|
|
sss_node.daemon = 0; // Whether to daemonize
|
|
|
|
sss_node.lport = 1234; // Main UDP listen port
|
2020-03-16 15:03:03 +01:00
|
|
|
|
2021-09-06 13:18:15 +02:00
|
|
|
sss_node.sock = open_socket(sss_node.lport, INADDR_ANY, 0 /* UDP */);
|
2021-01-07 11:14:25 +01:00
|
|
|
if(-1 == sss_node.sock) {
|
|
|
|
exit(-2);
|
|
|
|
}
|
2020-03-16 15:03:03 +01:00
|
|
|
|
2021-09-06 13:18:15 +02:00
|
|
|
sss_node.mgmt_sock = open_socket(5645, INADDR_LOOPBACK, 0 /* UDP */); // Main UDP management port
|
2021-01-07 11:14:25 +01:00
|
|
|
if(-1 == sss_node.mgmt_sock) {
|
|
|
|
exit(-2);
|
|
|
|
}
|
2020-03-16 15:03:03 +01:00
|
|
|
|
2021-08-30 10:38:31 +02:00
|
|
|
sn_init(&sss_node);
|
|
|
|
|
2021-01-07 11:14:25 +01:00
|
|
|
keep_running = 1;
|
2021-10-23 07:20:05 +02:00
|
|
|
sss_node.keep_running = &keep_running;
|
|
|
|
rc = run_sn_loop(&sss_node);
|
2020-03-16 15:03:03 +01:00
|
|
|
|
2021-01-07 11:14:25 +01:00
|
|
|
sn_term(&sss_node);
|
|
|
|
|
|
|
|
return rc;
|
2020-07-27 07:02:11 +02:00
|
|
|
}
|