1
0

pptpgre.h 2.2 KB

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