blob: 427e75cdfb7fe55b38e5080656beb152b0f02d15 (
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
|
#ifndef PSOCK_H
#define PSOCK_H 1
#include "ppkt.h"
#include <stdint.h>
#include <stdlib.h>
struct pdesc;
struct psock {
int epoll_fd;
int icmp_fd;
struct {
int is_client;
} local;
struct {
struct sockaddr_storage peer;
size_t bytes_read;
struct ppkt_buffer pkt_buf;
} current;
struct {
size_t used;
size_t max;
struct pdesc * descriptors;
} remotes;
};
int psock_init(struct psock *, size_t);
int psock_setup_fds(struct psock *, int);
int psock_add_server(struct psock *, char const *);
void psock_free(struct psock *);
void psock_loop(struct psock *);
#endif
|