-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtarget.h
51 lines (41 loc) · 1.03 KB
/
target.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Copyright (C) 2024 TDT AG <[email protected]>
*
* This is free software, licensed under the GNU General Public License v2.
* See https://www.gnu.org/licenses/gpl-2.0.txt for more information.
*
*/
#ifndef _TARGET_H
#define _TARGET_H
#include <libubox/list.h>
#include <libubox/uloop.h>
#include <time.h>
#include "interface.h"
enum target_state {
TARGET_STATE_UNKNOWN,
TARGET_STATE_RUNNING,
TARGET_STATE_STOPPED,
};
struct target {
struct list_head list;
struct interface *iface;
char *remote;
char *device;
enum target_state state;
int interval;
/* resolved IP */
int ip;
unsigned int cnt_sent;
unsigned int cnt_succ;
unsigned int rtt_last; /* in ms */
unsigned int rtt_max; /* in ms */
unsigned int timeout;
/* internal state for ping */
struct uloop_fd ping;
struct uloop_timeout timeout_offline;
struct uloop_timeout timeout_send;
struct timespec time_sent;
};
void target_add(struct interface *iface, const char *remote, const char *device);
void targets_del(struct interface *iface);
#endif /* _TARGET_H */