xref: /linux/arch/um/drivers/slirp.h (revision 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2)
1*1da177e4SLinus Torvalds #ifndef __UM_SLIRP_H
2*1da177e4SLinus Torvalds #define __UM_SLIRP_H
3*1da177e4SLinus Torvalds 
4*1da177e4SLinus Torvalds #define BUF_SIZE 1500
5*1da177e4SLinus Torvalds  /* two bytes each for a (pathological) max packet of escaped chars +  *
6*1da177e4SLinus Torvalds   * terminating END char + initial END char                            */
7*1da177e4SLinus Torvalds #define ENC_BUF_SIZE (2 * BUF_SIZE + 2)
8*1da177e4SLinus Torvalds 
9*1da177e4SLinus Torvalds #define SLIRP_MAX_ARGS 100
10*1da177e4SLinus Torvalds /*
11*1da177e4SLinus Torvalds  * XXX this next definition is here because I don't understand why this
12*1da177e4SLinus Torvalds  * initializer doesn't work in slirp_kern.c:
13*1da177e4SLinus Torvalds  *
14*1da177e4SLinus Torvalds  *   argv :  { init->argv[ 0 ... SLIRP_MAX_ARGS-1 ] },
15*1da177e4SLinus Torvalds  *
16*1da177e4SLinus Torvalds  * or why I can't typecast like this:
17*1da177e4SLinus Torvalds  *
18*1da177e4SLinus Torvalds  *   argv :  (char* [SLIRP_MAX_ARGS])(init->argv),
19*1da177e4SLinus Torvalds  */
20*1da177e4SLinus Torvalds struct arg_list_dummy_wrapper { char *argv[SLIRP_MAX_ARGS]; };
21*1da177e4SLinus Torvalds 
22*1da177e4SLinus Torvalds struct slirp_data {
23*1da177e4SLinus Torvalds 	void *dev;
24*1da177e4SLinus Torvalds 	struct arg_list_dummy_wrapper argw;
25*1da177e4SLinus Torvalds 	int pid;
26*1da177e4SLinus Torvalds 	int slave;
27*1da177e4SLinus Torvalds 	char ibuf[ENC_BUF_SIZE];
28*1da177e4SLinus Torvalds 	char obuf[ENC_BUF_SIZE];
29*1da177e4SLinus Torvalds 	int more; /* more data: do not read fd until ibuf has been drained */
30*1da177e4SLinus Torvalds 	int pos;
31*1da177e4SLinus Torvalds 	int esc;
32*1da177e4SLinus Torvalds };
33*1da177e4SLinus Torvalds 
34*1da177e4SLinus Torvalds extern struct net_user_info slirp_user_info;
35*1da177e4SLinus Torvalds 
36*1da177e4SLinus Torvalds extern int set_umn_addr(int fd, char *addr, char *ptp_addr);
37*1da177e4SLinus Torvalds extern int slirp_user_read(int fd, void *buf, int len, struct slirp_data *pri);
38*1da177e4SLinus Torvalds extern int slirp_user_write(int fd, void *buf, int len, struct slirp_data *pri);
39*1da177e4SLinus Torvalds 
40*1da177e4SLinus Torvalds #endif
41*1da177e4SLinus Torvalds 
42*1da177e4SLinus Torvalds /*
43*1da177e4SLinus Torvalds  * Overrides for Emacs so that we follow Linus's tabbing style.
44*1da177e4SLinus Torvalds  * Emacs will notice this stuff at the end of the file and automatically
45*1da177e4SLinus Torvalds  * adjust the settings for this buffer only.  This must remain at the end
46*1da177e4SLinus Torvalds  * of the file.
47*1da177e4SLinus Torvalds  * ---------------------------------------------------------------------------
48*1da177e4SLinus Torvalds  * Local variables:
49*1da177e4SLinus Torvalds  * c-file-style: "linux"
50*1da177e4SLinus Torvalds  * End:
51*1da177e4SLinus Torvalds  */
52