From 810720e7790a6736f96c30c82ecf29d4fcefb7e3 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sat, 12 Apr 2014 16:51:33 +0200 Subject: use logging functions --- modules/dtls_srtp/dtls.c | 13 ++++--------- modules/dtls_srtp/srtp.c | 25 ++++++++++--------------- modules/dtls_srtp/tls_udp.c | 18 +++++++----------- 3 files changed, 21 insertions(+), 35 deletions(-) (limited to 'modules/dtls_srtp') diff --git a/modules/dtls_srtp/dtls.c b/modules/dtls_srtp/dtls.c index f787cd2..e502903 100644 --- a/modules/dtls_srtp/dtls.c +++ b/modules/dtls_srtp/dtls.c @@ -12,11 +12,6 @@ #include "dtls_srtp.h" -#define DEBUG_MODULE "dtls_srtp" -#define DEBUG_LEVEL 5 -#include - - /* note: shadow struct in libre's tls module */ struct tls { SSL_CTX *ctx; @@ -157,8 +152,8 @@ int dtls_alloc_selfsigned(struct tls **tlsp, const char *aor, /* Generate self-signed certificate */ err = tls_gen_selfsigned_cert(tls, aor); if (err) { - DEBUG_WARNING("failed to generate certificate (%s): %m\n", - aor, err); + warning("dtls: failed to generate certificate (%s): %m\n", + aor, err); goto out; } @@ -175,8 +170,8 @@ int dtls_alloc_selfsigned(struct tls **tlsp, const char *aor, } if (0 != SSL_CTX_set_tlsext_use_srtp(tls->ctx, srtp_profiles)) { - DEBUG_WARNING("could not enable SRTP for profiles '%s'\n", - srtp_profiles); + warning("dtls: could not enable SRTP for profiles '%s'\n", + srtp_profiles); err = ENOSYS; goto out; } diff --git a/modules/dtls_srtp/srtp.c b/modules/dtls_srtp/srtp.c index 7f33ccc..b68ebc1 100644 --- a/modules/dtls_srtp/srtp.c +++ b/modules/dtls_srtp/srtp.c @@ -13,11 +13,6 @@ #include "dtls_srtp.h" -#define DEBUG_MODULE "dtls_srtp" -#define DEBUG_LEVEL 5 -#include - - struct srtp_stream { srtp_policy_t policy; srtp_t srtp; @@ -118,10 +113,10 @@ static bool send_handler(int *err, struct sa *dst, struct mbuf *mb, void *arg) } if (err_status_ok != e) { - DEBUG_WARNING("send: failed to protect %s-packet" - " with %d bytes (%H)\n", - is_rtcp_packet(mb) ? "RTCP" : "RTP", - len, errstatus_print, e); + warning("srtp: send: failed to protect %s-packet" + " with %d bytes (%H)\n", + is_rtcp_packet(mb) ? "RTCP" : "RTP", + len, errstatus_print, e); *err = EPROTO; return false; } @@ -152,10 +147,10 @@ static bool recv_handler(struct sa *src, struct mbuf *mb, void *arg) } if (e != err_status_ok) { - DEBUG_WARNING("recv: failed to unprotect %s-packet" - " with %d bytes (%H)\n", - is_rtcp_packet(mb) ? "RTCP" : "RTP", - len, errstatus_print, e); + warning("srtp: recv: failed to unprotect %s-packet" + " with %d bytes (%H)\n", + is_rtcp_packet(mb) ? "RTCP" : "RTP", + len, errstatus_print, e); return true; /* error - drop packet */ } @@ -195,7 +190,7 @@ int srtp_stream_add(struct srtp_stream **sp, const char *profile, crypto_policy_set_aes_cm_128_hmac_sha1_32(&s->policy.rtcp); } else { - DEBUG_WARNING("unsupported profile: %s\n", profile); + warning("srtp: unsupported profile: %s\n", profile); err = ENOSYS; goto out; } @@ -207,7 +202,7 @@ int srtp_stream_add(struct srtp_stream **sp, const char *profile, e = srtp_create(&s->srtp, &s->policy); if (err_status_ok != e) { s->srtp = NULL; - DEBUG_WARNING("srtp_create() failed. e=%d\n", e); + warning("srtp: srtp_create() failed. e=%d\n", e); err = ENOMEM; goto out; } diff --git a/modules/dtls_srtp/tls_udp.c b/modules/dtls_srtp/tls_udp.c index ada5310..058641a 100644 --- a/modules/dtls_srtp/tls_udp.c +++ b/modules/dtls_srtp/tls_udp.c @@ -8,14 +8,10 @@ #include #include #include +#include #include "dtls_srtp.h" -#define DEBUG_MODULE "tls_udp" -#define DEBUG_LEVEL 5 -#include - - /* note: shadow struct in dtls.c */ struct tls { SSL_CTX *ctx; @@ -81,7 +77,7 @@ static int bio_write(BIO *b, const char *buf, int len) err = udp_send_helper(tc->us, &tc->peer, mb, tc->uh); if (err) { - DEBUG_WARNING("udp_send_helper: %m\n", err); + warning("dtls: udp_send_helper: %m\n", err); } mem_deref(mb); @@ -179,8 +175,8 @@ static int get_srtp_key_info(const struct dtls_flow *tc, char *name, size_t sz, keymatexportlen = (int)(kl + sl)*2; if (keymatexportlen != 60) { - DEBUG_WARNING("expected 60 bits, but keying material is %d\n", - keymatexportlen); + warning("dtls: expected 60 bits, but keying material is %d\n", + keymatexportlen); return EINVAL; } @@ -257,7 +253,7 @@ static bool recv_handler(struct sa *src, struct mbuf *mb, void *arg) err = get_srtp_key_info(flow, profile, sizeof(profile), &client_key, &server_key); if (err) { - DEBUG_WARNING("SRTP key info: %m\n", err); + warning("dtls: SRTP key info: %m\n", err); return true; } @@ -340,8 +336,8 @@ int dtls_flow_start(struct dtls_flow *flow, const struct sa *peer, bool active) ERR_clear_error(); if (ssl_err != SSL_ERROR_WANT_READ) { - DEBUG_WARNING("SSL_connect() failed" - " (err=%d)\n", ssl_err); + warning("dtls: SSL_connect() failed" + " (err=%d)\n", ssl_err); } } -- cgit v1.2.3