Update and clean Tomato RAF files
[tomato.git] / release / src / router / pptpd / pptpgre.h
blob42d1467fd6fb112b319f57d9ab46c80897b515ed
1 /*
2 * pptpgre.h
4 * Functions to handle the GRE en/decapsulation
6 * $Id: pptpgre.h,v 1.3 2005/08/02 11:33:31 quozl Exp $
7 */
9 #ifndef _PPTPD_PPTPGRE_H
10 #define _PPTPD_PPTPGRE_H
12 extern int decaps_hdlc(int fd, int (*cb) (int cl, void *pack, unsigned len), int cl);
13 extern int encaps_hdlc(int fd, void *pack, unsigned len);
14 extern int decaps_gre(int fd, int (*cb) (int cl, void *pack, unsigned len), int cl);
15 extern int encaps_gre(int fd, void *pack, unsigned len);
17 extern int pptp_gre_init(u_int32_t call_id_pair, int pty_fd, struct in_addr *inetaddrs);
19 struct 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;
25 extern int disable_buffer;
27 typedef 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;
32 typedef struct gre_stats {
33 /* statistics for GRE receive */
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
48 /* statistics for GRE transmit */
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
56 /* statistics for packet tracking, for RTT calculation */
58 pack_track_t pt; // last data packet seq/time
59 int rtt; // estimated round-trip time in us
61 } gre_stats_t;
63 extern gre_stats_t stats;
65 #endif /* !_PPTPD_PPTPGRE_H */