mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-03-22 03:45:22 +00:00
Fix -Wunused-parameter warnings
New UNUSED(param) macro suppresses the warning for a specific parameter In some cases, removed the unused parameters. In others, used the parameter in a DEBUGF() or assert() statement to document the intent.
This commit is contained in:
parent
68555ce241
commit
30b2059608
@ -79,13 +79,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
extern struct cli_schema command_line_options[];
|
||||
|
||||
int commandline_usage(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int commandline_usage(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
printf("Serval DNA version %s\nUsage:\n", version_servald);
|
||||
return cli_usage_parsed(parsed, XPRINTF_STDIO(stdout));
|
||||
}
|
||||
|
||||
int version_message(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int version_message(const struct cli_parsed *UNUSED(parsed), struct cli_context *UNUSED(context))
|
||||
{
|
||||
printf("Serval DNA version %s\n%s\n", version_servald, copyright_servald);
|
||||
printf("\
|
||||
@ -165,7 +165,7 @@ int Throw(JNIEnv *env, const char *class, const char *msg)
|
||||
/* JNI entry point to command line. See org.servalproject.servald.ServalD class for the Java side.
|
||||
JNI method descriptor: "(Ljava/util/List;[Ljava/lang/String;)I"
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_servalproject_servald_ServalD_rawCommand(JNIEnv *env, jobject this, jobject outv, jobjectArray args)
|
||||
JNIEXPORT jint JNICALL Java_org_servalproject_servald_ServalD_rawCommand(JNIEnv *env, jobject UNUSED(this), jobject outv, jobjectArray args)
|
||||
{
|
||||
struct cli_context context;
|
||||
bzero(&context, sizeof(context));
|
||||
@ -535,7 +535,7 @@ int app_echo(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_log(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_log(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_cli_parsed(parsed);
|
||||
@ -1233,7 +1233,7 @@ int app_config_dump(const struct cli_parsed *parsed, struct cli_context *context
|
||||
return ret == CFOK ? 0 : 1;
|
||||
}
|
||||
|
||||
int app_config_set(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_config_set(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_cli_parsed(parsed);
|
||||
@ -1626,7 +1626,7 @@ cleanup:
|
||||
return status;
|
||||
}
|
||||
|
||||
int app_rhizome_append_manifest(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_rhizome_append_manifest(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_cli_parsed(parsed);
|
||||
@ -1650,7 +1650,7 @@ int app_rhizome_append_manifest(const struct cli_parsed *parsed, struct cli_cont
|
||||
return ret;
|
||||
}
|
||||
|
||||
int app_rhizome_delete(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_rhizome_delete(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_cli_parsed(parsed);
|
||||
@ -1980,7 +1980,7 @@ int app_rhizome_list(const struct cli_parsed *parsed, struct cli_context *contex
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_keyring_create(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_keyring_create(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_cli_parsed(parsed);
|
||||
@ -1991,7 +1991,7 @@ int app_keyring_create(const struct cli_parsed *parsed, struct cli_context *cont
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_keyring_dump(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_keyring_dump(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_cli_parsed(parsed);
|
||||
@ -2018,7 +2018,7 @@ int app_keyring_dump(const struct cli_parsed *parsed, struct cli_context *contex
|
||||
return ret;
|
||||
}
|
||||
|
||||
int app_keyring_load(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_keyring_load(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_cli_parsed(parsed);
|
||||
@ -2255,7 +2255,7 @@ ssize_t mdp_poll_recv(int mdp_sock, time_ms_t timeout, struct mdp_header *rev_he
|
||||
return len;
|
||||
}
|
||||
|
||||
static int handle_pins(const struct cli_parsed *parsed, struct cli_context *context, int revoke)
|
||||
static int handle_pins(const struct cli_parsed *parsed, struct cli_context *UNUSED(context), int revoke)
|
||||
{
|
||||
const char *pin, *sid_hex;
|
||||
if (cli_arg(parsed, "entry-pin", &pin, NULL, "") == -1 ||
|
||||
@ -2473,7 +2473,7 @@ int app_count_peers(const struct cli_parsed *parsed, struct cli_context *context
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_byteorder_test(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_byteorder_test(const struct cli_parsed *UNUSED(parsed), struct cli_context *UNUSED(context))
|
||||
{
|
||||
uint64_t in=0x1234;
|
||||
uint64_t out;
|
||||
@ -2820,7 +2820,7 @@ int app_reverse_lookup(const struct cli_parsed *parsed, struct cli_context *cont
|
||||
}
|
||||
|
||||
void context_switch_test(int);
|
||||
int app_mem_test(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_mem_test(const struct cli_parsed *UNUSED(parsed), struct cli_context *UNUSED(context))
|
||||
{
|
||||
size_t mem_size;
|
||||
size_t addr;
|
||||
|
@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "constants.h"
|
||||
#include "log.h"
|
||||
#include "conf.h"
|
||||
|
||||
@ -515,7 +516,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
int cf_fmt_config_##__name(struct cf_om_node **parentp, const struct config_##__name *strct) { \
|
||||
return cf_xfmt_config_##__name(parentp, strct, NULL); \
|
||||
} \
|
||||
int cf_xfmt_config_##__name(struct cf_om_node **parentp, const struct config_##__name *strct, const struct config_##__name *dflt) { \
|
||||
int cf_xfmt_config_##__name(struct cf_om_node **parentp, const struct config_##__name *strct, const struct config_##__name *UNUSED(dflt)) { \
|
||||
int result = CFOK; \
|
||||
int ret;
|
||||
#define __FMT_TEXT(__repr, __eltname, __eltexpr, __defaultvar) \
|
||||
@ -619,7 +620,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#define SUB_STRUCT_DEFAULT(__name, __element, __dfllabel...)
|
||||
#define END_STRUCT_DEFAULT
|
||||
#define ARRAY(__name, __flags, __validator...) \
|
||||
int cf_xfmt_config_##__name(struct cf_om_node **parentp, const struct config_##__name *array, const struct config_##__name *dflt) { \
|
||||
int cf_xfmt_config_##__name(struct cf_om_node **parentp, const struct config_##__name *array, const struct config_##__name *UNUSED(dflt)) { \
|
||||
return cf_fmt_config_##__name(parentp, array); \
|
||||
} \
|
||||
int cf_fmt_config_##__name(struct cf_om_node **parentp, const struct config_##__name *array) { \
|
||||
|
13
constants.h
13
constants.h
@ -19,7 +19,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#ifndef __SERVAL_DNA__CONSTANTS_H
|
||||
#define __SERVAL_DNA__CONSTANTS_H
|
||||
|
||||
#define NELS(a) (sizeof (a) / sizeof *(a))
|
||||
/* Useful macros not specific to Serval DNA
|
||||
*/
|
||||
|
||||
// Number of elements in an array (Warning: does not work if A is a pointer!).
|
||||
#define NELS(A) (sizeof (A) / sizeof *(A))
|
||||
|
||||
// To suppress the "unused parameter" warning from -Wunused-parameter.
|
||||
#ifdef __GNUC__
|
||||
# define UNUSED(x) x __attribute__((__unused__))
|
||||
#else
|
||||
# define UNUSED(x) x
|
||||
#endif
|
||||
|
||||
/* Packet format:
|
||||
|
||||
|
@ -46,6 +46,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
@ -354,6 +355,7 @@ static void monitor_requests(struct sched_ent *alarm)
|
||||
strbuf_str(strbuf_append_poll_events(strbuf_alloca(40), sched_requests.poll.revents))
|
||||
);
|
||||
}
|
||||
assert(alarm == &sched_requests);
|
||||
// On Linux, poll(2) returns ERR when the remote reader dies. On Mac OS X, poll(2) returns NVAL,
|
||||
// which is documented to mean the file descriptor is not open, but testing revealed that in this
|
||||
// case it is still open. See issue #5.
|
||||
@ -480,6 +482,7 @@ static void monitor_replies(struct sched_ent *alarm)
|
||||
strbuf_str(strbuf_append_poll_events(strbuf_alloca(40), sched_replies.poll.revents))
|
||||
);
|
||||
}
|
||||
assert(alarm == &sched_replies);
|
||||
if (sched_replies.poll.revents & POLLIN) {
|
||||
size_t remaining = reply_buffer + sizeof reply_buffer - reply_bufend;
|
||||
ssize_t nread = read_nonblock(sched_replies.poll.fd, reply_bufend, remaining);
|
||||
@ -532,6 +535,7 @@ static void monitor_errors(struct sched_ent *alarm)
|
||||
strbuf_str(strbuf_append_poll_events(strbuf_alloca(40), sched_errors.poll.revents))
|
||||
);
|
||||
}
|
||||
assert(alarm == &sched_errors);
|
||||
if (sched_errors.poll.revents & POLLIN) {
|
||||
char buffer[1024];
|
||||
ssize_t nread = read_nonblock(sched_errors.poll.fd, buffer, sizeof buffer);
|
||||
@ -550,6 +554,7 @@ static void monitor_errors(struct sched_ent *alarm)
|
||||
|
||||
static void harvester(struct sched_ent *alarm)
|
||||
{
|
||||
assert(alarm == &sched_harvester);
|
||||
// While the helper process appears to still be running, keep calling this function.
|
||||
// Otherwise, wait a while before re-starting the helper.
|
||||
if (dna_helper_harvest(0) <= 0) {
|
||||
@ -570,6 +575,7 @@ static void harvester(struct sched_ent *alarm)
|
||||
|
||||
static void restart_delayer(struct sched_ent *alarm)
|
||||
{
|
||||
assert(alarm == &sched_restart);
|
||||
if (dna_helper_pid == 0) {
|
||||
if (config.debug.dnahelper)
|
||||
DEBUG("DNAHELPER re-enable restart");
|
||||
@ -579,6 +585,7 @@ static void restart_delayer(struct sched_ent *alarm)
|
||||
|
||||
static void reply_timeout(struct sched_ent *alarm)
|
||||
{
|
||||
assert(alarm == &sched_timeout);
|
||||
if (awaiting_reply) {
|
||||
WHY("DNAHELPER reply timeout");
|
||||
dna_helper_kill();
|
||||
|
@ -632,6 +632,7 @@ static int load_unknown(keypair *kp, const char *text)
|
||||
|
||||
static int unpack_private_public(keypair *kp, struct rotbuf *rb, int key_length)
|
||||
{
|
||||
assert(key_length == kp->private_key_len + kp->public_key_len);
|
||||
rotbuf_getbuf(rb, kp->private_key, kp->private_key_len);
|
||||
rotbuf_getbuf(rb, kp->public_key, kp->public_key_len);
|
||||
return 0;
|
||||
@ -661,6 +662,7 @@ static int unpack_public_only(keypair *kp, struct rotbuf *rb, int key_length)
|
||||
|
||||
static int unpack_cryptobox(keypair *kp, struct rotbuf *rb, int key_length)
|
||||
{
|
||||
assert(key_length == kp->private_key_len);
|
||||
rotbuf_getbuf(rb, kp->private_key, kp->private_key_len);
|
||||
if (!rb->wrap)
|
||||
_derive_scalarmult_public(kp->public_key, kp->private_key);
|
||||
@ -683,7 +685,7 @@ static int unpack_did_name(keypair *kp, struct rotbuf *rb, int key_length)
|
||||
return strnchr((const char *)kp->public_key, kp->public_key_len, '\0') == NULL ? -1 : 0;
|
||||
}
|
||||
|
||||
static void dump_did_name(const keypair *kp, XPRINTF xpf, int include_secret)
|
||||
static void dump_did_name(const keypair *kp, XPRINTF xpf, int UNUSED(include_secret))
|
||||
{
|
||||
xprintf(xpf, " DID=%s", alloca_str_toprint_quoted((const char *)kp->private_key, "\"\""));
|
||||
xprintf(xpf, " Name=%s", alloca_str_toprint_quoted((const char *)kp->public_key, "\"\""));
|
||||
|
2
log.c
2
log.c
@ -271,7 +271,7 @@ static void _log_prefix_whence(_log_iterator *it, struct __sourceloc whence)
|
||||
}
|
||||
}
|
||||
|
||||
static void _log_end_line(_log_iterator *it, int level)
|
||||
static void _log_end_line(_log_iterator *it, int UNUSED(level))
|
||||
{
|
||||
#ifdef ANDROID
|
||||
if (it->config == &config.log.android) {
|
||||
|
4
meshms.c
4
meshms.c
@ -742,7 +742,7 @@ int app_meshms_conversations(const struct cli_parsed *parsed, struct cli_context
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_meshms_send_message(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_meshms_send_message(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
const char *my_sidhex, *their_sidhex, *message;
|
||||
if (cli_arg(parsed, "sender_sid", &my_sidhex, str_is_subscriber_id, "") == -1
|
||||
@ -977,7 +977,7 @@ static int mark_read(struct conversations *conv, const sid_t *their_sid, const c
|
||||
return ret;
|
||||
}
|
||||
|
||||
int app_meshms_mark_read(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_meshms_mark_read(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
const char *my_sidhex, *their_sidhex, *offset_str;
|
||||
if (cli_arg(parsed, "sender_sid", &my_sidhex, str_is_subscriber_id, "") == -1
|
||||
|
@ -31,7 +31,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "cli.h"
|
||||
#include "monitor-client.h"
|
||||
|
||||
int remote_print(char *cmd, int argc, char **argv, unsigned char *data, int dataLen, void *context){
|
||||
int remote_print(char *cmd, int argc, char **argv, unsigned char *data, int dataLen, void *UNUSED(context))
|
||||
{
|
||||
int i;
|
||||
printf("%s",cmd);
|
||||
for (i=0;i<argc;i++){
|
||||
@ -48,7 +49,7 @@ struct monitor_command_handler monitor_handlers[]={
|
||||
{.command="", .handler=remote_print},
|
||||
};
|
||||
|
||||
int app_monitor_cli(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_monitor_cli(const struct cli_parsed *UNUSED(parsed), struct cli_context *UNUSED(context))
|
||||
{
|
||||
struct pollfd fds[2];
|
||||
struct monitor_state *state;
|
||||
|
10
monitor.c
10
monitor.c
@ -391,7 +391,7 @@ void monitor_get_all_supported_codecs(unsigned char *codecs){
|
||||
}
|
||||
}
|
||||
|
||||
static int monitor_announce_all_peers(struct subscriber *subscriber, void *context)
|
||||
static int monitor_announce_all_peers(struct subscriber *subscriber, void *UNUSED(context))
|
||||
{
|
||||
if (subscriber->reachable&REACHABLE)
|
||||
monitor_announce_peer(&subscriber->sid);
|
||||
@ -491,7 +491,7 @@ static int monitor_call(const struct cli_parsed *parsed, struct cli_context *con
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int monitor_call_ring(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
static int monitor_call_ring(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
struct vomp_call_state *call=vomp_find_call_by_session(strtol(parsed->args[1],NULL,16));
|
||||
if (!call)
|
||||
@ -501,7 +501,7 @@ static int monitor_call_ring(const struct cli_parsed *parsed, struct cli_context
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int monitor_call_pickup(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
static int monitor_call_pickup(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
struct vomp_call_state *call=vomp_find_call_by_session(strtol(parsed->args[1],NULL,16));
|
||||
if (!call)
|
||||
@ -529,7 +529,7 @@ static int monitor_call_audio(const struct cli_parsed *parsed, struct cli_contex
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int monitor_call_hangup(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
static int monitor_call_hangup(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
struct vomp_call_state *call=vomp_find_call_by_session(strtol(parsed->args[1],NULL,16));
|
||||
if (!call)
|
||||
@ -592,7 +592,7 @@ int monitor_process_command(struct monitor_context *c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int monitor_help(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
static int monitor_help(const struct cli_parsed *UNUSED(parsed), struct cli_context *context)
|
||||
{
|
||||
struct monitor_context *c=context->context;
|
||||
strbuf b = strbuf_alloca(16384);
|
||||
|
2
nonce.c
2
nonce.c
@ -49,7 +49,7 @@ int generate_nonce(unsigned char *nonce,int bytes)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_nonce_test(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_nonce_test(const struct cli_parsed *UNUSED(parsed), struct cli_context *context)
|
||||
{
|
||||
int i,j;
|
||||
unsigned char nonces[0x10001][32];
|
||||
|
@ -282,7 +282,7 @@ overlay_interface_read_any(struct sched_ent *alarm)
|
||||
DEBUGF("Could not find matching interface for packet received from %s", inet_ntoa(recvaddr.inet.sin_addr));
|
||||
return;
|
||||
}
|
||||
packetOkOverlay(interface, packet, plen, recvttl, &recvaddr);
|
||||
packetOkOverlay(interface, packet, plen, &recvaddr);
|
||||
}
|
||||
if (alarm->poll.revents & (POLLHUP | POLLERR)) {
|
||||
INFO("Closing broadcast socket due to error");
|
||||
@ -587,13 +587,13 @@ static void interface_read_dgram(struct overlay_interface *interface)
|
||||
plen = recvwithttl(interface->alarm.poll.fd,packet, sizeof(packet), &recvttl, &recvaddr);
|
||||
if (plen == -1) {
|
||||
WHYF_perror("recvwithttl(%d,%p,%zu,&%d,%p(%s))",
|
||||
interface->alarm.poll.fd, packet, sizeof packet, recvttl,
|
||||
interface->alarm.poll.fd, packet, sizeof packet,
|
||||
&recvaddr, alloca_socket_address(&recvaddr)
|
||||
);
|
||||
overlay_interface_close(interface);
|
||||
return;
|
||||
}
|
||||
packetOkOverlay(interface, packet, plen, recvttl, &recvaddr);
|
||||
packetOkOverlay(interface, packet, plen, &recvaddr);
|
||||
}
|
||||
|
||||
struct file_packet{
|
||||
@ -687,7 +687,7 @@ static void interface_read_file(struct overlay_interface *interface)
|
||||
struct socket_address srcaddr;
|
||||
srcaddr.addrlen = sizeof packet.src_addr;
|
||||
srcaddr.inet = packet.src_addr;
|
||||
packetOkOverlay(interface, packet.payload, packet.payload_length, -1, &srcaddr);
|
||||
packetOkOverlay(interface, packet.payload, packet.payload_length, &srcaddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ static struct sched_ent mdp_sock2 = {
|
||||
.poll={.fd = -1},
|
||||
};
|
||||
|
||||
static int overlay_saw_mdp_frame(struct overlay_frame *frame, overlay_mdp_frame *mdp, time_ms_t now);
|
||||
static int overlay_saw_mdp_frame(struct overlay_frame *frame, overlay_mdp_frame *mdp);
|
||||
static int mdp_send2(struct socket_address *client, struct mdp_header *header,
|
||||
const uint8_t *payload, size_t payload_len);
|
||||
|
||||
@ -235,7 +235,7 @@ static int overlay_mdp_releasebindings(struct socket_address *client)
|
||||
|
||||
}
|
||||
|
||||
static int overlay_mdp_process_bind_request(int sock, struct subscriber *subscriber, mdp_port_t port,
|
||||
static int overlay_mdp_process_bind_request(struct subscriber *subscriber, mdp_port_t port,
|
||||
int flags, struct socket_address *client)
|
||||
{
|
||||
if (config.debug.mdprequests)
|
||||
@ -446,7 +446,7 @@ int overlay_mdp_decrypt(struct overlay_frame *f, overlay_mdp_frame *mdp)
|
||||
OUT();
|
||||
}
|
||||
|
||||
int overlay_saw_mdp_containing_frame(struct overlay_frame *f, time_ms_t now)
|
||||
int overlay_saw_mdp_containing_frame(struct overlay_frame *f)
|
||||
{
|
||||
IN();
|
||||
/* Take frame source and destination and use them to populate mdp->in->{src,dst}
|
||||
@ -469,7 +469,7 @@ int overlay_saw_mdp_containing_frame(struct overlay_frame *f, time_ms_t now)
|
||||
RETURN(-1);
|
||||
|
||||
/* and do something with it! */
|
||||
RETURN(overlay_saw_mdp_frame(f, &mdp,now));
|
||||
RETURN(overlay_saw_mdp_frame(f, &mdp));
|
||||
OUT();
|
||||
}
|
||||
|
||||
@ -482,7 +482,7 @@ int overlay_mdp_swap_src_dst(overlay_mdp_frame *mdp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int overlay_saw_mdp_frame(struct overlay_frame *frame, overlay_mdp_frame *mdp, time_ms_t now)
|
||||
static int overlay_saw_mdp_frame(struct overlay_frame *frame, overlay_mdp_frame *mdp)
|
||||
{
|
||||
IN();
|
||||
int i;
|
||||
@ -916,7 +916,7 @@ int overlay_mdp_dispatch(overlay_mdp_frame *mdp, struct socket_address *client)
|
||||
DEBUGF("[%u] destination->sid=%s", __d, destination ? alloca_tohex_sid_t(destination->sid) : "NULL");
|
||||
if (!destination || destination->reachable == REACHABLE_SELF){
|
||||
/* Packet is addressed to us / broadcast, we should process it first. */
|
||||
overlay_saw_mdp_frame(NULL,mdp,gettime_ms());
|
||||
overlay_saw_mdp_frame(NULL,mdp);
|
||||
if (destination) {
|
||||
/* Is local, and is not broadcast, so shouldn't get sent out on the wire. */
|
||||
if (config.debug.mdprequests)
|
||||
@ -1404,7 +1404,7 @@ static void mdp_process_packet(struct socket_address *client, struct mdp_header
|
||||
|
||||
if (config.debug.mdprequests)
|
||||
DEBUGF("Attempting to process mdp packet locally");
|
||||
overlay_saw_mdp_frame(NULL, &mdp, gettime_ms());
|
||||
overlay_saw_mdp_frame(NULL, &mdp);
|
||||
}
|
||||
|
||||
if (config.debug.mdprequests)
|
||||
@ -1597,7 +1597,7 @@ static void overlay_mdp_poll(struct sched_ent *alarm)
|
||||
}
|
||||
|
||||
}
|
||||
if (overlay_mdp_process_bind_request(alarm->poll.fd, subscriber, mdp->bind.port,
|
||||
if (overlay_mdp_process_bind_request(subscriber, mdp->bind.port,
|
||||
mdp->packetTypeAndFlags, &client))
|
||||
overlay_mdp_reply_error(alarm->poll.fd, &client, 3, "Port already in use");
|
||||
else
|
||||
|
@ -154,7 +154,7 @@ int overlay_mdp_service_rhizomeresponse(overlay_mdp_frame *mdp)
|
||||
a slot to capture this files as it is being requested
|
||||
by someone else.
|
||||
*/
|
||||
rhizome_received_content(bidprefix,version,offset, count, bytes, type);
|
||||
rhizome_received_content(bidprefix,version,offset, count, bytes);
|
||||
|
||||
RETURN(0);
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ static void parse_frame(struct overlay_buffer *buff){
|
||||
// the remaining bytes are an mdp payload, process it
|
||||
frame.payload = buff;
|
||||
|
||||
overlay_saw_mdp_containing_frame(&frame, gettime_ms());
|
||||
overlay_saw_mdp_containing_frame(&frame);
|
||||
|
||||
// TODO relay this packet to other non-olsr networks.
|
||||
|
||||
|
@ -88,11 +88,11 @@ int process_incoming_frame(time_ms_t now, struct overlay_interface *interface, s
|
||||
break;
|
||||
// data frames
|
||||
case OF_TYPE_RHIZOME_ADVERT:
|
||||
overlay_rhizome_saw_advertisements(id,context,f,now);
|
||||
overlay_rhizome_saw_advertisements(context,f);
|
||||
break;
|
||||
case OF_TYPE_DATA:
|
||||
case OF_TYPE_DATA_VOICE:
|
||||
overlay_saw_mdp_containing_frame(f,now);
|
||||
overlay_saw_mdp_containing_frame(f);
|
||||
break;
|
||||
case OF_TYPE_PLEASEEXPLAIN:
|
||||
process_explain(f);
|
||||
@ -238,7 +238,7 @@ int parseMdpPacketHeader(struct decode_context *context, struct overlay_frame *f
|
||||
RETURN(WHY("Unable to read packet seq"));
|
||||
// TODO unicast
|
||||
if ((flags & PAYLOAD_FLAG_ONE_HOP) || !(flags & PAYLOAD_FLAG_TO_BROADCAST)){
|
||||
if (link_received_duplicate(context->sender, context->interface, context->sender_interface, seq, 0)){
|
||||
if (link_received_duplicate(context->sender, seq)){
|
||||
if (config.debug.verbose && config.debug.overlayframes)
|
||||
DEBUG("Don't process or forward duplicate payloads");
|
||||
forward=process=0;
|
||||
@ -321,7 +321,7 @@ int parseEnvelopeHeader(struct decode_context *context, struct overlay_interface
|
||||
}
|
||||
|
||||
int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, size_t len,
|
||||
int recvttl, struct socket_address *recvaddr)
|
||||
struct socket_address *recvaddr)
|
||||
{
|
||||
IN();
|
||||
/*
|
||||
|
@ -56,7 +56,7 @@ struct sched_ent next_packet;
|
||||
struct profile_total send_packet;
|
||||
|
||||
static void overlay_send_packet(struct sched_ent *alarm);
|
||||
static int overlay_calc_queue_time(overlay_txqueue *queue, struct overlay_frame *frame);
|
||||
static int overlay_calc_queue_time(struct overlay_frame *frame);
|
||||
|
||||
int overlay_queue_init(){
|
||||
/* Set default congestion levels for queues */
|
||||
@ -219,7 +219,7 @@ int overlay_payload_enqueue(struct overlay_frame *p)
|
||||
if (p->queue==OQ_ISOCHRONOUS_VOICE)
|
||||
rhizome_saw_voice_traffic();
|
||||
|
||||
overlay_calc_queue_time(queue, p);
|
||||
overlay_calc_queue_time(p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -283,7 +283,8 @@ static void remove_destination(struct overlay_frame *frame, int i){
|
||||
|
||||
// update the alarm time and return 1 if changed
|
||||
static int
|
||||
overlay_calc_queue_time(overlay_txqueue *queue, struct overlay_frame *frame){
|
||||
overlay_calc_queue_time(struct overlay_frame *frame)
|
||||
{
|
||||
|
||||
time_ms_t next_allowed_packet=0;
|
||||
// check all interfaces
|
||||
@ -492,7 +493,7 @@ overlay_stuff_packet(struct outgoing_packet *packet, overlay_txqueue *queue, tim
|
||||
|
||||
skip:
|
||||
// if we can't send the payload now, check when we should try next
|
||||
overlay_calc_queue_time(queue, frame);
|
||||
overlay_calc_queue_time(frame);
|
||||
frame = frame->next;
|
||||
}
|
||||
}
|
||||
@ -528,7 +529,8 @@ overlay_fill_send_packet(struct outgoing_packet *packet, time_ms_t now) {
|
||||
}
|
||||
|
||||
// when the queue timer elapses, send a packet
|
||||
static void overlay_send_packet(struct sched_ent *alarm){
|
||||
static void overlay_send_packet(struct sched_ent *UNUSED(alarm))
|
||||
{
|
||||
struct outgoing_packet packet;
|
||||
bzero(&packet, sizeof(struct outgoing_packet));
|
||||
packet.seq=-1;
|
||||
@ -594,7 +596,7 @@ int overlay_queue_ack(struct subscriber *neighbour, struct network_destination *
|
||||
if (config.debug.ack)
|
||||
DEBUGF("RE-TX DUE TO NACK: Requeue packet %p to %s sent by seq %d due to ack of seq %d", frame, alloca_tohex_sid_t(neighbour->sid), frame_seq, ack_seq);
|
||||
frame->delay_until = now;
|
||||
overlay_calc_queue_time(&overlay_tx[i], frame);
|
||||
overlay_calc_queue_time(frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ static int radio_link_parse(struct overlay_interface *interface, struct radio_li
|
||||
if (config.debug.radio_link)
|
||||
DEBUGF("PDU Complete (length=%d)",state->packet_length);
|
||||
|
||||
packetOkOverlay(interface, state->dst, state->packet_length, -1, NULL);
|
||||
packetOkOverlay(interface, state->dst, state->packet_length, NULL);
|
||||
state->packet_length=sizeof(state->dst)+1;
|
||||
}
|
||||
return 1;
|
||||
|
@ -604,7 +604,7 @@ int rhizome_bk_xor_stream(
|
||||
const size_t rs_len,
|
||||
unsigned char *xor_stream,
|
||||
int xor_stream_byte_count);
|
||||
int rhizome_bk2secret(rhizome_manifest *m,
|
||||
int rhizome_bk2secret(
|
||||
const rhizome_bid_t *bidp,
|
||||
const unsigned char *rs, const size_t rs_len,
|
||||
/* The BK need only be the length of the secret half of the secret key */
|
||||
@ -618,7 +618,6 @@ int rhizome_secret2bk(
|
||||
unsigned char bkout[RHIZOME_BUNDLE_KEY_BYTES],
|
||||
const unsigned char secret[crypto_sign_edwards25519sha512batch_SECRETKEYBYTES]
|
||||
);
|
||||
unsigned char *rhizome_bundle_shared_secret(rhizome_manifest *m);
|
||||
int rhizome_sign_hash_with_key(rhizome_manifest *m,const unsigned char *sk,
|
||||
const unsigned char *pk,rhizome_signature *out);
|
||||
int rhizome_verify_bundle_privatekey(const unsigned char *sk, const unsigned char *pk);
|
||||
@ -765,8 +764,7 @@ typedef struct rhizome_http_request
|
||||
} rhizome_http_request;
|
||||
|
||||
int rhizome_received_content(const unsigned char *bidprefix,uint64_t version,
|
||||
uint64_t offset, size_t count,unsigned char *bytes,
|
||||
int type);
|
||||
uint64_t offset, size_t count,unsigned char *bytes);
|
||||
int64_t rhizome_database_create_blob_for(const char *filehashhex_or_tempid,
|
||||
int64_t fileLength,int priority);
|
||||
int rhizome_server_set_response(rhizome_http_request *r, const struct http_response *h);
|
||||
|
@ -31,14 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "keyring.h"
|
||||
#include "dataformats.h"
|
||||
|
||||
/* Work out the encrypt/decrypt key for the supplied manifest.
|
||||
If the manifest is not encrypted, then return NULL.
|
||||
*/
|
||||
unsigned char *rhizome_bundle_shared_secret(rhizome_manifest *m)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int rhizome_manifest_createid(rhizome_manifest *m)
|
||||
{
|
||||
if (crypto_sign_edwards25519sha512batch_keypair(m->cryptoSignPublic.binary, m->cryptoSignSecret))
|
||||
@ -133,7 +125,7 @@ int rhizome_bk_xor_stream(
|
||||
* Returns 0 if the BK decodes correctly to the bundle secret, 1 if not. Returns -1 if there is an
|
||||
* error.
|
||||
*/
|
||||
int rhizome_bk2secret(rhizome_manifest *m,
|
||||
int rhizome_bk2secret(
|
||||
const rhizome_bid_t *bidp,
|
||||
const unsigned char *rs, const size_t rs_len,
|
||||
/* The BK need only be the length of the secret half of the secret key */
|
||||
@ -242,7 +234,7 @@ void rhizome_authenticate_author(rhizome_manifest *m)
|
||||
case FOUND_RHIZOME_SECRET:
|
||||
if (config.debug.rhizome)
|
||||
DEBUGF("author has Rhizome secret");
|
||||
switch (rhizome_bk2secret(m, &m->cryptoSignPublic, rs, rs_len, m->bundle_key.binary, m->cryptoSignSecret)) {
|
||||
switch (rhizome_bk2secret(&m->cryptoSignPublic, rs, rs_len, m->bundle_key.binary, m->cryptoSignSecret)) {
|
||||
case 0:
|
||||
if (config.debug.rhizome)
|
||||
DEBUGF("authentic");
|
||||
@ -373,7 +365,7 @@ void rhizome_find_bundle_author_and_secret(rhizome_manifest *m)
|
||||
unsigned char *secretp = m->cryptoSignSecret;
|
||||
if (m->haveSecret)
|
||||
secretp = alloca(sizeof m->cryptoSignSecret);
|
||||
if (rhizome_bk2secret(m, &m->cryptoSignPublic, rs, rs_len, m->bundle_key.binary, secretp) == 0) {
|
||||
if (rhizome_bk2secret(&m->cryptoSignPublic, rs, rs_len, m->bundle_key.binary, secretp) == 0) {
|
||||
if (m->haveSecret) {
|
||||
if (memcmp(secretp, m->cryptoSignSecret, sizeof m->cryptoSignSecret) != 0)
|
||||
FATALF("Bundle secret does not match derived secret");
|
||||
|
@ -116,7 +116,7 @@ static int sqlite_trace_done;
|
||||
*
|
||||
* @author Andrew Bettison <andrew@servalproject.com>
|
||||
*/
|
||||
static void sqlite_trace_callback(void *context, const char *rendered_sql)
|
||||
static void sqlite_trace_callback(void *UNUSED(context), const char *rendered_sql)
|
||||
{
|
||||
if (sqlite_trace_func())
|
||||
logMessage(LOG_LEVEL_DEBUG, sqlite_trace_whence ? *sqlite_trace_whence : __HERE__, "%s", rendered_sql);
|
||||
@ -130,7 +130,7 @@ static void sqlite_trace_callback(void *context, const char *rendered_sql)
|
||||
*
|
||||
* @author Andrew Bettison <andrew@servalproject.com>
|
||||
*/
|
||||
static void sqlite_profile_callback(void *context, const char *rendered_sql, sqlite_uint64 nanosec)
|
||||
static void sqlite_profile_callback(void *context, const char *rendered_sql, sqlite_uint64 UNUSED(nanosec))
|
||||
{
|
||||
if (!sqlite_trace_done)
|
||||
sqlite_trace_callback(context, rendered_sql);
|
||||
@ -159,7 +159,7 @@ int (*sqlite_set_tracefunc(int (*newfunc)()))()
|
||||
return oldfunc;
|
||||
}
|
||||
|
||||
void sqlite_log(void *ignored, int result, const char *msg)
|
||||
void sqlite_log(void *UNUSED(ignored), int result, const char *msg)
|
||||
{
|
||||
WARNF("Sqlite: %d %s", result, msg);
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ static int rhizome_sync_with_peers(int mode, int peer_count, const struct config
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_rhizome_direct_sync(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_rhizome_direct_sync(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_cli_parsed(parsed);
|
||||
|
@ -337,6 +337,8 @@ static void rhizome_direct_process_mime_body(struct http_request *hr, const char
|
||||
|
||||
int rhizome_direct_import(rhizome_http_request *r, const char *remainder)
|
||||
{
|
||||
if (*remainder)
|
||||
return 1;
|
||||
if (r->http.verb != HTTP_VERB_POST) {
|
||||
http_request_simple_response(&r->http, 405, NULL);
|
||||
return 0;
|
||||
@ -354,6 +356,8 @@ int rhizome_direct_import(rhizome_http_request *r, const char *remainder)
|
||||
|
||||
int rhizome_direct_enquiry(rhizome_http_request *r, const char *remainder)
|
||||
{
|
||||
if (*remainder)
|
||||
return 1;
|
||||
if (r->http.verb != HTTP_VERB_POST) {
|
||||
http_request_simple_response(&r->http, 405, NULL);
|
||||
return 0;
|
||||
@ -376,6 +380,8 @@ int rhizome_direct_enquiry(rhizome_http_request *r, const char *remainder)
|
||||
*/
|
||||
int rhizome_direct_addfile(rhizome_http_request *r, const char *remainder)
|
||||
{
|
||||
if (*remainder)
|
||||
return 1;
|
||||
if (r->http.verb != HTTP_VERB_POST) {
|
||||
http_request_simple_response(&r->http, 405, NULL);
|
||||
return 0;
|
||||
@ -402,12 +408,12 @@ int rhizome_direct_addfile(rhizome_http_request *r, const char *remainder)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rhizome_direct_dispatch(rhizome_http_request *r, const char *remainder)
|
||||
int rhizome_direct_dispatch(rhizome_http_request *r, const char *UNUSED(remainder))
|
||||
{
|
||||
if ( config.rhizome.api.addfile.uri_path[0]
|
||||
&& strcmp(r->http.path, config.rhizome.api.addfile.uri_path) == 0
|
||||
)
|
||||
return rhizome_direct_addfile(r, remainder);
|
||||
return rhizome_direct_addfile(r, "");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -827,6 +827,7 @@ static void rhizome_start_next_queued_fetch(struct rhizome_fetch_slot *slot)
|
||||
static void rhizome_start_next_queued_fetches(struct sched_ent *alarm)
|
||||
{
|
||||
IN();
|
||||
assert(alarm == &sched_activate);
|
||||
int i;
|
||||
for (i = 0; i < NQUEUES; ++i)
|
||||
rhizome_start_next_queued_fetch(&rhizome_fetch_queues[i].active);
|
||||
@ -1393,7 +1394,7 @@ int rhizome_write_content(struct rhizome_fetch_slot *slot, unsigned char *buffer
|
||||
|
||||
int rhizome_received_content(const unsigned char *bidprefix,
|
||||
uint64_t version, uint64_t offset,
|
||||
size_t count, unsigned char *bytes, int type)
|
||||
size_t count, unsigned char *bytes)
|
||||
{
|
||||
IN();
|
||||
if (!is_rhizome_mdp_enabled()) {
|
||||
|
@ -282,7 +282,7 @@ error:
|
||||
|
||||
time_ms_t lookup_time=0;
|
||||
|
||||
int overlay_rhizome_saw_advertisements(int i, struct decode_context *context, struct overlay_frame *f, time_ms_t now)
|
||||
int overlay_rhizome_saw_advertisements(struct decode_context *context, struct overlay_frame *f)
|
||||
{
|
||||
IN();
|
||||
if (!f)
|
||||
|
11
route_link.c
11
route_link.c
@ -461,7 +461,8 @@ next:
|
||||
RETURN(best_link);
|
||||
}
|
||||
|
||||
static int monitor_announce(struct subscriber *subscriber, void *context){
|
||||
static int monitor_announce(struct subscriber *subscriber, void *UNUSED(context))
|
||||
{
|
||||
if (subscriber->reachable & REACHABLE){
|
||||
struct link_state *state = get_link_state(subscriber);
|
||||
monitor_announce_link(state->hop_count, state->transmitter, subscriber);
|
||||
@ -765,7 +766,7 @@ static int neighbour_find_best_link(struct neighbour *n)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int neighbour_link_sent(struct overlay_frame *frame, int sequence, void *context)
|
||||
static int neighbour_link_sent(struct overlay_frame *UNUSED(frame), int sequence, void *context)
|
||||
{
|
||||
struct subscriber *subscriber = context;
|
||||
struct neighbour *neighbour = get_neighbour(subscriber, 0);
|
||||
@ -1077,7 +1078,7 @@ int link_state_ack_soon(struct subscriber *subscriber)
|
||||
}
|
||||
|
||||
// our neighbour is sending a duplicate frame, did we see the original?
|
||||
int link_received_duplicate(struct subscriber *subscriber, struct overlay_interface *interface, int sender_interface, int payload_seq, int unicast)
|
||||
int link_received_duplicate(struct subscriber *subscriber, int payload_seq)
|
||||
{
|
||||
struct neighbour *neighbour = get_neighbour(subscriber, 0);
|
||||
if (!neighbour)
|
||||
@ -1106,7 +1107,7 @@ int link_received_duplicate(struct subscriber *subscriber, struct overlay_interf
|
||||
}
|
||||
|
||||
// remote peer has confirmed hearing a recent unicast packet
|
||||
int link_unicast_ack(struct subscriber *subscriber, struct overlay_interface *interface, struct sockaddr_in addr)
|
||||
int link_unicast_ack(struct subscriber *UNUSED(subscriber), struct overlay_interface *UNUSED(interface), struct sockaddr_in UNUSED(addr))
|
||||
{
|
||||
// TODO find / create network destination, keep it alive
|
||||
return 0;
|
||||
@ -1441,7 +1442,7 @@ void link_explained(struct subscriber *subscriber)
|
||||
update_alarm(__WHENCE__, now + 5);
|
||||
}
|
||||
|
||||
void link_interface_down(struct overlay_interface *interface)
|
||||
void link_interface_down(struct overlay_interface *UNUSED(interface))
|
||||
{
|
||||
clean_neighbours(gettime_ms());
|
||||
}
|
||||
|
8
serval.h
8
serval.h
@ -435,7 +435,7 @@ void insertTransactionInCache(unsigned char *transaction_id);
|
||||
|
||||
int overlay_forward_payload(struct overlay_frame *f);
|
||||
int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, size_t len,
|
||||
int recvttl, struct socket_address *recvaddr);
|
||||
struct socket_address *recvaddr);
|
||||
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,
|
||||
@ -476,10 +476,10 @@ int overlay_queue_schedule_next(time_ms_t next_allowed_packet);
|
||||
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);
|
||||
|
||||
int overlay_rhizome_saw_advertisements(int i, struct decode_context *context, struct overlay_frame *f, time_ms_t now);
|
||||
int overlay_rhizome_saw_advertisements(struct decode_context *context, struct overlay_frame *f);
|
||||
int rhizome_server_get_fds(struct pollfd *fds,int *fdcount,int fdmax);
|
||||
int rhizome_saw_voice_traffic();
|
||||
int overlay_saw_mdp_containing_frame(struct overlay_frame *f, time_ms_t now);
|
||||
int overlay_saw_mdp_containing_frame(struct overlay_frame *f);
|
||||
|
||||
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);
|
||||
@ -713,7 +713,7 @@ extern int64_t bundles_available;
|
||||
extern char crash_handler_clue[1024];
|
||||
|
||||
|
||||
int link_received_duplicate(struct subscriber *subscriber, struct overlay_interface *interface, int sender_interface, int previous_seq, int unicast);
|
||||
int link_received_duplicate(struct subscriber *subscriber, int previous_seq);
|
||||
int link_received_packet(struct decode_context *context, int sender_seq, char unicast);
|
||||
int link_receive(struct overlay_frame *frame, overlay_mdp_frame *mdp);
|
||||
void link_explained(struct subscriber *subscriber);
|
||||
|
@ -89,7 +89,7 @@ int main(int argc,char **argv)
|
||||
|
||||
#endif
|
||||
|
||||
int serval_packetvisualise_renderaddress(XPRINTF xpf, const unsigned char *packet, size_t *ofs, int senderP)
|
||||
static int serval_packetvisualise_renderaddress(XPRINTF xpf, const unsigned char *packet, size_t *ofs)
|
||||
{
|
||||
unsigned int len = packet[(*ofs)++];
|
||||
xprintf(xpf,"(0x%02x) ",len);
|
||||
@ -206,7 +206,7 @@ int isOverlayPacket(XPRINTF xpf, const unsigned char *packet, size_t *ofs, size_
|
||||
}
|
||||
|
||||
xprintf(xpf, "%sSender; ", indent(4));
|
||||
int ret=serval_packetvisualise_renderaddress(xpf,packet,ofs,0);
|
||||
int ret=serval_packetvisualise_renderaddress(xpf,packet,ofs);
|
||||
xprintf(xpf, "\n");
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -247,7 +247,7 @@ int isOverlayPacket(XPRINTF xpf, const unsigned char *packet, size_t *ofs, size_
|
||||
|
||||
if (!payload_flags & 1){
|
||||
xprintf(xpf, "%sSender; ", indent(6));
|
||||
int ret=serval_packetvisualise_renderaddress(xpf,packet,ofs,0);
|
||||
int ret=serval_packetvisualise_renderaddress(xpf,packet,ofs);
|
||||
xprintf(xpf, "\n");
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -263,13 +263,13 @@ int isOverlayPacket(XPRINTF xpf, const unsigned char *packet, size_t *ofs, size_
|
||||
}
|
||||
}else{
|
||||
xprintf(xpf, "%sDestination; ", indent(6));
|
||||
int ret=serval_packetvisualise_renderaddress(xpf,packet,ofs,0);
|
||||
int ret=serval_packetvisualise_renderaddress(xpf,packet,ofs);
|
||||
xprintf(xpf, "\n");
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!(payload_flags & 4)){
|
||||
xprintf(xpf, "%sNext Hop; ", indent(6));
|
||||
int ret=serval_packetvisualise_renderaddress(xpf,packet,ofs,0);
|
||||
int ret=serval_packetvisualise_renderaddress(xpf,packet,ofs);
|
||||
xprintf(xpf, "\n");
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -17,16 +17,18 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
int sigPipeFlag=0;
|
||||
int sigIoFlag=0;
|
||||
|
||||
void sigPipeHandler(int signal)
|
||||
void sigPipeHandler(int UNUSED(signal))
|
||||
{
|
||||
sigPipeFlag++;
|
||||
return;
|
||||
}
|
||||
|
||||
void sigIoHandler(int signal)
|
||||
void sigIoHandler(int UNUSED(signal))
|
||||
{
|
||||
sigIoFlag++;
|
||||
return;
|
||||
|
@ -93,7 +93,8 @@ static void send_audio(int session_id, unsigned char *buffer, int len, int codec
|
||||
monitor_client_writeline_and_data(monitor_client_fd, buffer, len, "audio %06x %d\n", session_id, codec);
|
||||
}
|
||||
|
||||
static int remote_call(char *cmd, int argc, char **argv, unsigned char *data, int dataLen, void *context){
|
||||
static int remote_call(char *UNUSED(cmd), int UNUSED(argc), char **argv, unsigned char *UNUSED(data), int UNUSED(dataLen), void *UNUSED(context))
|
||||
{
|
||||
int token = strtol(argv[0], NULL, 16);
|
||||
|
||||
if (call_token != -1){
|
||||
@ -111,7 +112,8 @@ static int remote_call(char *cmd, int argc, char **argv, unsigned char *data, in
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int remote_ringing(char *cmd, int argc, char **argv, unsigned char *data, int dataLen, void *context){
|
||||
static int remote_ringing(char *UNUSED(cmd), int UNUSED(argc), char **argv, unsigned char *UNUSED(data), int UNUSED(dataLen), void *UNUSED(context))
|
||||
{
|
||||
int token = strtol(argv[0], NULL, 16);
|
||||
if (call_token == token){
|
||||
printf("They're ringing\n");
|
||||
@ -121,7 +123,8 @@ static int remote_ringing(char *cmd, int argc, char **argv, unsigned char *data,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int remote_pickup(char *cmd, int argc, char **argv, unsigned char *data, int dataLen, void *context){
|
||||
static int remote_pickup(char *UNUSED(cmd), int UNUSED(argc), char **argv, unsigned char *UNUSED(data), int UNUSED(dataLen), void *UNUSED(context))
|
||||
{
|
||||
int token = strtol(argv[0], NULL, 16);
|
||||
if (call_token == token){
|
||||
printf("They've picked up\n");
|
||||
@ -131,7 +134,8 @@ static int remote_pickup(char *cmd, int argc, char **argv, unsigned char *data,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int remote_dialing(char *cmd, int argc, char **argv, unsigned char *data, int dataLen, void *context){
|
||||
static int remote_dialing(char *UNUSED(cmd), int UNUSED(argc), char **argv, unsigned char *UNUSED(data), int UNUSED(dataLen), void *UNUSED(context))
|
||||
{
|
||||
int token = strtol(argv[0], NULL, 16);
|
||||
if (call_token == -1){
|
||||
call_token=token;
|
||||
@ -143,7 +147,8 @@ static int remote_dialing(char *cmd, int argc, char **argv, unsigned char *data,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int remote_hangup(char *cmd, int argc, char **argv, unsigned char *data, int dataLen, void *context){
|
||||
static int remote_hangup(char *UNUSED(cmd), int UNUSED(argc), char **argv, unsigned char *UNUSED(data), int UNUSED(dataLen), void *UNUSED(context))
|
||||
{
|
||||
int token = strtol(argv[0], NULL, 16);
|
||||
if (call_token == token){
|
||||
printf("Call ended\n");
|
||||
@ -153,7 +158,8 @@ static int remote_hangup(char *cmd, int argc, char **argv, unsigned char *data,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int remote_audio(char *cmd, int argc, char **argv, unsigned char *data, int dataLen, void *context){
|
||||
static int remote_audio(char *UNUSED(cmd), int UNUSED(argc), char **argv, unsigned char *UNUSED(data), int UNUSED(dataLen), void *UNUSED(context))
|
||||
{
|
||||
int token = strtol(argv[0], NULL, 16);
|
||||
if (call_token == token){
|
||||
int codec = strtol(argv[1], NULL, 10);
|
||||
@ -171,7 +177,8 @@ static int remote_audio(char *cmd, int argc, char **argv, unsigned char *data, i
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int remote_codecs(char *cmd, int argc, char **argv, unsigned char *data, int dataLen, void *context){
|
||||
static int remote_codecs(char *UNUSED(cmd), int UNUSED(argc), char **argv, unsigned char *UNUSED(data), int UNUSED(dataLen), void *UNUSED(context))
|
||||
{
|
||||
int token = strtol(argv[0], NULL, 16);
|
||||
if (call_token == token){
|
||||
int i;
|
||||
@ -185,7 +192,8 @@ static int remote_codecs(char *cmd, int argc, char **argv, unsigned char *data,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int remote_print(char *cmd, int argc, char **argv, unsigned char *data, int dataLen, void *context){
|
||||
static int remote_print(char *cmd, int argc, char **argv, unsigned char *data, int dataLen, void *UNUSED(context))
|
||||
{
|
||||
int i;
|
||||
printf("%s",cmd);
|
||||
for (i=0;i<argc;i++){
|
||||
@ -199,7 +207,8 @@ static int remote_print(char *cmd, int argc, char **argv, unsigned char *data, i
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int remote_noop(char *cmd, int argc, char **argv, unsigned char *data, int dataLen, void *context){
|
||||
static int remote_noop(char *UNUSED(cmd), int UNUSED(argc), char **UNUSED(argv), unsigned char *UNUSED(data), int UNUSED(dataLen), void *UNUSED(context))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -217,7 +226,7 @@ struct monitor_command_handler console_handlers[]={
|
||||
{.command="MONITORSTATUS", .handler=remote_noop},
|
||||
};
|
||||
|
||||
static int console_dial(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
static int console_dial(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
if (call_token!=-1){
|
||||
printf("Already in a call\n");
|
||||
@ -230,7 +239,7 @@ static int console_dial(const struct cli_parsed *parsed, struct cli_context *con
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int console_answer(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
static int console_answer(const struct cli_parsed *UNUSED(parsed), struct cli_context *UNUSED(context))
|
||||
{
|
||||
if (call_token==-1){
|
||||
printf("No active call to answer\n");
|
||||
@ -240,7 +249,7 @@ static int console_answer(const struct cli_parsed *parsed, struct cli_context *c
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int console_hangup(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
static int console_hangup(const struct cli_parsed *UNUSED(parsed), struct cli_context *UNUSED(context))
|
||||
{
|
||||
if (call_token==-1){
|
||||
printf("No call to hangup\n");
|
||||
@ -250,7 +259,7 @@ static int console_hangup(const struct cli_parsed *parsed, struct cli_context *c
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int console_audio(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
static int console_audio(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
if (call_token==-1){
|
||||
printf("No active call\n");
|
||||
@ -285,7 +294,7 @@ struct cli_schema console_commands[]={
|
||||
{NULL, {NULL, NULL, NULL}, 0, NULL},
|
||||
};
|
||||
|
||||
static int console_usage(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
static int console_usage(const struct cli_parsed *UNUSED(parsed), struct cli_context *UNUSED(context))
|
||||
{
|
||||
cli_usage(console_commands, XPRINTF_STDIO(stdout));
|
||||
fflush(stdout);
|
||||
@ -353,7 +362,7 @@ static void monitor_read(struct sched_ent *alarm){
|
||||
}
|
||||
}
|
||||
|
||||
int app_vomp_console(const struct cli_parsed *parsed, struct cli_context *context)
|
||||
int app_vomp_console(const struct cli_parsed *parsed, struct cli_context *UNUSED(context))
|
||||
{
|
||||
if (config.debug.verbose)
|
||||
DEBUG_cli_parsed(parsed);
|
||||
|
Loading…
x
Reference in New Issue
Block a user