aboutsummaryrefslogtreecommitdiff
path: root/include/client.h
blob: 8746bea2ebe401ea86850a1485b646662e308801 (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
36
37
38
39
40
41
42
43
44
45
#ifndef _SEATD_CLIENT_H
#define _SEATD_CLIENT_H

#include <stdint.h>
#include <sys/types.h>
#include <unistd.h>

#include "connection.h"
#include "linked_list.h"

struct server;

enum client_state {
	CLIENT_NEW,
	CLIENT_ACTIVE,
	CLIENT_PENDING_DISABLE,
	CLIENT_DISABLED,
	CLIENT_CLOSED
};

struct client {
	struct linked_list link; // seat::clients
	struct server *server;
	struct event_source_fd *event_source;
	struct connection connection;

	pid_t pid;
	uid_t uid;
	gid_t gid;

	struct seat *seat;
	int session;
	enum client_state state;

	struct linked_list devices;
};

struct client *client_create(struct server *server, int client_fd);
void client_destroy(struct client *client);

int client_handle_connection(int fd, uint32_t mask, void *data);
int client_send_enable_seat(struct client *client);
int client_send_disable_seat(struct client *client);

#endif