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
|
|
|
#include "tr-macros.h"
|
|
|
|
|
2016-01-02 14:28:59 +00:00
|
|
|
struct event_base;
|
|
|
|
|
2021-10-06 14:26:07 +00:00
|
|
|
using tr_watchdir_t = struct tr_watchdir*;
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2021-10-06 14:26:07 +00:00
|
|
|
enum tr_watchdir_status
|
2016-01-02 14:28:59 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
TR_WATCHDIR_ACCEPT,
|
|
|
|
TR_WATCHDIR_IGNORE,
|
|
|
|
TR_WATCHDIR_RETRY
|
2021-10-06 14:26:07 +00:00
|
|
|
};
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2021-10-06 14:26:07 +00:00
|
|
|
using tr_watchdir_cb = tr_watchdir_status (*)(tr_watchdir_t handle, char const* name, void* user_data);
|
2016-01-02 14:28:59 +00:00
|
|
|
|
|
|
|
/* ... */
|
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
tr_watchdir_t tr_watchdir_new(
|
|
|
|
char const* path,
|
|
|
|
tr_watchdir_cb callback,
|
|
|
|
void* callback_user_data,
|
|
|
|
struct event_base* event_base,
|
|
|
|
bool force_generic);
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void tr_watchdir_free(tr_watchdir_t handle);
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
char const* tr_watchdir_get_path(tr_watchdir_t handle);
|