VirtualBox

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

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

NAT: 1. wo sync enhancement branch is still functional (was corrupted with using ICMP file handler in select(1))

  1. after sending send queue doesn't need to synchronize with NAT thread to free mbuf instead NAT queue used to call freeing slirp routine.
  2. no more copying on slirp to guest sent.


  • 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
38#if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC)
39void slirp_select_poll(PNATState pData, int fTimeout, int fIcmp);
40#else
41void slirp_select_poll(PNATState pData, fd_set *readfds, fd_set *writefds, fd_set *xfds);
42#endif
43
44void slirp_input(PNATState pData, const uint8_t *pkt, int pkt_len);
45void slirp_set_ethaddr(PNATState pData, const uint8_t *ethaddr);
46
47/* you must provide the following functions: */
48int slirp_can_output(void * pvUser);
49#ifdef VBOX_WITH_SIMPLIFIED_SLIRP_SYNC
50void slirp_output(void * pvUser, void *pvArg, const uint8_t *pkt, int pkt_len);
51void slirp_post_sent(PNATState pData, void *pvArg);
52#else
53void slirp_output(void * pvUser, const uint8_t *pkt, int pkt_len);
54#endif
55
56int slirp_redir(PNATState pData, int is_udp, int host_port,
57 struct in_addr guest_addr, int guest_port);
58int slirp_add_exec(PNATState pData, int do_pty, const char *args, int addr_low_byte,
59 int guest_port);
60
61#if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
62
63
64/*
65 * ICMP handle state change
66 */
67# define VBOX_ICMP_EVENT_INDEX 0
68
69/**
70 * This event is for
71 * - slirp_input
72 * - slirp_link_up
73 * - slirp_link_down
74 * - wakeup
75 */
76# define VBOX_WAKEUP_EVENT_INDEX 1
77
78/*
79 * UDP/TCP socket state change (socket ready to receive, to send, ...)
80 */
81# define VBOX_SOCKET_EVENT_INDEX 2
82
83/*
84 * The number of events for WSAWaitForMultipleEvents().
85 */
86# define VBOX_EVENT_COUNT 3
87
88HANDLE *slirp_get_events(PNATState pData);
89void slirp_register_external_event(PNATState pData, HANDLE hEvent, int index);
90#endif
91
92/*
93 * Return the timeout.
94 */
95unsigned int slirp_get_timeout_ms(PNATState pData);
96
97#ifdef __cplusplus
98}
99#endif
100
101#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