summaryrefslogtreecommitdiffstats
path: root/src/wol.h
blob: a245592a87cd1719dab40cc7348c43d8301a0f1a (plain)
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
#ifndef _OG_WOL_H_
#define _OG_WOL_H_

#define OG_WOL_SEQUENCE		6
#define OG_WOL_MACADDR_LEN	6
#define OG_WOL_REPEAT		16

#include "list.h"
#include <ev.h>
#include <stdbool.h>

struct wol_msg {
	char secuencia_FF[OG_WOL_SEQUENCE];
	char macbin[OG_WOL_REPEAT][OG_WOL_MACADDR_LEN];
};

int wol_socket_open(void);
bool wake_up_send(int sd, struct sockaddr_in *client,
		  const struct wol_msg *msg, const struct in_addr *addr);
bool wake_up_broadcast(int sd, struct sockaddr_in *client,
		       const struct wol_msg *msg);

struct og_client_wol {
	struct list_head	list;
	struct in_addr		addr;
	struct ev_timer		timer;
};

struct og_client_wol *og_client_wol_create(const struct in_addr *addr);
struct og_client_wol *og_client_wol_find(const struct in_addr *addr);
void og_client_wol_refresh(struct og_client_wol *cli_wol);
void og_client_wol_destroy(struct og_client_wol *cli_wol);
const char *og_client_wol_status(const struct og_client_wol *wol);

#endif