This commit is contained in:
biosvos
2026-08-07 17:38:18 +09:00
commit 873193a243
9613 changed files with 2755992 additions and 0 deletions
@@ -0,0 +1,53 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_ADD_REQUEST_HEA" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_add_request_header, ne_print_request_header \- add headers to a request
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_request\&.h>
.sp
.HP 28
void\ \fBne_add_request_header\fR\ (ne_request\ *\fIrequest\fR, const\ char\ *\fIname\fR, const\ char\ *\fIvalue\fR);
.HP 30
void\ \fBne_print_request_header\fR\ (ne_request\ *\fIrequest\fR, const\ char\ *\fIname\fR, const\ char\ *\fIformat\fR, \&.\&.\&.);
.ad
.hy
.SH "DESCRIPTION"
.PP
The functions \fBne_add_request_header\fR and \fBne_print_request_header\fR can be used to add headers to a request, before it is sent\&.
.PP
\fBne_add_request_header\fR simply adds a header of given \fIname\fR, with given \fIvalue\fR\&.
.PP
\fBne_print_request_header\fR adds a header of given \fIname\fR, taking the value from the \fBprintf\fR\-like \fIformat\fR string parameter and subsequent variable\-length argument list\&.
.SH "SEE ALSO"
.PP
\fBne_request_create\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_addr_resolve.3
@@ -0,0 +1 @@
.so man3/ne_addr_resolve.3
@@ -0,0 +1 @@
.so man3/ne_addr_resolve.3
@@ -0,0 +1 @@
.so man3/ne_addr_resolve.3
@@ -0,0 +1,97 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_ADDR_RESOLVE" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_addr_resolve, ne_addr_result, ne_addr_first, ne_addr_next, ne_addr_error, ne_addr_destroy \- functions to resolve hostnames to addresses
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_socket\&.h>
.sp
.HP 31
ne_sock_addr\ *\fBne_addr_resolve\fR\ (const\ char\ *\fIhostname\fR, int\ \fIflags\fR);
.HP 20
int\ \fBne_addr_result\fR\ (const\ ne_sock_addr\ *\fIaddr\fR);
.HP 36
const\ ne_inet_addr\ *\fBne_addr_first\fR\ (ne_sock_addr\ *\fIaddr\fR);
.HP 35
const\ ne_inet_addr\ *\fBne_addr_next\fR\ (ne_sock_addr\ *\fIaddr\fR);
.HP 21
char\ *\fBne_addr_error\fR\ (const\ ne_sock_addr\ *\fIaddr\fR, char\ *\fIbuffer\fR, size_t\ \fIbufsiz\fR);
.HP 22
void\ \fBne_addr_destroy\fR\ (ne_sock_addr\ *\fIaddr\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBne_addr_resolve\fR function resolves the given \fIhostname\fR, returning an \fBne_sock_addr\fR object representing the address (or addresses) associated with the hostname\&. The \fIflags\fR parameter is currently unused, and must be passed as 0\&.
.PP
The \fIhostname\fR passed to \fBne_addr_resolve\fR can be a DNS hostname (e\&.g\&. "www\&.example\&.com") or an IPv4 dotted quad (e\&.g\&. "192\&.0\&.34\&.72"); or, on systems which support IPv6, an IPv6 hex address, which may be enclosed in brackets, e\&.g\&. "[::1]"\&.
.PP
To determine whether the hostname was successfully resolved, the \fBne_addr_result\fR function is used, which returns non\-zero if an error occurred\&. If an error did occur, the \fBne_addr_error\fR function can be used, which will copy the error string into a given \fIbuffer\fR (of size \fIbufsiz\fR)\&.
.PP
The functions \fBne_addr_first\fR and \fBne_addr_next\fR are used to retrieve the Internet addresses associated with an address object which has been successfully resolved\&. \fBne_addr_first\fR returns the first address; \fBne_addr_next\fR returns the next address after the most recent call to \fBne_addr_next\fR or \fBne_addr_first\fR, or NULL if there are no more addresses\&. The \fBne_inet_addr\fR pointer returned by these functions can be passed to \fBne_sock_connect\fR to connect a socket\&.
.PP
After the address object has been used, it should be destroyed using \fBne_addr_destroy\fR\&.
.SH "RETURN VALUE"
.PP
\fBne_addr_resolve\fR returns a pointer to an address object, and never NULL\&. \fBne_addr_error\fR returns the \fIbuffer\fR parameter \&.
.SH "EXAMPLES"
.PP
The code below prints out the set of addresses associated with the hostname www\&.google\&.com\&.
.nf
ne_sock_addr *addr;
char buf[256];
addr = ne_addr_resolve("www\&.google\&.com", 0);
if (ne_addr_result(addr)) {
printf("Could not resolve www\&.google\&.com: %s\\n",
ne_addr_error(addr, buf, sizeof buf));
} else {
const ne_inet_addr *ia;
printf("www\&.google\&.com:");
for (ia = ne_addr_first(addr); ia != NULL; ia = ne_addr_next(addr)) {
printf(" %s", ne_iaddr_print(ia, buf, sizeof buf));
}
putchar('\\n');
}
ne_addr_destroy(addr);
.fi
.SH "SEE ALSO"
.PP
\fBne_iaddr_print\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_addr_resolve.3
@@ -0,0 +1,50 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_BUFFER" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_buffer \- string buffer handling
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_string\&.h>
typedef struct {
char *data;
size_t used;
size_t length;
} \fBne_buffer\fR;
.sp
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBne_buffer\fR type represents an expandable memory buffer for holding NUL\-terminated strings\&. The data field points to the beginnning of the string, the length of which is given by the used field\&. The current size of memory allocated is given by the length field\&. It is not recommended that the fields of a buffer are manipulated directly\&. The data pointer may change when the buffer is modified\&.
.PP
A buffer is created using \fBne_buffer_create\fR(3) or \fBne_buffer_ncreate\fR(3), and destroyed using \fBne_buffer_destroy\fR(3) or \fBne_buffer_finish\fR(3)\&. The functions \fBne_buffer_append\fR(3), \fBne_buffer_zappend\fR(3) and \fBne_buffer_concat\fR(3) are used to append data to a buffer\&.
.PP
If the string referenced by the data pointer is modified directly (rather than using one of the functions listed above), \fBne_buffer_altered\fR must be called\&.
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_buffer_clear.3
@@ -0,0 +1,65 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_BUFFER_APPEND" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_buffer_append, ne_buffer_zappend, ne_buffer_concat \- append data to a string buffer
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_string\&.h>
.sp
.HP 23
void\ \fBne_buffer_append\fR\ (ne_buffer\ *\fIbuf\fR, const\ char\ *\fIstring\fR, size_t\ \fIlen\fR);
.HP 24
void\ \fBne_buffer_zappend\fR\ (ne_buffer\ *\fIbuf\fR, const\ char\ *\fIstring\fR);
.HP 23
void\ \fBne_buffer_concat\fR\ (ne_buffer\ *\fIbuf\fR, const\ char\ *\fIstr\fR, \&.\&.\&.);
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBne_buffer_append\fR and \fBne_buffer_zappend\fR functions append a string to the end of a buffer; extending the buffer as necessary\&. The \fIlen\fR passed to \fBne_buffer_append\fR specifies the length of the string to append; there must be no NUL terminator in the first \fIlen\fR bytes of the string\&. \fBne_buffer_zappend\fR must be passed a NUL\-terminated string\&.
.PP
The \fBne_buffer_concat\fR function takes a variable\-length argument list following \fIstr\fR; each argument must be a \fBchar *\fR pointer to a NUL\-terminated string\&. A NULL pointer must be given as the last argument to mark the end of the list\&. The strings (including \fIstr\fR) are appended to the buffer in the order given\&. None of the strings passed to \fBne_buffer_concat\fR are modified\&.
.SH "EXAMPLES"
.PP
The following code will output "Hello, world\&. And goodbye\&."\&.
.nf
ne_buffer *buf = ne_buffer_create();
ne_buffer_zappend(buf, "Hello");
ne_buffer_concat(buf, ", world\&. ", "And ", "goodbye\&.", NULL);
puts(buf\->data);
ne_buffer_destroy(buf);
.fi
.SH "SEE ALSO"
.PP
\fBne_buffer\fR(3), \fBne_buffer_create\fR(3), \fBne_buffer_destroy\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1,50 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_BUFFER_CLEAR" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_buffer_clear, ne_buffer_grow, ne_buffer_altered \- general purpose of group of functions
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_string\&.h>
.sp
.HP 22
void\ \fBne_buffer_clear\fR\ (ne_buffer\ *\fIbuf\fR);
.HP 24
void\ \fBne_buffer_altered\fR\ (ne_buffer\ *\fIbuf\fR);
.HP 21
void\ \fBne_buffer_grow\fR\ (ne_buffer\ *\fIbuf\fR, size_t\ \fIsize\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBne_buffer_clear\fR function sets the string stored in \fIbuf\fR to be the empty string ("")\&.
.PP
The \fBne_buffer_altered\fR function must be used after the string stored in the buffer \fIbuf\fR is modified by directly rather than using \fBne_buffer_append\fR(3), \fBne_buffer_zappend\fR(3) or \fBne_buffer_concat\fR(3)\&.
.PP
The \fBne_buffer_grow\fR function ensures that at least \fIsize\fR bytes are allocated for the string; this can be used if a large amount of data is going to be appended to the buffer and may result in more efficient memory allocation\&.
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_buffer_append.3
@@ -0,0 +1,52 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_BUFFER_CREATE" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_buffer_create, ne_buffer_ncreate \- general purpose of group of functions
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_alloc\&.h>
.sp
.HP 29
ne_buffer\ *\fBne_buffer_create\fR\ (void);
.HP 30
ne_buffer\ *\fBne_buffer_ncreate\fR\ (size_t\ \fIsize\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
\fBne_buffer_create\fR creates a new buffer object, with an implementation\-defined initial size\&. \fBne_buffer_ncreate\fR creates an \fBne_buffer\fR where the minimum initial size is given in the \fIsize\fR parameter\&. The buffer created will contain the empty string ("")\&.
.SH "RETURN VALUE"
.PP
Both functions return a pointer to a new buffer object, and never NULL\&.
.SH "SEE ALSO"
.PP
\fBne_buffer\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1,71 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_BUFFER_DESTROY" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_buffer_destroy, ne_buffer_finish \- destroy a buffer object
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_string\&.h>
.sp
.HP 24
void\ \fBne_buffer_destroy\fR\ (ne_buffer\ *\fIbuf\fR);
.HP 24
char\ *\fBne_buffer_finish\fR\ (ne_buffer\ *\fIbuf\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
\fBne_buffer_destroy\fR frees all memory associated with the buffer\&. \fBne_buffer_finish\fR frees the buffer structure, but not the actual string stored in the buffer, which is returned and must be \fBfree\fR()d by the caller\&.
.PP
Any use of the buffer object after calling either of these functions gives undefined behaviour\&.
.SH "RETURN VALUE"
.PP
\fBne_buffer_finish\fR returns the \fBmalloc\fR\-allocated string stored in the buffer\&.
.SH "EXAMPLES"
.PP
An example use of \fBne_buffer_finish\fR; the \fBduplicate\fR function returns a string made up of \fIn\fR copies of \fIstr\fR:
.nf
static char *duplicate(int n, const char *str)
{
ne_buffer *buf = ne_buffer_create();
while (n\-\-) {
ne_buffer_zappend(buf, str);
}
return ne_buffer_finish(buf);
}
.fi
.SH "SEE ALSO"
.PP
\fBne_buffer\fR(3), \fBne_buffer_create\fR(3), \fBne_buffer_zappend\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_buffer_destroy.3
@@ -0,0 +1 @@
.so man3/ne_buffer_clear.3
@@ -0,0 +1 @@
.so man3/ne_buffer_create.3
@@ -0,0 +1 @@
.so man3/ne_buffer_append.3
@@ -0,0 +1 @@
.so man3/ne_malloc.3
@@ -0,0 +1 @@
.so man3/ne_session_create.3
@@ -0,0 +1 @@
.so man3/ne_set_server_auth.3
@@ -0,0 +1,68 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_GET_ERROR" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_get_error, ne_set_error \- error handling for HTTP sessions
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_session\&.h>
.sp
.HP 27
const\ char\ *\fBne_get_error\fR\ (ne_sesssion\ *\fIsession\fR);
.HP 19
void\ \fBne_set_error\fR\ (ne_sesssion\ *\fIsession\fR, const\ char\ *\fIformat\fR, \&.\&.\&.);
.ad
.hy
.SH "DESCRIPTION"
.PP
The session error string is used to store any human\-readable error information associated with any errors which occur whilst using the HTTP session\&.
.PP
The \fBne_get_error\fR function returns the current session error string\&. This string persists only until it is changed by a subsequent operation on the session\&.
.PP
The \fBne_set_error\fR function can be used to set a new session error string, using a \fBprintf\fR\-style format string interface\&.
.SH "EXAMPLES"
.PP
Retrieve the current error string:
.nf
ne_session *sess = ne_session_create(\&.\&.\&.);
\&.\&.\&.
printf("Error was: %s\\n", ne_get_error(sess));
.fi
.PP
Set a new error string:
.nf
ne_session *sess = ne_session_create(\&.\&.\&.);
\&.\&.\&.
ne_set_error(sess, "Response missing header %s", "somestring");
.fi
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1,74 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_GET_RESPONSE_H" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_get_response_header, ne_response_header_iterate \- functions to access response headers
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_request\&.h>
.sp
.HP 37
const\ char\ *\fBne_get_response_header\fR\ (ne_request\ *\fIrequest\fR, const\ char\ *\fIname\fR);
.HP 34
void\ *\fBne_response_header_iterate\fR\ (ne_request\ *\fIrequest\fR, void\ *\fIcursor\fR, const\ char\ **\fIname\fR, const\ char\ **\fIvalue\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
To retrieve the value of a response header field, the \fBne_get_response_header\fR function can be used, and is given the name of the header to return\&.
.PP
To iterate over all the response headers returned, the \fBne_response_header_iterate\fR function can be used\&. This function takes a \fIcursor\fR parameter which should be NULL to retrieve the first header\&. The function stores the name and value of the next header header in the \fIname\fR and \fIvalue\fR parameters, and returns a new cursor pointer which can be passed to \fBne_response_header_iterate\fR to retrieve the next header\&.
.SH "RETURN VALUE"
.PP
\fBne_get_response_header\fR returns a string, or NULL if no header with that name was given\&. If used during request processing, the return value pointer is valid only until the next call to \fBne_begin_request\fR, or else, until the request object is destroyed\&.
.PP
Likewise, the cursor, names, and values returned by \fBne_response_header_iterate\fR are only valid until the next call to \fBne_begin_request\fR or until the request object is destroyed\&.
.SH "EXAMPLES"
.PP
The following code will output the value of the Last\-Modified header for a resource:
.nf
ne_request *req = ne_request_create(sess, "GET", "/foo\&.txt");
if (ne_request_dispatch(req) == NE_OK) {
const char *mtime = ne_get_response_header(req, "Last\-Modified");
if (mtime) {
printf("/foo\&.txt has last\-modified value %s\\n", mtime);
}
}
ne_request_destroy(req);
.fi
.SH "SEE ALSO"
.PP
\fBne_request_create\fR(3), \fBne_request_destroy\fR(3)\&.
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_set_useragent.3
@@ -0,0 +1 @@
.so man3/ne_set_useragent.3
@@ -0,0 +1,59 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_GET_STATUS" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_get_status \- retrieve HTTP response status for request
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_request\&.h>
.sp
.HP 33
const\ ne_status\ *\fBne_get_status\fR\ (const\ ne_request\ *\fIrequest\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBne_get_status\fR function returns a pointer to the HTTP status object giving the result of a request\&. The object returned only becomes valid once the request has been \fIsuccessfully\fR dispatched (the return value of \fBne_request_dispatch\fR or \fBne_begin_request\fR was zero)\&. The object remains valid until the associated request object is destroyed\&.
.SH "SEE ALSO"
.PP
\fBne_status\fR(3), \fBne_request_create\fR(3)
.SH "EXAMPLE"
.PP
Display the response status code of applying the HEAD method to some resource\&.
.nf
ne_request *req = ne_request_create(sess, "HEAD", "/foo/bar");
if (ne_request_dispatch(req))
/* handle errors\&.\&.\&. */
else
printf("Response status code was %d\\n", ne_get_status(req)\->code);
ne_request_destroy(req);
.fi
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_iaddr_make.3
@@ -0,0 +1 @@
.so man3/ne_iaddr_make.3
@@ -0,0 +1,97 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_IADDR_MAKE" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_iaddr_make, ne_iaddr_cmp, ne_iaddr_print, ne_iaddr_typeof, ne_iaddr_free \- functions to manipulate and compare network addresses
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_socket\&.h>
typedef enum {
ne_iaddr_ipv4 = 0,
ne_iaddr_ipv6
} \fBne_iaddr_type\fR;
.sp
.HP 29
ne_inet_addr\ *\fBne_iaddr_make\fR\ (ne_iaddr_type\ \fItype\fR, const\ unsigned\ char\ *\fIraw\fR);
.HP 18
int\ \fBne_iaddr_cmp\fR\ (const\ ne_inet_addr\ *\fIia1\fR, const\ ne_inet_addr\ *\fIia2\fR);
.HP 22
char\ *\fBne_iaddr_print\fR\ (const\ ne_inet_addr\ *\fIia\fR, char\ *\fIbuffer\fR, size_t\ \fIbufsiz\fR);
.HP 31
ne_iaddr_type\ \fBne_iaddr_typeof\fR\ (const\ ne_inet_addr\ *\fIia\fR);
.HP 20
void\ \fBne_iaddr_free\fR\ (const\ ne_inet_addr\ *\fIia\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
\fBne_iaddr_make\fR creates an \fBne_inet_addr\fR object from a raw binary network address; for instance the four bytes 0x7f 0x00 0x00 0x01 represent the IPv4 address 127\&.0\&.0\&.1\&. The object returned is suitable for passing to \fBne_sock_connect\fR\&. A binary IPv4 address contains four bytes; a binary IPv6 address contains sixteen bytes; addresses passed must be in network byte order\&.
.PP
\fBne_iaddr_cmp\fR can be used to compare two network addresses; returning zero only if they are identical\&. The addresses need not be of the same address type; if the addresses are not of the same type, the return value is guaranteed to be non\-zero\&.
.PP
\fBne_iaddr_print\fR can be used to print the human\-readable string representation of a network address into a buffer, for instance the string "127\&.0\&.0\&.1"\&.
.PP
\fBne_iaddr_typeof\fR returns the type of the given network address\&.
.PP
\fBne_iaddr_free\fR releases the memory associated with a network address object\&.
.SH "RETURN VALUE"
.PP
\fBne_iaddr_make\fR returns NULL if the address type passed is not supported (for instance on a platform which does not support IPv6)\&.
.PP
\fBne_iaddr_print\fR returns the \fIbuffer\fR pointer, and never NULL\&.
.SH "EXAMPLES"
.PP
The following example connects a socket to port 80 at the address 127\&.0\&.0\&.1\&.
.nf
unsigned char addr[] = "\\0x7f\\0x00\\0x00\\0x01";
ne_inet_addr *ia;
ia = ne_iaddr_make(ne_iaddr_ipv4, addr);
if (ia != NULL) {
ne_socket *sock = ne_sock_connect(ia, 80);
ne_iaddr_free(ia);
/* \&.\&.\&. */
} else {
/* \&.\&.\&. */
}
.fi
.SH "SEE ALSO"
.PP
\fBne_addr_resolve\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_iaddr_make.3
@@ -0,0 +1 @@
.so man3/ne_iaddr_make.3
@@ -0,0 +1,58 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_MALLOC" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_malloc, ne_calloc, ne_realloc, ne_strdup, ne_strndup, ne_oom_callback \- memory allocation wrappers
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_alloc\&.h>
.sp
.HP 17
void\ *\fBne_malloc\fR\ (size_t\ \fIsize\fR);
.HP 17
void\ *\fBne_calloc\fR\ (size_t\ \fIsize\fR);
.HP 18
void\ *\fBne_realloc\fR\ (void\ *\fIsize\fR, size_t\ \fIlen\fR);
.HP 17
char\ *\fBne_strdup\fR\ (const\ char\ *\fIs\fR, size_t\ \fIsize\fR);
.HP 18
char\ *\fBne_strndup\fR\ (const\ char\ *\fIs\fR, size_t\ \fIsize\fR);
.HP 22
void\ \fBne_oom_callback\fR\ (void\ (*\fIcallback\fR)(void));
.ad
.hy
.SH "DESCRIPTION"
.PP
The functions \fBne_malloc\fR, \fBne_calloc\fR, \fBne_realloc\fR, \fBne_strdup\fR and \fBne_strdnup\fR provide wrappers for the equivalent functions in the standard C library\&. The wrappers provide the extra guarantee that if the C library equivalent returns NULL when no memory is available, an optional callback will be called, and the library will then call \fBabort\fR()\&.
.PP
\fBne_oom_callback\fR registers a callback which will be invoked if an out of memory error is detected\&.
.SH "NOTES"
.PP
If the operating system uses optimistic memory allocation, the C library memory allocation routines will not return NULL, so it is not possible to gracefully handle memory allocation failures\&.
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_malloc.3
@@ -0,0 +1 @@
.so man3/ne_add_request_header.3
@@ -0,0 +1 @@
.so man3/ne_token.3
@@ -0,0 +1 @@
.so man3/ne_malloc.3
@@ -0,0 +1,112 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_REQUEST_CREATE" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_request_create, ne_request_dispatch, ne_request_destroy \- low-level HTTP request handling
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_request\&.h>
.sp
.HP 31
ne_request\ *\fBne_request_create\fR\ (ne_session\ *\fIsession\fR, const\ char\ *\fImethod\fR, const\ char\ *\fIpath\fR);
.HP 25
int\ \fBne_request_dispatch\fR\ (ne_request\ *\fIreq\fR);
.HP 25
void\ \fBne_request_destroy\fR\ (ne_request\ *\fIreq\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
An HTTP request, represented by the \fBne_request\fR type, specifies that some operation is to be performed on some resource\&. The \fBne_request_create\fR function creates a request object, specifying the operation in the \fImethod\fR parameter\&. The location of the resource is determined by the server in use for the session given by the \fIsess\fR parameter, combined with the \fIpath\fR parameter\&.
.PP
The \fIpath\fR string used must conform to the abs_path definition given in RFC2396, with an optional "?query" part, and must be URI\-escaped by the caller (for instance, using \fBne_path_escape\fR)\&. If the string comes from an untrusted source, failure to perform URI\-escaping results in a security vulnerability\&.
.PP
To dispatch a request, and process the response, the \fBne_request_dispatch\fR function can be used\&. An alternative is to use the (more complex, but more flexible) combination of the \fBne_begin_request\fR, \fBne_end_request\fR, and \fBne_read_response_block\fR functions; see \fBne_begin_request\fR\&.
.PP
To add extra headers in the request, the functions \fBne_add_request_header\fR(3) and \fBne_print_request_header\fR(3) can be used\&. To include a message body with the request, one of the functions \fBne_set_request_body_buffer\fR, \fBne_set_request_body_fd\fR(3), or \fBne_set_request_body_provider\fR can be used\&.
.PP
The return value of \fBne_request_dispatch\fR indicates merely whether the request was sent and the response read successfully\&. To discover the result of the operation, \fBne_get_status\fR(3), along with any processing of the response headers and message body\&.
.PP
A request can only be dispatched once: calling \fBne_request_dispatch\fR more than once on a single \fBne_request\fR object produces undefined behaviour\&. Once all processing associated with the request object is complete, use the \fBne_request_destroy\fR function to destroy the resources associated with it\&. Any subsequent use of the request object produces undefined behaviour\&.
.SH "RETURN VALUE"
.PP
The \fBne_request_create\fR function returns a pointer to a request object (and never NULL)\&.
.PP
The \fBne_request_dispatch\fR function returns zero if the request was dispatched successfully, and a non\-zero error code otherwise\&.
.SH "ERRORS"
.TP
\fBNE_ERROR\fR
Request failed (see session error string)
.TP
\fBNE_LOOKUP\fR
The DNS lookup for the server (or proxy server) failed\&.
.TP
\fBNE_AUTH\fR
Authentication failed on the server\&.
.TP
\fBNE_PROXYAUTH\fR
Authentication failed on the proxy server\&.
.TP
\fBNE_CONNECT\fR
A connection to the server could not be established\&.
.TP
\fBNE_TIMEOUT\fR
A timeout occurred while waiting for the server to respond\&.
.SH "EXAMPLE"
.PP
An example of applying a MKCOL operation to the resource at the locationhttp://www\&.example\&.com/foo/bar/:
.nf
ne_session *sess = ne_session_create("http", "www\&.example\&.com", 80);
ne_request *req = ne_request_create(sess, "MKCOL", "/foo/bar/");
if (ne_request_dispatch(req)) {
printf("Request failed: %s\\n", ne_get_error(sess));
}
ne_request_destroy(req);
.fi
.SH "SEE ALSO"
.PP
\fBne_get_error\fR(3), \fBne_set_error\fR(3), \fBne_get_status\fR(3), \fBne_add_request_header\fR(3), \fBne_set_request_body_buffer\fR(3)\&.
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_request_create.3
@@ -0,0 +1 @@
.so man3/ne_request_create.3
@@ -0,0 +1 @@
.so man3/ne_get_response_header.3
@@ -0,0 +1,89 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SESSION_CREATE" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_session_create, ne_close_connection, ne_session_proxy, ne_session_destroy \- set up HTTP sessions
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_session\&.h>
.sp
.HP 31
ne_session\ *\fBne_session_create\fR\ (const\ char\ *\fIscheme\fR, const\ char\ *\fIhostname\fR, unsigned\ int\ \fIport\fR);
.HP 23
void\ \fBne_session_proxy\fR\ (ne_session\ *\fIsession\fR, const\ char\ *\fIhostname\fR, unsigned\ int\ \fIport\fR);
.HP 26
void\ \fBne_close_connection\fR\ (ne_session\ *\fIsession\fR);
.HP 25
void\ \fBne_session_destroy\fR\ (ne_session\ *\fIsession\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
An \fBne_session\fR object represents an HTTP session \- a logical grouping of a sequence of HTTP requests made to a certain server\&. Any requests made using the session can use a persistent connection, share cached authentication credentials and any other common attributes\&.
.PP
A new HTTP session is created using \fBne_session_create\fR, giving the \fIhostname\fR and \fIport\fR of the server to use, along with the \fIscheme\fR used to contact the server (usually "http")\&. Before the first use of \fBne_session_create\fR in a process, \fBne_sock_init\fR(3) must have been called to perform any global initialization needed by any libraries used by neon\&.
.PP
To enable SSL/TLS for the session, pass the string "https" as the \fIscheme\fR parameter, and either register a certificate verification function (see \fBne_ssl_set_verify\fR(3)) or trust the appropriate certificate (see \fBne_ssl_trust_cert\fR(3), \fBne_ssl_trust_default_ca\fR(3))\&.
.PP
If an HTTP proxy server should be used for the session, \fBne_session_proxy\fR must be called giving the hostname and port on which to contact the proxy\&.
.PP
If it is known that the session will not be used for a significant period of time, \fBne_close_connection\fR can be called to close the connection, if one remains open\&. Use of this function is entirely optional, but it must not be called if there is a request active using the session\&.
.PP
Once a session has been completed, \fBne_session_destroy\fR must be called to destroy the resources associated with the session\&. Any subsequent use of the session pointer produces undefined behaviour\&.
.SH "NOTES"
.PP
The hostname passed to \fBne_session_create\fR is resolved when the first request using the session is dispatched; a DNS resolution failure can only be detected at that time (using the NE_LOOKUP error code); see \fBne_request_dispatch\fR(3) for details\&.
.SH "RETURN VALUES"
.PP
\fBne_session_create\fR will return a pointer to a new session object (and never NULL)\&.
.SH "EXAMPLES"
.PP
Create and destroy a session:
.nf
ne_session *sess;
sess = ne_session_create("http", "host\&.example\&.com", 80);
/* \&.\&.\&. use sess \&.\&.\&. */
ne_session_destroy(sess);
.fi
.SH "SEE ALSO"
.PP
\fBne_ssl_set_verify\fR(3), \fBne_ssl_trust_cert\fR(3), \fBne_sock_init\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_session_create.3
@@ -0,0 +1 @@
.so man3/ne_session_create.3
@@ -0,0 +1 @@
.so man3/ne_get_error.3
@@ -0,0 +1 @@
.so man3/ne_set_useragent.3
@@ -0,0 +1 @@
.so man3/ne_set_server_auth.3
@@ -0,0 +1 @@
.so man3/ne_set_useragent.3
@@ -0,0 +1,45 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SET_REQUEST_" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_set_request_body_buffer, ne_set_request_body_fd \- include a message body with a request
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_request\&.h>
.sp
.HP 33
void\ \fBne_set_request_body_buffer\fR\ (ne_request\ *\fIreq\fR, const\ char\ *\fIbuf\fR, size_t\ \fIcount\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBne_set_request_body_buffer\fR function specifies that a message body should be included with the body, which is stored in the \fIcount\fR bytes buffer \fIbuf\fR\&.
.SH "SEE ALSO"
.PP
\fBne_request_create\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_set_request_body_buffer.3
@@ -0,0 +1,53 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SET_REQUEST_E" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_set_request_expect100 \- function to enable Expect: 100-continue support
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_request\&.h>
.sp
.HP 31
void\ \fBne_set_request_expect100\fR\ (ne_request\ *\fIrequest\fR, int\ \fIflag\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
An extension introduced in the HTTP/1\&.1 specification was the use of the Expect: 100\-continue header\&. This header allows an HTTP client to be informed of the expected response status before the request message body is sent: a useful optimisation for situations where a large message body is to be sent\&. The \fBne_set_request_expect100\fR function can be used to enable this feature by passing the \fIflag\fR parameter as any non\-zero integer\&.
.RS
.Sh "Warning"
.PP
Unfortunately, if this header is sent to a server which is not fully compliant with the HTTP/1\&.1 specification, a deadlock occurs resulting in a temporarily "hung" connection\&. neon will recover gracefully from this situation, but only after a 15 second timeout\&. It is highly recommended that this option is not enabled unless it is known that the server in use correctly implements Expect: 100\-continue support\&.
.RE
.SH "SEE ALSO"
.PP
\fBne_request_create\fR(3)\&.
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1,89 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SET_SERVER_AUTH" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_set_server_auth, ne_set_proxy_auth, ne_forget_auth \- register authentication callbacks
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_auth\&.h>
.sp
.HP 33
typedef\ int\ (*\fBne_request_auth\fR)\ (void\ *\fIuserdata\fR, const\ char\ *\fIrealm\fR, int\ \fIattempt\fR, char\ *\fIusername\fR, char\ *\fIpassword\fR);
.HP 25
void\ \fBne_set_server_auth\fR\ (ne_session\ *\fIsession\fR, ne_request_auth\ \fIcallback\fR, void\ *\fIuserdata\fR);
.HP 24
void\ \fBne_set_proxy_auth\fR\ (ne_session\ *\fIsession\fR, ne_request_auth\ \fIcallback\fR, void\ *\fIuserdata\fR);
.HP 21
void\ \fBne_forget_auth\fR\ (ne_session\ *\fIsession\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBne_request_auth\fR function type defines a callback which is invoked when a server or proxy server requires user authentication for a particular request\&. The \fIrealm\fR string is supplied by the server\&. The \fIattempt\fR is a counter giving the number of times the request has been retried with different authentication credentials\&. The first time the callback is invoked for a particular request, \fIattempt\fR will be zero\&.
.PP
To retry the request using new authentication credentials, the callback should return zero, and the \fIusername\fR and \fIpassword\fR buffers must contain NUL\-terminated strings\&. The NE_ABUFSIZ constant gives the size of these buffers\&.
.RS
.Sh "Tip"
.PP
If you only wish to allow the user one attempt to enter credentials, use the value of the \fIattempt\fR parameter as the return value of the callback\&.
.RE
.PP
To abort the request, the callback should return a non\-zero value; in which case the contents of the \fIusername\fR and \fIpassword\fR buffers are ignored\&.
.PP
The \fBne_forget_auth\fR function can be used to discard the cached authentication credentials\&.
.SH "EXAMPLES"
.nf
/* Function which prompts for a line of user input: */
extern char *prompt_for(const char *prompt);
static int
my_auth(void *userdata, const char *realm, int attempts,
char *username, char *password)
{
strncpy(username, prompt_for("Username: "), NE_ABUFSIZ);
strncpy(password, prompt_for("Password: "), NE_ABUFSIZ);
return attempts;
}
int main(\&.\&.\&.)
{
ne_session *sess = ne_session_create(\&.\&.\&.);
ne_set_server_auth(sess, my_auth, NULL);
/* \&.\&.\&. */
}
.fi
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1,86 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SET_USERAGENT" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_set_useragent, ne_set_persist, ne_set_read_timeout, ne_get_scheme, ne_get_server_hostport \- common properties for HTTP sessions
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_session\&.h>
.sp
.HP 23
void\ \fBne_set_useragent\fR\ (ne_session\ *\fIsession\fR, const\ char\ *\fIproduct\fR);
.HP 21
void\ \fBne_set_persist\fR\ (ne_session\ *\fIsession\fR, int\ \fIflag\fR);
.HP 26
void\ \fBne_set_read_timeout\fR\ (ne_session\ *\fIsession\fR, int\ \fItimeout\fR);
.HP 28
const\ char\ *\fBne_get_scheme\fR\ (ne_sesssion\ *\fIsession\fR);
.HP 37
const\ char\ *\fBne_get_server_hostport\fR\ (ne_sesssion\ *\fIsession\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
The User\-Agent request header is used to identify the software which generated the request for statistical or debugging purposes\&. neon does not send a User\-Agent header unless a call is made to the \fBne_set_useragent\fR\&. \fBne_set_useragent\fR must be passed a product string conforming to RFC2616's product token grammar; of the form "Product/Version"\&.
.PP
By default neon will use a persistent connection whenever possible\&. For specific applications, or for debugging purposes, it is sometimes useful to disable persistent connections\&. The \fBne_set_persist\fR function will disable persistent connections if passed a \fIflag\fR parameter of 0, and will enable them otherwise\&.
.PP
When neon reads from a socket, by default the read operation will time out after 60 seconds, and the request will fail giving an \fBNE_TIMEOUT\fR error\&. To configure this timeout interval, call \fBne_set_read_timeout\fR giving the desired number of seconds as the \fItimeout\fR parameter\&.
.PP
The scheme used to initially create the session will be returned by \fBne_get_scheme\fR\&.
.PP
The hostport pair with which the session is associated will be returned by the \fBne_get_server_hostport\fR; for example www\&.example\&.com:8080\&. Note that the :port will be omitted if the default port for the scheme is used\&.
.SH "EXAMPLES"
.PP
Set a user\-agent string:
.nf
ne_session *sess = ne_session_create(\&.\&.\&.);
ne_set_useragent(sess, "MyApplication/2\&.1");
.fi
.PP
Disable use of persistent connections:
.nf
ne_session *sess = ne_session_create(\&.\&.\&.);
ne_set_persist(sess, 0);
.fi
.PP
Set a 30 second read timeout:
.nf
ne_session *sess = ne_session_create(\&.\&.\&.);
ne_set_read_timeout(sess, 30);
.fi
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1,50 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SHAVE" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_shave \- trim whitespace from a string
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_string\&.h>
.sp
.HP 16
char\ *\fBne_shave\fR\ (char\ *\fIstr\fR, const\ char\ *\fIwhitespace\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
\fBne_shave\fR returns a portion of \fIstr\fR with any leading or trailing characters in the \fIwhitespace\fR array removed\&. \fIstr\fR may be modified\&. Note that the return value may not be equal to \fIstr\fR\&.
.SH "EXAMPLES"
.PP
The following code segment will output"fish":
.nf
char s[] = "\&.!\&.fish!\&.!";
puts(ne_shave(s, "\&.!"));
.fi
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1,50 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SOCK_INIT" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_sock_init \- perform library initialization
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_socket\&.h>
.sp
.HP 18
int\ \fBne_sock_init\fR\ (void);
.ad
.hy
.SH "DESCRIPTION"
.PP
In some platforms and configurations, neon may be using some socket or SSL libraries which require global initialization before use\&. To perform this initialization, the \fBne_sock_init\fR function must be called once before any other library functions are used\&.
.SH "RETURN VALUE"
.PP
\fBne_sock_init\fR returns zero on success, or non\-zero on error\&. If an error occurs, no further use of the neon library should be attempted\&.
.SH "SEE ALSO"
.PP
\fBneon\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1,45 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SSL_CERT_CMP" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_ssl_cert_cmp, ne_ssl_cert_free \- functions to operate on certificate objects
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_header\&.h>
.sp
.HP 21
int\ \fBne_ssl_cert_cmp\fR\ (const\ ne_ssl_certificate\ *\fIc1\fR, const\ ne_ssl_certificate\ *\fIc2\fR);
.HP 23
void\ \fBne_ssl_cert_free\fR\ (ne_ssl_certificate\ *\fIcert\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBne_ssl_cert_cmp\fR function can be used to compare two certificate objects; it returns zero if they refer to the same certificate, and non\-zero otherwise\&.
.PP
The \fBne_ssl_cert_free\fR function can be used to destroy a certificate object when it is no longer needed\&.
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_ssl_cert_read.3
@@ -0,0 +1 @@
.so man3/ne_ssl_cert_cmp.3
@@ -0,0 +1,85 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SSL_CERT_IDENTI" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_ssl_cert_identity, ne_ssl_cert_signedby, ne_ssl_cert_issuer, ne_ssl_cert_subject \- functions to access certificate properties
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_ssl\&.h>
.sp
.HP 35
const\ char\ *\fBne_ssl_cert_identity\fR\ (const\ ne_ssl_certificate\ *\fIcert\fR);
.HP 49
const\ ne_ssl_certificate\ *\fBne_ssl_cert_signedby\fR\ (const\ ne_ssl_certificate\ *\fIcert\fR);
.HP 42
const\ ne_ssl_dname\ *\fBne_ssl_cert_subject\fR\ (const\ ne_ssl_certificate\ *\fIcert\fR);
.HP 41
const\ ne_ssl_dname\ *\fBne_ssl_cert_issuer\fR\ (const\ ne_ssl_certificate\ *\fIcert\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
The function \fBne_ssl_cert_identity\fR retrieves the ``identity'' of a certificate; for an SSL server certificate, this will be the hostname for which the certificate was issued\&. In PKI parlance, the identity is the \fIcommon name\fR attribute of the distinguished name of the certificate subject\&.
.PP
The functions \fBne_ssl_cert_subject\fR and \fBne_ssl_cert_issuer\fR can be used to access the objects representing the distinguished name of the subject and of the issuer of a certificate, respectively\&.
.PP
If a certificate object is part of a certificate chain, then \fBne_ssl_cert_signedby\fR can be used to find the certificate which signed a particular certificate\&. For a self\-signed certificate or a certificate for which the full chain is not available, this function will return NULL\&.
.SH "RETURN VALUE"
.PP
\fBne_ssl_cert_issuer\fR and \fBne_ssl_cert_subject\fR are guaranteed to never return NULL\&. \fBne_ssl_cert_identity\fR may return NULL if the certificate has no specific ``identity''\&. \fBne_ssl_cert_signedby\fR may return NULL as covered above\&.
.SH "EXAMPLES"
.PP
The following function could be used to display information about a given certificate:
.nf
void dump_cert(const ne_ssl_certificate *cert) {
const char *id = ne_ssl_cert_identity(cert);
char *dn;
if (id)
printf("Certificate was issued for '%s'\&.\\n", id);
dn = ne_ssl_readable_dname(ne_ssl_cert_subject(cert));
printf("Subject: %s\\n", dn);
free(dn);
dn = ne_ssl_readable_dname(ne_ssl_cert_issuer(cert));
printf("Issuer: %s\\n", dn);
free(dn);
}
.fi
.SH "SEE ALSO"
.PP
\fBne_ssl_cert_cmp\fR(3), \fBne_ssl_readable_dname\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_ssl_cert_read.3
@@ -0,0 +1 @@
.so man3/ne_ssl_cert_identity.3
@@ -0,0 +1,59 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SSL_CERT_READ" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_ssl_cert_read, ne_ssl_cert_write, ne_ssl_cert_import, ne_ssl_cert_export \- functions to read or write certificates to and from files or strings
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_ssl\&.h>
.sp
.HP 38
ne_ssl_certificate\ *\fBne_ssl_cert_read\fR\ (const\ char\ *\fIfilename\fR);
.HP 23
int\ \fBne_ssl_cert_write\fR\ (const\ ne_ssl_certificate\ *\fIcert\fR, const\ char\ *\fIfilename\fR);
.HP 40
ne_ssl_certificate\ *\fBne_ssl_cert_import\fR\ (const\ char\ *\fIdata\fR);
.HP 26
char\ *\fBne_ssl_cert_export\fR\ (const\ ne_ssl_certificate\ *\fIcert\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBne_ssl_cert_write\fR function writes a certificate to a file using the PEM encoding\&. The \fBne_ssl_cert_export\fR function returns a base64\-encoded NUL\-terminated string representing the certificate\&. This string is malloc\-allocated and should be destroyed using \fBfree\fR by the caller\&.
.PP
The \fBne_ssl_cert_read\fR function reads a certificate from a PEM\-encoded file, and returns a certificate object\&. The \fBne_ssl_cert_import\fR function returns a certificate object from a base64\-encoded string, \fIdata\fR, as returned by \fBne_ssl_cert_export\fR\&. The certificate object returned by these functions should be destroyed using \fBne_ssl_cert_free\fR(3) after use\&.
.SH "RETURN VALUE"
.PP
\fBne_ssl_cert_read\fR returns NULL if a certificate could not be read from the file\&. \fBne_ssl_cert_write\fR returns non\-zero if the certificate could not be written to the file\&. \fBne_ssl_cert_export\fR always returns a NUL\-terminated string, and never NULL\&. \fBne_ssl_cert_import\fR returns NULL if the string was not a valid base64\-encoded certificate\&.
.SH "ENCODING FORMATS"
.PP
The string produced by \fBne_ssl_cert_export\fR is the base64 encoding of the DER representation of the certificate\&. The file written by \fBne_ssl_cert_write\fR uses the PEM format: this is the base64 encoding of the DER representation with newlines every 64 characters, and start and end marker lines\&.
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_ssl_cert_identity.3
@@ -0,0 +1 @@
.so man3/ne_ssl_cert_identity.3
@@ -0,0 +1 @@
.so man3/ne_ssl_cert_read.3
@@ -0,0 +1 @@
.so man3/ne_ssl_clicert_read.3
@@ -0,0 +1 @@
.so man3/ne_ssl_clicert_read.3
@@ -0,0 +1 @@
.so man3/ne_ssl_clicert_read.3
@@ -0,0 +1 @@
.so man3/ne_ssl_clicert_read.3
@@ -0,0 +1 @@
.so man3/ne_ssl_clicert_read.3
@@ -0,0 +1,99 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SSL_CLIENT_CERT" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_ssl_clicert_read, ne_ssl_clicert_name, ne_ssl_clicert_encrypted, ne_ssl_clicert_decrypt, ne_ssl_clicert_owner, ne_ssl_clicert_free \- SSL client certificate handling
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_ssl\&.h>
.sp
.HP 41
ne_ssl_client_cert\ *\fBne_ssl_clicert_read\fR\ (const\ char\ *\fIfilename\fR);
.HP 34
const\ char\ *\fBne_ssl_clicert_name\fR\ (const\ ne_ssl_client_cert\ *\fIccert\fR);
.HP 30
int\ \fBne_ssl_clicert_encrypted\fR\ (const\ ne_ssl_client_cert\ *\fIccert\fR);
.HP 28
int\ \fBne_ssl_clicert_decrypt\fR\ (ne_ssl_client_cert\ *\fIccert\fR, const\ char\ *\fIpassword\fR);
.HP 49
const\ ne_ssl_certificate\ *\fBne_ssl_clicert_owner\fR\ (const\ ne_ssl_client_cert\ *\fIccert\fR);
.HP 26
void\ \fBne_ssl_clicert_free\fR\ (ne_ssl_client_cert\ *\fIccert\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBne_ssl_clicert_read\fR function reads a client certificate from a PKCS#12\-formatted file, and returns an \fBne_ssl_client_cert\fR object\&. If the client certificate is encrypted, it must be decrypted before it is used\&. An \fBne_ssl_client_cert\fR object holds a client certificate and the associated private key, not just a certificate; the term "client certificate" will used to refer to this pair\&.
.PP
A client certificate can be in one of two states: \fIencrypted\fR or \fIdecrypted\fR\&. The \fBne_ssl_clicert_encrypted\fR function will return non\-zero if the client certificate is in the \fIencrypted\fR state\&. A client certificate object returned by \fBne_ssl_clicert_read\fR may be initially in either state, depending on whether the file was encrypted or not\&.
.PP
\fBne_ssl_clicert_decrypt\fR can be used to decrypt a client certificate using the appropriate password\&. This function must only be called if the object is in the \fIencrypted\fR state; if decryption fails, the certificate state does not change, so decryption can be attempted more than once using different passwords\&.
.PP
A client certificate can be given a "friendly name" when it is created; \fBne_ssl_clicert_name\fR will return this name (or NULL if no friendly name was specified)\&. \fBne_ssl_clicert_name\fR can be used when the client certificate is in either the encrypted or decrypted state, and will return the same string for the lifetime of the object\&.
.PP
The function \fBne_ssl_clicert_owner\fR returns the certificate part of the client certificate; it must only be called if the client certificate is in the \fIdecrypted\fR state\&.
.PP
When the client certificate is no longer needed, the \fBne_ssl_clicert_free\fR function should be used to destroy the object\&.
.SH "RETURN VALUE"
.PP
\fBne_ssl_clicert_read\fR returns a client certificate object, or NULL if the file could not be read\&. \fBne_ssl_clicert_encrypted\fR returns zero if the object is in the decrypted state, or non\-zero if it is in the encrypted state\&. \fBne_ssl_clicert_name\fR returns a NUL\-terminated friendly name string, or NULL\&. \fBne_ssl_clicert_owner\fR returns a certificate object\&.
.SH "EXAMPLES"
.PP
The following code reads a client certificate and decrypts it if necessary, then loads it into an HTTP session\&.
.nf
ne_ssl_client_cert *ccert;
ccert = ne_ssl_clicert_read("/path/to/client\&.p12");
if (ccert == NULL) {
/* handle error\&.\&.\&. */
} else if (ne_ssl_clicert_encrypted(ccert)) {
char *password = prompt_for_password();
if (ne_ssl_clicert_decrypt(ccert, password)) {
/* could not decrypt! handle error\&.\&.\&. */
}
}
ne_ssl_set_clicert(sess, ccert);
.fi
.SH "SEE ALSO"
.PP
\fBne_ssl_cert_read\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_ssl_readable_dname.3
@@ -0,0 +1,60 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SSL_DNAME" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_ssl_readable_dname, ne_ssl_dname_cmp \- SSL distinguished name handling
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_ssl\&.h>
.sp
.HP 36
const\ char\ *\fBne_ssl_readable_dname\fR\ (const\ ne_ssl_dname\ *\fIdname\fR);
.HP 22
int\ \fBne_ssl_dname_cmp\fR\ (const\ ne_ssl_dname\ *\fIdn1\fR, const\ ne_ssl_dname\ *\fIdn2\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBne_ssl_readable_dname\fR function creates a single\-line, human\-readable string out of an \fBne_ssl_dname\fR object\&. The returned string is \fBmalloc\fR()\-allocated, and must be \fBfree\fR()d by the caller\&.
.PP
The \fBne_ssl_dname_cmp\fR function compares two distinguished names, and returns zero if they are equal, or non\-zero otherwise\&.
.SH "RETURN VALUE"
.PP
\fBne_ssl_readable_dname\fR returns a \fBmalloc\fR\-allocated string, and never NULL\&.
.SH "EXAMPLES"
.PP
See \fBne_ssl_cert_subject\fR(3) for an example use of \fBne_ssl_readable_dname\fR\&.
.SH "SEE ALSO"
.PP
\fBne_ssl_cert_subject\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1,123 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SSL_SET_VERIFY" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_ssl_set_verify \- register an SSL certificate verification callback
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_session\&.h>
.sp
.HP 31
typedef\ int\ \fBne_ssl_verify_fn\fR\ (void\ *\fIuserdata\fR, int\ \fIfailures\fR, const\ ne_ssl_certificate\ *\fIcert\fR);
.HP 24
void\ \fBne_ssl_set_verify\fR\ (ne_session\ *\fIsession\fR, ne_ssl_verify_fn\ \fIverify_fn\fR, void\ *\fIuserdata\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
To enable manual SSL certificate verification, a callback can be registered using \fBne_ssl_set_verify\fR\&. If such a callback is not registered, when a connection is established to an SSL server which does not present a certificate signed by a trusted CA (see \fBne_ssl_trust_cert\fR(3)), or if the certificate presented is invalid in some way, the connection will fail\&.
.PP
When the callback is invoked, the \fIfailures\fR parameter gives a bitmask indicating in what way the automatic certificate verification failed\&. The value is equal to the bit\-wise OR of one or more of the following constants (and is guaranteed to be non\-zero):
.TP
\fBNE_SSL_NOTYETVALID\fR
The certificate is not yet valid\&.
.TP
\fBNE_SSL_EXPIRED\fR
The certificate has expired\&.
.TP
\fBNE_SSL_IDMISMATCH\fR
The hostname used for the session does not match the hostname to which the certificate was issued\&.
.TP
\fBNE_SSL_UNTRUSTED\fR
The Certificate Authority which signed the certificate is not trusted\&.
.PP
Note that if either of the\fBNE_SSL_IDMISMATCH\fR or\fBNE_SSL_UNTRUSTED\fR failures is given, the connection may have been intercepted by a third party, and must not be presumed to be ``secure''\&.
.PP
The \fIcert\fR parameter passed to the callback represents the certificate which was presented by the server\&. If the server presented a chain of certificates, the chain can be accessed using \fBne_ssl_cert_signedby\fR(3)\&. The \fIcert\fR object given is not valid after the callback returns\&.
.SH "RETURN VALUE"
.PP
The verification callback must return zero to indicate that the certificate should be trusted; and non\-zero otherwise (in which case, the connection will fail)\&.
.SH "EXAMPLES"
.PP
The following code implements an example verification callback, using the \fBdump_cert\fR function from \fBne_ssl_cert_subject\fR(3) to display certification information\&. Notice that the hostname of the server used for the session is passed as the\fIuserdata\fR parameter to the callback\&.
.nf
static int
my_verify(void *userdata, int failures, const ne_ssl_certificate *cert)
{
const char *hostname = userdata;
dump_cert(cert);
puts("Certificate verification failed \- the connection may have been "
"intercepted by a third party!");
if (failures & NE_SSL_IDMISMATCH) {
const char *id = ne_ssl_cert_identity(cert);
if (id)
printf("Server certificate was issued to '%s' not '%s'\&.\\n",
id, hostname);
else
printf("The certificate was not issued for '%s'\\n", hostname);
}
if (failures & NE_SSL_UNTRUSTED)
puts("The certificate is not signed by a trusted Certificate Authority\&.");
/* \&.\&.\&. check for validity failures \&.\&.\&. */
if (prompt_user())
return 1; /* fail verification */
else
return 0; /* trust the certificate anyway */
}
int
main(\&.\&.\&.)
{
ne_session *sess = ne_session_create("https", "some\&.host\&.name", 443);
ne_ssl_set_verify(sess, my_verify, "some\&.host\&.name");
\&.\&.\&.
}
.fi
.SH "SEE ALSO"
.PP
\fBne_ssl_trust_cert\fR(3), \fBne_ssl_readable_dname\fR(3), \fBne_ssl_cert_subject\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1,67 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_SSL_TRUST_CERT" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_ssl_trust_cert, ne_ssl_trust_default_ca \- functions to indicate that certificates are trusted
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_session\&.h>
.sp
.HP 24
void\ \fBne_ssl_trust_cert\fR\ (ne_session\ *\fIsession\fR, const\ ne_ssl_certificate\ *\fIcert\fR);
.HP 30
void\ \fBne_ssl_trust_default_ca\fR\ (ne_session\ *\fIsession\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
To indicate that a given certificate is trusted by the user, the certificate object can be passed to \fBne_ssl_trust_cert\fR\&. The certificate object is duplicated internally and can subequently be destroyed\&.
.PP
The SSL library in use by neon may include a default set of CA certificates; calling the \fBne_ssl_trust_default_ca\fR function will indicate that these CAs are trusted by the user\&.
.SH "EXAMPLES"
.PP
Load the CA certificate stored in \fI/path/to/cacert\&.pem\fR:
.nf
ne_session *sess = ne_session_create(\&.\&.\&.);
ne_ssl_certificate *cert = ne_ssl_cert_read("/path/to/cacert\&.pem");
if (cert) {
ne_ssl_trust_cert(sess, cert);
ne_ssl_cert_free(cert);
} else {
printf("Could not load CA cert: %s\\n", ne_get_error(sess));
}
.fi
.SH "SEE ALSO"
.PP
\fBne_ssl_cert_read\fR(3), \fBne_ssl_cert_import\fR(3), \fBne_ssl_cert_free\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_ssl_trust_cert.3
@@ -0,0 +1,72 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_STATUS" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_status \- HTTP status structure
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_utils\&.h>
typedef struct {
int major_version, minor_version;
int code, klass;
const char *reason_phrase;
} \fBne_status\fR;
.sp
.ad
.hy
.SH "DESCRIPTION"
.PP
An \fBne_status\fR type represents an HTTP response status; used in response messages giving a result of request\&. The major_version and minor_version fields give the HTTP version supported by the server issuing the response\&. The code field gives the status code of the result (lying between 100 and 999 inclusive), and the klass field gives the class[2], which is equal to the most significant digit of the status\&.
.PP
There are five classes of HTTP status code defined by RFC2616:
.TP
1xx
Informational response\&.
.TP
2xx
Success: the operation was successful
.TP
3xx
Redirection
.TP
4xx
Client error: the request made was incorrect in some manner\&.
.TP
5xx
Server error
.SH "SEE ALSO"
.PP
\fBne_get_status\fR(3)\&.
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_malloc.3
@@ -0,0 +1 @@
.so man3/ne_malloc.3
@@ -0,0 +1,59 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_TOKEN" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_token, ne_qtoken \- string tokenizers
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_string\&.h>
.sp
.HP 16
char\ *\fBne_token\fR\ (char\ **\fIstr\fR, char\ \fIsep\fR);
.HP 17
char\ *\fBne_qtoken\fR\ (char\ **\fIstr\fR, char\ \fIsep\fR, const\ char\ *\fIquotes\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
\fBne_token\fR and \fBne_qtoken\fR tokenize the string at the location stored in the pointer \fIstr\fR\&. Each time the function is called, it returns the next token, and modifies the \fIstr\fR pointer to point to the remainer of the string, or NULL if there are no more tokens in the string\&. A token is delimited by the separator character \fIsep\fR; if \fBne_qtoken\fR is used any quoted segments of the string are skipped when searching for a separator\&. A quoted segment is enclosed in a pair of one of the characters given in the \fIquotes\fR string\&.
.PP
The string being tokenized is modified each time the tokenizing function is called; replacing the next separator character with a NUL terminator\&.
.SH "EXAMPLES"
.PP
The following function prints out each token in a comma\-separated string \fIlist\fR, which is modified in\-place:
.nf
static void splitter(char *list)
{
do {
printf("Token: %s\\n", ne_token(&list, ','));
while (list);
}
.fi
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1,58 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_VERSION_MATCH" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_version_match, ne_version_string \- library versioning
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_utils\&.h>
.sp
.HP 22
int\ \fBne_version_match\fR\ (int\ \fImajor\fR, int\ \fIminor\fR);
.HP 32
const\ char\ *\fBne_version_string\fR\ (void);
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBne_version_match\fR function returns non\-zero if the library version is not of major version \fImajor\fR, or the minor version is less than \fIminor\fR\&. For neon versions 0\&.x, every minor version is assumed to be incompatible with every other minor version\&.
.PP
The \fBne_version_string\fR function returns a string giving the library version\&.
.SH "EXAMPLES"
.PP
To require neon 1\&.x, version 1\&.2 or later:
.nf
if (ne_version_match(1, 2)) {
printf("Library version out of date: 1\&.2 required, found %s\&.",
ne_version_string());
exit(1);
}
.fi
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_version_match.3
@@ -0,0 +1,52 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_XML_CREATE" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
ne_xml_create, ne_xml_destroy \- create and destroy an XML parser
.SH "SYNOPSIS"
.ad l
.hy 0
#include <ne_xml\&.h>
.sp
.HP 30
ne_xml_parser\ *\fBne_xml_create\fR\ (void);
.HP 21
void\ \fBne_xml_destroy\fR\ (ne_xml_parser\ *\fIparser\fR);
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBne_xml_create\fR function creates an XML parser object, which can be used for parsing XML documents using stacked SAX handlers\&.
.SH "RETURN VALUE"
.PP
\fBne_xml_create\fR returns a pointer to an XML parser object, and never NULL
.SH "SEE ALSO"
.PP
XXX
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1 @@
.so man3/ne_xml_create.3
@@ -0,0 +1,85 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NEON-CONFIG" 1 "20 October 2005" "neon 0.25.4" "neon"
.SH NAME
neon-config \- script providing information about installed copy of neon library
.SH "SYNOPSIS"
.ad l
.hy 0
.HP 12
\fBneon\-config\fR [\fB\-\-prefix\fR] [\fB\fB\-\-cflags\fR\fR | \fB\fB\-\-libs\fR\fR | \fB\fB\-\-la\-file\fR\fR | \fB\fB\-\-support\fR\ \fIfeature\fR\fR | \fB\fB\-\-help\fR\fR | \fB\fB\-\-version\fR\fR]
.ad
.hy
.SH "DESCRIPTION"
.PP
The \fBneon\-config\fR script provides information about an installed copy of the neon library\&. The \fB\-\-cflags\fR and \fB\-\-libs\fR options instruct how to compile and link an application against the library; the \fB\-\-version\fR and \fB\-\-support\fR options can help determine whether the library meets the applications requirements\&.
.SH "OPTIONS"
.TP
\fB\-\-cflags\fR
Print the flags which should be passed to the C compiler when compiling object files, when the object files use neon header files\&.
.TP
\fB\-\-libs\fR
Print the flags which should be passed to the linker when linking an application which uses the neon library
.TP
\fB\-\-la\-file\fR
Print the location of the libtool library script, \fIlibneon\&.la\fR, which can be used to link against neon by applications using libtool\&.
.TP
\fB\-\-version\fR
Print the version of the library
.TP
\fB\-\-prefix\fR \fIdir\fR
If \fIdir\fR is given; relocate output of \fB\-\-cflags\fR and \fB\-\-libs\fR as if neon was installed in given prefix directory\&. Otherwise, print the installation prefix of the library\&.
.TP
\fB\-\-support\fR \fIfeature\fR
The script exits with success if \fIfeature\fR is supported by the library\&.
.TP
\fB\-\-help\fR
Print help message; includes list of known features and whether they are supported or not\&.
.SH "EXAMPLE"
.PP
Below is a Makefile fragment which could be used to build an application against an installed neon library, when the \fBneon\-config\fR script can be found in \fB$PATH\fR\&.
.nf
CFLAGS = `neon\-config \-\-cflags`
LIBS = `neon\-config \-\-libs`
OBJECTS = myapp\&.o
TARGET = myapp
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) \-o $(TARGET) $(OBJECTS) $(LIBS)
myapp\&.o: myapp\&.c
$(CC) $(CFLAGS) \-c myapp\&.c \-o myapp\&.o
.fi
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
@@ -0,0 +1,107 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NEON" 3 "20 October 2005" "neon 0.25.4" "neon API reference"
.SH NAME
neon \- HTTP and WebDAV client library
.SH "DESCRIPTION"
.PP
neon is an HTTP and WebDAV client library\&. The major abstractions exposed are the HTTP \fIsession\fR, created by \fBne_session_create\fR(3); and the HTTP \fIrequest\fR, created by \fBne_request_create\fR(3)\&. HTTP authentication is handled transparently for server and proxy servers, see \fBne_set_server_auth\fR(3); complete SSL/TLS support is also included, see \fBne_ssl_set_verify\fR(3)\&.
.SH "CONVENTIONS"
.PP
Some conventions are used throughout the neon API, to provide a consistent and simple interface; these are documented below\&.
.SS "Thread-safeness and global initialization"
.PP
neon itself is implemented to be thread\-safe (avoiding any use of global state), but relies on the operating system providing a thread\-safe resolver interface\&. Modern operating systems offer the thread\-safe \fBgetaddrinfo\fR interface, which neon supports; some others implement \fBgethostbyname\fR using thread\-local storage\&.
.PP
To allow thread\-safe use of the OpenSSL library, the application must register some locking callbacks in accordance with the OpenSSL documentation: \fIhttp://www.openssl.org/docs/crypto/threads.html\fR\&.
.PP
Some platforms and libraries used by neon require global initialization before use; notably:
.TP 3
\(bu
OpenSSL requires global initialization to load shared lookup tables\&.
.TP
\(bu
The SOCKS library requires initialization before use\&.
.TP
\(bu
The Win32 socket library requires initialization before use\&.
.LP
The \fBne_sock_init\fR(3) function should be called before any other use of neon to perform any necessary initialization needed for the particular platform\&.
.SS "Namespaces"
.PP
To avoid possible collisions between names used for symbols and preprocessor macros by an application and the libraries it uses, it is good practice for each library to reserve a particular \fInamespace prefix\fR\&. An application which ensures it uses no names with these prefixes is then guaranteed to avoid such collisions\&.
.PP
The neon library reserves the use of the namespace prefixes ne_ and NE_\&. The libraries used by neon may also reserve certain namespaces; collisions between these libraries and a neon\-based application will not be detected at compile time, since the underlying library interfaces are not exposed through the neon header files\&. Such collisions can only be detected at link time, when the linker attempts to resolve symbols\&. The following list documents some of the namespaces claimed by libraries used by neon; this list may be incomplete\&.
.TP
SSL, ssl, TLS, tls, ERR_, BIO_, d2i_, i2d_, ASN1_
Some of the many prefixes used by the OpenSSL library; little attempt has been made to keep exported symbols within any particular prefixes for this library\&.
.TP
XML_, Xml[A\-Z]
Namespaces used by the expat library\&.
.TP
xml[A\-Z], html[A\-Z], docb[A\-Z]
Namespaces used by the libxml2 library; a relatively small number of symbols are used without these prefixes\&.
.SS "Argument validation"
.PP
neon does not attempt to validate that the parameters passed to functions conform to the API (for instance, checking that pointer arguments are not NULL)\&. Any use of the neon API which is not documented to produce a certain behaviour results is said to produce \fIundefined behaviour\fR; it is likely that neon will segfault under these conditions\&.
.SS "URI paths, WebDAV metadata"
.PP
The path strings passed to any function must be \fIURI\-encoded\fR by the application; neon never performs any URI encoding or decoding internally\&. WebDAV property names and values must be valid UTF\-8 encoded Unicode strings\&.
.SS "User interaction"
.PP
As a pure library interface, neon will never produce output on \fBstdout\fR or \fBstderr\fR; all user interaction is the responsibilty of the application\&.
.SS "Memory handling"
.PP
neon does not attempt to cope gracefully with an out\-of\-memory situation; instead, by default, the \fBabort\fR function is called to immediately terminate the process\&. An application may register a custom function which will be called before \fBabort\fR in such a situation; see \fBne_oom_callback\fR(3)\&.
.SS "Callbacks and userdata"
.PP
Whenever a callback is registered, a userdata pointer is also used to allow the application to associate a context with the callback\&. The userdata is of type \fBvoid *\fR, allowing any pointer to be used\&.
.SH "SEE ALSO"
.PP
\fBne_session_create\fR(3), \fBne_oom_callback\fR(3)
.SH AUTHOR
Joe Orton <neon@webdav\&.org>.