summaryrefslogtreecommitdiff
path: root/accel-pppd/include/ap_net.h
blob: 25121d946c65a2a4da659372a8cfb03fd4cca9f0 (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
#ifndef __AP_NET_H
#define __AP_NET_H

struct rtnl_handle;

struct ap_net {
	struct list_head entry;
	int refs;
	char *name;
	int (*socket)(int domain, int type, int proto);
	int (*connect)(int sock, const struct sockaddr *, socklen_t len);
	int (*bind)(int sock, const struct sockaddr *, socklen_t len);
	int (*listen)(int sock, int backlog);
	ssize_t (*read)(int sock, void *buf, size_t len);
	ssize_t (*recvfrom)(int sock, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen);
	ssize_t (*write)(int sock, const void *buf, size_t len);
	ssize_t (*sendto)(int sock, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen);
	int (*set_nonblocking)(int sock, int f);
	int (*setsockopt)(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
	int (*sock_ioctl)(unsigned long request, void *arg);
	int (*sock6_ioctl)(unsigned long request, void *arg);
	int (*ppp_open)();
	int (*ppp_ioctl)(int fd, unsigned long request, void *arg);
	void (*enter_ns)();
	void (*exit_ns)();
	struct rtnl_handle *(*rtnl_get)();
	void (*rtnl_put)(struct rtnl_handle *);
	int (*rtnl_open)(struct rtnl_handle *h, int proto);
	int (*move_link)(struct ap_net *net, int ifindex);
	void (*release)(struct ap_net *net);
};

extern __thread struct ap_net *net;
extern struct ap_net *def_net;

int ap_net_register(struct ap_net *net);
struct ap_net *ap_net_find(const char *name);
struct ap_net *ap_net_open_ns(const char *name);

#endif