VirtualBox

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

Last change on this file since 18902 was 18902, checked in by vboxsync, 16 years ago

NAT: removed VBOX_WITH_SIMPLIFIED_SLIRP_SYNC as the poller API was removed some days ago

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
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
30int slirp_init(PNATState *, const char *, uint32_t, bool, void *);
31void slirp_register_timers(PNATState pData, PPDMDRVINS pDrvIns);
32void slirp_term(PNATState);
33void slirp_link_up(PNATState);
34void slirp_link_down(PNATState);
35
36#if defined(RT_OS_WINDOWS)
37void slirp_select_fill(PNATState pData, int *pndfs);
38
39void slirp_select_poll(PNATState pData, int fTimeout, int fIcmp);
40#else /* RT_OS_WINDOWS */
41void slirp_select_fill(PNATState pData, int *pnfds, struct pollfd *polls);
42void slirp_select_poll(PNATState pData, struct pollfd *polls, int ndfs);
43#endif /* !RT_OS_WINDOWS */
44
45void slirp_input(PNATState pData, const uint8_t *pkt, int pkt_len);
46void slirp_set_ethaddr(PNATState pData, const uint8_t *ethaddr);
47
48/* you must provide the following functions: */
49int slirp_can_output(void * pvUser);
50void slirp_output(void * pvUser, void *pvArg, const uint8_t *pkt, int pkt_len);
51void slirp_post_sent(PNATState pData, void *pvArg);
52
53int slirp_redir(PNATState pData, int is_udp, int host_port,
54 struct in_addr guest_addr, int guest_port);
55int slirp_add_exec(PNATState pData, int do_pty, const char *args, int addr_low_byte,
56 int guest_port);
57
58void slirp_set_dhcp_TFTP_prefix(PNATState pData, const char *tftpPrefix);
59void slirp_set_dhcp_TFTP_bootfile(PNATState pData, const char *bootFile);
60void slirp_set_dhcp_next_server(PNATState pData, const char *nextServer);
61#ifdef VBOX_WITH_SLIRP_DNS_PROXY
62void slirp_set_dhcp_dns_proxy(PNATState pData, bool fDNSProxy);
63#endif
64
65#if defined(RT_OS_WINDOWS)
66
67
68/*
69 * ICMP handle state change
70 */
71# define VBOX_ICMP_EVENT_INDEX 0
72
73/**
74 * This event is for
75 * - slirp_input
76 * - slirp_link_up
77 * - slirp_link_down
78 * - wakeup
79 */
80# define VBOX_WAKEUP_EVENT_INDEX 1
81
82/*
83 * UDP/TCP socket state change (socket ready to receive, to send, ...)
84 */
85# define VBOX_SOCKET_EVENT_INDEX 2
86
87/*
88 * The number of events for WSAWaitForMultipleEvents().
89 */
90# define VBOX_EVENT_COUNT 3
91
92HANDLE *slirp_get_events(PNATState pData);
93void slirp_register_external_event(PNATState pData, HANDLE hEvent, int index);
94#endif /* RT_OS_WINDOWS */
95
96#ifdef VBOX_WITH_SLIRP_MT
97void slirp_process_queue(PNATState pData);
98void *slirp_get_queue(PNATState pData);
99#endif
100
101/*
102 * Returns the timeout.
103 */
104unsigned int slirp_get_timeout_ms(PNATState pData);
105
106# ifndef RT_OS_WINDOWS
107/*
108 * Returns the number of sockets.
109 */
110int slirp_get_nsock(PNATState pData);
111# endif
112
113#ifdef __cplusplus
114}
115#endif
116
117#endif
Note: See TracBrowser for help on using the repository browser.

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