opener_error.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*******************************************************************************
  2. * Copyright (c) 2009, Rockwell Automation, Inc.
  3. * All rights reserved.
  4. *
  5. ******************************************************************************/
  6. /** @file opener_error.h
  7. * @author Martin Melik Merkumians
  8. * @brief This file includes the prototypes for error resolution functions like strerror_r or WSAGetLastError
  9. *
  10. */
  11. /**
  12. * @brief Gets the error number or equivalent
  13. *
  14. * A delegate which implements how to get the error number from the system
  15. *
  16. * @return Error number
  17. */
  18. int GetSocketErrorNumber(
  19. );
  20. /**
  21. * @brief Returns a human readable message for the given error number
  22. *
  23. * Returns a human readable error message to be used in logs and traces.
  24. * The error message shall not be a shared memory, like the classic strerror function, as such functions are non-reentrant
  25. * To free the space in which the error message is returned the user shall implement and use the function
  26. * FreeErrorMessage(char *)
  27. *
  28. * @return A human readable error message for the given error number
  29. */
  30. char *GetErrorMessage(int error_number);
  31. /**
  32. * @brief Frees the space of the error message generated by GetErrorMessage(int)
  33. *
  34. * This function shall implement an appropriate method to free the space allocated
  35. * by GetErrorMessage(int)
  36. */
  37. void FreeErrorMessage(char *error_message);