ip_divert.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* $OpenBSD: ip_divert.h,v 1.6 2014/07/10 03:17:59 lteo Exp $ */
  2. /*
  3. * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
  4. *
  5. * Permission to use, copy, modify, and distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #ifndef _IP_DIVERT_H_
  18. #define _IP_DIVERT_H_
  19. struct divstat {
  20. u_long divs_ipackets; /* total input packets */
  21. u_long divs_noport; /* no socket on port */
  22. u_long divs_fullsock; /* not delivered, input socket full */
  23. u_long divs_opackets; /* total output packets */
  24. u_long divs_errors; /* generic errors */
  25. };
  26. /*
  27. * Names for divert sysctl objects
  28. */
  29. #define DIVERTCTL_RECVSPACE 1 /* receive buffer space */
  30. #define DIVERTCTL_SENDSPACE 2 /* send buffer space */
  31. #define DIVERTCTL_STATS 3 /* divert statistics */
  32. #define DIVERTCTL_MAXID 4
  33. #define DIVERTCTL_NAMES { \
  34. { 0, 0 }, \
  35. { "recvspace", CTLTYPE_INT }, \
  36. { "sendspace", CTLTYPE_INT }, \
  37. { "stats", CTLTYPE_STRUCT } \
  38. }
  39. #define DIVERTCTL_VARS { \
  40. NULL, \
  41. &divert_recvspace, \
  42. &divert_sendspace, \
  43. NULL \
  44. }
  45. #ifdef _KERNEL
  46. extern struct inpcbtable divbtable;
  47. extern struct divstat divstat;
  48. void divert_init(void);
  49. void divert_input(struct mbuf *, ...);
  50. int divert_packet(struct mbuf *, int, u_int16_t);
  51. int divert_sysctl(int *, u_int, void *, size_t *, void *, size_t);
  52. int divert_usrreq(struct socket *,
  53. int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
  54. #endif /* _KERNEL */
  55. #endif /* _IP_DIVERT_H_ */