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