2016-01-02 14:28:59 +00:00
|
|
|
/*
|
|
|
|
* This file Copyright (C) 2015-2016 Mnemosyne LLC
|
|
|
|
*
|
|
|
|
* It may be used under the GNU GPL versions 2 or 3
|
|
|
|
* or any future license endorsed by Mnemosyne LLC.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-03-29 16:37:21 +00:00
|
|
|
#pragma once
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2020-08-11 18:11:55 +00:00
|
|
|
#ifndef LIBTRANSMISSION_WATCHDIR_MODULE
|
2017-04-19 12:04:45 +00:00
|
|
|
#error only the libtransmission watchdir module should #include this header.
|
2016-01-02 14:28:59 +00:00
|
|
|
#endif
|
|
|
|
|
2021-09-29 17:25:52 +00:00
|
|
|
#include <string>
|
|
|
|
#include <unordered_set>
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2021-10-06 14:26:07 +00:00
|
|
|
struct tr_watchdir_backend
|
2016-01-02 14:28:59 +00:00
|
|
|
{
|
2021-08-15 09:41:48 +00:00
|
|
|
void (*free_func)(struct tr_watchdir_backend*);
|
2021-10-06 14:26:07 +00:00
|
|
|
};
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2021-09-29 17:25:52 +00:00
|
|
|
#define BACKEND_DOWNCAST(b) (reinterpret_cast<tr_watchdir_backend*>(b))
|
2016-01-02 14:28:59 +00:00
|
|
|
|
|
|
|
/* ... */
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
tr_watchdir_backend* tr_watchdir_get_backend(tr_watchdir_t handle);
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
struct event_base* tr_watchdir_get_event_base(tr_watchdir_t handle);
|
2016-01-02 14:28:59 +00:00
|
|
|
|
|
|
|
/* ... */
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
void tr_watchdir_process(tr_watchdir_t handle, char const* name);
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2021-09-29 17:25:52 +00:00
|
|
|
void tr_watchdir_scan(tr_watchdir_t handle, std::unordered_set<std::string>* dir_entries);
|
2016-01-02 14:28:59 +00:00
|
|
|
|
|
|
|
/* ... */
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
tr_watchdir_backend* tr_watchdir_generic_new(tr_watchdir_t handle);
|
2016-01-02 14:28:59 +00:00
|
|
|
|
|
|
|
#ifdef WITH_INOTIFY
|
2017-04-19 12:04:45 +00:00
|
|
|
tr_watchdir_backend* tr_watchdir_inotify_new(tr_watchdir_t handle);
|
2016-01-02 14:28:59 +00:00
|
|
|
#endif
|
|
|
|
#ifdef WITH_KQUEUE
|
2017-04-19 12:04:45 +00:00
|
|
|
tr_watchdir_backend* tr_watchdir_kqueue_new(tr_watchdir_t handle);
|
2016-01-02 14:28:59 +00:00
|
|
|
#endif
|
|
|
|
#ifdef _WIN32
|
2017-04-19 12:04:45 +00:00
|
|
|
tr_watchdir_backend* tr_watchdir_win32_new(tr_watchdir_t handle);
|
2016-01-02 14:28:59 +00:00
|
|
|
#endif
|