How to handle error code
There are error codes in three layers, Sock, Interface and Module.
SUCCESS, FATAL and TIMEOUT are common.
The others are dependent on the layers.
For examples, SiTCPVME has own error codes such as VMEBUS, LENGTH an so on.
Thus, I define the error codes as follows;
There is not error:
SUCCESS = 0

There are error in common:
ERROR_FATAL = -1
ERROR_TIMEOUT = -2

layer dependent error codes:
Sock error -> none
Interface  -> from -10 to -99
Module     -> frm -100 to ?

Naming convension:
SUCCESS
ERROR_TIMEOUT
ERROR_FATAL
ERROR_XXXX

definition in C and C++:
In C, common error definition file such as error.h defines common errors and
specific error defines in their own layers.

In C++, all errors in their own layers.
