bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 1 | #ifndef _LIBSLIRP_H |
| 2 | #define _LIBSLIRP_H |
| 3 | |
Stefan Weil | 5a61cb6 | 2011-09-08 17:55:32 +0200 | [diff] [blame] | 4 | #include "qemu-common.h" |
Jan Kiszka | 6dbe553 | 2009-06-24 14:42:29 +0200 | [diff] [blame] | 5 | |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 6 | struct Slirp; |
| 7 | typedef struct Slirp Slirp; |
| 8 | |
Ed Swierk | df7a86e | 2009-08-20 19:00:31 -0700 | [diff] [blame] | 9 | int get_dns_addr(struct in_addr *pdns_addr); |
| 10 | |
Jan Kiszka | 9f8bd04 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 11 | Slirp *slirp_init(int restricted, struct in_addr vnetwork, |
| 12 | struct in_addr vnetmask, struct in_addr vhost, |
| 13 | const char *vhostname, const char *tftp_path, |
| 14 | const char *bootfile, struct in_addr vdhcp_start, |
Klaus Stengel | 63d2960 | 2012-10-27 19:53:39 +0200 | [diff] [blame] | 15 | struct in_addr vnameserver, const char **vdnssearch, |
| 16 | void *opaque); |
Jan Kiszka | ad0d8c4 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 17 | void slirp_cleanup(Slirp *slirp); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 18 | |
Liu Ping Fan | a42e9c4 | 2013-08-25 10:01:21 +0800 | [diff] [blame] | 19 | void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 20 | |
Stefan Hajnoczi | 8917c3b | 2013-02-20 11:28:28 +0100 | [diff] [blame] | 21 | void slirp_pollfds_poll(GArray *pollfds, int select_error); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 22 | |
Jan Kiszka | 9f8bd04 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 23 | void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 24 | |
| 25 | /* you must provide the following functions: */ |
Jan Kiszka | 9f8bd04 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 26 | void slirp_output(void *opaque, const uint8_t *pkt, int pkt_len); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 27 | |
Jan Kiszka | 9f8bd04 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 28 | int slirp_add_hostfwd(Slirp *slirp, int is_udp, |
| 29 | struct in_addr host_addr, int host_port, |
Jan Kiszka | c92ef6a | 2009-06-24 14:42:28 +0200 | [diff] [blame] | 30 | struct in_addr guest_addr, int guest_port); |
Jan Kiszka | 9f8bd04 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 31 | int slirp_remove_hostfwd(Slirp *slirp, int is_udp, |
| 32 | struct in_addr host_addr, int host_port); |
| 33 | int slirp_add_exec(Slirp *slirp, int do_pty, const void *args, |
Jan Kiszka | bb53fc5 | 2009-07-22 17:03:52 +0200 | [diff] [blame] | 34 | struct in_addr *guest_addr, int guest_port); |
bellard | 9bf0544 | 2004-08-25 22:12:49 +0000 | [diff] [blame] | 35 | |
Jan Kiszka | 9f8bd04 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 36 | void slirp_connection_info(Slirp *slirp, Monitor *mon); |
Jan Kiszka | 6dbe553 | 2009-06-24 14:42:29 +0200 | [diff] [blame] | 37 | |
Jan Kiszka | 9f8bd04 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 38 | void slirp_socket_recv(Slirp *slirp, struct in_addr guest_addr, |
| 39 | int guest_port, const uint8_t *buf, int size); |
| 40 | size_t slirp_socket_can_recv(Slirp *slirp, struct in_addr guest_addr, |
| 41 | int guest_port); |
blueswir1 | 31a60e2 | 2007-10-26 18:42:59 +0000 | [diff] [blame] | 42 | |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 43 | #endif |