2010-07-13 12:15:46 +00:00
|
|
|
/*
|
2013-10-18 00:04:43 +00:00
|
|
|
Serval DNA header file
|
2012-07-30 03:28:21 +00:00
|
|
|
Copyright (C) 2010-2012 Paul Gardner-Stephen
|
2013-12-04 06:26:55 +00:00
|
|
|
Copyright (C) 2012-2013 Serval Project Inc.
|
2010-07-13 12:15:46 +00: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 2
|
|
|
|
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, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2013-12-07 17:38:14 +00:00
|
|
|
/*
|
|
|
|
Portions Copyright (C) 2013 Petter Reinholdtsen
|
|
|
|
Some rights reserved
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
1. Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in
|
|
|
|
the documentation and/or other materials provided with the
|
|
|
|
distribution.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2013-12-04 06:44:14 +00:00
|
|
|
#ifndef __SERVAL_DNA__SERVAL_H
|
|
|
|
#define __SERVAL_DNA__SERVAL_H
|
2012-07-23 04:17:59 +00:00
|
|
|
|
2010-07-13 12:15:46 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdlib.h>
|
2012-05-10 03:23:57 +00:00
|
|
|
#include <stdarg.h>
|
2010-07-13 12:15:46 +00:00
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
#include <strings.h>
|
|
|
|
#endif
|
|
|
|
#include <string.h>
|
2011-12-01 19:14:32 +00:00
|
|
|
#include <signal.h>
|
2012-05-14 09:02:10 +00:00
|
|
|
#include <sys/types.h>
|
2011-03-30 05:04:23 +00:00
|
|
|
|
|
|
|
#ifdef WIN32
|
2013-11-12 01:09:06 +00:00
|
|
|
# include "win32/win32.h"
|
2011-03-30 05:04:23 +00:00
|
|
|
#else
|
2013-11-12 01:09:06 +00:00
|
|
|
# include <unistd.h>
|
|
|
|
# ifdef HAVE_SYS_SOCKET_H
|
|
|
|
# include <sys/socket.h>
|
|
|
|
# endif
|
|
|
|
# ifdef HAVE_NET_ROUTE_H
|
|
|
|
# include <net/route.h>
|
|
|
|
# endif
|
|
|
|
# ifdef HAVE_LINUX_IF_H
|
|
|
|
# include <linux/if.h>
|
|
|
|
# else
|
|
|
|
# ifdef HAVE_NET_IF_H
|
|
|
|
# include <net/if.h>
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# ifdef HAVE_NETINET_IN_H
|
|
|
|
# include <netinet/in.h>
|
|
|
|
# endif
|
|
|
|
# ifdef HAVE_LINUX_NETLINK_H
|
|
|
|
# include <linux/netlink.h>
|
|
|
|
# endif
|
|
|
|
# ifdef HAVE_LINUX_RTNETLINK_H
|
|
|
|
# include <linux/rtnetlink.h>
|
|
|
|
# endif
|
|
|
|
# ifdef HAVE_IFADDRS_H
|
|
|
|
# include <ifaddrs.h>
|
|
|
|
# endif
|
|
|
|
# ifdef HAVE_SYS_SOCKIO_H
|
|
|
|
# include <sys/sockio.h>
|
|
|
|
# endif
|
|
|
|
# ifdef HAVE_SYS_UCRED_H
|
|
|
|
# include <sys/ucred.h>
|
|
|
|
# endif
|
|
|
|
#endif //!WIN32
|
2011-03-30 05:04:23 +00:00
|
|
|
|
|
|
|
#if !defined(FORASTERISK) && !defined(s_addr)
|
2010-07-13 12:15:46 +00:00
|
|
|
#ifdef HAVE_ARPA_INET_H
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#else
|
2013-10-09 08:24:21 +00:00
|
|
|
typedef uint32_t in_addr_t;
|
2010-07-13 12:15:46 +00:00
|
|
|
struct in_addr {
|
|
|
|
in_addr_t s_addr;
|
|
|
|
};
|
|
|
|
#endif
|
2011-03-21 02:38:35 +00:00
|
|
|
#endif
|
2011-03-30 05:04:23 +00:00
|
|
|
|
2010-07-13 12:15:46 +00:00
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_MMAN_H
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETDB_H
|
|
|
|
#include <netdb.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_CTYPE_H
|
|
|
|
#include <ctype.h>
|
|
|
|
#endif
|
2011-03-30 05:04:23 +00:00
|
|
|
|
|
|
|
#ifndef WIN32
|
2010-07-13 12:15:46 +00:00
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/un.h>
|
2011-03-30 05:04:23 +00:00
|
|
|
#endif
|
|
|
|
|
2010-07-13 12:15:46 +00:00
|
|
|
#include <fcntl.h>
|
2012-05-10 07:28:25 +00:00
|
|
|
#include <sys/stat.h>
|
2010-07-13 12:15:46 +00:00
|
|
|
|
2014-03-24 04:57:04 +00:00
|
|
|
#include "instance.h"
|
2013-10-18 00:04:43 +00:00
|
|
|
#include "fdqueue.h"
|
2013-02-12 07:30:37 +00:00
|
|
|
#include "cli.h"
|
2012-07-29 03:05:53 +00:00
|
|
|
#include "constants.h"
|
2012-12-03 23:26:24 +00:00
|
|
|
#include "mem.h"
|
2012-08-03 07:14:05 +00:00
|
|
|
#include "xprintf.h"
|
2012-07-29 03:05:53 +00:00
|
|
|
#include "log.h"
|
2012-08-23 03:01:07 +00:00
|
|
|
#include "net.h"
|
2012-12-03 23:42:35 +00:00
|
|
|
#include "os.h"
|
2012-05-14 09:02:10 +00:00
|
|
|
|
2011-08-08 14:41:46 +00:00
|
|
|
/* UDP Port numbers for various Serval services.
|
|
|
|
The overlay mesh works over DNA */
|
2011-04-27 11:48:09 +00:00
|
|
|
#define PORT_DNA 4110
|
2010-07-13 12:15:46 +00:00
|
|
|
|
|
|
|
#define BATCH 1
|
|
|
|
#define NONBATCH 0
|
|
|
|
|
|
|
|
#define REQ_SERIAL 0
|
|
|
|
#define REQ_PARALLEL -1
|
|
|
|
#define REQ_FIRSTREPLY -2
|
|
|
|
#define REQ_REPLY -101
|
|
|
|
|
|
|
|
|
|
|
|
#define SET_NOREPLACE 1
|
|
|
|
#define SET_REPLACE 2
|
|
|
|
#define SET_NOCREATE 3
|
|
|
|
#define SET_FRAGMENT 0x80
|
|
|
|
|
|
|
|
#define WITHDATA 1
|
|
|
|
#define WITHOUTDATA 0
|
|
|
|
|
|
|
|
/* Limit packet payloads to minimise packet loss of big packets in mesh networks */
|
|
|
|
#define MAX_DATA_BYTES 256
|
|
|
|
|
2013-03-12 03:33:33 +00:00
|
|
|
|
|
|
|
extern const char version_servald[];
|
2013-12-05 02:51:58 +00:00
|
|
|
extern const char copyright_servald[];
|
2013-03-12 03:33:33 +00:00
|
|
|
|
2013-10-09 08:24:21 +00:00
|
|
|
/* Fundamental types.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct sid_binary {
|
|
|
|
unsigned char binary[SID_SIZE];
|
|
|
|
} sid_t;
|
|
|
|
|
|
|
|
#define SID_ANY ((sid_t){{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}})
|
|
|
|
#define SID_BROADCAST ((sid_t){{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}})
|
|
|
|
|
|
|
|
// is the SID entirely 0xFF?
|
|
|
|
#define is_sid_t_broadcast(SID) is_all_matching((SID).binary, sizeof (*(sid_t*)0).binary, 0xFF)
|
|
|
|
|
|
|
|
// is the SID entirely 0x00?
|
|
|
|
#define is_sid_t_any(SID) is_all_matching((SID).binary, sizeof (*(sid_t*)0).binary, 0)
|
|
|
|
|
|
|
|
#define alloca_tohex_sid_t(sid) alloca_tohex((sid).binary, sizeof (*(sid_t*)0).binary)
|
2013-11-15 06:40:33 +00:00
|
|
|
#define alloca_tohex_sid_t_trunc(sid,strlen) tohex((char *)alloca((strlen)+1), (strlen), (sid).binary)
|
2013-10-09 08:24:21 +00:00
|
|
|
|
|
|
|
int cmp_sid_t(const sid_t *a, const sid_t *b);
|
|
|
|
int str_to_sid_t(sid_t *sid, const char *hex);
|
2014-04-29 04:09:21 +00:00
|
|
|
int strn_to_sid_t(sid_t *sid, const char *hex, size_t hexlen, const char **endp);
|
2013-10-09 08:24:21 +00:00
|
|
|
|
|
|
|
#define alloca_tohex_sas(sas) alloca_tohex((sas), SAS_SIZE)
|
|
|
|
|
2013-08-29 07:59:32 +00:00
|
|
|
struct cli_parsed;
|
|
|
|
|
2012-03-04 22:57:31 +00:00
|
|
|
extern int servalShutdown;
|
2010-07-13 12:15:46 +00:00
|
|
|
|
2012-05-15 03:26:10 +00:00
|
|
|
int rhizome_enabled();
|
2012-07-12 02:40:59 +00:00
|
|
|
int rhizome_http_server_running();
|
2011-12-17 01:41:32 +00:00
|
|
|
|
2010-07-13 12:15:46 +00:00
|
|
|
#define MAX_PEERS 1024
|
|
|
|
extern int peer_count;
|
2011-04-27 11:48:09 +00:00
|
|
|
extern struct in_addr peers[MAX_PEERS];
|
2010-07-13 12:15:46 +00:00
|
|
|
|
2012-10-03 04:29:46 +00:00
|
|
|
struct subscriber;
|
2012-10-09 01:34:02 +00:00
|
|
|
struct decode_context;
|
2013-12-02 06:47:47 +00:00
|
|
|
struct socket_address;
|
2013-12-09 07:15:47 +00:00
|
|
|
struct overlay_interface;
|
|
|
|
struct network_destination;
|
2014-01-23 06:01:56 +00:00
|
|
|
struct internal_mdp_header;
|
2012-10-03 04:29:46 +00:00
|
|
|
|
2012-08-27 00:34:59 +00:00
|
|
|
struct overlay_buffer;
|
2012-11-20 06:11:06 +00:00
|
|
|
struct overlay_frame;
|
2012-11-23 05:55:32 +00:00
|
|
|
struct broadcast;
|
|
|
|
|
2011-08-08 14:41:46 +00:00
|
|
|
extern int overlayMode;
|
2012-04-13 18:36:08 +00:00
|
|
|
|
2012-07-02 03:49:54 +00:00
|
|
|
int server_pid();
|
2014-03-26 05:05:43 +00:00
|
|
|
const char *_server_pidfile_path(struct __sourceloc);
|
|
|
|
#define server_pidfile_path() (_server_pidfile_path(__WHENCE__))
|
2012-07-02 03:49:54 +00:00
|
|
|
void server_save_argv(int argc, const char *const *argv);
|
2014-04-07 06:41:11 +00:00
|
|
|
int server(void);
|
2014-02-24 00:07:14 +00:00
|
|
|
int server_write_pid();
|
2014-02-24 06:17:16 +00:00
|
|
|
int server_write_proc_state(const char *path, const char *fmt, ...);
|
2014-02-25 02:12:36 +00:00
|
|
|
int server_get_proc_state(const char *path, char *buff, size_t buff_len);
|
2012-07-02 03:49:54 +00:00
|
|
|
int server_create_stopfile();
|
|
|
|
int server_remove_stopfile();
|
|
|
|
int server_check_stopfile();
|
2014-04-16 08:36:27 +00:00
|
|
|
void server_watchdog(struct sched_ent *alarm);
|
2013-12-11 06:11:57 +00:00
|
|
|
void overlay_mdp_clean_socket_files();
|
2012-07-02 03:49:54 +00:00
|
|
|
void serverCleanUp();
|
|
|
|
|
2012-08-27 00:34:59 +00:00
|
|
|
int overlay_forward_payload(struct overlay_frame *f);
|
2012-07-03 06:06:51 +00:00
|
|
|
int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, size_t len,
|
2013-12-09 07:52:18 +00:00
|
|
|
struct socket_address *recvaddr);
|
2013-02-07 04:46:07 +00:00
|
|
|
int parseMdpPacketHeader(struct decode_context *context, struct overlay_frame *frame,
|
|
|
|
struct overlay_buffer *buffer, struct subscriber **nexthop);
|
|
|
|
int parseEnvelopeHeader(struct decode_context *context, struct overlay_interface *interface,
|
2013-12-09 07:15:47 +00:00
|
|
|
struct socket_address *addr, struct overlay_buffer *buffer);
|
2013-02-07 04:46:07 +00:00
|
|
|
int process_incoming_frame(time_ms_t now, struct overlay_interface *interface,
|
|
|
|
struct overlay_frame *f, struct decode_context *context);
|
2012-07-02 03:49:54 +00:00
|
|
|
|
2012-08-27 00:34:59 +00:00
|
|
|
int overlay_frame_process(struct overlay_interface *interface, struct overlay_frame *f);
|
2012-07-02 03:49:54 +00:00
|
|
|
|
2013-08-08 05:50:31 +00:00
|
|
|
int overlay_frame_append_payload(struct decode_context *context, int encapsulation,
|
2013-08-30 07:54:52 +00:00
|
|
|
struct overlay_frame *p, struct overlay_buffer *b,
|
|
|
|
char will_retransmit);
|
2013-05-24 04:22:31 +00:00
|
|
|
int overlay_packet_init_header(int packet_version, int encapsulation,
|
2013-02-14 03:48:56 +00:00
|
|
|
struct decode_context *context, struct overlay_buffer *buff,
|
2013-05-15 02:03:43 +00:00
|
|
|
char unicast, char interface, int seq);
|
2013-02-12 00:04:04 +00:00
|
|
|
void overlay_rhizome_advertise(struct sched_ent *alarm);
|
2013-09-24 02:31:00 +00:00
|
|
|
void rhizome_sync_status_html(struct strbuf *b, struct subscriber *subscriber);
|
2013-09-24 04:53:40 +00:00
|
|
|
int rhizome_cache_count();
|
2011-08-15 07:27:29 +00:00
|
|
|
|
2014-04-07 06:41:11 +00:00
|
|
|
int overlayServerMode(void);
|
2012-10-09 05:14:37 +00:00
|
|
|
int overlay_payload_enqueue(struct overlay_frame *p);
|
2013-01-28 02:35:24 +00:00
|
|
|
int overlay_queue_remaining(int queue);
|
2013-02-06 06:40:43 +00:00
|
|
|
int overlay_queue_schedule_next(time_ms_t next_allowed_packet);
|
2013-08-08 05:50:31 +00:00
|
|
|
int overlay_send_tick_packet(struct network_destination *destination);
|
|
|
|
int overlay_queue_ack(struct subscriber *neighbour, struct network_destination *destination, uint32_t ack_mask, int ack_seq);
|
2013-05-13 02:53:44 +00:00
|
|
|
|
2013-12-09 07:52:18 +00:00
|
|
|
int overlay_rhizome_saw_advertisements(struct decode_context *context, struct overlay_frame *f);
|
2012-05-22 03:35:29 +00:00
|
|
|
int rhizome_saw_voice_traffic();
|
2013-12-09 07:52:18 +00:00
|
|
|
int overlay_saw_mdp_containing_frame(struct overlay_frame *f);
|
2011-10-16 21:41:05 +00:00
|
|
|
|
2013-09-02 05:24:33 +00:00
|
|
|
int serval_packetvisualise(const char *message, const unsigned char *packet, size_t len);
|
|
|
|
int serval_packetvisualise_xpf(XPRINTF xpf, const char *message, const unsigned char *packet, size_t len);
|
2013-09-18 04:14:18 +00:00
|
|
|
void logServalPacket(int level, struct __sourceloc __whence, const char *message, const unsigned char *packet, size_t len);
|
|
|
|
#define DEBUG_packet_visualise(M,P,N) logServalPacket(LOG_LEVEL_DEBUG, __WHENCE__, (M), (P), (N))
|
2012-01-10 11:26:07 +00:00
|
|
|
|
2012-03-04 22:57:31 +00:00
|
|
|
int rhizome_opendb();
|
2012-01-10 11:26:07 +00:00
|
|
|
|
2013-07-03 07:21:27 +00:00
|
|
|
int parseCommandLine(struct cli_context *context, const char *argv0, int argc, const char *const *argv);
|
2012-02-23 02:09:31 +00:00
|
|
|
|
2013-10-09 08:24:21 +00:00
|
|
|
typedef uint32_t mdp_port_t;
|
2014-04-29 06:01:50 +00:00
|
|
|
#define PRImdp_port_t "#010" PRIx32
|
2013-10-09 08:24:21 +00:00
|
|
|
|
2012-03-19 05:36:34 +00:00
|
|
|
|
2012-03-28 00:58:04 +00:00
|
|
|
/* Server-side MDP functions */
|
2014-02-03 01:41:56 +00:00
|
|
|
void mdp_init_response(const struct internal_mdp_header *in, struct internal_mdp_header *out);
|
2013-11-25 06:13:32 +00:00
|
|
|
void overlay_mdp_encode_ports(struct overlay_buffer *plaintext, mdp_port_t dst_port, mdp_port_t src_port);
|
2014-01-31 00:08:52 +00:00
|
|
|
int overlay_mdp_dnalookup_reply(struct subscriber *dest, mdp_port_t dest_port,
|
2014-02-05 04:56:56 +00:00
|
|
|
struct subscriber *resolved_sid, const char *uri, const char *did, const char *name);
|
2014-01-29 05:09:12 +00:00
|
|
|
int overlay_send_frame(struct internal_mdp_header *header, struct overlay_buffer *payload);
|
2012-03-20 17:25:13 +00:00
|
|
|
|
2013-11-18 02:42:52 +00:00
|
|
|
int mdp_bind_internal(struct subscriber *subscriber, mdp_port_t port,
|
2014-01-23 06:01:56 +00:00
|
|
|
int (*internal)(struct internal_mdp_header *header, struct overlay_buffer *payload));
|
2013-11-18 02:42:52 +00:00
|
|
|
int mdp_unbind_internal(struct subscriber *subscriber, mdp_port_t port,
|
2014-01-23 06:01:56 +00:00
|
|
|
int (*internal)(struct internal_mdp_header *header, struct overlay_buffer *payload));
|
2013-11-18 02:42:52 +00:00
|
|
|
|
2014-05-05 05:04:34 +00:00
|
|
|
int allow_inbound_packet(const struct internal_mdp_header *header);
|
|
|
|
int allow_outbound_packet(const struct internal_mdp_header *header);
|
2014-02-07 05:25:40 +00:00
|
|
|
void load_mdp_packet_rules(const char *filename);
|
2013-11-18 02:42:52 +00:00
|
|
|
|
2012-08-06 05:16:46 +00:00
|
|
|
struct vomp_call_state;
|
2012-09-27 06:57:37 +00:00
|
|
|
|
|
|
|
void set_codec_flag(int codec, unsigned char *flags);
|
|
|
|
|
2013-12-10 06:39:19 +00:00
|
|
|
struct vomp_call_state *vomp_find_call_by_session(unsigned int session_token);
|
2014-01-31 04:32:35 +00:00
|
|
|
int vomp_mdp_received(struct internal_mdp_header *header, struct overlay_buffer *payload);
|
2012-05-03 18:14:41 +00:00
|
|
|
int vomp_parse_dtmf_digit(char c);
|
2012-12-07 05:32:58 +00:00
|
|
|
int vomp_dial(struct subscriber *local, struct subscriber *remote, const char *local_did, const char *remote_did);
|
2012-08-06 05:16:46 +00:00
|
|
|
int vomp_pickup(struct vomp_call_state *call);
|
|
|
|
int vomp_hangup(struct vomp_call_state *call);
|
|
|
|
int vomp_ringing(struct vomp_call_state *call);
|
2012-11-14 05:20:22 +00:00
|
|
|
int vomp_received_audio(struct vomp_call_state *call, int audio_codec, int time, int sequence,
|
|
|
|
const unsigned char *audio, int audio_length);
|
2012-09-27 06:57:37 +00:00
|
|
|
void monitor_get_all_supported_codecs(unsigned char *codecs);
|
2012-07-05 06:22:21 +00:00
|
|
|
|
2012-09-18 02:56:30 +00:00
|
|
|
int directory_registration();
|
|
|
|
int directory_service_init();
|
2012-04-20 06:11:13 +00:00
|
|
|
|
2013-07-03 07:21:27 +00:00
|
|
|
int app_nonce_test(const struct cli_parsed *parsed, struct cli_context *context);
|
|
|
|
int app_rhizome_direct_sync(const struct cli_parsed *parsed, struct cli_context *context);
|
|
|
|
int app_monitor_cli(const struct cli_parsed *parsed, struct cli_context *context);
|
|
|
|
int app_vomp_console(const struct cli_parsed *parsed, struct cli_context *context);
|
2013-07-22 08:25:02 +00:00
|
|
|
int app_meshms_conversations(const struct cli_parsed *parsed, struct cli_context *context);
|
|
|
|
int app_meshms_send_message(const struct cli_parsed *parsed, struct cli_context *context);
|
|
|
|
int app_meshms_list_messages(const struct cli_parsed *parsed, struct cli_context *context);
|
2013-07-26 05:06:11 +00:00
|
|
|
int app_meshms_mark_read(const struct cli_parsed *parsed, struct cli_context *context);
|
2013-11-28 06:23:12 +00:00
|
|
|
int app_msp_connection(const struct cli_parsed *parsed, struct cli_context *context);
|
2012-05-02 16:58:39 +00:00
|
|
|
|
|
|
|
int monitor_get_fds(struct pollfd *fds,int *fdcount,int fdmax);
|
|
|
|
|
|
|
|
int monitor_setup_sockets();
|
|
|
|
int monitor_get_fds(struct pollfd *fds,int *fdcount,int fdmax);
|
2013-10-09 08:24:21 +00:00
|
|
|
int monitor_announce_peer(const sid_t *sidp);
|
|
|
|
int monitor_announce_unreachable_peer(const sid_t *sidp);
|
2013-05-02 04:57:23 +00:00
|
|
|
int monitor_announce_link(int hop_count, struct subscriber *transmitter, struct subscriber *receiver);
|
2012-06-25 05:30:07 +00:00
|
|
|
int monitor_tell_clients(char *msg, int msglen, int mask);
|
2012-08-08 01:26:05 +00:00
|
|
|
int monitor_tell_formatted(int mask, char *fmt, ...);
|
2012-08-06 05:16:46 +00:00
|
|
|
int monitor_client_interested(int mask);
|
2012-05-09 18:16:27 +00:00
|
|
|
|
2012-05-10 04:37:11 +00:00
|
|
|
int scrapeProcNetRoute();
|
2012-05-28 05:24:33 +00:00
|
|
|
int lsif();
|
2012-06-08 07:01:59 +00:00
|
|
|
int doifaddrs();
|
2012-05-21 11:15:07 +00:00
|
|
|
|
2012-09-18 02:54:33 +00:00
|
|
|
int dna_helper_start();
|
2012-07-20 08:47:43 +00:00
|
|
|
int dna_helper_shutdown();
|
2014-01-31 00:08:52 +00:00
|
|
|
int dna_helper_enqueue(struct subscriber *source, mdp_port_t source_port, const char *did);
|
2012-07-23 08:59:57 +00:00
|
|
|
int parseDnaReply(const char *buf, size_t len, char *token, char *did, char *name, char *uri, const char **bufp);
|
2012-06-21 01:00:08 +00:00
|
|
|
extern int sigPipeFlag;
|
|
|
|
extern int sigIoFlag;
|
2013-12-20 01:23:13 +00:00
|
|
|
extern int sigIntFlag;
|
2012-06-21 01:00:08 +00:00
|
|
|
void sigPipeHandler(int signal);
|
|
|
|
void sigIoHandler(int signal);
|
2013-12-20 01:23:13 +00:00
|
|
|
void sigIntHandler(int signal);
|
2012-06-21 05:05:05 +00:00
|
|
|
|
2012-06-25 23:52:51 +00:00
|
|
|
int overlay_mdp_setup_sockets();
|
|
|
|
|
2013-12-09 07:15:47 +00:00
|
|
|
int overlay_packetradio_setup_port(struct overlay_interface *interface);
|
2012-12-14 05:57:04 +00:00
|
|
|
void server_config_reload(struct sched_ent *alarm);
|
2012-07-02 03:49:54 +00:00
|
|
|
void server_shutdown_check(struct sched_ent *alarm);
|
2014-01-23 06:01:56 +00:00
|
|
|
void overlay_mdp_bind_internal_services();
|
2013-08-08 05:50:31 +00:00
|
|
|
int overlay_send_probe(struct subscriber *peer, struct network_destination *destination, int queue);
|
2012-12-07 05:34:40 +00:00
|
|
|
int overlay_send_stun_request(struct subscriber *server, struct subscriber *request);
|
2012-07-02 03:49:54 +00:00
|
|
|
void fd_periodicstats(struct sched_ent *alarm);
|
|
|
|
void rhizome_check_connections(struct sched_ent *alarm);
|
|
|
|
|
2012-11-20 06:11:06 +00:00
|
|
|
int overlay_queue_init();
|
|
|
|
|
2012-07-02 03:49:54 +00:00
|
|
|
void monitor_client_poll(struct sched_ent *alarm);
|
|
|
|
void monitor_poll(struct sched_ent *alarm);
|
|
|
|
void rhizome_fetch_poll(struct sched_ent *alarm);
|
|
|
|
void rhizome_server_poll(struct sched_ent *alarm);
|
|
|
|
|
2014-01-29 06:23:19 +00:00
|
|
|
int overlay_mdp_service_stun_req(struct internal_mdp_header *header, struct overlay_buffer *payload);
|
|
|
|
int overlay_mdp_service_stun(struct internal_mdp_header *header, struct overlay_buffer *payload);
|
|
|
|
int overlay_mdp_service_probe(struct internal_mdp_header *header, struct overlay_buffer *payload);
|
2012-12-12 03:10:00 +00:00
|
|
|
|
2012-08-31 05:28:40 +00:00
|
|
|
int olsr_init_socket(void);
|
|
|
|
int olsr_send(struct overlay_frame *frame);
|
|
|
|
|
2013-07-23 04:51:46 +00:00
|
|
|
int pack_uint(unsigned char *buffer, uint64_t v);
|
|
|
|
int measure_packed_uint(uint64_t v);
|
|
|
|
int unpack_uint(unsigned char *buffer, int buff_size, uint64_t *v);
|
|
|
|
|
2013-11-04 03:45:08 +00:00
|
|
|
void rhizome_fetch_log_short_status();
|
2013-02-15 22:39:36 +00:00
|
|
|
extern char crash_handler_clue[1024];
|
2013-02-15 05:07:39 +00:00
|
|
|
|
2013-12-09 07:52:18 +00:00
|
|
|
int link_received_duplicate(struct subscriber *subscriber, int previous_seq);
|
2013-08-09 02:48:14 +00:00
|
|
|
int link_received_packet(struct decode_context *context, int sender_seq, char unicast);
|
2014-01-23 06:01:56 +00:00
|
|
|
int link_receive(struct internal_mdp_header *header, struct overlay_buffer *payload);
|
2013-04-26 07:23:04 +00:00
|
|
|
void link_explained(struct subscriber *subscriber);
|
2013-04-29 07:37:36 +00:00
|
|
|
void link_interface_down(struct overlay_interface *interface);
|
2013-05-08 04:12:11 +00:00
|
|
|
int link_state_announce_links();
|
2013-05-09 05:29:33 +00:00
|
|
|
int link_state_legacy_ack(struct overlay_frame *frame, time_ms_t now);
|
2013-05-15 02:03:43 +00:00
|
|
|
int link_state_ack_soon(struct subscriber *sender);
|
2013-05-29 01:44:26 +00:00
|
|
|
int link_state_should_forward_broadcast(struct subscriber *transmitter);
|
2013-12-09 07:15:47 +00:00
|
|
|
int link_unicast_ack(struct subscriber *subscriber, struct overlay_interface *interface, struct socket_address *addr);
|
2013-08-09 06:49:45 +00:00
|
|
|
int link_add_destinations(struct overlay_frame *frame);
|
2013-09-23 01:41:58 +00:00
|
|
|
void link_neighbour_short_status_html(struct strbuf *b, const char *link_prefix);
|
|
|
|
void link_neighbour_status_html(struct strbuf *b, struct subscriber *neighbour);
|
2013-10-14 03:58:48 +00:00
|
|
|
int link_stop_routing(struct subscriber *subscriber);
|
2013-04-26 07:23:04 +00:00
|
|
|
|
2013-05-07 05:11:59 +00:00
|
|
|
int generate_nonce(unsigned char *nonce,int bytes);
|
|
|
|
|
2013-12-04 06:44:14 +00:00
|
|
|
#endif // __SERVAL_DNA__SERVAL_H
|