diff options
author | Jon Skeet <skeet@pobox.com> | 2008-08-14 20:35:21 +0100 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2008-08-14 20:35:21 +0100 |
commit | 575083ae9c3ecb17e14ae29aa20b784940fcdfd1 (patch) | |
tree | a8b536c9b8e2982e9e904e25b8489404cd727155 /csharp/ProtocolBuffers | |
parent | 1353315dede3e22266df73fca8dd421119597e46 (diff) | |
download | protobuf-575083ae9c3ecb17e14ae29aa20b784940fcdfd1.tar.gz protobuf-575083ae9c3ecb17e14ae29aa20b784940fcdfd1.tar.bz2 protobuf-575083ae9c3ecb17e14ae29aa20b784940fcdfd1.zip |
Initial support for services and extensions. Incomplete, but enough to get generated unit test files to compile.
Diffstat (limited to 'csharp/ProtocolBuffers')
-rw-r--r-- | csharp/ProtocolBuffers/CodedInputStream.cs | 8 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/CodedOutputStream.cs | 15 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs | 337 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/Descriptors/EnumDescriptorIndexAttribute.cs | 3 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/DynamicMessage.cs | 11 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/ExtendableMessage.cs | 165 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/FieldSet.cs | 11 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/GeneratedBuilder.cs | 17 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/GeneratedExtension.cs | 70 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/GeneratedMessage.cs | 13 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/IRpcChannel.cs | 14 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/IRpcController.cs | 8 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/IService.cs | 9 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/ProtocolBuffers.csproj | 6 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/RpcUtil.cs | 35 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/TextFormat.cs | 18 | ||||
-rw-r--r-- | csharp/ProtocolBuffers/UnknownField.cs | 4 |
17 files changed, 529 insertions, 215 deletions
diff --git a/csharp/ProtocolBuffers/CodedInputStream.cs b/csharp/ProtocolBuffers/CodedInputStream.cs index ff5d6f88..418f5809 100644 --- a/csharp/ProtocolBuffers/CodedInputStream.cs +++ b/csharp/ProtocolBuffers/CodedInputStream.cs @@ -142,6 +142,7 @@ namespace Google.ProtocolBuffers { /// Read a double field from the stream. /// </summary> public double ReadDouble() { + // TODO(jonskeet): Test this on different endiannesses return BitConverter.Int64BitsToDouble((long) ReadRawLittleEndian64()); } @@ -149,9 +150,10 @@ namespace Google.ProtocolBuffers { /// Read a float field from the stream. /// </summary> public float ReadFloat() { - //return Float.intBitsToFloat(readRawLittleEndian32()); - // FIXME implement! - throw new NotImplementedException(); + // TODO(jonskeet): Test this on different endiannesses + uint raw = ReadRawLittleEndian32(); + byte[] rawBytes = BitConverter.GetBytes(raw); + return BitConverter.ToSingle(rawBytes, 0); } /// <summary> diff --git a/csharp/ProtocolBuffers/CodedOutputStream.cs b/csharp/ProtocolBuffers/CodedOutputStream.cs index 260db868..fff30d3f 100644 --- a/csharp/ProtocolBuffers/CodedOutputStream.cs +++ b/csharp/ProtocolBuffers/CodedOutputStream.cs @@ -98,6 +98,7 @@ namespace Google.ProtocolBuffers { /// Writes a double field value, including tag, to the stream. /// </summary> public void WriteDouble(int fieldNumber, double value) { + // TODO(jonskeet): Test this on different endiannesses WriteTag(fieldNumber, WireFormat.WireType.Fixed64); WriteRawLittleEndian64((ulong)BitConverter.DoubleToInt64Bits(value)); } @@ -107,8 +108,10 @@ namespace Google.ProtocolBuffers { /// </summary> public void WriteFloat(int fieldNumber, float value) { WriteTag(fieldNumber, WireFormat.WireType.Fixed32); - // FIXME: How do we convert a single to 32 bits? (Without unsafe code) - //WriteRawLittleEndian32(BitConverter.SingleT(value)); + // TODO(jonskeet): Test this on different endiannesses + byte[] rawBytes = BitConverter.GetBytes(value); + uint asInteger = BitConverter.ToUInt32(rawBytes, 0); + WriteRawLittleEndian32(asInteger); } /// <summary> @@ -434,7 +437,7 @@ namespace Google.ProtocolBuffers { /// Compute the number of bytes that would be needed to encode a /// fixed64 field, including the tag. /// </summary> - public static int ComputeFixed64Size(int fieldNumber, long value) { + public static int ComputeFixed64Size(int fieldNumber, ulong value) { return ComputeTagSize(fieldNumber) + LittleEndian64Size; } @@ -442,7 +445,7 @@ namespace Google.ProtocolBuffers { /// Compute the number of bytes that would be needed to encode a /// fixed32 field, including the tag. /// </summary> - public static int ComputeFixed32Size(int fieldNumber, int value) { + public static int ComputeFixed32Size(int fieldNumber, uint value) { return ComputeTagSize(fieldNumber) + LittleEndian32Size; } @@ -625,8 +628,8 @@ namespace Google.ProtocolBuffers { case FieldType.Int64: return ComputeInt64Size(fieldNumber, (long)value); case FieldType.UInt64: return ComputeUInt64Size(fieldNumber, (ulong)value); case FieldType.Int32: return ComputeInt32Size(fieldNumber, (int)value); - case FieldType.Fixed64: return ComputeFixed64Size(fieldNumber, (long)value); - case FieldType.Fixed32: return ComputeFixed32Size(fieldNumber, (int)value); + case FieldType.Fixed64: return ComputeFixed64Size(fieldNumber, (ulong)value); + case FieldType.Fixed32: return ComputeFixed32Size(fieldNumber, (uint)value); case FieldType.Bool: return ComputeBoolSize(fieldNumber, (bool)value); case FieldType.String: return ComputeStringSize(fieldNumber, (string)value); case FieldType.Group: return ComputeGroupSize(fieldNumber, (IMessage)value); diff --git a/csharp/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/csharp/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs index 4b92791a..ed159229 100644 --- a/csharp/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs +++ b/csharp/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs @@ -16,152 +16,152 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } private static readonly pbd::FileDescriptor descriptor = pbd::FileDescriptor.InternalBuildGeneratedFileFrom ( new byte[] { - 0x0a, 0x24, 0x73, 0x72, 0x63, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0xdc, 0x02, 0x0a, 0x13, - 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x0f, 0x0a, 0x07, 0x70, 0x61, 0x63, - 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x12, 0x12, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, - 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x12, 0x36, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x37, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x27, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x38, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa9, 0x03, 0x0a, 0x0f, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x12, 0x34, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x38, 0x0a, 0x09, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x35, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, - 0x65, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x37, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x48, 0x0a, 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, - 0x6e, 0x67, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x30, - 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x2c, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x0d, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x12, 0x0b, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x22, 0x94, 0x05, 0x0a, 0x14, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x0e, 0x0a, 0x06, 0x6e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x12, 0x3a, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x38, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x11, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x12, 0x10, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x12, 0x15, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x12, 0x2e, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xb6, 0x02, 0x0a, 0x04, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x10, - 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, - 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, - 0x4e, 0x54, 0x33, 0x32, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, - 0x36, 0x34, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, - 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x08, 0x12, 0x0f, 0x0a, - 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x0a, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, - 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, - 0x45, 0x53, 0x10, 0x0c, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, - 0x0d, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x0e, 0x12, 0x11, 0x0a, 0x0d, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x14, 0x12, 0x11, 0x0a, 0x0d, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x10, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x11, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x12, 0x22, 0x43, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, - 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x12, 0x0a, - 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, - 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x50, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x8c, 0x01, - 0x0a, 0x13, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x38, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x22, 0x6c, 0x0a, 0x18, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x12, 0x0e, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x12, 0x32, - 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x90, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x36, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x30, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x7f, 0x0a, - 0x15, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x12, 0x0a, 0x0a, - 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x12, 0x13, 0x0a, 0x0b, - 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x12, 0x2f, 0x0a, - 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x88, 0x03, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x12, 0x1c, 0x0a, 0x14, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, - 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x12, 0x22, 0x0a, 0x13, 0x6a, 0x61, - 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0c, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, - 0x7a, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x0a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0xdc, 0x02, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x0f, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x12, 0x12, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x12, 0x36, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x37, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x38, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x38, 0x0a, + 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2d, 0x0a, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x3a, 0x09, 0x43, 0x4f, 0x44, - 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x12, 0x19, 0x0a, 0x10, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x09, 0x12, 0x1e, 0x0a, 0x15, 0x63, 0x73, 0x68, - 0x61, 0x72, 0x70, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0xe9, - 0x07, 0x20, 0x01, 0x28, 0x09, 0x12, 0x25, 0x0a, 0x15, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6d, 0x75, 0x6c, 0x74, - 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0xea, 0x07, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, - 0x61, 0x6c, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x13, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x5f, - 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x18, 0xeb, 0x07, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, - 0x65, 0x12, 0x24, 0x0a, 0x15, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x63, - 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x18, 0xec, 0x07, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x04, 0x74, 0x72, 0x75, 0x65, 0x22, - 0x28, 0x0a, 0x0c, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x53, - 0x50, 0x45, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x10, - 0x02, 0x22, 0x38, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x26, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, - 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x22, - 0x85, 0x01, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, 0x0a, 0x05, - 0x63, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x14, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, - 0x6e, 0x74, 0x61, 0x6c, 0x5f, 0x6d, 0x61, 0x70, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x22, 0x23, - 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x44, 0x10, 0x01, 0x12, 0x10, 0x0a, - 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, 0x43, 0x45, 0x10, 0x02, 0x22, 0x0d, 0x0a, 0x0b, 0x45, - 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x12, 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x72, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x48, 0x01, 0xc2, 0x3e, 0x27, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0xca, 0x3e, 0x13, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x69, 0x6c, 0x65, 0xd0, 0x3e, 0x00, 0xd8, 0x3e, 0x00, 0xe0, 0x3e, - 0x01, + 0x6e, 0x73, 0x22, 0xa9, 0x03, 0x0a, 0x0f, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x34, 0x0a, 0x05, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x38, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x35, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x37, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x48, 0x0a, 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, + 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x2c, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x12, 0x0d, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x12, 0x0b, 0x0a, + 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x22, 0x94, 0x05, 0x0a, 0x14, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x0e, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x05, 0x12, 0x3a, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x38, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x11, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x12, 0x10, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x12, 0x15, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x12, 0x2e, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xb6, 0x02, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, + 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, + 0x4e, 0x54, 0x36, 0x34, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x33, 0x32, + 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x06, + 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x07, 0x12, 0x0d, + 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, + 0x52, 0x4f, 0x55, 0x50, 0x10, 0x0a, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, + 0x47, 0x45, 0x10, 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, 0x0c, + 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x0d, 0x12, 0x0d, 0x0a, + 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x0e, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x0f, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x10, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, + 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x11, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, + 0x36, 0x34, 0x10, 0x12, 0x22, 0x43, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, + 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, + 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, + 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x50, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x8c, 0x01, 0x0a, 0x13, 0x45, 0x6e, + 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x38, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x6c, 0x0a, 0x18, + 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x0e, + 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x12, 0x32, 0x0a, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x90, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x36, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x30, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x7f, 0x0a, 0x15, 0x4d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x12, 0x12, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, + 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x12, 0x13, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, + 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x12, 0x2f, 0x0a, 0x07, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x22, 0x88, 0x03, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, + 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x12, 0x1c, 0x0a, 0x14, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x12, 0x22, 0x0a, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, + 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, + 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0c, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x66, + 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, + 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x3a, 0x09, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, + 0x5a, 0x45, 0x12, 0x19, 0x0a, 0x10, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x09, 0x12, 0x1e, 0x0a, 0x15, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, + 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0xe9, 0x07, 0x20, 0x01, 0x28, + 0x09, 0x12, 0x25, 0x0a, 0x15, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, + 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0xea, 0x07, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, + 0x12, 0x23, 0x0a, 0x13, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x65, 0x73, 0x18, 0xeb, 0x07, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x12, 0x24, 0x0a, + 0x15, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, + 0x65, 0x73, 0x18, 0xec, 0x07, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x04, 0x74, 0x72, 0x75, 0x65, 0x22, 0x28, 0x0a, 0x0c, 0x4f, + 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, + 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x10, 0x02, 0x22, 0x38, 0x0a, + 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x17, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, + 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x0c, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, 0x0a, 0x05, 0x63, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x14, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, + 0x5f, 0x6d, 0x61, 0x70, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x22, 0x23, 0x0a, 0x05, 0x43, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x44, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, + 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, 0x43, 0x45, 0x10, 0x02, 0x22, 0x0d, 0x0a, 0x0b, 0x45, 0x6e, 0x75, 0x6d, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x12, 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x42, 0x72, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x48, 0x01, 0xc2, 0x3e, 0x27, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0xca, 0x3e, 0x13, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x69, 0x6c, 0x65, 0xd0, 0x3e, 0x00, 0xd8, 0x3e, 0x00, 0xe0, 0x3e, 0x01, }, new pbd::FileDescriptor[] { }); #endregion #region Extensions + /**/ #endregion #region Static variables @@ -295,7 +295,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorProto__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable; } } @@ -973,7 +973,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto__FieldAccessorTable; } } @@ -996,7 +996,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto_ExtensionRange__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable; } } @@ -1872,57 +1872,36 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_FieldDescriptorProto__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_FieldDescriptorProto__FieldAccessorTable; } } #region Nested types public static class Types { public enum Type { - [pbd::EnumDescriptorIndex(0)] TYPE_DOUBLE = 1, - [pbd::EnumDescriptorIndex(1)] TYPE_FLOAT = 2, - [pbd::EnumDescriptorIndex(2)] TYPE_INT64 = 3, - [pbd::EnumDescriptorIndex(3)] TYPE_UINT64 = 4, - [pbd::EnumDescriptorIndex(4)] TYPE_INT32 = 5, - [pbd::EnumDescriptorIndex(5)] TYPE_FIXED64 = 6, - [pbd::EnumDescriptorIndex(6)] TYPE_FIXED32 = 7, - [pbd::EnumDescriptorIndex(7)] TYPE_BOOL = 8, - [pbd::EnumDescriptorIndex(8)] TYPE_STRING = 9, - [pbd::EnumDescriptorIndex(9)] TYPE_GROUP = 10, - [pbd::EnumDescriptorIndex(10)] TYPE_MESSAGE = 11, - [pbd::EnumDescriptorIndex(11)] TYPE_BYTES = 12, - [pbd::EnumDescriptorIndex(12)] TYPE_UINT32 = 13, - [pbd::EnumDescriptorIndex(13)] TYPE_ENUM = 14, - [pbd::EnumDescriptorIndex(14)] - TYPE_SFIXED32 = 20, - [pbd::EnumDescriptorIndex(15)] + TYPE_SFIXED32 = 15, TYPE_SFIXED64 = 16, - [pbd::EnumDescriptorIndex(16)] TYPE_SINT32 = 17, - [pbd::EnumDescriptorIndex(17)] TYPE_SINT64 = 18, } public enum Label { - [pbd::EnumDescriptorIndex(0)] LABEL_OPTIONAL = 1, - [pbd::EnumDescriptorIndex(1)] LABEL_REQUIRED = 2, - [pbd::EnumDescriptorIndex(2)] LABEL_REPEATED = 3, } @@ -2450,7 +2429,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_EnumDescriptorProto__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable; } } @@ -2792,7 +2771,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_EnumValueDescriptorProto__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable; } } @@ -3099,7 +3078,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_ServiceDescriptorProto__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable; } } @@ -3441,7 +3420,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_MethodDescriptorProto__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable; } } @@ -3790,16 +3769,14 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_FileOptions__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_FileOptions__FieldAccessorTable; } } #region Nested types public static class Types { public enum OptimizeMode { - [pbd::EnumDescriptorIndex(0)] SPEED = 1, - [pbd::EnumDescriptorIndex(1)] CODE_SIZE = 2, } @@ -4344,7 +4321,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_MessageOptions__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_MessageOptions__FieldAccessorTable; } } @@ -4546,16 +4523,14 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_FieldOptions__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_FieldOptions__FieldAccessorTable; } } #region Nested types public static class Types { public enum CType { - [pbd::EnumDescriptorIndex(0)] CORD = 1, - [pbd::EnumDescriptorIndex(1)] STRING_PIECE = 2, } @@ -4806,7 +4781,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_EnumOptions__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_EnumOptions__FieldAccessorTable; } } @@ -4966,7 +4941,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_EnumValueOptions__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable; } } @@ -5126,7 +5101,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_ServiceOptions__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_ServiceOptions__FieldAccessorTable; } } @@ -5286,7 +5261,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return self::DescriptorProtoFile.internal__static_google_protobuf_MethodOptions__Descriptor; } } - protected internal override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return self::DescriptorProtoFile.internal__static_google_protobuf_MethodOptions__FieldAccessorTable; } } diff --git a/csharp/ProtocolBuffers/Descriptors/EnumDescriptorIndexAttribute.cs b/csharp/ProtocolBuffers/Descriptors/EnumDescriptorIndexAttribute.cs index e751b1fd..c8d23858 100644 --- a/csharp/ProtocolBuffers/Descriptors/EnumDescriptorIndexAttribute.cs +++ b/csharp/ProtocolBuffers/Descriptors/EnumDescriptorIndexAttribute.cs @@ -3,9 +3,10 @@ namespace Google.ProtocolBuffers.Descriptors { /// <summary> /// Allows enum values to express the index within their descriptor. + /// TODO(jonskeet): Consider removing this. I don't think we need it after all. /// </summary> [AttributeUsage(AttributeTargets.Field)] - internal class EnumDescriptorIndexAttribute : Attribute { + public class EnumDescriptorIndexAttribute : Attribute { readonly int index; internal int Index { diff --git a/csharp/ProtocolBuffers/DynamicMessage.cs b/csharp/ProtocolBuffers/DynamicMessage.cs new file mode 100644 index 00000000..8a18375c --- /dev/null +++ b/csharp/ProtocolBuffers/DynamicMessage.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Google.ProtocolBuffers { + public class DynamicMessage { + internal static object GetDefaultInstance(Google.ProtocolBuffers.Descriptors.MessageDescriptor messageDescriptor) { + throw new NotImplementedException(); + } + } +} diff --git a/csharp/ProtocolBuffers/ExtendableMessage.cs b/csharp/ProtocolBuffers/ExtendableMessage.cs new file mode 100644 index 00000000..cf43b03b --- /dev/null +++ b/csharp/ProtocolBuffers/ExtendableMessage.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.Collections; + +namespace Google.ProtocolBuffers { + public abstract class ExtendableMessage<TMessage,TBuilder> : GeneratedMessage<TMessage,TBuilder> + where TMessage : GeneratedMessage<TMessage, TBuilder> + where TBuilder : IBuilder<TMessage> { + + protected ExtendableMessage() {} + private readonly FieldSet extensions = FieldSet.CreateFieldSet(); + + /// <summary> + /// Checks if a singular extension is present. + /// </summary> + public bool HasExtension(GeneratedExtension<TMessage, TBuilder> extension) { + return extensions.HasField(extension.Descriptor); + } + + /// <summary> + /// Returns the number of elements in a repeated extension. + /// </summary> + public int GetExtensionCount<TExtension>(GeneratedExtension<TMessage, IList<TExtension>> extension) { + return extensions.GetRepeatedFieldCount(extension.Descriptor); + } + + /// <summary> + /// Returns the value of an extension. + /// </summary> + public TExtension GetExtension<TExtension>(GeneratedExtension<TMessage, TExtension> extension) { + object value = extensions[extension.Descriptor]; + if (value == null) { + return (TExtension) extension.MessageDefaultInstance; + } else { + return (TExtension) extension.FromReflectionType(value); + } + } + + /// <summary> + /// Returns one element of a repeated extension. + /// </summary> + public TExtension GetExtension<TExtension>(GeneratedExtension<TMessage, IList<TExtension>> extension, int index) { + return (TExtension) extension.SingularFromReflectionType(extensions[extension.Descriptor, index]); + } + + /// <summary> + /// Called by subclasses to check if all extensions are initialized. + /// </summary> + protected bool ExtensionsAreInitialized { + get { return extensions.IsInitialized; } + } + + #region Reflection + public override IDictionary<FieldDescriptor, object> AllFields { + get { + IDictionary<FieldDescriptor, object> result = GetMutableFieldMap(); + foreach(KeyValuePair<FieldDescriptor, object> entry in extensions.AllFields) { + result[entry.Key] = entry.Value; + } + return Dictionaries.AsReadOnly(result); + } + } + + public override bool HasField(FieldDescriptor field) { + if (field.IsExtension) { + VerifyContainingType(field); + return extensions.HasField(field); + } else { + return base.HasField(field); + } + } + + public override object this[FieldDescriptor field] { + get { + if (field.IsExtension) { + VerifyContainingType(field); + object value = extensions[field]; + if (value == null) { + // Lacking an ExtensionRegistry, we have no way to determine the + // extension's real type, so we return a DynamicMessage. + // TODO(jonskeet): Work out what this means + return DynamicMessage.GetDefaultInstance(field.MessageType); + } else { + return value; + } + } else { + return base[field]; + } + } + } + + public override int GetRepeatedFieldCount(FieldDescriptor field) { + if (field.IsExtension) { + VerifyContainingType(field); + return extensions.GetRepeatedFieldCount(field); + } else { + return base.GetRepeatedFieldCount(field); + } + } + + public override object this[FieldDescriptor field, int index] { + get { + if (field.IsExtension) { + VerifyContainingType(field); + return extensions[field, index]; + } else { + return base[field, index]; + } + } + } + + private void VerifyContainingType(FieldDescriptor field) { + if (field.ContainingType != DescriptorForType) { + throw new ArgumentException("FieldDescriptor does not match message type."); + } + } + #endregion + + /// <summary> + /// Used by subclasses to serialize extensions. Extension ranges may be + /// interleaves with field numbers, but we must write them in canonical + /// (sorted by field number) order. This class helps us to write individual + /// ranges of extensions at once. + /// + /// TODO(jonskeet): See if we can improve this in terms of readability. + /// </summary> + protected class ExtensionWriter { + readonly IEnumerator<KeyValuePair<FieldDescriptor, object>> iterator; + readonly FieldSet extensions; + KeyValuePair<FieldDescriptor, object>? next = null; + + internal ExtensionWriter(ExtendableMessage<TMessage, TBuilder> message) { + extensions = message.extensions; + iterator = message.extensions.GetEnumerator(); + if (iterator.MoveNext()) { + next = iterator.Current; + } + } + + public void WriteUntil(int end, CodedOutputStream output) { + while (next != null && next.Value.Key.FieldNumber < end) { + extensions.WriteField(next.Value.Key, next.Value.Value, output); + if (iterator.MoveNext()) { + next = iterator.Current; + } else { + next = null; + } + } + } + } + + protected ExtensionWriter CreateExtensionWriter(ExtendableMessage<TMessage, TBuilder> message) { + return new ExtensionWriter(message); + } + + /// <summary> + /// Called by subclasses to compute the size of extensions. + /// </summary> + protected int ExtensionsSerializedSize { + get { return extensions.SerializedSize; } + } + } +} diff --git a/csharp/ProtocolBuffers/FieldSet.cs b/csharp/ProtocolBuffers/FieldSet.cs index 10330762..e42b4a01 100644 --- a/csharp/ProtocolBuffers/FieldSet.cs +++ b/csharp/ProtocolBuffers/FieldSet.cs @@ -30,6 +30,10 @@ namespace Google.ProtocolBuffers { this.fields = fields; } + public static FieldSet CreateFieldSet() { + return new FieldSet(new Dictionary<FieldDescriptor, object>()); + } + /// <summary> /// Makes this FieldSet immutable, and returns it for convenience. Any /// mutable repeated fields are made immutable, as well as the map itself. @@ -396,6 +400,13 @@ namespace Google.ProtocolBuffers { } /// <summary> + /// Returns an enumerator for the field map. Used to write the fields out. + /// </summary> + internal IEnumerator<KeyValuePair<FieldDescriptor, object>> GetEnumerator() { + return fields.GetEnumerator(); + } + + /// <summary> /// See <see cref="IMessage.IsInitialized" /> /// </summary> /// <remarks> diff --git a/csharp/ProtocolBuffers/GeneratedBuilder.cs b/csharp/ProtocolBuffers/GeneratedBuilder.cs index 821dc7e7..acafe486 100644 --- a/csharp/ProtocolBuffers/GeneratedBuilder.cs +++ b/csharp/ProtocolBuffers/GeneratedBuilder.cs @@ -23,7 +23,7 @@ namespace Google.ProtocolBuffers { protected abstract TMessage MessageBeingBuilt { get; } protected internal FieldAccessorTable InternalFieldAccessors { - get { return MessageBeingBuilt.InternalFieldAccessors; } + get { return MessageBeingBuilt.FieldAccesseorsFromBuilder; } } public override bool Initialized { @@ -190,6 +190,16 @@ namespace Google.ProtocolBuffers { return this; } + public virtual IBuilder<TMessage> MergeFrom(CodedInputStream input) { + ((IBuilder)this).MergeFrom(input); + return this; + } + + public virtual IBuilder<TMessage> MergeFrom(CodedInputStream input, ExtensionRegistry extensionRegistry) { + ((IBuilder)this).MergeFrom(input, extensionRegistry); + return this; + } + /// <summary> /// Like Build(), but will wrap UninitializedMessageException in /// InvalidProtocolBufferException. @@ -217,7 +227,8 @@ namespace Google.ProtocolBuffers { public abstract IBuilder<TMessage> Clone(); public abstract new IBuilder<TMessage> Clear(); public abstract TMessage DefaultInstanceForType { get; } - public abstract IBuilder<TMessage> MergeFrom(CodedInputStream input); - public abstract IBuilder<TMessage> MergeFrom(CodedInputStream input, ExtensionRegistry extensionRegistry); + + public abstract class ExtendableBuilder : GeneratedBuilder<TMessage, TBuilder> { + } } } diff --git a/csharp/ProtocolBuffers/GeneratedExtension.cs b/csharp/ProtocolBuffers/GeneratedExtension.cs index d39d794e..667b4531 100644 --- a/csharp/ProtocolBuffers/GeneratedExtension.cs +++ b/csharp/ProtocolBuffers/GeneratedExtension.cs @@ -1,7 +1,29 @@ using Google.ProtocolBuffers.Descriptors; +using System; +using System.Collections.Generic; +using System.Reflection; namespace Google.ProtocolBuffers { + public static class GeneratedExtension { + + public static GeneratedExtension<TContainer, TExtension> CreateExtension<TContainer, TExtension>(FieldDescriptor descriptor) + where TContainer : IMessage<TContainer> { + if (descriptor.IsRepeated) { + throw new ArgumentException("Must call CreateRepeatedGeneratedExtension() for repeated types."); + } + return new GeneratedExtension<TContainer, TExtension>(descriptor); + } + + public static GeneratedExtension<TContainer, IList<TExtension>> CreateRepeatedExtension<TContainer, TExtension>(FieldDescriptor descriptor) + where TContainer : IMessage<TContainer> { + if (descriptor.IsRepeated) { + throw new ArgumentException("Must call CreateRepeatedGeneratedExtension() for repeated types."); + } + return new GeneratedExtension<TContainer, IList<TExtension>>(descriptor); + } + } + /// <summary> /// Base class for all generated extensions. /// </summary> @@ -24,8 +46,52 @@ namespace Google.ProtocolBuffers { /// in ExtendableMessage and ExtendableBuilder. /// </remarks> public class GeneratedExtension<TContainer, TExtension> where TContainer : IMessage<TContainer> { - public FieldDescriptor Descriptor; + private readonly IMessage messageDefaultInstance; + private readonly FieldDescriptor descriptor; + + internal GeneratedExtension(FieldDescriptor descriptor) { + if (!descriptor.IsExtension) { + throw new ArgumentException("GeneratedExtension given a regular (non-extension) field."); + } + + this.descriptor = descriptor; + + switch (descriptor.MappedType) { + case MappedType.Message: + PropertyInfo defaultInstanceProperty = typeof(TExtension) + .GetProperty("DefaultInstance", BindingFlags.Static | BindingFlags.Public); + if (defaultInstanceProperty == null) { + throw new ArgumentException("No public static DefaultInstance property for type " + typeof(TExtension).Name); + } + messageDefaultInstance = (IMessage) defaultInstanceProperty.GetValue(null, null); + break; + case MappedType.Enum: + // FIXME(jonskeet): May not need this + //enumValueOf = getMethodOrDie(type, "valueOf", + // EnumValueDescriptor.class); + //enumGetValueDescriptor = getMethodOrDie(type, "getValueDescriptor"); + messageDefaultInstance = null; + break; + default: + messageDefaultInstance = null; + break; + } + } + + public FieldDescriptor Descriptor { + get { return descriptor; } + } + + public IMessage MessageDefaultInstance { + get { return messageDefaultInstance; } + } + + internal object SingularFromReflectionType(object p) { + throw new System.NotImplementedException(); + } - public IMessage MessageDefaultInstance; + internal object FromReflectionType(object value) { + throw new System.NotImplementedException(); + } } } diff --git a/csharp/ProtocolBuffers/GeneratedMessage.cs b/csharp/ProtocolBuffers/GeneratedMessage.cs index f43e2e9d..2aa8e842 100644 --- a/csharp/ProtocolBuffers/GeneratedMessage.cs +++ b/csharp/ProtocolBuffers/GeneratedMessage.cs @@ -14,11 +14,16 @@ namespace Google.ProtocolBuffers { /// can ignore this class as an implementation detail. /// </summary> public abstract class GeneratedMessage<TMessage, TBuilder> : AbstractMessage, IMessage<TMessage> - where TMessage : GeneratedMessage<TMessage, TBuilder> where TBuilder : IBuilder<TMessage> { + where TMessage : GeneratedMessage<TMessage, TBuilder> + where TBuilder : IBuilder<TMessage> { private UnknownFieldSet unknownFields = UnknownFieldSet.DefaultInstance; - protected internal abstract FieldAccessorTable InternalFieldAccessors { get; } + internal FieldAccessorTable FieldAccesseorsFromBuilder { + get { return InternalFieldAccessors; } + } + + protected abstract FieldAccessorTable InternalFieldAccessors { get; } public override MessageDescriptor DescriptorForType { get { return InternalFieldAccessors.Descriptor; } @@ -36,7 +41,7 @@ namespace Google.ProtocolBuffers { public abstract IBuilder<TMessage> CreateBuilderForType(); - private IDictionary<FieldDescriptor, Object> GetMutableFieldMap() { + internal IDictionary<FieldDescriptor, Object> GetMutableFieldMap() { // Use a SortedList so we'll end up serializing fields in order var ret = new SortedList<FieldDescriptor, object>(); @@ -83,6 +88,6 @@ namespace Google.ProtocolBuffers { /// </summary> internal void SetUnknownFields(UnknownFieldSet fieldSet) { unknownFields = fieldSet; - } + } } } diff --git a/csharp/ProtocolBuffers/IRpcChannel.cs b/csharp/ProtocolBuffers/IRpcChannel.cs new file mode 100644 index 00000000..96c82e16 --- /dev/null +++ b/csharp/ProtocolBuffers/IRpcChannel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers { + /// <summary> + /// TODO(jonskeet): Do this properly. + /// </summary> + public interface IRpcChannel { + void CallMethod<T>(MethodDescriptor method, IRpcController controller, + IMessage request, IMessage responsePrototype, Action<T> done); + } +} diff --git a/csharp/ProtocolBuffers/IRpcController.cs b/csharp/ProtocolBuffers/IRpcController.cs new file mode 100644 index 00000000..81348fde --- /dev/null +++ b/csharp/ProtocolBuffers/IRpcController.cs @@ -0,0 +1,8 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Google.ProtocolBuffers { + public interface IRpcController { + } +} diff --git a/csharp/ProtocolBuffers/IService.cs b/csharp/ProtocolBuffers/IService.cs new file mode 100644 index 00000000..d53395aa --- /dev/null +++ b/csharp/ProtocolBuffers/IService.cs @@ -0,0 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Google.ProtocolBuffers { + public interface IService { + // TODO(jonskeet): Fill this in + } +} diff --git a/csharp/ProtocolBuffers/ProtocolBuffers.csproj b/csharp/ProtocolBuffers/ProtocolBuffers.csproj index bcfe9f2f..0cd9e88e 100644 --- a/csharp/ProtocolBuffers/ProtocolBuffers.csproj +++ b/csharp/ProtocolBuffers/ProtocolBuffers.csproj @@ -67,6 +67,8 @@ <Compile Include="Descriptors\MethodDescriptor.cs" /> <Compile Include="Descriptors\PackageDescriptor.cs" /> <Compile Include="Descriptors\ServiceDescriptor.cs" /> + <Compile Include="DynamicMessage.cs" /> + <Compile Include="ExtendableMessage.cs" /> <Compile Include="ExtensionInfo.cs" /> <Compile Include="ExtensionRegistry.cs" /> <Compile Include="FieldAccess\SingleEnumAccessor.cs" /> @@ -85,7 +87,11 @@ <Compile Include="IBuilder.cs" /> <Compile Include="IMessage.cs" /> <Compile Include="InvalidProtocolBufferException.cs" /> + <Compile Include="IRpcChannel.cs" /> + <Compile Include="IRpcController.cs" /> + <Compile Include="IService.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="RpcUtil.cs" /> <Compile Include="TextFormat.cs" /> <Compile Include="TextGenerator.cs" /> <Compile Include="UninitializedMessageException.cs" /> diff --git a/csharp/ProtocolBuffers/RpcUtil.cs b/csharp/ProtocolBuffers/RpcUtil.cs new file mode 100644 index 00000000..75e6f34b --- /dev/null +++ b/csharp/ProtocolBuffers/RpcUtil.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Google.ProtocolBuffers { + public static class RpcUtil { + + /// <summary> + /// Converts an Action[IMessage] to an Action[T]. + /// </summary> + public static Action<T> SpecializeCallback<T>(Action<IMessage> action) + where T : IMessage<T> { + return message => action(message); + } + + /// <summary> + /// Converts an Action[T] to an Action[IMessage]. + /// The generalized action will accept any message object which has + /// the same descriptor, and will convert it to the correct class + /// before calling the original action. However, if the generalized + /// callback is given a message with a different descriptor, an + /// exception will be thrown. + /// </summary> + public static Action<IMessage> GeneralizeCallback<T>(Action<T> action, T defaultInstance) + where T : class, IMessage<T> { + return message => { + T castMessage = message as T; + if (castMessage == null) { + castMessage = (T) defaultInstance.CreateBuilderForType().MergeFrom(message).Build(); + } + action(castMessage); + }; + } + } +} diff --git a/csharp/ProtocolBuffers/TextFormat.cs b/csharp/ProtocolBuffers/TextFormat.cs index efa1ba94..e395b5f9 100644 --- a/csharp/ProtocolBuffers/TextFormat.cs +++ b/csharp/ProtocolBuffers/TextFormat.cs @@ -155,25 +155,18 @@ namespace Google.ProtocolBuffers { UnknownField field = entry.Value; foreach (ulong value in field.VarintList) { - generator.Print(entry.Key.ToString()); - generator.Print(": "); + generator.Print(prefix); generator.Print(value.ToString()); generator.Print("\n"); } foreach (uint value in field.Fixed32List) { - generator.Print(entry.Key.ToString()); - generator.Print(": "); - // FIXME(jonskeet): Get format of this right; in Java it's %08x. Find out what this means - // Also check we're okay in terms of signed/unsigned. - generator.Print(string.Format("0x{0:x}", value)); + generator.Print(prefix); + generator.Print(string.Format("0x{0:x8}", value)); generator.Print("\n"); } foreach (ulong value in field.Fixed64List) { - generator.Print(entry.Key.ToString()); - generator.Print(": "); - // FIXME(jonskeet): Get format of this right; in Java it's %016x. Find out what this means - // Also check we're okay in terms of signed/unsigned. - generator.Print(string.Format("0x{0:x}", value)); + generator.Print(prefix); + generator.Print(string.Format("0x{0:x16}", value)); generator.Print("\n"); } foreach (ByteString value in field.LengthDelimitedList) { @@ -193,7 +186,6 @@ namespace Google.ProtocolBuffers { } } - internal static ulong ParseUInt64(string text) { return (ulong) ParseInteger(text, true, false); } diff --git a/csharp/ProtocolBuffers/UnknownField.cs b/csharp/ProtocolBuffers/UnknownField.cs index e1c12b72..b6a1d270 100644 --- a/csharp/ProtocolBuffers/UnknownField.cs +++ b/csharp/ProtocolBuffers/UnknownField.cs @@ -127,10 +127,10 @@ namespace Google.ProtocolBuffers { foreach (ulong value in varintList) { result += CodedOutputStream.ComputeUInt64Size(fieldNumber, value); } - foreach (int value in fixed32List) { + foreach (uint value in fixed32List) { result += CodedOutputStream.ComputeFixed32Size(fieldNumber, value); } - foreach (long value in fixed64List) { + foreach (ulong value in fixed64List) { result += CodedOutputStream.ComputeFixed64Size(fieldNumber, value); } foreach (ByteString value in lengthDelimitedList) { |