srtp_err.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. */
  18. #include "err.h"
  19. #include <pj/log.h>
  20. /* Redirect libsrtp error to PJ_LOG */
  21. static srtp_err_reporting_level_t err_level = srtp_err_level_error;
  22. void srtp_err_report(srtp_err_reporting_level_t priority, const char *format, ...)
  23. {
  24. va_list args;
  25. #if PJ_LOG_MAX_LEVEL >= 1
  26. if (priority <= err_level) {
  27. va_start(args, format);
  28. pj_log("libsrtp", priority, format, args);
  29. va_end(args);
  30. }
  31. #endif
  32. }
  33. void srtp_err_reporting_set_level(srtp_err_reporting_level_t lvl)
  34. {
  35. err_level = lvl;
  36. }
  37. srtp_err_status_t srtp_err_reporting_init(void)
  38. {
  39. return srtp_err_status_ok;
  40. }
  41. srtp_err_status_t srtp_install_err_report_handler(srtp_err_report_handler_func_t func)
  42. {
  43. PJ_UNUSED_ARG(func);
  44. return srtp_err_status_ok;
  45. }