VirtualBox

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

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

slirp:ICMP: windows support (mostly reorganization, shouldn't compile on windows)

  • Property svn:eol-style set to native
File size: 2.5 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 <arpa/inet.h>
19#endif
20
21#include <VBox/types.h>
22
23typedef struct NATState *PNATState;
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29int slirp_init(PNATState *, const char *, uint32_t, bool, const char *, const char *, void *);
30void slirp_register_timers(PNATState pData, PPDMDRVINS pDrvIns);
31void slirp_term(PNATState);
32void slirp_link_up(PNATState);
33void slirp_link_down(PNATState);
34
35void slirp_select_fill(PNATState pData, int *pnfds,
36 fd_set *readfds, fd_set *writefds, fd_set *xfds);
37
38void slirp_select_poll(PNATState pData, fd_set *readfds, fd_set *writefds, fd_set *xfds);
39
40void slirp_input(PNATState pData, const uint8_t *pkt, int pkt_len);
41void slirp_set_ethaddr(PNATState pData, const uint8_t *ethaddr);
42
43/* you must provide the following functions: */
44int slirp_can_output(void * pvUser);
45void slirp_output(void * pvUser, const uint8_t *pkt, int pkt_len);
46
47int slirp_redir(PNATState pData, int is_udp, int host_port,
48 struct in_addr guest_addr, int guest_port);
49int slirp_add_exec(PNATState pData, int do_pty, const char *args, int addr_low_byte,
50 int guest_port);
51
52#if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
53/**
54 * This event is for
55 * - slirp_input
56 * - slirp_link_up
57 * - slirp_link_down
58 * - wakeup
59 *
60 * The event index should be smaller than VBOX_SOCKET_EVENT_INDEX to ensure
61 * that we can detect if that event was set (WSAWaitForMultipleEvents()
62 * returns the index of the first active event).
63 */
64#define VBOX_WAKEUP_EVENT_INDEX 0
65
66/*
67 * UDP/TCP socket state change (socket ready to receive, to send, ...)
68 */
69#define VBOX_SOCKET_EVENT_INDEX 1
70
71#ifdef VBOX_WITH_SLIRP_ICMP
72/*
73 * ICMP handle state change
74 */
75#define VBOX_ICMP_EVENT_INDEX 2
76
77/*
78 * The number of events for WSAWaitForMultipleEvents().
79 */
80#define VBOX_EVENT_COUNT 3
81#else
82/*
83 * The number of events for WSAWaitForMultipleEvents().
84 */
85#define VBOX_EVENT_COUNT 2
86
87#endif
88
89HANDLE *slirp_get_events(PNATState pData);
90void slirp_register_external_event(PNATState pData, HANDLE hEvent, int index);
91#endif
92
93/*
94 * Return the timeout.
95 */
96unsigned int slirp_get_timeout_ms(PNATState pData);
97
98#ifdef __cplusplus
99}
100#endif
101
102#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