Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
BaErrorCodes.h File Reference

Detailed Description

BAS status codes and fatal-error reporting.

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define baFatalE(ecode1, ecode2)   baFatalEf(ecode1, ecode2, __FILE__, __LINE__)
 Report a fatal condition with the current source file and line. More...
 

Enumerations

enum  BaFatalErrorCodes {
  FE_MALLOC = HTTP_E_BASE , FE_ASSERT , FE_NO_SERV_CON , FE_SOCKET ,
  FE_GETHOSTBYNAME , FE_GETHOSTBYNAME2 , FE_BIND , FE_LISTEN ,
  FE_IOCTL , FE_SETSOCKOPT , FE_ACCEPT , FE_NO_IPV6_SUPPORT ,
  FE_INVALID_CSPREADER , FE_CANNOT_READ , FE_MAGIC_NO , FE_THREAD_LIB ,
  FE_SSL_ERROR , FE_HTTPCON_INVALID_DISPEV , FE_BLUA_PANIC , FE_EXIT ,
  FE_INCORRECT_USE , FE_TYPE_SIZE_ERROR , FE_WRONG_ENDIAN , FE_USER_ERROR_1 = HTTP_E_BASE+100 ,
  FE_USER_ERROR_2 , FE_USER_ERROR_3 , FE_USER_ERROR_4 , FE_USER_ERROR_5 ,
  FE_USER_ERROR_6 , FE_USER_ERROR_7 , FE_USER_ERROR_8 , FE_USER_ERROR_9 ,
  FE_USER_ERROR_10
}
 Fatal conditions reported to UserDefinedErrHandler, not ordinary returns. More...
 
enum  BaErrorCodes {
}
 Operation status codes. More...
 

Functions

BA_API void baFatalEf (BaFatalErrorCodes ecode1, unsigned int ecode2, const char *file, int line)
 Invoke platform fatal-error handling and the configured application handler. More...
 
BA_API const char * baErr2Str (int ecode)
 Convert an operation status to a short diagnostic string. More...
 
BA_API int baErr2HttpCode (int ecode)
 Map selected I/O results to an HTTP response status. More...
 

Macro Definition Documentation

◆ baFatalE

#define baFatalE (   ecode1,
  ecode2 
)    baFatalEf(ecode1, ecode2, __FILE__, __LINE__)

Report a fatal condition with the current source file and line.

Parameters
ecode1BaFatalErrorCodes condition.
ecode2Secondary code such as allocation byte count or OS error. See baFatalEf for control-flow behavior. No value is returned.

Enumeration Type Documentation

◆ BaErrorCodes

Operation status codes.

Zero means success where the calling API specifies it; negative values identify failures or special states. E_PROXY_READY is internal progress, not an error. Consult each API for its possible results; these are not HTTP response status numbers.

Enumerator
E_PAGE_NOT_FOUND 

for HttpResponse include or forward

E_INCORRECT_USE 

The API is not used correctly.

E_SHARK_ALERT_RECV 

Call SharkSslCon_getAlertDescription.

E_NOT_TRUSTED 

SSL certificate not trusted or domain mismatch.

E_TLS_CLOSE_NOTIFY 

Peer is closing the connection.

E_PROXY_AUTH 

Authentication required or wrong credentials.

E_PROXY_GENERAL 

general SOCKS server failure

E_PROXY_NOT_ALLOWED 

connection not allowed by ruleset

E_PROXY_NETWORK 

Network unreachable.

E_PROXY_HOST 

Host unreachable.

E_PROXY_REFUSED 

Connection refused.

E_PROXY_TTL 

TTL expired.

E_PROXY_COMMAND_NOT_SUP 

Command not supported.

E_PROXY_ADDRESS_NOT_SUP 

Address type not supported.

E_PROXY_NOT_COMPATIBLE 

Not a supported SOCKS version.

E_PROXY_UNKNOWN 

Unknown SOCKS error.

E_SYS_SHUTDOWN 

Used by Mako Server (and others) when program exits.

◆ BaFatalErrorCodes

Fatal conditions reported to UserDefinedErrHandler, not ordinary returns.

The secondary code is condition/platform dependent. Applications should terminate or reset after a fatal callback; continued execution is not promised.

Enumerator
FE_MALLOC 

error code 2 = size needed

FE_ASSERT 

error code 2 not used

FE_NO_SERV_CON 

error code 2 not used

FE_SOCKET 

error code 2 = errno

FE_GETHOSTBYNAME 

error code 2 = errno

FE_GETHOSTBYNAME2 

error code 2 = errno

FE_BIND 

error code 2 = errno

FE_LISTEN 

error code 2 = errno

FE_IOCTL 

error code 2 = errno

FE_SETSOCKOPT 

error code 2 = errno

FE_ACCEPT 

error code 2 = errno

FE_NO_IPV6_SUPPORT 

error code 2 not used

FE_INVALID_CSPREADER 

error code 2 not used

FE_CANNOT_READ 

error code 2 is the offset position

FE_MAGIC_NO 

error code 2 not used

FE_THREAD_LIB 

See threadlib for error code 2.

FE_SSL_ERROR 

error code 2 not used

FE_HTTPCON_INVALID_DISPEV 

error code 2 not used

FE_BLUA_PANIC 

Lua panic: error 2 is code from exit()

FE_TYPE_SIZE_ERROR 

One of U8 to U32 are of incorrect size.

FE_WRONG_ENDIAN 

Incorrect B_LITTLE_ENDIAN/B_BIG_ENDIAN macro.

Function Documentation

◆ baErr2HttpCode()

BA_API int baErr2HttpCode ( int  ecode)

Map selected I/O results to an HTTP response status.

Parameters
ecodeHTTP code 100..599 or I/O error code.
Returns
HTTP codes pass through unchanged. Selected I/O errors map to 400/403/404/405/409/423/501/503/507; all other values, including zero, map to 500. Call only after determining that an operation failed.

◆ baErr2Str()

BA_API const char * baErr2Str ( int  ecode)

Convert an operation status to a short diagnostic string.

Parameters
ecodeBAS, I/O, ZIP, or other explicitly supported status.
Returns
Borrowed static NUL-terminated string; "unknown" for unmapped values. Do not free. This is a diagnostic mapping, not a success/failure test.

◆ baFatalEf()

BA_API void baFatalEf ( BaFatalErrorCodes  ecode1,
unsigned int  ecode2,
const char *  file,
int  line 
)

Invoke platform fatal-error handling and the configured application handler.

Parameters
ecode1Fatal condition.
ecode2Secondary condition/platform-specific detail.
fileBorrowed NUL-terminated diagnostic source filename.
lineSource line number. Use baFatalE to capture the call site. Default ports wait indefinitely when no handler is installed. Some ports permit a handler to return and others continue waiting; do not rely on returning as a recovery mechanism.