-/*
- * This function create a flow from src to dst
- *
- * Parameters
- * src: node source
- * dst: node destination
- * port_number: The port number to use
- * start: the time the communication start
- * addr: ip address
- * TotalBytes: number of bytes to transmit
- */
-void NS3Sim::create_flow_NS3(
- Ptr<Node> src,
- Ptr<Node> dst,
- uint16_t port_number,
- double start,
- const char *addr,
- uint32_t TotalBytes,
- void * action)
-{
- if(!dict_socket) dict_socket = xbt_dict_new();
- PacketSinkHelper sink ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny(), port_number));
- sink.Install (dst);
- Ptr<Socket> sock = Socket::CreateSocket (src, TypeId::LookupByName ("ns3::TcpSocketFactory"));
- MySocket *mysocket = new MySocket();
- mysocket->TotalBytes = TotalBytes;
- mysocket->remaining = TotalBytes;
- mysocket->sentBytes = 0;
- mysocket->finished = 0;
- mysocket->action = action;
- xbt_dict_set(dict_socket,(const char*)&sock, mysocket,NULL);
- sock->Bind(InetSocketAddress(port_number));
- Simulator::Schedule (Seconds(start),&StartFlow, sock, addr, port_number);