| ne_request.h | | ne_request.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| License along with this library; if not, write to the Free | | License along with this library; if not, write to the Free | |
| Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, | | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, | |
| MA 02111-1307, USA | | MA 02111-1307, USA | |
| | | | |
| */ | | */ | |
| | | | |
| #ifndef NE_REQUEST_H | | #ifndef NE_REQUEST_H | |
| #define NE_REQUEST_H | | #define NE_REQUEST_H | |
| | | | |
| #include "ne_utils.h" /* For ne_status */ | | #include "ne_utils.h" /* For ne_status */ | |
|
| #include "ne_string.h" /* For sbuffer */ | | #include "ne_string.h" /* For ne_buffer */ | |
| #include "ne_session.h" | | #include "ne_session.h" | |
| | | | |
| BEGIN_NEON_DECLS | | BEGIN_NEON_DECLS | |
| | | | |
| #define NE_OK (0) /* Success */ | | #define NE_OK (0) /* Success */ | |
| #define NE_ERROR (1) /* Generic error; use ne_get_error(session) for messag
e */ | | #define NE_ERROR (1) /* Generic error; use ne_get_error(session) for messag
e */ | |
| #define NE_LOOKUP (2) /* Server or proxy hostname lookup failed */ | | #define NE_LOOKUP (2) /* Server or proxy hostname lookup failed */ | |
| #define NE_AUTH (3) /* User authentication failed on server */ | | #define NE_AUTH (3) /* User authentication failed on server */ | |
| #define NE_PROXYAUTH (4) /* User authentication failed on proxy */ | | #define NE_PROXYAUTH (4) /* User authentication failed on proxy */ | |
| #define NE_CONNECT (5) /* Could not connect to server */ | | #define NE_CONNECT (5) /* Could not connect to server */ | |
| | | | |
| skipping to change at line 165 | | skipping to change at line 165 | |
| void ne_duplicate_header(void *userdata, const char *value); | | void ne_duplicate_header(void *userdata, const char *value); | |
| void ne_handle_numeric_header(void *userdata, const char *value); | | void ne_handle_numeric_header(void *userdata, const char *value); | |
| | | | |
| /* Adds a header to the request with given name and value. */ | | /* Adds a header to the request with given name and value. */ | |
| void ne_add_request_header(ne_request *req, const char *name, | | void ne_add_request_header(ne_request *req, const char *name, | |
| const char *value); | | const char *value); | |
| /* Adds a header to the request with given name, using printf-like | | /* Adds a header to the request with given name, using printf-like | |
| * format arguments for the value. */ | | * format arguments for the value. */ | |
| void ne_print_request_header(ne_request *req, const char *name, | | void ne_print_request_header(ne_request *req, const char *name, | |
| const char *format, ...) | | const char *format, ...) | |
|
| #ifdef __GNUC__ | | ne_attribute((format(printf, 3, 4))); | |
| __attribute__ ((format (printf, 3, 4))) | | | |
| #endif /* __GNUC__ */ | | | |
| ; | | | |
| | | | |
| /* ne_request_dispatch: Sends the given request, and reads the | | /* ne_request_dispatch: Sends the given request, and reads the | |
| * response. Response-Status information can be retrieve with | | * response. Response-Status information can be retrieve with | |
| * ne_get_status(req). | | * ne_get_status(req). | |
| * | | * | |
| * NE_OK if request sent + response read okay. | | * NE_OK if request sent + response read okay. | |
| * NE_AUTH user not authorised on server | | * NE_AUTH user not authorised on server | |
| * NE_PROXYAUTH user not authorised on proxy server | | * NE_PROXYAUTH user not authorised on proxy server | |
| * NE_CONNECT could not connect to server/proxy server | | * NE_CONNECT could not connect to server/proxy server | |
| * NE_TIMEOUT connection timed out mid-request | | * NE_TIMEOUT connection timed out mid-request | |
| * NE_ERROR for other errors, and ne_get_error() should | | * NE_ERROR for other errors, and ne_get_error() should | |
| * return a meaningful error string | | * return a meaningful error string | |
| */ | | */ | |
| int ne_request_dispatch(ne_request *req); | | int ne_request_dispatch(ne_request *req); | |
| | | | |
|
| /* Returns a pointer to the response status information for the | | /* Returns a pointer to the response status information for the given | |
| * given request. */ | | * request; pointer is valid until request object is destroyed. */ | |
| const ne_status *ne_get_status(const ne_request *req) | | const ne_status *ne_get_status(const ne_request *req) ne_attribute((const)) | |
| /* Declare this with attribute const, since we often call it >1 times | | ; | |
| * with the same argument, and it will return the same thing each | | | |
| * time. This lets the compiler optimize away any subsequent calls | | | |
| * (theoretically). */ | | | |
| #ifdef __GNUC__ | | | |
| __attribute__ ((const)) | | | |
| #endif /* __GNUC__ */ | | | |
| ; | | | |
| | | | |
| /* Returns pointer to session associated with request. */ | | /* Returns pointer to session associated with request. */ | |
| ne_session *ne_get_session(const ne_request *req); | | ne_session *ne_get_session(const ne_request *req); | |
| | | | |
| /* Destroy memory associated with request pointer */ | | /* Destroy memory associated with request pointer */ | |
| void ne_request_destroy(ne_request *req); | | void ne_request_destroy(ne_request *req); | |
| | | | |
| /* "Caller-pulls" request interface. This is an ALTERNATIVE interface | | /* "Caller-pulls" request interface. This is an ALTERNATIVE interface | |
| * to ne_request_dispatch: either use that, or do all this yourself: | | * to ne_request_dispatch: either use that, or do all this yourself: | |
| * | | * | |
| | | | |
End of changes. 3 change blocks. |
| 16 lines changed or deleted | | 6 lines changed or added | |
|
| ne_session.h | | ne_session.h | |
| | | | |
| skipping to change at line 184 | | skipping to change at line 184 | |
| * the trailing ':'; e.g. "http" or "https". */ | | * the trailing ':'; e.g. "http" or "https". */ | |
| const char *ne_get_scheme(ne_session *sess); | | const char *ne_get_scheme(ne_session *sess); | |
| | | | |
| /* Sets the host, scheme, and port fields (and no others) of the given | | /* Sets the host, scheme, and port fields (and no others) of the given | |
| * URI structure; host and scheme are malloc-allocated. */ | | * URI structure; host and scheme are malloc-allocated. */ | |
| void ne_fill_server_uri(ne_session *sess, ne_uri *uri); | | void ne_fill_server_uri(ne_session *sess, ne_uri *uri); | |
| | | | |
| /* Set the error string for the session; takes printf-like format | | /* Set the error string for the session; takes printf-like format | |
| * string. */ | | * string. */ | |
| void ne_set_error(ne_session *sess, const char *format, ...) | | void ne_set_error(ne_session *sess, const char *format, ...) | |
|
| #ifdef __GNUC__ | | ne_attribute((format (printf, 2, 3))); | |
| __attribute__ ((format (printf, 2, 3))) | | | |
| #endif /* __GNUC__ */ | | | |
| ; | | | |
| | | | |
| /* Retrieve the error string for the session */ | | /* Retrieve the error string for the session */ | |
| const char *ne_get_error(ne_session *sess); | | const char *ne_get_error(ne_session *sess); | |
| | | | |
| END_NEON_DECLS | | END_NEON_DECLS | |
| | | | |
| #endif /* NE_SESSION_H */ | | #endif /* NE_SESSION_H */ | |
| | | | |
End of changes. 1 change blocks. |
| 4 lines changed or deleted | | 1 lines changed or added | |
|
| ne_utils.h | | ne_utils.h | |
| | | | |
| skipping to change at line 98 | | skipping to change at line 98 | |
| * as 0. */ | | * as 0. */ | |
| void ne_debug_init(FILE *stream, int mask); | | void ne_debug_init(FILE *stream, int mask); | |
| | | | |
| /* The current debug mask and stream set by the last call to | | /* The current debug mask and stream set by the last call to | |
| * ne_debug_init. */ | | * ne_debug_init. */ | |
| extern int ne_debug_mask; | | extern int ne_debug_mask; | |
| extern FILE *ne_debug_stream; | | extern FILE *ne_debug_stream; | |
| | | | |
| /* Produce debug output if any of channels 'ch' is enabled for | | /* Produce debug output if any of channels 'ch' is enabled for | |
| * debugging. */ | | * debugging. */ | |
|
| void ne_debug(int ch, const char *, ...) | | void ne_debug(int ch, const char *, ...) ne_attribute((format(printf, 2, 3) | |
| #ifdef __GNUC__ | | )); | |
| __attribute__ ((format (printf, 2, 3))) | | | |
| #endif /* __GNUC__ */ | | | |
| ; | | | |
| | | | |
| /* Storing an HTTP status result */ | | /* Storing an HTTP status result */ | |
| typedef struct { | | typedef struct { | |
| int major_version; | | int major_version; | |
| int minor_version; | | int minor_version; | |
| int code; /* Status-Code value */ | | int code; /* Status-Code value */ | |
| int klass; /* Class of Status-Code (1-5) */ | | int klass; /* Class of Status-Code (1-5) */ | |
| char *reason_phrase; | | char *reason_phrase; | |
| } ne_status; | | } ne_status; | |
| | | | |
| | | | |
End of changes. 1 change blocks. |
| 5 lines changed or deleted | | 2 lines changed or added | |
|