VirtualBox

source: vbox/trunk/src/VBox/NetworkServices/NAT/proxy_pollmgr.h@ 48576

最後變更 在這個檔案從48576是 48001,由 vboxsync 提交於 11 年 前

Move proxy sources from Devices/Network/lwip-new/vbox
to NetworkServices/NAT where they belong.

  • 屬性 svn:eol-style 設為 native
檔案大小: 2.0 KB
 
1/* -*- indent-tabs-mode: nil; -*- */
2#ifndef _PROXY_POLLMGR_H_
3#define _PROXY_POLLMGR_H_
4
5#ifndef RT_OS_WINDOWS
6# include <unistd.h> /* for ssize_t */
7#endif
8#include "lwip/sys.h"
9
10enum pollmgr_slot_t {
11 POLLMGR_CHAN_PXTCP_ADD, /* new proxy tcp connection from guest */
12 POLLMGR_CHAN_PXTCP_POLLIN, /* free space in ringbuf, may POLLIN */
13 POLLMGR_CHAN_PXTCP_POLLOUT, /* schedule one-shot POLLOUT callback */
14 POLLMGR_CHAN_PXTCP_DEL, /* delete pxtcp */
15 POLLMGR_CHAN_PXTCP_RESET, /* send RST and delete pxtcp */
16
17 POLLMGR_CHAN_PXUDP_ADD, /* new proxy udp conversation from guest */
18 POLLMGR_CHAN_PXUDP_DEL, /* delete pxudp from pollmgr */
19
20 POLLMGR_CHAN_PORTFWD, /* add/remove port forwarding rules */
21
22 POLLMGR_SLOT_STATIC_COUNT,
23 POLLMGR_SLOT_FIRST_DYNAMIC = POLLMGR_SLOT_STATIC_COUNT
24};
25
26
27struct pollmgr_handler; /* forward */
28typedef int (*pollmgr_callback)(struct pollmgr_handler *, SOCKET, int);
29
30struct pollmgr_handler {
31 pollmgr_callback callback;
32 void *data;
33 int slot;
34};
35
36struct pollmgr_refptr {
37 struct pollmgr_handler *ptr;
38 sys_mutex_t lock;
39 size_t strong;
40 size_t weak;
41};
42
43int pollmgr_init(void);
44
45/* static named slots (aka "channels") */
46SOCKET pollmgr_add_chan(int, struct pollmgr_handler *);
47ssize_t pollmgr_chan_send(int, void *buf, size_t nbytes);
48void *pollmgr_chan_recv_ptr(struct pollmgr_handler *, SOCKET, int);
49
50/* dynamic slots */
51int pollmgr_add(struct pollmgr_handler *, SOCKET, int);
52
53/* special-purpose strong/weak references */
54struct pollmgr_refptr *pollmgr_refptr_create(struct pollmgr_handler *);
55void pollmgr_refptr_weak_ref(struct pollmgr_refptr *);
56struct pollmgr_handler *pollmgr_refptr_get(struct pollmgr_refptr *);
57void pollmgr_refptr_unref(struct pollmgr_refptr *);
58
59void pollmgr_update_events(int, int);
60void pollmgr_del_slot(int);
61
62void pollmgr_thread(void *);
63
64/* buffer for callbacks to receive udp without worrying about truncation */
65extern u8_t pollmgr_udpbuf[64 * 1024];
66
67#endif /* _PROXY_POLLMGR_H_ */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette