1 /*
2  * This file Copyright (C) 2009-2014 Mnemosyne LLC
3  *
4  * It may be used under the GNU GPL versions 2 or 3
5  * or any future license endorsed by Mnemosyne LLC.
6  *
7  */
8 
9 #pragma once
10 
11 #ifndef __TRANSMISSION__
12 #error only libtransmission should #include this header.
13 #endif
14 
15 #define TR_PATH_DELIMITER '/'
16 #define TR_PATH_DELIMITER_STR "/"
17 
18 /**
19  * @addtogroup tr_session Session
20  * @{
21  */
22 
23 /**
24  * @brief invoked by tr_sessionInit() to set up the locations of the resume, torrent, and clutch directories.
25  * @see tr_getResumeDir()
26  * @see tr_getTorrentDir()
27  * @see tr_getWebClientDir()
28  */
29 void tr_setConfigDir(tr_session* session, char const* configDir);
30 
31 /** @brief return the directory where .resume files are stored */
32 char const* tr_getResumeDir(tr_session const*);
33 
34 /** @brief return the directory where .torrent files are stored */
35 char const* tr_getTorrentDir(tr_session const*);
36 
37 /** @brief return the directory where the Web Client's web ui files are kept */
38 char const* tr_getWebClientDir(tr_session const*);
39 
40 /** @brief return the directory where session id lock files are stored */
41 char* tr_getSessionIdDir(void);
42 
43 /** @} */
44 
45 /**
46  * @addtogroup utils Utilities
47  * @{
48  */
49 
50 typedef struct tr_thread tr_thread;
51 
52 /** @brief Instantiate a new process thread */
53 tr_thread* tr_threadNew(void (* func)(void*), void* arg);
54 
55 /** @brief Return nonzero if this function is being called from `thread'
56     @param thread the thread being tested */
57 bool tr_amInThread(tr_thread const* thread);
58 
59 /***
60 ****
61 ***/
62 
63 typedef struct tr_lock tr_lock;
64 
65 /** @brief Create a new thread mutex object */
66 tr_lock* tr_lockNew(void);
67 
68 /** @brief Destroy a thread mutex object */
69 void tr_lockFree(tr_lock*);
70 
71 /** @brief Attempt to lock a thread mutex object */
72 void tr_lockLock(tr_lock*);
73 
74 /** @brief Unlock a thread mutex object */
75 void tr_lockUnlock(tr_lock*);
76 
77 /** @brief return nonzero if the specified lock is locked */
78 bool tr_lockHave(tr_lock const*);
79 
80 /* @} */
81