blob: 5bdcbd50f7ec4acc41b4017d8f538d2f3127a4b2 [file] [log] [blame]
bellardf0cbd3e2004-04-22 00:10:48 +00001#ifndef _LIBSLIRP_H
2#define _LIBSLIRP_H
3
Stefan Weil5a61cb62011-09-08 17:55:32 +02004#include "qemu-common.h"
Jan Kiszka6dbe5532009-06-24 14:42:29 +02005
Jan Kiszka460fec62009-06-24 14:42:31 +02006struct Slirp;
7typedef struct Slirp Slirp;
8
Ed Swierkdf7a86e2009-08-20 19:00:31 -07009int get_dns_addr(struct in_addr *pdns_addr);
10
Jan Kiszka9f8bd042009-06-24 14:42:31 +020011Slirp *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 Stengel63d29602012-10-27 19:53:39 +020015 struct in_addr vnameserver, const char **vdnssearch,
16 void *opaque);
Jan Kiszkaad0d8c42009-06-24 14:42:31 +020017void slirp_cleanup(Slirp *slirp);
bellardf0cbd3e2004-04-22 00:10:48 +000018
Liu Ping Fana42e9c42013-08-25 10:01:21 +080019void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout);
bellardf0cbd3e2004-04-22 00:10:48 +000020
Stefan Hajnoczi8917c3b2013-02-20 11:28:28 +010021void slirp_pollfds_poll(GArray *pollfds, int select_error);
bellardf0cbd3e2004-04-22 00:10:48 +000022
Jan Kiszka9f8bd042009-06-24 14:42:31 +020023void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len);
bellardf0cbd3e2004-04-22 00:10:48 +000024
25/* you must provide the following functions: */
Jan Kiszka9f8bd042009-06-24 14:42:31 +020026void slirp_output(void *opaque, const uint8_t *pkt, int pkt_len);
bellardf0cbd3e2004-04-22 00:10:48 +000027
Jan Kiszka9f8bd042009-06-24 14:42:31 +020028int slirp_add_hostfwd(Slirp *slirp, int is_udp,
29 struct in_addr host_addr, int host_port,
Jan Kiszkac92ef6a2009-06-24 14:42:28 +020030 struct in_addr guest_addr, int guest_port);
Jan Kiszka9f8bd042009-06-24 14:42:31 +020031int slirp_remove_hostfwd(Slirp *slirp, int is_udp,
32 struct in_addr host_addr, int host_port);
33int slirp_add_exec(Slirp *slirp, int do_pty, const void *args,
Jan Kiszkabb53fc52009-07-22 17:03:52 +020034 struct in_addr *guest_addr, int guest_port);
bellard9bf05442004-08-25 22:12:49 +000035
Jan Kiszka9f8bd042009-06-24 14:42:31 +020036void slirp_connection_info(Slirp *slirp, Monitor *mon);
Jan Kiszka6dbe5532009-06-24 14:42:29 +020037
Jan Kiszka9f8bd042009-06-24 14:42:31 +020038void slirp_socket_recv(Slirp *slirp, struct in_addr guest_addr,
39 int guest_port, const uint8_t *buf, int size);
40size_t slirp_socket_can_recv(Slirp *slirp, struct in_addr guest_addr,
41 int guest_port);
blueswir131a60e22007-10-26 18:42:59 +000042
bellardf0cbd3e2004-04-22 00:10:48 +000043#endif