PageRenderTime 50ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/openvswitch/lib/ovsdb-error.h

https://github.com/kevinfhell/dpdk-ovs
C Header | 69 lines | 34 code | 13 blank | 22 comment | 0 complexity | 12db9833d842565c94f500f1b2b83c58 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-3.0, LGPL-3.0, Apache-2.0, LGPL-2.1, GPL-2.0, MIT
  1. /* Copyright (c) 2009, 2010, 2011 Nicira, Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at:
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. #ifndef OVSDB_ERROR_H
  16. #define OVSDB_ERROR_H 1
  17. #include "compiler.h"
  18. struct json;
  19. struct ovsdb_error *ovsdb_error(const char *tag, const char *details, ...)
  20. PRINTF_FORMAT(2, 3)
  21. WARN_UNUSED_RESULT;
  22. struct ovsdb_error *ovsdb_io_error(int error, const char *details, ...)
  23. PRINTF_FORMAT(2, 3)
  24. WARN_UNUSED_RESULT;
  25. struct ovsdb_error *ovsdb_syntax_error(const struct json *, const char *tag,
  26. const char *details, ...)
  27. PRINTF_FORMAT(3, 4)
  28. WARN_UNUSED_RESULT;
  29. struct ovsdb_error *ovsdb_wrap_error(struct ovsdb_error *error,
  30. const char *details, ...)
  31. PRINTF_FORMAT(2, 3);
  32. struct ovsdb_error *ovsdb_internal_error(struct ovsdb_error *error,
  33. const char *file, int line,
  34. const char *details, ...)
  35. PRINTF_FORMAT(4, 5)
  36. WARN_UNUSED_RESULT;
  37. /* Returns a pointer to an ovsdb_error that represents an internal error for
  38. * the current file name and line number with MSG as the associated message.
  39. * The caller is responsible for freeing the internal error. */
  40. #define OVSDB_BUG(MSG) \
  41. ovsdb_internal_error(NULL, __FILE__, __LINE__, "%s", MSG)
  42. /* Returns a pointer to an ovsdb_error that represents an internal error for
  43. * the current file name and line number, with MSG as the associated message.
  44. * If ERROR is nonnull then the internal error is wrapped around ERROR. Takes
  45. * ownership of ERROR. The caller is responsible for freeing the returned
  46. * error. */
  47. #define OVSDB_WRAP_BUG(MSG, ERROR) \
  48. ovsdb_internal_error(ERROR, __FILE__, __LINE__, "%s", MSG)
  49. void ovsdb_error_destroy(struct ovsdb_error *);
  50. struct ovsdb_error *ovsdb_error_clone(const struct ovsdb_error *)
  51. WARN_UNUSED_RESULT;
  52. char *ovsdb_error_to_string(const struct ovsdb_error *);
  53. struct json *ovsdb_error_to_json(const struct ovsdb_error *);
  54. const char *ovsdb_error_get_tag(const struct ovsdb_error *);
  55. void ovsdb_error_assert(struct ovsdb_error *);
  56. #endif /* ovsdb-error.h */