OpENer - Open Source EtherNet/IP(TM) I/O Target Stack  2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
opener_error.c
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (c) 2009, Rockwell Automation, Inc.
3  * All rights reserved.
4  *
5  ******************************************************************************/
6 
13 #include <errno.h>
14 #include <stddef.h>
15 #include <stdlib.h>
16 #include <string.h>
17 
18 #include "opener_error.h"
19 
20 const int kErrorMessageBufferSize = 255;
21 
23  return errno;
24 }
25 
26 char *GetErrorMessage(int error_number) {
27  char *error_message = malloc(kErrorMessageBufferSize);
28  strerror_r(error_number, error_message, kErrorMessageBufferSize);
29  return error_message;
30 }
31 
32 void FreeErrorMessage(char *error_message) {
33  free(error_message);
34 }
35 
char * GetErrorMessage(int error_number)
Returns a human readable message for the given error number.
Definition: opener_error.c:21
This file includes the prototypes for error resolution functions like strerror_r or WSAGetLastError...
const int kErrorMessageBufferSize
Definition: opener_error.c:20
void FreeErrorMessage(char *error_message)
Frees the space of the error message generated by GetErrorMessage(int)
Definition: opener_error.c:34
int GetSocketErrorNumber()
Gets the error number or equivalent.
Definition: opener_error.c:17