aboutsummaryrefslogtreecommitdiff
path: root/slirp/libslirp.h
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2009-06-24 14:42:31 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-29 08:52:49 -0500
commit9f8bd0421dc03b2640ac2d0a4d702354a218b2ab (patch)
treeb866bf7d4864fac7a8313bdf04cca2f997242951 /slirp/libslirp.h
parent460fec67ee3807bb2eb189587ffe803a48f317e5 (diff)
slirp: Use internal state in interface
This now also exports the internal state to the slirp users in qemu, returning it from slirp_init and expecting it along with service invocations. Additionally provide an opaque value interface for the callbacks from slirp into the qemu core. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'slirp/libslirp.h')
-rw-r--r--slirp/libslirp.h35
1 files changed, 19 insertions, 16 deletions
diff --git a/slirp/libslirp.h b/slirp/libslirp.h
index 3bda69194e..521de3e026 100644
--- a/slirp/libslirp.h
+++ b/slirp/libslirp.h
@@ -8,11 +8,11 @@
struct Slirp;
typedef struct Slirp Slirp;
-void slirp_init(int restricted, struct in_addr vnetwork,
- struct in_addr vnetmask, struct in_addr vhost,
- const char *vhostname, const char *tftp_path,
- const char *bootfile, struct in_addr vdhcp_start,
- struct in_addr vnameserver);
+Slirp *slirp_init(int restricted, struct in_addr vnetwork,
+ struct in_addr vnetmask, struct in_addr vhost,
+ const char *vhostname, const char *tftp_path,
+ const char *bootfile, struct in_addr vdhcp_start,
+ struct in_addr vnameserver, void *opaque);
void slirp_select_fill(int *pnfds,
fd_set *readfds, fd_set *writefds, fd_set *xfds);
@@ -20,23 +20,26 @@ void slirp_select_fill(int *pnfds,
void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
int select_error);
-void slirp_input(const uint8_t *pkt, int pkt_len);
+void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len);
/* you must provide the following functions: */
-int slirp_can_output(void);
-void slirp_output(const uint8_t *pkt, int pkt_len);
+int slirp_can_output(void *opaque);
+void slirp_output(void *opaque, const uint8_t *pkt, int pkt_len);
-int slirp_add_hostfwd(int is_udp, struct in_addr host_addr, int host_port,
+int slirp_add_hostfwd(Slirp *slirp, int is_udp,
+ struct in_addr host_addr, int host_port,
struct in_addr guest_addr, int guest_port);
-int slirp_remove_hostfwd(int is_udp, struct in_addr host_addr, int host_port);
-int slirp_add_exec(int do_pty, const void *args, struct in_addr guest_addr,
- int guest_port);
+int slirp_remove_hostfwd(Slirp *slirp, int is_udp,
+ struct in_addr host_addr, int host_port);
+int slirp_add_exec(Slirp *slirp, int do_pty, const void *args,
+ struct in_addr guest_addr, int guest_port);
-void slirp_connection_info(Monitor *mon);
+void slirp_connection_info(Slirp *slirp, Monitor *mon);
-void slirp_socket_recv(struct in_addr guest_addr, int guest_port,
- const uint8_t *buf, int size);
-size_t slirp_socket_can_recv(struct in_addr guest_addr, int guest_port);
+void slirp_socket_recv(Slirp *slirp, struct in_addr guest_addr,
+ int guest_port, const uint8_t *buf, int size);
+size_t slirp_socket_can_recv(Slirp *slirp, struct in_addr guest_addr,
+ int guest_port);
#else /* !CONFIG_SLIRP */