NetFork

Files CCore/inc/net/NetFork.h CCore/src/net/NetFork.cpp

NetFork is a simple device. It can be used to process a packet traffic using several tasks. In fact, there are two such classes: EndpointNetFork and MultipointNetFork. First is working with the PacketEndpointDevice and the second with the PacketMultipointDevice. Each of them implements the same packet endpoint interface. So NetFork is a transparent middle device, it enables the inbound packet processing using multiple tasks. Outbound packets go directly to the endpoint device. But the inbound traffic splits between several tasks to be processed.


class EndpointNetFork : public ObjBase , public PacketEndpointDevice
 {
   ....

  public:
  
   template <class ... TT>
   EndpointNetFork(StrLen ep_dev_name,ulen task_count,ulen queue_len,TT ... tt);
   
   virtual ~EndpointNetFork();
   
   // PacketEndpointDevice
   
   virtual PacketFormat getOutboundFormat();
    
   virtual void outbound(Packet<uint8> packet);
    
   virtual ulen getMaxInboundLen();
    
   virtual void attach(InboundProc *proc);
    
   virtual void detach();
 };

EndpointNetFork constructor has the following arguments:

ep_dev_name is the name of some PacketEndpointDevice.

task_count is the number of working tasks to spawn.

queue_len is the packet queue length. A typical value should be 100.

The rest of the argument list is used to spawn tasks. For the possible values see the Task object constructor arguments.

Other methods is the implementation of the PacketEndpointDevice interface.


class MultipointNetFork : public ObjBase , public PacketMultipointDevice
 {
   ....

  public:
  
   template <class ... TT>
   MultipointNetFork(StrLen mp_dev_name,ulen task_count,ulen queue_len,TT ... tt);
   
   virtual ~MultipointNetFork();
   
   // PacketMultipointDevice
   
   virtual StrLen toText(XPoint point,PtrLen<char> buf);
   
   virtual PacketFormat getOutboundFormat();
    
   virtual void outbound(XPoint point,Packet<uint8> packet);
    
   virtual ulen getMaxInboundLen();
    
   virtual void attach(InboundProc *proc);
    
   virtual void detach();
 };

MultipointNetFork constructor has the following arguments:

mp_dev_name is the name of some PacketMultipointDevice.

task_count is the number of working tasks to spawn.

queue_len is the packet queue length. A typical value should be 100.

The rest of the argument list is used to spawn tasks. For the possible values see the Task object constructor arguments.

Other methods is the implementation of the PacketMultipointDevice interface.