Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
#ifndef _STREAM_BASE_H
|
|
|
|
#define _STREAM_BASE_H
|
|
|
|
|
2009-08-02 09:52:34 -05:00
|
|
|
#include <QString>
|
|
|
|
#include <QLinkedList>
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
|
2009-08-02 09:52:34 -05:00
|
|
|
#include "protocol.pb.h"
|
|
|
|
|
|
|
|
class AbstractProtocol;
|
|
|
|
class ProtocolList;
|
|
|
|
class ProtocolListIterator;
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
|
|
|
|
class StreamBase
|
|
|
|
{
|
2009-08-02 09:52:34 -05:00
|
|
|
private:
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
OstProto::StreamId *mStreamId;
|
|
|
|
OstProto::StreamCore *mCore;
|
|
|
|
OstProto::StreamControl *mControl;
|
|
|
|
|
2009-08-02 09:52:34 -05:00
|
|
|
ProtocolList *currentFrameProtocols;
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
StreamBase();
|
|
|
|
~StreamBase();
|
|
|
|
|
|
|
|
void protoDataCopyFrom(const OstProto::Stream &stream);
|
|
|
|
void protoDataCopyInto(OstProto::Stream &stream) const;
|
|
|
|
|
2009-11-13 10:00:57 -06:00
|
|
|
ProtocolListIterator* createProtocolListIterator() const;
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
|
2009-11-03 08:02:09 -06:00
|
|
|
//! \todo (LOW) should we have a copy constructor??
|
2009-08-02 09:52:34 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
enum FrameLengthMode {
|
|
|
|
e_fl_fixed,
|
|
|
|
e_fl_inc,
|
|
|
|
e_fl_dec,
|
|
|
|
e_fl_random
|
|
|
|
};
|
|
|
|
|
|
|
|
enum SendUnit {
|
|
|
|
e_su_packets,
|
|
|
|
e_su_bursts
|
|
|
|
};
|
|
|
|
|
|
|
|
enum SendMode {
|
|
|
|
e_sm_fixed,
|
|
|
|
e_sm_continuous
|
|
|
|
};
|
|
|
|
|
|
|
|
enum NextWhat {
|
|
|
|
e_nw_stop,
|
|
|
|
e_nw_goto_next,
|
|
|
|
e_nw_goto_id
|
|
|
|
};
|
|
|
|
|
|
|
|
bool operator < (const StreamBase &s) const;
|
|
|
|
|
|
|
|
quint32 id();
|
|
|
|
bool setId(quint32 id);
|
|
|
|
|
|
|
|
#if 0 // FIXME(HI): needed?
|
|
|
|
quint32 portId()
|
|
|
|
{ return mCore->port_id();}
|
|
|
|
bool setPortId(quint32 id)
|
|
|
|
{ mCore->set_port_id(id); return true;}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
quint32 ordinal();
|
|
|
|
bool setOrdinal(quint32 ordinal);
|
|
|
|
|
|
|
|
bool isEnabled() const;
|
|
|
|
bool setEnabled(bool flag);
|
|
|
|
|
|
|
|
const QString name() const ;
|
|
|
|
bool setName(QString name) ;
|
|
|
|
|
|
|
|
// Frame Length (includes FCS);
|
2009-11-13 10:00:57 -06:00
|
|
|
FrameLengthMode lenMode() const;
|
2009-08-02 09:52:34 -05:00
|
|
|
bool setLenMode(FrameLengthMode lenMode);
|
|
|
|
|
2009-11-13 10:00:57 -06:00
|
|
|
quint16 frameLen(int streamIndex = 0) const;
|
2009-08-02 09:52:34 -05:00
|
|
|
bool setFrameLen(quint16 frameLen);
|
|
|
|
|
2009-11-13 10:00:57 -06:00
|
|
|
quint16 frameLenMin() const;
|
2009-08-02 09:52:34 -05:00
|
|
|
bool setFrameLenMin(quint16 frameLenMin);
|
|
|
|
|
2009-11-13 10:00:57 -06:00
|
|
|
quint16 frameLenMax() const;
|
2009-08-02 09:52:34 -05:00
|
|
|
bool setFrameLenMax(quint16 frameLenMax);
|
|
|
|
|
2009-11-13 10:00:57 -06:00
|
|
|
SendUnit sendUnit() const;
|
2009-08-02 09:52:34 -05:00
|
|
|
bool setSendUnit(SendUnit sendUnit);
|
|
|
|
|
2009-11-13 10:00:57 -06:00
|
|
|
SendMode sendMode() const;
|
2009-08-02 09:52:34 -05:00
|
|
|
bool setSendMode(SendMode sendMode);
|
|
|
|
|
2009-11-13 10:00:57 -06:00
|
|
|
NextWhat nextWhat() const;
|
2009-08-02 09:52:34 -05:00
|
|
|
bool setNextWhat(NextWhat nextWhat);
|
|
|
|
|
2009-11-13 10:00:57 -06:00
|
|
|
quint32 numPackets() const;
|
2009-08-02 09:52:34 -05:00
|
|
|
bool setNumPackets(quint32 numPackets);
|
|
|
|
|
2009-11-13 10:00:57 -06:00
|
|
|
quint32 numBursts() const;
|
2009-08-02 09:52:34 -05:00
|
|
|
bool setNumBursts(quint32 numBursts);
|
|
|
|
|
2009-11-13 10:00:57 -06:00
|
|
|
quint32 burstSize() const;
|
2009-08-02 09:52:34 -05:00
|
|
|
bool setBurstSize(quint32 packetsPerBurst);
|
|
|
|
|
2009-11-13 10:00:57 -06:00
|
|
|
quint32 packetRate() const;
|
2009-08-02 09:52:34 -05:00
|
|
|
bool setPacketRate(quint32 packetsPerSec);
|
|
|
|
|
2009-11-13 10:00:57 -06:00
|
|
|
quint32 burstRate() const;
|
2009-08-02 09:52:34 -05:00
|
|
|
bool setBurstRate(quint32 burstsPerSec);
|
2009-11-13 10:00:57 -06:00
|
|
|
|
|
|
|
bool isFrameVariable() const;
|
|
|
|
int frameValue(uchar *buf, int bufMaxSize, int n) const;
|
Protocol Framework basic code in place now. Cleanup pending.
- New Classes:
o ProtocolManager - singleton with which all protocols register
o ProtocolCollection - Aggregates all registered protocols; exports methods to work on all protocols
o StreamBase - aggregates ProtocolCollection with Stream Core and Control; the client/server side stream classes now derive from StreamBase leading to major reduction in their code (more cleanup pending)
- AbstractProtocol now supports the additional methods
o createInstance()
o protocolFrameSize()
o protocolFrameOffset(), protocolFramePayloadSize()
o protocolId(), payloadProtocolId()
o protocolFrameCksum(), protocolFramePayloadCksum()
0 constructor takes an extra param - frameProtoList
- Specific protocols - eth2, llc, snap, ip4, udp, tcp now return length, protocol id and cksums correctly (tcp/udp cksum pending)
- StreamConfigDialog - protocol controls for length, cksum and protocolid are automatically updated (not fully working yet)
2009-05-10 01:27:17 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|