Skip to content

ostinato.protocols.userscript_pb2 module

Configure user defined protocol in an Ostinato stream by accessing the UserScript object via the Protocol Extensions, allowing for defining content and metadata like header size and checksum of a user defined protocol

To add and configure UserScript in a stream, add a protocol to the stream, set the protocol id to ost_pb.Protocol.kUserScriptFieldNumber and access the UserScript object from the Protocol object's Extensions dictionary using the key userscript_pb2.userScript

from ostinato.protocols import userscript_pb2
...
# stream is an object of type ost_pb.Stream
proto = stream.protocol.add()
proto.protocol_id.id = ost_pb.Protocol.kUserScriptFieldNumber
my_userScript = proto.Extensions[userscript_pb2.userScript]
You can then set UserScript attributes using my_userScript.<attribute>

UserScript class

Class attributes

program

UserScript.program : str(unicode)
Optional. If not set, defaults to "".

Back to top