nss-sock.c nss-sock.h qnetd-client.c qnetd-client.h \
qnetd-client-list.c qnetd-client-list.h log.c log.h \
pr-poll-array.c pr-poll-array.h timer-list.c timer-list.h tlv.c tlv.h \
+ log-common.c log-common.h \
send-buffer-list.c send-buffer-list.h node-list.c node-list.h \
qnetd-algo-test.c qnetd-algo-test.h qnetd-algorithm.c qnetd-algorithm.h \
qnetd-algo-utils.c qnetd-algo-utils.h \
zi++;
}
}
+
+void
+log_common_msg_decode_error(int ret)
+{
+
+ switch (ret) {
+ case -1:
+ log(LOG_WARNING, "Received message with option with invalid length");
+ break;
+ case -2:
+ log(LOG_CRIT, "Can't allocate memory");
+ break;
+ case -3:
+ log(LOG_WARNING, "Received inconsistent msg (tlv len > msg size)");
+ break;
+ case -4:
+ log(LOG_WARNING, "Received message with option with invalid value");
+ break;
+ default:
+ log(LOG_ERR, "Unknown error occurred when decoding message");
+ break;
+ }
+}
extern void log_common_debug_dump_node_list(const struct node_list *nlist);
+extern void log_common_msg_decode_error(int ret);
+
#ifdef __cplusplus
}
#endif
openlog(log_config_ident, LOG_PID, log_config_syslog_facility);
}
}
-
-void
-log_msg_decode_error(int ret)
-{
-
- switch (ret) {
- case -1:
- log(LOG_WARNING, "Received message with option with invalid length");
- break;
- case -2:
- log(LOG_CRIT, "Can't allocate memory");
- break;
- case -3:
- log(LOG_WARNING, "Received inconsistent msg (tlv len > msg size)");
- break;
- case -4:
- log(LOG_WARNING, "Received message with option with invalid value");
- break;
- default:
- log(LOG_ERR, "Unknown error occurred when decoding message");
- break;
- }
-}
extern void log_set_target(int target, int syslog_facility);
-extern void log_msg_decode_error(int ret);
-
#ifdef __cplusplus
}
#endif
*/
#include "log.h"
+#include "log-common.h"
#include "qdevice-net-algorithm.h"
#include "qdevice-net-cast-vote-timer.h"
#include "qdevice-net-heuristics.h"
return (res);
}
-static void
-qdevice_net_msg_received_log_msg_decode_error(int ret)
-{
-
- switch (ret) {
- case -1:
- log(LOG_WARNING, "Received message with option with invalid length");
- break;
- case -2:
- log(LOG_CRIT, "Can't allocate memory");
- break;
- case -3:
- log(LOG_WARNING, "Received inconsistent msg (tlv len > msg size)");
- break;
- case -4:
- log(LOG_ERR, "Received message with option with invalid value");
- break;
- default:
- log(LOG_ERR, "Unknown error occurred when decoding message");
- break;
- }
-}
-
static int
qdevice_net_msg_received_unexpected_msg(struct qdevice_net_instance *instance,
const struct msg_decoded *msg, const char *msg_str)
/*
* Error occurred. Disconnect.
*/
- qdevice_net_msg_received_log_msg_decode_error(res);
+ log_common_msg_decode_error(res);
log(LOG_ERR, "Disconnecting from server");
instance->disconnect_reason = QDEVICE_NET_DISCONNECT_REASON_MSG_DECODE_ERROR;
#include <sys/types.h>
#include "log.h"
+#include "log-common.h"
#include "qnetd-algorithm.h"
#include "qnetd-instance.h"
#include "qnetd-log-debug.h"
/*
* Error occurred. Send server error.
*/
- log_msg_decode_error(res);
+ log_common_msg_decode_error(res);
log(LOG_INFO, "Sending back error message");
if (qnetd_client_send_err(client, msg.seq_number_set, msg.seq_number,