ne_207.h   ne_207.h 
skipping to change at line 80 skipping to change at line 80
void ne_207_set_response_handlers( void ne_207_set_response_handlers(
ne_207_parser *p, ne_207_start_response start, ne_207_end_response end) ; ne_207_parser *p, ne_207_start_response start, ne_207_end_response end) ;
void ne_207_set_propstat_handlers( void ne_207_set_propstat_handlers(
ne_207_parser *p, ne_207_start_propstat start, ne_207_end_propstat end) ; ne_207_parser *p, ne_207_start_propstat start, ne_207_end_propstat end) ;
void ne_207_destroy(ne_207_parser *p); void ne_207_destroy(ne_207_parser *p);
/* An acceptance function which only accepts 207 responses */ /* An acceptance function which only accepts 207 responses */
int ne_accept_207(void *userdata, ne_request *req, ne_status *status); int ne_accept_207(void *userdata, ne_request *req, const ne_status *status) ;
void *ne_207_get_current_propstat(ne_207_parser *p); void *ne_207_get_current_propstat(ne_207_parser *p);
void *ne_207_get_current_response(ne_207_parser *p); void *ne_207_get_current_response(ne_207_parser *p);
/* Call this as the LAST thing before beginning parsing, to install a /* Call this as the LAST thing before beginning parsing, to install a
* catch-all handler which means all unknown XML returned in the 207 * catch-all handler which means all unknown XML returned in the 207
* response is ignored gracefully. */ * response is ignored gracefully. */
void ne_207_ignore_unknown(ne_207_parser *p); void ne_207_ignore_unknown(ne_207_parser *p);
/* Dispatch a DAV request and handle a 207 error response appropriately */ /* Dispatch a DAV request and handle a 207 error response appropriately */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 ne_alloc.h   ne_alloc.h 
skipping to change at line 43 skipping to change at line 43
BEGIN_NEON_DECLS BEGIN_NEON_DECLS
/* Set callback which is called if malloc() returns NULL. */ /* Set callback which is called if malloc() returns NULL. */
void ne_oom_callback(void (*callback)(void)); void ne_oom_callback(void (*callback)(void));
/* Replacements for standard C library memory allocation functions, /* Replacements for standard C library memory allocation functions,
* which never return NULL. If the C library malloc() returns NULL, * which never return NULL. If the C library malloc() returns NULL,
* neon will abort(); calling an OOM callback beforehand if one is * neon will abort(); calling an OOM callback beforehand if one is
* registered. The C library will only ever return NULL if the * registered. The C library will only ever return NULL if the
* operating system does not use optimistic memory allocation. */ * operating system does not use optimistic memory allocation. */
void *ne_malloc(size_t len); void *ne_malloc(size_t size);
void *ne_calloc(size_t len); void *ne_calloc(size_t size);
void *ne_realloc(void *ptr, size_t len); void *ne_realloc(void *ptr, size_t s);
char *ne_strdup(const char *s); char *ne_strdup(const char *s);
char *ne_strndup(const char *s, size_t n); char *ne_strndup(const char *s, size_t n);
/* Handy macro to free things: takes an lvalue, and sets to NULL /* Handy macro to free things: takes an lvalue, and sets to NULL
* afterwards. */ * afterwards. */
#define NE_FREE(x) do { if ((x) != NULL) free((x)); (x) = NULL; } while (0) #define NE_FREE(x) do { if ((x) != NULL) free((x)); (x) = NULL; } while (0)
END_NEON_DECLS END_NEON_DECLS
#endif /* NE_ALLOC_H */ #endif /* NE_ALLOC_H */
 End of changes. 1 change blocks. 
3 lines changed or deleted 3 lines changed or added


 ne_redirect.h   ne_redirect.h 
skipping to change at line 29 skipping to change at line 29
*/ */
#ifndef NE_REDIRECT_H #ifndef NE_REDIRECT_H
#define NE_REDIRECT_H #define NE_REDIRECT_H
#include "ne_request.h" #include "ne_request.h"
BEGIN_NEON_DECLS BEGIN_NEON_DECLS
/* The redirect code does not handle redirects to a different server. /* Register redirect handling: if a redirection response is given, the
* For a redirect to a different server, the request fails and returns * request will fail with the NE_REDIRECT code, and the destinsation
* NE_REDIRECT. You can then retrieve the redirect location using the * of the redirect can be retrieved using ne_redirect_location(). */
* call ne_redirect_location. void ne_redirect_register(ne_session *sess);
*
* (you must have called ne_redirect_register for this to happen).
* */
/* Get confirmation from the user that a redirect from
* URI 'src' to URI 'dest' is acceptable. Should return:
* Non-Zero to FOLLOW the redirect
* Zero to NOT follow the redirect
*/
typedef int (*ne_redirect_confirm)(void *userdata,
const char *src, const char *dest);
/* Notify the user that a redirect has been automatically
* followed from URI 'src' to URI 'dest' */
typedef void (*ne_redirect_notify)(void *userdata,
const char *src, const char *dest);
/* Register redirect handling for the given session.
* Some redirect responses will be automatically followed.
* If the redirect is automatically followed, the 'notify' callback
* is called.
* For redirects which are NOT automatically followed, the
* 'confirm' callback is called: if this returns zero, the redirect
* is ignored.
*
* 'confirm' may be passed as NULL: in this case, only automatic
* redirects are followed. 'notify' may also be passed as NULL,
* automatic redirects are still followed.
*
* 'userdata' is passed as the first argument to the confirm and
* notify callbacks. */
void ne_redirect_register(ne_session *sess,
ne_redirect_confirm confirm,
ne_redirect_notify notify,
void *userdata);
/* Return location of last redirect. */ /* Returns location of last redirect. */
const char *ne_redirect_location(ne_session *sess); const ne_uri *ne_redirect_location(ne_session *sess);
END_NEON_DECLS END_NEON_DECLS
#endif /* NE_REDIRECT_H */ #endif /* NE_REDIRECT_H */
 End of changes. 2 change blocks. 
41 lines changed or deleted 6 lines changed or added


 ne_request.h   ne_request.h 
skipping to change at line 99 skipping to change at line 99
* 1) 'acceptance' callback: determines whether you want to handle the * 1) 'acceptance' callback: determines whether you want to handle the
* response body given the response-status information, e.g., if you * response body given the response-status information, e.g., if you
* only want 2xx responses, say so here. * only want 2xx responses, say so here.
* *
* 2) 'reader' callback: passed blocks of the response-body as they * 2) 'reader' callback: passed blocks of the response-body as they
* arrive, if the acceptance callback returned non-zero. */ * arrive, if the acceptance callback returned non-zero. */
/* 'acceptance' callback type. Return non-zero to accept the response, /* 'acceptance' callback type. Return non-zero to accept the response,
* else zero to ignore it. */ * else zero to ignore it. */
typedef int (*ne_accept_response)( typedef int (*ne_accept_response)(
void *userdata, ne_request *req, ne_status *st); void *userdata, ne_request *req, const ne_status *st);
/* An 'acceptance' callback which only accepts 2xx-class responses. /* An 'acceptance' callback which only accepts 2xx-class responses.
* Ignores userdata. */ * Ignores userdata. */
int ne_accept_2xx(void *userdata, ne_request *req, ne_status *st); int ne_accept_2xx(void *userdata, ne_request *req, const ne_status *st);
/* An acceptance callback which accepts all responses. Ignores /* An acceptance callback which accepts all responses. Ignores
* userdata. */ * userdata. */
int ne_accept_always(void *userdata, ne_request *req, ne_status *st); int ne_accept_always(void *userdata, ne_request *req, const ne_status *st);
/* The 'reader' callback type. */
typedef void (*ne_block_reader)(void *userdata, const char *block, size_t l
en);
/* Add a response reader for the given request, with the given /* Add a response reader for the given request, with the given
* acceptance function. userdata is passed as the first argument to * acceptance function. userdata is passed as the first argument to
* the acceptance + reader callbacks. * the acceptance + reader callbacks.
* *
* The acceptance callback is called once each time the request is * The acceptance callback is called once each time the request is
* sent: it may be sent >1 time because of authentication retries etc. * sent: it may be sent >1 time because of authentication retries etc.
* For each time the acceptance callback is called, if it returns * For each time the acceptance callback is called, if it returns
* non-zero, blocks of the response body will be passed to the reader * non-zero, blocks of the response body will be passed to the reader
* callback as the response is read. After all the response body has * callback as the response is read. After all the response body has
skipping to change at line 192 skipping to change at line 189
* *
* NB: NE_AUTH and NE_AUTHPROXY mean that the USER supplied the * NB: NE_AUTH and NE_AUTHPROXY mean that the USER supplied the
* wrong username/password. SERVER/PROXYAUTH mean that, after the * wrong username/password. SERVER/PROXYAUTH mean that, after the
* server has accepted a valid username/password, the server/proxy did * server has accepted a valid username/password, the server/proxy did
* not authenticate the response message correctly. * not authenticate the response message correctly.
* */ * */
int ne_request_dispatch(ne_request *req); int ne_request_dispatch(ne_request *req);
/* Returns a pointer to the response status information for the /* Returns a pointer to the response status information for the
* given request. */ * given request. */
const ne_status *ne_get_status(ne_request *req) const ne_status *ne_get_status(const ne_request *req)
/* Declare this with attribute const, since we often call it >1 times /* Declare this with attribute const, since we often call it >1 times
* with the same argument, and it will return the same thing each * with the same argument, and it will return the same thing each
* time. This lets the compiler optimize away any subsequent calls * time. This lets the compiler optimize away any subsequent calls
* (theoretically). */ * (theoretically). */
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__ ((const)) __attribute__ ((const))
#endif /* __GNUC__ */ #endif /* __GNUC__ */
; ;
/* Returns pointer to session associated with request. */ /* Returns pointer to session associated with request. */
ne_session *ne_get_session(ne_request *req); ne_session *ne_get_session(const ne_request *req);
/* Destroy memory associated with request pointer */ /* Destroy memory associated with request pointer */
void ne_request_destroy(ne_request *req); void ne_request_destroy(ne_request *req);
/* "Caller-pulls" request interface. This is an ALTERNATIVE interface /* "Caller-pulls" request interface. This is an ALTERNATIVE interface
* to ne_request_dispatch: either use that, or do all this yourself: * to ne_request_dispatch: either use that, or do all this yourself:
* *
* caller must call: * caller must call:
* 1. ne_begin_request (fail if returns non-NE_OK) * 1. ne_begin_request (fail if returns non-NE_OK)
* 2. while(ne_read_response_block(...) > 0) ... loop ...; * 2. while(ne_read_response_block(...) > 0) ... loop ...;
skipping to change at line 258 skipping to change at line 255
* NE_OK everything is okay * NE_OK everything is okay
* NE_RETRY try sending the request again. * NE_RETRY try sending the request again.
* anything else signifies an error, and the request is failed. The return * anything else signifies an error, and the request is failed. The return
* code is passed back the _dispatch caller, so the session error must * code is passed back the _dispatch caller, so the session error must
* also be set appropriately (ne_set_error). * also be set appropriately (ne_set_error).
*/ */
typedef int (*ne_post_send_fn)(void *userdata, const ne_status *status); typedef int (*ne_post_send_fn)(void *userdata, 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_destory_fn)(void *userdata); typedef void (*ne_destroy_fn)(void *userdata);
void ne_hook_destroy_request(ne_session *sess, void ne_hook_destroy_request(ne_session *sess,
ne_destory_fn fn, void *userdata); ne_destroy_fn 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_destory_fn fn, void *userdata); ne_destroy_fn fn, void *userdata);
/* Hook used to allow external access into hook processing. */ /* Hook used to allow external access into hook processing. */
typedef void *(*ne_accessor_fn)(void *userdata); typedef void *(*ne_accessor_fn)(void *userdata);
void ne_hook_session_accessor(ne_session *sess, const char *id, void ne_hook_session_accessor(ne_session *sess, const char *id,
ne_accessor_fn, void *userdata); ne_accessor_fn, void *userdata);
void ne_hook_request_accessor(ne_request *req, const char *id, void ne_hook_request_accessor(ne_request *req, const char *id,
ne_accessor_fn, void *userdata); ne_accessor_fn, void *userdata);
/* an accessor which simply returns the userdata. */ /* an accessor which simply returns the userdata. */
void *ne_null_accessor(void *userdata); void *ne_null_accessor(void *userdata);
 End of changes. 8 change blocks. 
12 lines changed or deleted 8 lines changed or added


 ne_session.h   ne_session.h 
skipping to change at line 29 skipping to change at line 29
*/ */
#ifndef NE_SESSION_H #ifndef NE_SESSION_H
#define NE_SESSION_H 1 #define NE_SESSION_H 1
#ifdef NEON_SSL #ifdef NEON_SSL
#include <openssl/ssl.h> #include <openssl/ssl.h>
#endif #endif
#include "ne_socket.h" /* for sock_progress */ #include "ne_socket.h" /* for ne_progress */
#include "ne_uri.h" /* for ne_uri */ #include "ne_uri.h" /* for ne_uri */
#include "ne_defs.h" #include "ne_defs.h"
BEGIN_NEON_DECLS BEGIN_NEON_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. */
skipping to change at line 68 skipping to change at line 68
* with requests with bodies. * with requests with bodies.
* *
* persist: When set, use a persistent connection. (Generally, * persist: When set, use a persistent connection. (Generally,
* you don't want to turn this off.) * you don't want to turn this off.)
* */ * */
void ne_set_expect100(ne_session *sess, int use_expect100); void ne_set_expect100(ne_session *sess, int use_expect100);
void ne_set_persist(ne_session *sess, int persist); void ne_set_persist(ne_session *sess, int persist);
/* Set a progress callback for the session. */ /* Set a progress callback for the session. */
void ne_set_progress(ne_session *sess, void ne_set_progress(ne_session *sess,
sock_progress progress, void *userdata); ne_progress progress, void *userdata);
typedef enum { typedef enum {
ne_conn_namelookup, /* lookup up hostname (info = hostname) */ ne_conn_namelookup, /* lookup up hostname (info = hostname) */
ne_conn_connecting, /* connecting to host (info = hostname) */ ne_conn_connecting, /* connecting to host (info = hostname) */
ne_conn_connected, /* connected to host (info = hostname) */ ne_conn_connected, /* connected to host (info = hostname) */
ne_conn_secure /* connection now secure (info = crypto level) */ ne_conn_secure /* connection now secure (info = crypto level) */
} ne_conn_status; } ne_conn_status;
typedef void (*ne_notify_status)(void *userdata, typedef void (*ne_notify_status)(void *userdata,
ne_conn_status status, ne_conn_status status,
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 ne_socket.h   ne_socket.h 
skipping to change at line 44 skipping to change at line 44
#endif #endif
#ifdef NEON_SSL #ifdef NEON_SSL
#include <openssl/ssl.h> #include <openssl/ssl.h>
#endif #endif
#include "ne_defs.h" #include "ne_defs.h"
BEGIN_NEON_DECLS BEGIN_NEON_DECLS
#define SOCK_ERROR -1 #define NE_SOCK_ERROR -1
/* Read/Write timed out */ /* Read/Write timed out */
#define SOCK_TIMEOUT -2 #define NE_SOCK_TIMEOUT -2
/* Passed buffer was full */
#define SOCK_FULL -3
/* Socket was closed */ /* Socket was closed */
#define SOCK_CLOSED -4 #define NE_SOCK_CLOSED -3
struct nsocket_s; typedef struct ne_socket_s ne_socket;
typedef struct nsocket_s nsocket;
typedef void (*sock_block_reader) ( typedef void (*ne_block_reader) (
void *userdata, const char *buf, size_t len); void *userdata, const char *buf, size_t len);
typedef void (*sock_progress)(void *userdata, off_t progress, off_t total); typedef void (*ne_progress)(void *userdata, off_t progress, off_t total);
void sock_register_progress(nsocket *sock, sock_progress cb, void *userdata
);
void sock_call_progress(nsocket *sock, off_t progress, off_t total); void ne_register_progress(ne_socket *sock, ne_progress cb, void *userdata);
/* While neon itself doesn't require per-process global /* While neon itself doesn't require per-process global
* initialization, some platforms do, and so does the OpenSSL * initialization, some platforms do, and so does the OpenSSL
* library. */ * library. */
int sock_init(void); int ne_sock_init(void);
/* Shutdown any underlying libraries. */ /* Shutdown any underlying libraries. */
void sock_exit(void); void ne_sock_exit(void);
/* sock_read is read() with a timeout /* ne_read is read() with a timeout
* Returns: * Returns:
* SOCK_* on error, * NE_SOCK_* on error,
* 0 on no data to read (due to EOF), * 0 on no data to read (due to EOF),
* >0 length of data read into buffer. * >0 length of data read into buffer.
*/ */
int sock_read(nsocket *sock, char *buffer, size_t count); ssize_t ne_sock_read(ne_socket *sock, char *buffer, size_t count);
/* sock_peek is recv() with a timeout /* ne_peek is recv() with a timeout
* Returns: * Returns:
* SOCK_* on error, * NE_SOCK_* on error,
* 0 on no data to read (due to EOF), * 0 on no data to read (due to EOF),
* >0 length of data read into buffer. * >0 length of data read into buffer.
*/ */
int sock_peek(nsocket *sock, char *buffer, size_t count); ssize_t ne_sock_peek(ne_socket *sock, char *buffer, size_t count);
/* Blocks waiting for data on the given socket for the given time. /* Block for up to 'n' seconds until data becomes available for reading
* Returns: * on the socket. Returns:
* SOCK_* on error, * NE_SOCK_* on error,
* SOCK_TIMEOUT on no data within timeout, * NE_SOCK_TIMEOUT if no data arrives in 'n' seconds.
* 0 if data arrived on the socket. * 0 if data arrived on the socket.
*/ */
int sock_block(nsocket *sock, int timeout); int ne_sock_block(ne_socket *sock, int n);
/* Reads readlen bytes from fd and writes to socket. /* Sends the given block of data down the ne_socket. Returns zero on
* (Not all in one go, obviously). * success, NE_SOCK_* on error. */
* If readlen == -1, then it reads from srcfd until EOF. int ne_sock_fullwrite(ne_socket *sock, const char *data, size_t length);
* Returns number of bytes written to destfd, or SOCK_* on error.
*/
int sock_transfer(int fd, nsocket *sock, off_t readlen);
/* Sends the given line to given socket, CRLF appended */ /* Reads a line from given ne_socket */
int sock_sendline(nsocket *sock, const char *line); ssize_t ne_sock_readline(ne_socket *sock, char *line, size_t len);
/* Sends the given block of data down the nsocket. Returns zero on
* success, SOCK_* on error. */
int sock_fullwrite(nsocket *sock, const char *data, size_t length);
/* Sends the null-terminated string down the given nsocket */
int sock_send_string(nsocket *sock, const char *string);
/* Reads a line from given nsocket */ /* Read exactly 'len' bytes into buffer; returns 0 on success, SOCK_*
int sock_readline(nsocket *sock, char *line, int len); * on error. */
/* Reads a chunk of data. */ ssize_t ne_sock_fullread(ne_socket *sock, char *buffer, size_t buflen);
int sock_fullread(nsocket *sock, char *buffer, int buflen);
/* Creates and connects a nsocket */ /* Creates and connects a ne_socket */
nsocket *sock_connect(const struct in_addr host, ne_socket *ne_sock_connect(const struct in_addr host,
unsigned short int portnum); unsigned short int portnum);
/* Not as good as accept(2), missing parms 2+3. /* Not as good as accept(2), missing parms 2+3.
* Addings parms 2+3 would probably mean passing socklen_t as an * Addings parms 2+3 would probably mean passing socklen_t as an
* int then casting internally, since we don't really want to * int then casting internally, since we don't really want to
* autogenerate the header file to be correct for the build platform. * autogenerate the header file to be correct for the build platform.
*/ */
nsocket *sock_accept(int listener); ne_socket *ne_sock_accept(int listener);
/* Returns the file descriptor used for the socket */ /* Returns the file descriptor used for the socket */
int sock_get_fd(nsocket *sock); int ne_sock_fd(const ne_socket *sock);
/* Closes the socket and frees the nsocket object. */ /* Closes the socket and frees the ne_socket object. Returns non-zero
int sock_close(nsocket *sock); * on error. */
int ne_sock_close(ne_socket *sock);
const char *sock_get_error(nsocket *sock); const char *ne_sock_error(const ne_socket *sock);
/* Set read timeout for socket. */ /* Set read timeout for socket. */
void sock_set_read_timeout(nsocket *sock, int timeout); void ne_sock_read_timeout(ne_socket *sock, int timeout);
/* Do a name lookup on given hostname, writes the address into /* Do a name lookup on given hostname, writes the address into
* given address buffer. Return -1 on failure. */ * given address buffer. Return -1 on failure. */
int sock_name_lookup(const char *hostname, struct in_addr *addr); int ne_name_lookup(const char *hostname, struct in_addr *addr);
/* Returns the standard TCP port for the given service */ /* Returns the standard TCP port for the given service */
int sock_service_lookup(const char *name); int ne_service_lookup(const char *name);
/* Read from socket, passing each block read to reader callback.
* Pass userdata as first argument to reader callback.
*
* If length is -1, keep going till EOF is returned. SOCK_CLOSED
* is never returned in this case.
*
* Otherwise, read exactly 'length' bytes. If EOF is encountered
* before length bytes have been read, and SOCK_CLOSED will be
* returned.
*
* Returns:
* 0 on success,
* SOCK_* on error (SOCK_CLOSED is a special case, as above)
*/
int sock_readfile_blocked(nsocket *sock, off_t length,
sock_block_reader reader, void *userdata);
/* Enable SSL/TLS on the socket. Returns non-zero if the SSL /* Enable SSL/TLS on the socket. Returns non-zero if the SSL
* negotiation fails. */ * negotiation fails. */
int sock_enable_ssl(nsocket *sock); int ne_sock_use_ssl(ne_socket *sock);
#ifdef NEON_SSL #ifdef NEON_SSL
/* FIXME: this is a terribly disgusting API. */ /* FIXME: this is a terribly disgusting API. */
/* Enable SSL/TLS, using the given OpenSSL SSL context, and resuming /* Enable SSL/TLS, using the given OpenSSL SSL context, and resuming
* the given session if sess is non-NULL. Returns non-zero if the SSL * the given session if sess is non-NULL. Returns non-zero if the SSL
* negotiation fails. If out is non-NULL, *out is set to the SSL * negotiation fails. If out is non-NULL, *out is set to the SSL
* connection structure from OpenSSL. */ * connection structure from OpenSSL. */
int sock_enable_ssl_os(nsocket *sock, SSL_CTX *ctx, int ne_sock_use_ssl_os(ne_socket *sock, SSL_CTX *ctx,
SSL_SESSION *sess, SSL **out, void *appdata); SSL_SESSION *sess, SSL **out, void *appdata);
#endif #endif
END_NEON_DECLS END_NEON_DECLS
#endif /* NE_SOCKET_H */ #endif /* NE_SOCKET_H */
 End of changes. 30 change blocks. 
73 lines changed or deleted 42 lines changed or added


 ne_string.h   ne_string.h 
skipping to change at line 32 skipping to change at line 32
#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 BEGIN_NEON_DECLS
/* Returns an ne_malloc-allocated UTF-8 encoded copy of 'str'. */ /* ne_token and ne_qtoken return the next token in *str between *str
char *ne_utf8_encode(const char *str); * and separator character 'sep' or the NUL terminator. ne_qtoken
* skips over any parts quoted using a pair of any one of the
/* Returns an ne_malloc-allocated UTF-8 decode copy of 'str'. * characters given in 'quotes'. After returning, *str will point to
* Returns NULL if any of the characters in 'str' are non-8-bit.
*/
char *ne_utf8_decode(const char *str);
/* Simple string tokenizer.
*
* Returns the next token in *str between *str and 'separator' or NUL
* terminator, skipping over any parts quoted using a pair of any
* character found 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. quotes may be NULL. * separator characters were found.
* *
* Returns NULL if unbalanced quotes are found. (this will not * ne_qtoken may return NULL if unterminated quotes are found. */
* happen if quotes == NULL). */ char *ne_token(char **str, char sep);
char *ne_token(char **str, char separator, const char *quotes); char *ne_qtoken(char **str, char sep, const char *quotes);
/* Return portion of 'str' with any characters in 'whitespace' shaved /* Return portion of 'str' with any characters in 'whitespace' shaved
* off the beginning and end. Modifies str. */ * off the beginning and end. Modifies str. */
char *ne_shave(char *str, const char *whitespace); char *ne_shave(char *str, const char *whitespace);
/* A base64 encoder: converts 'len' bytes of 'text' to base64.
* Returns malloc-allocated buffer; caller must free(). */
char *ne_base64(const char *text, size_t len);
/*** OBSOLETE INTERFACES ***/ /*** OBSOLETE INTERFACES ***/
char **split_string(const char *str, const char seperator, char **split_string(const char *str, const char seperator,
const char *quotes, const char *whitespace); const char *quotes, const char *whitespace);
char **split_string_c(const char *str, const char seperator, char **split_string_c(const char *str, const char seperator,
const char *quotes, const char *whitespace, int *count ); const char *quotes, const char *whitespace, int *count );
char **pair_string(const char *str, const char compsep, const char kvsep, char **pair_string(const char *str, const char compsep, const char kvsep,
const char *quotes, const char *whitespace); const char *quotes, const char *whitespace);
void split_string_free(char **components); void split_string_free(char **components);
void pair_string_free(char **pairs); void pair_string_free(char **pairs);
/*** END OF OBSOLETE INTERFACES */ /*** END OF OBSOLETE INTERFACES */
/* String buffer handling. (Strings are zero-terminated still). A /* String buffer handling. (Strings are zero-terminated still). A
* string buffer ne_buffer * which grows dynamically with the * string buffer ne_buffer * which grows dynamically with the
* string. */ * string. */
struct ne_buffer_s { typedef struct {
char *data; /* contents: null-terminated string. */ char *data; /* contents: null-terminated string. */
size_t used; /* used bytes in buffer */ size_t used; /* used bytes in buffer */
size_t length; /* length of buffer */ size_t length; /* length of buffer */
}; } ne_buffer;
typedef struct ne_buffer_s ne_buffer;
/* Returns size of data in buffer, equiv to strlen(ne_buffer_data(buf)) */ /* Returns size of data in buffer, equiv to strlen(ne_buffer_data(buf)) */
#define ne_buffer_size(buf) ((buf)->used - 1) #define ne_buffer_size(buf) ((buf)->used - 1)
/* Concatenate all given strings onto the end of the buffer. The /* Concatenate all given strings onto the end of the buffer. The
* strings must all be NUL-terminated, and MUST be followed by a NULL * strings must all be NUL-terminated, and MUST be followed by a NULL
* argument marking the end of the list. */ * argument marking the end of the list. */
void ne_buffer_concat(ne_buffer *buf, ...); void ne_buffer_concat(ne_buffer *buf, ...);
/* Create a new ne_buffer. Returns NULL on error */ /* Create a new ne_buffer. */
ne_buffer *ne_buffer_create(void); ne_buffer *ne_buffer_create(void);
/* Create a new ne_buffer of given minimum size. Returns NULL on error */ /* Create a new ne_buffer of given minimum size. */
ne_buffer *ne_buffer_create_sized(size_t size); ne_buffer *ne_buffer_ncreate(size_t size);
/* Destroys (deallocates) a buffer */ /* Destroys (deallocates) a buffer */
void ne_buffer_destroy(ne_buffer *buf); void ne_buffer_destroy(ne_buffer *buf);
/* Append a NUL-terminated string 'str' to buf. */ /* Append a NUL-terminated string 'str' to buf. */
void ne_buffer_zappend(ne_buffer *buf, const char *str); void ne_buffer_zappend(ne_buffer *buf, const char *str);
/* Append 'len' bytes of 'data' to buf. 'data' does not need to be /* Append 'len' bytes of 'data' to buf. 'data' does not need to be
* NUL-terminated. The resultant string will have a NUL-terminator, * NUL-terminated. The resultant string will have a NUL-terminator,
* either way. */ * either way. */
 End of changes. 8 change blocks. 
24 lines changed or deleted 17 lines changed or added


 ne_xml.h   ne_xml.h 
skipping to change at line 178 skipping to change at line 178
void ne_xml_parse_v(void *userdata, const char *block, size_t len); void ne_xml_parse_v(void *userdata, const char *block, size_t len);
/* Return current parse line for errors */ /* Return current parse line for errors */
int ne_xml_currentline(ne_xml_parser *p); int ne_xml_currentline(ne_xml_parser *p);
/* Set error message for parser */ /* Set error message for parser */
void ne_xml_set_error(ne_xml_parser *p, const char *msg); void ne_xml_set_error(ne_xml_parser *p, const char *msg);
const char *ne_xml_get_error(ne_xml_parser *p); const char *ne_xml_get_error(ne_xml_parser *p);
/* Get attribute of given name. TODO: doesn't consider namespaces. */ /* From a start_element callback which was passed 'attrs' using given
const char *ne_xml_get_attr(const char **attrs, const char *name); * parser, return attribute of given name and namespace. If nspace is
* NULL, no namespace resolution is performed. */
const char *ne_xml_get_attr(ne_xml_parser *parser,
const char **attrs, const char *nspace,
const char *name);
END_NEON_DECLS END_NEON_DECLS
#endif /* NE_XML_H */ #endif /* NE_XML_H */
 End of changes. 1 change blocks. 
2 lines changed or deleted 6 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/