Table of Contents

Class ProtobufFeature

Namespace
IceRpc.Features
Assembly
IceRpc.Protobuf.dll

Default implementation of IProtobufFeature.

public sealed class ProtobufFeature : IProtobufFeature
Inheritance
ProtobufFeature
Implements
Inherited Members

Constructors

ProtobufFeature(int, ProtobufEncodeOptions?, IProtobufFeature?)

Constructs a Protobuf feature.

public ProtobufFeature(int maxMessageLength = -1, ProtobufEncodeOptions? encodeOptions = null, IProtobufFeature? defaultFeature = null)

Parameters

maxMessageLength int

The maximum message length. Use -1 to get the default value.

encodeOptions ProtobufEncodeOptions

The encode options.

defaultFeature IProtobufFeature

A feature that provides default values for all parameters. null is equivalent to Default.

Exceptions

ArgumentOutOfRangeException

Thrown when maxMessageLength is a negative value other than -1.

Properties

Default

Gets a IProtobufFeature with default values for all properties.

public static IProtobufFeature Default { get; }

Property Value

IProtobufFeature

EncodeOptions

Gets the options to use when encoding the payload of an outgoing response.

public ProtobufEncodeOptions? EncodeOptions { get; }

Property Value

ProtobufEncodeOptions

The Protobuf encode options. null is equivalent to Default.

MaxMessageLength

Gets the maximum length of an encoded Protobuf message, in bytes.

public int MaxMessageLength { get; }

Property Value

int

The maximum length of a Protobuf message, in bytes.

Remarks

This limit applies only when decoding the payload of an incoming request or response, whether this payload holds a single message or a stream of messages: the decoding throws InvalidDataException when the length encoded in the 5-byte prefix of a message exceeds this maximum, before parsing any byte of the message. It does not restrict the length of the messages encoded by the application. The message length does not include this prefix. Implementations must return a value greater than or equal to 0.