blob: ab51bc56b55adeafe36ab00922e353877cc6123a (
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
46
47
|
#ifndef PSOCK_H
#define PSOCK_H 1
#include <netinet/in.h>
#include <stdint.h>
#include <stdlib.h>
struct icmphdr;
struct pdesc;
struct ppkt;
struct psock {
int epoll_fd;
int icmp_fd;
struct {
int is_client;
} local;
struct {
struct sockaddr_storage peer;
struct {
size_t used;
size_t max;
uint8_t * buffer;
struct icmphdr * icmphdr;
struct ppkt * pkt;
} packet;
} current;
struct {
size_t used;
size_t max;
struct pdesc * descriptors;
} remotes;
};
int psock_init(struct psock *, int, size_t, size_t);
int psock_add_server(char const *);
void psock_free(struct psock *);
void psock_loop(struct psock *);
#endif
|