1 /* SPDX-License-Identifier: BSD-3-Clause */ 2 /* 3 * Copyright (c) 1995 Danny Gasparovski. 4 */ 5 6 #ifndef MISC_H 7 #define MISC_H 8 9 #include "libslirp.h" 10 11 struct gfwd_list { 12 SlirpWriteCb write_cb; 13 void *opaque; 14 struct in_addr ex_addr; /* Server address */ 15 int ex_fport; /* Port to telnet to */ 16 char *ex_exec; /* Command line of what to exec */ 17 char *ex_unix; /* unix socket */ 18 struct gfwd_list *ex_next; 19 }; 20 21 #define EMU_NONE 0x0 22 23 /* TCP emulations */ 24 #define EMU_CTL 0x1 25 #define EMU_FTP 0x2 26 #define EMU_KSH 0x3 27 #define EMU_IRC 0x4 28 #define EMU_REALAUDIO 0x5 29 #define EMU_RLOGIN 0x6 30 #define EMU_IDENT 0x7 31 32 #define EMU_NOCONNECT 0x10 /* Don't connect */ 33 34 struct tos_t { 35 uint16_t lport; 36 uint16_t fport; 37 uint8_t tos; 38 uint8_t emu; 39 }; 40 41 struct emu_t { 42 uint16_t lport; 43 uint16_t fport; 44 uint8_t tos; 45 uint8_t emu; 46 struct emu_t *next; 47 }; 48 49 struct slirp_quehead { 50 struct slirp_quehead *qh_link; 51 struct slirp_quehead *qh_rlink; 52 }; 53 54 void slirp_insque(void *, void *); 55 void slirp_remque(void *); 56 int fork_exec(struct socket *so, const char *ex); 57 int open_unix(struct socket *so, const char *unixsock); 58 59 struct gfwd_list *add_guestfwd(struct gfwd_list **ex_ptr, SlirpWriteCb write_cb, 60 void *opaque, struct in_addr addr, int port); 61 62 struct gfwd_list *add_exec(struct gfwd_list **ex_ptr, const char *cmdline, 63 struct in_addr addr, int port); 64 65 struct gfwd_list *add_unix(struct gfwd_list **ex_ptr, const char *unixsock, 66 struct in_addr addr, int port); 67 68 int remove_guestfwd(struct gfwd_list **ex_ptr, struct in_addr addr, int port); 69 70 int slirp_bind_outbound(struct socket *so, unsigned short af); 71 72 #endif 73