#include <stdint.h>
#include <string>
-class TUNProtocol : public Protocol {
+class TUNProtocol : public Sender, public Reader {
public:
TUNProtocol(const char *devname);
- virtual void send_packet(uint16_t proto, const std::string &data);
+ virtual void send_packet(uint16_t proto, const std::string &data, int incoming_seq);
virtual int fd() const;
- void read_packet(Protocol* sender);
+ virtual void read_packet(Sender* sender);
+
+ int get_received_packets() const { return received_packets; }
+ int get_sent_packets() const { return sent_packets; }
private:
int tunfd;
+ int seq;
+
+ int received_packets = 0, sent_packets = 0;
};
#endif // !defined(_TUNPROTOCOL_H)