opener_error.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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(void);
  19. /**
  20. * @brief Returns a human readable message for the given error number
  21. *
  22. * Returns a human readable error message to be used in logs and traces.
  23. * The error message shall not be a shared memory, like the classic strerror function, as such functions are non-reentrant
  24. * To free the space in which the error message is returned the user shall implement and use the function
  25. * FreeErrorMessage(char *)
  26. *
  27. * @return A human readable error message for the given error number
  28. */
  29. char *GetErrorMessage(int error_number);
  30. /**
  31. * @brief Frees the space of the error message generated by GetErrorMessage(int)
  32. *
  33. * This function shall implement an appropriate method to free the space allocated
  34. * by GetErrorMessage(int)
  35. */
  36. void FreeErrorMessage(char *error_message);