ns3-bgp  0.2
BGP module for ns-3.
bgp-ns3-socket-in.cc
Go to the documentation of this file.
1 
11 #include "bgp-ns3-socket-in.h"
12 #include "ns3/log.h"
13 
14 namespace ns3 {
15 
21 BgpNs3SocketIn::BgpNs3SocketIn(Ptr<BgpNs3Fsm> fsm) {
22  _fsm = fsm;
23 }
24 
30 void BgpNs3SocketIn::HandleRead(Ptr<Socket> socket) {
31  int sz = socket->Recv(_recv_buffer, 65535, 0);
32 
33  if (sz <= 0) {
34  _fsm->resetHard();
35  return;
36  }
37 
38  _fsm->run(_recv_buffer, sz);
39 }
40 
41 }
BgpNs3SocketIn(Ptr< BgpNs3Fsm > fsm)
Construct the container.
Definition: bgp-log.cc:15
Simple container class for FSM to receive data from peer.
void HandleRead(Ptr< Socket > socket)
Handle reading from socket.