slirp.h 1.5 KB

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