nanohttp-error.h File Reference

Go to the source code of this file.

Defines

#define H_OK   0
#define GENERAL_ERROR   1400
#define GENERAL_INVALID_PARAM   (GENERAL_ERROR + 1)
#define GENERAL_HEADER_PARSE_ERROR   (GENERAL_ERROR + 2)
#define THREAD_ERROR   1500
#define THREAD_BEGIN_ERROR   (THREAD_ERROR)
#define FILE_ERROR   8000
#define FILE_ERROR_OPEN   (FILE_ERROR + 1)
#define FILE_ERROR_READ   (FILE_ERROR + 2)

Typedefs

typedef void * herror_t

Functions

herror_t herror_new (const char *func, int errcode, const char *format,...)
int herror_code (herror_t err)
const char * herror_func (herror_t err)
const char * herror_message (herror_t err)
void herror_release (herror_t err)


Detailed Description

nanoHTTP error handling

Almost all function will return a "herror_t" object. If the function returns with success this object is H_OK. Another herror_t object will be returned otherwise. Following functions can be used with a returned herror_t object:

Example:

 herror_t err;

 if ((err = http_client_invoke("http://somewhere")) != H_OK)
 {
   printf("Message: %s\n", herror_message(err));
   printf("Error code: %d\n", herror_code(err));
   printf("In function: %s\n", herror_func(err));
   herror_release(err);
 }

Note that you MUST call herror_release() to free the resources.

Definition in file nanohttp-error.h.


Define Documentation

#define FILE_ERROR   8000
 

File errors

Definition at line 87 of file nanohttp-error.h.

#define FILE_ERROR_OPEN   (FILE_ERROR + 1)
 

Definition at line 88 of file nanohttp-error.h.

Referenced by httpc_mime_send_file(), httpd_mime_send_file(), and soap_ctx_add_file().

#define FILE_ERROR_READ   (FILE_ERROR + 2)
 

Definition at line 89 of file nanohttp-error.h.

Referenced by httpc_mime_send_file(), and httpd_mime_send_file().

#define GENERAL_ERROR   1400
 

General errors

Definition at line 70 of file nanohttp-error.h.

#define GENERAL_HEADER_PARSE_ERROR   (GENERAL_ERROR + 2)
 

Definition at line 72 of file nanohttp-error.h.

Referenced by hresponse_new_from_socket().

#define GENERAL_INVALID_PARAM   (GENERAL_ERROR + 1)
 

Definition at line 71 of file nanohttp-error.h.

Referenced by soap_env_new_from_buffer(), soap_env_new_from_doc(), and soap_env_new_with_response().

#define H_OK   0
 

Success flag

Definition at line 63 of file nanohttp-error.h.

Referenced by _soap_xmlsec_init(), herror_code(), hrequest_new_from_socket(), hresponse_new_from_socket(), hsocket_accept(), hsocket_bind(), hsocket_init(), hsocket_listen(), hsocket_module_init(), hsocket_open(), hsocket_recv(), hsocket_send(), hssl_client_ssl(), hssl_read(), hssl_server_ssl(), hssl_write(), http_input_stream_is_ready(), http_input_stream_new(), http_input_stream_read(), http_output_stream_flush(), http_output_stream_write(), httpc_get(), httpc_mime_end(), httpc_mime_next(), httpc_mime_send_file(), httpc_new(), httpc_post_begin(), httpc_post_end(), httpc_send_header(), httpd_init(), httpd_mime_end(), httpd_mime_next(), httpd_mime_send_file(), httpd_register_secure(), httpd_run(), httpd_send_header(), hurl_parse(), mime_get_attachments(), soap_client_init_args(), soap_client_invoke(), soap_ctx_add_file(), soap_ctx_new_with_method(), soap_env_new_from_buffer(), soap_env_new_from_doc(), soap_env_new_with_fault(), soap_nhttp_client_init_args(), soap_nhttp_register(), soap_nhttp_server_init_args(), soap_nudp_client_init_args(), soap_nudp_register(), soap_nudp_server_init_args(), soap_nudp_server_run(), soap_nudp_server_run_threaded(), soap_router_register_default_service(), soap_router_register_service(), soap_server_init_args(), soap_server_process(), soap_server_register_router(), soap_server_run(), soap_transport_add(), soap_transport_client_init_args(), soap_transport_register(), soap_transport_server_init_args(), soap_transport_server_run(), soap_xmlsec_client_init_args(), soap_xmlsec_decrypt(), soap_xmlsec_encrypt(), soap_xmlsec_server_init_args(), soap_xmlsec_sign(), and soap_xmlsec_verify().

#define THREAD_BEGIN_ERROR   (THREAD_ERROR)
 

Definition at line 80 of file nanohttp-error.h.

#define THREAD_ERROR   1500
 

Thread errors

Definition at line 79 of file nanohttp-error.h.


Typedef Documentation

typedef void* herror_t
 

Todo:
Remove me.
Dummy deklaration to hide the implementation.

Definition at line 98 of file nanohttp-error.h.


Function Documentation

int herror_code herror_t  err  ) 
 

Returns the code of the error.

Definition at line 85 of file nanohttp-error.c.

References _herror_impl_t::errcode, and H_OK.

Referenced by mime_streamreader_function().

const char* herror_func herror_t  err  ) 
 

Returns the name of the function, where the error was produced.

Definition at line 96 of file nanohttp-error.c.

References _herror_impl_t::func.

Referenced by mime_streamreader_function().

const char* herror_message herror_t  err  ) 
 

Returns the error message.

Definition at line 107 of file nanohttp-error.c.

References _herror_impl_t::message.

Referenced by _soap_xmlsec_init(), hrequest_new_from_socket(), hsocket_accept(), hsocket_module_init(), hsocket_open(), hsocket_recv(), hsocket_send(), httpc_get(), httpc_new(), httpc_post_begin(), httpd_init(), httpd_run(), mime_streamreader_function(), soap_client_init_args(), soap_client_invoke(), soap_nhttp_client_init_args(), soap_nhttp_register(), soap_nhttp_server_init_args(), soap_nudp_server_run(), soap_server_init_args(), soap_server_process(), soap_server_register_router(), soap_transport_client_init_args(), soap_transport_register(), soap_transport_server_init_args(), soap_transport_server_run(), and soap_xmlsec_server_init_args().

herror_t herror_new const char *  func,
int  errcode,
const char *  format,
  ...
 

Creates a new error structure.

See also:
printf

Definition at line 59 of file nanohttp-error.c.

References _herror_impl_t::errcode, _herror_impl_t::func, log_error2, and _herror_impl_t::message.

Referenced by _soap_xmlsec_init(), hresponse_new_from_socket(), hsocket_accept(), hsocket_bind(), hsocket_listen(), hsocket_open(), hsocket_recv(), hsocket_send(), hssl_client_ssl(), hssl_read(), hssl_server_ssl(), hssl_write(), http_input_stream_read(), httpc_mime_send_file(), httpd_mime_send_file(), httpd_register_secure(), hurl_parse(), mime_get_attachments(), soap_ctx_add_file(), soap_env_new_from_buffer(), soap_env_new_from_doc(), soap_env_new_with_fault(), soap_env_new_with_method(), soap_env_new_with_response(), soap_nudp_server_init_args(), soap_nudp_server_run_threaded(), soap_router_register_default_service(), soap_router_register_service(), soap_transport_add(), soap_transport_client_invoke(), soap_xmlsec_decrypt(), soap_xmlsec_encrypt(), soap_xmlsec_sign(), and soap_xmlsec_verify().

void herror_release herror_t  err  ) 
 

Frees the error structure.

Definition at line 118 of file nanohttp-error.c.

References _herror_impl_t::func.

Referenced by soap_nudp_server_run(), and soap_server_process().


Generated on Thu Jan 25 23:36:03 2007 for csoap by  doxygen 1.4.6