File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,3 +68,12 @@ TcpConnection::TcpConnection(const TcpAddress& first, const TcpAddress& second)
6868
6969TcpConnection::~TcpConnection () {
7070}
71+
72+ void
73+ TcpConnection::addPacket (bool isIncoming, const Buffer& buffer) {
74+ if (isIncoming) {
75+ mInBuffer .append (buffer);
76+ } else {
77+ mOutBuffer .append (buffer);
78+ }
79+ }
Original file line number Diff line number Diff line change 66#include < list>
77#include < string>
88
9+ #include " buffer.h"
10+
911using namespace std ;
1012
1113typedef u_int32_t tcp_seq;
@@ -59,8 +61,6 @@ typedef struct ether_header RawEtherPacket;
5961typedef struct nread_ip RawIpPacket;
6062typedef struct nread_tcp RawTcpPacket;
6163
62- class Buffer ;
63-
6464class IPv4 {
6565 public:
6666 IPv4 (const struct in_addr & addr);
@@ -112,12 +112,14 @@ class TcpConnection {
112112 TcpConnection (const TcpAddress& first, const TcpAddress& second);
113113 virtual ~TcpConnection ();
114114
115- virtual bool addPacket (const Buffer& data) = 0 ;
115+ virtual void addPacket (bool isIncoming, const Buffer& data);
116116
117117 private:
118118 TcpAddress mFirst ;
119119 TcpAddress mSecond ;
120120 TcpConnectionState mState ;
121+ Buffer mOutBuffer ;
122+ Buffer mInBuffer ;
121123};
122124
123125class TcpConnectionManager {
You can’t perform that action at this time.
0 commit comments