Path: blob/a-new-beginning/SharedDependencies/Sources/libslirp/include/misc.h
2 views
/* SPDX-License-Identifier: BSD-3-Clause */1/*2* Copyright (c) 1995 Danny Gasparovski.3*/45#ifndef MISC_H6#define MISC_H78#include "libslirp.h"910struct gfwd_list {11SlirpWriteCb write_cb;12void *opaque;13struct in_addr ex_addr; /* Server address */14int ex_fport; /* Port to telnet to */15char *ex_exec; /* Command line of what to exec */16char *ex_unix; /* unix socket */17struct gfwd_list *ex_next;18};1920#define EMU_NONE 0x02122/* TCP emulations */23#define EMU_CTL 0x124#define EMU_FTP 0x225#define EMU_KSH 0x326#define EMU_IRC 0x427#define EMU_REALAUDIO 0x528#define EMU_RLOGIN 0x629#define EMU_IDENT 0x73031#define EMU_NOCONNECT 0x10 /* Don't connect */3233struct tos_t {34uint16_t lport;35uint16_t fport;36uint8_t tos;37uint8_t emu;38};3940struct emu_t {41uint16_t lport;42uint16_t fport;43uint8_t tos;44uint8_t emu;45struct emu_t *next;46};4748struct slirp_quehead {49struct slirp_quehead *qh_link;50struct slirp_quehead *qh_rlink;51};5253/* Insert element a into queue b */54void slirp_insque(void *a, void *b);5556/* Remove element a from its queue */57void slirp_remque(void *a);5859/* Run the given command in the background, and expose its output as a socket */60int fork_exec(struct socket *so, const char *ex);6162/* Create a Unix socket, and expose it as a socket */63int open_unix(struct socket *so, const char *unixsock);6465/* Add a guest forward on the given address and port, with guest data being66* forwarded by calling write_cb */67struct gfwd_list *add_guestfwd(struct gfwd_list **ex_ptr, SlirpWriteCb write_cb,68void *opaque, struct in_addr addr, int port);6970/* Run the given command in the backaground, and send its output to the guest on71* the given address and port */72struct gfwd_list *add_exec(struct gfwd_list **ex_ptr, const char *cmdline,73struct in_addr addr, int port);7475/* Create a Unix socket, and expose it to the guest on the given address and76* port */77struct gfwd_list *add_unix(struct gfwd_list **ex_ptr, const char *unixsock,78struct in_addr addr, int port);7980/* Remove the guest forward bound to the given address and port */81int remove_guestfwd(struct gfwd_list **ex_ptr, struct in_addr addr, int port);8283/* Bind the socket to the outbound address specified in the slirp configuration */84int slirp_bind_outbound(struct socket *so, unsigned short af);8586#endif878889