1
0

pptpgre.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * pptpgre.h
  3. *
  4. * Functions to handle the GRE en/decapsulation
  5. *
  6. * $Id: pptpgre.h,v 1.3 2005/08/02 11:33:31 quozl Exp $
  7. */
  8. #ifndef _PPTPD_PPTPGRE_H
  9. #define _PPTPD_PPTPGRE_H
  10. extern int decaps_hdlc(int fd, int (*cb) (int cl, void *pack, unsigned len), int cl);
  11. extern int encaps_hdlc(int fd, void *pack, unsigned len);
  12. extern int decaps_gre(int fd, int (*cb) (int cl, void *pack, unsigned len), int cl);
  13. extern int encaps_gre(int fd, void *pack, unsigned len);
  14. extern int pptp_gre_init(u_int32_t call_id_pair, int pty_fd, struct in_addr *inetaddrs);
  15. struct gre_state {
  16. u_int32_t ack_sent, ack_recv;
  17. u_int32_t seq_sent, seq_recv;
  18. u_int32_t call_id_pair;
  19. };
  20. extern int disable_buffer;
  21. typedef struct pack_track {
  22. uint32_t seq; // seq no of this tracked packet
  23. uint64_t time; // time when this tracked packet was sent (in usecs)
  24. } pack_track_t;
  25. typedef struct gre_stats {
  26. /* statistics for GRE receive */
  27. uint32_t rx_accepted; // data packet was passed to pppd
  28. uint32_t rx_lost; // data packet did not arrive before timeout
  29. uint32_t rx_underwin; // data packet was under window (arrived too late
  30. // or duplicate packet)
  31. uint32_t rx_overwin; // data packet was over window
  32. // (too many packets lost?)
  33. uint32_t rx_buffered; // data packet arrived earlier than expected,
  34. // packet(s) before it were lost or reordered
  35. uint32_t rx_errors; // OS error on receive
  36. uint32_t rx_truncated; // truncated packet
  37. uint32_t rx_invalid; // wrong protocol or invalid flags
  38. uint32_t rx_acks; // acknowledgement only
  39. /* statistics for GRE transmit */
  40. uint32_t tx_sent; // data packet write() to GRE socket succeeded
  41. uint32_t tx_failed; // data packet write() to GRE socket returned error
  42. uint32_t tx_short; // data packet write() to GRE socket underflowed
  43. uint32_t tx_acks; // sent packet with just ACK
  44. uint32_t tx_oversize; // data packet dropped because it was too large
  45. /* statistics for packet tracking, for RTT calculation */
  46. pack_track_t pt; // last data packet seq/time
  47. int rtt; // estimated round-trip time in us
  48. } gre_stats_t;
  49. extern gre_stats_t stats;
  50. #endif /* !_PPTPD_PPTPGRE_H */