ostinato/common/protocol.proto
Srivats P. 1357f495ac Major rewrite of the protocol framework - changes not yet complete
Common
------
- Change in OstProto
	- Individual protocols are now extensions of (new) message 'Protocol' instead of 'Stream'
	- Stream now contains a repeated Protocol which also determines the ordered set of currently selected protocols; StreamCore.frame_proto which was doing this earlier has been removed

- Change in AbstractProtocol Interface
	- Parent changed to StreamBase
	- Corresponding change in constructor and factory func - createInstance()
	- new method protocolNumber() - returns unique id for each protocol
	- protoDataCopyInto/From() now copies into OstProto::Protocol instead of OstProto::Stream
- Change in all subclasses of AbstractProtocol to match new interface
- For all protocols, configFrom is no longer static, but each protocol has its own configForm
	- configForm creation is lazy
	- configForm is still a child of the protocol i.e. it will be destroyed alongwith the protocol
	- TODO: convert configWidget() to a pure factory function i.e. the protocol does not own the configForm - this requires us to pass the widget into load/storeConfigWidget() methods

- ProtocolCollection class removed alongwith its .h and .cpp
- ProtocolList class redefined to serve the purpose of ProtocolCollection
- New class ProtocolListIterator defined to iterate ProtocolList
- AbstractProtocol methods now use the ProtocolListIterator
- Factory function createProtocol() added to ProtocolManager
- OstProto::StreamCore accessor functions moved from Stream to StreamBase

Server
------
- MyService uses the newly moved accessors to StreamBase for OstProto::StreamCore members
- StreamInfo now uses the protocols to create the packet

Client
------
- StreamConfigDialog now uses ProtocolListIterator
- So does PacketModel
2009-08-02 14:52:34 +00:00

195 lines
4.1 KiB
Protocol Buffer

// stream.proto
// FIXME: Re-evaluate Tag Values
package OstProto;
message StreamId {
required uint32 id = 1;
}
message StreamCore {
enum FrameLengthMode {
e_fl_fixed = 0;
e_fl_inc = 1;
e_fl_dec = 2;
e_fl_random = 3;
}
// Basics
optional string name = 1;
optional bool is_enabled = 2;
optional uint32 ordinal = 3;
// Frame Length (includes CRC)
optional FrameLengthMode len_mode = 14 [default = e_fl_fixed];
optional uint32 frame_len = 15 [default = 64];
optional uint32 frame_len_min = 16 [default = 64];
optional uint32 frame_len_max = 17 [default = 1518];
// Currently Selected Protocols
//repeated uint32 frame_proto = 20;
}
message StreamControl {
enum SendUnit {
e_su_packets = 0;
e_su_bursts = 1;
}
enum SendMode {
e_sm_fixed = 0;
e_sm_continuous = 1;
}
enum NextWhat {
e_nw_stop = 0;
e_nw_goto_next = 1;
e_nw_goto_id = 2;
}
optional SendUnit unit = 1 [default = e_su_packets];
optional SendMode mode = 2 [default = e_sm_fixed];
optional uint32 num_packets = 3 [default = 1];
optional uint32 num_bursts = 4 [default = 1];
optional uint32 packets_per_burst = 5 [default = 10];
optional NextWhat next = 6 [default = e_nw_goto_next];
optional uint32 packets_per_sec = 7 [default = 1];
optional uint32 bursts_per_sec = 8 [default = 1];
// TODO: Gaps?
}
message ProtocolId {
required uint32 id = 1;
}
message Protocol {
required ProtocolId protocol_id = 1;
extensions 51 to 100; // Reserved for Ostinato Use
extensions 101 to 200; // Available for use by protocols
enum k {
kMacFieldNumber = 51;
kPayloadFieldNumber = 52;
kEth2FieldNumber = 121;
kDot3FieldNumber = 122;
kLlcFieldNumber = 123;
kSnapFieldNumber = 124;
kVlanFieldNumber = 126;
kIp4FieldNumber = 130;
kArpFieldNumber = 131;
kTcpFieldNumber = 140;
kUdpFieldNumber = 141;
kIcmpFieldNumber = 142;
kIgmpFieldNumber = 143;
}
}
message Stream {
required StreamId stream_id = 1;
optional StreamCore core = 2;
optional StreamControl control = 3;
repeated Protocol protocol = 4;
}
message Void {
// nothing!
}
message Ack {
// TODO
}
message PortId {
required uint32 id = 1;
}
message PortIdList {
repeated PortId port_id = 1;
}
message StreamIdList {
required PortId port_id = 1;
repeated StreamId stream_id = 2;
}
message Port {
required PortId port_id = 1;
optional string name = 2;
optional string description = 3;
optional bool is_enabled = 4;
optional bool is_oper_up = 5;
optional bool is_exclusive_control = 6;
}
message PortConfigList {
repeated Port port = 1;
}
message StreamConfigList {
required PortId port_id = 1;
repeated Stream stream = 2;
}
message CaptureBuffer {
// TODO
}
message CaptureBufferList {
repeated CaptureBuffer list = 1;
}
message PortStats {
required PortId port_id = 1;
optional uint64 rx_pkts = 11;
optional uint64 rx_bytes = 12;
optional uint64 rx_pkts_nic = 13;
optional uint64 rx_bytes_nic = 14;
optional uint64 rx_pps = 15;
optional uint64 rx_bps = 16;
optional uint64 tx_pkts = 21;
optional uint64 tx_bytes = 22;
optional uint64 tx_pkts_nic = 23;
optional uint64 tx_bytes_nic = 24;
optional uint64 tx_pps = 25;
optional uint64 tx_bps = 26;
}
message PortStatsList {
repeated PortStats port_stats = 1;
}
service OstService {
rpc getPortIdList(Void) returns (PortIdList);
rpc getPortConfig(PortIdList) returns (PortConfigList);
rpc getStreamIdList(PortId) returns (StreamIdList);
rpc getStreamConfig(StreamIdList) returns (StreamConfigList);
rpc addStream(StreamIdList) returns (Ack);
rpc deleteStream(StreamIdList) returns (Ack);
rpc modifyStream(StreamConfigList) returns (Ack);
rpc startTx(PortIdList) returns (Ack);
rpc stopTx(PortIdList) returns (Ack);
rpc startCapture(PortIdList) returns (Ack);
rpc stopCapture(PortIdList) returns (Ack);
rpc getCaptureBuffer(PortIdList) returns (CaptureBufferList);
rpc getStats(PortIdList) returns (PortStatsList);
rpc clearStats(PortIdList) returns (Ack);
}