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 File Reference

This file includes the prototypes for error resolution functions like strerror or WSAGetLastError. More...

#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "opener_error.h"
Include dependency graph for opener_error.c:

Go to the source code of this file.

Functions

void FreeErrorMessage (char *error_message)
 Frees the space of the error message generated by GetErrorMessage(int) More...
 
char * GetErrorMessage (int error_number)
 Returns a human readable message for the given error number. More...
 
int GetSocketErrorNumber ()
 Gets the error number or equivalent. More...
 

Variables

const int kErrorMessageBufferSize = 255
 

Detailed Description

This file includes the prototypes for error resolution functions like strerror or WSAGetLastError.

Author
Martin Melik Merkumians

Definition in file opener_error.c.

Function Documentation

void FreeErrorMessage ( char *  error_message)

Frees the space of the error message generated by GetErrorMessage(int)

This function shall implement an appropriate method to free the space allocated by GetErrorMessage(int)

Definition at line 32 of file opener_error.c.

char* GetErrorMessage ( int  error_number)

Returns a human readable message for the given error number.

Returns a human readable error message to be used in logs and traces. The error message shall not be a shared memory, like the classic strerror function, as such functions are non-reentrant To free the space in which the error message is returned the user shall implement and use the function FreeErrorMessage(char *)

Returns
A human readable error message for the given error number

Definition at line 26 of file opener_error.c.

References kErrorMessageBufferSize.

int GetSocketErrorNumber ( )

Gets the error number or equivalent.

A delegate which implements how to get the error number from the system

Returns
Error number

Definition at line 22 of file opener_error.c.

Variable Documentation

const int kErrorMessageBufferSize = 255

Definition at line 20 of file opener_error.c.

Referenced by GetErrorMessage().