-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathserver.h
46 lines (37 loc) · 1.28 KB
/
server.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
/*
* Copyright (C) 2016 Ingemar Ådahl
*
* This file is part of remote-input.
*
* remote-input is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* remote-input is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with remote-input. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SERVER_H_
#define _SERVER_H_
#include <stdint.h>
#include <netinet/in.h>
struct client_event;
struct server_info {
char sv_addr[INET6_ADDRSTRLEN];
uint16_t sv_port;
int sv_fd;
};
struct client_info {
char cl_addr[INET6_ADDRSTRLEN];
int cl_fd;
};
int server_create(const char* local_ip, uint16_t port, struct server_info*);
void server_close(struct server_info*);
int server_accept(const struct server_info*, struct client_info* client);
int read_client_event(struct client_info* client, struct client_event* event);
#endif /* _SERVER_H_ */