Fix header files for Xcode iOS build

- make "debug.h" a private header so that the DEBUG() macro does not
  interfere with Xcode Debug builds, which set DEBUG=1
- move all #include "debug.h" from headers into .c files
- move 'struct idebug' into a new public header "idebug.h" so that
  "log.h" can be public
- move HTTPD port number defs from "httpd.h" to "constants.h", so that
  "httpd.h" can be private and "conf.h" can be public
- add missing nested includes so each header compiles stand-alone
  without error
- #include "sodium.h" instead of <sodium.h>
- #include "sqlite3.h" instead of <sqlite3.h>
- add header guard to "fifo.h"
- fix header guard in "sync_keys.h"
This commit is contained in:
Andrew Bettison 2017-11-24 10:33:39 +10:30
parent ca8e846264
commit c35af0617a
72 changed files with 210 additions and 62 deletions

4
conf.h
View File

@ -230,9 +230,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "constants.h"
#include "serval_types.h"
#include "rhizome_types.h"
#include "rhizome.h"
#include "strbuf.h"
#include "httpd.h"
#include "http_server.h"
#include "trigger.h"
#define CONFIG_FILE_MAX_SIZE (32 * 1024)

View File

@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "instance.h"
#include "mdp_client.h"
#include "server.h"
#include "debug.h"
DEFINE_FEATURE(cli_config);

View File

@ -226,6 +226,33 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* @author Andrew Bettison <andrew@servalproject.com>
*/
// If a macro is missing then this file has no effect but emits a warning, so
// that the iOS framework module can declare it as a public header, so that
// conf.h can be a public header.
#if defined(STRUCT) && \
defined(NODE) && \
defined(ATOM) && \
defined(STRING) && \
defined(SUB_STRUCT) && \
defined(NODE_STRUCT) && \
defined(END_STRUCT) && \
defined(STRUCT_ASSIGN) && \
defined(END_STRUCT_ASSIGN) && \
defined(STRUCT_DEFAULT) && \
defined(ATOM_DEFAULT) && \
defined(STRING_DEFAULT) && \
defined(SUB_STRUCT_DEFAULT) && \
defined(END_STRUCT_DEFAULT) && \
defined(ARRAY) && \
defined(KEY_ATOM) && \
defined(KEY_STRING) && \
defined(VALUE_ATOM) && \
defined(VALUE_STRING) && \
defined(VALUE_NODE) && \
defined(VALUE_SUB_STRUCT) && \
defined(VALUE_NODE_STRUCT) && \
defined(END_ARRAY)
STRUCT(debug)
ATOM(bool_t, verbose, 0, boolean,, "")
ATOM(bool_t, ack, 0, boolean,, "")
@ -513,3 +540,7 @@ SUB_STRUCT(olsr, olsr,)
SUB_STRUCT(host_list, hosts,)
SUB_STRUCT(api, api,)
END_STRUCT
#else
#warning "included stand-alone has no effect"
#endif

View File

@ -19,9 +19,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __SERVAL_DNA__CONSTANTS_H
#define __SERVAL_DNA__CONSTANTS_H
// UDP Port numbers for various Serval services.
// UDP port numbers for various Serval services
#define PORT_DNA 4110
// TCP port numbers for various Serval services
#define HTTPD_PORT_DEFAULT 4110
#define HTTPD_PORT_RANGE 100
#define OVERLAY_MAX_INTERFACES 16
#define CRYPT_CIPHERED 1

View File

@ -20,9 +20,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __SERVAL_DNA__CRYPTO_H
#define __SERVAL_DNA__CRYPTO_H
#include <sodium.h>
#include "serval_types.h"
#define SIGNATURE_BYTES crypto_sign_BYTES
struct subscriber;
int crypto_isvalid_keypair(const sign_private_t *private_key, const sign_public_t *public_key);
int crypto_verify_message(struct subscriber *subscriber, unsigned char *message, size_t *message_len);
int crypto_sign_to_sid(const sign_public_t *public_key, sid_t *sid);

View File

@ -16,9 +16,12 @@ 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.
*/
#ifndef __SERVAL_DNA___DATA_FORMATS_H
#define __SERVAL_DNA___DATA_FORMATS_H
#include <stdint.h>
int str_is_subscriber_id(const char *sid);
int strn_is_subscriber_id(const char *sid, size_t *lenp);
int str_is_identity(const char *sid);

16
debug.h
View File

@ -1,5 +1,6 @@
/*
Copyright (C) 2015 Serval Project Inc.
Copyright (C) 2017 Flinders University
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -19,8 +20,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __SERVAL_DNA__DEBUG_H
#define __SERVAL_DNA__DEBUG_H
#include "serval_types.h" // for bool_t
#include "log.h"
/* This header file must not be included by other header files (.h), only by
* source files (.c), because it defines macros (DEBUG being the primary
* offender) that can interfere with other projects that include Serval DNA
* header files, such as the iOS ServalDNA.framework.
*/
#include "log.h" // for _DEBUGF_TAG
#include "idebug.h" // for struct idebug
/* These DEBUG macros use the IF_DEBUG(FLAG) macro as the conditional.
*
@ -53,11 +60,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* string constant with the name of the flag.
*/
struct idebug {
bool_t *flagp;
const char *flagname;
};
#define INDIRECT_CONFIG_DEBUG(FLAG) ((struct idebug){.flagp=&(config.debug.FLAG), .flagname=#FLAG})
#define IF_IDEBUG(IND) ((IND).flagp && *(IND).flagp)

View File

@ -61,6 +61,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "dataformats.h"
#include "overlay_address.h"
#include "server.h"
#include "debug.h"
static void dna_helper_shutdown();

View File

@ -53,6 +53,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "str.h"
#include "strbuf.h"
#include "strbuf_helpers.h"
#include "debug.h"
#define MAX_WATCHED_FDS 128
__thread struct pollfd fds[MAX_WATCHED_FDS];

View File

@ -56,9 +56,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
#include "os.h"
#include "log.h"
#include "debug.h"
#include "os.h" // for time_ms_t
#include "whence.h"
struct profile_total {
struct profile_total *_next;

7
fifo.h
View File

@ -17,6 +17,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __SERVAL_DNA__FIFO_H
#define __SERVAL_DNA__FIFO_H
#include <stdint.h> // for uint8_t
struct fifo;
struct fifo *fifo_alloc(unsigned int size);
@ -27,3 +32,5 @@ unsigned int fifo_get(struct fifo *fifo, uint8_t *buffer, unsigned int len);
unsigned int fifo_unget(struct fifo *fifo, uint8_t *buffer, unsigned int len);
unsigned int fifo_avail(struct fifo *fifo);
unsigned int fifo_space(struct fifo *fifo);
#endif // __SERVAL_DNA__FIFO_H

View File

@ -1,9 +1,5 @@
SQLITE3_AMALGAMATION = sqlite-amalgamation-3140200
SQLITE3_HDRS = $(SQLITE3_AMALGAMATION)/sqlite3.h
# These library headers are designed for re-use, and do not depend on any
# SERVAL_HDRS.
# These public library headers are designed for re-use, and do not depend on
# any PUBLIC_HDRS or PRIVATE_HDRS.
LIB_HDRS= \
lang.h \
feature.h \
@ -32,15 +28,19 @@ LIB_HDRS= \
http_server.h \
nibble_tree.h
# These headers are specific to Serval DNA, and also depend on LIB_HDRS. They
# These headers are specific to Serval DNA, and may depend on LIB_HDRS. They
# are exposed by the iOS framework module, so they are accessible to Swift code
# in Xcode projects.
PUBLIC_HDRS= \
constants.h \
log.h \
conf.h \
conf_schema.h \
idebug.h \
instance.h \
serval_types.h \
rhizome_types.h \
dataformats.h \
instance.h \
sighandlers.h \
commandline.h \
crypto.h \
@ -53,7 +53,6 @@ PUBLIC_HDRS= \
overlay_buffer.h \
overlay_address.h \
overlay_packet.h \
overlay_interface.h \
rhizome.h \
meshms.h \
meshmb.h \
@ -65,17 +64,19 @@ PUBLIC_HDRS= \
monitor-client.h \
serval.h
# These headers are specific to Serval DNA, and also depend on LIB_HDRS. They are
# not exposed by the iOS framework module, so are inaccessible to Swift code in
# Xcode projects.
# The public amalgamated SQLite3 header is independent of Serval headers, and
# may only be included directly from source (.c) files.
SQLITE3_AMALGAMATION = sqlite-amalgamation-3140200
SQLITE3_HDRS = $(SQLITE3_AMALGAMATION)/sqlite3.h
# These headers are specific to Serval DNA, and may depend on LIB_HDRS. They
# may only be included directly from source (.c) files, or by other private
# headers. They are not exposed by the iOS framework module, so are
# inaccessible to Swift code in Xcode projects.
PRIVATE_HDRS= \
conf.h \
httpd.h \
msp_common.h \
# These headers cannot be included stand-alone, but some PRIVATE_HDRS depend on them.
SERVAL_META_HDRS = \
conf_schema.h
overlay_interface.h \
# All header files, useful for writing dependency rules with total coverage.
ALL_HDRS = $(LIB_HDRS) $(PUBLIC_HDRS) $(PRIVATE_HDRS) $(SQLITE3_HDRS) $(SERVAL_META_HDRS)
ALL_HDRS = $(LIB_HDRS) $(PUBLIC_HDRS) $(PRIVATE_HDRS) $(SQLITE3_HDRS)

View File

@ -20,14 +20,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __SERVAL_DNA__HTTP_SERVER_H
#define __SERVAL_DNA__HTTP_SERVER_H
#include <stdint.h> // for uint16_t, uint8_t
#include <limits.h>
#include "serval_types.h"
#include "debug.h"
#include "net.h"
#include "lang.h" // for bool_t
#include "os.h" // for time_ms_t
#include "idebug.h" // for struct idebug
#include "strbuf.h"
#include "strbuf_helpers.h"
#include "fdqueue.h"
#include "socket.h"
#include "strbuf_helpers.h" // for struct json_atom
#include "fdqueue.h" // for struct sched_ent
#include "socket.h" // for struct socket_address
/* Generic HTTP request handling.
*

View File

@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "conf.h"
#include "str.h"
#include "server.h"
#include "debug.h"
#define RHIZOME_SERVER_MAX_LIVE_REQUESTS 32

View File

@ -28,9 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
int is_httpd_server_running();
#define HTTPD_PORT_DEFAULT 4110
#define HTTPD_PORT_RANGE 100
extern uint16_t httpd_server_port;
extern unsigned int current_httpd_request_count;

34
idebug.h Normal file
View File

@ -0,0 +1,34 @@
/*
Copyright (C) 2017 Flinders University
Copyright (C) 2015 Serval Project Inc.
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.
*/
#ifndef __SERVAL_DNA__IDEBUG_H
#define __SERVAL_DNA__IDEBUG_H
#include "lang.h" // for bool_t
/* An "indirect debug flag" is a struct that contains a pointer to a flag and a
* string constant with the name of the flag.
*/
struct idebug {
bool_t *flagp;
const char *flagname;
};
#endif // __SERVAL_DNA__IDEBUG_H

View File

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "keyring.h"
#include "conf.h"
#include "instance.h"
#include "httpd.h"
static JNIEnv *server_env=NULL;
static jclass IJniServer= NULL;

View File

@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "rotbuf.h"
#include "route_link.h"
#include "commandline.h"
#include "debug.h"
static keyring_file *keyring_open_or_create(const char *path, int writeable);
static int keyring_initialise(keyring_file *k);

1
lang.h
View File

@ -29,7 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
typedef char bool_t;
/* Useful macros not specific to Serval DNA that assist with using the C
* language.
*/

View File

@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __SERVAL_DNA__LIMIT_H
#define __SERVAL_DNA__LIMIT_H
#include "os.h" // for uint32_t and time_ms_t
struct limit_state{
uint32_t rate_micro_seconds;
// length of time for a burst
@ -35,4 +37,4 @@ time_ms_t limit_next_allowed(struct limit_state *state);
int limit_is_allowed(struct limit_state *state);
int limit_init(struct limit_state *state, uint32_t rate_micro_seconds);
#endif
#endif

1
lsif.c
View File

@ -63,6 +63,7 @@
#include "conf.h"
#include "overlay_interface.h"
#include "debug.h"
/* On platforms that have variable length
ifreq use the old fixed length interface instead */

View File

@ -29,6 +29,7 @@
#include "str.h"
#include "numeric_str.h"
#include "server.h"
#include "debug.h"
//#define DEBUG_MDP_FILTER_PARSING 1

View File

@ -1,6 +1,11 @@
#ifndef __SERVAL_DNA__MESHMB_H
#define __SERVAL_DNA__MESHMB_H
#include <stdint.h> // for uint64_t
#include "lang.h" // for bool_t
#include "os.h" // for time_s_t
#include "message_ply.h"
struct meshmb_feeds;
enum meshmb_send_status{

View File

@ -9,6 +9,7 @@
#include "strbuf_helpers.h"
#include "keyring.h"
#include "meshmb.h"
#include "debug.h"
DEFINE_FEATURE(http_rest_meshmb);

View File

@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __SERVAL_DNA__MESHMS_H
#define __SERVAL_DNA__MESHMS_H
#include <stdint.h>
#ifndef __MESHMS_INLINE
# if __GNUC__ && !__GNUC_STDC_INLINE__
# define __MESHMS_INLINE extern inline

View File

@ -2,6 +2,7 @@
#include "serval_types.h"
#include "dataformats.h"
#include "cli.h"
#include "keyring.h"
#include "meshms.h"
#include "log.h"
#include "debug.h"

View File

@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "numeric_str.h"
#include "base64.h"
#include "strbuf_helpers.h"
#include "debug.h"
DEFINE_FEATURE(http_rest_meshms);

View File

@ -1,6 +1,7 @@
#include "serval.h"
#include "dataformats.h"
#include "keyring.h"
#include "rhizome.h"
#include "message_ply.h"
#include "log.h"

View File

@ -45,8 +45,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "debug.h"
#include "str.h"
#include "strbuf_helpers.h"
#include "net.h"
#include "socket.h"
#include "monitor-client.h"
#include "debug.h"
#define STATE_INIT 0
#define STATE_DATA 1

View File

@ -71,6 +71,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "dataformats.h"
#include "server.h"
#include "route_link.h"
#include "debug.h"
#ifdef HAVE_UCRED_H
#include <ucred.h>

View File

@ -1,6 +1,7 @@
#ifndef __SERVAL_DNA__MSP_COMMON_H
#define __SERVAL_DNA__MSP_COMMON_H
#include "debug.h"
#define FLAG_SHUTDOWN (1<<0)
#define FLAG_ACK (1<<1)
@ -345,4 +346,4 @@ static int msp_process_packet(struct msp_stream *stream, const uint8_t *payload,
return 0;
}
#endif
#endif

View File

@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "numeric_str.h"
#include "uri.h"
#include "overlay_buffer.h"
#include "debug.h"
DEFINE_FEATURE(cli_network);

View File

@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __SERVAL_DNA__NIBBLE_TREE_H
#define __SERVAL_DNA__NIBBLE_TREE_H
#include <stdint.h> // for uint8_t, size_t
struct tree_record{
// number of bits of the binary value, to uniquely identify this record within the tree's current contents
size_t tree_depth;

View File

@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <arpa/inet.h>
#include "serval.h"
#include "conf.h"
#include "keyring.h"
#include "crypto.h"
#include "str.h"
#include "overlay_address.h"
@ -39,6 +40,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "server.h"
#include "route_link.h"
#include "commandline.h"
#include "debug.h"
#define MAX_BPIS 1024
#define BPI_MASK 0x3ff

View File

@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mem.h"
#include "str.h"
#include "overlay_buffer.h"
#include "debug.h"
/*
When writing to a buffer, sizeLimit may place an upper bound on the amount of space to use

View File

@ -44,7 +44,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "radio_link.h"
#include "server.h"
#include "route_link.h"
#include "debug.h"
// The size of the receive buffer. This effectively sets the MRU for packet radio interfaces where

View File

@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __SERVAL_DNA__OVERLAY_INTERFACE_H
#define __SERVAL_DNA__OVERLAY_INTERFACE_H
#include "os.h" // for time_ms_t
#include "socket.h"
#include "limit.h"

View File

@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "strbuf_helpers.h"
#include "route_link.h"
#include "socket.h"
#include "debug.h"
int set_reachable(struct subscriber *subscriber,
struct network_destination *destination, struct subscriber *next_hop,

View File

@ -65,6 +65,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "socket.h"
#include "server.h"
#include "route_link.h"
#include "debug.h"
uint16_t mdp_loopback_port;

View File

@ -21,8 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "serval.h"
#include "conf.h"
#include "debug.h"
#include "keyring.h"
#include "overlay_buffer.h"
#include "debug.h"
DEFINE_BINDING(MDP_PORT_DNALOOKUP, overlay_mdp_service_dnalookup);
static int overlay_mdp_service_dnalookup(struct internal_mdp_header *header, struct overlay_buffer *payload)

View File

@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "overlay_buffer.h"
#include "rhizome.h"
#include "mdp_client.h"
#include "debug.h"
static int rhizome_mdp_send_block(struct subscriber *dest, const rhizome_bid_t *bid, uint64_t version, uint64_t fileOffset, uint32_t bitmap, uint16_t blockLength)
{

View File

@ -67,6 +67,7 @@
#include "overlay_buffer.h"
#include "overlay_address.h"
#include "route_link.h"
#include "debug.h"
#define PACKET_FORMAT_NUMBER 123

View File

@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "overlay_interface.h"
#include "overlay_packet.h"
#include "route_link.h"
#include "debug.h"
struct sockaddr_in loopback;

View File

@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "conf.h"
#include "overlay_interface.h"
#include "server.h"
#include "debug.h"
int overlay_packetradio_setup_port(overlay_interface *interface)
{

View File

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "overlay_interface.h"
#include "overlay_buffer.h"
#include "fdqueue.h"
#include "debug.h"
/* Collection of unicast echo responses to detect working links */
DEFINE_BINDING(MDP_PORT_PROBE, overlay_mdp_service_probe);

View File

@ -28,6 +28,7 @@
#include "strbuf.h"
#include "route_link.h"
#include "server.h"
#include "debug.h"
typedef struct overlay_txqueue {
struct overlay_frame *first;

View File

@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "route_link.h"
#include "overlay_interface.h"
#include "overlay_buffer.h"
#include "debug.h"
DEFINE_BINDING(MDP_PORT_STUN, overlay_mdp_service_stun);
static int overlay_mdp_service_stun(struct internal_mdp_header *header, struct overlay_buffer *payload)

View File

@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "route_link.h"
#include "overlay_interface.h"
#include "overlay_buffer.h"
#include "debug.h"
// append the address of a unicast link into a packet buffer
static void overlay_append_unicast_address(struct subscriber *subscriber, struct overlay_buffer *buff)

View File

@ -49,6 +49,7 @@
#include <inttypes.h> // for PRIu64 on Android
#include "fdqueue.h"
#include "conf.h"
#include "debug.h"
__thread struct profile_total *stats_head=NULL;
__thread struct call_stats *current_call=NULL;

View File

@ -50,6 +50,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "overlay_interface.h"
#include "golay.h"
#include "radio_link.h"
#include "debug.h"
#define MAVLINK_MSG_ID_RADIO 166
#define MAVLINK_MSG_ID_DATASTREAM 67

View File

@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __SERVAL_DNA__RHIZOME_H
#define __SERVAL_DNA__RHIZOME_H
#include <sqlite3.h>
#include "sqlite3.h"
#include "serval_types.h"
#include "rhizome_types.h"
#include "overlay_address.h"

View File

@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mem.h"
#include "keyring.h"
#include "dataformats.h"
#include "debug.h"
static const char *rhizome_manifest_get(const rhizome_manifest *m, const char *var)
{

View File

@ -24,6 +24,7 @@
#include "commandline.h"
#include "rhizome.h"
#include "instance.h"
#include "debug.h"
DEFINE_FEATURE(cli_rhizome);

View File

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "crypto.h"
#include "keyring.h"
#include "dataformats.h"
#include "debug.h"
int rhizome_manifest_createid(rhizome_manifest *m)
{

View File

@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "server.h"
#include "commandline.h"
#include "mdp_client.h"
#include "debug.h"
static int rhizome_delete_manifest_retry(sqlite_retry_state *retry, const rhizome_bid_t *bidp);

View File

@ -113,6 +113,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "rhizome.h"
#include "conf.h"
#include "str.h"
#include "debug.h"
rhizome_direct_sync_request *rd_sync_handles[RHIZOME_DIRECT_MAX_SYNC_HANDLES];
int rd_sync_handle_count=0;

View File

@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "strbuf.h"
#include "strbuf_helpers.h"
#include "socket.h"
#include "debug.h"
DEFINE_FEATURE(http_rhizome_direct);

View File

@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "overlay_buffer.h"
#include "socket.h"
#include "dataformats.h"
#include "debug.h"
/* Represents a queued fetch of a bundle payload, for which the manifest is already known.
*/

View File

@ -17,18 +17,21 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "serval.h"
#include "conf.h"
#include "rhizome.h"
#include <assert.h>
#include "overlay_buffer.h"
#include "overlay_address.h"
#include "overlay_packet.h"
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include "overlay_buffer.h"
#include "overlay_address.h"
#include "overlay_packet.h"
#include "serval.h"
#include "conf.h"
#include "rhizome.h"
#include "httpd.h"
#include "debug.h"
/* Android doesn't have log2(), and we don't really need to do floating point
math to work out how big a file is.
*/

View File

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "base64.h"
#include "strbuf_helpers.h"
#include "numeric_str.h"
#include "debug.h"
DEFINE_FEATURE(http_rest_rhizome);

View File

@ -36,6 +36,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "conf.h"
#include "str.h"
#include "numeric_str.h"
#include "debug.h"
#define RHIZOME_BUFFER_MAXIMUM_SIZE (1024*1024)

View File

@ -23,8 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <sys/types.h>
#include <stdint.h>
#include <limits.h>
#include <sodium.h>
#include "str.h" // for alloca_tohex(), is_all_matching(), etc.
#include "serval_types.h" // for "sodium.h", sign_binary
#include "str.h" // for alloca_tohex(), is_all_matching(), etc.
#define RHIZOME_BUNDLE_ID_BYTES crypto_sign_PUBLICKEYBYTES
#define RHIZOME_BUNDLE_ID_STRLEN (RHIZOME_BUNDLE_ID_BYTES * 2)

View File

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "server.h"
#include "mdp_client.h"
#include "route_link.h"
#include "debug.h"
/*
Link state routing;

View File

@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __SERVAL_DNA__ROUTE_LINK_H
#define __SERVAL_DNA__ROUTE_LINK_H
#include <stdint.h> // for uint8_t
struct strbuf;
struct overlay_interface;
struct network_destination;

View File

@ -21,9 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define __SERVAL_DNA__SERVAL_TYPES_H
#include <sys/types.h>
#include <inttypes.h> // for PRIx32
#include <stdint.h>
#include <inttypes.h>
#include <sodium.h>
#include "sodium.h"
// all of the response codes we might want to return
// with well defined semantics

View File

@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "serval_uuid.h"
#include "os.h"
#include "str.h"
#include <sodium.h>
#include "sodium.h" // for randombytes_buf()
#include <assert.h>
#ifdef HAVE_ARPA_INET_H

View File

@ -52,6 +52,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "commandline.h"
#include "mdp_client.h"
#include "route_link.h"
#include "httpd.h"
#include "debug.h"
DEFINE_FEATURE(cli_server);

View File

@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "strbuf_helpers.h"
#include "net.h"
#include "limit.h"
#include "debug.h"
#define MTU 1600
struct peer;

2
str.c
View File

@ -21,7 +21,7 @@
#define __SERVAL_DNA__STR_INLINE
#include "str.h"
#include "strbuf_helpers.h"
#include <sodium.h>
#include "sodium.h"
#include <stdio.h> // for NULL
#include <string.h> // for strlen(), strncmp() etc.

View File

@ -1,6 +1,7 @@
#ifndef __SYNC_H
#define __SYNC_H
#ifndef __SERVAL_DNA__SYNC_H
#define __SERVAL_DNA__SYNC_H
#include <stdint.h> // for uint8_t
#include "str.h" // for alloca_tohex()
/*
@ -44,4 +45,4 @@ int sync_recv_message(struct sync_state *state, void *peer_context, const uint8_
void sync_enum_differences(struct sync_state *state,
void (*callback)(void *context, void *peer_context, const sync_key_t *key, uint8_t theirs));
#endif
#endif // __SERVAL_DNA__SYNC_H

View File

@ -33,6 +33,7 @@
#include "commandline.h"
#include "mem.h"
#include "str.h"
#include "debug.h"
DEFINE_FEATURE(cli_tests);

1
vomp.c
View File

@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "overlay_buffer.h"
#include "overlay_packet.h"
#include "server.h"
#include "debug.h"
/*
Typical call state lifecycle between 2 parties.