Unverified Commit f5e8ee41 authored by Joshua Haberman's avatar Joshua Haberman Committed by GitHub

PHP updates for new upb APIs (#5604)

parent 37581380
...@@ -591,6 +591,7 @@ php_EXTRA_DIST= \ ...@@ -591,6 +591,7 @@ php_EXTRA_DIST= \
php/README.md \ php/README.md \
php/composer.json \ php/composer.json \
php/ext/google/protobuf/array.c \ php/ext/google/protobuf/array.c \
php/ext/google/protobuf/builtin_descriptors.inc \
php/ext/google/protobuf/config.m4 \ php/ext/google/protobuf/config.m4 \
php/ext/google/protobuf/def.c \ php/ext/google/protobuf/def.c \
php/ext/google/protobuf/encode_decode.c \ php/ext/google/protobuf/encode_decode.c \
......
unsigned char descriptor_proto[] = {
0x0a, 0x9b, 0x3b, 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, 0x4d, 0x0a, 0x11, 0x46, 0x69,
0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72,
0x53, 0x65, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x04, 0x66, 0x69, 0x6c,
0x65, 0x22, 0xe4, 0x04, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65,
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a,
0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12,
0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63,
0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x70,
0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x70,
0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64,
0x65, 0x6e, 0x63, 0x79, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x05, 0x52, 0x10,
0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64,
0x65, 0x6e, 0x63, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x65, 0x61, 0x6b,
0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18,
0x0b, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0e, 0x77, 0x65, 0x61, 0x6b, 0x44,
0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x43, 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, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 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, 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70,
0x65, 0x12, 0x41, 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, 0x52,
0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 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, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65,
0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36, 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, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x12, 0x49, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f,
0x63, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x09, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65,
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6e, 0x74,
0x61, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79,
0x6e, 0x74, 0x61, 0x78, 0x22, 0xb9, 0x06, 0x0a, 0x0f, 0x44, 0x65, 0x73,
0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3b, 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, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x43, 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, 0x52, 0x09, 0x65, 0x78, 0x74,
0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x41, 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, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x79, 0x70,
0x65, 0x12, 0x41, 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, 0x52, 0x08,
0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x58, 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, 0x52, 0x0e,
0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e,
0x67, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f,
0x64, 0x65, 0x63, 0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25,
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65,
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74,
0x6f, 0x52, 0x09, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x63, 0x6c,
0x12, 0x39, 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, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12,
0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f,
0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x2e, 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, 0x52, 0x65,
0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52,
0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e,
0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76,
0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28,
0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e,
0x61, 0x6d, 0x65, 0x1a, 0x7a, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e,
0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a,
0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65,
0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e,
0x64, 0x12, 0x40, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61,
0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07,
0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x37, 0x0a, 0x0d, 0x52,
0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65,
0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10,
0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x03, 0x65, 0x6e, 0x64, 0x22, 0x7c, 0x0a, 0x15, 0x45, 0x78, 0x74, 0x65,
0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74,
0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70,
0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a,
0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x98,
0x06, 0x0a, 0x14, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63,
0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e,
0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x41, 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, 0x52, 0x05, 0x6c, 0x61, 0x62,
0x65, 0x6c, 0x12, 0x3e, 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,
0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x79,
0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12,
0x1a, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e,
0x64, 0x65, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75,
0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56,
0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f,
0x66, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28,
0x05, 0x52, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, 0x64, 0x65,
0x78, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6a, 0x73,
0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 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, 0x52, 0x07, 0x6f, 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, 0x63, 0x0a, 0x14, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65,
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a,
0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65,
0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xe3, 0x02, 0x0a, 0x13, 0x45,
0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f,
0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x3f, 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,
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, 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, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x12, 0x5d, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72,
0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x36, 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, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65,
0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52,
0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e,
0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76,
0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28,
0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e,
0x61, 0x6d, 0x65, 0x1a, 0x3b, 0x0a, 0x11, 0x45, 0x6e, 0x75, 0x6d, 0x52,
0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65,
0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10,
0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x03, 0x65, 0x6e, 0x64, 0x22, 0x83, 0x01, 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, 0x12, 0x0a,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d,
0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e,
0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x3b, 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, 0x52, 0x07, 0x6f,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 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, 0x12, 0x0a,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, 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, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x39, 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, 0x52,
0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x89, 0x02, 0x0a,
0x15, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72,
0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12,
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e,
0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70,
0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f,
0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x38,
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, 0x52,
0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x0a, 0x10,
0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05,
0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e,
0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x30,
0x0a, 0x10, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72,
0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08,
0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x73, 0x65, 0x72,
0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67,
0x22, 0x92, 0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61,
0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0b, 0x6a, 0x61, 0x76, 0x61, 0x50, 0x61, 0x63, 0x6b,
0x61, 0x67, 0x65, 0x12, 0x30, 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, 0x52, 0x12, 0x6a,
0x61, 0x76, 0x61, 0x4f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73,
0x73, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 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, 0x52, 0x11, 0x6a, 0x61, 0x76, 0x61, 0x4d,
0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73,
0x12, 0x44, 0x0a, 0x1d, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e,
0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x73,
0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x14, 0x20,
0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x19, 0x6a, 0x61, 0x76,
0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, 0x71, 0x75,
0x61, 0x6c, 0x73, 0x41, 0x6e, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3a,
0x0a, 0x16, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e,
0x67, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x75, 0x74, 0x66, 0x38,
0x18, 0x1b, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73,
0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x53, 0x74, 0x72, 0x69, 0x6e,
0x67, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x74, 0x66, 0x38, 0x12, 0x53,
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, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x52, 0x0b,
0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x46, 0x6f, 0x72, 0x12,
0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x50,
0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x63, 0x63,
0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x3a,
0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x63, 0x63, 0x47, 0x65,
0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x73, 0x12, 0x39, 0x0a, 0x15, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65,
0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61,
0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e,
0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73,
0x12, 0x35, 0x0a, 0x13, 0x70, 0x79, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72,
0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18,
0x12, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65,
0x52, 0x11, 0x70, 0x79, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x14, 0x70,
0x68, 0x70, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x2a, 0x20, 0x01, 0x28,
0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x12, 0x70, 0x68,
0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72,
0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x17, 0x20, 0x01, 0x28, 0x08,
0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70,
0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2f, 0x0a, 0x10, 0x63,
0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65,
0x6e, 0x61, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66,
0x61, 0x6c, 0x73, 0x65, 0x52, 0x0e, 0x63, 0x63, 0x45, 0x6e, 0x61, 0x62,
0x6c, 0x65, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x12, 0x2a, 0x0a, 0x11,
0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70,
0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x24, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0f, 0x6f, 0x62, 0x6a, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, 0x72,
0x65, 0x66, 0x69, 0x78, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x73, 0x68, 0x61,
0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,
0x18, 0x25, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x73, 0x68, 0x61,
0x72, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12,
0x21, 0x0a, 0x0c, 0x73, 0x77, 0x69, 0x66, 0x74, 0x5f, 0x70, 0x72, 0x65,
0x66, 0x69, 0x78, 0x18, 0x27, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73,
0x77, 0x69, 0x66, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x28,
0x0a, 0x10, 0x70, 0x68, 0x70, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f,
0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0e, 0x70, 0x68, 0x70, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, 0x72,
0x65, 0x66, 0x69, 0x78, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x68, 0x70, 0x5f,
0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x29, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x68, 0x70, 0x4e, 0x61, 0x6d, 0x65,
0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x70, 0x68, 0x70,
0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6e, 0x61,
0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x2c, 0x20, 0x01, 0x28,
0x09, 0x52, 0x14, 0x70, 0x68, 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
0x74, 0x61, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12,
0x21, 0x0a, 0x0c, 0x72, 0x75, 0x62, 0x79, 0x5f, 0x70, 0x61, 0x63, 0x6b,
0x61, 0x67, 0x65, 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72,
0x75, 0x62, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x58,
0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65,
0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7,
0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65,
0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70,
0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 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, 0x12, 0x10,
0x0a, 0x0c, 0x4c, 0x49, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49,
0x4d, 0x45, 0x10, 0x03, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80,
0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x26, 0x10, 0x27, 0x22, 0xd1, 0x02,
0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 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, 0x52, 0x14, 0x6d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65,
0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4c, 0x0a, 0x1f, 0x6e, 0x6f,
0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x5f, 0x64, 0x65,
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63, 0x63,
0x65, 0x73, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a,
0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x1c, 0x6e, 0x6f, 0x53, 0x74,
0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69,
0x70, 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72,
0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74,
0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61,
0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61,
0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x65,
0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08,
0x6d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x58, 0x0a, 0x14,
0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65,
0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e,
0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74,
0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80,
0x02, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x09, 0x10,
0x0a, 0x22, 0xe2, 0x03, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 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, 0x3a, 0x06,
0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65,
0x64, 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18,
0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 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, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, 0x4a, 0x53, 0x5f,
0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79,
0x70, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x05,
0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52,
0x04, 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70,
0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65,
0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x04,
0x77, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05,
0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12,
0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72,
0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18,
0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74,
0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e,
0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79,
0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47,
0x10, 0x00, 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, 0x35, 0x0a, 0x06, 0x4a, 0x53,
0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e,
0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4a,
0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d,
0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10,
0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02,
0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x73, 0x0a, 0x0c, 0x4f, 0x6e,
0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58,
0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65,
0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7,
0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65,
0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70,
0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80,
0x80, 0x80, 0x02, 0x22, 0xc0, 0x01, 0x0a, 0x0b, 0x45, 0x6e, 0x75, 0x6d,
0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61,
0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02,
0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41,
0x6c, 0x69, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72,
0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08,
0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70,
0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75,
0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64,
0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70,
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65,
0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02,
0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0x9e, 0x01, 0x0a, 0x10, 0x45,
0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65,
0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a,
0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72,
0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e,
0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f,
0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e,
0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72,
0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22,
0x9c, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65,
0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01,
0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64,
0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a,
0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74,
0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55,
0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64,
0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e,
0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80,
0x80, 0x02, 0x22, 0xe0, 0x02, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f,
0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a,
0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21,
0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52,
0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12,
0x71, 0x0a, 0x11, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e,
0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x22, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x2f, 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, 0x2e, 0x49,
0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65,
0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54,
0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e,
0x52, 0x10, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63,
0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e,
0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f,
0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e,
0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72,
0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x22, 0x50, 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65,
0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a, 0x13,
0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f,
0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a,
0x0f, 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, 0x45, 0x5f, 0x45, 0x46, 0x46,
0x45, 0x43, 0x54, 0x53, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x44,
0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x54, 0x10, 0x02, 0x2a, 0x09,
0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9a, 0x03,
0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65,
0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65,
0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x52, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, 0x65, 0x6e,
0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x64, 0x65, 0x6e,
0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12,
0x2c, 0x0a, 0x12, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f,
0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20,
0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76,
0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a,
0x12, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e,
0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
0x03, 0x52, 0x10, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x49,
0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64,
0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c,
0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74,
0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x67, 0x67,
0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x67, 0x67, 0x72,
0x65, 0x67, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x4a,
0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x1b,
0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18,
0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x61, 0x6d, 0x65, 0x50,
0x61, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x65, 0x78,
0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x02, 0x28,
0x08, 0x52, 0x0b, 0x69, 0x73, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
0x6f, 0x6e, 0x22, 0xa7, 0x02, 0x0a, 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, 0x0a,
0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f,
0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c,
0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, 0x01, 0x0a, 0x08,
0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04,
0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02,
0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x04,
0x73, 0x70, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02,
0x10, 0x01, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10,
0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d,
0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f,
0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65,
0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c,
0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73,
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x74, 0x72, 0x61, 0x69,
0x6c, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73,
0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f,
0x64, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d,
0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52,
0x17, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, 0x61,
0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73,
0x22, 0xd1, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,
0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4d,
0x0a, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f,
0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x6d, 0x0a, 0x0a, 0x41, 0x6e, 0x6e,
0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70,
0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10,
0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73,
0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x46, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x65, 0x67, 0x69,
0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67,
0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, 0x20,
0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x42, 0x8f, 0x01, 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, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2f, 0x64,
0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x3b, 0x64, 0x65,
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0xf8, 0x01, 0x01, 0xa2,
0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1a, 0x47, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e
};
unsigned int descriptor_proto_len = 7582;
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <Zend/zend_exceptions.h> #include <Zend/zend_exceptions.h>
#include "protobuf.h" #include "protobuf.h"
#include "builtin_descriptors.inc"
// Forward declare. // Forward declare.
static void descriptor_init_c_instance(Descriptor* intern TSRMLS_DC); static void descriptor_init_c_instance(Descriptor* intern TSRMLS_DC);
...@@ -68,21 +69,6 @@ static void check_upb_status(const upb_status* status, const char* msg) { ...@@ -68,21 +69,6 @@ static void check_upb_status(const upb_status* status, const char* msg) {
} }
} }
static void upb_filedef_free(void *r) {
upb_filedef *f = *(upb_filedef **)r;
size_t i;
for (i = 0; i < upb_filedef_depcount(f); i++) {
upb_filedef_unref(upb_filedef_dep(f, i), f);
}
upb_inttable_uninit(&f->defs);
upb_inttable_uninit(&f->deps);
upb_gfree((void *)f->name);
upb_gfree((void *)f->package);
upb_gfree(f);
}
// Camel-case the field name and append "Entry" for generated map entry name. // Camel-case the field name and append "Entry" for generated map entry name.
// e.g. map<KeyType, ValueType> foo_map => FooMapEntry // e.g. map<KeyType, ValueType> foo_map => FooMapEntry
static void append_map_entry_name(char *result, const char *field_name, static void append_map_entry_name(char *result, const char *field_name,
...@@ -108,13 +94,6 @@ static void append_map_entry_name(char *result, const char *field_name, ...@@ -108,13 +94,6 @@ static void append_map_entry_name(char *result, const char *field_name,
strcat(result, "Entry"); strcat(result, "Entry");
} }
#define CHECK_UPB(code, msg) \
do { \
upb_status status = UPB_STATUS_INIT; \
code; \
check_upb_status(&status, msg); \
} while (0)
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// GPBType // GPBType
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -172,40 +151,12 @@ static void descriptor_free_c(Descriptor *self TSRMLS_DC) { ...@@ -172,40 +151,12 @@ static void descriptor_free_c(Descriptor *self TSRMLS_DC) {
if (self->layout) { if (self->layout) {
free_layout(self->layout); free_layout(self->layout);
} }
if (self->fill_handlers) {
upb_handlers_unref(self->fill_handlers, &self->fill_handlers);
}
if (self->fill_method) {
upb_pbdecodermethod_unref(self->fill_method, &self->fill_method);
}
if (self->json_fill_method) {
upb_json_parsermethod_unref(self->json_fill_method,
&self->json_fill_method);
}
if (self->pb_serialize_handlers) {
upb_handlers_unref(self->pb_serialize_handlers,
&self->pb_serialize_handlers);
}
if (self->json_serialize_handlers) {
upb_handlers_unref(self->json_serialize_handlers,
&self->json_serialize_handlers);
}
if (self->json_serialize_handlers_preserve) {
upb_handlers_unref(self->json_serialize_handlers_preserve,
&self->json_serialize_handlers_preserve);
}
} }
static void descriptor_init_c_instance(Descriptor *desc TSRMLS_DC) { static void descriptor_init_c_instance(Descriptor *desc TSRMLS_DC) {
desc->msgdef = NULL; desc->msgdef = NULL;
desc->layout = NULL; desc->layout = NULL;
desc->klass = NULL; desc->klass = NULL;
desc->fill_handlers = NULL;
desc->fill_method = NULL;
desc->json_fill_method = NULL;
desc->pb_serialize_handlers = NULL;
desc->json_serialize_handlers = NULL;
desc->json_serialize_handlers_preserve = NULL;
} }
PHP_METHOD(Descriptor, getClass) { PHP_METHOD(Descriptor, getClass) {
...@@ -297,7 +248,7 @@ PHP_METHOD(Descriptor, getOneofDecl) { ...@@ -297,7 +248,7 @@ PHP_METHOD(Descriptor, getOneofDecl) {
for(upb_msg_oneof_begin(&iter, intern->msgdef), i = 0; for(upb_msg_oneof_begin(&iter, intern->msgdef), i = 0;
!upb_msg_oneof_done(&iter) && i < index; !upb_msg_oneof_done(&iter) && i < index;
upb_msg_oneof_next(&iter), i++); upb_msg_oneof_next(&iter), i++);
upb_oneofdef *oneof = upb_msg_iter_oneof(&iter); const upb_oneofdef *oneof = upb_msg_iter_oneof(&iter);
ZVAL_OBJ(return_value, oneof_descriptor_type->create_object( ZVAL_OBJ(return_value, oneof_descriptor_type->create_object(
oneof_descriptor_type TSRMLS_CC)); oneof_descriptor_type TSRMLS_CC));
...@@ -482,14 +433,13 @@ PHP_METHOD(FieldDescriptor, isMap) { ...@@ -482,14 +433,13 @@ PHP_METHOD(FieldDescriptor, isMap) {
PHP_METHOD(FieldDescriptor, getEnumType) { PHP_METHOD(FieldDescriptor, getEnumType) {
FieldDescriptor *intern = UNBOX(FieldDescriptor, getThis()); FieldDescriptor *intern = UNBOX(FieldDescriptor, getThis());
const upb_enumdef *enumdef = upb_fielddef_enumsubdef(intern->fielddef); if (upb_fielddef_type(intern->fielddef) != UPB_TYPE_ENUM) {
if (enumdef == NULL) { zend_throw_exception_ex(NULL, 0 TSRMLS_CC,
char error_msg[100]; "Cannot get enum type for non-enum field '%s'",
sprintf(error_msg, "Cannot get enum type for non-enum field '%s'", upb_fielddef_name(intern->fielddef));
upb_fielddef_name(intern->fielddef));
zend_throw_exception(NULL, error_msg, 0 TSRMLS_CC);
return; return;
} }
const upb_enumdef *enumdef = upb_fielddef_enumsubdef(intern->fielddef);
PHP_PROTO_HASHTABLE_VALUE desc = get_def_obj(enumdef); PHP_PROTO_HASHTABLE_VALUE desc = get_def_obj(enumdef);
#if PHP_MAJOR_VERSION < 7 #if PHP_MAJOR_VERSION < 7
...@@ -502,14 +452,13 @@ PHP_METHOD(FieldDescriptor, getEnumType) { ...@@ -502,14 +452,13 @@ PHP_METHOD(FieldDescriptor, getEnumType) {
PHP_METHOD(FieldDescriptor, getMessageType) { PHP_METHOD(FieldDescriptor, getMessageType) {
FieldDescriptor *intern = UNBOX(FieldDescriptor, getThis()); FieldDescriptor *intern = UNBOX(FieldDescriptor, getThis());
const upb_msgdef *msgdef = upb_fielddef_msgsubdef(intern->fielddef); if (upb_fielddef_type(intern->fielddef) != UPB_TYPE_MESSAGE) {
if (msgdef == NULL) { zend_throw_exception_ex(
char error_msg[100]; NULL, 0 TSRMLS_CC, "Cannot get message type for non-message field '%s'",
sprintf(error_msg, "Cannot get message type for non-message field '%s'", upb_fielddef_name(intern->fielddef));
upb_fielddef_name(intern->fielddef));
zend_throw_exception(NULL, error_msg, 0 TSRMLS_CC);
return; return;
} }
const upb_msgdef *msgdef = upb_fielddef_msgsubdef(intern->fielddef);
PHP_PROTO_HASHTABLE_VALUE desc = get_def_obj(msgdef); PHP_PROTO_HASHTABLE_VALUE desc = get_def_obj(msgdef);
#if PHP_MAJOR_VERSION < 7 #if PHP_MAJOR_VERSION < 7
...@@ -657,17 +606,24 @@ void init_generated_pool_once(TSRMLS_D) { ...@@ -657,17 +606,24 @@ void init_generated_pool_once(TSRMLS_D) {
static void internal_descriptor_pool_init_c_instance( static void internal_descriptor_pool_init_c_instance(
InternalDescriptorPool *pool TSRMLS_DC) { InternalDescriptorPool *pool TSRMLS_DC) {
pool->symtab = upb_symtab_new(); pool->symtab = upb_symtab_new();
pool->fill_handler_cache =
ALLOC_HASHTABLE(pool->pending_list); upb_handlercache_new(add_handlers_for_message, NULL);
zend_hash_init(pool->pending_list, 1, NULL, ZVAL_PTR_DTOR, 0); pool->pb_serialize_handler_cache = upb_pb_encoder_newcache();
pool->json_serialize_handler_cache = upb_json_printer_newcache(false);
pool->json_serialize_handler_preserve_cache = upb_json_printer_newcache(true);
pool->fill_method_cache = upb_pbcodecache_new(pool->fill_handler_cache);
pool->json_fill_method_cache = upb_json_codecache_new();
} }
static void internal_descriptor_pool_free_c( static void internal_descriptor_pool_free_c(
InternalDescriptorPool *pool TSRMLS_DC) { InternalDescriptorPool *pool TSRMLS_DC) {
upb_symtab_free(pool->symtab); upb_symtab_free(pool->symtab);
upb_handlercache_free(pool->fill_handler_cache);
zend_hash_destroy(pool->pending_list); upb_handlercache_free(pool->pb_serialize_handler_cache);
FREE_HASHTABLE(pool->pending_list); upb_handlercache_free(pool->json_serialize_handler_cache);
upb_handlercache_free(pool->json_serialize_handler_preserve_cache);
upb_pbcodecache_free(pool->fill_method_cache);
upb_json_codecache_free(pool->json_fill_method_cache);
} }
static void descriptor_pool_init_c_instance(DescriptorPool *pool TSRMLS_DC) { static void descriptor_pool_init_c_instance(DescriptorPool *pool TSRMLS_DC) {
...@@ -821,11 +777,11 @@ static void fill_segment(const char *segment, int length, ...@@ -821,11 +777,11 @@ static void fill_segment(const char *segment, int length,
} }
} }
static void fill_namespace(const char *package, const char *namespace_given, static void fill_namespace(const char *package, const char *php_namespace,
stringsink *classname) { stringsink *classname) {
if (namespace_given != NULL) { if (php_namespace != NULL) {
stringsink_string(classname, NULL, namespace_given, stringsink_string(classname, NULL, php_namespace, strlen(php_namespace),
strlen(namespace_given), NULL); NULL);
stringsink_string(classname, NULL, "\\", 1, NULL); stringsink_string(classname, NULL, "\\", 1, NULL);
} else if (package != NULL) { } else if (package != NULL) {
int i = 0, j, offset = 0; int i = 0, j, offset = 0;
...@@ -845,7 +801,6 @@ static void fill_namespace(const char *package, const char *namespace_given, ...@@ -845,7 +801,6 @@ static void fill_namespace(const char *package, const char *namespace_given,
static void fill_classname(const char *fullname, static void fill_classname(const char *fullname,
const char *package, const char *package,
const char *namespace_given,
const char *prefix, const char *prefix,
stringsink *classname, stringsink *classname,
bool use_nested_submsg) { bool use_nested_submsg) {
...@@ -879,118 +834,152 @@ static void fill_classname(const char *fullname, ...@@ -879,118 +834,152 @@ static void fill_classname(const char *fullname,
} }
} }
static void fill_qualified_classname(const char *fullname, static zend_class_entry *register_class(const upb_filedef *file,
const char *package, const char *fullname,
const char *namespace_given, PHP_PROTO_HASHTABLE_VALUE desc_php,
const char *prefix, bool use_nested_submsg TSRMLS_DC) {
stringsink *classname, // Prepend '.' to package name to make it absolute. In the 5 additional
bool use_nested_submsg) { // bytes allocated, one for '.', one for trailing 0, and 3 for 'GPB' if
fill_namespace(package, namespace_given, classname); // given message is google.protobuf.Empty.
fill_classname(fullname, package, namespace_given, prefix, const char *package = upb_filedef_package(file);
classname, use_nested_submsg); const char *php_namespace = upb_filedef_phpnamespace(file);
const char *prefix = upb_filedef_phpprefix(file);
size_t classname_len =
classname_len_max(fullname, package, php_namespace, prefix);
char* after_package;
zend_class_entry* ret;
stringsink namesink;
stringsink_init(&namesink);
fill_namespace(package, php_namespace, &namesink);
fill_classname(fullname, package, prefix, &namesink, use_nested_submsg);
PHP_PROTO_CE_DECLARE pce;
if (php_proto_zend_lookup_class(namesink.ptr, namesink.len, &pce) ==
FAILURE) {
zend_error(
E_ERROR,
"Generated message class %s hasn't been defined (%s, %s, %s, %s)",
namesink.ptr, fullname, package, php_namespace, prefix);
return NULL;
}
ret = PHP_PROTO_CE_UNREF(pce);
add_ce_obj(ret, desc_php);
add_proto_obj(fullname, desc_php);
stringsink_uninit(&namesink);
return ret;
}
bool depends_on_descriptor(const google_protobuf_FileDescriptorProto* file) {
const upb_strview *deps;
upb_strview name = upb_strview_makez("google/protobuf/descriptor.proto");
size_t i, n;
deps = google_protobuf_FileDescriptorProto_dependency(file, &n);
for (i = 0; i < n; i++) {
if (upb_strview_eql(deps[i], name)) {
return true;
}
}
return false;
} }
static void classname_no_prefix(const char *fullname, const char *package_name, const upb_filedef *parse_and_add_descriptor(const char *data,
char *class_name) { PHP_PROTO_SIZE data_len,
size_t i = 0, j; InternalDescriptorPool *pool,
bool first_char = true, is_reserved = false; upb_arena *arena) {
size_t pkg_name_len = package_name == NULL ? 0 : strlen(package_name); size_t n;
size_t message_name_start = package_name == NULL ? 0 : pkg_name_len + 1; google_protobuf_FileDescriptorSet *set;
size_t message_len = (strlen(fullname) - message_name_start); const google_protobuf_FileDescriptorProto* const* files;
const upb_filedef* file;
// Submessage is concatenated with its containing messages by '_'. upb_status status;
for (j = message_name_start; j < message_name_start + message_len; j++) {
if (fullname[j] == '.') { set = google_protobuf_FileDescriptorSet_parsenew(
class_name[i++] = '_'; upb_strview_make(data, data_len), arena);
} else {
class_name[i++] = fullname[j]; if (!set) {
zend_error(E_ERROR, "Failed to parse binary descriptor\n");
return false;
}
files = google_protobuf_FileDescriptorSet_file(set, &n);
if (n != 1) {
zend_error(E_ERROR, "Serialized descriptors should have exactly one file");
return false;
}
// The PHP code generator currently special-cases descriptor.proto. It
// doesn't add it as a dependency even if the proto file actually does
// depend on it.
if (depends_on_descriptor(files[0]) &&
upb_symtab_lookupfile(pool->symtab, "google/protobuf/descriptor.proto") ==
NULL) {
if (!parse_and_add_descriptor((char *)descriptor_proto,
descriptor_proto_len, pool, arena)) {
return false;
} }
} }
upb_status_clear(&status);
file = upb_symtab_addfile(pool->symtab, files[0], &status);
check_upb_status(&status, "Unable to load descriptor");
return file;
} }
void internal_add_generated_file(const char *data, PHP_PROTO_SIZE data_len, void internal_add_generated_file(const char *data, PHP_PROTO_SIZE data_len,
InternalDescriptorPool *pool, InternalDescriptorPool *pool,
bool use_nested_submsg TSRMLS_DC) { bool use_nested_submsg TSRMLS_DC) {
upb_filedef **files; int i;
size_t i; upb_arena *arena;
const upb_filedef* file;
CHECK_UPB(files = upb_loaddescriptor(data, data_len, &pool, &status),
"Parse binary descriptors to internal descriptors failed");
// This method is called only once in each file.
assert(files[0] != NULL);
assert(files[1] == NULL);
CHECK_UPB(upb_symtab_addfile(pool->symtab, files[0], &status), arena = upb_arena_new();
"Unable to add file to DescriptorPool"); file = parse_and_add_descriptor(data, data_len, pool, arena);
upb_arena_free(arena);
if (!file) return;
// For each enum/message, we need its PHP class, upb descriptor and its PHP // For each enum/message, we need its PHP class, upb descriptor and its PHP
// wrapper. These information are needed later for encoding, decoding and type // wrapper. These information are needed later for encoding, decoding and type
// checking. However, sometimes we just have one of them. In order to find // checking. However, sometimes we just have one of them. In order to find
// them quickly, here, we store the mapping for them. // them quickly, here, we store the mapping for them.
for (i = 0; i < upb_filedef_defcount(files[0]); i++) {
const upb_def *def = upb_filedef_def(files[0], i);
switch (upb_def_type(def)) {
#define CASE_TYPE(def_type, def_type_lower, desc_type, desc_type_lower) \
case UPB_DEF_##def_type: { \
CREATE_HASHTABLE_VALUE(desc, desc_php, desc_type, desc_type_lower##_type); \
const upb_##def_type_lower *def_type_lower = \
upb_downcast_##def_type_lower(def); \
desc->def_type_lower = def_type_lower; \
add_def_obj(desc->def_type_lower, desc_php); \
/* Unlike other messages, MapEntry is shared by all map fields and doesn't \
* have generated PHP class.*/ \
if (upb_def_type(def) == UPB_DEF_MSG && \
upb_msgdef_mapentry(upb_downcast_msgdef(def))) { \
break; \
} \
/* Prepend '.' to package name to make it absolute. In the 5 additional \
* bytes allocated, one for '.', one for trailing 0, and 3 for 'GPB' if \
* given message is google.protobuf.Empty.*/ \
const char *fullname = upb_##def_type_lower##_fullname(def_type_lower); \
const char *package = upb_filedef_package(files[0]); \
const char *php_namespace = upb_filedef_phpnamespace(files[0]); \
const char *prefix_given = upb_filedef_phpprefix(files[0]); \
stringsink namesink; \
stringsink_init(&namesink); \
fill_qualified_classname(fullname, package, php_namespace, \
prefix_given, &namesink, use_nested_submsg); \
PHP_PROTO_CE_DECLARE pce; \
if (php_proto_zend_lookup_class(namesink.ptr, namesink.len, &pce) == \
FAILURE) { \
zend_error(E_ERROR, "Generated message class %s hasn't been defined", \
namesink.ptr); \
return; \
} else { \
desc->klass = PHP_PROTO_CE_UNREF(pce); \
} \
add_ce_obj(desc->klass, desc_php); \
add_proto_obj(upb_##def_type_lower##_fullname(desc->def_type_lower), \
desc_php); \
stringsink_uninit(&namesink); \
break; \
}
CASE_TYPE(MSG, msgdef, Descriptor, descriptor) for (i = 0; i < upb_filedef_msgcount(file); i++) {
CASE_TYPE(ENUM, enumdef, EnumDescriptor, enum_descriptor) const upb_msgdef *msgdef = upb_filedef_msg(file, i);
#undef CASE_TYPE CREATE_HASHTABLE_VALUE(desc, desc_php, Descriptor, descriptor_type);
desc->msgdef = msgdef;
desc->pool = pool;
add_def_obj(desc->msgdef, desc_php);
// Unlike other messages, MapEntry is shared by all map fields and doesn't
// have generated PHP class.
if (upb_msgdef_mapentry(msgdef)) {
continue;
}
desc->klass = register_class(file, upb_msgdef_fullname(msgdef), desc_php,
use_nested_submsg TSRMLS_CC);
default: if (desc->klass == NULL) {
break; return;
} }
build_class_from_descriptor(desc_php TSRMLS_CC);
} }
for (i = 0; i < upb_filedef_defcount(files[0]); i++) { for (i = 0; i < upb_filedef_enumcount(file); i++) {
const upb_def *def = upb_filedef_def(files[0], i); const upb_enumdef *enumdef = upb_filedef_enum(file, i);
if (upb_def_type(def) == UPB_DEF_MSG) { CREATE_HASHTABLE_VALUE(desc, desc_php, EnumDescriptor, enum_descriptor_type);
const upb_msgdef *msgdef = upb_downcast_msgdef(def); desc->enumdef = enumdef;
PHP_PROTO_HASHTABLE_VALUE desc_php = get_def_obj(msgdef); add_def_obj(desc->enumdef, desc_php);
build_class_from_descriptor(desc_php TSRMLS_CC); desc->klass = register_class(file, upb_enumdef_fullname(enumdef), desc_php,
use_nested_submsg TSRMLS_CC);
if (desc->klass == NULL) {
return;
} }
} }
upb_filedef_unref(files[0], &pool);
upb_gfree(files);
} }
PHP_METHOD(InternalDescriptorPool, internalAddGeneratedFile) { PHP_METHOD(InternalDescriptorPool, internalAddGeneratedFile) {
......
...@@ -89,7 +89,8 @@ void stringsink_uninit_opaque(void *sink) { stringsink_uninit(sink); } ...@@ -89,7 +89,8 @@ void stringsink_uninit_opaque(void *sink) { stringsink_uninit(sink); }
// if any error occurs. // if any error occurs.
#define STACK_ENV_STACKBYTES 4096 #define STACK_ENV_STACKBYTES 4096
typedef struct { typedef struct {
upb_env env; upb_arena *arena;
upb_status status;
const char *php_error_template; const char *php_error_template;
char allocbuf[STACK_ENV_STACKBYTES]; char allocbuf[STACK_ENV_STACKBYTES];
} stackenv; } stackenv;
...@@ -98,31 +99,22 @@ typedef struct { ...@@ -98,31 +99,22 @@ typedef struct {
static void stackenv_init(stackenv* se, const char* errmsg); static void stackenv_init(stackenv* se, const char* errmsg);
static void stackenv_uninit(stackenv* se); static void stackenv_uninit(stackenv* se);
// Callback invoked by upb if any error occurs during parsing or serialization.
static bool env_error_func(void* ud, const upb_status* status) {
char err_msg[100] = "";
stackenv* se = ud;
// Free the env -- zend_error will longjmp up the stack past the
// encode/decode function so it would not otherwise have been freed.
stackenv_uninit(se);
// TODO(teboring): have a way to verify that this is actually a parse error,
// instead of just throwing "parse error" unconditionally.
sprintf(err_msg, se->php_error_template, upb_status_errmsg(status));
TSRMLS_FETCH();
zend_throw_exception(NULL, err_msg, 0 TSRMLS_CC);
// Never reached.
return false;
}
static void stackenv_init(stackenv* se, const char* errmsg) { static void stackenv_init(stackenv* se, const char* errmsg) {
se->php_error_template = errmsg; se->php_error_template = errmsg;
upb_env_init2(&se->env, se->allocbuf, sizeof(se->allocbuf), NULL); se->arena = upb_arena_new();
upb_env_seterrorfunc(&se->env, env_error_func, se); upb_status_clear(&se->status);
} }
static void stackenv_uninit(stackenv* se) { static void stackenv_uninit(stackenv* se) {
upb_env_uninit(&se->env); upb_arena_free(se->arena);
if (!upb_ok(&se->status)) {
// TODO(teboring): have a way to verify that this is actually a parse error,
// instead of just throwing "parse error" unconditionally.
TSRMLS_FETCH();
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, se->php_error_template,
upb_status_errmsg(&se->status));
}
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -131,7 +123,7 @@ static void stackenv_uninit(stackenv* se) { ...@@ -131,7 +123,7 @@ static void stackenv_uninit(stackenv* se) {
// TODO(teboring): This shoud be a bit in upb_msgdef // TODO(teboring): This shoud be a bit in upb_msgdef
static bool is_wrapper_msg(const upb_msgdef *msg) { static bool is_wrapper_msg(const upb_msgdef *msg) {
return !strcmp(upb_filedef_name(upb_msgdef_upcast(msg)->file), return !strcmp(upb_filedef_name(upb_msgdef_file(msg)),
"google/protobuf/wrappers.proto"); "google/protobuf/wrappers.proto");
} }
...@@ -462,11 +454,6 @@ typedef struct { ...@@ -462,11 +454,6 @@ typedef struct {
size_t ofs; size_t ofs;
upb_fieldtype_t key_field_type; upb_fieldtype_t key_field_type;
upb_fieldtype_t value_field_type; upb_fieldtype_t value_field_type;
// We know that we can hold this reference because the handlerdata has the
// same lifetime as the upb_handlers struct, and the upb_handlers struct holds
// a reference to the upb_msgdef, which in turn has references to its subdefs.
const upb_def* value_field_subdef;
} map_handlerdata_t; } map_handlerdata_t;
// Temporary frame for map parsing: at the beginning of a map entry message, a // Temporary frame for map parsing: at the beginning of a map entry message, a
...@@ -671,7 +658,6 @@ static map_handlerdata_t* new_map_handlerdata( ...@@ -671,7 +658,6 @@ static map_handlerdata_t* new_map_handlerdata(
value_field = upb_msgdef_itof(mapentry_def, MAP_VALUE_FIELD); value_field = upb_msgdef_itof(mapentry_def, MAP_VALUE_FIELD);
assert(value_field != NULL); assert(value_field != NULL);
hd->value_field_type = upb_fielddef_type(value_field); hd->value_field_type = upb_fielddef_type(value_field);
hd->value_field_subdef = upb_fielddef_subdef(value_field);
return hd; return hd;
} }
...@@ -831,10 +817,9 @@ static void* oneofsubmsg_handler(void* closure, const void* hd) { ...@@ -831,10 +817,9 @@ static void* oneofsubmsg_handler(void* closure, const void* hd) {
static void add_handlers_for_repeated_field(upb_handlers *h, static void add_handlers_for_repeated_field(upb_handlers *h,
const upb_fielddef *f, const upb_fielddef *f,
size_t offset) { size_t offset) {
upb_handlerattr attr = UPB_HANDLERATTR_INITIALIZER; upb_handlerattr attr = UPB_HANDLERATTR_INIT;
upb_handlerattr_sethandlerdata(&attr, newhandlerdata(h, offset)); attr.handler_data = newhandlerdata(h, offset);
upb_handlers_setstartseq(h, f, startseq_handler, &attr); upb_handlers_setstartseq(h, f, startseq_handler, &attr);
upb_handlerattr_uninit(&attr);
switch (upb_fielddef_type(f)) { switch (upb_fielddef_type(f)) {
...@@ -862,10 +847,9 @@ static void add_handlers_for_repeated_field(upb_handlers *h, ...@@ -862,10 +847,9 @@ static void add_handlers_for_repeated_field(upb_handlers *h,
break; break;
} }
case UPB_TYPE_MESSAGE: { case UPB_TYPE_MESSAGE: {
upb_handlerattr attr = UPB_HANDLERATTR_INITIALIZER; upb_handlerattr attr = UPB_HANDLERATTR_INIT;
upb_handlerattr_sethandlerdata(&attr, newsubmsghandlerdata(h, 0, f)); attr.handler_data = newsubmsghandlerdata(h, 0, f);
upb_handlers_setstartsubmsg(h, f, appendsubmsg_handler, &attr); upb_handlers_setstartsubmsg(h, f, appendsubmsg_handler, &attr);
upb_handlerattr_uninit(&attr);
break; break;
} }
} }
...@@ -876,13 +860,12 @@ static void add_handlers_for_singular_field(upb_handlers *h, ...@@ -876,13 +860,12 @@ static void add_handlers_for_singular_field(upb_handlers *h,
const upb_fielddef *f, const upb_fielddef *f,
size_t offset) { size_t offset) {
switch (upb_fielddef_type(f)) { switch (upb_fielddef_type(f)) {
#define SET_HANDLER(utype, ltype) \
#define SET_HANDLER(utype, ltype) \ case utype: { \
case utype: { \ upb_handlerattr attr = UPB_HANDLERATTR_INIT; \
upb_handlerattr attr = UPB_HANDLERATTR_INITIALIZER; \ attr.handler_data = newhandlerdata(h, offset); \
upb_handlerattr_sethandlerdata(&attr, newhandlerdata(h, offset)); \ upb_handlers_set##ltype(h, f, ltype##_handler, &attr); \
upb_handlers_set##ltype(h, f, ltype##_handler, &attr); \ break; \
break; \
} }
SET_HANDLER(UPB_TYPE_BOOL, bool); SET_HANDLER(UPB_TYPE_BOOL, bool);
...@@ -898,19 +881,17 @@ static void add_handlers_for_singular_field(upb_handlers *h, ...@@ -898,19 +881,17 @@ static void add_handlers_for_singular_field(upb_handlers *h,
case UPB_TYPE_STRING: case UPB_TYPE_STRING:
case UPB_TYPE_BYTES: { case UPB_TYPE_BYTES: {
upb_handlerattr attr = UPB_HANDLERATTR_INITIALIZER; upb_handlerattr attr = UPB_HANDLERATTR_INIT;
upb_handlerattr_sethandlerdata(&attr, newhandlerdata(h, offset)); attr.handler_data = newhandlerdata(h, offset);
upb_handlers_setstartstr(h, f, str_handler, &attr); upb_handlers_setstartstr(h, f, str_handler, &attr);
upb_handlers_setstring(h, f, stringdata_handler, &attr); upb_handlers_setstring(h, f, stringdata_handler, &attr);
upb_handlers_setendstr(h, f, str_end_handler, &attr); upb_handlers_setendstr(h, f, str_end_handler, &attr);
upb_handlerattr_uninit(&attr);
break; break;
} }
case UPB_TYPE_MESSAGE: { case UPB_TYPE_MESSAGE: {
upb_handlerattr attr = UPB_HANDLERATTR_INITIALIZER; upb_handlerattr attr = UPB_HANDLERATTR_INIT;
upb_handlerattr_sethandlerdata(&attr, newsubmsghandlerdata(h, offset, f)); attr.handler_data = newsubmsghandlerdata(h, offset, f);
upb_handlers_setstartsubmsg(h, f, submsg_handler, &attr); upb_handlers_setstartsubmsg(h, f, submsg_handler, &attr);
upb_handlerattr_uninit(&attr);
break; break;
} }
} }
...@@ -923,12 +904,11 @@ static void add_handlers_for_mapfield(upb_handlers* h, ...@@ -923,12 +904,11 @@ static void add_handlers_for_mapfield(upb_handlers* h,
Descriptor* desc) { Descriptor* desc) {
const upb_msgdef* map_msgdef = upb_fielddef_msgsubdef(fielddef); const upb_msgdef* map_msgdef = upb_fielddef_msgsubdef(fielddef);
map_handlerdata_t* hd = new_map_handlerdata(offset, map_msgdef, desc); map_handlerdata_t* hd = new_map_handlerdata(offset, map_msgdef, desc);
upb_handlerattr attr = UPB_HANDLERATTR_INITIALIZER; upb_handlerattr attr = UPB_HANDLERATTR_INIT;
upb_handlers_addcleanup(h, hd, free); upb_handlers_addcleanup(h, hd, free);
upb_handlerattr_sethandlerdata(&attr, hd); attr.handler_data = hd;
upb_handlers_setstartsubmsg(h, fielddef, startmapentry_handler, &attr); upb_handlers_setstartsubmsg(h, fielddef, startmapentry_handler, &attr);
upb_handlerattr_uninit(&attr);
} }
// Adds handlers to a map-entry msgdef. // Adds handlers to a map-entry msgdef.
...@@ -937,10 +917,10 @@ static void add_handlers_for_mapentry(const upb_msgdef* msgdef, upb_handlers* h, ...@@ -937,10 +917,10 @@ static void add_handlers_for_mapentry(const upb_msgdef* msgdef, upb_handlers* h,
const upb_fielddef* key_field = map_entry_key(msgdef); const upb_fielddef* key_field = map_entry_key(msgdef);
const upb_fielddef* value_field = map_entry_value(msgdef); const upb_fielddef* value_field = map_entry_value(msgdef);
map_handlerdata_t* hd = new_map_handlerdata(0, msgdef, desc); map_handlerdata_t* hd = new_map_handlerdata(0, msgdef, desc);
upb_handlerattr attr = UPB_HANDLERATTR_INITIALIZER; upb_handlerattr attr = UPB_HANDLERATTR_INIT;
upb_handlers_addcleanup(h, hd, free); upb_handlers_addcleanup(h, hd, free);
upb_handlerattr_sethandlerdata(&attr, hd); attr.handler_data = hd;
upb_handlers_setendmsg(h, endmap_handler, &attr); upb_handlers_setendmsg(h, endmap_handler, &attr);
add_handlers_for_singular_field(h, key_field, add_handlers_for_singular_field(h, key_field,
...@@ -959,10 +939,9 @@ static void add_handlers_for_oneof_field(upb_handlers *h, ...@@ -959,10 +939,9 @@ static void add_handlers_for_oneof_field(upb_handlers *h,
size_t oneof_case_offset, size_t oneof_case_offset,
int property_cache_offset) { int property_cache_offset) {
upb_handlerattr attr = UPB_HANDLERATTR_INITIALIZER; upb_handlerattr attr = UPB_HANDLERATTR_INIT;
upb_handlerattr_sethandlerdata( attr.handler_data = newoneofhandlerdata(h, offset, oneof_case_offset,
&attr, newoneofhandlerdata(h, offset, oneof_case_offset, property_cache_offset, m, f);
property_cache_offset, m, f));
switch (upb_fielddef_type(f)) { switch (upb_fielddef_type(f)) {
...@@ -994,8 +973,6 @@ static void add_handlers_for_oneof_field(upb_handlers *h, ...@@ -994,8 +973,6 @@ static void add_handlers_for_oneof_field(upb_handlers *h,
break; break;
} }
} }
upb_handlerattr_uninit(&attr);
} }
static bool add_unknown_handler(void* closure, const void* hd, const char* buf, static bool add_unknown_handler(void* closure, const void* hd, const char* buf,
...@@ -1016,8 +993,7 @@ static bool add_unknown_handler(void* closure, const void* hd, const char* buf, ...@@ -1016,8 +993,7 @@ static bool add_unknown_handler(void* closure, const void* hd, const char* buf,
return true; return true;
} }
static void add_handlers_for_message(const void* closure, void add_handlers_for_message(const void* closure, upb_handlers* h) {
upb_handlers* h) {
const upb_msgdef* msgdef = upb_handlers_msgdef(h); const upb_msgdef* msgdef = upb_handlers_msgdef(h);
TSRMLS_FETCH(); TSRMLS_FETCH();
Descriptor* desc = Descriptor* desc =
...@@ -1039,8 +1015,8 @@ static void add_handlers_for_message(const void* closure, ...@@ -1039,8 +1015,8 @@ static void add_handlers_for_message(const void* closure,
desc->layout = create_layout(desc->msgdef); desc->layout = create_layout(desc->msgdef);
} }
upb_handlerattr attr = UPB_HANDLERATTR_INITIALIZER; upb_handlerattr attr = UPB_HANDLERATTR_INIT;
upb_handlerattr_sethandlerdata(&attr, newunknownfieldshandlerdata(h)); attr.handler_data = newunknownfieldshandlerdata(h);
upb_handlers_setunknown(h, add_unknown_handler, &attr); upb_handlers_setunknown(h, add_unknown_handler, &attr);
for (upb_msg_field_begin(&i, desc->msgdef); for (upb_msg_field_begin(&i, desc->msgdef);
...@@ -1066,84 +1042,52 @@ static void add_handlers_for_message(const void* closure, ...@@ -1066,84 +1042,52 @@ static void add_handlers_for_message(const void* closure,
} }
} }
// Creates upb handlers for populating a message.
static const upb_handlers *new_fill_handlers(Descriptor* desc,
const void* owner) {
// TODO(cfallin, haberman): once upb gets a caching/memoization layer for
// handlers, reuse subdef handlers so that e.g. if we already parse
// B-with-field-of-type-C, we don't have to rebuild the whole hierarchy to
// parse A-with-field-of-type-B-with-field-of-type-C.
return upb_handlers_newfrozen(desc->msgdef, owner,
add_handlers_for_message, NULL);
}
// Constructs the handlers for filling a message's data into an in-memory // Constructs the handlers for filling a message's data into an in-memory
// object. // object.
const upb_handlers* get_fill_handlers(Descriptor* desc) { const upb_handlers* get_fill_handlers(Descriptor* desc) {
if (!desc->fill_handlers) { return upb_handlercache_get(desc->pool->fill_handler_cache, desc->msgdef);
desc->fill_handlers =
new_fill_handlers(desc, &desc->fill_handlers);
}
return desc->fill_handlers;
}
const upb_pbdecodermethod *new_fillmsg_decodermethod(Descriptor* desc,
const void* owner) {
const upb_handlers* handlers = get_fill_handlers(desc);
upb_pbdecodermethodopts opts;
upb_pbdecodermethodopts_init(&opts, handlers);
return upb_pbdecodermethod_new(&opts, owner);
} }
static const upb_pbdecodermethod *msgdef_decodermethod(Descriptor* desc) { static const upb_pbdecodermethod *msgdef_decodermethod(Descriptor* desc) {
if (desc->fill_method == NULL) { return upb_pbcodecache_get(desc->pool->fill_method_cache, desc->msgdef);
desc->fill_method = new_fillmsg_decodermethod(
desc, &desc->fill_method);
}
return desc->fill_method;
} }
static const upb_json_parsermethod *msgdef_jsonparsermethod(Descriptor* desc) { static const upb_json_parsermethod *msgdef_jsonparsermethod(Descriptor* desc) {
if (desc->json_fill_method == NULL) { return upb_json_codecache_get(desc->pool->json_fill_method_cache, desc->msgdef);
desc->json_fill_method =
upb_json_parsermethod_new(desc->msgdef, &desc->json_fill_method);
}
return desc->json_fill_method;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Serializing. // Serializing.
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
static void putmsg(zval* msg, const Descriptor* desc, upb_sink* sink, static void putmsg(zval* msg, const Descriptor* desc, upb_sink sink,
int depth, bool is_json TSRMLS_DC); int depth, bool is_json TSRMLS_DC);
static void putrawmsg(MessageHeader* msg, const Descriptor* desc, static void putrawmsg(MessageHeader* msg, const Descriptor* desc,
upb_sink* sink, int depth, bool is_json, upb_sink sink, int depth, bool is_json,
bool open_msg TSRMLS_DC); bool open_msg TSRMLS_DC);
static void putjsonany(MessageHeader* msg, const Descriptor* desc, static void putjsonany(MessageHeader* msg, const Descriptor* desc,
upb_sink* sink, int depth TSRMLS_DC); upb_sink sink, int depth TSRMLS_DC);
static void putjsonlistvalue( static void putjsonlistvalue(
MessageHeader* msg, const Descriptor* desc, MessageHeader* msg, const Descriptor* desc,
upb_sink* sink, int depth TSRMLS_DC); upb_sink sink, int depth TSRMLS_DC);
static void putjsonstruct( static void putjsonstruct(
MessageHeader* msg, const Descriptor* desc, MessageHeader* msg, const Descriptor* desc,
upb_sink* sink, int depth TSRMLS_DC); upb_sink sink, int depth TSRMLS_DC);
static void putstr(zval* str, const upb_fielddef* f, upb_sink* sink, static void putstr(zval* str, const upb_fielddef* f, upb_sink sink,
bool force_default); bool force_default);
static void putrawstr(const char* str, int len, const upb_fielddef* f, static void putrawstr(const char* str, int len, const upb_fielddef* f,
upb_sink* sink, bool force_default); upb_sink sink, bool force_default);
static void putsubmsg(zval* submsg, const upb_fielddef* f, upb_sink* sink, static void putsubmsg(zval* submsg, const upb_fielddef* f, upb_sink sink,
int depth, bool is_json TSRMLS_DC); int depth, bool is_json TSRMLS_DC);
static void putrawsubmsg(MessageHeader* submsg, const upb_fielddef* f, static void putrawsubmsg(MessageHeader* submsg, const upb_fielddef* f,
upb_sink* sink, int depth, bool is_json TSRMLS_DC); upb_sink sink, int depth, bool is_json TSRMLS_DC);
static void putarray(zval* array, const upb_fielddef* f, upb_sink* sink, static void putarray(zval* array, const upb_fielddef* f, upb_sink sink,
int depth, bool is_json TSRMLS_DC); int depth, bool is_json TSRMLS_DC);
static void putmap(zval* map, const upb_fielddef* f, upb_sink* sink, static void putmap(zval* map, const upb_fielddef* f, upb_sink sink,
int depth, bool is_json TSRMLS_DC); int depth, bool is_json TSRMLS_DC);
static upb_selector_t getsel(const upb_fielddef* f, upb_handlertype_t type) { static upb_selector_t getsel(const upb_fielddef* f, upb_handlertype_t type) {
...@@ -1155,7 +1099,7 @@ static upb_selector_t getsel(const upb_fielddef* f, upb_handlertype_t type) { ...@@ -1155,7 +1099,7 @@ static upb_selector_t getsel(const upb_fielddef* f, upb_handlertype_t type) {
static void put_optional_value(const void* memory, int len, static void put_optional_value(const void* memory, int len,
const upb_fielddef* f, const upb_fielddef* f,
int depth, upb_sink* sink, int depth, upb_sink sink,
bool is_json TSRMLS_DC) { bool is_json TSRMLS_DC) {
assert(upb_fielddef_label(f) == UPB_LABEL_OPTIONAL); assert(upb_fielddef_label(f) == UPB_LABEL_OPTIONAL);
...@@ -1229,7 +1173,7 @@ static int raw_value_len(void* memory, int len, const upb_fielddef* f) { ...@@ -1229,7 +1173,7 @@ static int raw_value_len(void* memory, int len, const upb_fielddef* f) {
} }
} }
static void putmap(zval* map, const upb_fielddef* f, upb_sink* sink, static void putmap(zval* map, const upb_fielddef* f, upb_sink sink,
int depth, bool is_json TSRMLS_DC) { int depth, bool is_json TSRMLS_DC) {
upb_sink subsink; upb_sink subsink;
const upb_fielddef* key_field; const upb_fielddef* key_field;
...@@ -1252,29 +1196,29 @@ static void putmap(zval* map, const upb_fielddef* f, upb_sink* sink, ...@@ -1252,29 +1196,29 @@ static void putmap(zval* map, const upb_fielddef* f, upb_sink* sink,
upb_status status; upb_status status;
upb_sink entry_sink; upb_sink entry_sink;
upb_sink_startsubmsg(&subsink, getsel(f, UPB_HANDLER_STARTSUBMSG), upb_sink_startsubmsg(subsink, getsel(f, UPB_HANDLER_STARTSUBMSG),
&entry_sink); &entry_sink);
upb_sink_startmsg(&entry_sink); upb_sink_startmsg(entry_sink);
// Serialize key. // Serialize key.
const char *key = map_iter_key(&it, &len); const char *key = map_iter_key(&it, &len);
put_optional_value(key, len, key_field, depth + 1, put_optional_value(key, len, key_field, depth + 1,
&entry_sink, is_json TSRMLS_CC); entry_sink, is_json TSRMLS_CC);
// Serialize value. // Serialize value.
upb_value value = map_iter_value(&it, &len); upb_value value = map_iter_value(&it, &len);
put_optional_value(raw_value(upb_value_memory(&value), value_field), put_optional_value(raw_value(upb_value_memory(&value), value_field),
raw_value_len(upb_value_memory(&value), len, value_field), raw_value_len(upb_value_memory(&value), len, value_field),
value_field, depth + 1, &entry_sink, is_json TSRMLS_CC); value_field, depth + 1, entry_sink, is_json TSRMLS_CC);
upb_sink_endmsg(&entry_sink, &status); upb_sink_endmsg(entry_sink, &status);
upb_sink_endsubmsg(&subsink, getsel(f, UPB_HANDLER_ENDSUBMSG)); upb_sink_endsubmsg(subsink, getsel(f, UPB_HANDLER_ENDSUBMSG));
} }
upb_sink_endseq(sink, getsel(f, UPB_HANDLER_ENDSEQ)); upb_sink_endseq(sink, getsel(f, UPB_HANDLER_ENDSEQ));
} }
static void putmsg(zval* msg_php, const Descriptor* desc, upb_sink* sink, static void putmsg(zval* msg_php, const Descriptor* desc, upb_sink sink,
int depth, bool is_json TSRMLS_DC) { int depth, bool is_json TSRMLS_DC) {
MessageHeader* msg = UNBOX(MessageHeader, msg_php); MessageHeader* msg = UNBOX(MessageHeader, msg_php);
putrawmsg(msg, desc, sink, depth, is_json, true TSRMLS_CC); putrawmsg(msg, desc, sink, depth, is_json, true TSRMLS_CC);
...@@ -1284,7 +1228,7 @@ static const upb_handlers* msgdef_json_serialize_handlers( ...@@ -1284,7 +1228,7 @@ static const upb_handlers* msgdef_json_serialize_handlers(
Descriptor* desc, bool preserve_proto_fieldnames); Descriptor* desc, bool preserve_proto_fieldnames);
static void putjsonany(MessageHeader* msg, const Descriptor* desc, static void putjsonany(MessageHeader* msg, const Descriptor* desc,
upb_sink* sink, int depth TSRMLS_DC) { upb_sink sink, int depth TSRMLS_DC) {
upb_status status; upb_status status;
const upb_fielddef* type_field = upb_msgdef_itof(desc->msgdef, UPB_ANY_TYPE); const upb_fielddef* type_field = upb_msgdef_itof(desc->msgdef, UPB_ANY_TYPE);
const upb_fielddef* value_field = upb_msgdef_itof(desc->msgdef, UPB_ANY_VALUE); const upb_fielddef* value_field = upb_msgdef_itof(desc->msgdef, UPB_ANY_VALUE);
...@@ -1360,8 +1304,8 @@ static void putjsonany(MessageHeader* msg, const Descriptor* desc, ...@@ -1360,8 +1304,8 @@ static void putjsonany(MessageHeader* msg, const Descriptor* desc,
subsink.handlers = subsink.handlers =
msgdef_json_serialize_handlers(payload_desc, true); msgdef_json_serialize_handlers(payload_desc, true);
subsink.closure = sink->closure; subsink.closure = sink.closure;
putrawmsg(intern, payload_desc, &subsink, depth, true, putrawmsg(intern, payload_desc, subsink, depth, true,
is_wellknown TSRMLS_CC); is_wellknown TSRMLS_CC);
zval_dtor(&val); zval_dtor(&val);
...@@ -1373,7 +1317,7 @@ static void putjsonany(MessageHeader* msg, const Descriptor* desc, ...@@ -1373,7 +1317,7 @@ static void putjsonany(MessageHeader* msg, const Descriptor* desc,
static void putjsonlistvalue( static void putjsonlistvalue(
MessageHeader* msg, const Descriptor* desc, MessageHeader* msg, const Descriptor* desc,
upb_sink* sink, int depth TSRMLS_DC) { upb_sink sink, int depth TSRMLS_DC) {
upb_status status; upb_status status;
upb_sink subsink; upb_sink subsink;
const upb_fielddef* f = upb_msgdef_itof(desc->msgdef, 1); const upb_fielddef* f = upb_msgdef_itof(desc->msgdef, 1);
...@@ -1403,7 +1347,7 @@ static void putjsonlistvalue( ...@@ -1403,7 +1347,7 @@ static void putjsonlistvalue(
static void putjsonstruct( static void putjsonstruct(
MessageHeader* msg, const Descriptor* desc, MessageHeader* msg, const Descriptor* desc,
upb_sink* sink, int depth TSRMLS_DC) { upb_sink sink, int depth TSRMLS_DC) {
upb_status status; upb_status status;
upb_sink subsink; upb_sink subsink;
const upb_fielddef* f = upb_msgdef_itof(desc->msgdef, 1); const upb_fielddef* f = upb_msgdef_itof(desc->msgdef, 1);
...@@ -1430,7 +1374,7 @@ static void putjsonstruct( ...@@ -1430,7 +1374,7 @@ static void putjsonstruct(
} }
static void putrawmsg(MessageHeader* msg, const Descriptor* desc, static void putrawmsg(MessageHeader* msg, const Descriptor* desc,
upb_sink* sink, int depth, bool is_json, upb_sink sink, int depth, bool is_json,
bool open_msg TSRMLS_DC) { bool open_msg TSRMLS_DC) {
upb_msg_field_iter i; upb_msg_field_iter i;
upb_status status; upb_status status;
...@@ -1551,7 +1495,7 @@ static void putrawmsg(MessageHeader* msg, const Descriptor* desc, ...@@ -1551,7 +1495,7 @@ static void putrawmsg(MessageHeader* msg, const Descriptor* desc,
} }
static void putstr(zval* str, const upb_fielddef *f, static void putstr(zval* str, const upb_fielddef *f,
upb_sink *sink, bool force_default) { upb_sink sink, bool force_default) {
upb_sink subsink; upb_sink subsink;
if (ZVAL_IS_NULL(str)) return; if (ZVAL_IS_NULL(str)) return;
...@@ -1571,7 +1515,7 @@ static void putstr(zval* str, const upb_fielddef *f, ...@@ -1571,7 +1515,7 @@ static void putstr(zval* str, const upb_fielddef *f,
zend_error(E_USER_ERROR, "Given string is not UTF8 encoded."); zend_error(E_USER_ERROR, "Given string is not UTF8 encoded.");
return; return;
} }
upb_sink_putstring(&subsink, getsel(f, UPB_HANDLER_STRING), Z_STRVAL_P(str), upb_sink_putstring(subsink, getsel(f, UPB_HANDLER_STRING), Z_STRVAL_P(str),
Z_STRLEN_P(str), NULL); Z_STRLEN_P(str), NULL);
} }
...@@ -1579,7 +1523,7 @@ static void putstr(zval* str, const upb_fielddef *f, ...@@ -1579,7 +1523,7 @@ static void putstr(zval* str, const upb_fielddef *f,
} }
static void putrawstr(const char* str, int len, const upb_fielddef* f, static void putrawstr(const char* str, int len, const upb_fielddef* f,
upb_sink* sink, bool force_default) { upb_sink sink, bool force_default) {
upb_sink subsink; upb_sink subsink;
if (len == 0 && !force_default) return; if (len == 0 && !force_default) return;
...@@ -1593,11 +1537,11 @@ static void putrawstr(const char* str, int len, const upb_fielddef* f, ...@@ -1593,11 +1537,11 @@ static void putrawstr(const char* str, int len, const upb_fielddef* f,
} }
upb_sink_startstr(sink, getsel(f, UPB_HANDLER_STARTSTR), len, &subsink); upb_sink_startstr(sink, getsel(f, UPB_HANDLER_STARTSTR), len, &subsink);
upb_sink_putstring(&subsink, getsel(f, UPB_HANDLER_STRING), str, len, NULL); upb_sink_putstring(subsink, getsel(f, UPB_HANDLER_STRING), str, len, NULL);
upb_sink_endstr(sink, getsel(f, UPB_HANDLER_ENDSTR)); upb_sink_endstr(sink, getsel(f, UPB_HANDLER_ENDSTR));
} }
static void putsubmsg(zval* submsg_php, const upb_fielddef* f, upb_sink* sink, static void putsubmsg(zval* submsg_php, const upb_fielddef* f, upb_sink sink,
int depth, bool is_json TSRMLS_DC) { int depth, bool is_json TSRMLS_DC) {
if (Z_TYPE_P(submsg_php) == IS_NULL) return; if (Z_TYPE_P(submsg_php) == IS_NULL) return;
...@@ -1606,18 +1550,18 @@ static void putsubmsg(zval* submsg_php, const upb_fielddef* f, upb_sink* sink, ...@@ -1606,18 +1550,18 @@ static void putsubmsg(zval* submsg_php, const upb_fielddef* f, upb_sink* sink,
} }
static void putrawsubmsg(MessageHeader* submsg, const upb_fielddef* f, static void putrawsubmsg(MessageHeader* submsg, const upb_fielddef* f,
upb_sink* sink, int depth, bool is_json TSRMLS_DC) { upb_sink sink, int depth, bool is_json TSRMLS_DC) {
upb_sink subsink; upb_sink subsink;
Descriptor* subdesc = Descriptor* subdesc =
UNBOX_HASHTABLE_VALUE(Descriptor, get_def_obj(upb_fielddef_msgsubdef(f))); UNBOX_HASHTABLE_VALUE(Descriptor, get_def_obj(upb_fielddef_msgsubdef(f)));
upb_sink_startsubmsg(sink, getsel(f, UPB_HANDLER_STARTSUBMSG), &subsink); upb_sink_startsubmsg(sink, getsel(f, UPB_HANDLER_STARTSUBMSG), &subsink);
putrawmsg(submsg, subdesc, &subsink, depth + 1, is_json, true TSRMLS_CC); putrawmsg(submsg, subdesc, subsink, depth + 1, is_json, true TSRMLS_CC);
upb_sink_endsubmsg(sink, getsel(f, UPB_HANDLER_ENDSUBMSG)); upb_sink_endsubmsg(sink, getsel(f, UPB_HANDLER_ENDSUBMSG));
} }
static void putarray(zval* array, const upb_fielddef* f, upb_sink* sink, static void putarray(zval* array, const upb_fielddef* f, upb_sink sink,
int depth, bool is_json TSRMLS_DC) { int depth, bool is_json TSRMLS_DC) {
upb_sink subsink; upb_sink subsink;
upb_fieldtype_t type = upb_fielddef_type(f); upb_fieldtype_t type = upb_fielddef_type(f);
...@@ -1641,7 +1585,7 @@ static void putarray(zval* array, const upb_fielddef* f, upb_sink* sink, ...@@ -1641,7 +1585,7 @@ static void putarray(zval* array, const upb_fielddef* f, upb_sink* sink,
switch (type) { switch (type) {
#define T(upbtypeconst, upbtype, ctype) \ #define T(upbtypeconst, upbtype, ctype) \
case upbtypeconst: \ case upbtypeconst: \
upb_sink_put##upbtype(&subsink, sel, *((ctype*)memory)); \ upb_sink_put##upbtype(subsink, sel, *((ctype*)memory)); \
break; break;
T(UPB_TYPE_FLOAT, float, float) T(UPB_TYPE_FLOAT, float, float)
...@@ -1662,7 +1606,7 @@ static void putarray(zval* array, const upb_fielddef* f, upb_sink* sink, ...@@ -1662,7 +1606,7 @@ static void putarray(zval* array, const upb_fielddef* f, upb_sink* sink,
const char* rawstr = ZSTR_VAL(*(zend_string**)memory); const char* rawstr = ZSTR_VAL(*(zend_string**)memory);
int len = ZSTR_LEN(*(zend_string**)memory); int len = ZSTR_LEN(*(zend_string**)memory);
#endif #endif
putrawstr(rawstr, len, f, &subsink, putrawstr(rawstr, len, f, subsink,
is_json && is_wrapper_msg(upb_fielddef_containingtype(f))); is_json && is_wrapper_msg(upb_fielddef_containingtype(f)));
break; break;
} }
...@@ -1674,7 +1618,7 @@ static void putarray(zval* array, const upb_fielddef* f, upb_sink* sink, ...@@ -1674,7 +1618,7 @@ static void putarray(zval* array, const upb_fielddef* f, upb_sink* sink,
(MessageHeader*)((char*)(Z_OBJ_P((zval*)memory)) - (MessageHeader*)((char*)(Z_OBJ_P((zval*)memory)) -
XtOffsetOf(MessageHeader, std)); XtOffsetOf(MessageHeader, std));
#endif #endif
putrawsubmsg(submsg, f, &subsink, depth, is_json TSRMLS_CC); putrawsubmsg(submsg, f, subsink, depth, is_json TSRMLS_CC);
break; break;
} }
...@@ -1685,29 +1629,18 @@ static void putarray(zval* array, const upb_fielddef* f, upb_sink* sink, ...@@ -1685,29 +1629,18 @@ static void putarray(zval* array, const upb_fielddef* f, upb_sink* sink,
} }
static const upb_handlers* msgdef_pb_serialize_handlers(Descriptor* desc) { static const upb_handlers* msgdef_pb_serialize_handlers(Descriptor* desc) {
if (desc->pb_serialize_handlers == NULL) { return upb_handlercache_get(desc->pool->pb_serialize_handler_cache,
desc->pb_serialize_handlers = desc->msgdef);
upb_pb_encoder_newhandlers(desc->msgdef, &desc->pb_serialize_handlers);
}
return desc->pb_serialize_handlers;
} }
static const upb_handlers* msgdef_json_serialize_handlers( static const upb_handlers* msgdef_json_serialize_handlers(
Descriptor* desc, bool preserve_proto_fieldnames) { Descriptor* desc, bool preserve_proto_fieldnames) {
if (preserve_proto_fieldnames) { if (preserve_proto_fieldnames) {
if (desc->json_serialize_handlers == NULL) { return upb_handlercache_get(
desc->json_serialize_handlers = desc->pool->json_serialize_handler_preserve_cache, desc->msgdef);
upb_json_printer_newhandlers(
desc->msgdef, true, &desc->json_serialize_handlers);
}
return desc->json_serialize_handlers;
} else { } else {
if (desc->json_serialize_handlers_preserve == NULL) { return upb_handlercache_get(desc->pool->json_serialize_handler_cache,
desc->json_serialize_handlers_preserve = desc->msgdef);
upb_json_printer_newhandlers(
desc->msgdef, false, &desc->json_serialize_handlers_preserve);
}
return desc->json_serialize_handlers_preserve;
} }
} }
...@@ -1729,7 +1662,7 @@ void serialize_to_string(zval* val, zval* return_value TSRMLS_DC) { ...@@ -1729,7 +1662,7 @@ void serialize_to_string(zval* val, zval* return_value TSRMLS_DC) {
upb_pb_encoder* encoder; upb_pb_encoder* encoder;
stackenv_init(&se, "Error occurred during encoding: %s"); stackenv_init(&se, "Error occurred during encoding: %s");
encoder = upb_pb_encoder_create(&se.env, serialize_handlers, &sink.sink); encoder = upb_pb_encoder_create(se.arena, serialize_handlers, sink.sink);
putmsg(val, desc, upb_pb_encoder_input(encoder), 0, false TSRMLS_CC); putmsg(val, desc, upb_pb_encoder_input(encoder), 0, false TSRMLS_CC);
...@@ -1754,7 +1687,7 @@ void merge_from_string(const char* data, int data_len, Descriptor* desc, ...@@ -1754,7 +1687,7 @@ void merge_from_string(const char* data, int data_len, Descriptor* desc,
stackenv_init(&se, "Error occurred during parsing: %s"); stackenv_init(&se, "Error occurred during parsing: %s");
upb_sink_reset(&sink, h, msg); upb_sink_reset(&sink, h, msg);
decoder = upb_pbdecoder_create(&se.env, method, &sink); decoder = upb_pbdecoder_create(se.arena, method, sink, &se.status);
upb_bufsrc_putbuf(data, data_len, upb_pbdecoder_input(decoder)); upb_bufsrc_putbuf(data, data_len, upb_pbdecoder_input(decoder));
stackenv_uninit(&se); stackenv_uninit(&se);
...@@ -1796,7 +1729,7 @@ PHP_METHOD(Message, serializeToJsonString) { ...@@ -1796,7 +1729,7 @@ PHP_METHOD(Message, serializeToJsonString) {
stackenv se; stackenv se;
stackenv_init(&se, "Error occurred during encoding: %s"); stackenv_init(&se, "Error occurred during encoding: %s");
printer = upb_json_printer_create(&se.env, serialize_handlers, &sink.sink); printer = upb_json_printer_create(se.arena, serialize_handlers, sink.sink);
putmsg(getThis(), desc, upb_json_printer_input(printer), 0, true TSRMLS_CC); putmsg(getThis(), desc, upb_json_printer_input(printer), 0, true TSRMLS_CC);
...@@ -1837,8 +1770,8 @@ PHP_METHOD(Message, mergeFromJsonString) { ...@@ -1837,8 +1770,8 @@ PHP_METHOD(Message, mergeFromJsonString) {
stackenv_init(&se, "Error occurred during parsing: %s"); stackenv_init(&se, "Error occurred during parsing: %s");
upb_sink_reset(&sink, get_fill_handlers(desc), msg); upb_sink_reset(&sink, get_fill_handlers(desc), msg);
parser = upb_json_parser_create(&se.env, method, generated_pool->symtab, parser = upb_json_parser_create(se.arena, method, generated_pool->symtab,
&sink, ignore_json_unknown); sink, &se.status, ignore_json_unknown);
upb_bufsrc_putbuf(data, data_len, upb_json_parser_input(parser)); upb_bufsrc_putbuf(data, data_len, upb_json_parser_input(parser));
stackenv_uninit(&se); stackenv_uninit(&se);
......
...@@ -494,7 +494,7 @@ void Message_construct(zval* msg, zval* array_wrapper) { ...@@ -494,7 +494,7 @@ void Message_construct(zval* msg, zval* array_wrapper) {
ZVAL_OBJ(submsg, desc->klass->create_object(desc->klass TSRMLS_CC)); ZVAL_OBJ(submsg, desc->klass->create_object(desc->klass TSRMLS_CC));
Message_construct(submsg, NULL); Message_construct(submsg, NULL);
MessageHeader* to = UNBOX(MessageHeader, submsg); MessageHeader* to = UNBOX(MessageHeader, submsg);
const upb_filedef *file = upb_def_file(upb_msgdef_upcast(submsgdef)); const upb_filedef *file = upb_msgdef_file(submsgdef);
if (!strcmp(upb_filedef_name(file), "google/protobuf/wrappers.proto") && if (!strcmp(upb_filedef_name(file), "google/protobuf/wrappers.proto") &&
Z_TYPE_P(CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value)) != IS_OBJECT) { Z_TYPE_P(CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value)) != IS_OBJECT) {
const upb_fielddef *value_field = upb_msgdef_itof(submsgdef, 1); const upb_fielddef *value_field = upb_msgdef_itof(submsgdef, 1);
......
...@@ -763,7 +763,12 @@ PHP_METHOD(DescriptorPool, getEnumDescriptorByClassName); ...@@ -763,7 +763,12 @@ PHP_METHOD(DescriptorPool, getEnumDescriptorByClassName);
PHP_PROTO_WRAP_OBJECT_START(InternalDescriptorPool) PHP_PROTO_WRAP_OBJECT_START(InternalDescriptorPool)
upb_symtab* symtab; upb_symtab* symtab;
HashTable* pending_list; upb_handlercache* fill_handler_cache;
upb_handlercache* pb_serialize_handler_cache;
upb_handlercache* json_serialize_handler_cache;
upb_handlercache* json_serialize_handler_preserve_cache;
upb_pbcodecache* fill_method_cache;
upb_json_codecache* json_fill_method_cache;
PHP_PROTO_WRAP_OBJECT_END PHP_PROTO_WRAP_OBJECT_END
PHP_METHOD(InternalDescriptorPool, getGeneratedPool); PHP_METHOD(InternalDescriptorPool, getGeneratedPool);
...@@ -773,6 +778,7 @@ void internal_add_generated_file(const char* data, PHP_PROTO_SIZE data_len, ...@@ -773,6 +778,7 @@ void internal_add_generated_file(const char* data, PHP_PROTO_SIZE data_len,
InternalDescriptorPool* pool, InternalDescriptorPool* pool,
bool use_nested_submsg TSRMLS_DC); bool use_nested_submsg TSRMLS_DC);
void init_generated_pool_once(TSRMLS_D); void init_generated_pool_once(TSRMLS_D);
void add_handlers_for_message(const void* closure, upb_handlers* h);
// wrapper of generated pool // wrapper of generated pool
#if PHP_MAJOR_VERSION < 7 #if PHP_MAJOR_VERSION < 7
...@@ -789,15 +795,10 @@ void internal_descriptor_pool_free(zend_object* object); ...@@ -789,15 +795,10 @@ void internal_descriptor_pool_free(zend_object* object);
extern InternalDescriptorPool* generated_pool; // The actual generated pool extern InternalDescriptorPool* generated_pool; // The actual generated pool
PHP_PROTO_WRAP_OBJECT_START(Descriptor) PHP_PROTO_WRAP_OBJECT_START(Descriptor)
InternalDescriptorPool* pool;
const upb_msgdef* msgdef; const upb_msgdef* msgdef;
MessageLayout* layout; MessageLayout* layout;
zend_class_entry* klass; // begins as NULL zend_class_entry* klass; // begins as NULL
const upb_handlers* fill_handlers;
const upb_pbdecodermethod* fill_method;
const upb_json_parsermethod* json_fill_method;
const upb_handlers* pb_serialize_handlers;
const upb_handlers* json_serialize_handlers;
const upb_handlers* json_serialize_handlers_preserve;
PHP_PROTO_WRAP_OBJECT_END PHP_PROTO_WRAP_OBJECT_END
PHP_METHOD(Descriptor, getClass); PHP_METHOD(Descriptor, getClass);
...@@ -1168,7 +1169,7 @@ PHP_METHOD(RepeatedFieldIter, valid); ...@@ -1168,7 +1169,7 @@ PHP_METHOD(RepeatedFieldIter, valid);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
PHP_PROTO_WRAP_OBJECT_START(Oneof) PHP_PROTO_WRAP_OBJECT_START(Oneof)
upb_oneofdef* oneofdef; const upb_oneofdef* oneofdef;
int index; // Index of field in oneof. -1 if not set. int index; // Index of field in oneof. -1 if not set.
char value[NATIVE_SLOT_MAX_SIZE]; char value[NATIVE_SLOT_MAX_SIZE];
PHP_PROTO_WRAP_OBJECT_END PHP_PROTO_WRAP_OBJECT_END
......
...@@ -553,11 +553,11 @@ const zend_class_entry* field_type_class( ...@@ -553,11 +553,11 @@ const zend_class_entry* field_type_class(
const upb_fielddef* field PHP_PROTO_TSRMLS_DC) { const upb_fielddef* field PHP_PROTO_TSRMLS_DC) {
if (upb_fielddef_type(field) == UPB_TYPE_MESSAGE) { if (upb_fielddef_type(field) == UPB_TYPE_MESSAGE) {
Descriptor* desc = UNBOX_HASHTABLE_VALUE( Descriptor* desc = UNBOX_HASHTABLE_VALUE(
Descriptor, get_def_obj(upb_fielddef_subdef(field))); Descriptor, get_def_obj(upb_fielddef_msgsubdef(field)));
return desc->klass; return desc->klass;
} else if (upb_fielddef_type(field) == UPB_TYPE_ENUM) { } else if (upb_fielddef_type(field) == UPB_TYPE_ENUM) {
EnumDescriptor* desc = UNBOX_HASHTABLE_VALUE( EnumDescriptor* desc = UNBOX_HASHTABLE_VALUE(
EnumDescriptor, get_def_obj(upb_fielddef_subdef(field))); EnumDescriptor, get_def_obj(upb_fielddef_enumsubdef(field)));
return desc->klass; return desc->klass;
} }
return NULL; return NULL;
...@@ -742,16 +742,13 @@ MessageLayout* create_layout(const upb_msgdef* msgdef) { ...@@ -742,16 +742,13 @@ MessageLayout* create_layout(const upb_msgdef* msgdef) {
} }
layout->size = off; layout->size = off;
layout->msgdef = msgdef; layout->msgdef = msgdef;
upb_msgdef_ref(layout->msgdef, &layout->msgdef);
return layout; return layout;
} }
void free_layout(MessageLayout* layout) { void free_layout(MessageLayout* layout) {
FREE(layout->fields); FREE(layout->fields);
upb_msgdef_unref(layout->msgdef, &layout->msgdef);
FREE(layout); FREE(layout);
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -18,12 +18,12 @@ internal_build_cpp() { ...@@ -18,12 +18,12 @@ internal_build_cpp() {
./autogen.sh ./autogen.sh
./configure CXXFLAGS="-fPIC -std=c++11" # -fPIC is needed for python cpp test. ./configure CXXFLAGS="-fPIC -std=c++11" # -fPIC is needed for python cpp test.
# See python/setup.py for more details # See python/setup.py for more details
make -j4 make -j$(nproc)
} }
build_cpp() { build_cpp() {
internal_build_cpp internal_build_cpp
make check -j4 || (cat src/test-suite.log; false) make check -j$(nproc) || (cat src/test-suite.log; false)
cd conformance && make test_cpp && cd .. cd conformance && make test_cpp && cd ..
# The benchmark code depends on cmake, so test if it is installed before # The benchmark code depends on cmake, so test if it is installed before
...@@ -77,7 +77,7 @@ build_cpp_distcheck() { ...@@ -77,7 +77,7 @@ build_cpp_distcheck() {
fi fi
# Do the regular dist-check for C++. # Do the regular dist-check for C++.
make distcheck -j4 make distcheck -j$(nproc)
} }
build_csharp() { build_csharp() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment