-
Notifications
You must be signed in to change notification settings - Fork 133
Expand file tree
/
Copy pathdns_server_tcp.h
More file actions
31 lines (22 loc) · 907 Bytes
/
dns_server_tcp.h
File metadata and controls
31 lines (22 loc) · 907 Bytes
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
#ifndef _DNS_SERVER_TCP_H_
#define _DNS_SERVER_TCP_H_
#include <stdint.h>
#include <ev.h>
struct dns_server_tcp_s;
typedef void (*dns_tcp_req_received_cb)(struct dns_server_tcp_s *dns_server, void *data,
int client_fd, uint16_t tx_id,
char *dns_req, size_t dns_req_len);
typedef struct dns_server_tcp_s {
struct ev_loop *loop;
void *cb_data;
dns_tcp_req_received_cb cb;
int sock;
ev_io watcher;
} dns_server_tcp_t;
void dns_server_tcp_init(dns_server_tcp_t *d, struct ev_loop *loop,
const char *listen_addr, int listen_port,
dns_tcp_req_received_cb cb, void *data);
void dns_server_tcp_respond(int client_fd, char *buf, size_t blen);
void dns_server_tcp_stop(dns_server_tcp_t *d);
void dns_server_tcp_cleanup(dns_server_tcp_t *d);
#endif // _DNS_SERVER_TCP_H_