# for dual mode check that all are masters
if is_dual:
+ if not pcap_filename.endswith('erf'):
+ raise STLError("dual mode: only ERF format is supported for dual mode")
+
for port in ports:
master = port
slave = port ^ 0x1
DUAL: ArgumentPack(['--dual'],
{"action": "store_true",
'default': False,
- 'help': "Transmit in a dual mode - requires a slave attached to the port"}),
+ 'help': "Transmit in a dual mode - requires ownership on the adjacent port"}),
FILE_PATH: ArgumentPack(['-f'],
{'metavar': 'FILE',
* open file for reading.
*/
virtual bool Create(char * name, int loops = 0) = 0;
+
+ virtual capture_type_e get_type() = 0;
+
protected:
int m_loops;
uint64_t m_file_size;
bool Create(char *filename, int loops = 0);
void Delete();
virtual bool ReadPacket(CCapPktRaw * lpPacket);
+
+ virtual capture_type_e get_type() {
+ return ERF;
+ }
+
private:
FILE * m_handle;
};
* otherwise (reached eof)
*/
virtual bool ReadPacket(CCapPktRaw *lpPacket);
- virtual void Rewind();
+ virtual void Rewind();
+ virtual capture_type_e get_type() {
+ return LIBPCAP;
+ }
+
private:
LibPCapReader(LibPCapReader &);
if (!slave->get_owner().verify(slave_handler)) {
generate_execute_err(result, "incorrect or missing slave port handler");
}
+
+ std::stringstream ss;
+ CCapReaderBase *reader = CCapReaderFactory::CreateReader((char *)pcap_filename.c_str(), 0, ss);
+ if (!reader) {
+ generate_execute_err(result, ss.str());
+ }
+ if (reader->get_type() != ERF) {
+ generate_execute_err(result, "dual mode is only supported on ERF format");
+ }
}
+
try {
port->push_remote(pcap_filename, ipg_usec, speedup, count, duration, is_dual);
} catch (const TrexException &ex) {
verify_state(PORT_STATE_IDLE | PORT_STATE_STREAMS, "push_remote");
/* check that file exists */
- CCapReaderBase *reader;
std::stringstream ss;
- reader = CCapReaderFactory::CreateReader((char *)pcap_filename.c_str(), 0, ss);
+ CCapReaderBase *reader = CCapReaderFactory::CreateReader((char *)pcap_filename.c_str(), 0, ss);
if (!reader) {
throw TrexException(ss.str());
}