Skip to content

ostinato.protocols.textproto_pb2 module

Customize and configure any Text based protocol attributes for packet streams, including port number, encoding, text content, and end-of-line settings

To add and configure TextProtocol in a stream, add a protocol to the stream, set the protocol id to ost_pb.Protocol.kTextProtocolFieldNumber and access the TextProtocol object from the Protocol object's Extensions dictionary using the key textproto_pb2.textProtocol

from ostinato.protocols import textproto_pb2
...
# stream is an object of type ost_pb.Stream
proto = stream.protocol.add()
proto.protocol_id.id = ost_pb.Protocol.kTextProtocolFieldNumber
my_textProtocol = proto.Extensions[textproto_pb2.textProtocol]
You can then set TextProtocol attributes using my_textProtocol.<attribute>

TextProtocol class

Class constants

EndOfLine

TextProtocol.kCr 
TextProtocol.kLf 
TextProtocol.kCrLf 

TextEncoding

TextProtocol.kUtf8 

Class attributes

port_num

TextProtocol.port_num : long
Optional. If not set, defaults to 80.

encoding

TextProtocol.encoding : TextEncoding
Optional. If not set, defaults to kUtf8.

See TextEncoding

text

TextProtocol.text : str(unicode)
Optional. If not set, defaults to "".

eol

TextProtocol.eol : EndOfLine
Optional. If not set, defaults to kLf.

See EndOfLine

Back to top