From 8fa43b469a221a6f87ade73b077a6178d6b8e4b7 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 11 Aug 2003 07:25:02 +0000 Subject: [PATCH] documenting the share interface --- docs/libcurl/curl_share_cleanup.3 | 19 +++++++++++++ docs/libcurl/curl_share_init.3 | 21 ++++++++++++++ docs/libcurl/curl_share_setopt.3 | 46 +++++++++++++++++++++++++++++++ docs/libcurl/libcurl-share.3 | 46 +++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 docs/libcurl/curl_share_cleanup.3 create mode 100644 docs/libcurl/curl_share_init.3 create mode 100644 docs/libcurl/curl_share_setopt.3 create mode 100644 docs/libcurl/libcurl-share.3 diff --git a/docs/libcurl/curl_share_cleanup.3 b/docs/libcurl/curl_share_cleanup.3 new file mode 100644 index 0000000000..2510213ebe --- /dev/null +++ b/docs/libcurl/curl_share_cleanup.3 @@ -0,0 +1,19 @@ +.\" $Id$ +.\" +.TH curl_share_cleanup 3 "8 Aug 2003" "libcurl 7.10.7" "libcurl Manual" +.SH NAME +curl_share_cleanup - Clean up a shared object +.SH SYNOPSIS +.B #include +.sp +.BI "CURLSHcode curl_share_cleanup( );" +.ad +.SH DESCRIPTION +This function deletes a shared object. The share handle cannot be used anymore +when this function has been called. + +.SH RETURN VALUE +If this function returns non-zero, the object was not properly deleted and it +still remains! +.SH "SEE ALSO" +.BR curl_share_init "(3), " curl_share_setopt "(3)" diff --git a/docs/libcurl/curl_share_init.3 b/docs/libcurl/curl_share_init.3 new file mode 100644 index 0000000000..2f65813631 --- /dev/null +++ b/docs/libcurl/curl_share_init.3 @@ -0,0 +1,21 @@ +.\" $Id$ +.\" +.TH curl_share_init 3 "8 Aug 2003" "libcurl 7.10.7" "libcurl Manual" +.SH NAME +curl_share_init - Create a shared object +.SH SYNOPSIS +.B #include +.sp +.BI "CURLSH *curl_share_init( );" +.ad +.SH DESCRIPTION +This function returns a CURLSH handle to be used as input to all the other +share-functions, sometimes refered to as a share handle on some places in the +documentation. This init call MUST have a corresponding call to +\fIcurl_share_cleanup\fP when all operations using the share are complete. +.SH RETURN VALUE +If this function returns NULL, something went wrong and you got no share +object to use. +.SH "SEE ALSO" +.BR curl_share_cleanup "(3), " curl_share_setopt "(3)" + diff --git a/docs/libcurl/curl_share_setopt.3 b/docs/libcurl/curl_share_setopt.3 new file mode 100644 index 0000000000..583c146451 --- /dev/null +++ b/docs/libcurl/curl_share_setopt.3 @@ -0,0 +1,46 @@ +.\" $Id$ +.\" +.TH curl_share_setopt 3 "8 Aug 2003" "libcurl 7.10.7" "libcurl Manual" +.SH NAME +curl_share_setopt - Set options for a shared object +.SH SYNOPSIS +.B #include +.sp +CURLSHcode curl_share_setopt(CURLSH *share, CURLSHoption option, parameter); +.ad +.SH DESCRIPTION +Set the \fIoption\fP to \fIparameter\fP for the given \fIshare\fP. +.SH OPTIONS +.TP 0.4i +.B CURLSHOPT_LOCKFUNC +The \fIparameter\fP must be a pointer to a function matching the following +prototype: + +void lock_function(CURL *handle, curl_lock_data data, curl_lock_access access, +void *userptr); + +\fIdata\fP defines what data libcurl wants to lock, and you must make sure that +only one lock is given at any time for each kind of data. + +\fIaccess\fP defines what access type libcurl wants, shared or single. + +\fIuserptr\fP is the pointer you set with \fICURLSHOPT_USERDAT\fP. + +.TP +.B CURLSHOPT_UNLOCKFUNC +hej +.TP +.B CURLSHOPT_SHARE +hej +.TP +.B CURLSHOPT_UNSHARE +hej +.TP +.B CURLSHOPT_USERDATA +hej +.PP +.SH RETURN VALUE +If this function returns non-zero, something was wrong! + +.SH "SEE ALSO" +.BR curl_share_cleanup "(3), " curl_share_init "(3)" diff --git a/docs/libcurl/libcurl-share.3 b/docs/libcurl/libcurl-share.3 new file mode 100644 index 0000000000..6a8e22fb36 --- /dev/null +++ b/docs/libcurl/libcurl-share.3 @@ -0,0 +1,46 @@ +.\" You can view this file with: +.\" nroff -man [file] +.\" $Id$ +.\" +.TH libcurl-share 3 "8 Aug 2003" "libcurl 7.10.7" "libcurl share interface" +.SH NAME +libcurl-share \- how to use the share interface +.SH DESCRIPTION +This is an overview on how to use the libcurl share interface in your C +programs. There are specific man pages for each function mentioned in +here. + +All functions in the share interface are prefixed with curl_share. + +.SH "OBJECTIVES" +The share interface was added to enable sharing of data between curl +\&"handles". +.SH "ONE SET OF DATA - MANY TRANSFERS" +You can have multiple easy handles share data between them. Have them update +and use the \fBsame\fP cookie database or DNS cache! This way, each single +transfer will take advantage from data updates made by the other transfer(s). +.SH "SHARE OBJECT" +You create a shared object with \fIcurl_share_init()\fP. It returns a handle +for a newly created one. + +You tell the shared object what data you want it to share by using +\fIcurl_share_setopt()\fP. Currently you can only share DNS and/or COOKIE +data. + +Since you can use this share from multiple threads, and libcurl has no +internal thread synchronization, you must provide mutex callbacks if you're +using this multi-threaded. You set lock and unlock functions with +\fIcurl_share_setopt()\fP too. + +Then, you make an easy handle to use this share, you set the CURLOPT_SHARE +option with \fIcurl_easy_setopt\fP, and pass in share handle. You can make any +number of easy handles share the same share handle. + +To make an easy handle stop using that particular share, you set CURLOPT_SHARE +to NULL for that easy handle. To make a handle stop sharing a particular data, +you can CURLSHOPT_UNSHARE it. + +When you're done using the share, make sure that no easy handle is still using +it, and call \fIcurl_share_cleanup()\fP on the handle. +.SH "SEE ALSO" +.BR curl_share_init "(3), " curl_share_setopt "(3), " curl_share_cleanup "(3)"