Transmission 2.33
[tomato.git] / release / src / router / transmission / libtransmission / web.h
blobff66552726bff00f3697938b7f3c0e330da10556
1 /*
2 * This file Copyright (C) Mnemosyne LLC
4 * This file is licensed by the GPL version 2. Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
10 * $Id: web.h 12539 2011-07-10 15:24:51Z jordan $
13 #ifndef TR_HTTP_H
14 #define TR_HTTP_H
16 #include <curl/curl.h>
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
22 struct tr_address;
23 struct tr_web_task;
25 typedef enum
27 TR_WEB_GET_CODE = CURLINFO_RESPONSE_CODE,
28 TR_WEB_GET_REDIRECTS = CURLINFO_REDIRECT_COUNT,
29 TR_WEB_GET_REAL_URL = CURLINFO_EFFECTIVE_URL
31 tr_web_task_info;
33 void tr_webInit( tr_session * session );
35 typedef enum
37 TR_WEB_CLOSE_WHEN_IDLE,
38 TR_WEB_CLOSE_NOW
40 tr_web_close_mode;
42 void tr_webClose( tr_session * session, tr_web_close_mode close_mode );
44 typedef void ( tr_web_done_func )( tr_session * session,
45 bool timeout_flag,
46 bool did_connect_flag,
47 long response_code,
48 const void * response,
49 size_t response_byte_count,
50 void * user_data );
52 const char * tr_webGetResponseStr( long response_code );
54 struct tr_web_task * tr_webRun( tr_session * session,
55 const char * url,
56 const char * range,
57 const char * cookies,
58 tr_web_done_func done_func,
59 void * done_func_user_data );
61 struct evbuffer;
63 struct tr_web_task * tr_webRunWithBuffer( tr_session * session,
64 const char * url,
65 const char * range,
66 const char * cookies,
67 tr_web_done_func done_func,
68 void * done_func_user_data,
69 struct evbuffer * buffer );
71 void tr_webGetTaskInfo( struct tr_web_task * task, tr_web_task_info info, void * dst );
73 void tr_http_escape( struct evbuffer *out, const char *str, int len, bool escape_slashes );
75 void tr_http_escape_sha1( char * out, const uint8_t * sha1_digest );
77 char* tr_http_unescape( const char * str, int len );
79 #ifdef __cplusplus
81 #endif
83 #endif