OpenNet
PacketGenerator.h
Go to the documentation of this file.
1 
2 // Product OpenNet
3 
8 
9 #pragma once
10 
11 // Includes
13 
14 // ===== Includes ===========================================================
15 #include <OpenNet/OpenNet.h>
16 #include <OpenNet/Status.h>
17 #include <OpenNetK/Adapter_Types.h>
18 
19 namespace OpenNet
20 {
21 
22  class Adapter;
23 
24  // Class
26 
34  {
35 
36  public:
37 
46  typedef enum
47  {
48  PROTOCOL_ETHERNET,
49  PROTOCOL_IPv4 ,
50  PROTOCOL_IPv4_UDP,
51 
52  PROTOCOL_QTY
53  }
54  Protocol;
55 
64  typedef struct
65  {
66  OpenNetK::EthernetAddress mDestinationEthernet;
67  OpenNetK::IPv4Address mDestinationIPv4 ;
68  OpenNetK::IPv4Address mSourceIPv4 ;
69 
70  double mBandwidth_MiB_s;
71 
72  Protocol mProtocol;
73 
74  uint32_t mAllowedIndexRepeat;
75  uint32_t mIndexOffset_byte ;
76  uint32_t mPacketSize_byte ;
77 
78  uint16_t mDestinationPort ;
79  uint16_t mEthernetProtocol;
80  uint16_t mSourcePort ;
81 
82  uint8_t mIPv4Protocol;
83 
84  uint8_t mReserved1[81];
85  }
86  Config;
87 
100  OPEN_NET_PUBLIC static PacketGenerator * Create();
101 
104  // configuration.
117  OPEN_NET_PUBLIC static Status Display(const Config & aConfig, FILE * aOut);
118 
130  virtual Status GetConfig(Config * aOut) const = 0;
131 
140  virtual Status ResetConfig() = 0;
141 
151  virtual Status SetAdapter(Adapter * aAdapter) = 0;
152 
164  virtual Status SetConfig(const Config & aConfig) = 0;
165 
173  virtual void Delete();
174 
184  virtual Status Display(FILE * aOut) = 0;
185 
193  virtual Status Start() = 0;
194 
202  virtual Status Stop() = 0;
203 
204  protected:
205 
206  PacketGenerator();
207 
208  virtual ~PacketGenerator();
209 
210  private:
211 
213 
214  const PacketGenerator & operator = (const PacketGenerator &);
215 
216  };
217 
218 }
virtual Status ResetConfig()=0
Reset the configuration of the PacketGenerator.
static OPEN_NET_PUBLIC PacketGenerator * Create()
This static methode create an instance of the PacketGenerator class.
Definition: Adapter.h:19
This structure is used for IPv4 address.
Definition: Adapter_Types.h:111
virtual Status Stop()=0
Stop.
This structure is used for Ethernet address.
Definition: Adapter_Types.h:54
virtual Status GetConfig(Config *aOut) const =0
Retrieve the configuration of the PacketGenerator.
Protocol
This enum indicate the protocol.
Definition: PacketGenerator.h:46
virtual Status SetConfig(const Config &aConfig)=0
Modify the configuration of the PacketGenerator.
OpenNetK::Adapter_Config, OpenNetK::Adapter_Info, OpenNetK::Adapter_State, OpenNetK::Buffer, OpenNetK::EthernetAddress, OpenNetK::IPv4Address, OpenNetK::VersionInfo (SDK)
virtual Status SetAdapter(Adapter *aAdapter)=0
Connect an Adapter to the PacketGenerator.
virtual Status Start()=0
Start.
static OPEN_NET_PUBLIC Status Display(const Config &aConfig, FILE *aOut)
This static methode display the PacketGenerator.
This class define the adapter level interface.
Definition: Adapter.h:35
virtual void Delete()
This methode delete the instance.
PacketGenerator configuration.
Definition: PacketGenerator.h:64
The PacketGenerator class.
Definition: PacketGenerator.h:33