| ne_207.h | | ne_207.h | |
| /* | | /* | |
| WebDAV 207 multi-status response handling | | WebDAV 207 multi-status response handling | |
|
| Copyright (C) 1999-2004, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU Library General Public | | You should have received a copy of the GNU Library General Public | |
| 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 DAV207_H | | #ifndef NE_207_H | |
| #define DAV207_H | | #define NE_207_H | |
| | | | |
| #include "ne_xml.h" | | #include "ne_xml.h" | |
| #include "ne_request.h" /* for ne_request */ | | #include "ne_request.h" /* for ne_request */ | |
|
| | | #include "ne_uri.h" /* for ne_uri */ | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_DECLS | |
| | | | |
| /* The defined state integer for the '{DAV:}prop' element. */ | | /* The defined state integer for the '{DAV:}prop' element. */ | |
| #define NE_207_STATE_PROP (50) | | #define NE_207_STATE_PROP (50) | |
| /* This interface reserves the state integers 'x' where 0 < x < 100 */ | | /* This interface reserves the state integers 'x' where 0 < x < 100 */ | |
| #define NE_207_STATE_TOP (100) | | #define NE_207_STATE_TOP (100) | |
| | | | |
| /* Handling of 207 multistatus XML documents. A "multistatus" | | /* Handling of 207 multistatus XML documents. A "multistatus" | |
| * document is made up of a set of responses, each concerned with a | | * document is made up of a set of responses, each concerned with a | |
| * particular resource. Each response may have an associated result | | * particular resource. Each response may have an associated result | |
| * status and failure description. A response is made up of a set of | | * status and failure description. A response is made up of a set of | |
| * propstats, each of which again may have an associated result status | | * propstats, each of which again may have an associated result status | |
| * and failure description. */ | | * and failure description. */ | |
| | | | |
| /* Start and end response callbacks trigger at the start and end of | | /* Start and end response callbacks trigger at the start and end of | |
|
| * each "response" within the multistatus body. 'href' gives the URI | | * each "response" within the multistatus body. 'uri' gives the URI | |
| * of the resource which is subject of this response. The return | | * of the resource which is subject of this response. The return | |
| * value of a 'start_response' callback is passed as the 'response' | | * value of a 'start_response' callback is passed as the 'response' | |
| * parameter to the corresponding 'end_response' parameter. */ | | * parameter to the corresponding 'end_response' parameter. */ | |
|
| typedef void *ne_207_start_response(void *userdata, const char *href); | | typedef void *ne_207_start_response(void *userdata, const ne_uri *uri); | |
| typedef void ne_207_end_response(void *userdata, void *response, | | typedef void ne_207_end_response(void *userdata, void *response, | |
| const ne_status *status, | | const ne_status *status, | |
| const char *description); | | const char *description); | |
| | | | |
| /* Similarly, start and end callbacks for each propstat within the | | /* Similarly, start and end callbacks for each propstat within the | |
| * response. The return value of the 'start_response' callback for | | * response. The return value of the 'start_response' callback for | |
| * the response in which this propstat is contains is passed as the | | * the response in which this propstat is contains is passed as the | |
| * 'response' parameter. The return value of each 'start_propstat' is | | * 'response' parameter. The return value of each 'start_propstat' is | |
| * passed as the 'propstat' parameter' to the corresponding | | * passed as the 'propstat' parameter' to the corresponding | |
| * 'end_propstat' callback. If the start_propstat callback returns | | * 'end_propstat' callback. If the start_propstat callback returns | |
| * NULL, parsing is aborted (the XML parser error must be set by the | | * NULL, parsing is aborted (the XML parser error must be set by the | |
| * callback). */ | | * callback). */ | |
| typedef void *ne_207_start_propstat(void *userdata, void *response); | | typedef void *ne_207_start_propstat(void *userdata, void *response); | |
| typedef void ne_207_end_propstat(void *userdata, void *propstat, | | typedef void ne_207_end_propstat(void *userdata, void *propstat, | |
| const ne_status *status, | | const ne_status *status, | |
| const char *description); | | const char *description); | |
| | | | |
| typedef struct ne_207_parser_s ne_207_parser; | | typedef struct ne_207_parser_s ne_207_parser; | |
| | | | |
| /* Create 207 parser an add the handlers the the given parser's | | /* Create 207 parser an add the handlers the the given parser's | |
|
| * handler stack. */ | | * handler stack. URI references in the 207 response will be resolved | |
| ne_207_parser *ne_207_create(ne_xml_parser *parser, void *userdata); | | * relative to the base URI 'base'. */ | |
| | | ne_207_parser *ne_207_create(ne_xml_parser *parser, const ne_uri *base, | |
| | | void *userdata); | |
| | | | |
| /* Register response handling callbacks. */ | | /* Register response handling callbacks. */ | |
| void ne_207_set_response_handlers(ne_207_parser *p, | | void ne_207_set_response_handlers(ne_207_parser *p, | |
| ne_207_start_response *start, | | ne_207_start_response *start, | |
| ne_207_end_response *end); | | ne_207_end_response *end); | |
| | | | |
| /* Register propstat handling callbacks. */ | | /* Register propstat handling callbacks. */ | |
| void ne_207_set_propstat_handlers(ne_207_parser *p, | | void ne_207_set_propstat_handlers(ne_207_parser *p, | |
| ne_207_start_propstat *start, | | ne_207_start_propstat *start, | |
| ne_207_end_propstat *end); | | ne_207_end_propstat *end); | |
| | | | |
| skipping to change at line 98 | | skipping to change at line 101 | |
| void *ne_207_get_current_response(ne_207_parser *p); | | void *ne_207_get_current_response(ne_207_parser *p); | |
| | | | |
| /* Dispatch request 'req', returning: | | /* Dispatch request 'req', returning: | |
| * NE_ERROR: for a dispatch error, or a non-2xx response, or a | | * NE_ERROR: for a dispatch error, or a non-2xx response, or a | |
| * 207 response which contained a non-2xx propstat | | * 207 response which contained a non-2xx propstat | |
| * NE_OK: for a 2xx response or a 207 response which contained | | * NE_OK: for a 2xx response or a 207 response which contained | |
| * only 2xx-class propstats. | | * only 2xx-class propstats. | |
| * The request object is destroyed in both cases. */ | | * The request object is destroyed in both cases. */ | |
| int ne_simple_request(ne_session *sess, ne_request *req); | | int ne_simple_request(ne_session *sess, ne_request *req); | |
| | | | |
|
| END_NEON_DECLS | | NE_END_DECLS | |
| | | | |
|
| #endif /* DAV207_H */ | | #endif /* NE_207_H */ | |
| | | | |
End of changes. 9 change blocks. |
| 9 lines changed or deleted | | 12 lines changed or added | |
|
| ne_auth.h | | ne_auth.h | |
| /* | | /* | |
| HTTP authentication routines | | HTTP authentication routines | |
|
| Copyright (C) 1999-2002, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| 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_AUTH_H | | #ifndef NE_AUTH_H | |
| #define NE_AUTH_H | | #define NE_AUTH_H | |
| | | | |
| #include "ne_session.h" /* for ne_session */ | | #include "ne_session.h" /* for ne_session */ | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_DECLS | |
| | | | |
| /* Size of username/password buffers passed to ne_auth_creds | | /* Size of username/password buffers passed to ne_auth_creds | |
| * callback. */ | | * callback. */ | |
| #define NE_ABUFSIZ (256) | | #define NE_ABUFSIZ (256) | |
| | | | |
| /* The callback used to request the username and password in the given | | /* The callback used to request the username and password in the given | |
| * realm. The username and password must be copied into the buffers | | * realm. The username and password must be copied into the buffers | |
| * which are both of size NE_ABUFSIZ. The 'attempt' parameter is zero | | * which are both of size NE_ABUFSIZ. The 'attempt' parameter is zero | |
| * on the first call to the callback, and increases by one each time | | * on the first call to the callback, and increases by one each time | |
| * an attempt to authenticate fails. | | * an attempt to authenticate fails. | |
| * | | * | |
| * The callback must return zero to indicate that authentication | | * The callback must return zero to indicate that authentication | |
| * should be attempted with the username/password, or non-zero to | | * should be attempted with the username/password, or non-zero to | |
| * cancel the request. (if non-zero, username and password are | | * cancel the request. (if non-zero, username and password are | |
|
| * ignored.) */ | | * ignored.) | |
| | | * | |
| | | * IMPORTANT NOTE: The callback will be invoked repeatedly until | |
| | | * either it returns non-zero, or authentication is successful. | |
| | | * | |
| | | * Hint: if you just wish to attempt authentication just once (even if | |
| | | * the user gets the username/password wrong), have the callback | |
| | | * function use 'attempt' value as the function return value. */ | |
| typedef int (*ne_auth_creds)(void *userdata, const char *realm, int attempt
, | | typedef int (*ne_auth_creds)(void *userdata, const char *realm, int attempt
, | |
| char *username, char *password); | | char *username, char *password); | |
| | | | |
|
| /* TOP TIP: if you just wish to try authenticating once (even if the | | | |
| * user gets the username/password wrong), have your implementation of | | | |
| * the callback return the 'attempt' value. */ | | | |
| | | | |
| /* Set callbacks to provide credentials for server and proxy | | /* Set callbacks to provide credentials for server and proxy | |
|
| * authentication. userdata is passed as the first argument to the | | * authentication, using the default set of authentication protocols. | |
| * callback. The callback is called *indefinitely* until either it | | * userdata is passed as the first argument to the callback. */ | |
| * returns non-zero, or authentication is successful. */ | | | |
| void ne_set_server_auth(ne_session *sess, ne_auth_creds creds, void *userda
ta); | | void ne_set_server_auth(ne_session *sess, ne_auth_creds creds, void *userda
ta); | |
| void ne_set_proxy_auth(ne_session *sess, ne_auth_creds creds, void *userdat
a); | | void ne_set_proxy_auth(ne_session *sess, ne_auth_creds creds, void *userdat
a); | |
| | | | |
|
| /* Clear any stored authentication details for the given session. */ | | /* As an alternative to using ne_set_server_auth and | |
| | | * ne_set_proxy_auth, the following interfaces may be used; these | |
| | | * allow control over which authentication protocol is used. */ | |
| | | | |
| | | /* NE_AUTH_BASIC: Basic authentication transmits the username and | |
| | | * password unprotected over the channel; this allows a passive attack | |
| | | * to steal the credentials if using an unsecured channel | |
| | | * (i.e. non-SSL). */ | |
| | | #define NE_AUTH_BASIC (0x0001) | |
| | | /* NE_AUTH_DIGEST: Digest authentication uses a hash of the username, | |
| | | * password, and certain aspects of the request, so prevents passive | |
| | | * attackers from obtaining the credentials; active attackers can | |
| | | * still modify most of the request/response if using an unsecured | |
| | | * channel. */ | |
| | | #define NE_AUTH_DIGEST (0x0002) | |
| | | /* NE_AUTH_NEGOTIATE: Negotiate uses GSSAPI/SSPI to authenticate the | |
| | | * user; an active attacker can modify any of the request/response at | |
| | | * will, so this must not be used over an unsecured channel. */ | |
| | | #define NE_AUTH_NEGOTIATE (0x0004) | |
| | | /* All supported protocols. */ | |
| | | #define NE_AUTH_ALL (NE_AUTH_BASIC | NE_AUTH_DIGEST | NE_AUTH_NEGOTIATE) | |
| | | | |
| | | /* Add a callback to provide credentials for server and proxy | |
| | | * authentication using a particular auth protocol or set of | |
| | | * protocols. The protocol is supplied as a bitmask of NE_AUTH_* | |
| | | * values. For NE_AUTH_NEGOTIATE, the creds and userdata arguments | |
| | | * are ignored and may be NULL. | |
| | | * | |
| | | * These functions may be called multiple times per session to | |
| | | * register callbacks for different protocols. If the server presents | |
| | | * more than one protocol in an auth challenge, the following | |
| | | * algorithm will be used to determine which callback is used: | |
| | | * | |
| | | * - iterate over the registered callbacks in the order registered | |
| | | * - for each each callback, iterate over the known set of protocols | |
| | | * in order of algorithm strength (strongest first). | |
| | | * - if the protocol mask for that callback matches the protocol, | |
| | | * attempt authentication using this protocol. | |
| | | * | |
| | | * Therefore, if multiple calls to ne_add_server_auth or | |
| | | * ne_add_proxy_auth are used for a given session, the caller must | |
| | | * ensure that the order in which those calls are made reflects the | |
| | | * precedence of protocols to be used. */ | |
| | | void ne_add_server_auth(ne_session *sess, unsigned protocol, | |
| | | ne_auth_creds creds, void *userdata); | |
| | | void ne_add_proxy_auth(ne_session *sess, unsigned protocol, | |
| | | ne_auth_creds creds, void *userdata); | |
| | | | |
| | | /* Clear any cached authentication credentials for the given | |
| | | * session. */ | |
| void ne_forget_auth(ne_session *sess); | | void ne_forget_auth(ne_session *sess); | |
| | | | |
|
| END_NEON_DECLS | | NE_END_DECLS | |
| | | | |
| #endif /* NE_AUTH_H */ | | #endif /* NE_AUTH_H */ | |
| | | | |
End of changes. 7 change blocks. |
| 12 lines changed or deleted | | 63 lines changed or added | |
|
| ne_dates.h | | ne_dates.h | |
| /* | | /* | |
| Date manipulation routines | | Date manipulation routines | |
|
| Copyright (C) 1999-2002, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2002, 2005, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU Library General Public | | You should have received a copy of the GNU Library General Public | |
| 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 DATES_H | | #ifndef NE_DATES_H | |
| #define DATES_H | | #define NE_DATES_H | |
| | | | |
| #include <sys/types.h> | | #include <sys/types.h> | |
| | | | |
| #include "ne_defs.h" | | #include "ne_defs.h" | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_DECLS | |
| | | | |
| /* Date manipulation routines as per RFC1123 and RFC1036 */ | | /* Date manipulation routines as per RFC1123 and RFC1036 */ | |
| | | | |
| /* Return current date/time in RFC1123 format */ | | /* Return current date/time in RFC1123 format */ | |
| char *ne_rfc1123_date(time_t anytime); | | char *ne_rfc1123_date(time_t anytime); | |
| | | | |
| /* Returns time from date/time using the subset of the ISO8601 format | | /* Returns time from date/time using the subset of the ISO8601 format | |
| * referenced in RFC2518 (e.g as used in the creationdate property in | | * referenced in RFC2518 (e.g as used in the creationdate property in | |
| * the DAV: namespace). */ | | * the DAV: namespace). */ | |
| time_t ne_iso8601_parse(const char *date); | | time_t ne_iso8601_parse(const char *date); | |
| | | | |
| skipping to change at line 52 | | skipping to change at line 52 | |
| time_t ne_rfc1123_parse(const char *date); | | time_t ne_rfc1123_parse(const char *date); | |
| | | | |
| time_t ne_rfc1036_parse(const char *date); | | time_t ne_rfc1036_parse(const char *date); | |
| | | | |
| /* Parses asctime date string */ | | /* Parses asctime date string */ | |
| time_t ne_asctime_parse(const char *date); | | time_t ne_asctime_parse(const char *date); | |
| | | | |
| /* Parse an HTTP-date as per RFC2616 */ | | /* Parse an HTTP-date as per RFC2616 */ | |
| time_t ne_httpdate_parse(const char *date); | | time_t ne_httpdate_parse(const char *date); | |
| | | | |
|
| END_NEON_DECLS | | NE_END_DECLS | |
| | | | |
|
| #endif /* DATES_H */ | | #endif /* NE_DATES_H */ | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 5 lines changed or added | |
|
| ne_i18n.h | | ne_i18n.h | |
| /* | | /* | |
| Internationalization of neon | | Internationalization of neon | |
|
| Copyright (C) 1999-2002, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 2005-2006, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU Library General Public | | You should have received a copy of the GNU Library General Public | |
| 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 NEON_I18N_H | | #ifndef NE_I18N_H | |
| #define NEON_I18N_H | | #define NE_I18N_H | |
| | | | |
|
| #undef _ | | #include "ne_defs.h" | |
| #ifdef ENABLE_NLS | | | |
| #include <libintl.h> | | | |
| #define _(str) gettext(str) | | | |
| #else | | | |
| #define _(str) (str) | | | |
| #endif /* ENABLE_NLS */ | | | |
| #define N_(str) (str) | | | |
| | | | |
|
| /* Initialize i18n in neon */ | | NE_BEGIN_DECLS | |
| void neon_i18n_init(void); | | | |
| | | | |
|
| #endif /* NEON_I18N_H */ | | /* Initialize translated error messages within neon. If 'encoding' is | |
| | | * non-NULL, it specifies the character encoding for the generated | |
| | | * translated strings. If it is NULL, the appropriate character | |
| | | * encoding for the locale will be used. | |
| | | * | |
| | | * This call is only strictly necessary if either: | |
| | | * | |
| | | * a) neon has been installed into a different prefix than the | |
| | | * gettext() implementation on which it depends for i18n purposes, or | |
| | | * | |
| | | * b) the caller requires that translated messages are in a particular | |
| | | * character encoding. | |
| | | * | |
| | | * If ne_i18n_init() is never called, the message catalogs will not be | |
| | | * found if case (a) applies (and so English error messages will be | |
| | | * used), and will use the default character encoding specified by the | |
| | | * process locale. The library will otherwise operate correctly. | |
| | | * | |
| | | * Note that the encoding used is a process-global setting and so | |
| | | * results may be unexpected if other users of neon within the process | |
| | | * call ne_i18n_init() with a different encoding parameter. | |
| | | */ | |
| | | void ne_i18n_init(const char *encoding); | |
| | | | |
| | | NE_END_DECLS | |
| | | | |
| | | #endif /* NE_I18N_H */ | |
| | | | |
End of changes. 5 change blocks. |
| 13 lines changed or deleted | | 5 lines changed or added | |
|
| ne_locks.h | | ne_locks.h | |
| /* | | /* | |
| WebDAV Class 2 locking operations | | WebDAV Class 2 locking operations | |
|
| Copyright (C) 1999-2002, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| MA 02111-1307, USA | | MA 02111-1307, USA | |
| | | | |
| */ | | */ | |
| | | | |
| #ifndef NE_LOCKS_H | | #ifndef NE_LOCKS_H | |
| #define NE_LOCKS_H | | #define NE_LOCKS_H | |
| | | | |
| #include "ne_request.h" /* for ne_session + ne_request */ | | #include "ne_request.h" /* for ne_session + ne_request */ | |
| #include "ne_uri.h" /* for ne_uri */ | | #include "ne_uri.h" /* for ne_uri */ | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_DECLS | |
| | | | |
| /* The scope of a lock */ | | /* The scope of a lock */ | |
| enum ne_lock_scope { | | enum ne_lock_scope { | |
| ne_lockscope_exclusive, | | ne_lockscope_exclusive, | |
| ne_lockscope_shared | | ne_lockscope_shared | |
| }; | | }; | |
| | | | |
| /* Lock type. Only write locks are defined in RFC2518. */ | | /* Lock type. Only write locks are defined in RFC2518. */ | |
| enum ne_lock_type { | | enum ne_lock_type { | |
| ne_locktype_write | | ne_locktype_write | |
| | | | |
| skipping to change at line 140 | | skipping to change at line 140 | |
| /* Refresh a lock. Updates lock->timeout appropriately. */ | | /* Refresh a lock. Updates lock->timeout appropriately. */ | |
| int ne_lock_refresh(ne_session *sess, struct ne_lock *lock); | | int ne_lock_refresh(ne_session *sess, struct ne_lock *lock); | |
| | | | |
| /* Callback for lock discovery. If 'lock' is NULL, something went | | /* Callback for lock discovery. If 'lock' is NULL, something went | |
| * wrong performing lockdiscovery for the resource, look at 'status' | | * wrong performing lockdiscovery for the resource, look at 'status' | |
| * for the details. | | * for the details. | |
| * | | * | |
| * If lock is non-NULL, at least lock->uri and lock->token will be | | * If lock is non-NULL, at least lock->uri and lock->token will be | |
| * filled in; and status will be NULL. */ | | * filled in; and status will be NULL. */ | |
| typedef void (*ne_lock_result)(void *userdata, const struct ne_lock *lock, | | typedef void (*ne_lock_result)(void *userdata, const struct ne_lock *lock, | |
|
| const char *uri, const ne_status *status); | | const ne_uri *uri, const ne_status *status); | |
| | | | |
| /* Perform lock discovery on the given path. 'result' is called with | | /* Perform lock discovery on the given path. 'result' is called with | |
| * the results (possibly >1 times). */ | | * the results (possibly >1 times). */ | |
| int ne_lock_discover(ne_session *sess, const char *path, | | int ne_lock_discover(ne_session *sess, const char *path, | |
| ne_lock_result result, void *userdata); | | ne_lock_result result, void *userdata); | |
| | | | |
| /* The ne_lock_using_* functions should be used before dispatching a | | /* The ne_lock_using_* functions should be used before dispatching a | |
| * request which modify resources. If a lock store has been | | * request which modify resources. If a lock store has been | |
| * registered with the session associated with the request, and locks | | * registered with the session associated with the request, and locks | |
| * are present in the lock store which cover the resources which are | | * are present in the lock store which cover the resources which are | |
| | | | |
| skipping to change at line 163 | | skipping to change at line 163 | |
| | | | |
| /* Indicate that request 'req' will modify the resource at 'path', and | | /* Indicate that request 'req' will modify the resource at 'path', and | |
| * is an operation of given 'depth'. */ | | * is an operation of given 'depth'. */ | |
| void ne_lock_using_resource(ne_request *req, const char *path, int depth); | | void ne_lock_using_resource(ne_request *req, const char *path, int depth); | |
| | | | |
| /* Indicate that request 'req' will modify the parent collection of | | /* Indicate that request 'req' will modify the parent collection of | |
| * the resource found at 'path' (for instance when removing the | | * the resource found at 'path' (for instance when removing the | |
| * resource from the collection). */ | | * resource from the collection). */ | |
| void ne_lock_using_parent(ne_request *req, const char *path); | | void ne_lock_using_parent(ne_request *req, const char *path); | |
| | | | |
|
| END_NEON_DECLS | | NE_END_DECLS | |
| | | | |
| #endif /* NE_LOCKS_H */ | | #endif /* NE_LOCKS_H */ | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 4 lines changed or added | |
|
| ne_md5.h | | ne_md5.h | |
| /* Declaration of functions and data types used for MD5 sum computing | | /* Declaration of functions and data types used for MD5 sum computing | |
| library functions. | | library functions. | |
|
| | | Copyright (C) 2006, Joe Orton <joe@manyfish.co.uk> | |
| Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. | | Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. | |
| This file is part of the GNU C Library. | | This file is part of the GNU C Library. | |
| | | | |
| The GNU C Library is free software; you can redistribute it and/or | | The GNU C Library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public License as | | modify it under the terms of the GNU Library General Public License as | |
| published by the Free Software Foundation; either version 2 of the | | published by the Free Software Foundation; either version 2 of the | |
| License, or (at your option) any later version. | | License, or (at your option) any later version. | |
| | | | |
| The GNU C Library is distributed in the hope that it will be useful, | | The GNU C Library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 27 | |
| You should have received a copy of the GNU Library General Public | | You should have received a copy of the GNU Library General Public | |
| License along with the GNU C Library; see the file COPYING.LIB. If not, | | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
| write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330
, | | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330
, | |
| Boston, MA 02111-1307, USA. */ | | Boston, MA 02111-1307, USA. */ | |
| | | | |
| #ifndef NEON_MD5_H | | #ifndef NEON_MD5_H | |
| #define NEON_MD5_H 1 | | #define NEON_MD5_H 1 | |
| | | | |
| #include <stdio.h> | | #include <stdio.h> | |
| | | | |
|
| #if defined HAVE_LIMITS_H || _LIBC | | | |
| # include <limits.h> | | | |
| #endif | | | |
| | | | |
| /* The following contortions are an attempt to use the C preprocessor | | | |
| to determine an unsigned integral type that is 32 bits wide. An | | | |
| alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but | | | |
| doing that would require that the configure script compile and *run* | | | |
| the resulting executable. Locally running cross-compiled executables | | | |
| is usually not possible. */ | | | |
| | | | |
| #ifdef _LIBC | | | |
| # include <sys/types.h> | | | |
| typedef u_int32_t md5_uint32; | | | |
| #else | | | |
| # if defined __STDC__ && __STDC__ | | | |
| # define UINT_MAX_32_BITS 4294967295U | | | |
| # else | | | |
| # define UINT_MAX_32_BITS 0xFFFFFFFF | | | |
| # endif | | | |
| | | | |
| /* If UINT_MAX isn't defined, assume it's a 32-bit type. | | | |
| This should be valid for all systems GNU cares about because | | | |
| that doesn't include 16-bit systems, and only modern systems | | | |
| (that certainly have <limits.h>) have 64+-bit integral types. */ | | | |
| | | | |
| # ifndef UINT_MAX | | | |
| # define UINT_MAX UINT_MAX_32_BITS | | | |
| # endif | | | |
| | | | |
| # if UINT_MAX == UINT_MAX_32_BITS | | | |
| typedef unsigned int md5_uint32; | | | |
| # else | | | |
| # if USHRT_MAX == UINT_MAX_32_BITS | | | |
| typedef unsigned short md5_uint32; | | | |
| # else | | | |
| # if ULONG_MAX == UINT_MAX_32_BITS | | | |
| typedef unsigned long md5_uint32; | | | |
| # else | | | |
| /* The following line is intended to evoke an error. | | | |
| Using #error is not portable enough. */ | | | |
| "Cannot determine unsigned 32-bit data type." | | | |
| # endif | | | |
| # endif | | | |
| # endif | | | |
| #endif | | | |
| | | | |
| #undef __P | | | |
| #if defined (__STDC__) && __STDC__ | | | |
| # define __P(x) x | | | |
| #else | | | |
| # define __P(x) () | | | |
| #endif | | | |
| | | | |
| /* Structure to save state of computation between the single steps. */ | | | |
| struct ne_md5_ctx | | | |
| { | | | |
| md5_uint32 A; | | | |
| md5_uint32 B; | | | |
| md5_uint32 C; | | | |
| md5_uint32 D; | | | |
| | | | |
| md5_uint32 total[2]; | | | |
| md5_uint32 buflen; | | | |
| char buffer[128]; | | | |
| }; | | | |
| | | | |
| /* | | /* | |
| * The following three functions are build up the low level used in | | * The following three functions are build up the low level used in | |
| * the functions `md5_stream' and `md5_buffer'. | | * the functions `md5_stream' and `md5_buffer'. | |
| */ | | */ | |
|
| | | struct ne_md5_ctx; | |
| | | | |
|
| /* Initialize structure containing state of computation. | | /* Create structure containing state of computation. */ | |
| (RFC 1321, 3.3: Step 3) */ | | extern struct ne_md5_ctx *ne_md5_create_ctx(void); | |
| extern void ne_md5_init_ctx __P ((struct ne_md5_ctx *ctx)); | | | |
| | | | |
| /* Starting with the result of former calls of this function (or the | | /* Starting with the result of former calls of this function (or the | |
| initialization function update the context for the next LEN bytes | | initialization function update the context for the next LEN bytes | |
| starting at BUFFER. | | starting at BUFFER. | |
| It is necessary that LEN is a multiple of 64!!! */ | | It is necessary that LEN is a multiple of 64!!! */ | |
|
| extern void ne_md5_process_block __P ((const void *buffer, size_t len, | | extern void ne_md5_process_block(const void *buffer, size_t len, | |
| struct ne_md5_ctx *ctx)); | | struct ne_md5_ctx *ctx); | |
| | | | |
| /* Starting with the result of former calls of this function (or the | | /* Starting with the result of former calls of this function (or the | |
| initialization function update the context for the next LEN bytes | | initialization function update the context for the next LEN bytes | |
| starting at BUFFER. | | starting at BUFFER. | |
| It is NOT required that LEN is a multiple of 64. */ | | It is NOT required that LEN is a multiple of 64. */ | |
|
| extern void ne_md5_process_bytes __P ((const void *buffer, size_t len, | | extern void ne_md5_process_bytes(const void *buffer, size_t len, | |
| struct ne_md5_ctx *ctx)); | | struct ne_md5_ctx *ctx); | |
| | | | |
| /* Process the remaining bytes in the buffer and put result from CTX | | /* Process the remaining bytes in the buffer and put result from CTX | |
| in first 16 bytes following RESBUF. The result is always in little | | in first 16 bytes following RESBUF. The result is always in little | |
| endian byte order, so that a byte-wise output yields to the wanted | | endian byte order, so that a byte-wise output yields to the wanted | |
| ASCII representation of the message digest. | | ASCII representation of the message digest. | |
| | | | |
| IMPORTANT: On some systems it is required that RESBUF is correctly | | IMPORTANT: On some systems it is required that RESBUF is correctly | |
| aligned for a 32 bits value. */ | | aligned for a 32 bits value. */ | |
|
| extern void *ne_md5_finish_ctx __P ((struct ne_md5_ctx *ctx, void *resbuf))
; | | extern void *ne_md5_finish_ctx(struct ne_md5_ctx *ctx, void *resbuf); | |
| | | | |
| /* Put result from CTX in first 16 bytes following RESBUF. The result is | | /* Put result from CTX in first 16 bytes following RESBUF. The result is | |
| always in little endian byte order, so that a byte-wise output yields | | always in little endian byte order, so that a byte-wise output yields | |
| to the wanted ASCII representation of the message digest. | | to the wanted ASCII representation of the message digest. | |
| | | | |
| IMPORTANT: On some systems it is required that RESBUF is correctly | | IMPORTANT: On some systems it is required that RESBUF is correctly | |
| aligned for a 32 bits value. */ | | aligned for a 32 bits value. */ | |
|
| extern void *ne_md5_read_ctx __P ((const struct ne_md5_ctx *ctx, void *resb | | extern void *ne_md5_read_ctx(const struct ne_md5_ctx *ctx, void *resbuf); | |
| uf)); | | | |
| | | /* Take a copy of the state structure. */ | |
| | | extern struct ne_md5_ctx *ne_md5_dup_ctx(struct ne_md5_ctx *ctx); | |
| | | | |
| | | /* Re-initialize the context structure. */ | |
| | | extern void ne_md5_reset_ctx(struct ne_md5_ctx *ctx); | |
| | | | |
| | | /* Destroy the context structure. */ | |
| | | extern void ne_md5_destroy_ctx(struct ne_md5_ctx *ctx); | |
| | | | |
| /* Compute MD5 message digest for bytes read from STREAM. The | | /* Compute MD5 message digest for bytes read from STREAM. The | |
| resulting message digest number will be written into the 16 bytes | | resulting message digest number will be written into the 16 bytes | |
| beginning at RESBLOCK. */ | | beginning at RESBLOCK. */ | |
|
| extern int ne_md5_stream __P ((FILE *stream, void *resblock)); | | extern int ne_md5_stream(FILE *stream, void *resblock); | |
| | | | |
| | | /* Process the remaining bytes in the buffer and put ASCII | |
| | | representation of the resulting message digest from CTX in the | |
| | | first 33 bytes of BUFFER, including a trailing NUL terminator | |
| | | byte. Returns pointer to buffer. */ | |
| | | char *ne_md5_finish_ascii(struct ne_md5_ctx *ctx, char buffer[33]); | |
| | | | |
| /* MD5 ascii->binary conversion */ | | /* MD5 ascii->binary conversion */ | |
| void ne_md5_to_ascii(const unsigned char md5_buf[16], char *buffer); | | void ne_md5_to_ascii(const unsigned char md5_buf[16], char *buffer); | |
| void ne_ascii_to_md5(const char *buffer, unsigned char md5_buf[16]); | | void ne_ascii_to_md5(const char *buffer, unsigned char md5_buf[16]); | |
| | | | |
| #endif /* NEON_MD5_H */ | | #endif /* NEON_MD5_H */ | |
| | | | |
End of changes. 9 change blocks. |
| 78 lines changed or deleted | | 26 lines changed or added | |
|
| ne_props.h | | ne_props.h | |
| /* | | /* | |
| WebDAV Properties manipulation | | WebDAV Properties manipulation | |
|
| Copyright (C) 1999-2004, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| MA 02111-1307, USA | | MA 02111-1307, USA | |
| | | | |
| */ | | */ | |
| | | | |
| #ifndef NE_PROPS_H | | #ifndef NE_PROPS_H | |
| #define NE_PROPS_H | | #define NE_PROPS_H | |
| | | | |
| #include "ne_request.h" | | #include "ne_request.h" | |
| #include "ne_207.h" | | #include "ne_207.h" | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_DECLS | |
| | | | |
| /* There are two interfaces for fetching properties. The first is | | /* There are two interfaces for fetching properties. The first is | |
| * 'ne_simple_propfind', which is relatively simple, and easy to use, | | * 'ne_simple_propfind', which is relatively simple, and easy to use, | |
| * but only lets you fetch FLAT properties, i.e. properties which are | | * but only lets you fetch FLAT properties, i.e. properties which are | |
| * just a string of bytes. The complex interface is 'ne_propfind_*', | | * just a string of bytes. The complex interface is 'ne_propfind_*', | |
| * which is complicated, and hard to use, but lets you parse | | * which is complicated, and hard to use, but lets you parse | |
| * structured properties, i.e. properties which have XML content. */ | | * structured properties, i.e. properties which have XML content. */ | |
| | | | |
| /* The 'ne_simple_propfind' interface. *** | | /* The 'ne_simple_propfind' interface. *** | |
| * | | * | |
| | | | |
| skipping to change at line 51 | | skipping to change at line 51 | |
| * going by passing these arguments: | | * going by passing these arguments: | |
| * | | * | |
| * - the session which should be used. | | * - the session which should be used. | |
| * - the URI and the depth of the operation (0, 1, infinite) | | * - the URI and the depth of the operation (0, 1, infinite) | |
| * - the names of the properties which you want to fetch | | * - the names of the properties which you want to fetch | |
| * - a results callback, and the userdata for the callback. | | * - a results callback, and the userdata for the callback. | |
| * | | * | |
| * For each resource found, the results callback is called, passing | | * For each resource found, the results callback is called, passing | |
| * you two things along with the userdata you passed in originally: | | * you two things along with the userdata you passed in originally: | |
| * | | * | |
|
| * - the URI of the resource (const char *href) | | * - the URI of the resource (const ne_uri *uri) | |
| * - the properties results set (const ne_prop_result_set *results) | | * - the properties results set (const ne_prop_result_set *results) | |
| * */ | | * */ | |
| | | | |
| /* The name of a WebDAV property. 'nspace' may be NULL. */ | | /* The name of a WebDAV property. 'nspace' may be NULL. */ | |
| typedef struct { | | typedef struct { | |
| const char *nspace, *name; | | const char *nspace, *name; | |
| } ne_propname; | | } ne_propname; | |
| | | | |
| typedef struct ne_prop_result_set_s ne_prop_result_set; | | typedef struct ne_prop_result_set_s ne_prop_result_set; | |
| | | | |
| | | | |
| skipping to change at line 105 | | skipping to change at line 105 | |
| /* Iterate over all the properties in 'set', calling 'iterator' | | /* Iterate over all the properties in 'set', calling 'iterator' | |
| * for each, passing 'userdata' as the first argument to callback. | | * for each, passing 'userdata' as the first argument to callback. | |
| * | | * | |
| * Returns: | | * Returns: | |
| * whatever value iterator returns. | | * whatever value iterator returns. | |
| */ | | */ | |
| int ne_propset_iterate(const ne_prop_result_set *set, | | int ne_propset_iterate(const ne_prop_result_set *set, | |
| ne_propset_iterator iterator, void *userdata); | | ne_propset_iterator iterator, void *userdata); | |
| | | | |
| /* Callback for handling the results of fetching properties for a | | /* Callback for handling the results of fetching properties for a | |
|
| * single resource (named by 'href'). The results are stored in the | | * single resource (identified by URI 'uri'). The results are stored | |
| * result set 'results': use ne_propset_* to examine this object. */ | | * in the result set 'results': use ne_propset_* to examine this | |
| typedef void (*ne_props_result)(void *userdata, const char *href, | | * object. */ | |
| const ne_prop_result_set *results); | | typedef void (*ne_props_result)(void *userdata, const ne_uri *uri, | |
| | | const ne_prop_result_set *results); | |
| | | | |
| /* Fetch properties for a resource (if depth == NE_DEPTH_ZERO), | | /* Fetch properties for a resource (if depth == NE_DEPTH_ZERO), | |
| * or a tree of resources (if depth == NE_DEPTH_ONE or _INFINITE). | | * or a tree of resources (if depth == NE_DEPTH_ONE or _INFINITE). | |
| * | | * | |
| * Names of the properties required must be given in 'props', | | * Names of the properties required must be given in 'props', | |
| * or if props is NULL, *all* properties are fetched. | | * or if props is NULL, *all* properties are fetched. | |
| * | | * | |
| * 'results' is called for each resource in the response, userdata is | | * 'results' is called for each resource in the response, userdata is | |
| * passed as the first argument to the callback. It is important to | | * passed as the first argument to the callback. It is important to | |
| * note that the callback is called as the response is read off the | | * note that the callback is called as the response is read off the | |
| | | | |
| skipping to change at line 208 | | skipping to change at line 209 | |
| /* A "complex property" has a value which is structured XML. To handle | | /* A "complex property" has a value which is structured XML. To handle | |
| * complex properties, you must set up and register an XML handler | | * complex properties, you must set up and register an XML handler | |
| * which will understand the elements which make up such properties. | | * which will understand the elements which make up such properties. | |
| * The handler must be registered with the parser returned by | | * The handler must be registered with the parser returned by | |
| * 'ne_propfind_get_parser'. | | * 'ne_propfind_get_parser'. | |
| * | | * | |
| * To store the parsed value of the property, a 'private' structure is | | * To store the parsed value of the property, a 'private' structure is | |
| * allocated in each propset (i.e. one per resource). When parsing the | | * allocated in each propset (i.e. one per resource). When parsing the | |
| * property value elements, for each new resource encountered in the | | * property value elements, for each new resource encountered in the | |
| * response, the 'creator' callback is called to retrieve a 'private' | | * response, the 'creator' callback is called to retrieve a 'private' | |
|
| * structure for this resource. | | * structure for this resource. When the private structure is no longer | |
| | | * needed, the 'destructor' callback is called to deallocate any | |
| | | * memory, if necessary. | |
| * | | * | |
| * Whilst in XML element callbacks you will have registered to handle | | * Whilst in XML element callbacks you will have registered to handle | |
| * complex properties, you can use the 'ne_propfind_current_private' | | * complex properties, you can use the 'ne_propfind_current_private' | |
| * call to retrieve the pointer to this private structure. | | * call to retrieve the pointer to this private structure. | |
| * | | * | |
| * To retrieve this 'private' structure from the propset in the | | * To retrieve this 'private' structure from the propset in the | |
| * results callback, simply call 'ne_propset_private'. | | * results callback, simply call 'ne_propset_private'. | |
| * */ | | * */ | |
|
| typedef void *(*ne_props_create_complex)(void *userdata, | | typedef void *(*ne_props_create_complex)(void *userdata, const ne_uri *uri) | |
| const char *href); | | ; | |
| | | typedef void (*ne_props_destroy_complex)(void *userdata, void *complex); | |
| | | | |
| void ne_propfind_set_private(ne_propfind_handler *handler, | | void ne_propfind_set_private(ne_propfind_handler *handler, | |
| ne_props_create_complex creator, | | ne_props_create_complex creator, | |
|
| | | ne_props_destroy_complex destructor, | |
| void *userdata); | | void *userdata); | |
| | | | |
| /* Fetch all properties. | | /* Fetch all properties. | |
| * | | * | |
| * Returns NE_*. */ | | * Returns NE_*. */ | |
| int ne_propfind_allprop(ne_propfind_handler *handler, | | int ne_propfind_allprop(ne_propfind_handler *handler, | |
| ne_props_result result, void *userdata); | | ne_props_result result, void *userdata); | |
| | | | |
| /* Fetch all properties with names listed in array 'names', which is | | /* Fetch all properties with names listed in array 'names', which is | |
| * terminated by a property with a NULL name field. For each resource | | * terminated by a property with a NULL name field. For each resource | |
| | | | |
| skipping to change at line 243 | | skipping to change at line 247 | |
| * 'userdata' as the first argument. | | * 'userdata' as the first argument. | |
| * | | * | |
| * Returns NE_*. */ | | * Returns NE_*. */ | |
| int ne_propfind_named(ne_propfind_handler *handler, | | int ne_propfind_named(ne_propfind_handler *handler, | |
| const ne_propname *names, | | const ne_propname *names, | |
| ne_props_result result, void *userdata); | | ne_props_result result, void *userdata); | |
| | | | |
| /* Destroy a propfind handler after use. */ | | /* Destroy a propfind handler after use. */ | |
| void ne_propfind_destroy(ne_propfind_handler *handler); | | void ne_propfind_destroy(ne_propfind_handler *handler); | |
| | | | |
|
| END_NEON_DECLS | | NE_END_DECLS | |
| | | | |
| #endif /* NE_PROPS_H */ | | #endif /* NE_PROPS_H */ | |
| | | | |
End of changes. 8 change blocks. |
| 11 lines changed or deleted | | 16 lines changed or added | |
|
| ne_request.h | | ne_request.h | |
| /* | | /* | |
| HTTP Request Handling | | HTTP Request Handling | |
|
| Copyright (C) 1999-2005, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| | | | |
| */ | | */ | |
| | | | |
| #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 ne_buffer */ | | #include "ne_string.h" /* For ne_buffer */ | |
| #include "ne_session.h" | | #include "ne_session.h" | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_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 */ | |
| #define NE_TIMEOUT (6) /* Connection timed out */ | | #define NE_TIMEOUT (6) /* Connection timed out */ | |
| #define NE_FAILED (7) /* The precondition failed */ | | #define NE_FAILED (7) /* The precondition failed */ | |
| #define NE_RETRY (8) /* Retry request (ne_end_request ONLY) */ | | #define NE_RETRY (8) /* Retry request (ne_end_request ONLY) */ | |
| | | | |
| skipping to change at line 226 | | skipping to change at line 226 | |
| | | | |
| /* Read response blocks until end of response; exactly equivalent to | | /* Read response blocks until end of response; exactly equivalent to | |
| * calling ne_read_response_block() until it returns 0. Returns | | * calling ne_read_response_block() until it returns 0. Returns | |
| * non-zero on error. */ | | * non-zero on error. */ | |
| int ne_discard_response(ne_request *req); | | int ne_discard_response(ne_request *req); | |
| | | | |
| /* Read response blocks until end of response, writing content to the | | /* Read response blocks until end of response, writing content to the | |
| * given file descriptor. Returns NE_ERROR on error. */ | | * given file descriptor. Returns NE_ERROR on error. */ | |
| int ne_read_response_to_fd(ne_request *req, int fd); | | int ne_read_response_to_fd(ne_request *req, int fd); | |
| | | | |
|
| /* If 'flag' is non-zer, enable the HTTP/1.1 "Expect: 100-continue" | | /* Defined request flags: */ | |
| * feature for the request, which allows the server to send an error | | typedef enum ne_request_flag_e { | |
| * response before the request body is sent. This should only be used | | NE_REQFLAG_EXPECT100 = 0, /* enable this flag to enable use of the | |
| * if the server is known to support the feature (not all HTTP/1.1 | | * "Expect: 100-continue" for the | |
| * servers do); the request will time out and fail otherwise. */ | | * request. */ | |
| void ne_set_request_expect100(ne_request *req, int flag); | | | |
| | | NE_REQFLAG_IDEMPOTENT, /* disable this flag if the request uses a | |
| | | * non-idempotent method such as POST. */ | |
| | | | |
| | | NE_REQFLAG_LAST /* enum sentinel value */ | |
| | | } ne_request_flag; | |
| | | | |
| | | /* Set a new value for a particular request flag. */ | |
| | | void ne_set_request_flag(ne_request *req, ne_request_flag flag, int value); | |
| | | | |
| | | /* Return 0 if the given flag is not set, >0 it is set, or -1 if the | |
| | | * flag is not supported. */ | |
| | | int ne_get_request_flag(ne_request *req, ne_request_flag flag); | |
| | | | |
| /**** Request hooks handling *****/ | | /**** Request hooks handling *****/ | |
| | | | |
| typedef void (*ne_free_hooks)(void *cookie); | | typedef void (*ne_free_hooks)(void *cookie); | |
| | | | |
|
| /* Hook called when a create is created; passed the request method, | | /* Hook called when a request is created; passed the request method, | |
| * and the string used as the Request-URI (which may be an abs_path, | | * and the string used as the Request-URI (note that this may be a | |
| * or an absoluteURI, depending on whether an HTTP proxy is in | | * absolute URI if a proxy is in use, an absolute path, a "*", | |
| * use). */ | | * etc). */ | |
| typedef void (*ne_create_request_fn)(ne_request *req, void *userdata, | | typedef void (*ne_create_request_fn)(ne_request *req, void *userdata, | |
| const char *method, const char *requri)
; | | const char *method, const char *requri)
; | |
| void ne_hook_create_request(ne_session *sess, | | void ne_hook_create_request(ne_session *sess, | |
| ne_create_request_fn fn, void *userdata); | | ne_create_request_fn fn, void *userdata); | |
| | | | |
| /* Hook called before the request is sent. 'header' is the raw HTTP | | /* Hook called before the request is sent. 'header' is the raw HTTP | |
| * header before the trailing CRLF is added: add in more here. */ | | * header before the trailing CRLF is added: add in more here. */ | |
| typedef void (*ne_pre_send_fn)(ne_request *req, void *userdata, | | typedef void (*ne_pre_send_fn)(ne_request *req, void *userdata, | |
| ne_buffer *header); | | ne_buffer *header); | |
| void ne_hook_pre_send(ne_session *sess, ne_pre_send_fn fn, void *userdata); | | void ne_hook_pre_send(ne_session *sess, ne_pre_send_fn fn, void *userdata); | |
| | | | |
| skipping to change at line 275 | | skipping to change at line 287 | |
| /* Hook called when the function is destroyed. */ | | /* Hook called when the function is destroyed. */ | |
| typedef void (*ne_destroy_req_fn)(ne_request *req, void *userdata); | | typedef void (*ne_destroy_req_fn)(ne_request *req, void *userdata); | |
| void ne_hook_destroy_request(ne_session *sess, | | void ne_hook_destroy_request(ne_session *sess, | |
| ne_destroy_req_fn fn, void *userdata); | | ne_destroy_req_fn fn, void *userdata); | |
| | | | |
| typedef void (*ne_destroy_sess_fn)(void *userdata); | | typedef void (*ne_destroy_sess_fn)(void *userdata); | |
| /* Hook called when the session is destroyed. */ | | /* Hook called when the session is destroyed. */ | |
| void ne_hook_destroy_session(ne_session *sess, | | void ne_hook_destroy_session(ne_session *sess, | |
| ne_destroy_sess_fn fn, void *userdata); | | ne_destroy_sess_fn fn, void *userdata); | |
| | | | |
|
| | | /* The ne_unhook_* functions remove a hook registered with the given | |
| | | * session. If a hook is found which was registered with a given | |
| | | * function 'fn', and userdata pointer 'userdata', then it will be | |
| | | * removed from the hooks list. | |
| | | * | |
| | | * It is unsafe to use any of these functions from a hook function to | |
| | | * unregister itself, except for ne_unhook_destroy_request. */ | |
| | | void ne_unhook_create_request(ne_session *sess, | |
| | | ne_create_request_fn fn, void *userdata); | |
| | | void ne_unhook_pre_send(ne_session *sess, ne_pre_send_fn fn, void *userdata | |
| | | ); | |
| | | void ne_unhook_post_send(ne_session *sess, ne_post_send_fn fn, void *userda | |
| | | ta); | |
| | | void ne_unhook_destroy_request(ne_session *sess, | |
| | | ne_destroy_req_fn fn, void *userdata); | |
| | | void ne_unhook_destroy_session(ne_session *sess, | |
| | | ne_destroy_sess_fn fn, void *userdata); | |
| | | | |
| /* Store an opaque context for the request, 'priv' is returned by a | | /* Store an opaque context for the request, 'priv' is returned by a | |
| * call to ne_request_get_private with the same ID. */ | | * call to ne_request_get_private with the same ID. */ | |
| void ne_set_request_private(ne_request *req, const char *id, void *priv); | | void ne_set_request_private(ne_request *req, const char *id, void *priv); | |
| void *ne_get_request_private(ne_request *req, const char *id); | | void *ne_get_request_private(ne_request *req, const char *id); | |
| | | | |
|
| END_NEON_DECLS | | NE_END_DECLS | |
| | | | |
| #endif /* NE_REQUEST_H */ | | #endif /* NE_REQUEST_H */ | |
| | | | |
End of changes. 6 change blocks. |
| 13 lines changed or deleted | | 43 lines changed or added | |
|
| ne_session.h | | ne_session.h | |
| /* | | /* | |
| HTTP session handling | | HTTP session handling | |
|
| Copyright (C) 1999-2005, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 32 | | skipping to change at line 32 | |
| #ifndef NE_SESSION_H | | #ifndef NE_SESSION_H | |
| #define NE_SESSION_H 1 | | #define NE_SESSION_H 1 | |
| | | | |
| #include <sys/types.h> | | #include <sys/types.h> | |
| | | | |
| #include "ne_ssl.h" | | #include "ne_ssl.h" | |
| #include "ne_uri.h" /* for ne_uri */ | | #include "ne_uri.h" /* for ne_uri */ | |
| #include "ne_defs.h" | | #include "ne_defs.h" | |
| #include "ne_socket.h" | | #include "ne_socket.h" | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_DECLS | |
| | | | |
| typedef struct ne_session_s ne_session; | | typedef struct ne_session_s ne_session; | |
| | | | |
| /* Create a session to the given server, using the given scheme. If | | /* Create a session to the given server, using the given scheme. If | |
| * "https" is passed as the scheme, SSL will be used to connect to the | | * "https" is passed as the scheme, SSL will be used to connect to the | |
| * server. */ | | * server. */ | |
| ne_session *ne_session_create(const char *scheme, | | ne_session *ne_session_create(const char *scheme, | |
| const char *hostname, unsigned int port); | | const char *hostname, unsigned int port); | |
| | | | |
| /* Finish an HTTP session */ | | /* Finish an HTTP session */ | |
| void ne_session_destroy(ne_session *sess); | | void ne_session_destroy(ne_session *sess); | |
| | | | |
| /* Prematurely force the connection to be closed for the given | | /* Prematurely force the connection to be closed for the given | |
| * session. */ | | * session. */ | |
| void ne_close_connection(ne_session *sess); | | void ne_close_connection(ne_session *sess); | |
| | | | |
| /* Set the proxy server to be used for the session. */ | | /* Set the proxy server to be used for the session. */ | |
| void ne_session_proxy(ne_session *sess, | | void ne_session_proxy(ne_session *sess, | |
| const char *hostname, unsigned int port); | | const char *hostname, unsigned int port); | |
| | | | |
|
| /* Disable use of persistent connection if 'flag' is non-zero, else | | /* Defined session flags: */ | |
| * enable (the default). */ | | typedef enum ne_session_flag_e { | |
| void ne_set_persist(ne_session *sess, int flag); | | NE_SESSFLAG_PERSIST = 0, /* disable this flag to prevent use of | |
| | | * persistent connections. */ | |
| | | | |
| | | NE_SESSFLAG_ICYPROTO, /* enable this flag to enable support for | |
| | | * non-HTTP ShoutCast-style "ICY" responses. */ | |
| | | | |
| | | NE_SESSFLAG_SSLv2, /* disable this flag to disable support for | |
| | | * SSLv2, if supported by the SSL library. */ | |
| | | | |
| | | NE_SESSFLAG_LAST /* enum sentinel value */ | |
| | | } ne_session_flag; | |
| | | | |
| | | /* Set a new value for a particular session flag. */ | |
| | | void ne_set_session_flag(ne_session *sess, ne_session_flag flag, int value) | |
| | | ; | |
| | | | |
| | | /* Return 0 if the given flag is not set, >0 it is set, or -1 if the | |
| | | * flag is not supported. */ | |
| | | int ne_get_session_flag(ne_session *sess, ne_session_flag flag); | |
| | | | |
| /* Bypass the normal name resolution; force the use of specific set of | | /* Bypass the normal name resolution; force the use of specific set of | |
| * addresses for this session, addrs[0]...addrs[n-1]. The addrs array | | * addresses for this session, addrs[0]...addrs[n-1]. The addrs array | |
| * must remain valid until the session is destroyed. */ | | * must remain valid until the session is destroyed. */ | |
| void ne_set_addrlist(ne_session *sess, const ne_inet_addr **addrs, size_t n
); | | void ne_set_addrlist(ne_session *sess, const ne_inet_addr **addrs, size_t n
); | |
| | | | |
| /* Progress callback. */ | | /* Progress callback. */ | |
| typedef void (*ne_progress)(void *userdata, off_t progress, off_t total); | | typedef void (*ne_progress)(void *userdata, off_t progress, off_t total); | |
| | | | |
| /* Set a progress callback for the session. */ | | /* Set a progress callback for the session. */ | |
| | | | |
| skipping to change at line 186 | | skipping to change at line 203 | |
| 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, ...) | |
| ne_attribute((format (printf, 2, 3))); | | ne_attribute((format (printf, 2, 3))); | |
| | | | |
| /* 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 | | NE_END_DECLS | |
| | | | |
| #endif /* NE_SESSION_H */ | | #endif /* NE_SESSION_H */ | |
| | | | |
End of changes. 4 change blocks. |
| 6 lines changed or deleted | | 24 lines changed or added | |
|
| ne_socket.h | | ne_socket.h | |
| /* | | /* | |
| socket handling interface | | socket handling interface | |
|
| Copyright (C) 1999-2005, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| */ | | */ | |
| | | | |
| #ifndef NE_SOCKET_H | | #ifndef NE_SOCKET_H | |
| #define NE_SOCKET_H | | #define NE_SOCKET_H | |
| | | | |
| #include <sys/types.h> | | #include <sys/types.h> | |
| | | | |
| #include "ne_defs.h" | | #include "ne_defs.h" | |
| #include "ne_ssl.h" /* for ne_ssl_context */ | | #include "ne_ssl.h" /* for ne_ssl_context */ | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_DECLS | |
| | | | |
| #define NE_SOCK_ERROR (-1) | | #define NE_SOCK_ERROR (-1) | |
| /* Read/Write timed out */ | | /* Read/Write timed out */ | |
| #define NE_SOCK_TIMEOUT (-2) | | #define NE_SOCK_TIMEOUT (-2) | |
| /* Socket was closed */ | | /* Socket was closed */ | |
| #define NE_SOCK_CLOSED (-3) | | #define NE_SOCK_CLOSED (-3) | |
| /* Connection was reset (e.g. server crashed) */ | | /* Connection was reset (e.g. server crashed) */ | |
| #define NE_SOCK_RESET (-4) | | #define NE_SOCK_RESET (-4) | |
| /* Secure connection was closed without proper SSL shutdown. */ | | /* Secure connection was closed without proper SSL shutdown. */ | |
| #define NE_SOCK_TRUNC (-5) | | #define NE_SOCK_TRUNC (-5) | |
| | | | |
| skipping to change at line 52 | | skipping to change at line 52 | |
| /* ne_socket represents a TCP socket. */ | | /* ne_socket represents a TCP socket. */ | |
| typedef struct ne_socket_s ne_socket; | | typedef struct ne_socket_s ne_socket; | |
| | | | |
| /* ne_sock_addr represents an address object. */ | | /* ne_sock_addr represents an address object. */ | |
| typedef struct ne_sock_addr_s ne_sock_addr; | | typedef struct ne_sock_addr_s ne_sock_addr; | |
| | | | |
| #ifndef NE_INET_ADDR_DEFINED | | #ifndef NE_INET_ADDR_DEFINED | |
| typedef struct ne_inet_addr_s ne_inet_addr; | | typedef struct ne_inet_addr_s ne_inet_addr; | |
| #endif | | #endif | |
| | | | |
|
| /* While neon itself doesn't require per-process global | | /* Perform process-global initialization of any libraries in use. | |
| * initialization, some platforms do, and so does the OpenSSL | | * Returns non-zero on error. */ | |
| * library. */ | | | |
| int ne_sock_init(void); | | int ne_sock_init(void); | |
| | | | |
|
| /* Shutdown any underlying libraries. */ | | /* Perform process-global shutdown of any libraries in use. This | |
| | | * function only has effect when it has been called an equal number of | |
| | | * times to ne_sock_init() for the process. */ | |
| void ne_sock_exit(void); | | void ne_sock_exit(void); | |
| | | | |
| /* Resolve the given hostname. 'flags' must be zero. Hex | | /* Resolve the given hostname. 'flags' must be zero. Hex | |
| * string IPv6 addresses (e.g. `::1') may be enclosed in brackets | | * string IPv6 addresses (e.g. `::1') may be enclosed in brackets | |
| * (e.g. `[::1]'). */ | | * (e.g. `[::1]'). */ | |
| ne_sock_addr *ne_addr_resolve(const char *hostname, int flags); | | ne_sock_addr *ne_addr_resolve(const char *hostname, int flags); | |
| | | | |
| /* Returns zero if name resolution was successful, non-zero on | | /* Returns zero if name resolution was successful, non-zero on | |
| * error. */ | | * error. */ | |
| int ne_addr_result(const ne_sock_addr *addr); | | int ne_addr_result(const ne_sock_addr *addr); | |
| | | | |
| skipping to change at line 190 | | skipping to change at line 191 | |
| * SSL context. */ | | * SSL context. */ | |
| int ne_sock_accept_ssl(ne_socket *sock, ne_ssl_context *ctx); | | int ne_sock_accept_ssl(ne_socket *sock, ne_ssl_context *ctx); | |
| | | | |
| /* Negotiate an SSL connection on socket as an SSL client, using given | | /* Negotiate an SSL connection on socket as an SSL client, using given | |
| * SSL context. The 'userdata' parameter is associated with the | | * SSL context. The 'userdata' parameter is associated with the | |
| * underlying SSL library's socket structure for use in callbacks. | | * underlying SSL library's socket structure for use in callbacks. | |
| * Returns zero on success, or non-zero on error. */ | | * Returns zero on success, or non-zero on error. */ | |
| int ne_sock_connect_ssl(ne_socket *sock, ne_ssl_context *ctx, | | int ne_sock_connect_ssl(ne_socket *sock, ne_ssl_context *ctx, | |
| void *userdata); | | void *userdata); | |
| | | | |
|
| END_NEON_DECLS | | /* Retrieve the session ID of the current SSL session. If 'buf' is | |
| | | * non-NULL, on success, copies at most *buflen bytes to 'buf' and | |
| | | * sets *buflen to the exact number of bytes copied. If 'buf' is | |
| | | * NULL, on success, sets *buflen to the length of the session ID. | |
| | | * Returns zero on success, non-zero on error. */ | |
| | | int ne_sock_sessid(ne_socket *sock, unsigned char *buf, size_t *buflen); | |
| | | | |
| | | NE_END_DECLS | |
| | | | |
| #endif /* NE_SOCKET_H */ | | #endif /* NE_SOCKET_H */ | |
| | | | |
End of changes. 5 change blocks. |
| 7 lines changed or deleted | | 15 lines changed or added | |
|
| ne_ssl.h | | ne_ssl.h | |
| /* | | /* | |
| SSL/TLS abstraction layer for neon | | SSL/TLS abstraction layer for neon | |
|
| Copyright (C) 2003-2005, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 2003-2006, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| MA 02111-1307, USA | | MA 02111-1307, USA | |
| | | | |
| */ | | */ | |
| | | | |
| /* ne_ssl.h defines an interface for loading and accessing the | | /* ne_ssl.h defines an interface for loading and accessing the | |
| * properties of SSL certificates. */ | | * properties of SSL certificates. */ | |
| | | | |
| #ifndef NE_SSL_H | | #ifndef NE_SSL_H | |
| #define NE_SSL_H 1 | | #define NE_SSL_H 1 | |
| | | | |
|
| | | #include <sys/types.h> | |
| | | | |
| #include "ne_defs.h" | | #include "ne_defs.h" | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_DECLS | |
| | | | |
| /* A "distinguished name"; a unique name for some entity. */ | | /* A "distinguished name"; a unique name for some entity. */ | |
| typedef struct ne_ssl_dname_s ne_ssl_dname; | | typedef struct ne_ssl_dname_s ne_ssl_dname; | |
| | | | |
| /* Returns a single-line string representation of a distinguished | | /* Returns a single-line string representation of a distinguished | |
| * name, intended to be human-readable (e.g. "Acme Ltd., Norfolk, | | * name, intended to be human-readable (e.g. "Acme Ltd., Norfolk, | |
| * GB"). Return value is a UTF-8-encoded malloc-allocated string and | | * GB"). Return value is a UTF-8-encoded malloc-allocated string and | |
| * must be free'd by the caller. */ | | * must be free'd by the caller. */ | |
| char *ne_ssl_readable_dname(const ne_ssl_dname *dn); | | char *ne_ssl_readable_dname(const ne_ssl_dname *dn); | |
| | | | |
| | | | |
| skipping to change at line 91 | | skipping to change at line 93 | |
| | | | |
| #define NE_SSL_DIGESTLEN (60) | | #define NE_SSL_DIGESTLEN (60) | |
| | | | |
| /* Calculate the certificate digest ("fingerprint") and format it as a | | /* Calculate the certificate digest ("fingerprint") and format it as a | |
| * NUL-terminated hex string in 'digest', of the form "aa:bb:...:ff". | | * NUL-terminated hex string in 'digest', of the form "aa:bb:...:ff". | |
| * Returns zero on success or non-zero if there was an internal error | | * Returns zero on success or non-zero if there was an internal error | |
| * whilst calculating the digest. 'digest' must be at least | | * whilst calculating the digest. 'digest' must be at least | |
| * NE_SSL_DIGESTLEN bytes in length. */ | | * NE_SSL_DIGESTLEN bytes in length. */ | |
| int ne_ssl_cert_digest(const ne_ssl_certificate *cert, char *digest); | | int ne_ssl_cert_digest(const ne_ssl_certificate *cert, char *digest); | |
| | | | |
|
| #define NE_SSL_VDATELEN (30) | | /* Copy the validity times for the certificate 'cert' into 'from' and | |
| | | * 'until' (either may be NULL). If the time cannot be represented by | |
| | | * a time_t value, then (time_t)-1 will be written. */ | |
| | | void ne_ssl_cert_validity_time(const ne_ssl_certificate *cert, | |
| | | time_t *from, time_t *until); | |
| | | | |
|
| /* Copy the validity dates into buffers 'from' and 'until' as | | #define NE_SSL_VDATELEN (30) | |
| * NUL-terminated human-readable strings. The buffers must be at | | /* Copy the validity times into buffers 'from' and 'until' as | |
| * least NE_SSL_VDATELEN bytes in length. */ | | * NUL-terminated human-readable strings, using RFC 1123-style date | |
| | | * formatting (and not localized, so always using English month/week | |
| | | * names). The buffers must be at least NE_SSL_VDATELEN bytes in | |
| | | * length, and either may be NULL. */ | |
| void ne_ssl_cert_validity(const ne_ssl_certificate *cert, | | void ne_ssl_cert_validity(const ne_ssl_certificate *cert, | |
| char *from, char *until); | | char *from, char *until); | |
| | | | |
| /* Returns zero if 'c1' and 'c2' refer to the same certificate, or | | /* Returns zero if 'c1' and 'c2' refer to the same certificate, or | |
| * non-zero otherwise. */ | | * non-zero otherwise. */ | |
| int ne_ssl_cert_cmp(const ne_ssl_certificate *c1, | | int ne_ssl_cert_cmp(const ne_ssl_certificate *c1, | |
| const ne_ssl_certificate *c2); | | const ne_ssl_certificate *c2); | |
| | | | |
| /* Deallocate memory associated with certificate. */ | | /* Deallocate memory associated with certificate. */ | |
| void ne_ssl_cert_free(ne_ssl_certificate *cert); | | void ne_ssl_cert_free(ne_ssl_certificate *cert); | |
| | | | |
| skipping to change at line 161 | | skipping to change at line 170 | |
| /* Server mode: use given cert and key (filenames to PEM certificates). */ | | /* Server mode: use given cert and key (filenames to PEM certificates). */ | |
| int ne_ssl_context_keypair(ne_ssl_context *ctx, | | int ne_ssl_context_keypair(ne_ssl_context *ctx, | |
| const char *cert, const char *key); | | const char *cert, const char *key); | |
| | | | |
| /* Server mode: set client cert verification options: required is non-zero
if | | /* Server mode: set client cert verification options: required is non-zero
if | |
| * a client cert is required, if ca_names is non-NULL it is a filename cont
aining | | * a client cert is required, if ca_names is non-NULL it is a filename cont
aining | |
| * a set of PEM certs from which CA names are sent in the ccert request. */ | | * a set of PEM certs from which CA names are sent in the ccert request. */ | |
| int ne_ssl_context_set_verify(ne_ssl_context *ctx, int required, | | int ne_ssl_context_set_verify(ne_ssl_context *ctx, int required, | |
| const char *ca_names, const char *verify_cas)
; | | const char *ca_names, const char *verify_cas)
; | |
| | | | |
|
| | | #define NE_SSL_CTX_SSLv2 (0) | |
| | | /* Set a flag for the SSL context. */ | |
| | | void ne_ssl_context_set_flag(ne_ssl_context *ctx, int flag, int value); | |
| | | | |
| /* Destroy an SSL context. */ | | /* Destroy an SSL context. */ | |
| void ne_ssl_context_destroy(ne_ssl_context *ctx); | | void ne_ssl_context_destroy(ne_ssl_context *ctx); | |
| | | | |
|
| END_NEON_DECLS | | NE_END_DECLS | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 7 change blocks. |
| 7 lines changed or deleted | | 20 lines changed or added | |
|
| ne_string.h | | ne_string.h | |
| /* | | /* | |
| String utility functions | | String utility functions | |
|
| Copyright (C) 1999-2005, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| */ | | */ | |
| | | | |
| #ifndef NE_STRING_H | | #ifndef NE_STRING_H | |
| #define NE_STRING_H | | #define NE_STRING_H | |
| | | | |
| #include "ne_defs.h" | | #include "ne_defs.h" | |
| #include "ne_alloc.h" | | #include "ne_alloc.h" | |
| | | | |
| #include <stdarg.h> | | #include <stdarg.h> | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_DECLS | |
| | | | |
| /* ne_token and ne_qtoken return the next token in *str between *str | | /* ne_token and ne_qtoken return the next token in *str between *str | |
| * and separator character 'sep' or the NUL terminator. ne_qtoken | | * and separator character 'sep' or the NUL terminator. ne_qtoken | |
| * skips over any parts quoted using a pair of any one of the | | * skips over any parts quoted using a pair of any one of the | |
| * characters given in 'quotes'. After returning, *str will point to | | * characters given in 'quotes'. After returning, *str will point to | |
| * the next character after the separator, or NULL if no more | | * the next character after the separator, or NULL if no more | |
| * separator characters were found. | | * separator characters were found. | |
| * | | * | |
| * ne_qtoken may return NULL if unterminated quotes are found. */ | | * ne_qtoken may return NULL if unterminated quotes are found. */ | |
| char *ne_token(char **str, char sep); | | char *ne_token(char **str, char sep); | |
| | | | |
| skipping to change at line 125 | | skipping to change at line 125 | |
| | | | |
| /* ne_strnzcpy copies at most 'n'-1 bytes of 'src' to 'dest', and | | /* ne_strnzcpy copies at most 'n'-1 bytes of 'src' to 'dest', and | |
| * ensures that 'dest' is subsequently NUL-terminated. */ | | * ensures that 'dest' is subsequently NUL-terminated. */ | |
| #define ne_strnzcpy(dest, src, n) do { \ | | #define ne_strnzcpy(dest, src, n) do { \ | |
| strncpy(dest, src, n-1); dest[n-1] = '\0'; } while (0) | | strncpy(dest, src, n-1); dest[n-1] = '\0'; } while (0) | |
| | | | |
| /* Return malloc-allocated concatenation of all NUL-terminated string | | /* Return malloc-allocated concatenation of all NUL-terminated string | |
| * arguments, up to a terminating NULL. */ | | * arguments, up to a terminating NULL. */ | |
| char *ne_concat(const char *str, ...); | | char *ne_concat(const char *str, ...); | |
| | | | |
|
| #define NE_ASC2HEX(x) (((x) <= '9') ? ((x) - '0') : (tolower((x)) + 10 - 'a
')) | | #define NE_ASC2HEX(x) (((x) <= '9') ? ((x) - '0') : (ne_tolower((x)) + 10 -
'a')) | |
| #define NE_HEX2ASC(x) ((char) ((x) > 9 ? ((x) - 10 + 'a') : ((x) + '0'))) | | #define NE_HEX2ASC(x) ((char) ((x) > 9 ? ((x) - 10 + 'a') : ((x) + '0'))) | |
| | | | |
| /* Wrapper for snprintf: always NUL-terminates returned buffer, and | | /* Wrapper for snprintf: always NUL-terminates returned buffer, and | |
| * returns strlen(str). */ | | * returns strlen(str). */ | |
| size_t ne_snprintf(char *str, size_t size, const char *fmt, ...) | | size_t ne_snprintf(char *str, size_t size, const char *fmt, ...) | |
| ne_attribute((format(printf, 3, 4))); | | ne_attribute((format(printf, 3, 4))); | |
| | | | |
| /* Wrapper for vsnprintf. */ | | /* Wrapper for vsnprintf. */ | |
| size_t ne_vsnprintf(char *str, size_t size, const char *fmt, va_list ap) | | size_t ne_vsnprintf(char *str, size_t size, const char *fmt, va_list ap) | |
| ne_attribute((format(printf, 3, 0))); | | ne_attribute((format(printf, 3, 0))); | |
| | | | |
|
| END_NEON_DECLS | | /* Implementations of strcasecmp and strncasecmp which behave as | |
| | | * defined by the ANSI C strcasecmp() and strncasecmp() when in the | |
| | | * POSIX locale; i.e. ignoring the process locale. */ | |
| | | | |
| | | /* Compares 's1' and 's2', ignoring differences in case. */ | |
| | | int ne_strcasecmp(const char *s1, const char *s2); | |
| | | /* Compares up to 'n' characters of 's1' and 's2', ignoring | |
| | | * differences in case. */ | |
| | | int ne_strncasecmp(const char *s1, const char *s2, size_t n); | |
| | | | |
| | | /* Return lowercase 'c' as in POSIX locale; note difference from ANSI | |
| | | * C semantics as both the argument and return value are unsigned | |
| | | * char. */ | |
| | | #define ne_tolower(c) (ne_tolower_array()[(unsigned char)c]) | |
| | | | |
| | | const unsigned char *ne_tolower_array(void); | |
| | | | |
| | | NE_END_DECLS | |
| | | | |
| #endif /* NE_STRING_H */ | | #endif /* NE_STRING_H */ | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 21 lines changed or added | |
|
| ne_uri.h | | ne_uri.h | |
| /* | | /* | |
| URI manipulation routines. | | URI manipulation routines. | |
|
| Copyright (C) 1999-2005, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| 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_URI_H | | #ifndef NE_URI_H | |
| #define NE_URI_H | | #define NE_URI_H | |
| | | | |
| #include "ne_defs.h" | | #include "ne_defs.h" | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_DECLS | |
| | | | |
| /* Return a copy of a path string with anything other than | | /* Return a copy of a path string with anything other than | |
| * "unreserved" and the forward-slash character percent-encoded | | * "unreserved" and the forward-slash character percent-encoded | |
| * according to the URI encoding rules. Returns a malloc-allocated | | * according to the URI encoding rules. Returns a malloc-allocated | |
| * string and never NULL. */ | | * string and never NULL. */ | |
| char *ne_path_escape(const char *path); | | char *ne_path_escape(const char *path); | |
| | | | |
| /* Return a decoded copy of a percent-encoded path string. Returns | | /* Return a decoded copy of a percent-encoded path string. Returns | |
| * malloc-allocated path on success, or NULL if the string contained | | * malloc-allocated path on success, or NULL if the string contained | |
| * any syntactically invalid percent-encoding sequences. */ | | * any syntactically invalid percent-encoding sequences. */ | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 60 | |
| | | | |
| /* Returns non-zero if path has a trailing slash character */ | | /* Returns non-zero if path has a trailing slash character */ | |
| int ne_path_has_trailing_slash(const char *path); | | int ne_path_has_trailing_slash(const char *path); | |
| | | | |
| /* Return the default port for the given scheme, or 0 if none is | | /* Return the default port for the given scheme, or 0 if none is | |
| * known. */ | | * known. */ | |
| unsigned int ne_uri_defaultport(const char *scheme); | | unsigned int ne_uri_defaultport(const char *scheme); | |
| | | | |
| typedef struct { | | typedef struct { | |
| char *scheme; | | char *scheme; | |
|
| char *host; | | char *host, *userinfo; | |
| unsigned int port; | | unsigned int port; | |
|
| char *path; | | char *path, *query, *fragment; | |
| char *authinfo; | | | |
| } ne_uri; | | } ne_uri; | |
| | | | |
|
| /* Parse absoluteURI 'uri' and place parsed segments in *parsed. | | /* Parse a URI-reference 'uri' and place parsed components in *parsed. | |
| * Returns zero on success, non-zero on parse error. On successful or | | * Returns zero on success, non-zero on parse error. On successful or | |
| * error return, all the 'char *' fields of *parsed are either set to | | * error return, all the 'char *' fields of *parsed are either set to | |
| * NULL, or point to malloc-allocated NUL-terminated strings. | | * NULL, or point to malloc-allocated NUL-terminated strings. | |
|
| * ne_uri_free can be used to free the structure after use.*/ | | * ne_uri_free can be used to free the structure after use. */ | |
| int ne_uri_parse(const char *uri, ne_uri *parsed); | | int ne_uri_parse(const char *uri, ne_uri *parsed); | |
| | | | |
|
| /* Turns a URI structure back into a string. String is | | /* Turns a URI structure back into a string. The returned string is | |
| * malloc-allocated, and must be freed by the caller. */ | | * malloc-allocated, and must be freed by the caller. */ | |
| char *ne_uri_unparse(const ne_uri *uri); | | char *ne_uri_unparse(const ne_uri *uri); | |
| | | | |
|
| | | /* Resolve a relative URI 'relative', with respect to base URI 'base', | |
| | | * placing the resultant URI in '*result'. On return, all the 'char | |
| | | * *' fields of *result are either set to NULL or point to | |
| | | * malloc-allocated NUL-terminated strings. ne_uri_free can be used | |
| | | * to free the structure after use. Returns 'result'. */ | |
| | | ne_uri *ne_uri_resolve(const ne_uri *base, const ne_uri *relative, | |
| | | ne_uri *result); | |
| | | | |
| /* Compares URIs u1 and u2, returns non-zero if they are found to be | | /* Compares URIs u1 and u2, returns non-zero if they are found to be | |
| * non-equal. The sign of the return value is <0 if 'u1' is less than | | * non-equal. The sign of the return value is <0 if 'u1' is less than | |
| * 'u2', or >0 if 'u2' is greater than 'u1'. */ | | * 'u2', or >0 if 'u2' is greater than 'u1'. */ | |
| int ne_uri_cmp(const ne_uri *u1, const ne_uri *u2); | | int ne_uri_cmp(const ne_uri *u1, const ne_uri *u2); | |
| | | | |
|
| | | /* Copy components of URI 'src' to destination 'dest'. Returns | |
| | | * 'dest'. */ | |
| | | ne_uri *ne_uri_copy(ne_uri *dest, const ne_uri *src); | |
| | | | |
| /* Frees any non-NULL fields of parsed URI structure *parsed. All | | /* Frees any non-NULL fields of parsed URI structure *parsed. All | |
| * fields are then zero-initialized. */ | | * fields are then zero-initialized. */ | |
| void ne_uri_free(ne_uri *parsed); | | void ne_uri_free(ne_uri *parsed); | |
| | | | |
|
| END_NEON_DECLS | | NE_END_DECLS | |
| | | | |
| #endif /* NE_URI_H */ | | #endif /* NE_URI_H */ | |
| | | | |
End of changes. 10 change blocks. |
| 9 lines changed or deleted | | 20 lines changed or added | |
|
| ne_utils.h | | ne_utils.h | |
| /* | | /* | |
| HTTP utility functions | | HTTP utility functions | |
|
| Copyright (C) 1999-2005, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 37 | | skipping to change at line 37 | |
| #include <stdarg.h> | | #include <stdarg.h> | |
| #include <stdio.h> | | #include <stdio.h> | |
| | | | |
| #include "ne_defs.h" | | #include "ne_defs.h" | |
| | | | |
| #ifdef NEON_TRIO | | #ifdef NEON_TRIO | |
| /* no HAVE_TRIO_H check so this works from outside neon build tree. */ | | /* no HAVE_TRIO_H check so this works from outside neon build tree. */ | |
| #include <trio.h> | | #include <trio.h> | |
| #endif | | #endif | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_DECLS | |
| | | | |
| /* Returns a human-readable version string like: | | /* Returns a human-readable version string like: | |
| * "neon 0.2.0: Library build, OpenSSL support" | | * "neon 0.2.0: Library build, OpenSSL support" | |
| */ | | */ | |
| const char *ne_version_string(void); | | const char *ne_version_string(void); | |
| | | | |
| /* Returns non-zero if library version is not of major version | | /* Returns non-zero if library version is not of major version | |
| * 'major', or if minor version is not greater than or equal to | | * 'major', or if minor version is not greater than or equal to | |
| * 'minor'. For neon versions with major == 0, all minor versions are | | * 'minor'. For neon versions with major == 0, all minor versions are | |
| * presumed to be incompatible. */ | | * presumed to be incompatible. */ | |
| int ne_version_match(int major, int minor); | | int ne_version_match(int major, int minor); | |
| | | | |
| #define NE_FEATURE_SSL (1) /* SSL/TLS support */ | | #define NE_FEATURE_SSL (1) /* SSL/TLS support */ | |
| #define NE_FEATURE_ZLIB (2) /* zlib compression in compress interface */ | | #define NE_FEATURE_ZLIB (2) /* zlib compression in compress interface */ | |
| #define NE_FEATURE_IPV6 (3) /* IPv6 is supported in resolver */ | | #define NE_FEATURE_IPV6 (3) /* IPv6 is supported in resolver */ | |
| #define NE_FEATURE_LFS (4) /* large file support */ | | #define NE_FEATURE_LFS (4) /* large file support */ | |
| #define NE_FEATURE_SOCKS (5) /* SOCKSv5 support */ | | #define NE_FEATURE_SOCKS (5) /* SOCKSv5 support */ | |
|
| | | #define NE_FEATURE_TS_SSL (6) /* Thread-safe SSL/TLS support */ | |
| | | #define NE_FEATURE_I18N (7) /* i18n error message support */ | |
| | | | |
| /* Returns non-zero if neon has support for given feature code | | /* Returns non-zero if neon has support for given feature code | |
| * NE_FEATURE_*. */ | | * NE_FEATURE_*. */ | |
| int ne_has_support(int feature); | | int ne_has_support(int feature); | |
| | | | |
| /* CONSIDER: mutt has a nicer way of way of doing debugging output... maybe | | /* CONSIDER: mutt has a nicer way of way of doing debugging output... maybe | |
| * switch to like that. */ | | * switch to like that. */ | |
| | | | |
| #ifndef NE_DEBUGGING | | #ifndef NE_DEBUGGING | |
| #define NE_DEBUG if (0) ne_debug | | #define NE_DEBUG if (0) ne_debug | |
| | | | |
| skipping to change at line 115 | | skipping to change at line 117 | |
| | | | |
| /* Parser for strings which follow the Status-Line grammar from | | /* Parser for strings which follow the Status-Line grammar from | |
| * RFC2616. s->reason_phrase is malloc-allocated if non-NULL, and | | * RFC2616. s->reason_phrase is malloc-allocated if non-NULL, and | |
| * must be free'd by the caller. | | * must be free'd by the caller. | |
| * Returns: | | * Returns: | |
| * 0 on success, *s will be filled in. | | * 0 on success, *s will be filled in. | |
| * -1 on parse error. | | * -1 on parse error. | |
| */ | | */ | |
| int ne_parse_statusline(const char *status_line, ne_status *s); | | int ne_parse_statusline(const char *status_line, ne_status *s); | |
| | | | |
|
| END_NEON_DECLS | | NE_END_DECLS | |
| | | | |
| #endif /* NE_UTILS_H */ | | #endif /* NE_UTILS_H */ | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 5 lines changed or added | |
|
| ne_xml.h | | ne_xml.h | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| | | | |
| */ | | */ | |
| | | | |
| #ifndef NE_XML_H | | #ifndef NE_XML_H | |
| #define NE_XML_H | | #define NE_XML_H | |
| | | | |
| #include <sys/types.h> /* for size_t */ | | #include <sys/types.h> /* for size_t */ | |
| | | | |
| #include "ne_defs.h" | | #include "ne_defs.h" | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_DECLS | |
| | | | |
| /* The neon XML interface filters a streamed XML tree through a stack | | /* The neon XML interface filters a streamed XML tree through a stack | |
| * of SAX "handlers". A handler is made up of three callbacks | | * of SAX "handlers". A handler is made up of three callbacks | |
| * (start-element, char-data, end-element). Each start-element event | | * (start-element, char-data, end-element). Each start-element event | |
| * is passed to each handler in the stack in turn until one until one | | * is passed to each handler in the stack in turn until one until one | |
| * accepts the element. This handler then receives subsequent | | * accepts the element. This handler then receives subsequent | |
| * char-data and end-element events for the element. | | * char-data and end-element events for the element. | |
| * | | * | |
| * For each new start-element event, the search up the handler stack | | * For each new start-element event, the search up the handler stack | |
| * begins with the handler for the parent element (for the root | | * begins with the handler for the parent element (for the root | |
| | | | |
| skipping to change at line 149 | | skipping to change at line 149 | |
| /* Return the size of an idmap array */ | | /* Return the size of an idmap array */ | |
| #define NE_XML_MAPLEN(map) (sizeof(map) / sizeof(struct ne_xml_idmap)) | | #define NE_XML_MAPLEN(map) (sizeof(map) / sizeof(struct ne_xml_idmap)) | |
| | | | |
| /* Return the 'id' corresponding to {nspace, name}, or zero. */ | | /* Return the 'id' corresponding to {nspace, name}, or zero. */ | |
| int ne_xml_mapid(const struct ne_xml_idmap map[], size_t maplen, | | int ne_xml_mapid(const struct ne_xml_idmap map[], size_t maplen, | |
| const char *nspace, const char *name); | | const char *nspace, const char *name); | |
| | | | |
| /* media type, appropriate for adding to a Content-Type header */ | | /* media type, appropriate for adding to a Content-Type header */ | |
| #define NE_XML_MEDIA_TYPE "application/xml" | | #define NE_XML_MEDIA_TYPE "application/xml" | |
| | | | |
|
| END_NEON_DECLS | | NE_END_DECLS | |
| | | | |
| #endif /* NE_XML_H */ | | #endif /* NE_XML_H */ | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| ne_xmlreq.h | | ne_xmlreq.h | |
| /* | | /* | |
| XML/HTTP response handling | | XML/HTTP response handling | |
|
| Copyright (C) 2004-2005, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 2004-2006, Joe Orton <joe@manyfish.co.uk> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| MA 02111-1307, USA | | MA 02111-1307, USA | |
| | | | |
| */ | | */ | |
| | | | |
| #ifndef NE_XMLREQ_H | | #ifndef NE_XMLREQ_H | |
| #define NE_XMLREQ_H | | #define NE_XMLREQ_H | |
| | | | |
| #include "ne_request.h" | | #include "ne_request.h" | |
| #include "ne_xml.h" | | #include "ne_xml.h" | |
| | | | |
|
| BEGIN_NEON_DECLS | | NE_BEGIN_DECLS | |
| | | | |
| /* Read the HTTP response body using calls to ne_read_response_block | | /* Read the HTTP response body using calls to ne_read_response_block | |
| * (so must be enclosed by ne_begin_request/ne_end_request calls), and | | * (so must be enclosed by ne_begin_request/ne_end_request calls), and | |
| * parse it as an XML document, using the given parser. Returns NE_* | | * parse it as an XML document, using the given parser. Returns NE_* | |
| * error codes. If an XML parse error occurs, the session error | | * error codes. If an XML parse error occurs, the session error | |
| * string is set to the XML parser's error string, and NE_ERROR is | | * string is set to the XML parser's error string, and NE_ERROR is | |
| * returned. */ | | * returned. */ | |
| int ne_xml_parse_response(ne_request *req, ne_xml_parser *parser); | | int ne_xml_parse_response(ne_request *req, ne_xml_parser *parser); | |
| | | | |
| /* Dispatch the HTTP request, parsing the response body as an XML | | /* Dispatch the HTTP request, parsing the response body as an XML | |
|
| * document using * the given parser, if the response status class is | | * document using the given parser, if the response status class is | |
| * 2xx. Returns NE_* error codes. If an XML parse error occurs, the | | * 2xx. Returns NE_* error codes. If an XML parse error occurs, the | |
| * session error string is set to the XML parser's error string, and | | * session error string is set to the XML parser's error string, and | |
| * NE_ERROR is returned. */ | | * NE_ERROR is returned. */ | |
| int ne_xml_dispatch_request(ne_request *req, ne_xml_parser *parser); | | int ne_xml_dispatch_request(ne_request *req, ne_xml_parser *parser); | |
| | | | |
|
| END_NEON_DECLS | | NE_END_DECLS | |
| | | | |
| #endif /* NE_XMLREQ_H */ | | #endif /* NE_XMLREQ_H */ | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 4 lines changed or added | |
|