1 | #ifndef _LIBSLIRP_H
|
---|
2 | #define _LIBSLIRP_H
|
---|
3 |
|
---|
4 | #ifdef _WIN32
|
---|
5 | #include <winsock2.h>
|
---|
6 | #if defined(VBOX) && defined(__cplusplus)
|
---|
7 | extern "C" {
|
---|
8 | #endif
|
---|
9 | int inet_aton(const char *cp, struct in_addr *ia);
|
---|
10 | #if defined(VBOX) && defined(__cplusplus)
|
---|
11 | }
|
---|
12 | #endif
|
---|
13 | #else
|
---|
14 | #if defined(VBOX) && defined(__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 | #ifdef VBOX
|
---|
22 | #include <VBox/types.h>
|
---|
23 |
|
---|
24 | typedef struct NATState *PNATState;
|
---|
25 | #endif /* VBOX */
|
---|
26 |
|
---|
27 | #ifdef __cplusplus
|
---|
28 | extern "C" {
|
---|
29 | #endif
|
---|
30 |
|
---|
31 | #ifndef VBOX
|
---|
32 | void slirp_init(void);
|
---|
33 | #else /* VBOX */
|
---|
34 | int slirp_init(PNATState *, const char *, void *);
|
---|
35 | void slirp_term(PNATState);
|
---|
36 | void slirp_link_up(PNATState);
|
---|
37 | void slirp_link_down(PNATState);
|
---|
38 | #endif /* VBOX */
|
---|
39 |
|
---|
40 | #ifdef VBOX
|
---|
41 | void slirp_select_fill(PNATState pData, int *pnfds,
|
---|
42 | fd_set *readfds, fd_set *writefds, fd_set *xfds);
|
---|
43 |
|
---|
44 | void slirp_select_poll(PNATState pData, fd_set *readfds, fd_set *writefds, fd_set *xfds);
|
---|
45 |
|
---|
46 | void slirp_input(PNATState pData, const uint8_t *pkt, int pkt_len);
|
---|
47 | #else /* !VBOX */
|
---|
48 | void slirp_select_fill(int *pnfds,
|
---|
49 | fd_set *readfds, fd_set *writefds, fd_set *xfds);
|
---|
50 |
|
---|
51 | void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds);
|
---|
52 |
|
---|
53 | void slirp_input(const uint8_t *pkt, int pkt_len);
|
---|
54 | #endif /* !VBOX */
|
---|
55 |
|
---|
56 | #ifdef VBOX
|
---|
57 | /* you must provide the following functions: */
|
---|
58 | int slirp_can_output(void * pvUser);
|
---|
59 | void slirp_output(void * pvUser, const uint8_t *pkt, int pkt_len);
|
---|
60 |
|
---|
61 | int slirp_redir(PNATState pData, int is_udp, int host_port,
|
---|
62 | struct in_addr guest_addr, int guest_port);
|
---|
63 | int slirp_add_exec(PNATState pData, int do_pty, const char *args, int addr_low_byte,
|
---|
64 | int guest_port);
|
---|
65 | #else /* !VBOX */
|
---|
66 | /* you must provide the following functions: */
|
---|
67 | int slirp_can_output(void);
|
---|
68 | void slirp_output(const uint8_t *pkt, int pkt_len);
|
---|
69 |
|
---|
70 | int slirp_redir(int is_udp, int host_port,
|
---|
71 | struct in_addr guest_addr, int guest_port);
|
---|
72 | int slirp_add_exec(int do_pty, const char *args, int addr_low_byte,
|
---|
73 | int guest_port);
|
---|
74 | #endif /* !VBOX */
|
---|
75 |
|
---|
76 | #ifndef VBOX
|
---|
77 | extern const char *tftp_prefix;
|
---|
78 | extern char slirp_hostname[33];
|
---|
79 | #endif /* !VBOX */
|
---|
80 |
|
---|
81 | #ifdef __cplusplus
|
---|
82 | }
|
---|
83 | #endif
|
---|
84 |
|
---|
85 | #endif
|
---|