File:  [Qemu by Fabrice Bellard] / qemu / slirp / libslirp.h
Revision 1.1.1.6 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:41:00 2018 UTC (2 years, 6 months ago) by root
Branches: qemu, MAIN
CVS tags: qemu1000, qemu0151, qemu0150, qemu0141, qemu0140, qemu0130, qemu0125, qemu0124, qemu0123, qemu0122, qemu0121, qemu0120, HEAD
qemu 0.12.0

    1: #ifndef _LIBSLIRP_H
    2: #define _LIBSLIRP_H
    3: 
    4: #include <qemu-common.h>
    5: 
    6: #ifdef CONFIG_SLIRP
    7: 
    8: struct Slirp;
    9: typedef struct Slirp Slirp;
   10: 
   11: int get_dns_addr(struct in_addr *pdns_addr);
   12: 
   13: Slirp *slirp_init(int restricted, struct in_addr vnetwork,
   14:                   struct in_addr vnetmask, struct in_addr vhost,
   15:                   const char *vhostname, const char *tftp_path,
   16:                   const char *bootfile, struct in_addr vdhcp_start,
   17:                   struct in_addr vnameserver, void *opaque);
   18: void slirp_cleanup(Slirp *slirp);
   19: 
   20: void slirp_select_fill(int *pnfds,
   21:                        fd_set *readfds, fd_set *writefds, fd_set *xfds);
   22: 
   23: void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
   24:                        int select_error);
   25: 
   26: void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len);
   27: 
   28: /* you must provide the following functions: */
   29: int slirp_can_output(void *opaque);
   30: void slirp_output(void *opaque, const uint8_t *pkt, int pkt_len);
   31: 
   32: int slirp_add_hostfwd(Slirp *slirp, int is_udp,
   33:                       struct in_addr host_addr, int host_port,
   34:                       struct in_addr guest_addr, int guest_port);
   35: int slirp_remove_hostfwd(Slirp *slirp, int is_udp,
   36:                          struct in_addr host_addr, int host_port);
   37: int slirp_add_exec(Slirp *slirp, int do_pty, const void *args,
   38:                    struct in_addr *guest_addr, int guest_port);
   39: 
   40: void slirp_connection_info(Slirp *slirp, Monitor *mon);
   41: 
   42: void slirp_socket_recv(Slirp *slirp, struct in_addr guest_addr,
   43:                        int guest_port, const uint8_t *buf, int size);
   44: size_t slirp_socket_can_recv(Slirp *slirp, struct in_addr guest_addr,
   45:                              int guest_port);
   46: 
   47: #else /* !CONFIG_SLIRP */
   48: 
   49: static inline void slirp_select_fill(int *pnfds, fd_set *readfds,
   50:                                      fd_set *writefds, fd_set *xfds) { }
   51: 
   52: static inline void slirp_select_poll(fd_set *readfds, fd_set *writefds,
   53:                                      fd_set *xfds, int select_error) { }
   54: #endif /* !CONFIG_SLIRP */
   55: 
   56: #endif

unix.superglobalmegacorp.com