source: trunk/libtransmission/trevent.h @ 3457

Last change on this file since 3457 was 3457, checked in by charles, 14 years ago

fix overflow error that caused timers with intervals larger than 35 minutes to be lost... which is nastier than it sounds, since that's shorter than many tracker announce intervals.

  • Property svn:keywords set to Date Rev Author Id
File size: 2.2 KB
Line 
1/*
2 * This file Copyright (C) 2007 Charles Kerr <charles@rebelbase.com>
3 *
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.
9 *
10 * $Id: trevent.h 3457 2007-10-18 18:32:58Z charles $
11 */
12
13#ifndef TR_EVENT_H
14
15#include <stddef.h> /* size_t */
16#include <inttypes.h> /* uint64_t */
17
18/**
19**/
20
21void tr_eventInit( struct tr_handle * tr_handle );
22
23void tr_eventClose( struct tr_handle * tr_handle );
24
25/**
26**/
27
28struct event;
29enum evhttp_cmd_type;
30struct evhttp_request;
31struct evhttp_connection;
32struct bufferevent;
33
34void tr_evhttp_make_request (struct tr_handle          * tr_handle,
35                             struct evhttp_connection  * evcon,
36                             struct evhttp_request     * req,
37                             enum evhttp_cmd_type        type,
38                             char                      * uri);
39
40void tr_bufferevent_write( struct tr_handle    * tr_handle,
41                           struct bufferevent  * bufferEvent,
42                           const void          * buf,
43                           size_t                buflen );
44
45
46void tr_setBufferEventMode( struct tr_handle   * tr_handle,
47                            struct bufferevent * bufferEvent,
48                            short                mode_enable,
49                            short                mode_disable );
50
51/**
52***
53**/
54
55typedef struct tr_timer  tr_timer;
56
57/**
58 * Calls timer_func(user_data) after the specified interval.
59 * The timer is freed if timer_func returns zero.
60 * Otherwise, it's called again after the same interval.
61 */
62tr_timer* tr_timerNew( struct tr_handle  * handle,
63                       int                 func( void * user_data ),
64                       void              * user_data,
65                       uint64_t            timeout_milliseconds );
66
67/**
68 * Frees a timer and sets the timer pointer to NULL.
69 */
70void tr_timerFree( tr_timer ** timer );
71
72void tr_runInEventThread( struct tr_handle * handle,
73                          void               func( void* ),
74                          void             * user_data );
75
76#endif
Note: See TracBrowser for help on using the repository browser.