oauth.h   oauth.h 
/** /**
* @brief OAuth.net implementation in POSIX-C. * @brief OAuth.net implementation in POSIX-C.
* @file oauth.h * @file oauth.h
* @author Robin Gareus <robin@gareus.org> * @author Robin Gareus <robin@gareus.org>
* *
* Copyright 2007-2011 Robin Gareus <robin@gareus.org> * Copyright 2007-2012 Robin Gareus <robin@gareus.org>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the ri ghts * in the Software without restriction, including without limitation the ri ghts
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sel l * to use, copy, modify, merge, publish, distribute, sublicense, and/or sel l
* copies of the Software, and to permit persons to whom the Software is * copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: * furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
skipping to change at line 32 skipping to change at line 32
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS I N * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS I N
* THE SOFTWARE. * THE SOFTWARE.
* *
*/ */
#ifndef _OAUTH_H #ifndef _OAUTH_H
#define _OAUTH_H 1 #define _OAUTH_H 1
#ifndef DOXYGEN_IGNORE #ifndef DOXYGEN_IGNORE
// liboauth version // liboauth version
#define LIBOAUTH_VERSION "0.9.7" #define LIBOAUTH_VERSION "1.0.0"
#define LIBOAUTH_VERSION_MAJOR 0 #define LIBOAUTH_VERSION_MAJOR 1
#define LIBOAUTH_VERSION_MINOR 9 #define LIBOAUTH_VERSION_MINOR 0
#define LIBOAUTH_VERSION_MICRO 7 #define LIBOAUTH_VERSION_MICRO 0
//interface revision number //interface revision number
//http://www.gnu.org/software/libtool/manual/html_node/Updating-version-inf o.html //http://www.gnu.org/software/libtool/manual/html_node/Updating-version-inf o.html
#define LIBOAUTH_CUR 8 #define LIBOAUTH_CUR 8
#define LIBOAUTH_REV 4 #define LIBOAUTH_REV 4
#define LIBOAUTH_AGE 8 #define LIBOAUTH_AGE 8
#endif
#ifdef __GNUC__ #ifdef __GNUC__
# define OA_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) # define OA_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y)
#else #else
# define OA_GCC_VERSION_AT_LEAST(x,y) 0 # define OA_GCC_VERSION_AT_LEAST(x,y) 0
#endif #endif
#ifndef attribute_deprecated #ifndef attribute_deprecated
#if OA_GCC_VERSION_AT_LEAST(3,1) #if OA_GCC_VERSION_AT_LEAST(3,1)
# define attribute_deprecated __attribute__((deprecated)) # define attribute_deprecated __attribute__((deprecated))
#else #else
# define attribute_deprecated # define attribute_deprecated
#endif #endif
#endif #endif
#endif /* doxygen ignore */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** \enum OAuthMethod /** \enum OAuthMethod
* signature method to used for signing the request. * signature method to used for signing the request.
*/ */
typedef enum { typedef enum {
OA_HMAC=0, ///< use HMAC-SHA1 request signing method OA_HMAC=0, ///< use HMAC-SHA1 request signing method
OA_RSA, ///< use RSA signature OA_RSA, ///< use RSA signature
skipping to change at line 210 skipping to change at line 211
/** /**
* splits the given url into a parameter array. * splits the given url into a parameter array.
* (see \ref oauth_serialize_url and \ref oauth_serialize_url_parameters fo r the reverse) * (see \ref oauth_serialize_url and \ref oauth_serialize_url_parameters fo r the reverse)
* *
* @param url the url or query-string to parse. * @param url the url or query-string to parse.
* @param argv pointer to a (char *) array where the results are stored. * @param argv pointer to a (char *) array where the results are stored.
* The array is re-allocated to match the number of parameters and each * The array is re-allocated to match the number of parameters and each
* parameter-string is allocated with strdup. - The memory needs to be fre ed * parameter-string is allocated with strdup. - The memory needs to be fre ed
* by the caller. * by the caller.
* @param qesc use query parameter escape (vs post-param-escape) - if set * @param qesc use query parameter escape (vs post-param-escape) - if set
* to 1 all '+' are treated as spaces ' ' * to 1 all '+' are treated as spaces ' '
* *
* @return number of parameter(s) in array. * @return number of parameter(s) in array.
*/ */
int oauth_split_post_paramters(const char *url, char ***argv, short qesc); int oauth_split_post_paramters(const char *url, char ***argv, short qesc);
/** /**
* build a url query string from an array. * build a url query string from an array.
* *
* @param argc the total number of elements in the array * @param argc the total number of elements in the array
* @param start element in the array at which to start concatenating. * @param start element in the array at which to start concatenating.
* @param argv parameter-array to concatenate. * @param argv parameter-array to concatenate.
* @return url string needs to be freed by the caller. * @return url string needs to be freed by the caller.
* *
*/ */
char *oauth_serialize_url (int argc, int start, char **argv); char *oauth_serialize_url (int argc, int start, char **argv);
/** /**
* encode query parameters from an array. * encode query parameters from an array.
* *
* @param argc the total number of elements in the array * @param argc the total number of elements in the array
* @param start element in the array at which to start concatenating. * @param start element in the array at which to start concatenating.
skipping to change at line 564 skipping to change at line 565
* to become a stable part of this API. It does not do * to become a stable part of this API. It does not do
* much error checking or handling for one thing.. * much error checking or handling for one thing..
* *
* NOTE: \a u and \a q are just concatenated with a '?' in between, * NOTE: \a u and \a q are just concatenated with a '?' in between,
* unless \a q is NULL. in which case only \a u will be used. * unless \a q is NULL. in which case only \a u will be used.
* *
* @param u base url to get * @param u base url to get
* @param q query string to send along with the HTTP request or NULL. * @param q query string to send along with the HTTP request or NULL.
* @return In case of an error NULL is returned; otherwise a pointer to th e * @return In case of an error NULL is returned; otherwise a pointer to th e
* replied content from HTTP server. latter needs to be freed by caller. * replied content from HTTP server. latter needs to be freed by caller.
*
* @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
*/ */
char *oauth_http_get (const char *u, const char *q); char *oauth_http_get (const char *u, const char *q) attribute_deprecated;
/** /**
* do a HTTP GET request, wait for it to finish * do a HTTP GET request, wait for it to finish
* and return the content of the reply. * and return the content of the reply.
* *
* (requires libcurl) * (requires libcurl)
* *
* This is equivalent to /ref oauth_http_get but allows to * This is equivalent to /ref oauth_http_get but allows to
* specifiy a custom HTTP header and has * specifiy a custom HTTP header and has
* has no support for commandline-curl. * has no support for commandline-curl.
* *
* If liboauth is compiled <b>without</b> libcurl this function * If liboauth is compiled <b>without</b> libcurl this function
* always returns NULL. * always returns NULL.
* *
* @param u base url to get * @param u base url to get
* @param q query string to send along with the HTTP request or NULL. * @param q query string to send along with the HTTP request or NULL.
* @param customheader specify custom HTTP header (or NULL for none) * @param customheader specify custom HTTP header (or NULL for none)
* Multiple header elements can be passed separating them with "\r\n" * Multiple header elements can be passed separating them with "\r\n"
* @return In case of an error NULL is returned; otherwise a pointer to th e * @return In case of an error NULL is returned; otherwise a pointer to th e
* replied content from HTTP server. latter needs to be freed by caller. * replied content from HTTP server. latter needs to be freed by caller.
*
* @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
*/ */
char *oauth_http_get2 (const char *u, const char *q, const char *customhead er); char *oauth_http_get2 (const char *u, const char *q, const char *customhead er) attribute_deprecated;
/** /**
* do a HTTP POST request, wait for it to finish * do a HTTP POST request, wait for it to finish
* and return the content of the reply. * and return the content of the reply.
* (requires libcurl or a command-line HTTP client) * (requires libcurl or a command-line HTTP client)
* *
* If compiled <b>without</b> libcurl this function calls * If compiled <b>without</b> libcurl this function calls
* a command-line executable defined in the environment variable * a command-line executable defined in the environment variable
* OAUTH_HTTP_CMD - it defaults to * OAUTH_HTTP_CMD - it defaults to
* <tt>curl -sA 'liboauth-agent/0.1' -d '%%p' '%%u'</tt> * <tt>curl -sA 'liboauth-agent/0.1' -d '%%p' '%%u'</tt>
skipping to change at line 617 skipping to change at line 622
* to transmit custom HTTP headers or parameters. * to transmit custom HTTP headers or parameters.
* *
* WARNING: this is a tentative function. it's convenient and handy for tes ting * WARNING: this is a tentative function. it's convenient and handy for tes ting
* or developing OAuth code. But don't rely on this function * or developing OAuth code. But don't rely on this function
* to become a stable part of this API. It does not do * to become a stable part of this API. It does not do
* much error checking for one thing.. * much error checking for one thing..
* *
* @param u url to query * @param u url to query
* @param p postargs to send along with the HTTP request. * @param p postargs to send along with the HTTP request.
* @return replied content from HTTP server. needs to be freed by caller. * @return replied content from HTTP server. needs to be freed by caller.
*
* @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
*/ */
char *oauth_http_post (const char *u, const char *p); char *oauth_http_post (const char *u, const char *p) attribute_deprecated;
/** /**
* do a HTTP POST request, wait for it to finish * do a HTTP POST request, wait for it to finish
* and return the content of the reply. * and return the content of the reply.
* (requires libcurl) * (requires libcurl)
* *
* It's equivalent to /ref oauth_http_post, but offers * It's equivalent to /ref oauth_http_post, but offers
* the possibility to specify a custom HTTP header and * the possibility to specify a custom HTTP header and
* has no support for commandline-curl. * has no support for commandline-curl.
* *
* If liboauth is compiled <b>without</b> libcurl this function * If liboauth is compiled <b>without</b> libcurl this function
* always returns NULL. * always returns NULL.
* *
* @param u url to query * @param u url to query
* @param p postargs to send along with the HTTP request. * @param p postargs to send along with the HTTP request.
* @param customheader specify custom HTTP header (or NULL for none) * @param customheader specify custom HTTP header (or NULL for none)
* Multiple header elements can be passed separating them with "\r\n" * Multiple header elements can be passed separating them with "\r\n"
* @return replied content from HTTP server. needs to be freed by caller. * @return replied content from HTTP server. needs to be freed by caller.
*
* @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
*/ */
char *oauth_http_post2 (const char *u, const char *p, const char *customhea der); char *oauth_http_post2 (const char *u, const char *p, const char *customhea der) attribute_deprecated;
/** /**
* http post raw data from file. * http post raw data from file.
* the returned string needs to be freed by the caller * the returned string needs to be freed by the caller
* (requires libcurl) * (requires libcurl)
* *
* see dislaimer: /ref oauth_http_post * see dislaimer: /ref oauth_http_post
* *
* @param u url to retrieve * @param u url to retrieve
* @param fn filename of the file to post along * @param fn filename of the file to post along
* @param len length of the file in bytes. set to '0' for autodetection * @param len length of the file in bytes. set to '0' for autodetection
* @param customheader specify custom HTTP header (or NULL for default). * @param customheader specify custom HTTP header (or NULL for default).
* Multiple header elements can be passed separating them with "\r\n" * Multiple header elements can be passed separating them with "\r\n"
* @return returned HTTP reply or NULL on error * @return returned HTTP reply or NULL on error
*
* @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
*/ */
char *oauth_post_file (const char *u, const char *fn, const size_t len, con st char *customheader); char *oauth_post_file (const char *u, const char *fn, const size_t len, con st char *customheader) attribute_deprecated;
/** /**
* http post raw data * http post raw data
* the returned string needs to be freed by the caller * the returned string needs to be freed by the caller
* (requires libcurl) * (requires libcurl)
* *
* see dislaimer: /ref oauth_http_post * see dislaimer: /ref oauth_http_post
* *
* @param u url to retrieve * @param u url to retrieve
* @param data data to post * @param data data to post
* @param len length of the data in bytes. * @param len length of the data in bytes.
* @param customheader specify custom HTTP header (or NULL for default) * @param customheader specify custom HTTP header (or NULL for default)
* Multiple header elements can be passed separating them with "\r\n" * Multiple header elements can be passed separating them with "\r\n"
* @return returned HTTP reply or NULL on error * @return returned HTTP reply or NULL on error
*
* @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
*/ */
char *oauth_post_data (const char *u, const char *data, size_t len, const c har *customheader); char *oauth_post_data (const char *u, const char *data, size_t len, const c har *customheader) attribute_deprecated;
/** /**
* http post raw data, with callback. * http post raw data, with callback.
* the returned string needs to be freed by the caller * the returned string needs to be freed by the caller
* (requires libcurl) * (requires libcurl)
* *
* Invokes the callback - in no particular order - when HTTP-request status updates occur. * Invokes the callback - in no particular order - when HTTP-request status updates occur.
* The callback is called with: * The callback is called with:
* void * callback_data: supplied on function call. * void * callback_data: supplied on function call.
* int type: 0=data received, 1=data sent. * int type: 0=data received, 1=data sent.
skipping to change at line 692 skipping to change at line 705
* size_t totalsize: original amount of data to send, or amount of data r eceived * size_t totalsize: original amount of data to send, or amount of data r eceived
* *
* @param u url to retrieve * @param u url to retrieve
* @param data data to post along * @param data data to post along
* @param len length of the file in bytes. set to '0' for autodetection * @param len length of the file in bytes. set to '0' for autodetection
* @param customheader specify custom HTTP header (or NULL for default) * @param customheader specify custom HTTP header (or NULL for default)
* Multiple header elements can be passed separating them with "\r\n" * Multiple header elements can be passed separating them with "\r\n"
* @param callback specify the callback function * @param callback specify the callback function
* @param callback_data specify data to pass to the callback function * @param callback_data specify data to pass to the callback function
* @return returned HTTP reply or NULL on error * @return returned HTTP reply or NULL on error
*
* @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
*/ */
char *oauth_post_data_with_callback (const char *u, char *oauth_post_data_with_callback (const char *u,
const char *data, const char *data,
size_t len, size_t len,
const char *customheader, const char *customheader,
void (*callback)(void*,int,size_t ,size_t), void (*callback)(void*,int,size_t ,size_t),
void *callback_data); void *callback_data) attribute_de precated;
/** /**
* http send raw data. similar to /ref oauth_http_post but provides * http send raw data. similar to /ref oauth_http_post but provides
* for specifying the HTTP request method. * for specifying the HTTP request method.
* *
* the returned string needs to be freed by the caller * the returned string needs to be freed by the caller
* (requires libcurl) * (requires libcurl)
* *
* see dislaimer: /ref oauth_http_post * see dislaimer: /ref oauth_http_post
* *
* @param u url to retrieve * @param u url to retrieve
* @param data data to post * @param data data to post
* @param len length of the data in bytes. * @param len length of the data in bytes.
* @param customheader specify custom HTTP header (or NULL for default) * @param customheader specify custom HTTP header (or NULL for default)
* Multiple header elements can be passed separating them with "\r\n" * Multiple header elements can be passed separating them with "\r\n"
* @param httpMethod specify http verb ("GET"/"POST"/"PUT"/"DELETE") to be used. if httpMethod is NULL, a POST is executed. * @param httpMethod specify http verb ("GET"/"POST"/"PUT"/"DELETE") to be used. if httpMethod is NULL, a POST is executed.
* @return returned HTTP reply or NULL on error * @return returned HTTP reply or NULL on error
*
* @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
*/ */
char *oauth_send_data (const char *u, char *oauth_send_data (const char *u,
const char *data, const char *data,
size_t len, size_t len,
const char *customheader, const char *customheader,
const char *httpMethod); const char *httpMethod) attribute_deprecated;
/** /**
* http post raw data, with callback. * http post raw data, with callback.
* the returned string needs to be freed by the caller * the returned string needs to be freed by the caller
* (requires libcurl) * (requires libcurl)
* *
* Invokes the callback - in no particular order - when HTTP-request status updates occur. * Invokes the callback - in no particular order - when HTTP-request status updates occur.
* The callback is called with: * The callback is called with:
* void * callback_data: supplied on function call. * void * callback_data: supplied on function call.
* int type: 0=data received, 1=data sent. * int type: 0=data received, 1=data sent.
skipping to change at line 744 skipping to change at line 761
* *
* @param u url to retrieve * @param u url to retrieve
* @param data data to post along * @param data data to post along
* @param len length of the file in bytes. set to '0' for autodetection * @param len length of the file in bytes. set to '0' for autodetection
* @param customheader specify custom HTTP header (or NULL for default) * @param customheader specify custom HTTP header (or NULL for default)
* Multiple header elements can be passed separating them with "\r\n" * Multiple header elements can be passed separating them with "\r\n"
* @param callback specify the callback function * @param callback specify the callback function
* @param callback_data specify data to pass to the callback function * @param callback_data specify data to pass to the callback function
* @param httpMethod specify http verb ("GET"/"POST"/"PUT"/"DELETE") to be used. * @param httpMethod specify http verb ("GET"/"POST"/"PUT"/"DELETE") to be used.
* @return returned HTTP reply or NULL on error * @return returned HTTP reply or NULL on error
*
* @deprecated use libcurl - http://curl.haxx.se/libcurl/c/
*/ */
char *oauth_send_data_with_callback (const char *u, char *oauth_send_data_with_callback (const char *u,
const char *data, const char *data,
size_t len, size_t len,
const char *customheader, const char *customheader,
void (*callback)(void*,int,size_t ,size_t), void (*callback)(void*,int,size_t ,size_t),
void *callback_data, void *callback_data,
const char *httpMethod); const char *httpMethod) attribute _deprecated;
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif #endif
/* vi:set ts=8 sts=2 sw=2: */ /* vi:set ts=8 sts=2 sw=2: */
 End of changes. 25 change blocks. 
18 lines changed or deleted 37 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/