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
11struct 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 struct gfwd_list *ex_next;
18};
19
20#define EMU_NONE 0x0
21
22/* TCP emulations */
23#define EMU_CTL 0x1
24#define EMU_FTP 0x2
25#define EMU_KSH 0x3
26#define EMU_IRC 0x4
27#define EMU_REALAUDIO 0x5
28#define EMU_RLOGIN 0x6
29#define EMU_IDENT 0x7
30
31#define EMU_NOCONNECT 0x10 /* Don't connect */
32
33struct tos_t {
34 uint16_t lport;
35 uint16_t fport;
36 uint8_t tos;
37 uint8_t emu;
38};
39
40struct emu_t {
41 uint16_t lport;
42 uint16_t fport;
43 uint8_t tos;
44 uint8_t emu;
45 struct emu_t *next;
46};
47
48struct slirp_quehead {
49 struct slirp_quehead *qh_link;
50 struct slirp_quehead *qh_rlink;
51};
52
53void slirp_insque(void *, void *);
54void slirp_remque(void *);
55int fork_exec(struct socket *so, const char *ex);
56
57struct gfwd_list *add_guestfwd(struct gfwd_list **ex_ptr, SlirpWriteCb write_cb,
58 void *opaque, struct in_addr addr, int port);
59
60struct gfwd_list *add_exec(struct gfwd_list **ex_ptr, const char *cmdline,
61 struct in_addr addr, int port);
62
63#endif
64