FlowError.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * @file FlowError.c
  3. * @author Ambroz Bizjak <ambrop7@gmail.com>
  4. *
  5. * @section LICENSE
  6. *
  7. * This file is part of BadVPN.
  8. *
  9. * BadVPN is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2
  11. * as published by the Free Software Foundation.
  12. *
  13. * BadVPN is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. */
  22. #include <flow/FlowError.h>
  23. void FlowErrorDomain_Init (FlowErrorDomain *d, FlowErrorDomain_handler handler, void *user)
  24. {
  25. d->handler = handler;
  26. d->user = user;
  27. }
  28. FlowErrorReporter FlowErrorReporter_Create (FlowErrorDomain *domain, int component)
  29. {
  30. FlowErrorReporter r;
  31. r.domain = domain;
  32. r.component = component;
  33. return r;
  34. }
  35. void FlowErrorReporter_ReportError (FlowErrorReporter *reporter, int code)
  36. {
  37. reporter->domain->handler(reporter->domain->user, reporter->component, code);
  38. }