| ne_auth.h | | ne_auth.h | |
| /* | | /* | |
| HTTP authentication routines | | HTTP authentication routines | |
|
| Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2007, 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 78 | | skipping to change at line 78 | |
| /* NE_AUTH_DIGEST: Digest authentication uses a hash of the username, | | /* NE_AUTH_DIGEST: Digest authentication uses a hash of the username, | |
| * password, and certain aspects of the request, so prevents passive | | * password, and certain aspects of the request, so prevents passive | |
| * attackers from obtaining the credentials; active attackers can | | * attackers from obtaining the credentials; active attackers can | |
| * still modify most of the request/response if using an unsecured | | * still modify most of the request/response if using an unsecured | |
| * channel. */ | | * channel. */ | |
| #define NE_AUTH_DIGEST (0x0002) | | #define NE_AUTH_DIGEST (0x0002) | |
| /* NE_AUTH_NEGOTIATE: Negotiate uses GSSAPI/SSPI to authenticate the | | /* NE_AUTH_NEGOTIATE: Negotiate uses GSSAPI/SSPI to authenticate the | |
| * user; an active attacker can modify any of the request/response at | | * user; an active attacker can modify any of the request/response at | |
| * will, so this must not be used over an unsecured channel. */ | | * will, so this must not be used over an unsecured channel. */ | |
| #define NE_AUTH_NEGOTIATE (0x0004) | | #define NE_AUTH_NEGOTIATE (0x0004) | |
|
| /* All supported protocols. */ | | /* The default set of supported protocols, as deemed appropriate for | |
| #define NE_AUTH_ALL (NE_AUTH_BASIC | NE_AUTH_DIGEST | NE_AUTH_NEGOTIATE) | | * the given session scheme. */ | |
| | | #define NE_AUTH_DEFAULT (0x1000) | |
| | | /* All protocols supported by the library. */ | |
| | | #define NE_AUTH_ALL (0x2000) | |
| | | | |
| /* Add a callback to provide credentials for server and proxy | | /* Add a callback to provide credentials for server and proxy | |
| * authentication using a particular auth protocol or set of | | * authentication using a particular auth protocol or set of | |
| * protocols. The protocol is supplied as a bitmask of NE_AUTH_* | | * protocols. The protocol is supplied as a bitmask of NE_AUTH_* | |
| * values. For NE_AUTH_NEGOTIATE, the creds and userdata arguments | | * values. For NE_AUTH_NEGOTIATE, the creds and userdata arguments | |
| * are ignored and may be NULL. | | * are ignored and may be NULL. | |
| * | | * | |
| * These functions may be called multiple times per session to | | * These functions may be called multiple times per session to | |
| * register callbacks for different protocols. If the server presents | | * register callbacks for different protocols. If the server presents | |
| * more than one protocol in an auth challenge, the following | | * more than one protocol in an auth challenge, the following | |
| | | | |
End of changes. 2 change blocks. |
| 3 lines changed or deleted | | 6 lines changed or added | |
|
| ne_basic.h | | ne_basic.h | |
| /* | | /* | |
| HTTP/1.1 methods | | HTTP/1.1 methods | |
|
| Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2008, 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 70 | | skipping to change at line 70 | |
| const char *src, const char *dest); | | const char *src, const char *dest); | |
| | | | |
| /* Delete resource at 'path'. */ | | /* Delete resource at 'path'. */ | |
| int ne_delete(ne_session *sess, const char *path); | | int ne_delete(ne_session *sess, const char *path); | |
| /* Create a collection at 'path', which MUST have a trailing slash. */ | | /* Create a collection at 'path', which MUST have a trailing slash. */ | |
| int ne_mkcol(ne_session *sess, const char *path); | | int ne_mkcol(ne_session *sess, const char *path); | |
| | | | |
| /* Adds a Depth: header to a request */ | | /* Adds a Depth: header to a request */ | |
| void ne_add_depth_header(ne_request *req, int depth); | | void ne_add_depth_header(ne_request *req, int depth); | |
| | | | |
|
| /* Retrieve modification time of resource at location 'path', place in | | /* Retrieve modification time of resource at location 'path', using | |
| * *modtime. (uses HEAD) */ | | * the HEAD method, placing parsed time in *modtime. *modtime is set | |
| | | * to -1 if no Last-Modified response header was given, or the date | |
| | | * given could not be parsed. */ | |
| int ne_getmodtime(ne_session *sess, const char *path, time_t *modtime); | | int ne_getmodtime(ne_session *sess, const char *path, time_t *modtime); | |
| | | | |
| typedef struct { | | typedef struct { | |
| const char *type, *subtype; | | const char *type, *subtype; | |
| const char *charset; | | const char *charset; | |
| char *value; | | char *value; | |
| } ne_content_type; | | } ne_content_type; | |
| | | | |
| /* Retrieve the content-type of the response; returns zero if response | | /* Retrieve the content-type of the response; returns zero if response | |
| * had valid content-type, in which case all fields in *ctype are set | | * had valid content-type, in which case all fields in *ctype are set | |
| * (and never NULL); the caller must free(ctype->value) after use. | | * (and never NULL); the caller must free(ctype->value) after use. | |
| * Returns non-zero on error, in which case *ctype is not altered. */ | | * Returns non-zero on error, in which case *ctype is not altered. */ | |
| int ne_get_content_type(ne_request *req, ne_content_type *ctype); | | int ne_get_content_type(ne_request *req, ne_content_type *ctype); | |
| | | | |
|
| /* Server capabilities: */ | | /* DEPRECATED: Server capabilities. */ | |
| typedef struct { | | typedef struct { | |
| unsigned int dav_class1; /* True if Class 1 WebDAV server */ | | unsigned int dav_class1; /* True if Class 1 WebDAV server */ | |
| unsigned int dav_class2; /* True if Class 2 WebDAV server */ | | unsigned int dav_class2; /* True if Class 2 WebDAV server */ | |
| unsigned int dav_executable; /* True if supports the 'executable' | | unsigned int dav_executable; /* True if supports the 'executable' | |
| * property a. la. mod_dav */ | | * property a. la. mod_dav */ | |
| } ne_server_capabilities; | | } ne_server_capabilities; | |
| | | | |
|
| /* Determines server capabilities (using OPTIONS). Pass 'path' as "*" | | /* DEPRECATED: Determines server capabilities (using OPTIONS). */ | |
| * to determine proxy server capabilities if using a proxy server. */ | | | |
| int ne_options(ne_session *sess, const char *path, | | int ne_options(ne_session *sess, const char *path, | |
|
| ne_server_capabilities *caps); | | ne_server_capabilities *caps); | |
| | | | |
| | | #define NE_CAP_DAV_CLASS1 (0x0001) /* Class 1 WebDAV (RFC 2518) */ | |
| | | #define NE_CAP_DAV_CLASS2 (0x0002) /* Class 2 WebDAV (RFC 2518) */ | |
| | | #define NE_CAP_DAV_CLASS3 (0x0004) /* Class 3 WebDAV (RFC 4918) */ | |
| | | #define NE_CAP_MODDAV_EXEC (0x0008) /* mod_dav "executable" property */ | |
| | | #define NE_CAP_DAV_ACL (0x0010) /* WebDAV ACL (RFC 3744) */ | |
| | | #define NE_CAP_VER_CONTROL (0x0020) /* DeltaV version-control */ | |
| | | #define NE_CAP_CO_IN_PLACE (0x0040) /* DeltaV checkout-in-place */ | |
| | | #define NE_CAP_VER_HISTORY (0x0080) /* DeltaV version-history */ | |
| | | #define NE_CAP_WORKSPACE (0x0100) /* DeltaV workspace */ | |
| | | #define NE_CAP_UPDATE (0x0200) /* DeltaV update */ | |
| | | #define NE_CAP_LABEL (0x0400) /* DeltaV label */ | |
| | | #define NE_CAP_WORK_RESOURCE (0x0800) /* DeltaV working-resouce */ | |
| | | #define NE_CAP_MERGE (0x1000) /* DeltaV merge */ | |
| | | #define NE_CAP_BASELINE (0x2000) /* DeltaV baseline */ | |
| | | #define NE_CAP_ACTIVITY (0x4000) /* DeltaV activity */ | |
| | | #define NE_CAP_VC_COLLECTION (0x8000) /* DeltaV version-controlled-collecti | |
| | | on */ | |
| | | | |
| | | /* Determines resource capailities, using an OPTIONS request. On | |
| | | * return, *caps is set to a bit-mask of the above NE_CAP_* constants | |
| | | * describing the advertised resource capabilities. */ | |
| | | int ne_options2(ne_session *sess, const char *path, unsigned int *caps); | |
| | | | |
| /* Defines a range of bytes, starting at 'start' and ending | | /* Defines a range of bytes, starting at 'start' and ending | |
| * at 'end'. 'total' is the number of bytes in the range. | | * at 'end'. 'total' is the number of bytes in the range. | |
| */ | | */ | |
| typedef struct { | | typedef struct { | |
| ne_off_t start, end, total; | | ne_off_t start, end, total; | |
| } ne_content_range; | | } ne_content_range; | |
| | | | |
| /* Partial GET. range->start must be >= 0. range->total is ignored. | | /* Partial GET. range->start must be >= 0. range->total is ignored. | |
| * | | * | |
| | | | |
End of changes. 5 change blocks. |
| 7 lines changed or deleted | | 31 lines changed or added | |
|
| ne_request.h | | ne_request.h | |
| /* | | /* | |
| HTTP Request Handling | | HTTP Request Handling | |
|
| Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2006, 2008, 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 281 | | skipping to change at line 281 | |
| typedef int (*ne_post_send_fn)(ne_request *req, void *userdata, | | typedef int (*ne_post_send_fn)(ne_request *req, void *userdata, | |
| const ne_status *status); | | const ne_status *status); | |
| void ne_hook_post_send(ne_session *sess, ne_post_send_fn fn, void *userdata
); | | void ne_hook_post_send(ne_session *sess, ne_post_send_fn fn, void *userdata
); | |
| | | | |
| /* 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 about to be 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); | |
| | | | |
|
| | | typedef void (*ne_close_conn_fn)(void *userdata); | |
| | | /* Hook called when the connection is closed; note that this hook | |
| | | * may be called *AFTER* the destroy_session hook. */ | |
| | | void ne_hook_close_conn(ne_session *sess, ne_close_conn_fn fn, void *userda | |
| | | ta); | |
| | | | |
| /* The ne_unhook_* functions remove a hook registered with the given | | /* The ne_unhook_* functions remove a hook registered with the given | |
| * session. If a hook is found which was registered with a given | | * session. If a hook is found which was registered with a given | |
| * function 'fn', and userdata pointer 'userdata', then it will be | | * function 'fn', and userdata pointer 'userdata', then it will be | |
| * removed from the hooks list. | | * removed from the hooks list. | |
| * | | * | |
| * It is unsafe to use any of these functions from a hook function to | | * It is unsafe to use any of these functions from a hook function to | |
| * unregister itself, except for ne_unhook_destroy_request. */ | | * unregister itself, except for ne_unhook_destroy_request. */ | |
| void ne_unhook_create_request(ne_session *sess, | | void ne_unhook_create_request(ne_session *sess, | |
| ne_create_request_fn fn, void *userdata); | | 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_pre_send(ne_session *sess, ne_pre_send_fn fn, void *userdata
); | |
| void ne_unhook_post_headers(ne_session *sess, ne_post_headers_fn fn, void *
userdata); | | void ne_unhook_post_headers(ne_session *sess, ne_post_headers_fn fn, void *
userdata); | |
| void ne_unhook_post_send(ne_session *sess, ne_post_send_fn fn, void *userda
ta); | | void ne_unhook_post_send(ne_session *sess, ne_post_send_fn fn, void *userda
ta); | |
| void ne_unhook_destroy_request(ne_session *sess, | | void ne_unhook_destroy_request(ne_session *sess, | |
| ne_destroy_req_fn fn, void *userdata); | | ne_destroy_req_fn fn, void *userdata); | |
| void ne_unhook_destroy_session(ne_session *sess, | | void ne_unhook_destroy_session(ne_session *sess, | |
| ne_destroy_sess_fn fn, void *userdata); | | ne_destroy_sess_fn fn, void *userdata); | |
|
| | | void ne_unhook_close_conn(ne_session *sess, | |
| | | ne_close_conn_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); | |
| | | | |
| NE_END_DECLS | | NE_END_DECLS | |
| | | | |
| #endif /* NE_REQUEST_H */ | | #endif /* NE_REQUEST_H */ | |
| | | | |
End of changes. 4 change blocks. |
| 2 lines changed or deleted | | 10 lines changed or added | |
|
| ne_session.h | | ne_session.h | |
| /* | | /* | |
| HTTP session handling | | HTTP session handling | |
|
| Copyright (C) 1999-2007, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2008, 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 49 | | skipping to change at line 49 | |
| 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. This function | |
| | | * must only be called before any requests are created 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); | |
| | | | |
| /* Defined session flags: */ | | /* Defined session flags: */ | |
| typedef enum ne_session_flag_e { | | typedef enum ne_session_flag_e { | |
| NE_SESSFLAG_PERSIST = 0, /* disable this flag to prevent use of | | NE_SESSFLAG_PERSIST = 0, /* disable this flag to prevent use of | |
| * persistent connections. */ | | * persistent connections. */ | |
| | | | |
| NE_SESSFLAG_ICYPROTO, /* enable this flag to enable support for | | NE_SESSFLAG_ICYPROTO, /* enable this flag to enable support for | |
| * non-HTTP ShoutCast-style "ICY" responses. */ | | * non-HTTP ShoutCast-style "ICY" responses. */ | |
| | | | |
| skipping to change at line 73 | | skipping to change at line 75 | |
| | | | |
| NE_SESSFLAG_RFC4918, /* enable this flag to enable support for | | NE_SESSFLAG_RFC4918, /* enable this flag to enable support for | |
| * RFC4918-only WebDAV features; losing | | * RFC4918-only WebDAV features; losing | |
| * backwards-compatibility with RFC2518 | | * backwards-compatibility with RFC2518 | |
| * servers. */ | | * servers. */ | |
| | | | |
| NE_SESSFLAG_CONNAUTH, /* enable this flag if an awful, broken, | | NE_SESSFLAG_CONNAUTH, /* enable this flag if an awful, broken, | |
| * RFC-violating, connection-based HTTP | | * RFC-violating, connection-based HTTP | |
| * authentication scheme is in use. */ | | * authentication scheme is in use. */ | |
| | | | |
|
| | | NE_SESSFLAG_TLS_SNI, /* disable this flag to disable use of the | |
| | | * TLS Server Name Indication extension. */ | |
| | | | |
| NE_SESSFLAG_LAST /* enum sentinel value */ | | NE_SESSFLAG_LAST /* enum sentinel value */ | |
| } ne_session_flag; | | } ne_session_flag; | |
| | | | |
| /* Set a new value for a particular 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)
; | | 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 | | /* Return 0 if the given flag is not set, >0 it is set, or -1 if the | |
| * flag is not supported. */ | | * flag is not supported. */ | |
| int ne_get_session_flag(ne_session *sess, ne_session_flag flag); | | 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
); | |
| | | | |
|
| | | /* Bind connections to the specified local address. If the address | |
| | | * determined for the remote host has a different family (type) to | |
| | | * 'addr', 'addr' will be ignored. The 'addr' object must remain | |
| | | * valid until the session is destroyed. */ | |
| | | void ne_set_localaddr(ne_session *sess, const ne_inet_addr *addr); | |
| | | | |
| /* DEPRECATED: Progress callback. */ | | /* DEPRECATED: Progress callback. */ | |
| typedef void (*ne_progress)(void *userdata, ne_off_t progress, ne_off_t tot
al); | | typedef void (*ne_progress)(void *userdata, ne_off_t progress, ne_off_t tot
al); | |
| | | | |
| /* DEPRECATED API: Set a progress callback for the session; this is | | /* DEPRECATED API: Set a progress callback for the session; this is | |
| * deprecated in favour of ne_set_notifier(). The progress callback | | * deprecated in favour of ne_set_notifier(). The progress callback | |
| * is invoked for after each block of the request and response body to | | * is invoked for after each block of the request and response body to | |
| * indicate request and response progress (there is no way to | | * indicate request and response progress (there is no way to | |
| * distinguish between the two using this interface alone). | | * distinguish between the two using this interface alone). | |
| * | | * | |
| * NOTE: Use of this interface is mutually exclusive with the use of | | * NOTE: Use of this interface is mutually exclusive with the use of | |
| | | | |
| skipping to change at line 156 | | skipping to change at line 167 | |
| /* Callback invoked to notify a new session status event, given by the | | /* Callback invoked to notify a new session status event, given by the | |
| * 'status' argument. On invocation, the contents of exactly one of | | * 'status' argument. On invocation, the contents of exactly one of | |
| * the structures in the info union will be valid, as indicated | | * the structures in the info union will be valid, as indicated | |
| * above. */ | | * above. */ | |
| typedef void (*ne_notify_status)(void *userdata, ne_session_status status, | | typedef void (*ne_notify_status)(void *userdata, ne_session_status status, | |
| const ne_session_status_info *info); | | const ne_session_status_info *info); | |
| | | | |
| /* Set a status notification callback for the session, to report | | /* Set a status notification callback for the session, to report | |
| * session status events. Only one notification callback per session | | * session status events. Only one notification callback per session | |
| * can be registered; the most recent of successive calls to this | | * can be registered; the most recent of successive calls to this | |
|
| * function takes effect. Note that | | * function takes effect. | |
| * | | * | |
| * NOTE: Use of this interface is mutually exclusive with the use of | | * NOTE: Use of this interface is mutually exclusive with the use of | |
| * ne_set_progress(). A call to ne_set_notifier() removes the | | * ne_set_progress(). A call to ne_set_notifier() removes the | |
| * progress callback, and vice versa. */ | | * progress callback, and vice versa. */ | |
| void ne_set_notifier(ne_session *sess, ne_notify_status status, void *userd
ata); | | void ne_set_notifier(ne_session *sess, ne_notify_status status, void *userd
ata); | |
| | | | |
| /* Certificate verification failures. | | /* Certificate verification failures. | |
| * The certificate is not yet valid: */ | | * The certificate is not yet valid: */ | |
| #define NE_SSL_NOTYETVALID (0x01) | | #define NE_SSL_NOTYETVALID (0x01) | |
| /* The certificate has expired: */ | | /* The certificate has expired: */ | |
| | | | |
End of changes. 5 change blocks. |
| 3 lines changed or deleted | | 14 lines changed or added | |
|
| ne_socket.h | | ne_socket.h | |
| /* | | /* | |
| socket handling interface | | socket handling interface | |
|
| Copyright (C) 1999-2006, Joe Orton <joe@manyfish.co.uk> | | Copyright (C) 1999-2007, 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 124 | | skipping to change at line 124 | |
| * the returned name in the 'buf' buffer (of length 'bufsiz') if | | * the returned name in the 'buf' buffer (of length 'bufsiz') if | |
| * successful. Returns zero on success, or non-zero on error. */ | | * successful. Returns zero on success, or non-zero on error. */ | |
| int ne_iaddr_reverse(const ne_inet_addr *ia, char *buf, size_t bufsiz); | | int ne_iaddr_reverse(const ne_inet_addr *ia, char *buf, size_t bufsiz); | |
| | | | |
| /* Destroy a network address object created using ne_iaddr_make. */ | | /* Destroy a network address object created using ne_iaddr_make. */ | |
| void ne_iaddr_free(ne_inet_addr *addr); | | void ne_iaddr_free(ne_inet_addr *addr); | |
| | | | |
| /* Create a socket object; returns NULL on error. */ | | /* Create a socket object; returns NULL on error. */ | |
| ne_socket *ne_sock_create(void); | | ne_socket *ne_sock_create(void); | |
| | | | |
|
| | | /* Specify an address to which the local end of the socket will be | |
| | | * bound during a subsequent ne_sock_connect() call. If the address | |
| | | * passed to ne_sock_connect() is of a different type (family) to | |
| | | * 'addr', 'addr' is ignored. Either 'addr' may be NULL, to use the | |
| | | * given port with unspecified address, or 'port' may be 0, to use the | |
| | | * given address with an unspecified port. | |
| | | * | |
| | | * (Note: This function is not equivalent to a BSD socket bind(), it | |
| | | * only takes effect during the _connect() call). */ | |
| | | void ne_sock_prebind(ne_socket *sock, const ne_inet_addr *addr, | |
| | | unsigned int port); | |
| | | | |
| /* Connect the socket to server at address 'addr' on port 'port'. | | /* Connect the socket to server at address 'addr' on port 'port'. | |
| * Returns zero on success, NE_SOCK_TIMEOUT if a timeout occurs when a | | * Returns zero on success, NE_SOCK_TIMEOUT if a timeout occurs when a | |
| * non-zero connect timeout is configured (and is supported), or | | * non-zero connect timeout is configured (and is supported), or | |
| * NE_SOCK_ERROR on failure. */ | | * NE_SOCK_ERROR on failure. */ | |
| int ne_sock_connect(ne_socket *sock, const ne_inet_addr *addr, | | int ne_sock_connect(ne_socket *sock, const ne_inet_addr *addr, | |
| unsigned int port); | | unsigned int port); | |
| | | | |
| /* Read up to 'count' bytes from socket into 'buffer'. Returns: | | /* Read up to 'count' bytes from socket into 'buffer'. Returns: | |
| * NE_SOCK_* on error, | | * NE_SOCK_* on error, | |
| * >0 length of data read into buffer (may be less than 'count') | | * >0 length of data read into buffer (may be less than 'count') | |
| | | | |
| skipping to change at line 177 | | skipping to change at line 189 | |
| * success, NE_SOCK_* on error. */ | | * success, NE_SOCK_* on error. */ | |
| ssize_t ne_sock_fullread(ne_socket *sock, char *buffer, size_t len); | | ssize_t ne_sock_fullread(ne_socket *sock, char *buffer, size_t len); | |
| | | | |
| /* Accepts a connection from listening socket 'fd' and places the | | /* Accepts a connection from listening socket 'fd' and places the | |
| * socket in 'sock'. Returns zero on success or -1 on failure. */ | | * socket in 'sock'. Returns zero on success or -1 on failure. */ | |
| int ne_sock_accept(ne_socket *sock, int fd); | | int ne_sock_accept(ne_socket *sock, int fd); | |
| | | | |
| /* Returns the file descriptor used for socket 'sock'. */ | | /* Returns the file descriptor used for socket 'sock'. */ | |
| int ne_sock_fd(const ne_socket *sock); | | int ne_sock_fd(const ne_socket *sock); | |
| | | | |
|
| | | /* Return address of peer, or NULL on error. The returned address | |
| | | * must be destroyed by caller using ne_iaddr_free. */ | |
| | | ne_inet_addr *ne_sock_peer(ne_socket *sock, unsigned int *port); | |
| | | | |
| /* Close the socket and destroy the socket object. Returns zero on | | /* Close the socket and destroy the socket object. Returns zero on | |
| * success, or an errno value if close() failed. */ | | * success, or an errno value if close() failed. */ | |
| int ne_sock_close(ne_socket *sock); | | int ne_sock_close(ne_socket *sock); | |
| | | | |
| /* Return current error string for socket. */ | | /* Return current error string for socket. */ | |
| const char *ne_sock_error(const ne_socket *sock); | | const char *ne_sock_error(const ne_socket *sock); | |
| | | | |
| /* Set read timeout for socket, in seconds; must be a non-zero | | /* Set read timeout for socket, in seconds; must be a non-zero | |
| * positive integer. */ | | * positive integer. */ | |
| void ne_sock_read_timeout(ne_socket *sock, int timeout); | | void ne_sock_read_timeout(ne_socket *sock, int timeout); | |
| | | | |
| skipping to change at line 212 | | skipping to change at line 228 | |
| 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); | |
| | | | |
| /* Retrieve the session ID of the current SSL session. If 'buf' is | | /* Retrieve the session ID of the current SSL session. If 'buf' is | |
| * non-NULL, on success, copies at most *buflen bytes to 'buf' and | | * non-NULL, on success, copies at most *buflen bytes to 'buf' and | |
| * sets *buflen to the exact number of bytes copied. If 'buf' is | | * sets *buflen to the exact number of bytes copied. If 'buf' is | |
| * NULL, on success, sets *buflen to the length of the session ID. | | * NULL, on success, sets *buflen to the length of the session ID. | |
| * Returns zero on success, non-zero on error. */ | | * Returns zero on success, non-zero on error. */ | |
| int ne_sock_sessid(ne_socket *sock, unsigned char *buf, size_t *buflen); | | int ne_sock_sessid(ne_socket *sock, unsigned char *buf, size_t *buflen); | |
| | | | |
|
| | | /* Return human-readable name of SSL/TLS cipher used for connection, | |
| | | * or NULL if none. The format of this string is not intended to be | |
| | | * fixed or parseable, but is informational only. Return value is | |
| | | * NUL-terminated malloc-allocated string if not NULL, which must be | |
| | | * freed by the caller. */ | |
| | | char *ne_sock_cipher(ne_socket *sock); | |
| | | | |
| NE_END_DECLS | | NE_END_DECLS | |
| | | | |
| #endif /* NE_SOCKET_H */ | | #endif /* NE_SOCKET_H */ | |
| | | | |
End of changes. 4 change blocks. |
| 1 lines changed or deleted | | 24 lines changed or added | |
|
| ne_ssl.h | | ne_ssl.h | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 70 | |
| * caller. */ | | * caller. */ | |
| char *ne_ssl_cert_export(const ne_ssl_certificate *cert); | | char *ne_ssl_cert_export(const ne_ssl_certificate *cert); | |
| | | | |
| /* Import a certificate from a base64-encoded string as returned by | | /* Import a certificate from a base64-encoded string as returned by | |
| * ne_ssl_cert_export(). Returns a certificate object or NULL if | | * ne_ssl_cert_export(). Returns a certificate object or NULL if | |
| * 'data' was not valid. */ | | * 'data' was not valid. */ | |
| ne_ssl_certificate *ne_ssl_cert_import(const char *data); | | ne_ssl_certificate *ne_ssl_cert_import(const char *data); | |
| | | | |
| /* Returns the identity of the certificate, or NULL if none is given. | | /* Returns the identity of the certificate, or NULL if none is given. | |
| * For a server certificate this will be the hostname of the server to | | * For a server certificate this will be the hostname of the server to | |
|
| * whom the cert was issued. String returned is UTF-8-encoded. */ | | * which the cert was issued. A NUL-terminated UTF-8-encoded string | |
| | | * is returned, which is valid for the lifetime of the certificate | |
| | | * object. */ | |
| const char *ne_ssl_cert_identity(const ne_ssl_certificate *cert); | | const char *ne_ssl_cert_identity(const ne_ssl_certificate *cert); | |
| | | | |
| /* Return the certificate of the entity which signed certificate | | /* Return the certificate of the entity which signed certificate | |
| * 'cert'. Returns NULL if 'cert' is self-signed or the issuer | | * 'cert'. Returns NULL if 'cert' is self-signed or the issuer | |
|
| * certificate is not available. */ | | * certificate is not available; if non-NULL, the pointer is valid for | |
| | | * the lifetime of the certificate object. */ | |
| const ne_ssl_certificate *ne_ssl_cert_signedby(const ne_ssl_certificate *ce
rt); | | const ne_ssl_certificate *ne_ssl_cert_signedby(const ne_ssl_certificate *ce
rt); | |
| | | | |
| /* Returns the distinguished name of the certificate issuer. */ | | /* Returns the distinguished name of the certificate issuer. */ | |
| const ne_ssl_dname *ne_ssl_cert_issuer(const ne_ssl_certificate *cert); | | const ne_ssl_dname *ne_ssl_cert_issuer(const ne_ssl_certificate *cert); | |
| | | | |
| /* Returns the distinguished name of the certificate subject. */ | | /* Returns the distinguished name of the certificate subject. */ | |
| const ne_ssl_dname *ne_ssl_cert_subject(const ne_ssl_certificate *cert); | | const ne_ssl_dname *ne_ssl_cert_subject(const ne_ssl_certificate *cert); | |
| | | | |
| #define NE_SSL_DIGESTLEN (60) | | #define NE_SSL_DIGESTLEN (60) | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 5 lines changed or added | |
|