diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-01 22:35:00 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-01 22:35:00 +0200 |
commit | 350353d2c1282b2802bba83f49a3508b3beeb24a (patch) | |
tree | 7d0ad5411019d25cd4ad15c32b9766e4c6d35184 | |
parent | bd781685508ae5096f864ba969824e299c7f327c (diff) | |
download | fastd-350353d2c1282b2802bba83f49a3508b3beeb24a.tar fastd-350353d2c1282b2802bba83f49a3508b3beeb24a.zip |
Add verbose log level, change some log messages
-rw-r--r-- | src/fastd.h | 4 | ||||
-rw-r--r-- | src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c | 8 | ||||
-rw-r--r-- | src/types.h | 1 |
3 files changed, 8 insertions, 5 deletions
diff --git a/src/fastd.h b/src/fastd.h index 8a14f11..8e63884 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -151,12 +151,14 @@ static inline int fastd_rand(fastd_context *ctx, int min, int max) { #define is_error(ctx) ((ctx)->conf == NULL || LOG_ERROR <= (ctx)->conf->loglevel) #define is_warn(ctx) ((ctx)->conf == NULL || LOG_WARN <= (ctx)->conf->loglevel) #define is_info(ctx) ((ctx)->conf == NULL || LOG_INFO <= (ctx)->conf->loglevel) +#define is_verbose(ctx) ((ctx)->conf == NULL || LOG_VERBOSE <= (ctx)->conf->loglevel) #define is_debug(ctx) ((ctx)->conf == NULL || LOG_DEBUG <= (ctx)->conf->loglevel) #define pr_fatal(ctx, args...) pr_log(ctx, LOG_FATAL, "Fatal: ", args) #define pr_error(ctx, args...) pr_log(ctx, LOG_ERROR, "Error: ", args) #define pr_warn(ctx, args...) pr_log(ctx, LOG_WARN, "Warning: ", args) -#define pr_info(ctx, args...) pr_log(ctx, LOG_INFO, "", args) +#define pr_info(ctx, args...) pr_log(ctx, LOG_INFO, "Info: ", args) +#define pr_verbose(ctx, args...) pr_log(ctx, LOG_INFO, "Verbose: ", args) #define pr_debug(ctx, args...) pr_log(ctx, LOG_DEBUG, "DEBUG: ", args) #define warn_errno(ctx, message) pr_warn(ctx, "%s: %s", message, strerror(errno)) diff --git a/src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c b/src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c index 29c02fa..8988778 100644 --- a/src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c +++ b/src/protocol_ec25519_fhmqvc_xsalsa20_poly1305.c @@ -298,7 +298,7 @@ static inline bool has_field(const fastd_handshake *handshake, uint8_t type, siz } static void respond_handshake(fastd_context *ctx, fastd_peer *peer, const fastd_handshake *handshake) { - pr_info(ctx, "Responding handshake with %P...", peer); + pr_debug(ctx, "responding handshake with %P...", peer); uint8_t hashinput[5*PUBLICKEYBYTES]; uint8_t hashbuf[HASHBYTES]; @@ -362,7 +362,7 @@ static void establish(fastd_context *ctx, fastd_peer *peer, const fastd_peer_con int i; uint8_t hashinput[5*PUBLICKEYBYTES]; - pr_info(ctx, "Session with %P established", peer); + pr_verbose(ctx, "New session with %P established.", peer); if (is_session_valid(ctx, &peer->protocol_state->session) && !is_session_valid(ctx, &peer->protocol_state->old_session)) peer->protocol_state->old_session = peer->protocol_state->session; @@ -423,7 +423,7 @@ static inline bool is_session_initiator(const protocol_session *session) { } static void finish_handshake(fastd_context *ctx, fastd_peer *peer, const fastd_handshake *handshake) { - pr_info(ctx, "Finishing handshake with %P...", peer); + pr_debug(ctx, "finishing handshake with %P...", peer); uint8_t hashinput[5*PUBLICKEYBYTES]; uint8_t hashbuf[HASHBYTES]; @@ -494,7 +494,7 @@ static void finish_handshake(fastd_context *ctx, fastd_peer *peer, const fastd_h } static void handle_finish_handshake(fastd_context *ctx, fastd_peer *peer, const fastd_handshake *handshake) { - pr_info(ctx, "Handling handshake finish with %P...", peer); + pr_debug(ctx, "handling handshake finish with %P...", peer); uint8_t hashinput[2*PUBLICKEYBYTES]; diff --git a/src/types.h b/src/types.h index 1730459..684fe4a 100644 --- a/src/types.h +++ b/src/types.h @@ -38,6 +38,7 @@ typedef enum _fastd_loglevel { LOG_ERROR, LOG_WARN, LOG_INFO, + LOG_VERBOSE, LOG_DEBUG, } fastd_loglevel; |