Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
folium-app
GitHub Repository: folium-app/Folium
Path: blob/a-new-beginning/SharedDependencies/Sources/libslirp/include/misc.h
2 views
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
/* Insert element a into queue b */
55
void slirp_insque(void *a, void *b);
56
57
/* Remove element a from its queue */
58
void slirp_remque(void *a);
59
60
/* Run the given command in the background, and expose its output as a socket */
61
int fork_exec(struct socket *so, const char *ex);
62
63
/* Create a Unix socket, and expose it as a socket */
64
int open_unix(struct socket *so, const char *unixsock);
65
66
/* Add a guest forward on the given address and port, with guest data being
67
* forwarded by calling write_cb */
68
struct gfwd_list *add_guestfwd(struct gfwd_list **ex_ptr, SlirpWriteCb write_cb,
69
void *opaque, struct in_addr addr, int port);
70
71
/* Run the given command in the backaground, and send its output to the guest on
72
* the given address and port */
73
struct gfwd_list *add_exec(struct gfwd_list **ex_ptr, const char *cmdline,
74
struct in_addr addr, int port);
75
76
/* Create a Unix socket, and expose it to the guest on the given address and
77
* port */
78
struct gfwd_list *add_unix(struct gfwd_list **ex_ptr, const char *unixsock,
79
struct in_addr addr, int port);
80
81
/* Remove the guest forward bound to the given address and port */
82
int remove_guestfwd(struct gfwd_list **ex_ptr, struct in_addr addr, int port);
83
84
/* Bind the socket to the outbound address specified in the slirp configuration */
85
int slirp_bind_outbound(struct socket *so, unsigned short af);
86
87
#endif
88
89