1 /**
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundatnetn; either versnetn 2 of the License, or
5  * (at your optnetn) any later versnetn.
6  *
7  * net/error.h
8  * (c) 2007 Murat Deligonul
9  */
10 
11 #ifndef __NET_ERROR_H
12 #define __NET_ERROR_H
13 
14 #include "debug.h"
15 
16 namespace net {
17 
18 /** Socket errors **/
19 enum {
20 	ERR_SUCCESS = 0,
21 	ERR_CLOSED = -1,		/** socket closed normally **/
22 	ERR_FAILURE = -2,      		/** generic error return **/
23 	ERR_DNS   = -3,        		/** dns lookup failed, or hostname was bad **/
24 	ERR_AGAIN = -4,        		/** Try again (returned by some SSL functions) **/
25 	ERR_SYSCALL  = -5,     		/** A system call failed **/
26 	ERR_UNABLE  = -6,      		/** Unable to create socket (open() failed, or table full) **/
27 	ERR_ACCEPT  = -7,      		/** Unable to accept connection **/
28 	ERR_TABLE_FULL = -8,   		/** oops. too many sockets **/
29 	ERR_HUP	= -9,   		/** Hangup or poll error **/
30 	ERR_CONN_ABORTED = -10, 	/** non-blocking connect aborted **/
31 	ERR_LISTENING   = -11,  	/** Socket is already listening **/
32 	ERR_ALREADY_OPEN = -12, 	/** Socket is already open/connected **/
33 	ERR_INTERFACE = -13,		/** Unable to bind to requested address **/
34 	ERR_PROGRESS = -14,		/** Non-blocking operation in progress **/
35 	ERR_AUTH	= -15,		/** Authorization Error **/
36 	ERR_SSL   = -16,        	/** SSL library error **/
37 	ERR_MEM	  = -17,		/** Memory allocation error **/
38 	ERR_SOCK_CLOSED	= -18		/** Socket already closed **/
39 };
40 
41 // return error description
42 const char * strerror(int);
43 
44 }  /* namespace net */
45 #endif	/* __NET_ERROR_H */
46