VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/slirp/libslirp.h@ 22206

最後變更 在這個檔案從22206是 22206,由 vboxsync 提交於 15 年 前

NAT: make experiment more clear

  • 屬性 svn:eol-style 設為 native
檔案大小: 3.4 KB
 
1#ifndef _LIBSLIRP_H
2#define _LIBSLIRP_H
3
4#ifdef RT_OS_WINDOWS
5# include <winsock2.h>
6# ifdef __cplusplus
7extern "C" {
8# endif
9int inet_aton(const char *cp, struct in_addr *ia);
10# ifdef __cplusplus
11}
12# endif
13#else
14# ifdef RT_OS_OS2 /* temporary workaround, see ticket #127 */
15# include <sys/time.h>
16# endif
17# include <sys/select.h>
18# include <poll.h>
19# include <arpa/inet.h>
20#endif
21
22#include <VBox/types.h>
23
24typedef struct NATState *PNATState;
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#ifndef VBOX_WITH_NAT_SERVICE
31int slirp_init(PNATState *, const char *, uint32_t, bool, void *);
32#else
33int slirp_init(PNATState *, uint32_t, uint32_t, bool, void *);
34#endif
35void slirp_register_statistics(PNATState pData, PPDMDRVINS pDrvIns);
36void slirp_deregister_statistics(PNATState pData, PPDMDRVINS pDrvIns);
37void slirp_term(PNATState);
38void slirp_link_up(PNATState);
39void slirp_link_down(PNATState);
40
41#if defined(RT_OS_WINDOWS)
42void slirp_select_fill(PNATState pData, int *pndfs);
43
44void slirp_select_poll(PNATState pData, int fTimeout, int fIcmp);
45#else /* RT_OS_WINDOWS */
46void slirp_select_fill(PNATState pData, int *pnfds, struct pollfd *polls);
47void slirp_select_poll(PNATState pData, struct pollfd *polls, int ndfs);
48#endif /* !RT_OS_WINDOWS */
49
50void slirp_input(PNATState pData, const uint8_t *pkt, int pkt_len);
51void slirp_set_ethaddr(PNATState pData, const uint8_t *ethaddr);
52
53/* you must provide the following functions: */
54int slirp_can_output(void * pvUser);
55void slirp_output(void * pvUser, void *pvArg, const uint8_t *pkt, int pkt_len);
56void slirp_post_sent(PNATState pData, void *pvArg);
57
58int slirp_redir(PNATState pData, int is_udp, struct in_addr host_addr,
59 int host_port, struct in_addr guest_addr,
60 int guest_port, const uint8_t *);
61int slirp_add_exec(PNATState pData, int do_pty, const char *args, int addr_low_byte,
62 int guest_port);
63
64void slirp_set_dhcp_TFTP_prefix(PNATState pData, const char *tftpPrefix);
65void slirp_set_dhcp_TFTP_bootfile(PNATState pData, const char *bootFile);
66void slirp_set_dhcp_next_server(PNATState pData, const char *nextServer);
67void slirp_set_dhcp_dns_proxy(PNATState pData, bool fDNSProxy);
68void slirp_set_rcvbuf(PNATState pData, int kilobytes);
69void slirp_set_sndbuf(PNATState pData, int kilobytes);
70void slirp_set_tcp_rcvspace(PNATState pData, int kilobytes);
71void slirp_set_tcp_sndspace(PNATState pData, int kilobytes);
72
73int slirp_set_binding_address(PNATState, char *addr);
74
75#if defined(RT_OS_WINDOWS)
76
77
78/*
79 * ICMP handle state change
80 */
81# define VBOX_ICMP_EVENT_INDEX 0
82
83/**
84 * This event is for
85 * - slirp_input
86 * - slirp_link_up
87 * - slirp_link_down
88 * - wakeup
89 */
90# define VBOX_WAKEUP_EVENT_INDEX 1
91
92/*
93 * UDP/TCP socket state change (socket ready to receive, to send, ...)
94 */
95# define VBOX_SOCKET_EVENT_INDEX 2
96
97/*
98 * The number of events for WSAWaitForMultipleEvents().
99 */
100# define VBOX_EVENT_COUNT 3
101
102HANDLE *slirp_get_events(PNATState pData);
103void slirp_register_external_event(PNATState pData, HANDLE hEvent, int index);
104#endif /* RT_OS_WINDOWS */
105
106#ifdef VBOX_WITH_SLIRP_MT
107void slirp_process_queue(PNATState pData);
108void *slirp_get_queue(PNATState pData);
109#endif
110
111/*
112 * Returns the timeout.
113 */
114unsigned int slirp_get_timeout_ms(PNATState pData);
115
116# ifndef RT_OS_WINDOWS
117/*
118 * Returns the number of sockets.
119 */
120int slirp_get_nsock(PNATState pData);
121# endif
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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