File:  [Qemu by Fabrice Bellard] / qemu / slirp / libslirp.h
Revision 1.1.1.5 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:25:40 2018 UTC (2 years, 1 month ago) by root
Branches: qemu, MAIN
CVS tags: qemu0111, qemu0110, HEAD
qemu 0.11.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: 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,
   15:                   struct in_addr vnameserver, void *opaque);
   16: void slirp_cleanup(Slirp *slirp);
   17: 
   18: void slirp_select_fill(int *pnfds,
   19:                        fd_set *readfds, fd_set *writefds, fd_set *xfds);
   20: 
   21: void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
   22:                        int select_error);
   23: 
   24: void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len);
   25: 
   26: /* you must provide the following functions: */
   27: int slirp_can_output(void *opaque);
   28: void slirp_output(void *opaque, const uint8_t *pkt, int pkt_len);
   29: 
   30: int slirp_add_hostfwd(Slirp *slirp, int is_udp,
   31:                       struct in_addr host_addr, int host_port,
   32:                       struct in_addr guest_addr, int guest_port);
   33: int slirp_remove_hostfwd(Slirp *slirp, int is_udp,
   34:                          struct in_addr host_addr, int host_port);
   35: int slirp_add_exec(Slirp *slirp, int do_pty, const void *args,
   36:                    struct in_addr *guest_addr, int guest_port);
   37: 
   38: void slirp_connection_info(Slirp *slirp, Monitor *mon);
   39: 
   40: void slirp_socket_recv(Slirp *slirp, struct in_addr guest_addr,
   41:                        int guest_port, const uint8_t *buf, int size);
   42: size_t slirp_socket_can_recv(Slirp *slirp, struct in_addr guest_addr,
   43:                              int guest_port);
   44: 
   45: #else /* !CONFIG_SLIRP */
   46: 
   47: static inline void slirp_select_fill(int *pnfds, fd_set *readfds,
   48:                                      fd_set *writefds, fd_set *xfds) { }
   49: 
   50: static inline void slirp_select_poll(fd_set *readfds, fd_set *writefds,
   51:                                      fd_set *xfds, int select_error) { }
   52: #endif /* !CONFIG_SLIRP */
   53: 
   54: #endif

unix.superglobalmegacorp.com