diff options
Diffstat (limited to 'php/ext/google/protobuf')
-rw-r--r-- | php/ext/google/protobuf/def.c | 256 | ||||
-rw-r--r-- | php/ext/google/protobuf/encode_decode.c | 105 | ||||
-rw-r--r-- | php/ext/google/protobuf/map.c | 44 | ||||
-rw-r--r-- | php/ext/google/protobuf/message.c | 268 | ||||
-rw-r--r-- | php/ext/google/protobuf/package.xml | 86 | ||||
-rw-r--r-- | php/ext/google/protobuf/protobuf.c | 46 | ||||
-rw-r--r-- | php/ext/google/protobuf/protobuf.h | 44 | ||||
-rw-r--r-- | php/ext/google/protobuf/type_check.c | 7 | ||||
-rw-r--r-- | php/ext/google/protobuf/upb.c | 2015 | ||||
-rw-r--r-- | php/ext/google/protobuf/upb.h | 989 |
10 files changed, 3471 insertions, 389 deletions
diff --git a/php/ext/google/protobuf/def.c b/php/ext/google/protobuf/def.c index 13f7cdd6..fa33830b 100644 --- a/php/ext/google/protobuf/def.c +++ b/php/ext/google/protobuf/def.c @@ -249,9 +249,11 @@ PHP_METHOD(Descriptor, getField) { MAKE_STD_ZVAL(field_hashtable_value); ZVAL_OBJ(field_hashtable_value, field_descriptor_type->create_object( field_descriptor_type TSRMLS_CC)); + Z_DELREF_P(field_hashtable_value); #else field_hashtable_value = field_descriptor_type->create_object(field_descriptor_type TSRMLS_CC); + --GC_REFCOUNT(field_hashtable_value); #endif FieldDescriptor *field_php = UNBOX_HASHTABLE_VALUE(FieldDescriptor, field_hashtable_value); @@ -716,105 +718,187 @@ PHP_METHOD(InternalDescriptorPool, getGeneratedPool) { #endif } -static void classname_no_prefix(const char *fullname, const char *package_name, - char *class_name) { - size_t i = 0, j; - bool first_char = true, is_reserved = false; - size_t pkg_name_len = package_name == NULL ? 0 : strlen(package_name); - size_t message_name_start = package_name == NULL ? 0 : pkg_name_len + 1; - size_t message_len = (strlen(fullname) - message_name_start); +static size_t classname_len_max(const char *fullname, + const char *package, + const char *php_namespace, + const char *prefix) { + size_t fullname_len = strlen(fullname); + size_t package_len = 0; + size_t prefix_len = 0; + size_t namespace_len = 0; + size_t length = fullname_len; + int i, segment, classname_start = 0; + + if (package != NULL) { + package_len = strlen(package); + } + if (prefix != NULL) { + prefix_len = strlen(prefix); + } + if (php_namespace != NULL) { + namespace_len = strlen(php_namespace); + } - // Submessage is concatenated with its containing messages by '_'. - for (j = message_name_start; j < message_name_start + message_len; j++) { - if (fullname[j] == '.') { - class_name[i++] = '_'; - } else { - class_name[i++] = fullname[j]; + // Process package + if (package_len > 0) { + segment = 1; + for (i = 0; i < package_len; i++) { + if (package[i] == '.') { + segment++; + } } - } -} + // In case of reserved name in package. + length += 3 * segment; -static const char *classname_prefix(const char *classname, - const char *prefix_given, - const char *package_name) { - size_t i; - bool is_reserved = false; + classname_start = package_len + 1; + } - if (prefix_given != NULL && strcmp(prefix_given, "") != 0) { - return prefix_given; + // Process class name + segment = 1; + for (i = classname_start; i < fullname_len; i++) { + if (fullname[i] == '.') { + segment++; + } + } + if (prefix_len == 0) { + length += 3 * segment; + } else { + length += prefix_len * segment; } - char* lower = ALLOC_N(char, strlen(classname) + 1); - i = 0; - while(classname[i]) { - lower[i] = (char)tolower(classname[i]); + // The additional 2, one is for preceding '.' and the other is for trailing 0. + return length + namespace_len + 2; +} + +static bool is_reserved(const char *segment, int length) { + bool result; + char* lower = ALLOC_N(char, length + 1); + memset(lower, 0, length + 1); + memcpy(lower, segment, length); + int i = 0; + while(lower[i]) { + lower[i] = (char)tolower(lower[i]); i++; } - lower[i] = 0; - - is_reserved = is_reserved_name(lower); + lower[length] = 0; + result = is_reserved_name(lower); FREE(lower); + return result; +} - if (is_reserved) { - if (package_name != NULL && strcmp("google.protobuf", package_name) == 0) { - return "GPB"; - } else { - return "PB"; +static char* fill_prefix(const char *segment, int length, + const char *prefix_given, + const char *package_name, char *classname) { + size_t i; + + if (prefix_given != NULL && strcmp(prefix_given, "") != 0) { + size_t prefix_len = strlen(prefix_given); + memcpy(classname, prefix_given, strlen(prefix_given)); + classname += prefix_len; + } else { + if (is_reserved(segment, length)) { + if (package_name != NULL && + strcmp("google.protobuf", package_name) == 0) { + memcpy(classname, "GPB", 3); + classname += 3; + } else { + memcpy(classname, "PB", 2); + classname += 2; + } } } + return classname; +} - return ""; +static char* fill_segment(const char *segment, int length, + char *classname, bool use_camel) { + memcpy(classname, segment, length); + if (use_camel && (segment[0] < 'A' || segment[0] > 'Z')) { + classname[0] += 'A' - 'a'; + } + return classname + length; } -static void convert_to_class_name_inplace(const char *package, - const char *namespace_given, - const char *prefix, char *classname) { - size_t prefix_len = prefix == NULL ? 0 : strlen(prefix); - size_t classname_len = strlen(classname); - int i = 0, j; - bool first_char = true; +static char* fill_namespace(const char *package, const char *namespace_given, + char *classname) { + if (namespace_given != NULL) { + size_t namespace_len = strlen(namespace_given); + memcpy(classname, namespace_given, namespace_len); + classname += namespace_len; + *classname = '\\'; + classname++; + } else if (package != NULL) { + int i = 0, j, offset = 0; + size_t package_len = strlen(package); + while (i < package_len) { + j = i; + while (j < package_len && package[j] != '.') { + j++; + } + classname = fill_prefix(package + i, j - i, "", package, classname); + classname = fill_segment(package + i, j - i, classname, true); + classname[0] = '\\'; + classname++; + i = j + 1; + } + } + return classname; +} - size_t package_len = package == NULL ? 0 : strlen(package); - size_t namespace_given_len = - namespace_given == NULL ? 0 : strlen(namespace_given); - bool use_namespace_given = namespace_given != NULL; - size_t namespace_len = - use_namespace_given ? namespace_given_len : package_len; +static char* fill_classname(const char *fullname, + const char *package, + const char *namespace_given, + const char *prefix, char *classname) { + int classname_start = 0; + if (package != NULL) { + size_t package_len = strlen(package); + classname_start = package_len == 0 ? 0 : package_len + 1; + } + size_t fullname_len = strlen(fullname); + classname = fill_prefix(fullname + classname_start, + fullname_len - classname_start, + prefix, package, classname); + + int i = classname_start, j; + while (i < fullname_len) { + j = i; + while (j < fullname_len && fullname[j] != '.') { + j++; + } + classname = fill_segment(fullname + i, j - i, classname, false); + if (j != fullname_len) { + *classname = '_'; + classname++; + } + i = j + 1; + } + return classname; +} - int offset = namespace_len != 0 ? 2 : 0; +static char* fill_qualified_classname(const char *fullname, + const char *package, + const char *namespace_given, + const char *prefix, char *classname) { + classname = fill_namespace(package, namespace_given, classname); + return fill_classname(fullname, package, namespace_given, prefix, classname); +} - for (j = 0; j < classname_len; j++) { - classname[namespace_len + prefix_len + classname_len + offset - 1 - j] = - classname[classname_len - j - 1]; - } +static void classname_no_prefix(const char *fullname, const char *package_name, + char *class_name) { + size_t i = 0, j; + bool first_char = true, is_reserved = false; + size_t pkg_name_len = package_name == NULL ? 0 : strlen(package_name); + size_t message_name_start = package_name == NULL ? 0 : pkg_name_len + 1; + size_t message_len = (strlen(fullname) - message_name_start); - if (namespace_len != 0) { - classname[i++] = '\\'; - for (j = 0; j < namespace_len; j++) { - if (use_namespace_given) { - classname[i++] = namespace_given[j]; - continue; - } - // php packages are divided by '\'. - if (package[j] == '.') { - classname[i++] = '\\'; - first_char = true; - } else if (first_char) { - // PHP package uses camel case. - if (package[j] < 'A' || package[j] > 'Z') { - classname[i++] = package[j] + 'A' - 'a'; - } else { - classname[i++] = package[j]; - } - first_char = false; - } else { - classname[i++] = package[j]; - } + // Submessage is concatenated with its containing messages by '_'. + for (j = message_name_start; j < message_name_start + message_len; j++) { + if (fullname[j] == '.') { + class_name[i++] = '_'; + } else { + class_name[i++] = fullname[j]; } - classname[i++] = '\\'; } - - memcpy(classname + i, prefix, prefix_len); } void internal_add_generated_file(const char *data, PHP_PROTO_SIZE data_len, @@ -856,20 +940,14 @@ void internal_add_generated_file(const char *data, PHP_PROTO_SIZE data_len, * 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]); \ - size_t classname_len = strlen(fullname) + 5; \ - if (prefix_given != NULL) { \ - classname_len += strlen(prefix_given); \ - } \ - if (php_namespace != NULL) { \ - classname_len += strlen(php_namespace); \ - } \ + size_t classname_len = classname_len_max(fullname, package, \ + php_namespace, prefix_given); \ char *classname = ecalloc(sizeof(char), classname_len); \ - const char *package = upb_filedef_package(files[0]); \ - classname_no_prefix(fullname, package, classname); \ - const char *prefix = classname_prefix(classname, prefix_given, package); \ - convert_to_class_name_inplace(package, php_namespace, prefix, classname); \ + fill_qualified_classname(fullname, package, php_namespace, \ + prefix_given, classname); \ PHP_PROTO_CE_DECLARE pce; \ if (php_proto_zend_lookup_class(classname, strlen(classname), &pce) == \ FAILURE) { \ diff --git a/php/ext/google/protobuf/encode_decode.c b/php/ext/google/protobuf/encode_decode.c index 7e2b3ae6..a8c47f4d 100644 --- a/php/ext/google/protobuf/encode_decode.c +++ b/php/ext/google/protobuf/encode_decode.c @@ -484,11 +484,11 @@ static void map_slot_init(void* memory, upb_fieldtype_t type, zval* cache) { // Store zval** in memory in order to be consistent with the layout of // singular fields. zval** holder = ALLOC(zval*); + *(zval***)memory = holder; zval* tmp; MAKE_STD_ZVAL(tmp); PHP_PROTO_ZVAL_STRINGL(tmp, "", 0, 1); *holder = tmp; - *(zval***)memory = holder; #else *(zval**)memory = cache; PHP_PROTO_ZVAL_STRINGL(*(zval**)memory, "", 0, 1); @@ -521,7 +521,7 @@ static void map_slot_uninit(void* memory, upb_fieldtype_t type) { case UPB_TYPE_BYTES: { #if PHP_MAJOR_VERSION < 7 zval** holder = *(zval***)memory; - php_proto_zval_ptr_dtor(*holder); + zval_ptr_dtor(holder); FREE(holder); #else php_proto_zval_ptr_dtor(*(zval**)memory); @@ -1402,7 +1402,6 @@ static void putarray(zval* array, const upb_fielddef* f, upb_sink* sink, RepeatedField* intern = UNBOX(RepeatedField, array); HashTable *ht = PHP_PROTO_HASH_OF(intern->array); size = zend_hash_num_elements(ht); - // size = zend_hash_num_elements(PHP_PROTO_HASH_OF(intern->array)); if (size == 0) return; upb_sink_startseq(sink, getsel(f, UPB_HANDLER_STARTSEQ), &subsink); @@ -1614,3 +1613,103 @@ PHP_METHOD(Message, mergeFromJsonString) { stackenv_uninit(&se); } } + +// TODO(teboring): refactoring with putrawmsg +static void discard_unknown_fields(MessageHeader* msg) { + upb_msg_field_iter it; + + stringsink* unknown = DEREF(message_data(msg), 0, stringsink*); + if (unknown != NULL) { + stringsink_uninit(unknown); + FREE(unknown); + DEREF(message_data(msg), 0, stringsink*) = NULL; + } + + // Recursively discard unknown fields of submessages. + Descriptor* desc = msg->descriptor; + TSRMLS_FETCH(); + for (upb_msg_field_begin(&it, desc->msgdef); + !upb_msg_field_done(&it); + upb_msg_field_next(&it)) { + upb_fielddef* f = upb_msg_iter_field(&it); + uint32_t offset = desc->layout->fields[upb_fielddef_index(f)].offset; + bool containing_oneof = false; + + if (upb_fielddef_containingoneof(f)) { + uint32_t oneof_case_offset = + desc->layout->fields[upb_fielddef_index(f)].case_offset; + // For a oneof, check that this field is actually present -- skip all the + // below if not. + if (DEREF(message_data(msg), oneof_case_offset, uint32_t) != + upb_fielddef_number(f)) { + continue; + } + // Otherwise, fall through to the appropriate singular-field handler + // below. + containing_oneof = true; + } + + if (is_map_field(f)) { + MapIter map_it; + int len, size; + const upb_fielddef* value_field; + + value_field = map_field_value(f); + if (!upb_fielddef_issubmsg(value_field)) continue; + + zval* map_php = CACHED_PTR_TO_ZVAL_PTR( + DEREF(message_data(msg), offset, CACHED_VALUE*)); + if (map_php == NULL) continue; + + Map* intern = UNBOX(Map, map_php); + for (map_begin(map_php, &map_it TSRMLS_CC); + !map_done(&map_it); map_next(&map_it)) { + upb_value value = map_iter_value(&map_it, &len); + void* memory = raw_value(upb_value_memory(&value), value_field); +#if PHP_MAJOR_VERSION < 7 + MessageHeader *submsg = UNBOX(MessageHeader, *(zval**)memory); +#else + MessageHeader *submsg = + (MessageHeader*)((char*)(Z_OBJ_P((zval*)memory)) - + XtOffsetOf(MessageHeader, std)); +#endif + discard_unknown_fields(submsg); + } + } else if (upb_fielddef_isseq(f)) { + if (!upb_fielddef_issubmsg(f)) continue; + + zval* array_php = CACHED_PTR_TO_ZVAL_PTR( + DEREF(message_data(msg), offset, CACHED_VALUE*)); + if (array_php == NULL) continue; + + int size, i; + RepeatedField* intern = UNBOX(RepeatedField, array_php); + HashTable *ht = PHP_PROTO_HASH_OF(intern->array); + size = zend_hash_num_elements(ht); + if (size == 0) continue; + + for (i = 0; i < size; i++) { + void* memory = repeated_field_index_native(intern, i TSRMLS_CC); +#if PHP_MAJOR_VERSION < 7 + MessageHeader *submsg = UNBOX(MessageHeader, *(zval**)memory); +#else + MessageHeader *submsg = + (MessageHeader*)((char*)(Z_OBJ_P((zval*)memory)) - + XtOffsetOf(MessageHeader, std)); +#endif + discard_unknown_fields(submsg); + } + } else if (upb_fielddef_issubmsg(f)) { + zval* submsg_php = CACHED_PTR_TO_ZVAL_PTR( + DEREF(message_data(msg), offset, CACHED_VALUE*)); + if (Z_TYPE_P(submsg_php) == IS_NULL) continue; + MessageHeader* submsg = UNBOX(MessageHeader, submsg_php); + discard_unknown_fields(submsg); + } + } +} + +PHP_METHOD(Message, discardUnknownFields) { + MessageHeader* msg = UNBOX(MessageHeader, getThis()); + discard_unknown_fields(msg); +} diff --git a/php/ext/google/protobuf/map.c b/php/ext/google/protobuf/map.c index 2680b547..ab8a518a 100644 --- a/php/ext/google/protobuf/map.c +++ b/php/ext/google/protobuf/map.c @@ -293,13 +293,46 @@ static bool map_field_read_dimension(zval *object, zval *key, int type, } } +static bool map_index_unset(Map *intern, const char* keyval, int length) { + upb_value old_value; + if (upb_strtable_remove2(&intern->table, keyval, length, &old_value)) { + switch (intern->value_type) { + case UPB_TYPE_MESSAGE: { +#if PHP_MAJOR_VERSION < 7 + zval_ptr_dtor(upb_value_memory(&old_value)); +#else + zend_object* object = *(zend_object**)upb_value_memory(&old_value); + if(--GC_REFCOUNT(object) == 0) { + zend_objects_store_del(object); + } +#endif + break; + } + case UPB_TYPE_STRING: + case UPB_TYPE_BYTES: { +#if PHP_MAJOR_VERSION < 7 + zval_ptr_dtor(upb_value_memory(&old_value)); +#else + zend_string* object = *(zend_string**)upb_value_memory(&old_value); + zend_string_release(object); +#endif + break; + } + default: + break; + } + } +} + bool map_index_set(Map *intern, const char* keyval, int length, upb_value v) { // Replace any existing value by issuing a 'remove' operation first. - upb_strtable_remove2(&intern->table, keyval, length, NULL); + map_index_unset(intern, keyval, length); + if (!upb_strtable_insert2(&intern->table, keyval, length, v)) { zend_error(E_USER_ERROR, "Could not insert into table"); return false; } + return true; } @@ -326,12 +359,7 @@ static void map_field_write_dimension(zval *object, zval *key, v.ctype = UPB_CTYPE_UINT64; #endif - // Replace any existing value by issuing a 'remove' operation first. - upb_strtable_remove2(&intern->table, keyval, length, NULL); - if (!upb_strtable_insert2(&intern->table, keyval, length, v)) { - zend_error(E_USER_ERROR, "Could not insert into table"); - return; - } + map_index_set(intern, keyval, length, v); } static bool map_field_unset_dimension(zval *object, zval *key TSRMLS_DC) { @@ -348,7 +376,7 @@ static bool map_field_unset_dimension(zval *object, zval *key TSRMLS_DC) { v.ctype = UPB_CTYPE_UINT64; #endif - upb_strtable_remove2(&intern->table, keyval, length, &v); + map_index_unset(intern, keyval, length); return true; } diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index 3fce2c17..e28e42a1 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -29,7 +29,6 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <php.h> -#include <ext/date/php_date.h> #include <stdlib.h> #include "protobuf.h" @@ -42,6 +41,7 @@ static void hex_to_binary(const char* hex, char** binary, int* binary_len); static zend_function_entry message_methods[] = { PHP_ME(Message, clear, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Message, discardUnknownFields, NULL, ZEND_ACC_PUBLIC) PHP_ME(Message, serializeToString, NULL, ZEND_ACC_PUBLIC) PHP_ME(Message, mergeFromString, NULL, ZEND_ACC_PUBLIC) PHP_ME(Message, serializeToJsonString, NULL, ZEND_ACC_PUBLIC) @@ -222,7 +222,13 @@ static zval* message_get_property_ptr_ptr(zval* object, zval* member, int type, } static HashTable* message_get_properties(zval* object TSRMLS_DC) { - return NULL; + // User cannot get property directly (e.g., $a = $m->a) + zend_error(E_USER_ERROR, "Cannot access private properties."); +#if PHP_MAJOR_VERSION < 7 + return zend_std_get_properties(object TSRMLS_CC); +#else + return zend_std_get_properties(object); +#endif } static HashTable* message_get_gc(zval* object, CACHED_VALUE** table, @@ -276,15 +282,118 @@ void build_class_from_descriptor( // PHP Methods // ----------------------------------------------------------------------------- +void Message_construct(zval* msg, zval* array_wrapper) { + zend_class_entry* ce = Z_OBJCE_P(msg); + MessageHeader* intern = NULL; + if (EXPECTED(class_added(ce))) { + intern = UNBOX(MessageHeader, msg); + custom_data_init(ce, intern PHP_PROTO_TSRMLS_CC); + } + + if (array_wrapper == NULL) { + return; + } + + HashTable* array = Z_ARRVAL_P(array_wrapper); + HashPosition pointer; + zval key; + void* value; + const upb_fielddef* field; + + for (zend_hash_internal_pointer_reset_ex(array, &pointer); + php_proto_zend_hash_get_current_data_ex(array, (void**)&value, + &pointer) == SUCCESS; + zend_hash_move_forward_ex(array, &pointer)) { + zend_hash_get_current_key_zval_ex(array, &key, &pointer); + field = upb_msgdef_ntofz(intern->descriptor->msgdef, Z_STRVAL_P(&key)); + if (field == NULL) { + zend_error(E_USER_ERROR, "Unknown field: %s", Z_STRVAL_P(&key)); + } + if (upb_fielddef_ismap(field)) { + PHP_PROTO_FAKE_SCOPE_BEGIN(Z_OBJCE_P(msg)); + zval* submap = message_get_property_internal(msg, &key TSRMLS_CC); + PHP_PROTO_FAKE_SCOPE_END; + HashTable* subtable = HASH_OF( + CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value)); + HashPosition subpointer; + zval subkey; + void* memory; + for (zend_hash_internal_pointer_reset_ex(subtable, &subpointer); + php_proto_zend_hash_get_current_data_ex(subtable, (void**)&memory, + &subpointer) == SUCCESS; + zend_hash_move_forward_ex(subtable, &subpointer)) { + zend_hash_get_current_key_zval_ex(subtable, &subkey, &subpointer); + map_field_handlers->write_dimension( + submap, &subkey, + CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)memory) TSRMLS_CC); + zval_dtor(&subkey); + } + } else if (upb_fielddef_isseq(field)) { + PHP_PROTO_FAKE_SCOPE_BEGIN(Z_OBJCE_P(msg)); + zval* subarray = message_get_property_internal(msg, &key TSRMLS_CC); + PHP_PROTO_FAKE_SCOPE_END; + HashTable* subtable = HASH_OF( + CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value)); + HashPosition subpointer; + void* memory; + for (zend_hash_internal_pointer_reset_ex(subtable, &subpointer); + php_proto_zend_hash_get_current_data_ex(subtable, (void**)&memory, + &subpointer) == SUCCESS; + zend_hash_move_forward_ex(subtable, &subpointer)) { + repeated_field_handlers->write_dimension( + subarray, NULL, + CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)memory) TSRMLS_CC); + } + } else if (upb_fielddef_issubmsg(field)) { + const upb_msgdef* submsgdef = upb_fielddef_msgsubdef(field); + PHP_PROTO_HASHTABLE_VALUE desc_php = get_def_obj(submsgdef); + Descriptor* desc = UNBOX_HASHTABLE_VALUE(Descriptor, desc_php); + zend_property_info* property_info; + PHP_PROTO_FAKE_SCOPE_BEGIN(Z_OBJCE_P(msg)); +#if PHP_MAJOR_VERSION < 7 + property_info = + zend_get_property_info(Z_OBJCE_P(msg), &key, true TSRMLS_CC); +#else + property_info = + zend_get_property_info(Z_OBJCE_P(msg), Z_STR_P(&key), true); +#endif + PHP_PROTO_FAKE_SCOPE_END; + CACHED_VALUE* cached = OBJ_PROP(Z_OBJ_P(msg), property_info->offset); +#if PHP_MAJOR_VERSION < 7 + SEPARATE_ZVAL_IF_NOT_REF(cached); +#endif + zval* submsg = CACHED_PTR_TO_ZVAL_PTR(cached); + ZVAL_OBJ(submsg, desc->klass->create_object(desc->klass TSRMLS_CC)); + Message_construct(submsg, NULL); + MessageHeader* from = UNBOX(MessageHeader, + CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value)); + MessageHeader* to = UNBOX(MessageHeader, submsg); + if(from->descriptor != to->descriptor) { + zend_error(E_USER_ERROR, "Cannot merge messages with different class."); + return; + } + + layout_merge(from->descriptor->layout, from, to TSRMLS_CC); + } else { + message_set_property_internal(msg, &key, + CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value) TSRMLS_CC); + } + zval_dtor(&key); + } +} + // At the first time the message is created, the class entry hasn't been // modified. As a result, the first created instance will be a normal zend // object. Here, we manually modify it to our message in such a case. PHP_METHOD(Message, __construct) { - zend_class_entry* ce = Z_OBJCE_P(getThis()); - if (EXPECTED(class_added(ce))) { - MessageHeader* intern = UNBOX(MessageHeader, getThis()); - custom_data_init(ce, intern PHP_PROTO_TSRMLS_CC); + // Init message with array + zval* array_wrapper = NULL; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + "|a!", &array_wrapper) == FAILURE) { + return; } + + Message_construct(getThis(), array_wrapper); } PHP_METHOD(Message, clear) { @@ -292,7 +401,9 @@ PHP_METHOD(Message, clear) { Descriptor* desc = msg->descriptor; zend_class_entry* ce = desc->klass; + zend_object_std_dtor(&msg->std TSRMLS_CC); object_properties_init(&msg->std, ce); + layout_init(desc->layout, message_data(msg), &msg->std TSRMLS_CC); } @@ -378,6 +489,7 @@ PHP_METHOD(Message, whichOneof) { PHP_PROTO_FAKE_SCOPE_BEGIN(LOWER_CLASS##_type); \ zval* value = message_get_property_internal(getThis(), &member TSRMLS_CC); \ PHP_PROTO_FAKE_SCOPE_END; \ + zval_dtor(&member); \ PHP_PROTO_RETVAL_ZVAL(value); \ } \ PHP_METHOD(UPPER_CLASS, set##UPPER_FIELD) { \ @@ -389,6 +501,7 @@ PHP_METHOD(Message, whichOneof) { zval member; \ PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \ message_set_property_internal(getThis(), &member, value TSRMLS_CC); \ + zval_dtor(&member); \ PHP_PROTO_RETVAL_ZVAL(getThis()); \ } @@ -401,6 +514,7 @@ PHP_METHOD(Message, whichOneof) { message_get_oneof_property_internal(getThis(), &member, \ return_value TSRMLS_CC); \ PHP_PROTO_FAKE_SCOPE_END; \ + zval_dtor(&member); \ } \ PHP_METHOD(UPPER_CLASS, set##UPPER_FIELD) { \ zval* value = NULL; \ @@ -411,6 +525,7 @@ PHP_METHOD(Message, whichOneof) { zval member; \ PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \ message_set_property_internal(getThis(), &member, value TSRMLS_CC); \ + zval_dtor(&member); \ PHP_PROTO_RETVAL_ZVAL(getThis()); \ } @@ -441,8 +556,7 @@ static void init_file_wrappers(TSRMLS_D); // Define file init functions static void init_file_any(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_any) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0acd010a19676f6f676c652f70726f746f6275662f616e792e70726f746f" @@ -457,12 +571,11 @@ static void init_file_any(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_any = true; } static void init_file_api(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_api) return; init_file_source_context(TSRMLS_C); init_file_type(TSRMLS_C); init_generated_pool_once(TSRMLS_C); @@ -498,12 +611,11 @@ static void init_file_api(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_api = true; } static void init_file_duration(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_duration) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0ae3010a1e676f6f676c652f70726f746f6275662f6475726174696f6e2e" @@ -519,12 +631,11 @@ static void init_file_duration(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_duration = true; } static void init_file_field_mask(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_field_mask) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0ae3010a20676f6f676c652f70726f746f6275662f6669656c645f6d6173" @@ -540,12 +651,11 @@ static void init_file_field_mask(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_field_mask = true; } static void init_file_empty(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_empty) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0ab7010a1b676f6f676c652f70726f746f6275662f656d7074792e70726f" @@ -560,12 +670,11 @@ static void init_file_empty(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_empty = true; } static void init_file_source_context(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_source_context) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0afb010a24676f6f676c652f70726f746f6275662f736f757263655f636f" @@ -582,12 +691,11 @@ static void init_file_source_context(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_source_context = true; } static void init_file_struct(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_struct) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0a81050a1c676f6f676c652f70726f746f6275662f7374727563742e7072" @@ -617,12 +725,11 @@ static void init_file_struct(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_struct = true; } static void init_file_timestamp(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_timestamp) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0ae7010a1f676f6f676c652f70726f746f6275662f74696d657374616d70" @@ -638,12 +745,11 @@ static void init_file_timestamp(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_timestamp = true; } static void init_file_type(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_type) return; init_file_any(TSRMLS_C); init_file_source_context(TSRMLS_C); init_generated_pool_once(TSRMLS_C); @@ -707,12 +813,11 @@ static void init_file_type(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_type = true; } static void init_file_wrappers(TSRMLS_D) { - static bool is_initialized = false; - if (is_initialized) return; + if (is_inited_file_wrappers) return; init_generated_pool_once(TSRMLS_C); const char* generated_file = "0abf030a1e676f6f676c652f70726f746f6275662f77726170706572732e" @@ -735,7 +840,7 @@ static void init_file_wrappers(TSRMLS_D) { hex_to_binary(generated_file, &binary, &binary_len); internal_add_generated_file(binary, binary_len, generated_pool TSRMLS_CC); FREE(binary); - is_initialized = true; + is_inited_file_wrappers = true; } // ----------------------------------------------------------------------------- @@ -753,7 +858,7 @@ static zend_function_entry field_cardinality_methods[] = { zend_class_entry* field_cardinality_type; // Init class entry. -PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\Field_Cardinality", +PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\Field\\Cardinality", Field_Cardinality, field_cardinality) zend_declare_class_constant_long(field_cardinality_type, "CARDINALITY_UNKNOWN", 19, 0 TSRMLS_CC); @@ -763,6 +868,8 @@ PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\Field_Cardinality", "CARDINALITY_REQUIRED", 20, 2 TSRMLS_CC); zend_declare_class_constant_long(field_cardinality_type, "CARDINALITY_REPEATED", 20, 3 TSRMLS_CC); + const char *alias = "Google\\Protobuf\\Field_Cardinality"; + zend_register_class_alias_ex(alias, strlen(alias), field_cardinality_type TSRMLS_CC); PHP_PROTO_INIT_ENUMCLASS_END // ----------------------------------------------------------------------------- @@ -776,7 +883,7 @@ static zend_function_entry field_kind_methods[] = { zend_class_entry* field_kind_type; // Init class entry. -PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\Field_Kind", +PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\Field\\Kind", Field_Kind, field_kind) zend_declare_class_constant_long(field_kind_type, "TYPE_UNKNOWN", 12, 0 TSRMLS_CC); @@ -816,6 +923,8 @@ PHP_PROTO_INIT_ENUMCLASS_START("Google\\Protobuf\\Field_Kind", "TYPE_SINT32", 11, 17 TSRMLS_CC); zend_declare_class_constant_long(field_kind_type, "TYPE_SINT64", 11, 18 TSRMLS_CC); + const char *alias = "Google\\Protobuf\\Field_Kind"; + zend_register_class_alias_ex(alias, strlen(alias), field_kind_type TSRMLS_CC); PHP_PROTO_INIT_ENUMCLASS_END // ----------------------------------------------------------------------------- @@ -924,6 +1033,7 @@ PHP_METHOD(Any, unpack) { PHP_PROTO_FAKE_SCOPE_BEGIN(any_type); zval* type_url_php = php_proto_message_read_property( getThis(), &type_url_member PHP_PROTO_TSRMLS_CC); + zval_dtor(&type_url_member); PHP_PROTO_FAKE_SCOPE_END; // Get fully-qualified name from type url. @@ -934,7 +1044,7 @@ PHP_METHOD(Any, unpack) { if (url_prefix_len > type_url_len || strncmp(TYPE_URL_PREFIX, type_url, url_prefix_len) != 0) { zend_throw_exception( - NULL, "Type url needs to be type.googleapis.com/fully-qulified", + NULL, "Type url needs to be type.googleapis.com/fully-qualified", 0 TSRMLS_CC); return; } @@ -959,6 +1069,7 @@ PHP_METHOD(Any, unpack) { PHP_PROTO_FAKE_SCOPE_RESTART(any_type); zval* value = php_proto_message_read_property( getThis(), &value_member PHP_PROTO_TSRMLS_CC); + zval_dtor(&value_member); PHP_PROTO_FAKE_SCOPE_END; merge_from_string(Z_STRVAL_P(value), Z_STRLEN_P(value), desc, msg); @@ -987,6 +1098,8 @@ PHP_METHOD(Any, pack) { PHP_PROTO_FAKE_SCOPE_BEGIN(any_type); message_handlers->write_property(getThis(), &member, &data, NULL PHP_PROTO_TSRMLS_CC); + zval_dtor(&data); + zval_dtor(&member); PHP_PROTO_FAKE_SCOPE_END; // Set type url. @@ -1004,6 +1117,8 @@ PHP_METHOD(Any, pack) { PHP_PROTO_FAKE_SCOPE_RESTART(any_type); message_handlers->write_property(getThis(), &member, &type_url_php, NULL PHP_PROTO_TSRMLS_CC); + zval_dtor(&type_url_php); + zval_dtor(&member); PHP_PROTO_FAKE_SCOPE_END; FREE(type_url); } @@ -1036,6 +1151,7 @@ PHP_METHOD(Any, is) { PHP_PROTO_FAKE_SCOPE_BEGIN(any_type); zval* value = php_proto_message_read_property(getThis(), &member PHP_PROTO_TSRMLS_CC); + zval_dtor(&member); PHP_PROTO_FAKE_SCOPE_END; // Compare two type url. @@ -1119,17 +1235,41 @@ PHP_METHOD(Timestamp, fromDateTime) { zval* datetime; zval member; + PHP_PROTO_CE_DECLARE date_interface_ce; + if (php_proto_zend_lookup_class("\\DatetimeInterface", 18, + &date_interface_ce) == FAILURE) { + zend_error(E_ERROR, "Make sure date extension is enabled."); + return; + } + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &datetime, - php_date_get_date_ce()) == FAILURE) { + PHP_PROTO_CE_UNREF(date_interface_ce)) == FAILURE) { + zend_error(E_USER_ERROR, "Expect DatetimeInterface."); return; } - php_date_obj* dateobj = UNBOX(php_date_obj, datetime); - if (!dateobj->time->sse_uptodate) { - timelib_update_ts(dateobj->time, NULL); + // Get timestamp from Datetime object. + zval retval; + zval function_name; + int64_t timestamp; + +#if PHP_MAJOR_VERSION < 7 + INIT_ZVAL(retval); + INIT_ZVAL(function_name); +#endif + + PHP_PROTO_ZVAL_STRING(&function_name, "date_timestamp_get", 1); + + if (call_user_function(EG(function_table), NULL, &function_name, &retval, 1, + ZVAL_PTR_TO_CACHED_PTR(datetime) TSRMLS_CC) == FAILURE) { + zend_error(E_ERROR, "Cannot get timestamp from DateTime."); + return; } - int64_t timestamp = dateobj->time->sse; + protobuf_convert_to_int64(&retval, ×tamp); + + zval_dtor(&retval); + zval_dtor(&function_name); // Set seconds MessageHeader* self = UNBOX(MessageHeader, getThis()); @@ -1137,20 +1277,18 @@ PHP_METHOD(Timestamp, fromDateTime) { upb_msgdef_ntofz(self->descriptor->msgdef, "seconds"); void* storage = message_data(self); void* memory = slot_memory(self->descriptor->layout, storage, field); - *(int64_t*)memory = dateobj->time->sse; + *(int64_t*)memory = timestamp; // Set nanos field = upb_msgdef_ntofz(self->descriptor->msgdef, "nanos"); storage = message_data(self); memory = slot_memory(self->descriptor->layout, storage, field); *(int32_t*)memory = 0; + + RETURN_NULL(); } PHP_METHOD(Timestamp, toDateTime) { - zval datetime; - php_date_instantiate(php_date_get_date_ce(), &datetime TSRMLS_CC); - php_date_obj* dateobj = UNBOX(php_date_obj, &datetime); - // Get seconds MessageHeader* self = UNBOX(MessageHeader, getThis()); const upb_fielddef* field = @@ -1171,14 +1309,38 @@ PHP_METHOD(Timestamp, toDateTime) { strftime(formated_time, sizeof(formated_time), "%Y-%m-%dT%H:%M:%SUTC", utc_time); - if (!php_date_initialize(dateobj, formated_time, strlen(formated_time), NULL, - NULL, 0 TSRMLS_CC)) { - zval_dtor(&datetime); - RETURN_NULL(); + // Create Datetime object. + zval datetime; + zval formated_time_php; + zval function_name; + int64_t timestamp = 0; + +#if PHP_MAJOR_VERSION < 7 + INIT_ZVAL(function_name); + INIT_ZVAL(formated_time_php); +#endif + + PHP_PROTO_ZVAL_STRING(&function_name, "date_create", 1); + PHP_PROTO_ZVAL_STRING(&formated_time_php, formated_time, 1); + + CACHED_VALUE params[1] = {ZVAL_TO_CACHED_VALUE(formated_time_php)}; + + if (call_user_function(EG(function_table), NULL, + &function_name, &datetime, 1, + params TSRMLS_CC) == FAILURE) { + zend_error(E_ERROR, "Cannot create DateTime."); + return; } + zval_dtor(&formated_time_php); + zval_dtor(&function_name); + +#if PHP_MAJOR_VERSION < 7 zval* datetime_ptr = &datetime; PHP_PROTO_RETVAL_ZVAL(datetime_ptr); +#else + ZVAL_OBJ(return_value, Z_OBJ(datetime)); +#endif } // ----------------------------------------------------------------------------- diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml index 4a473801..28d713f3 100644 --- a/php/ext/google/protobuf/package.xml +++ b/php/ext/google/protobuf/package.xml @@ -10,11 +10,11 @@ <email>protobuf-opensource@google.com</email> <active>yes</active> </lead> - <date>2017-09-14</date> + <date>2018-06-06</date> <time>11:02:07</time> <version> - <release>3.4.1</release> - <api>3.4.1</api> + <release>3.6.0</release> + <api>3.6.0</api> </version> <stability> <release>stable</release> @@ -168,5 +168,85 @@ GA release. GA release. </notes> </release> + <release> + <version> + <release>3.5.0</release> + <api>3.5.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <date>2017-11-15</date> + <time>11:02:07</time> + <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license> + <notes> +GA release. + </notes> + </release> + <release> + <version> + <release>3.5.0.1</release> + <api>3.5.0.1</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <date>2017-12-06</date> + <time>11:02:07</time> + <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license> + <notes> +GA release. + </notes> + </release> + <release> + <version> + <release>3.5.1</release> + <api>3.5.1</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <date>2017-12-11</date> + <time>11:02:07</time> + <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license> + <notes> +GA release. + </notes> + </release> + <release> + <version> + <release>3.5.2</release> + <api>3.5.2</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <date>2018-03-06</date> + <time>11:02:07</time> + <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license> + <notes> +G A release. + </notes> + </release> + <release> + <version> + <release>3.6.0</release> + <api>3.6.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <date>2018-06-06</date> + <time>11:02:07</time> + <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license> + <notes> +G A release. + </notes> + </release> </changelog> </package> diff --git a/php/ext/google/protobuf/protobuf.c b/php/ext/google/protobuf/protobuf.c index 265d636e..da00302f 100644 --- a/php/ext/google/protobuf/protobuf.c +++ b/php/ext/google/protobuf/protobuf.c @@ -145,6 +145,21 @@ PHP_PROTO_HASHTABLE_VALUE get_proto_obj(const char* proto) { } // ----------------------------------------------------------------------------- +// Well Known Types. +// ----------------------------------------------------------------------------- + +bool is_inited_file_any; +bool is_inited_file_api; +bool is_inited_file_duration; +bool is_inited_file_field_mask; +bool is_inited_file_empty; +bool is_inited_file_source_context; +bool is_inited_file_struct; +bool is_inited_file_timestamp; +bool is_inited_file_type; +bool is_inited_file_wrappers; + +// ----------------------------------------------------------------------------- // Reserved Name. // ----------------------------------------------------------------------------- @@ -182,8 +197,15 @@ zend_function_entry protobuf_functions[] = { ZEND_FE_END }; +static const zend_module_dep protobuf_deps[] = { + ZEND_MOD_OPTIONAL("date") + ZEND_MOD_END +}; + zend_module_entry protobuf_module_entry = { - STANDARD_MODULE_HEADER, + STANDARD_MODULE_HEADER_EX, + NULL, + protobuf_deps, PHP_PROTOBUF_EXTNAME, // extension name protobuf_functions, // function list PHP_MINIT(protobuf), // process startup @@ -243,6 +265,17 @@ static PHP_RINIT_FUNCTION(protobuf) { generated_pool_php = NULL; internal_generated_pool_php = NULL; + is_inited_file_any = false; + is_inited_file_api = false; + is_inited_file_duration = false; + is_inited_file_field_mask = false; + is_inited_file_empty = false; + is_inited_file_source_context = false; + is_inited_file_struct = false; + is_inited_file_timestamp = false; + is_inited_file_type = false; + is_inited_file_wrappers = false; + return 0; } @@ -281,6 +314,17 @@ static PHP_RSHUTDOWN_FUNCTION(protobuf) { } #endif + is_inited_file_any = true; + is_inited_file_api = true; + is_inited_file_duration = true; + is_inited_file_field_mask = true; + is_inited_file_empty = true; + is_inited_file_source_context = true; + is_inited_file_struct = true; + is_inited_file_timestamp = true; + is_inited_file_type = true; + is_inited_file_wrappers = true; + return 0; } diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 18343772..20035ab7 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -37,7 +37,7 @@ #include "upb.h" #define PHP_PROTOBUF_EXTNAME "protobuf" -#define PHP_PROTOBUF_VERSION "3.4.1" +#define PHP_PROTOBUF_VERSION "3.6.0" #define MAX_LENGTH_OF_INT64 20 #define SIZEOF_INT64 8 @@ -182,6 +182,8 @@ #define CACHED_TO_ZVAL_PTR(VALUE) (VALUE) #define CACHED_PTR_TO_ZVAL_PTR(VALUE) (*VALUE) #define ZVAL_PTR_TO_CACHED_PTR(VALUE) (&VALUE) +#define ZVAL_PTR_TO_CACHED_VALUE(VALUE) (VALUE) +#define ZVAL_TO_CACHED_VALUE(VALUE) (&VALUE) #define CREATE_OBJ_ON_ALLOCATED_ZVAL_PTR(zval_ptr, class_type) \ ZVAL_OBJ(zval_ptr, class_type->create_object(class_type TSRMLS_CC)); @@ -452,6 +454,8 @@ static inline int php_proto_zend_hash_get_current_data_ex(HashTable* ht, #define CACHED_TO_ZVAL_PTR(VALUE) (&VALUE) #define CACHED_PTR_TO_ZVAL_PTR(VALUE) (VALUE) #define ZVAL_PTR_TO_CACHED_PTR(VALUE) (VALUE) +#define ZVAL_PTR_TO_CACHED_VALUE(VALUE) (*VALUE) +#define ZVAL_TO_CACHED_VALUE(VALUE) (VALUE) #define CREATE_OBJ_ON_ALLOCATED_ZVAL_PTR(zval_ptr, class_type) \ ZVAL_OBJ(zval_ptr, class_type->create_object(class_type)); @@ -608,48 +612,36 @@ typedef struct Api Api; typedef struct BoolValue BoolValue; typedef struct BytesValue BytesValue; typedef struct Descriptor Descriptor; -typedef struct Descriptor Descriptor; typedef struct DescriptorPool DescriptorPool; typedef struct DoubleValue DoubleValue; typedef struct Duration Duration; -typedef struct Enum Enum; typedef struct EnumDescriptor EnumDescriptor; -typedef struct EnumDescriptor EnumDescriptor; -typedef struct EnumValue EnumValue; -typedef struct EnumValueDescriptor EnumValueDescriptor; +typedef struct Enum Enum; typedef struct EnumValueDescriptor EnumValueDescriptor; -typedef struct Field Field; -typedef struct FieldDescriptor FieldDescriptor; -typedef struct FieldDescriptor FieldDescriptor; -typedef struct FieldMask FieldMask; +typedef struct EnumValue EnumValue; typedef struct Field_Cardinality Field_Cardinality; +typedef struct FieldDescriptor FieldDescriptor; +typedef struct Field Field; typedef struct Field_Kind Field_Kind; +typedef struct FieldMask FieldMask; typedef struct FloatValue FloatValue; typedef struct GPBEmpty GPBEmpty; typedef struct Int32Value Int32Value; typedef struct Int64Value Int64Value; typedef struct InternalDescriptorPool InternalDescriptorPool; typedef struct ListValue ListValue; -typedef struct Map Map; -typedef struct Map Map; typedef struct MapIter MapIter; -typedef struct MapIter MapIter; -typedef struct MessageField MessageField; +typedef struct Map Map; typedef struct MessageField MessageField; typedef struct MessageHeader MessageHeader; -typedef struct MessageHeader MessageHeader; -typedef struct MessageLayout MessageLayout; typedef struct MessageLayout MessageLayout; typedef struct Method Method; typedef struct Mixin Mixin; typedef struct NullValue NullValue; typedef struct Oneof Oneof; -typedef struct Oneof Oneof; typedef struct Option Option; -typedef struct RepeatedField RepeatedField; -typedef struct RepeatedField RepeatedField; -typedef struct RepeatedFieldIter RepeatedFieldIter; typedef struct RepeatedFieldIter RepeatedFieldIter; +typedef struct RepeatedField RepeatedField; typedef struct SourceContext SourceContext; typedef struct StringValue StringValue; typedef struct Struct Struct; @@ -969,6 +961,7 @@ PHP_METHOD(Message, serializeToString); PHP_METHOD(Message, mergeFromString); PHP_METHOD(Message, serializeToJsonString); PHP_METHOD(Message, mergeFromJsonString); +PHP_METHOD(Message, discardUnknownFields); // ----------------------------------------------------------------------------- // Type check / conversion. @@ -1179,6 +1172,17 @@ extern zend_class_entry* oneof_descriptor_type; // Well Known Type. // ----------------------------------------------------------------------------- +extern bool is_inited_file_any; +extern bool is_inited_file_api; +extern bool is_inited_file_duration; +extern bool is_inited_file_field_mask; +extern bool is_inited_file_empty; +extern bool is_inited_file_source_context; +extern bool is_inited_file_struct; +extern bool is_inited_file_timestamp; +extern bool is_inited_file_type; +extern bool is_inited_file_wrappers; + PHP_METHOD(GPBMetadata_Any, initOnce); PHP_METHOD(GPBMetadata_Api, initOnce); PHP_METHOD(GPBMetadata_Duration, initOnce); diff --git a/php/ext/google/protobuf/type_check.c b/php/ext/google/protobuf/type_check.c index f588774c..85f5051e 100644 --- a/php/ext/google/protobuf/type_check.c +++ b/php/ext/google/protobuf/type_check.c @@ -461,8 +461,7 @@ void check_repeated_field(const zend_class_entry* klass, PHP_PROTO_LONG type, CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)memory) TSRMLS_CC); } - Z_DELREF_P(CACHED_TO_ZVAL_PTR(repeated_field)); - RETURN_ZVAL(CACHED_TO_ZVAL_PTR(repeated_field), 1, 0); + RETURN_ZVAL(CACHED_TO_ZVAL_PTR(repeated_field), 1, 1); } else if (Z_TYPE_P(val) == IS_OBJECT) { if (!instanceof_function(Z_OBJCE_P(val), repeated_field_type TSRMLS_CC)) { @@ -533,10 +532,10 @@ void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type, map_field_handlers->write_dimension( CACHED_TO_ZVAL_PTR(map_field), &key, CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value) TSRMLS_CC); + zval_dtor(&key); } - Z_DELREF_P(CACHED_TO_ZVAL_PTR(map_field)); - RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 0); + RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 1); } else if (Z_TYPE_P(val) == IS_OBJECT) { if (!instanceof_function(Z_OBJCE_P(val), map_field_type TSRMLS_CC)) { zend_error(E_USER_ERROR, "Given value is not an instance of %s.", diff --git a/php/ext/google/protobuf/upb.c b/php/ext/google/protobuf/upb.c index c02a5ce4..e01f3bfd 100644 --- a/php/ext/google/protobuf/upb.c +++ b/php/ext/google/protobuf/upb.c @@ -1,9 +1,1908 @@ // Amalgamated source file #include "upb.h" +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * google/protobuf/descriptor.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#include <stddef.h> + + +struct google_protobuf_FileDescriptorSet { + upb_array* file; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_FileDescriptorSet_submsgs[1] = { + &google_protobuf_FileDescriptorProto_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_FileDescriptorSet__fields[1] = { + {1, offsetof(google_protobuf_FileDescriptorSet, file), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_FileDescriptorSet_msginit = { + &google_protobuf_FileDescriptorSet_submsgs[0], + &google_protobuf_FileDescriptorSet__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_FileDescriptorSet), 1, 0, false, true +}; + +google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_env *env) { + google_protobuf_FileDescriptorSet *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_FileDescriptorSet *msg = google_protobuf_FileDescriptorSet_new(env); + if (upb_decode(buf, msg, &google_protobuf_FileDescriptorSet_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_FileDescriptorSet_serialize(google_protobuf_FileDescriptorSet *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_FileDescriptorSet_msginit, env, size); +} +const upb_array* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet *msg) { + return msg->file; +} +void google_protobuf_FileDescriptorSet_set_file(google_protobuf_FileDescriptorSet *msg, upb_array* value) { + msg->file = value; +} +struct google_protobuf_FileDescriptorProto { + upb_stringview name; + upb_stringview package; + upb_stringview syntax; + google_protobuf_FileOptions* options; + google_protobuf_SourceCodeInfo* source_code_info; + upb_array* dependency; + upb_array* message_type; + upb_array* enum_type; + upb_array* service; + upb_array* extension; + upb_array* public_dependency; + upb_array* weak_dependency; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_FileDescriptorProto_submsgs[6] = { + &google_protobuf_DescriptorProto_msginit, + &google_protobuf_EnumDescriptorProto_msginit, + &google_protobuf_FieldDescriptorProto_msginit, + &google_protobuf_FileOptions_msginit, + &google_protobuf_ServiceDescriptorProto_msginit, + &google_protobuf_SourceCodeInfo_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_FileDescriptorProto__fields[12] = { + {1, offsetof(google_protobuf_FileDescriptorProto, name), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {2, offsetof(google_protobuf_FileDescriptorProto, package), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {3, offsetof(google_protobuf_FileDescriptorProto, dependency), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 3}, + {4, offsetof(google_protobuf_FileDescriptorProto, message_type), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, + {5, offsetof(google_protobuf_FileDescriptorProto, enum_type), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 1, 11, 3}, + {6, offsetof(google_protobuf_FileDescriptorProto, service), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 4, 11, 3}, + {7, offsetof(google_protobuf_FileDescriptorProto, extension), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 2, 11, 3}, + {8, offsetof(google_protobuf_FileDescriptorProto, options), 3, UPB_NOT_IN_ONEOF, 3, 11, 1}, + {9, offsetof(google_protobuf_FileDescriptorProto, source_code_info), 4, UPB_NOT_IN_ONEOF, 5, 11, 1}, + {10, offsetof(google_protobuf_FileDescriptorProto, public_dependency), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 3}, + {11, offsetof(google_protobuf_FileDescriptorProto, weak_dependency), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 3}, + {12, offsetof(google_protobuf_FileDescriptorProto, syntax), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_FileDescriptorProto_msginit = { + &google_protobuf_FileDescriptorProto_submsgs[0], + &google_protobuf_FileDescriptorProto__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_FileDescriptorProto), 12, 0, false, true +}; + +google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_env *env) { + google_protobuf_FileDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_FileDescriptorProto *msg = google_protobuf_FileDescriptorProto_new(env); + if (upb_decode(buf, msg, &google_protobuf_FileDescriptorProto_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_FileDescriptorProto_serialize(google_protobuf_FileDescriptorProto *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_FileDescriptorProto_msginit, env, size); +} +upb_stringview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg) { + return msg->name; +} +void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_stringview value) { + msg->name = value; +} +upb_stringview google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto *msg) { + return msg->package; +} +void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_stringview value) { + msg->package = value; +} +const upb_array* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg) { + return msg->dependency; +} +void google_protobuf_FileDescriptorProto_set_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value) { + msg->dependency = value; +} +const upb_array* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg) { + return msg->message_type; +} +void google_protobuf_FileDescriptorProto_set_message_type(google_protobuf_FileDescriptorProto *msg, upb_array* value) { + msg->message_type = value; +} +const upb_array* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg) { + return msg->enum_type; +} +void google_protobuf_FileDescriptorProto_set_enum_type(google_protobuf_FileDescriptorProto *msg, upb_array* value) { + msg->enum_type = value; +} +const upb_array* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg) { + return msg->service; +} +void google_protobuf_FileDescriptorProto_set_service(google_protobuf_FileDescriptorProto *msg, upb_array* value) { + msg->service = value; +} +const upb_array* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg) { + return msg->extension; +} +void google_protobuf_FileDescriptorProto_set_extension(google_protobuf_FileDescriptorProto *msg, upb_array* value) { + msg->extension = value; +} +const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg) { + return msg->options; +} +void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) { + msg->options = value; +} +const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg) { + return msg->source_code_info; +} +void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) { + msg->source_code_info = value; +} +const upb_array* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg) { + return msg->public_dependency; +} +void google_protobuf_FileDescriptorProto_set_public_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value) { + msg->public_dependency = value; +} +const upb_array* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg) { + return msg->weak_dependency; +} +void google_protobuf_FileDescriptorProto_set_weak_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value) { + msg->weak_dependency = value; +} +upb_stringview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg) { + return msg->syntax; +} +void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_stringview value) { + msg->syntax = value; +} +struct google_protobuf_DescriptorProto { + upb_stringview name; + google_protobuf_MessageOptions* options; + upb_array* field; + upb_array* nested_type; + upb_array* enum_type; + upb_array* extension_range; + upb_array* extension; + upb_array* oneof_decl; + upb_array* reserved_range; + upb_array* reserved_name; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_DescriptorProto_submsgs[8] = { + &google_protobuf_DescriptorProto_msginit, + &google_protobuf_DescriptorProto_ExtensionRange_msginit, + &google_protobuf_DescriptorProto_ReservedRange_msginit, + &google_protobuf_EnumDescriptorProto_msginit, + &google_protobuf_FieldDescriptorProto_msginit, + &google_protobuf_MessageOptions_msginit, + &google_protobuf_OneofDescriptorProto_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_DescriptorProto__fields[10] = { + {1, offsetof(google_protobuf_DescriptorProto, name), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {2, offsetof(google_protobuf_DescriptorProto, field), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 4, 11, 3}, + {3, offsetof(google_protobuf_DescriptorProto, nested_type), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, + {4, offsetof(google_protobuf_DescriptorProto, enum_type), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 3, 11, 3}, + {5, offsetof(google_protobuf_DescriptorProto, extension_range), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 1, 11, 3}, + {6, offsetof(google_protobuf_DescriptorProto, extension), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 4, 11, 3}, + {7, offsetof(google_protobuf_DescriptorProto, options), 1, UPB_NOT_IN_ONEOF, 5, 11, 1}, + {8, offsetof(google_protobuf_DescriptorProto, oneof_decl), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 6, 11, 3}, + {9, offsetof(google_protobuf_DescriptorProto, reserved_range), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 2, 11, 3}, + {10, offsetof(google_protobuf_DescriptorProto, reserved_name), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_msginit = { + &google_protobuf_DescriptorProto_submsgs[0], + &google_protobuf_DescriptorProto__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_DescriptorProto), 10, 0, false, true +}; + +google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_env *env) { + google_protobuf_DescriptorProto *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_DescriptorProto *msg = google_protobuf_DescriptorProto_new(env); + if (upb_decode(buf, msg, &google_protobuf_DescriptorProto_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_DescriptorProto_serialize(google_protobuf_DescriptorProto *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_DescriptorProto_msginit, env, size); +} +upb_stringview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg) { + return msg->name; +} +void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_stringview value) { + msg->name = value; +} +const upb_array* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg) { + return msg->field; +} +void google_protobuf_DescriptorProto_set_field(google_protobuf_DescriptorProto *msg, upb_array* value) { + msg->field = value; +} +const upb_array* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg) { + return msg->nested_type; +} +void google_protobuf_DescriptorProto_set_nested_type(google_protobuf_DescriptorProto *msg, upb_array* value) { + msg->nested_type = value; +} +const upb_array* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg) { + return msg->enum_type; +} +void google_protobuf_DescriptorProto_set_enum_type(google_protobuf_DescriptorProto *msg, upb_array* value) { + msg->enum_type = value; +} +const upb_array* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto *msg) { + return msg->extension_range; +} +void google_protobuf_DescriptorProto_set_extension_range(google_protobuf_DescriptorProto *msg, upb_array* value) { + msg->extension_range = value; +} +const upb_array* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg) { + return msg->extension; +} +void google_protobuf_DescriptorProto_set_extension(google_protobuf_DescriptorProto *msg, upb_array* value) { + msg->extension = value; +} +const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg) { + return msg->options; +} +void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) { + msg->options = value; +} +const upb_array* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg) { + return msg->oneof_decl; +} +void google_protobuf_DescriptorProto_set_oneof_decl(google_protobuf_DescriptorProto *msg, upb_array* value) { + msg->oneof_decl = value; +} +const upb_array* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto *msg) { + return msg->reserved_range; +} +void google_protobuf_DescriptorProto_set_reserved_range(google_protobuf_DescriptorProto *msg, upb_array* value) { + msg->reserved_range = value; +} +const upb_array* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto *msg) { + return msg->reserved_name; +} +void google_protobuf_DescriptorProto_set_reserved_name(google_protobuf_DescriptorProto *msg, upb_array* value) { + msg->reserved_name = value; +} +struct google_protobuf_DescriptorProto_ExtensionRange { + int32_t start; + int32_t end; + google_protobuf_ExtensionRangeOptions* options; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_DescriptorProto_ExtensionRange_submsgs[1] = { + &google_protobuf_ExtensionRangeOptions_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_DescriptorProto_ExtensionRange__fields[3] = { + {1, offsetof(google_protobuf_DescriptorProto_ExtensionRange, start), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, + {2, offsetof(google_protobuf_DescriptorProto_ExtensionRange, end), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, + {3, offsetof(google_protobuf_DescriptorProto_ExtensionRange, options), 2, UPB_NOT_IN_ONEOF, 0, 11, 1}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_ExtensionRange_msginit = { + &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0], + &google_protobuf_DescriptorProto_ExtensionRange__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_DescriptorProto_ExtensionRange), 3, 0, false, true +}; + +google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_env *env) { + google_protobuf_DescriptorProto_ExtensionRange *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_DescriptorProto_ExtensionRange *msg = google_protobuf_DescriptorProto_ExtensionRange_new(env); + if (upb_decode(buf, msg, &google_protobuf_DescriptorProto_ExtensionRange_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_DescriptorProto_ExtensionRange_serialize(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msginit, env, size); +} +int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange *msg) { + return msg->start; +} +void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) { + msg->start = value; +} +int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange *msg) { + return msg->end; +} +void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) { + msg->end = value; +} +const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange *msg) { + return msg->options; +} +void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) { + msg->options = value; +} +struct google_protobuf_DescriptorProto_ReservedRange { + int32_t start; + int32_t end; +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_DescriptorProto_ReservedRange__fields[2] = { + {1, offsetof(google_protobuf_DescriptorProto_ReservedRange, start), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, + {2, offsetof(google_protobuf_DescriptorProto_ReservedRange, end), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_ReservedRange_msginit = { + NULL, + &google_protobuf_DescriptorProto_ReservedRange__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_DescriptorProto_ReservedRange), 2, 0, false, true +}; + +google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_env *env) { + google_protobuf_DescriptorProto_ReservedRange *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_DescriptorProto_ReservedRange *msg = google_protobuf_DescriptorProto_ReservedRange_new(env); + if (upb_decode(buf, msg, &google_protobuf_DescriptorProto_ReservedRange_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_DescriptorProto_ReservedRange_serialize(google_protobuf_DescriptorProto_ReservedRange *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msginit, env, size); +} +int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange *msg) { + return msg->start; +} +void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) { + msg->start = value; +} +int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange *msg) { + return msg->end; +} +void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) { + msg->end = value; +} +struct google_protobuf_ExtensionRangeOptions { + upb_array* uninterpreted_option; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_ExtensionRangeOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_ExtensionRangeOptions__fields[1] = { + {999, offsetof(google_protobuf_ExtensionRangeOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_ExtensionRangeOptions_msginit = { + &google_protobuf_ExtensionRangeOptions_submsgs[0], + &google_protobuf_ExtensionRangeOptions__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_ExtensionRangeOptions), 1, 0, false, true +}; + +google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_env *env) { + google_protobuf_ExtensionRangeOptions *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_ExtensionRangeOptions *msg = google_protobuf_ExtensionRangeOptions_new(env); + if (upb_decode(buf, msg, &google_protobuf_ExtensionRangeOptions_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_ExtensionRangeOptions_serialize(google_protobuf_ExtensionRangeOptions *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_ExtensionRangeOptions_msginit, env, size); +} +const upb_array* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg) { + return msg->uninterpreted_option; +} +void google_protobuf_ExtensionRangeOptions_set_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_array* value) { + msg->uninterpreted_option = value; +} +struct google_protobuf_FieldDescriptorProto { + google_protobuf_FieldDescriptorProto_Label label; + google_protobuf_FieldDescriptorProto_Type type; + int32_t number; + int32_t oneof_index; + upb_stringview name; + upb_stringview extendee; + upb_stringview type_name; + upb_stringview default_value; + upb_stringview json_name; + google_protobuf_FieldOptions* options; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_FieldDescriptorProto_submsgs[1] = { + &google_protobuf_FieldOptions_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_FieldDescriptorProto__fields[10] = { + {1, offsetof(google_protobuf_FieldDescriptorProto, name), 4, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {2, offsetof(google_protobuf_FieldDescriptorProto, extendee), 5, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {3, offsetof(google_protobuf_FieldDescriptorProto, number), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, + {4, offsetof(google_protobuf_FieldDescriptorProto, label), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1}, + {5, offsetof(google_protobuf_FieldDescriptorProto, type), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1}, + {6, offsetof(google_protobuf_FieldDescriptorProto, type_name), 6, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {7, offsetof(google_protobuf_FieldDescriptorProto, default_value), 7, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {8, offsetof(google_protobuf_FieldDescriptorProto, options), 9, UPB_NOT_IN_ONEOF, 0, 11, 1}, + {9, offsetof(google_protobuf_FieldDescriptorProto, oneof_index), 3, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, + {10, offsetof(google_protobuf_FieldDescriptorProto, json_name), 8, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_FieldDescriptorProto_msginit = { + &google_protobuf_FieldDescriptorProto_submsgs[0], + &google_protobuf_FieldDescriptorProto__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_FieldDescriptorProto), 10, 0, false, true +}; + +google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_env *env) { + google_protobuf_FieldDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_FieldDescriptorProto *msg = google_protobuf_FieldDescriptorProto_new(env); + if (upb_decode(buf, msg, &google_protobuf_FieldDescriptorProto_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_FieldDescriptorProto_serialize(google_protobuf_FieldDescriptorProto *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_FieldDescriptorProto_msginit, env, size); +} +upb_stringview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg) { + return msg->name; +} +void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value) { + msg->name = value; +} +upb_stringview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg) { + return msg->extendee; +} +void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_stringview value) { + msg->extendee = value; +} +int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg) { + return msg->number; +} +void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) { + msg->number = value; +} +google_protobuf_FieldDescriptorProto_Label google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg) { + return msg->label; +} +void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldDescriptorProto_Label value) { + msg->label = value; +} +google_protobuf_FieldDescriptorProto_Type google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg) { + return msg->type; +} +void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldDescriptorProto_Type value) { + msg->type = value; +} +upb_stringview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg) { + return msg->type_name; +} +void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value) { + msg->type_name = value; +} +upb_stringview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg) { + return msg->default_value; +} +void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_stringview value) { + msg->default_value = value; +} +const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg) { + return msg->options; +} +void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) { + msg->options = value; +} +int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { + return msg->oneof_index; +} +void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) { + msg->oneof_index = value; +} +upb_stringview google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg) { + return msg->json_name; +} +void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value) { + msg->json_name = value; +} +struct google_protobuf_OneofDescriptorProto { + upb_stringview name; + google_protobuf_OneofOptions* options; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_OneofDescriptorProto_submsgs[1] = { + &google_protobuf_OneofOptions_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_OneofDescriptorProto__fields[2] = { + {1, offsetof(google_protobuf_OneofDescriptorProto, name), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {2, offsetof(google_protobuf_OneofDescriptorProto, options), 1, UPB_NOT_IN_ONEOF, 0, 11, 1}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_OneofDescriptorProto_msginit = { + &google_protobuf_OneofDescriptorProto_submsgs[0], + &google_protobuf_OneofDescriptorProto__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_OneofDescriptorProto), 2, 0, false, true +}; + +google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_env *env) { + google_protobuf_OneofDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_OneofDescriptorProto *msg = google_protobuf_OneofDescriptorProto_new(env); + if (upb_decode(buf, msg, &google_protobuf_OneofDescriptorProto_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_OneofDescriptorProto_serialize(google_protobuf_OneofDescriptorProto *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_OneofDescriptorProto_msginit, env, size); +} +upb_stringview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg) { + return msg->name; +} +void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_stringview value) { + msg->name = value; +} +const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto *msg) { + return msg->options; +} +void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) { + msg->options = value; +} +struct google_protobuf_EnumDescriptorProto { + upb_stringview name; + google_protobuf_EnumOptions* options; + upb_array* value; + upb_array* reserved_range; + upb_array* reserved_name; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_EnumDescriptorProto_submsgs[3] = { + &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, + &google_protobuf_EnumOptions_msginit, + &google_protobuf_EnumValueDescriptorProto_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_EnumDescriptorProto__fields[5] = { + {1, offsetof(google_protobuf_EnumDescriptorProto, name), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {2, offsetof(google_protobuf_EnumDescriptorProto, value), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 2, 11, 3}, + {3, offsetof(google_protobuf_EnumDescriptorProto, options), 1, UPB_NOT_IN_ONEOF, 1, 11, 1}, + {4, offsetof(google_protobuf_EnumDescriptorProto, reserved_range), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, + {5, offsetof(google_protobuf_EnumDescriptorProto, reserved_name), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_msginit = { + &google_protobuf_EnumDescriptorProto_submsgs[0], + &google_protobuf_EnumDescriptorProto__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_EnumDescriptorProto), 5, 0, false, true +}; + +google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_env *env) { + google_protobuf_EnumDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_EnumDescriptorProto *msg = google_protobuf_EnumDescriptorProto_new(env); + if (upb_decode(buf, msg, &google_protobuf_EnumDescriptorProto_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_EnumDescriptorProto_serialize(google_protobuf_EnumDescriptorProto *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_EnumDescriptorProto_msginit, env, size); +} +upb_stringview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg) { + return msg->name; +} +void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_stringview value) { + msg->name = value; +} +const upb_array* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg) { + return msg->value; +} +void google_protobuf_EnumDescriptorProto_set_value(google_protobuf_EnumDescriptorProto *msg, upb_array* value) { + msg->value = value; +} +const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg) { + return msg->options; +} +void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) { + msg->options = value; +} +const upb_array* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto *msg) { + return msg->reserved_range; +} +void google_protobuf_EnumDescriptorProto_set_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_array* value) { + msg->reserved_range = value; +} +const upb_array* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto *msg) { + return msg->reserved_name; +} +void google_protobuf_EnumDescriptorProto_set_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_array* value) { + msg->reserved_name = value; +} +struct google_protobuf_EnumDescriptorProto_EnumReservedRange { + int32_t start; + int32_t end; +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[2] = { + {1, offsetof(google_protobuf_EnumDescriptorProto_EnumReservedRange, start), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, + {2, offsetof(google_protobuf_EnumDescriptorProto_EnumReservedRange, end), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { + NULL, + &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_EnumDescriptorProto_EnumReservedRange), 2, 0, false, true +}; + +google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_env *env) { + google_protobuf_EnumDescriptorProto_EnumReservedRange *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_EnumDescriptorProto_EnumReservedRange *msg = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(env); + if (upb_decode(buf, msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, env, size); +} +int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { + return msg->start; +} +void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { + msg->start = value; +} +int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg) { + return msg->end; +} +void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { + msg->end = value; +} +struct google_protobuf_EnumValueDescriptorProto { + int32_t number; + upb_stringview name; + google_protobuf_EnumValueOptions* options; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_EnumValueDescriptorProto_submsgs[1] = { + &google_protobuf_EnumValueOptions_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_EnumValueDescriptorProto__fields[3] = { + {1, offsetof(google_protobuf_EnumValueDescriptorProto, name), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {2, offsetof(google_protobuf_EnumValueDescriptorProto, number), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, + {3, offsetof(google_protobuf_EnumValueDescriptorProto, options), 2, UPB_NOT_IN_ONEOF, 0, 11, 1}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_EnumValueDescriptorProto_msginit = { + &google_protobuf_EnumValueDescriptorProto_submsgs[0], + &google_protobuf_EnumValueDescriptorProto__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_EnumValueDescriptorProto), 3, 0, false, true +}; + +google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_env *env) { + google_protobuf_EnumValueDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_EnumValueDescriptorProto *msg = google_protobuf_EnumValueDescriptorProto_new(env); + if (upb_decode(buf, msg, &google_protobuf_EnumValueDescriptorProto_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_EnumValueDescriptorProto_serialize(google_protobuf_EnumValueDescriptorProto *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_EnumValueDescriptorProto_msginit, env, size); +} +upb_stringview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg) { + return msg->name; +} +void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_stringview value) { + msg->name = value; +} +int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg) { + return msg->number; +} +void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) { + msg->number = value; +} +const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg) { + return msg->options; +} +void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) { + msg->options = value; +} +struct google_protobuf_ServiceDescriptorProto { + upb_stringview name; + google_protobuf_ServiceOptions* options; + upb_array* method; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_ServiceDescriptorProto_submsgs[2] = { + &google_protobuf_MethodDescriptorProto_msginit, + &google_protobuf_ServiceOptions_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_ServiceDescriptorProto__fields[3] = { + {1, offsetof(google_protobuf_ServiceDescriptorProto, name), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {2, offsetof(google_protobuf_ServiceDescriptorProto, method), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, + {3, offsetof(google_protobuf_ServiceDescriptorProto, options), 1, UPB_NOT_IN_ONEOF, 1, 11, 1}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_ServiceDescriptorProto_msginit = { + &google_protobuf_ServiceDescriptorProto_submsgs[0], + &google_protobuf_ServiceDescriptorProto__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_ServiceDescriptorProto), 3, 0, false, true +}; + +google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_env *env) { + google_protobuf_ServiceDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_ServiceDescriptorProto *msg = google_protobuf_ServiceDescriptorProto_new(env); + if (upb_decode(buf, msg, &google_protobuf_ServiceDescriptorProto_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_ServiceDescriptorProto_serialize(google_protobuf_ServiceDescriptorProto *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_ServiceDescriptorProto_msginit, env, size); +} +upb_stringview google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto *msg) { + return msg->name; +} +void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_stringview value) { + msg->name = value; +} +const upb_array* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto *msg) { + return msg->method; +} +void google_protobuf_ServiceDescriptorProto_set_method(google_protobuf_ServiceDescriptorProto *msg, upb_array* value) { + msg->method = value; +} +const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg) { + return msg->options; +} +void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) { + msg->options = value; +} +struct google_protobuf_MethodDescriptorProto { + bool client_streaming; + bool server_streaming; + upb_stringview name; + upb_stringview input_type; + upb_stringview output_type; + google_protobuf_MethodOptions* options; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_MethodDescriptorProto_submsgs[1] = { + &google_protobuf_MethodOptions_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_MethodDescriptorProto__fields[6] = { + {1, offsetof(google_protobuf_MethodDescriptorProto, name), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {2, offsetof(google_protobuf_MethodDescriptorProto, input_type), 3, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {3, offsetof(google_protobuf_MethodDescriptorProto, output_type), 4, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {4, offsetof(google_protobuf_MethodDescriptorProto, options), 5, UPB_NOT_IN_ONEOF, 0, 11, 1}, + {5, offsetof(google_protobuf_MethodDescriptorProto, client_streaming), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {6, offsetof(google_protobuf_MethodDescriptorProto, server_streaming), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_MethodDescriptorProto_msginit = { + &google_protobuf_MethodDescriptorProto_submsgs[0], + &google_protobuf_MethodDescriptorProto__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_MethodDescriptorProto), 6, 0, false, true +}; + +google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_env *env) { + google_protobuf_MethodDescriptorProto *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_MethodDescriptorProto *msg = google_protobuf_MethodDescriptorProto_new(env); + if (upb_decode(buf, msg, &google_protobuf_MethodDescriptorProto_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_MethodDescriptorProto_serialize(google_protobuf_MethodDescriptorProto *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_MethodDescriptorProto_msginit, env, size); +} +upb_stringview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg) { + return msg->name; +} +void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_stringview value) { + msg->name = value; +} +upb_stringview google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto *msg) { + return msg->input_type; +} +void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_stringview value) { + msg->input_type = value; +} +upb_stringview google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto *msg) { + return msg->output_type; +} +void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_stringview value) { + msg->output_type = value; +} +const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg) { + return msg->options; +} +void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) { + msg->options = value; +} +bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { + return msg->client_streaming; +} +void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { + msg->client_streaming = value; +} +bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { + return msg->server_streaming; +} +void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { + msg->server_streaming = value; +} +struct google_protobuf_FileOptions { + google_protobuf_FileOptions_OptimizeMode optimize_for; + bool java_multiple_files; + bool cc_generic_services; + bool java_generic_services; + bool py_generic_services; + bool java_generate_equals_and_hash; + bool deprecated; + bool java_string_check_utf8; + bool cc_enable_arenas; + bool php_generic_services; + upb_stringview java_package; + upb_stringview java_outer_classname; + upb_stringview go_package; + upb_stringview objc_class_prefix; + upb_stringview csharp_namespace; + upb_stringview swift_prefix; + upb_stringview php_class_prefix; + upb_stringview php_namespace; + upb_array* uninterpreted_option; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_FileOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_FileOptions__fields[19] = { + {1, offsetof(google_protobuf_FileOptions, java_package), 10, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {8, offsetof(google_protobuf_FileOptions, java_outer_classname), 11, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {9, offsetof(google_protobuf_FileOptions, optimize_for), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1}, + {10, offsetof(google_protobuf_FileOptions, java_multiple_files), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {11, offsetof(google_protobuf_FileOptions, go_package), 12, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {16, offsetof(google_protobuf_FileOptions, cc_generic_services), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {17, offsetof(google_protobuf_FileOptions, java_generic_services), 3, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {18, offsetof(google_protobuf_FileOptions, py_generic_services), 4, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {20, offsetof(google_protobuf_FileOptions, java_generate_equals_and_hash), 5, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {23, offsetof(google_protobuf_FileOptions, deprecated), 6, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {27, offsetof(google_protobuf_FileOptions, java_string_check_utf8), 7, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {31, offsetof(google_protobuf_FileOptions, cc_enable_arenas), 8, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {36, offsetof(google_protobuf_FileOptions, objc_class_prefix), 13, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {37, offsetof(google_protobuf_FileOptions, csharp_namespace), 14, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {39, offsetof(google_protobuf_FileOptions, swift_prefix), 15, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {40, offsetof(google_protobuf_FileOptions, php_class_prefix), 16, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {41, offsetof(google_protobuf_FileOptions, php_namespace), 17, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {42, offsetof(google_protobuf_FileOptions, php_generic_services), 9, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {999, offsetof(google_protobuf_FileOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_FileOptions_msginit = { + &google_protobuf_FileOptions_submsgs[0], + &google_protobuf_FileOptions__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_FileOptions), 19, 0, false, true +}; + +google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_env *env) { + google_protobuf_FileOptions *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_FileOptions *google_protobuf_FileOptions_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_FileOptions *msg = google_protobuf_FileOptions_new(env); + if (upb_decode(buf, msg, &google_protobuf_FileOptions_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_FileOptions_serialize(google_protobuf_FileOptions *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_FileOptions_msginit, env, size); +} +upb_stringview google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions *msg) { + return msg->java_package; +} +void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_stringview value) { + msg->java_package = value; +} +upb_stringview google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions *msg) { + return msg->java_outer_classname; +} +void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_stringview value) { + msg->java_outer_classname = value; +} +google_protobuf_FileOptions_OptimizeMode google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions *msg) { + return msg->optimize_for; +} +void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, google_protobuf_FileOptions_OptimizeMode value) { + msg->optimize_for = value; +} +bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions *msg) { + return msg->java_multiple_files; +} +void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) { + msg->java_multiple_files = value; +} +upb_stringview google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions *msg) { + return msg->go_package; +} +void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_stringview value) { + msg->go_package = value; +} +bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions *msg) { + return msg->cc_generic_services; +} +void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) { + msg->cc_generic_services = value; +} +bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions *msg) { + return msg->java_generic_services; +} +void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) { + msg->java_generic_services = value; +} +bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions *msg) { + return msg->py_generic_services; +} +void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) { + msg->py_generic_services = value; +} +bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { + return msg->java_generate_equals_and_hash; +} +void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) { + msg->java_generate_equals_and_hash = value; +} +bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions *msg) { + return msg->deprecated; +} +void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) { + msg->deprecated = value; +} +bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions *msg) { + return msg->java_string_check_utf8; +} +void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) { + msg->java_string_check_utf8 = value; +} +bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions *msg) { + return msg->cc_enable_arenas; +} +void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) { + msg->cc_enable_arenas = value; +} +upb_stringview google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions *msg) { + return msg->objc_class_prefix; +} +void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_stringview value) { + msg->objc_class_prefix = value; +} +upb_stringview google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions *msg) { + return msg->csharp_namespace; +} +void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_stringview value) { + msg->csharp_namespace = value; +} +upb_stringview google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions *msg) { + return msg->swift_prefix; +} +void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_stringview value) { + msg->swift_prefix = value; +} +upb_stringview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg) { + return msg->php_class_prefix; +} +void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_stringview value) { + msg->php_class_prefix = value; +} +upb_stringview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg) { + return msg->php_namespace; +} +void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_stringview value) { + msg->php_namespace = value; +} +bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions *msg) { + return msg->php_generic_services; +} +void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) { + msg->php_generic_services = value; +} +const upb_array* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg) { + return msg->uninterpreted_option; +} +void google_protobuf_FileOptions_set_uninterpreted_option(google_protobuf_FileOptions *msg, upb_array* value) { + msg->uninterpreted_option = value; +} +struct google_protobuf_MessageOptions { + bool message_set_wire_format; + bool no_standard_descriptor_accessor; + bool deprecated; + bool map_entry; + upb_array* uninterpreted_option; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_MessageOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_MessageOptions__fields[5] = { + {1, offsetof(google_protobuf_MessageOptions, message_set_wire_format), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {2, offsetof(google_protobuf_MessageOptions, no_standard_descriptor_accessor), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {3, offsetof(google_protobuf_MessageOptions, deprecated), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {7, offsetof(google_protobuf_MessageOptions, map_entry), 3, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {999, offsetof(google_protobuf_MessageOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_MessageOptions_msginit = { + &google_protobuf_MessageOptions_submsgs[0], + &google_protobuf_MessageOptions__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_MessageOptions), 5, 0, false, true +}; + +google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_env *env) { + google_protobuf_MessageOptions *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_MessageOptions *google_protobuf_MessageOptions_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_MessageOptions *msg = google_protobuf_MessageOptions_new(env); + if (upb_decode(buf, msg, &google_protobuf_MessageOptions_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_MessageOptions_serialize(google_protobuf_MessageOptions *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_MessageOptions_msginit, env, size); +} +bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions *msg) { + return msg->message_set_wire_format; +} +void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) { + msg->message_set_wire_format = value; +} +bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg) { + return msg->no_standard_descriptor_accessor; +} +void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) { + msg->no_standard_descriptor_accessor = value; +} +bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions *msg) { + return msg->deprecated; +} +void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) { + msg->deprecated = value; +} +bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg) { + return msg->map_entry; +} +void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) { + msg->map_entry = value; +} +const upb_array* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions *msg) { + return msg->uninterpreted_option; +} +void google_protobuf_MessageOptions_set_uninterpreted_option(google_protobuf_MessageOptions *msg, upb_array* value) { + msg->uninterpreted_option = value; +} +struct google_protobuf_FieldOptions { + google_protobuf_FieldOptions_CType ctype; + google_protobuf_FieldOptions_JSType jstype; + bool packed; + bool deprecated; + bool lazy; + bool weak; + upb_array* uninterpreted_option; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_FieldOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_FieldOptions__fields[7] = { + {1, offsetof(google_protobuf_FieldOptions, ctype), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1}, + {2, offsetof(google_protobuf_FieldOptions, packed), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {3, offsetof(google_protobuf_FieldOptions, deprecated), 3, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {5, offsetof(google_protobuf_FieldOptions, lazy), 4, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {6, offsetof(google_protobuf_FieldOptions, jstype), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1}, + {10, offsetof(google_protobuf_FieldOptions, weak), 5, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {999, offsetof(google_protobuf_FieldOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_FieldOptions_msginit = { + &google_protobuf_FieldOptions_submsgs[0], + &google_protobuf_FieldOptions__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_FieldOptions), 7, 0, false, true +}; + +google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_env *env) { + google_protobuf_FieldOptions *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_FieldOptions *google_protobuf_FieldOptions_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_FieldOptions *msg = google_protobuf_FieldOptions_new(env); + if (upb_decode(buf, msg, &google_protobuf_FieldOptions_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_FieldOptions_serialize(google_protobuf_FieldOptions *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_FieldOptions_msginit, env, size); +} +google_protobuf_FieldOptions_CType google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions *msg) { + return msg->ctype; +} +void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_CType value) { + msg->ctype = value; +} +bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg) { + return msg->packed; +} +void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) { + msg->packed = value; +} +bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions *msg) { + return msg->deprecated; +} +void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) { + msg->deprecated = value; +} +bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg) { + return msg->lazy; +} +void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) { + msg->lazy = value; +} +google_protobuf_FieldOptions_JSType google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions *msg) { + return msg->jstype; +} +void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_JSType value) { + msg->jstype = value; +} +bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg) { + return msg->weak; +} +void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) { + msg->weak = value; +} +const upb_array* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions *msg) { + return msg->uninterpreted_option; +} +void google_protobuf_FieldOptions_set_uninterpreted_option(google_protobuf_FieldOptions *msg, upb_array* value) { + msg->uninterpreted_option = value; +} +struct google_protobuf_OneofOptions { + upb_array* uninterpreted_option; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_OneofOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_OneofOptions__fields[1] = { + {999, offsetof(google_protobuf_OneofOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_OneofOptions_msginit = { + &google_protobuf_OneofOptions_submsgs[0], + &google_protobuf_OneofOptions__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_OneofOptions), 1, 0, false, true +}; + +google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_env *env) { + google_protobuf_OneofOptions *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_OneofOptions *google_protobuf_OneofOptions_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_OneofOptions *msg = google_protobuf_OneofOptions_new(env); + if (upb_decode(buf, msg, &google_protobuf_OneofOptions_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_OneofOptions_serialize(google_protobuf_OneofOptions *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_OneofOptions_msginit, env, size); +} +const upb_array* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions *msg) { + return msg->uninterpreted_option; +} +void google_protobuf_OneofOptions_set_uninterpreted_option(google_protobuf_OneofOptions *msg, upb_array* value) { + msg->uninterpreted_option = value; +} +struct google_protobuf_EnumOptions { + bool allow_alias; + bool deprecated; + upb_array* uninterpreted_option; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_EnumOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_EnumOptions__fields[3] = { + {2, offsetof(google_protobuf_EnumOptions, allow_alias), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {3, offsetof(google_protobuf_EnumOptions, deprecated), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {999, offsetof(google_protobuf_EnumOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_EnumOptions_msginit = { + &google_protobuf_EnumOptions_submsgs[0], + &google_protobuf_EnumOptions__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_EnumOptions), 3, 0, false, true +}; + +google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_env *env) { + google_protobuf_EnumOptions *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_EnumOptions *google_protobuf_EnumOptions_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_EnumOptions *msg = google_protobuf_EnumOptions_new(env); + if (upb_decode(buf, msg, &google_protobuf_EnumOptions_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_EnumOptions_serialize(google_protobuf_EnumOptions *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_EnumOptions_msginit, env, size); +} +bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions *msg) { + return msg->allow_alias; +} +void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) { + msg->allow_alias = value; +} +bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions *msg) { + return msg->deprecated; +} +void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) { + msg->deprecated = value; +} +const upb_array* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions *msg) { + return msg->uninterpreted_option; +} +void google_protobuf_EnumOptions_set_uninterpreted_option(google_protobuf_EnumOptions *msg, upb_array* value) { + msg->uninterpreted_option = value; +} +struct google_protobuf_EnumValueOptions { + bool deprecated; + upb_array* uninterpreted_option; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_EnumValueOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_EnumValueOptions__fields[2] = { + {1, offsetof(google_protobuf_EnumValueOptions, deprecated), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {999, offsetof(google_protobuf_EnumValueOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_EnumValueOptions_msginit = { + &google_protobuf_EnumValueOptions_submsgs[0], + &google_protobuf_EnumValueOptions__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_EnumValueOptions), 2, 0, false, true +}; + +google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_env *env) { + google_protobuf_EnumValueOptions *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_EnumValueOptions *msg = google_protobuf_EnumValueOptions_new(env); + if (upb_decode(buf, msg, &google_protobuf_EnumValueOptions_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_EnumValueOptions_serialize(google_protobuf_EnumValueOptions *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_EnumValueOptions_msginit, env, size); +} +bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions *msg) { + return msg->deprecated; +} +void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) { + msg->deprecated = value; +} +const upb_array* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions *msg) { + return msg->uninterpreted_option; +} +void google_protobuf_EnumValueOptions_set_uninterpreted_option(google_protobuf_EnumValueOptions *msg, upb_array* value) { + msg->uninterpreted_option = value; +} +struct google_protobuf_ServiceOptions { + bool deprecated; + upb_array* uninterpreted_option; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_ServiceOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_ServiceOptions__fields[2] = { + {33, offsetof(google_protobuf_ServiceOptions, deprecated), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {999, offsetof(google_protobuf_ServiceOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_ServiceOptions_msginit = { + &google_protobuf_ServiceOptions_submsgs[0], + &google_protobuf_ServiceOptions__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_ServiceOptions), 2, 0, false, true +}; + +google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_env *env) { + google_protobuf_ServiceOptions *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_ServiceOptions *msg = google_protobuf_ServiceOptions_new(env); + if (upb_decode(buf, msg, &google_protobuf_ServiceOptions_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_ServiceOptions_serialize(google_protobuf_ServiceOptions *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_ServiceOptions_msginit, env, size); +} +bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions *msg) { + return msg->deprecated; +} +void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) { + msg->deprecated = value; +} +const upb_array* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions *msg) { + return msg->uninterpreted_option; +} +void google_protobuf_ServiceOptions_set_uninterpreted_option(google_protobuf_ServiceOptions *msg, upb_array* value) { + msg->uninterpreted_option = value; +} +struct google_protobuf_MethodOptions { + google_protobuf_MethodOptions_IdempotencyLevel idempotency_level; + bool deprecated; + upb_array* uninterpreted_option; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_MethodOptions_submsgs[1] = { + &google_protobuf_UninterpretedOption_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_MethodOptions__fields[3] = { + {33, offsetof(google_protobuf_MethodOptions, deprecated), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 1}, + {34, offsetof(google_protobuf_MethodOptions, idempotency_level), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 14, 1}, + {999, offsetof(google_protobuf_MethodOptions, uninterpreted_option), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_MethodOptions_msginit = { + &google_protobuf_MethodOptions_submsgs[0], + &google_protobuf_MethodOptions__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_MethodOptions), 3, 0, false, true +}; + +google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_env *env) { + google_protobuf_MethodOptions *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_MethodOptions *google_protobuf_MethodOptions_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_MethodOptions *msg = google_protobuf_MethodOptions_new(env); + if (upb_decode(buf, msg, &google_protobuf_MethodOptions_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_MethodOptions_serialize(google_protobuf_MethodOptions *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_MethodOptions_msginit, env, size); +} +bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions *msg) { + return msg->deprecated; +} +void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) { + msg->deprecated = value; +} +google_protobuf_MethodOptions_IdempotencyLevel google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions *msg) { + return msg->idempotency_level; +} +void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, google_protobuf_MethodOptions_IdempotencyLevel value) { + msg->idempotency_level = value; +} +const upb_array* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg) { + return msg->uninterpreted_option; +} +void google_protobuf_MethodOptions_set_uninterpreted_option(google_protobuf_MethodOptions *msg, upb_array* value) { + msg->uninterpreted_option = value; +} +struct google_protobuf_UninterpretedOption { + uint64_t positive_int_value; + int64_t negative_int_value; + double double_value; + upb_stringview identifier_value; + upb_stringview string_value; + upb_stringview aggregate_value; + upb_array* name; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_UninterpretedOption_submsgs[1] = { + &google_protobuf_UninterpretedOption_NamePart_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_UninterpretedOption__fields[7] = { + {2, offsetof(google_protobuf_UninterpretedOption, name), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, + {3, offsetof(google_protobuf_UninterpretedOption, identifier_value), 3, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {4, offsetof(google_protobuf_UninterpretedOption, positive_int_value), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 4, 1}, + {5, offsetof(google_protobuf_UninterpretedOption, negative_int_value), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 3, 1}, + {6, offsetof(google_protobuf_UninterpretedOption, double_value), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 1, 1}, + {7, offsetof(google_protobuf_UninterpretedOption, string_value), 4, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 12, 1}, + {8, offsetof(google_protobuf_UninterpretedOption, aggregate_value), 5, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_UninterpretedOption_msginit = { + &google_protobuf_UninterpretedOption_submsgs[0], + &google_protobuf_UninterpretedOption__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_UninterpretedOption), 7, 0, false, true +}; + +google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_env *env) { + google_protobuf_UninterpretedOption *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_UninterpretedOption *msg = google_protobuf_UninterpretedOption_new(env); + if (upb_decode(buf, msg, &google_protobuf_UninterpretedOption_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_UninterpretedOption_serialize(google_protobuf_UninterpretedOption *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_UninterpretedOption_msginit, env, size); +} +const upb_array* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg) { + return msg->name; +} +void google_protobuf_UninterpretedOption_set_name(google_protobuf_UninterpretedOption *msg, upb_array* value) { + msg->name = value; +} +upb_stringview google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption *msg) { + return msg->identifier_value; +} +void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_stringview value) { + msg->identifier_value = value; +} +uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption *msg) { + return msg->positive_int_value; +} +void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) { + msg->positive_int_value = value; +} +int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption *msg) { + return msg->negative_int_value; +} +void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) { + msg->negative_int_value = value; +} +double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption *msg) { + return msg->double_value; +} +void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) { + msg->double_value = value; +} +upb_stringview google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption *msg) { + return msg->string_value; +} +void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_stringview value) { + msg->string_value = value; +} +upb_stringview google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption *msg) { + return msg->aggregate_value; +} +void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_stringview value) { + msg->aggregate_value = value; +} +struct google_protobuf_UninterpretedOption_NamePart { + bool is_extension; + upb_stringview name_part; +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_UninterpretedOption_NamePart__fields[2] = { + {1, offsetof(google_protobuf_UninterpretedOption_NamePart, name_part), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 2}, + {2, offsetof(google_protobuf_UninterpretedOption_NamePart, is_extension), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 8, 2}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_UninterpretedOption_NamePart_msginit = { + NULL, + &google_protobuf_UninterpretedOption_NamePart__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_UninterpretedOption_NamePart), 2, 0, false, true +}; + +google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_env *env) { + google_protobuf_UninterpretedOption_NamePart *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_UninterpretedOption_NamePart *msg = google_protobuf_UninterpretedOption_NamePart_new(env); + if (upb_decode(buf, msg, &google_protobuf_UninterpretedOption_NamePart_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_UninterpretedOption_NamePart_serialize(google_protobuf_UninterpretedOption_NamePart *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_UninterpretedOption_NamePart_msginit, env, size); +} +upb_stringview google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { + return msg->name_part; +} +void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_stringview value) { + msg->name_part = value; +} +bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { + return msg->is_extension; +} +void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) { + msg->is_extension = value; +} +struct google_protobuf_SourceCodeInfo { + upb_array* location; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_SourceCodeInfo_submsgs[1] = { + &google_protobuf_SourceCodeInfo_Location_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_SourceCodeInfo__fields[1] = { + {1, offsetof(google_protobuf_SourceCodeInfo, location), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_SourceCodeInfo_msginit = { + &google_protobuf_SourceCodeInfo_submsgs[0], + &google_protobuf_SourceCodeInfo__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_SourceCodeInfo), 1, 0, false, true +}; + +google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_env *env) { + google_protobuf_SourceCodeInfo *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_SourceCodeInfo *msg = google_protobuf_SourceCodeInfo_new(env); + if (upb_decode(buf, msg, &google_protobuf_SourceCodeInfo_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_SourceCodeInfo_serialize(google_protobuf_SourceCodeInfo *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_SourceCodeInfo_msginit, env, size); +} +const upb_array* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo *msg) { + return msg->location; +} +void google_protobuf_SourceCodeInfo_set_location(google_protobuf_SourceCodeInfo *msg, upb_array* value) { + msg->location = value; +} +struct google_protobuf_SourceCodeInfo_Location { + upb_stringview leading_comments; + upb_stringview trailing_comments; + upb_array* path; + upb_array* span; + upb_array* leading_detached_comments; +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_SourceCodeInfo_Location__fields[5] = { + {1, offsetof(google_protobuf_SourceCodeInfo_Location, path), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 3}, + {2, offsetof(google_protobuf_SourceCodeInfo_Location, span), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 3}, + {3, offsetof(google_protobuf_SourceCodeInfo_Location, leading_comments), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {4, offsetof(google_protobuf_SourceCodeInfo_Location, trailing_comments), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {6, offsetof(google_protobuf_SourceCodeInfo_Location, leading_detached_comments), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_SourceCodeInfo_Location_msginit = { + NULL, + &google_protobuf_SourceCodeInfo_Location__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_SourceCodeInfo_Location), 5, 0, false, true +}; + +google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_env *env) { + google_protobuf_SourceCodeInfo_Location *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_SourceCodeInfo_Location *msg = google_protobuf_SourceCodeInfo_Location_new(env); + if (upb_decode(buf, msg, &google_protobuf_SourceCodeInfo_Location_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_SourceCodeInfo_Location_serialize(google_protobuf_SourceCodeInfo_Location *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_SourceCodeInfo_Location_msginit, env, size); +} +const upb_array* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location *msg) { + return msg->path; +} +void google_protobuf_SourceCodeInfo_Location_set_path(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value) { + msg->path = value; +} +const upb_array* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location *msg) { + return msg->span; +} +void google_protobuf_SourceCodeInfo_Location_set_span(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value) { + msg->span = value; +} +upb_stringview google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg) { + return msg->leading_comments; +} +void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_stringview value) { + msg->leading_comments = value; +} +upb_stringview google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg) { + return msg->trailing_comments; +} +void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_stringview value) { + msg->trailing_comments = value; +} +const upb_array* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location *msg) { + return msg->leading_detached_comments; +} +void google_protobuf_SourceCodeInfo_Location_set_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value) { + msg->leading_detached_comments = value; +} +struct google_protobuf_GeneratedCodeInfo { + upb_array* annotation; +}; + +static const upb_msglayout_msginit_v1 *const google_protobuf_GeneratedCodeInfo_submsgs[1] = { + &google_protobuf_GeneratedCodeInfo_Annotation_msginit, +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_GeneratedCodeInfo__fields[1] = { + {1, offsetof(google_protobuf_GeneratedCodeInfo, annotation), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, 0, 11, 3}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_GeneratedCodeInfo_msginit = { + &google_protobuf_GeneratedCodeInfo_submsgs[0], + &google_protobuf_GeneratedCodeInfo__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_GeneratedCodeInfo), 1, 0, false, true +}; + +google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_env *env) { + google_protobuf_GeneratedCodeInfo *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_GeneratedCodeInfo *msg = google_protobuf_GeneratedCodeInfo_new(env); + if (upb_decode(buf, msg, &google_protobuf_GeneratedCodeInfo_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_GeneratedCodeInfo_serialize(google_protobuf_GeneratedCodeInfo *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_msginit, env, size); +} +const upb_array* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo *msg) { + return msg->annotation; +} +void google_protobuf_GeneratedCodeInfo_set_annotation(google_protobuf_GeneratedCodeInfo *msg, upb_array* value) { + msg->annotation = value; +} +struct google_protobuf_GeneratedCodeInfo_Annotation { + int32_t begin; + int32_t end; + upb_stringview source_file; + upb_array* path; +}; + +static const upb_msglayout_fieldinit_v1 google_protobuf_GeneratedCodeInfo_Annotation__fields[4] = { + {1, offsetof(google_protobuf_GeneratedCodeInfo_Annotation, path), UPB_NO_HASBIT, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 3}, + {2, offsetof(google_protobuf_GeneratedCodeInfo_Annotation, source_file), 2, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 9, 1}, + {3, offsetof(google_protobuf_GeneratedCodeInfo_Annotation, begin), 0, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, + {4, offsetof(google_protobuf_GeneratedCodeInfo_Annotation, end), 1, UPB_NOT_IN_ONEOF, UPB_NO_SUBMSG, 5, 1}, +}; + +const upb_msglayout_msginit_v1 google_protobuf_GeneratedCodeInfo_Annotation_msginit = { + NULL, + &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], + NULL, + NULL, /* TODO. default_msg */ + UPB_ALIGNED_SIZEOF(google_protobuf_GeneratedCodeInfo_Annotation), 4, 0, false, true +}; + +google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_env *env) { + google_protobuf_GeneratedCodeInfo_Annotation *msg = upb_env_malloc(env, sizeof(*msg)); + memset(msg, 0, sizeof(*msg)); /* TODO: defaults */ + return msg; +} +google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parsenew(upb_stringview buf, upb_env *env) { + google_protobuf_GeneratedCodeInfo_Annotation *msg = google_protobuf_GeneratedCodeInfo_Annotation_new(env); + if (upb_decode(buf, msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, env)) { + return msg; + } else { + return NULL; + } +} +char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_env *env, size_t *size) { + return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, env, size); +} +const upb_array* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { + return msg->path; +} +void google_protobuf_GeneratedCodeInfo_Annotation_set_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_array* value) { + msg->path = value; +} +upb_stringview google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { + return msg->source_file; +} +void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_stringview value) { + msg->source_file = value; +} +int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { + return msg->begin; +} +void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { + msg->begin = value; +} +int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { + return msg->end; +} +void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { + msg->end = value; +} /* Maps descriptor type -> upb field type. */ -static const uint8_t upb_desctype_to_fieldtype[] = { +const uint8_t upb_desctype_to_fieldtype[] = { UPB_WIRE_TYPE_END_GROUP, /* ENDGROUP */ UPB_TYPE_DOUBLE, /* DOUBLE */ UPB_TYPE_FLOAT, /* FLOAT */ @@ -215,7 +2114,7 @@ static upb_array *upb_getorcreatearr(upb_decstate *d, if (!arr) { return NULL; } - upb_array_init(arr, upb_desctype_to_fieldtype[field->type], + upb_array_init(arr, upb_desctype_to_fieldtype[field->descriptortype], upb_arena_alloc(upb_env_arena(d->env))); *(upb_array**)&frame->msg[field->offset] = arr; } @@ -268,7 +2167,8 @@ static bool upb_decode_submsg(upb_decstate *d, const char *limit, const upb_msglayout_fieldinit_v1 *field, int group_number) { - char *submsg = *(void**)&frame->msg[field->offset]; + char *submsg_slot = upb_decode_prepareslot(d, frame, field); + char *submsg = *(void**)submsg_slot; const upb_msglayout_msginit_v1 *subm; UPB_ASSERT(field->submsg_index != UPB_NO_SUBMSG); @@ -280,7 +2180,7 @@ static bool upb_decode_submsg(upb_decstate *d, CHK(submsg); submsg = upb_msg_init( submsg, (upb_msglayout*)subm, upb_arena_alloc(upb_env_arena(d->env))); - *(void**)&frame->msg[field->offset] = submsg; + *(void**)submsg_slot = submsg; } upb_decode_message(d, limit, group_number, submsg, subm); @@ -298,7 +2198,7 @@ static bool upb_decode_varintfield(upb_decstate *d, upb_decframe *frame, CHK(field_mem); CHK(upb_decode_varint(&d->ptr, frame->limit, &val)); - switch ((upb_descriptortype_t)field->type) { + switch ((upb_descriptortype_t)field->descriptortype) { case UPB_DESCRIPTOR_TYPE_INT64: case UPB_DESCRIPTOR_TYPE_UINT64: memcpy(field_mem, &val, sizeof(val)); @@ -343,7 +2243,7 @@ static bool upb_decode_64bitfield(upb_decstate *d, upb_decframe *frame, CHK(field_mem); CHK(upb_decode_64bit(&d->ptr, frame->limit, &val)); - switch ((upb_descriptortype_t)field->type) { + switch ((upb_descriptortype_t)field->descriptortype) { case UPB_DESCRIPTOR_TYPE_DOUBLE: case UPB_DESCRIPTOR_TYPE_FIXED64: case UPB_DESCRIPTOR_TYPE_SFIXED64: @@ -367,7 +2267,7 @@ static bool upb_decode_32bitfield(upb_decstate *d, upb_decframe *frame, CHK(field_mem); CHK(upb_decode_32bit(&d->ptr, frame->limit, &val)); - switch ((upb_descriptortype_t)field->type) { + switch ((upb_descriptortype_t)field->descriptortype) { case UPB_DESCRIPTOR_TYPE_FLOAT: case UPB_DESCRIPTOR_TYPE_FIXED32: case UPB_DESCRIPTOR_TYPE_SFIXED32: @@ -415,7 +2315,7 @@ static bool upb_decode_toarray(upb_decstate *d, upb_decframe *frame, return true; \ } - switch ((upb_descriptortype_t)field->type) { + switch ((upb_descriptortype_t)field->descriptortype) { case UPB_DESCRIPTOR_TYPE_STRING: case UPB_DESCRIPTOR_TYPE_BYTES: { void *field_mem = upb_array_add(arr, 1); @@ -445,9 +2345,31 @@ static bool upb_decode_toarray(upb_decstate *d, upb_decframe *frame, VARINT_CASE(int32_t, upb_zzdecode_32); case UPB_DESCRIPTOR_TYPE_SINT64: VARINT_CASE(int64_t, upb_zzdecode_64); - case UPB_DESCRIPTOR_TYPE_MESSAGE: + case UPB_DESCRIPTOR_TYPE_MESSAGE: { + const upb_msglayout_msginit_v1 *subm; + char *submsg; + void *field_mem; + CHK(val.size <= (size_t)(frame->limit - val.data)); - return upb_decode_submsg(d, frame, val.data + val.size, field, 0); + d->ptr -= val.size; + + /* Create elemente message. */ + UPB_ASSERT(field->submsg_index != UPB_NO_SUBMSG); + subm = frame->m->submsgs[field->submsg_index]; + UPB_ASSERT(subm); + + submsg = upb_env_malloc(d->env, upb_msg_sizeof((upb_msglayout *)subm)); + CHK(submsg); + submsg = upb_msg_init(submsg, (upb_msglayout*)subm, + upb_arena_alloc(upb_env_arena(d->env))); + + field_mem = upb_array_add(arr, 1); + CHK(field_mem); + *(void**)field_mem = submsg; + + return upb_decode_message( + d, val.data + val.size, frame->group_number, submsg, subm); + } case UPB_DESCRIPTOR_TYPE_GROUP: return upb_append_unknown(d, frame, field_start); } @@ -465,7 +2387,7 @@ static bool upb_decode_delimitedfield(upb_decstate *d, upb_decframe *frame, if (field->label == UPB_LABEL_REPEATED) { return upb_decode_toarray(d, frame, field_start, field, val); } else { - switch ((upb_descriptortype_t)field->type) { + switch ((upb_descriptortype_t)field->descriptortype) { case UPB_DESCRIPTOR_TYPE_STRING: case UPB_DESCRIPTOR_TYPE_BYTES: { void *field_mem = upb_decode_prepareslot(d, frame, field); @@ -475,6 +2397,7 @@ static bool upb_decode_delimitedfield(upb_decstate *d, upb_decframe *frame, } case UPB_DESCRIPTOR_TYPE_MESSAGE: CHK(val.size <= (size_t)(frame->limit - val.data)); + d->ptr -= val.size; CHK(upb_decode_submsg(d, frame, val.data + val.size, field, 0)); break; default: @@ -519,7 +2442,7 @@ static bool upb_decode_field(upb_decstate *d, upb_decframe *frame) { case UPB_WIRE_TYPE_DELIMITED: return upb_decode_delimitedfield(d, frame, field_start, field); case UPB_WIRE_TYPE_START_GROUP: - CHK(field->type == UPB_DESCRIPTOR_TYPE_GROUP); + CHK(field->descriptortype == UPB_DESCRIPTOR_TYPE_GROUP); return upb_decode_submsg(d, frame, frame->limit, field, field_number); case UPB_WIRE_TYPE_END_GROUP: CHK(frame->group_number == field_number) @@ -3004,7 +4927,7 @@ static bool upb_encode_growbuffer(upb_encstate *e, size_t bytes) { CHK(new_buf); /* We want previous data at the end, realloc() put it at the beginning. */ - memmove(e->limit - old_size, e->buf, old_size); + memmove(new_buf + new_size - old_size, e->buf, old_size); e->ptr = new_buf + new_size - (e->limit - e->ptr); e->limit = new_buf + new_size; @@ -3100,7 +5023,7 @@ static bool upb_encode_array(upb_encstate *e, const char *field_mem, return true; } - UPB_ASSERT(arr->type == upb_desctype_to_fieldtype2[f->type]); + UPB_ASSERT(arr->type == upb_desctype_to_fieldtype2[f->descriptortype]); #define VARINT_CASE(ctype, encode) { \ ctype *start = arr->data; \ @@ -3115,7 +5038,7 @@ static bool upb_encode_array(upb_encstate *e, const char *field_mem, break; \ do { ; } while(0) - switch (f->type) { + switch (f->descriptortype) { case UPB_DESCRIPTOR_TYPE_DOUBLE: CHK(upb_put_fixedarray(e, arr, sizeof(double))); break; @@ -3134,9 +5057,10 @@ do { ; } while(0) case UPB_DESCRIPTOR_TYPE_UINT64: VARINT_CASE(uint64_t, *ptr); case UPB_DESCRIPTOR_TYPE_UINT32: + VARINT_CASE(uint32_t, *ptr); case UPB_DESCRIPTOR_TYPE_INT32: case UPB_DESCRIPTOR_TYPE_ENUM: - VARINT_CASE(uint32_t, *ptr); + VARINT_CASE(int32_t, (int64_t)*ptr); case UPB_DESCRIPTOR_TYPE_BOOL: VARINT_CASE(bool, *ptr); case UPB_DESCRIPTOR_TYPE_SINT32: @@ -3205,7 +5129,7 @@ static bool upb_encode_scalarfield(upb_encstate *e, const char *field_mem, upb_put_tag(e, f->number, wire_type); \ } while(0) - switch (f->type) { + switch (f->descriptortype) { case UPB_DESCRIPTOR_TYPE_DOUBLE: CASE(double, double, UPB_WIRE_TYPE_64BIT, val); case UPB_DESCRIPTOR_TYPE_FLOAT: @@ -3214,9 +5138,10 @@ static bool upb_encode_scalarfield(upb_encstate *e, const char *field_mem, case UPB_DESCRIPTOR_TYPE_UINT64: CASE(uint64_t, varint, UPB_WIRE_TYPE_VARINT, val); case UPB_DESCRIPTOR_TYPE_UINT32: + CASE(uint32_t, varint, UPB_WIRE_TYPE_VARINT, val); case UPB_DESCRIPTOR_TYPE_INT32: case UPB_DESCRIPTOR_TYPE_ENUM: - CASE(uint32_t, varint, UPB_WIRE_TYPE_VARINT, val); + CASE(int32_t, varint, UPB_WIRE_TYPE_VARINT, (int64_t)val); case UPB_DESCRIPTOR_TYPE_SFIXED64: case UPB_DESCRIPTOR_TYPE_FIXED64: CASE(uint64_t, fixed64, UPB_WIRE_TYPE_64BIT, val); @@ -3283,7 +5208,7 @@ bool upb_encode_message(upb_encstate* e, const char *msg, const upb_msglayout_msginit_v1 *m, size_t *size) { int i; - char *buf_end = e->ptr; + size_t pre_len = e->limit - e->ptr; if (msg == NULL) { return true; @@ -3296,12 +5221,18 @@ bool upb_encode_message(upb_encstate* e, const char *msg, CHK(upb_encode_array(e, msg + f->offset, m, f)); } else { if (upb_encode_hasscalarfield(msg, m, f)) { - CHK(upb_encode_scalarfield(e, msg + f->offset, m, f, !m->is_proto2)); + if (f->oneof_index == UPB_NOT_IN_ONEOF) { + CHK(upb_encode_scalarfield(e, msg + f->offset, m, f, !m->is_proto2)); + } else { + const upb_msglayout_oneofinit_v1 *o = &m->oneofs[f->oneof_index]; + CHK(upb_encode_scalarfield(e, msg + o->data_offset, + m, f, !m->is_proto2)); + } } } } - *size = buf_end - e->ptr; + *size = (e->limit - e->ptr) - pre_len; return true; } @@ -4095,9 +6026,9 @@ static size_t upb_msgval_sizeof(upb_fieldtype_t type) { return 4; case UPB_TYPE_BOOL: return 1; - case UPB_TYPE_BYTES: case UPB_TYPE_MESSAGE: return sizeof(void*); + case UPB_TYPE_BYTES: case UPB_TYPE_STRING: return sizeof(upb_stringview); } @@ -4108,7 +6039,7 @@ static uint8_t upb_msg_fieldsize(const upb_msglayout_fieldinit_v1 *field) { if (field->label == UPB_LABEL_REPEATED) { return sizeof(void*); } else { - return upb_msgval_sizeof(field->type); + return upb_msgval_sizeof(upb_desctype_to_fieldtype[field->descriptortype]); } } @@ -4252,10 +6183,11 @@ static bool upb_msglayout_initdefault(upb_msglayout *l, const upb_msgdef *m) { return true; } -static upb_msglayout *upb_msglayout_new(const upb_msgdef *m) { +static bool upb_msglayout_init(const upb_msgdef *m, + upb_msglayout *l, + upb_msgfactory *factory) { upb_msg_field_iter it; upb_msg_oneof_iter oit; - upb_msglayout *l; size_t hasbit; size_t submsg_count = 0; const upb_msglayout_msginit_v1 **submsgs; @@ -4271,9 +6203,6 @@ static upb_msglayout *upb_msglayout_new(const upb_msgdef *m) { } } - l = upb_gmalloc(sizeof(*l)); - if (!l) return NULL; - memset(l, 0, sizeof(*l)); fields = upb_gmalloc(upb_msgdef_numfields(m) * sizeof(*fields)); @@ -4284,11 +6213,10 @@ static upb_msglayout *upb_msglayout_new(const upb_msgdef *m) { (!submsgs && submsg_count) || (!oneofs && upb_msgdef_numoneofs(m))) { /* OOM. */ - upb_gfree(l); upb_gfree(fields); upb_gfree(submsgs); upb_gfree(oneofs); - return NULL; + return false; } l->data.field_count = upb_msgdef_numfields(m); @@ -4308,6 +6236,7 @@ static upb_msglayout *upb_msglayout_new(const upb_msgdef *m) { */ /* Allocate hasbits and set basic field attributes. */ + submsg_count = 0; for (upb_msg_field_begin(&it, m), hasbit = 0; !upb_msg_field_done(&it); upb_msg_field_next(&it)) { @@ -4315,7 +6244,7 @@ static upb_msglayout *upb_msglayout_new(const upb_msgdef *m) { upb_msglayout_fieldinit_v1 *field = &fields[upb_fielddef_index(f)]; field->number = upb_fielddef_number(f); - field->type = upb_fielddef_type(f); + field->descriptortype = upb_fielddef_descriptortype(f); field->label = upb_fielddef_label(f); if (upb_fielddef_containingoneof(f)) { @@ -4324,8 +6253,19 @@ static upb_msglayout *upb_msglayout_new(const upb_msgdef *m) { field->oneof_index = UPB_NOT_IN_ONEOF; } + if (upb_fielddef_issubmsg(f)) { + const upb_msglayout *sub_layout = + upb_msgfactory_getlayout(factory, upb_fielddef_msgsubdef(f)); + field->submsg_index = submsg_count++; + submsgs[field->submsg_index] = &sub_layout->data; + } else { + field->submsg_index = UPB_NO_SUBMSG; + } + if (upb_fielddef_haspresence(f) && !upb_fielddef_containingoneof(f)) { field->hasbit = hasbit++; + } else { + field->hasbit = UPB_NO_HASBIT; } } @@ -4375,12 +6315,7 @@ static upb_msglayout *upb_msglayout_new(const upb_msgdef *m) { * alignment. TODO: track overall alignment for real? */ l->data.size = align_up(l->data.size, 8); - if (upb_msglayout_initdefault(l, m)) { - return l; - } else { - upb_msglayout_free(l); - return NULL; - } + return upb_msglayout_initdefault(l, m); } @@ -4435,10 +6370,14 @@ const upb_msglayout *upb_msgfactory_getlayout(upb_msgfactory *f, UPB_ASSERT(upb_value_getptr(v)); return upb_value_getptr(v); } else { + /* In case of circular dependency, layout has to be inserted first. */ + upb_msglayout *l = upb_gmalloc(sizeof(*l)); upb_msgfactory *mutable_f = (void*)f; - upb_msglayout *l = upb_msglayout_new(m); upb_inttable_insertptr(&mutable_f->layouts, m, upb_value_ptr(l)); UPB_ASSERT(l); + if (!upb_msglayout_init(m, l, f)) { + upb_msglayout_free(l); + } return l; } } diff --git a/php/ext/google/protobuf/upb.h b/php/ext/google/protobuf/upb.h index 10371e8b..a263db30 100644 --- a/php/ext/google/protobuf/upb.h +++ b/php/ext/google/protobuf/upb.h @@ -1,4 +1,111 @@ // Amalgamated source file + +// php.h intentionally defined NDEBUG. We have to define this macro in order to +// be used together with php.h +#ifndef NDEBUG +#define NDEBUG +#endif + +/* +** upb_decode: parsing into a upb_msg using a upb_msglayout. +*/ + +#ifndef UPB_DECODE_H_ +#define UPB_DECODE_H_ + +/* +** upb::Message is a representation for protobuf messages. +** +** However it differs from other common representations like +** google::protobuf::Message in one key way: it does not prescribe any +** ownership between messages and submessages, and it relies on the +** client to delete each message/submessage/array/map at the appropriate +** time. +** +** A client can access a upb::Message without knowing anything about +** ownership semantics, but to create or mutate a message a user needs +** to implement the memory management themselves. +** +** Currently all messages, arrays, and maps store a upb_alloc* internally. +** Mutating operations use this when they require dynamically-allocated +** memory. We could potentially eliminate this size overhead later by +** letting the user flip a bit on the factory that prevents this from +** being stored. The user would then need to use separate functions where +** the upb_alloc* is passed explicitly. However for handlers to populate +** such structures, they would need a place to store this upb_alloc* during +** parsing; upb_handlers don't currently have a good way to accommodate this. +** +** TODO: UTF-8 checking? +**/ + +#ifndef UPB_MSG_H_ +#define UPB_MSG_H_ + +/* +** Defs are upb's internal representation of the constructs that can appear +** in a .proto file: +** +** - upb::MessageDef (upb_msgdef): describes a "message" construct. +** - upb::FieldDef (upb_fielddef): describes a message field. +** - upb::FileDef (upb_filedef): describes a .proto file and its defs. +** - upb::EnumDef (upb_enumdef): describes an enum. +** - upb::OneofDef (upb_oneofdef): describes a oneof. +** - upb::Def (upb_def): base class of all the others. +** +** TODO: definitions of services. +** +** Like upb_refcounted objects, defs are mutable only until frozen, and are +** only thread-safe once frozen. +** +** This is a mixed C/C++ interface that offers a full API to both languages. +** See the top-level README for more information. +*/ + +#ifndef UPB_DEF_H_ +#define UPB_DEF_H_ + +/* +** upb::RefCounted (upb_refcounted) +** +** A refcounting scheme that supports circular refs. It accomplishes this by +** partitioning the set of objects into groups such that no cycle spans groups; +** we can then reference-count the group as a whole and ignore refs within the +** group. When objects are mutable, these groups are computed very +** conservatively; we group any objects that have ever had a link between them. +** When objects are frozen, we compute strongly-connected components which +** allows us to be precise and only group objects that are actually cyclic. +** +** This is a mixed C/C++ interface that offers a full API to both languages. +** See the top-level README for more information. +*/ + +#ifndef UPB_REFCOUNTED_H_ +#define UPB_REFCOUNTED_H_ + +/* +** upb_table +** +** This header is INTERNAL-ONLY! Its interfaces are not public or stable! +** This file defines very fast int->upb_value (inttable) and string->upb_value +** (strtable) hash tables. +** +** The table uses chained scatter with Brent's variation (inspired by the Lua +** implementation of hash tables). The hash function for strings is Austin +** Appleby's "MurmurHash." +** +** The inttable uses uintptr_t as its key, which guarantees it can be used to +** store pointers or integers of at least 32 bits (upb isn't really useful on +** systems where sizeof(void*) < 4). +** +** The table must be homogenous (all values of the same type). In debug +** mode, we check this on insert and lookup. +*/ + +#ifndef UPB_TABLE_H_ +#define UPB_TABLE_H_ + +#include <stdint.h> +#include <string.h> /* ** This file contains shared definitions that are widely used across upb. ** @@ -9,12 +116,6 @@ #ifndef UPB_H_ #define UPB_H_ -// php.h intentionally defined NDEBUG. We have to define this macro in order to -// be used together with php.h -#ifndef NDEBUG -#define NDEBUG -#endif - #include <assert.h> #include <stdarg.h> #include <stdbool.h> @@ -743,106 +844,6 @@ template <int N> class upb::InlinedEnvironment : public upb::Environment { #endif /* UPB_H_ */ -/* -** upb_decode: parsing into a upb_msg using a upb_msglayout. -*/ - -#ifndef UPB_DECODE_H_ -#define UPB_DECODE_H_ - -/* -** upb::Message is a representation for protobuf messages. -** -** However it differs from other common representations like -** google::protobuf::Message in one key way: it does not prescribe any -** ownership between messages and submessages, and it relies on the -** client to delete each message/submessage/array/map at the appropriate -** time. -** -** A client can access a upb::Message without knowing anything about -** ownership semantics, but to create or mutate a message a user needs -** to implement the memory management themselves. -** -** Currently all messages, arrays, and maps store a upb_alloc* internally. -** Mutating operations use this when they require dynamically-allocated -** memory. We could potentially eliminate this size overhead later by -** letting the user flip a bit on the factory that prevents this from -** being stored. The user would then need to use separate functions where -** the upb_alloc* is passed explicitly. However for handlers to populate -** such structures, they would need a place to store this upb_alloc* during -** parsing; upb_handlers don't currently have a good way to accommodate this. -** -** TODO: UTF-8 checking? -**/ - -#ifndef UPB_MSG_H_ -#define UPB_MSG_H_ - -/* -** Defs are upb's internal representation of the constructs that can appear -** in a .proto file: -** -** - upb::MessageDef (upb_msgdef): describes a "message" construct. -** - upb::FieldDef (upb_fielddef): describes a message field. -** - upb::FileDef (upb_filedef): describes a .proto file and its defs. -** - upb::EnumDef (upb_enumdef): describes an enum. -** - upb::OneofDef (upb_oneofdef): describes a oneof. -** - upb::Def (upb_def): base class of all the others. -** -** TODO: definitions of services. -** -** Like upb_refcounted objects, defs are mutable only until frozen, and are -** only thread-safe once frozen. -** -** This is a mixed C/C++ interface that offers a full API to both languages. -** See the top-level README for more information. -*/ - -#ifndef UPB_DEF_H_ -#define UPB_DEF_H_ - -/* -** upb::RefCounted (upb_refcounted) -** -** A refcounting scheme that supports circular refs. It accomplishes this by -** partitioning the set of objects into groups such that no cycle spans groups; -** we can then reference-count the group as a whole and ignore refs within the -** group. When objects are mutable, these groups are computed very -** conservatively; we group any objects that have ever had a link between them. -** When objects are frozen, we compute strongly-connected components which -** allows us to be precise and only group objects that are actually cyclic. -** -** This is a mixed C/C++ interface that offers a full API to both languages. -** See the top-level README for more information. -*/ - -#ifndef UPB_REFCOUNTED_H_ -#define UPB_REFCOUNTED_H_ - -/* -** upb_table -** -** This header is INTERNAL-ONLY! Its interfaces are not public or stable! -** This file defines very fast int->upb_value (inttable) and string->upb_value -** (strtable) hash tables. -** -** The table uses chained scatter with Brent's variation (inspired by the Lua -** implementation of hash tables). The hash function for strings is Austin -** Appleby's "MurmurHash." -** -** The inttable uses uintptr_t as its key, which guarantees it can be used to -** store pointers or integers of at least 32 bits (upb isn't really useful on -** systems where sizeof(void*) < 4). -** -** The table must be homogenous (all values of the same type). In debug -** mode, we check this on insert and lookup. -*/ - -#ifndef UPB_TABLE_H_ -#define UPB_TABLE_H_ - -#include <stdint.h> -#include <string.h> #ifdef __cplusplus extern "C" { @@ -2001,6 +2002,9 @@ typedef enum { UPB_SYNTAX_PROTO3 = 3 } upb_syntax_t; +/* Maps descriptor type -> upb field type. */ +extern const uint8_t upb_desctype_to_fieldtype[]; + /* Maximum field number allowed for FieldDefs. This is an inherent limit of the * protobuf wire format. */ #define UPB_MAX_FIELDNUMBER ((1 << 29) - 1) @@ -6747,7 +6751,7 @@ typedef struct { uint16_t hasbit; /* UPB_NO_HASBIT if no hasbit. */ uint16_t oneof_index; /* UPB_NOT_IN_ONEOF if not in a oneof. */ uint16_t submsg_index; /* UPB_NO_SUBMSG if no submsg. */ - uint8_t type; + uint8_t descriptortype; uint8_t label; } upb_msglayout_fieldinit_v1; @@ -6793,6 +6797,714 @@ UPB_END_EXTERN_C #endif /* UPB_DECODE_H_ */ /* +** upb_encode: parsing into a upb_msg using a upb_msglayout. +*/ + +#ifndef UPB_ENCODE_H_ +#define UPB_ENCODE_H_ + + +UPB_BEGIN_EXTERN_C + +char *upb_encode(const void *msg, const upb_msglayout_msginit_v1 *l, + upb_env *env, size_t *size); + +UPB_END_EXTERN_C + +#endif /* UPB_ENCODE_H_ */ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * google/protobuf/descriptor.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ +#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ + + +UPB_BEGIN_EXTERN_C + +struct google_protobuf_FileDescriptorSet; +typedef struct google_protobuf_FileDescriptorSet google_protobuf_FileDescriptorSet; +struct google_protobuf_FileDescriptorProto; +typedef struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto; +struct google_protobuf_DescriptorProto; +typedef struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto; +struct google_protobuf_DescriptorProto_ExtensionRange; +typedef struct google_protobuf_DescriptorProto_ExtensionRange google_protobuf_DescriptorProto_ExtensionRange; +struct google_protobuf_DescriptorProto_ReservedRange; +typedef struct google_protobuf_DescriptorProto_ReservedRange google_protobuf_DescriptorProto_ReservedRange; +struct google_protobuf_ExtensionRangeOptions; +typedef struct google_protobuf_ExtensionRangeOptions google_protobuf_ExtensionRangeOptions; +struct google_protobuf_FieldDescriptorProto; +typedef struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto; +struct google_protobuf_OneofDescriptorProto; +typedef struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto; +struct google_protobuf_EnumDescriptorProto; +typedef struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto; +struct google_protobuf_EnumDescriptorProto_EnumReservedRange; +typedef struct google_protobuf_EnumDescriptorProto_EnumReservedRange google_protobuf_EnumDescriptorProto_EnumReservedRange; +struct google_protobuf_EnumValueDescriptorProto; +typedef struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto; +struct google_protobuf_ServiceDescriptorProto; +typedef struct google_protobuf_ServiceDescriptorProto google_protobuf_ServiceDescriptorProto; +struct google_protobuf_MethodDescriptorProto; +typedef struct google_protobuf_MethodDescriptorProto google_protobuf_MethodDescriptorProto; +struct google_protobuf_FileOptions; +typedef struct google_protobuf_FileOptions google_protobuf_FileOptions; +struct google_protobuf_MessageOptions; +typedef struct google_protobuf_MessageOptions google_protobuf_MessageOptions; +struct google_protobuf_FieldOptions; +typedef struct google_protobuf_FieldOptions google_protobuf_FieldOptions; +struct google_protobuf_OneofOptions; +typedef struct google_protobuf_OneofOptions google_protobuf_OneofOptions; +struct google_protobuf_EnumOptions; +typedef struct google_protobuf_EnumOptions google_protobuf_EnumOptions; +struct google_protobuf_EnumValueOptions; +typedef struct google_protobuf_EnumValueOptions google_protobuf_EnumValueOptions; +struct google_protobuf_ServiceOptions; +typedef struct google_protobuf_ServiceOptions google_protobuf_ServiceOptions; +struct google_protobuf_MethodOptions; +typedef struct google_protobuf_MethodOptions google_protobuf_MethodOptions; +struct google_protobuf_UninterpretedOption; +typedef struct google_protobuf_UninterpretedOption google_protobuf_UninterpretedOption; +struct google_protobuf_UninterpretedOption_NamePart; +typedef struct google_protobuf_UninterpretedOption_NamePart google_protobuf_UninterpretedOption_NamePart; +struct google_protobuf_SourceCodeInfo; +typedef struct google_protobuf_SourceCodeInfo google_protobuf_SourceCodeInfo; +struct google_protobuf_SourceCodeInfo_Location; +typedef struct google_protobuf_SourceCodeInfo_Location google_protobuf_SourceCodeInfo_Location; +struct google_protobuf_GeneratedCodeInfo; +typedef struct google_protobuf_GeneratedCodeInfo google_protobuf_GeneratedCodeInfo; +struct google_protobuf_GeneratedCodeInfo_Annotation; +typedef struct google_protobuf_GeneratedCodeInfo_Annotation google_protobuf_GeneratedCodeInfo_Annotation; +/* Enums */ + +typedef enum { + google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1, + google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2, + google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3 +} google_protobuf_FieldDescriptorProto_Label; + +typedef enum { + google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1, + google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2, + google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3, + google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4, + google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5, + google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6, + google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7, + google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8, + google_protobuf_FieldDescriptorProto_TYPE_STRING = 9, + google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10, + google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11, + google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12, + google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13, + google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14, + google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15, + google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16, + google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17, + google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18 +} google_protobuf_FieldDescriptorProto_Type; + +typedef enum { + google_protobuf_FieldOptions_STRING = 0, + google_protobuf_FieldOptions_CORD = 1, + google_protobuf_FieldOptions_STRING_PIECE = 2 +} google_protobuf_FieldOptions_CType; + +typedef enum { + google_protobuf_FieldOptions_JS_NORMAL = 0, + google_protobuf_FieldOptions_JS_STRING = 1, + google_protobuf_FieldOptions_JS_NUMBER = 2 +} google_protobuf_FieldOptions_JSType; + +typedef enum { + google_protobuf_FileOptions_SPEED = 1, + google_protobuf_FileOptions_CODE_SIZE = 2, + google_protobuf_FileOptions_LITE_RUNTIME = 3 +} google_protobuf_FileOptions_OptimizeMode; + +typedef enum { + google_protobuf_MethodOptions_IDEMPOTENCY_UNKNOWN = 0, + google_protobuf_MethodOptions_NO_SIDE_EFFECTS = 1, + google_protobuf_MethodOptions_IDEMPOTENT = 2 +} google_protobuf_MethodOptions_IdempotencyLevel; + +/* google_protobuf_FileDescriptorSet */ +extern const upb_msglayout_msginit_v1 google_protobuf_FileDescriptorSet_msginit; +google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_env *env); +google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_FileDescriptorSet_serialize(google_protobuf_FileDescriptorSet *msg, upb_env *env, size_t *len); +void google_protobuf_FileDescriptorSet_free(google_protobuf_FileDescriptorSet *msg, upb_env *env); + +/* getters. */ +const upb_array* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet *msg); + +/* setters. */ +void google_protobuf_FileDescriptorSet_set_file(google_protobuf_FileDescriptorSet *msg, upb_array* value); + + +/* google_protobuf_FileDescriptorProto */ +extern const upb_msglayout_msginit_v1 google_protobuf_FileDescriptorProto_msginit; +google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_env *env); +google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_FileDescriptorProto_serialize(google_protobuf_FileDescriptorProto *msg, upb_env *env, size_t *len); +void google_protobuf_FileDescriptorProto_free(google_protobuf_FileDescriptorProto *msg, upb_env *env); + +/* getters. */ +upb_stringview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg); +upb_stringview google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg); +const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg); +const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg); +const upb_array* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg); +upb_stringview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg); + +/* setters. */ +void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_stringview value); +void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_stringview value); +void google_protobuf_FileDescriptorProto_set_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value); +void google_protobuf_FileDescriptorProto_set_message_type(google_protobuf_FileDescriptorProto *msg, upb_array* value); +void google_protobuf_FileDescriptorProto_set_enum_type(google_protobuf_FileDescriptorProto *msg, upb_array* value); +void google_protobuf_FileDescriptorProto_set_service(google_protobuf_FileDescriptorProto *msg, upb_array* value); +void google_protobuf_FileDescriptorProto_set_extension(google_protobuf_FileDescriptorProto *msg, upb_array* value); +void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value); +void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value); +void google_protobuf_FileDescriptorProto_set_public_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value); +void google_protobuf_FileDescriptorProto_set_weak_dependency(google_protobuf_FileDescriptorProto *msg, upb_array* value); +void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_stringview value); + + +/* google_protobuf_DescriptorProto */ +extern const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_msginit; +google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_env *env); +google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_DescriptorProto_serialize(google_protobuf_DescriptorProto *msg, upb_env *env, size_t *len); +void google_protobuf_DescriptorProto_free(google_protobuf_DescriptorProto *msg, upb_env *env); + +/* getters. */ +upb_stringview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg); +const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto *msg); +const upb_array* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto *msg); + +/* setters. */ +void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_stringview value); +void google_protobuf_DescriptorProto_set_field(google_protobuf_DescriptorProto *msg, upb_array* value); +void google_protobuf_DescriptorProto_set_nested_type(google_protobuf_DescriptorProto *msg, upb_array* value); +void google_protobuf_DescriptorProto_set_enum_type(google_protobuf_DescriptorProto *msg, upb_array* value); +void google_protobuf_DescriptorProto_set_extension_range(google_protobuf_DescriptorProto *msg, upb_array* value); +void google_protobuf_DescriptorProto_set_extension(google_protobuf_DescriptorProto *msg, upb_array* value); +void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value); +void google_protobuf_DescriptorProto_set_oneof_decl(google_protobuf_DescriptorProto *msg, upb_array* value); +void google_protobuf_DescriptorProto_set_reserved_range(google_protobuf_DescriptorProto *msg, upb_array* value); +void google_protobuf_DescriptorProto_set_reserved_name(google_protobuf_DescriptorProto *msg, upb_array* value); + + +/* google_protobuf_DescriptorProto_ExtensionRange */ +extern const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_ExtensionRange_msginit; +google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_env *env); +google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_DescriptorProto_ExtensionRange_serialize(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_env *env, size_t *len); +void google_protobuf_DescriptorProto_ExtensionRange_free(google_protobuf_DescriptorProto_ExtensionRange *msg, upb_env *env); + +/* getters. */ +int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange *msg); +int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange *msg); +const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange *msg); + +/* setters. */ +void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value); +void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value); +void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value); + + +/* google_protobuf_DescriptorProto_ReservedRange */ +extern const upb_msglayout_msginit_v1 google_protobuf_DescriptorProto_ReservedRange_msginit; +google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_env *env); +google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_DescriptorProto_ReservedRange_serialize(google_protobuf_DescriptorProto_ReservedRange *msg, upb_env *env, size_t *len); +void google_protobuf_DescriptorProto_ReservedRange_free(google_protobuf_DescriptorProto_ReservedRange *msg, upb_env *env); + +/* getters. */ +int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange *msg); +int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange *msg); + +/* setters. */ +void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value); +void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value); + + +/* google_protobuf_ExtensionRangeOptions */ +extern const upb_msglayout_msginit_v1 google_protobuf_ExtensionRangeOptions_msginit; +google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_env *env); +google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_ExtensionRangeOptions_serialize(google_protobuf_ExtensionRangeOptions *msg, upb_env *env, size_t *len); +void google_protobuf_ExtensionRangeOptions_free(google_protobuf_ExtensionRangeOptions *msg, upb_env *env); + +/* getters. */ +const upb_array* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions *msg); + +/* setters. */ +void google_protobuf_ExtensionRangeOptions_set_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_array* value); + + +/* google_protobuf_FieldDescriptorProto */ +extern const upb_msglayout_msginit_v1 google_protobuf_FieldDescriptorProto_msginit; +google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_env *env); +google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_FieldDescriptorProto_serialize(google_protobuf_FieldDescriptorProto *msg, upb_env *env, size_t *len); +void google_protobuf_FieldDescriptorProto_free(google_protobuf_FieldDescriptorProto *msg, upb_env *env); + +/* getters. */ +upb_stringview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg); +upb_stringview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg); +int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg); +google_protobuf_FieldDescriptorProto_Label google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg); +google_protobuf_FieldDescriptorProto_Type google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg); +upb_stringview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg); +upb_stringview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg); +const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg); +int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg); +upb_stringview google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg); + +/* setters. */ +void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value); +void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_stringview value); +void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value); +void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldDescriptorProto_Label value); +void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldDescriptorProto_Type value); +void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value); +void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_stringview value); +void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value); +void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value); +void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_stringview value); + + +/* google_protobuf_OneofDescriptorProto */ +extern const upb_msglayout_msginit_v1 google_protobuf_OneofDescriptorProto_msginit; +google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_env *env); +google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_OneofDescriptorProto_serialize(google_protobuf_OneofDescriptorProto *msg, upb_env *env, size_t *len); +void google_protobuf_OneofDescriptorProto_free(google_protobuf_OneofDescriptorProto *msg, upb_env *env); + +/* getters. */ +upb_stringview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg); +const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto *msg); + +/* setters. */ +void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_stringview value); +void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value); + + +/* google_protobuf_EnumDescriptorProto */ +extern const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_msginit; +google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_env *env); +google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_EnumDescriptorProto_serialize(google_protobuf_EnumDescriptorProto *msg, upb_env *env, size_t *len); +void google_protobuf_EnumDescriptorProto_free(google_protobuf_EnumDescriptorProto *msg, upb_env *env); + +/* getters. */ +upb_stringview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg); +const upb_array* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg); +const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto *msg); +const upb_array* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto *msg); +const upb_array* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto *msg); + +/* setters. */ +void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_stringview value); +void google_protobuf_EnumDescriptorProto_set_value(google_protobuf_EnumDescriptorProto *msg, upb_array* value); +void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value); +void google_protobuf_EnumDescriptorProto_set_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_array* value); +void google_protobuf_EnumDescriptorProto_set_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_array* value); + + +/* google_protobuf_EnumDescriptorProto_EnumReservedRange */ +extern const upb_msglayout_msginit_v1 google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit; +google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_env *env); +google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_env *env, size_t *len); +void google_protobuf_EnumDescriptorProto_EnumReservedRange_free(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_env *env); + +/* getters. */ +int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg); +int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg); + +/* setters. */ +void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value); +void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value); + + +/* google_protobuf_EnumValueDescriptorProto */ +extern const upb_msglayout_msginit_v1 google_protobuf_EnumValueDescriptorProto_msginit; +google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_env *env); +google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_EnumValueDescriptorProto_serialize(google_protobuf_EnumValueDescriptorProto *msg, upb_env *env, size_t *len); +void google_protobuf_EnumValueDescriptorProto_free(google_protobuf_EnumValueDescriptorProto *msg, upb_env *env); + +/* getters. */ +upb_stringview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg); +int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg); +const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg); + +/* setters. */ +void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_stringview value); +void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value); +void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value); + + +/* google_protobuf_ServiceDescriptorProto */ +extern const upb_msglayout_msginit_v1 google_protobuf_ServiceDescriptorProto_msginit; +google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_env *env); +google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_ServiceDescriptorProto_serialize(google_protobuf_ServiceDescriptorProto *msg, upb_env *env, size_t *len); +void google_protobuf_ServiceDescriptorProto_free(google_protobuf_ServiceDescriptorProto *msg, upb_env *env); + +/* getters. */ +upb_stringview google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto *msg); +const upb_array* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto *msg); +const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto *msg); + +/* setters. */ +void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_stringview value); +void google_protobuf_ServiceDescriptorProto_set_method(google_protobuf_ServiceDescriptorProto *msg, upb_array* value); +void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value); + + +/* google_protobuf_MethodDescriptorProto */ +extern const upb_msglayout_msginit_v1 google_protobuf_MethodDescriptorProto_msginit; +google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_env *env); +google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_MethodDescriptorProto_serialize(google_protobuf_MethodDescriptorProto *msg, upb_env *env, size_t *len); +void google_protobuf_MethodDescriptorProto_free(google_protobuf_MethodDescriptorProto *msg, upb_env *env); + +/* getters. */ +upb_stringview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg); +upb_stringview google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto *msg); +upb_stringview google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto *msg); +const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg); +bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg); +bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg); + +/* setters. */ +void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_stringview value); +void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_stringview value); +void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_stringview value); +void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value); +void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value); +void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value); + + +/* google_protobuf_FileOptions */ +extern const upb_msglayout_msginit_v1 google_protobuf_FileOptions_msginit; +google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_env *env); +google_protobuf_FileOptions *google_protobuf_FileOptions_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_FileOptions_serialize(google_protobuf_FileOptions *msg, upb_env *env, size_t *len); +void google_protobuf_FileOptions_free(google_protobuf_FileOptions *msg, upb_env *env); + +/* getters. */ +upb_stringview google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions *msg); +upb_stringview google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions *msg); +google_protobuf_FileOptions_OptimizeMode google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions *msg); +bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions *msg); +upb_stringview google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions *msg); +bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions *msg); +bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions *msg); +bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions *msg); +bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg); +bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions *msg); +bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions *msg); +bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions *msg); +upb_stringview google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions *msg); +upb_stringview google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions *msg); +upb_stringview google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions *msg); +upb_stringview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg); +upb_stringview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg); +bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions *msg); +const upb_array* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg); + +/* setters. */ +void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_stringview value); +void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_stringview value); +void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, google_protobuf_FileOptions_OptimizeMode value); +void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value); +void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_stringview value); +void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value); +void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value); +void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value); +void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value); +void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value); +void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value); +void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value); +void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_stringview value); +void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_stringview value); +void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_stringview value); +void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_stringview value); +void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_stringview value); +void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value); +void google_protobuf_FileOptions_set_uninterpreted_option(google_protobuf_FileOptions *msg, upb_array* value); + + +/* google_protobuf_MessageOptions */ +extern const upb_msglayout_msginit_v1 google_protobuf_MessageOptions_msginit; +google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_env *env); +google_protobuf_MessageOptions *google_protobuf_MessageOptions_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_MessageOptions_serialize(google_protobuf_MessageOptions *msg, upb_env *env, size_t *len); +void google_protobuf_MessageOptions_free(google_protobuf_MessageOptions *msg, upb_env *env); + +/* getters. */ +bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions *msg); +bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions *msg); +bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions *msg); +bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg); +const upb_array* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions *msg); + +/* setters. */ +void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value); +void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value); +void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value); +void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value); +void google_protobuf_MessageOptions_set_uninterpreted_option(google_protobuf_MessageOptions *msg, upb_array* value); + + +/* google_protobuf_FieldOptions */ +extern const upb_msglayout_msginit_v1 google_protobuf_FieldOptions_msginit; +google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_env *env); +google_protobuf_FieldOptions *google_protobuf_FieldOptions_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_FieldOptions_serialize(google_protobuf_FieldOptions *msg, upb_env *env, size_t *len); +void google_protobuf_FieldOptions_free(google_protobuf_FieldOptions *msg, upb_env *env); + +/* getters. */ +google_protobuf_FieldOptions_CType google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions *msg); +bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg); +bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions *msg); +bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg); +google_protobuf_FieldOptions_JSType google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions *msg); +bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg); +const upb_array* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions *msg); + +/* setters. */ +void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_CType value); +void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value); +void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value); +void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value); +void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_JSType value); +void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value); +void google_protobuf_FieldOptions_set_uninterpreted_option(google_protobuf_FieldOptions *msg, upb_array* value); + + +/* google_protobuf_OneofOptions */ +extern const upb_msglayout_msginit_v1 google_protobuf_OneofOptions_msginit; +google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_env *env); +google_protobuf_OneofOptions *google_protobuf_OneofOptions_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_OneofOptions_serialize(google_protobuf_OneofOptions *msg, upb_env *env, size_t *len); +void google_protobuf_OneofOptions_free(google_protobuf_OneofOptions *msg, upb_env *env); + +/* getters. */ +const upb_array* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions *msg); + +/* setters. */ +void google_protobuf_OneofOptions_set_uninterpreted_option(google_protobuf_OneofOptions *msg, upb_array* value); + + +/* google_protobuf_EnumOptions */ +extern const upb_msglayout_msginit_v1 google_protobuf_EnumOptions_msginit; +google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_env *env); +google_protobuf_EnumOptions *google_protobuf_EnumOptions_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_EnumOptions_serialize(google_protobuf_EnumOptions *msg, upb_env *env, size_t *len); +void google_protobuf_EnumOptions_free(google_protobuf_EnumOptions *msg, upb_env *env); + +/* getters. */ +bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions *msg); +bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions *msg); +const upb_array* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions *msg); + +/* setters. */ +void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value); +void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value); +void google_protobuf_EnumOptions_set_uninterpreted_option(google_protobuf_EnumOptions *msg, upb_array* value); + + +/* google_protobuf_EnumValueOptions */ +extern const upb_msglayout_msginit_v1 google_protobuf_EnumValueOptions_msginit; +google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_env *env); +google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_EnumValueOptions_serialize(google_protobuf_EnumValueOptions *msg, upb_env *env, size_t *len); +void google_protobuf_EnumValueOptions_free(google_protobuf_EnumValueOptions *msg, upb_env *env); + +/* getters. */ +bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions *msg); +const upb_array* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions *msg); + +/* setters. */ +void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value); +void google_protobuf_EnumValueOptions_set_uninterpreted_option(google_protobuf_EnumValueOptions *msg, upb_array* value); + + +/* google_protobuf_ServiceOptions */ +extern const upb_msglayout_msginit_v1 google_protobuf_ServiceOptions_msginit; +google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_env *env); +google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_ServiceOptions_serialize(google_protobuf_ServiceOptions *msg, upb_env *env, size_t *len); +void google_protobuf_ServiceOptions_free(google_protobuf_ServiceOptions *msg, upb_env *env); + +/* getters. */ +bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions *msg); +const upb_array* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions *msg); + +/* setters. */ +void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value); +void google_protobuf_ServiceOptions_set_uninterpreted_option(google_protobuf_ServiceOptions *msg, upb_array* value); + + +/* google_protobuf_MethodOptions */ +extern const upb_msglayout_msginit_v1 google_protobuf_MethodOptions_msginit; +google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_env *env); +google_protobuf_MethodOptions *google_protobuf_MethodOptions_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_MethodOptions_serialize(google_protobuf_MethodOptions *msg, upb_env *env, size_t *len); +void google_protobuf_MethodOptions_free(google_protobuf_MethodOptions *msg, upb_env *env); + +/* getters. */ +bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions *msg); +google_protobuf_MethodOptions_IdempotencyLevel google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions *msg); +const upb_array* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg); + +/* setters. */ +void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value); +void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, google_protobuf_MethodOptions_IdempotencyLevel value); +void google_protobuf_MethodOptions_set_uninterpreted_option(google_protobuf_MethodOptions *msg, upb_array* value); + + +/* google_protobuf_UninterpretedOption */ +extern const upb_msglayout_msginit_v1 google_protobuf_UninterpretedOption_msginit; +google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_env *env); +google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_UninterpretedOption_serialize(google_protobuf_UninterpretedOption *msg, upb_env *env, size_t *len); +void google_protobuf_UninterpretedOption_free(google_protobuf_UninterpretedOption *msg, upb_env *env); + +/* getters. */ +const upb_array* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg); +upb_stringview google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption *msg); +uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption *msg); +int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption *msg); +double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption *msg); +upb_stringview google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption *msg); +upb_stringview google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption *msg); + +/* setters. */ +void google_protobuf_UninterpretedOption_set_name(google_protobuf_UninterpretedOption *msg, upb_array* value); +void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_stringview value); +void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value); +void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value); +void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value); +void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_stringview value); +void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_stringview value); + + +/* google_protobuf_UninterpretedOption_NamePart */ +extern const upb_msglayout_msginit_v1 google_protobuf_UninterpretedOption_NamePart_msginit; +google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_env *env); +google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_UninterpretedOption_NamePart_serialize(google_protobuf_UninterpretedOption_NamePart *msg, upb_env *env, size_t *len); +void google_protobuf_UninterpretedOption_NamePart_free(google_protobuf_UninterpretedOption_NamePart *msg, upb_env *env); + +/* getters. */ +upb_stringview google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart *msg); +bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg); + +/* setters. */ +void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_stringview value); +void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value); + + +/* google_protobuf_SourceCodeInfo */ +extern const upb_msglayout_msginit_v1 google_protobuf_SourceCodeInfo_msginit; +google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_env *env); +google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_SourceCodeInfo_serialize(google_protobuf_SourceCodeInfo *msg, upb_env *env, size_t *len); +void google_protobuf_SourceCodeInfo_free(google_protobuf_SourceCodeInfo *msg, upb_env *env); + +/* getters. */ +const upb_array* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo *msg); + +/* setters. */ +void google_protobuf_SourceCodeInfo_set_location(google_protobuf_SourceCodeInfo *msg, upb_array* value); + + +/* google_protobuf_SourceCodeInfo_Location */ +extern const upb_msglayout_msginit_v1 google_protobuf_SourceCodeInfo_Location_msginit; +google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_env *env); +google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_SourceCodeInfo_Location_serialize(google_protobuf_SourceCodeInfo_Location *msg, upb_env *env, size_t *len); +void google_protobuf_SourceCodeInfo_Location_free(google_protobuf_SourceCodeInfo_Location *msg, upb_env *env); + +/* getters. */ +const upb_array* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location *msg); +const upb_array* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location *msg); +upb_stringview google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location *msg); +upb_stringview google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location *msg); +const upb_array* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location *msg); + +/* setters. */ +void google_protobuf_SourceCodeInfo_Location_set_path(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value); +void google_protobuf_SourceCodeInfo_Location_set_span(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value); +void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_stringview value); +void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_stringview value); +void google_protobuf_SourceCodeInfo_Location_set_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_array* value); + + +/* google_protobuf_GeneratedCodeInfo */ +extern const upb_msglayout_msginit_v1 google_protobuf_GeneratedCodeInfo_msginit; +google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_env *env); +google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_GeneratedCodeInfo_serialize(google_protobuf_GeneratedCodeInfo *msg, upb_env *env, size_t *len); +void google_protobuf_GeneratedCodeInfo_free(google_protobuf_GeneratedCodeInfo *msg, upb_env *env); + +/* getters. */ +const upb_array* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo *msg); + +/* setters. */ +void google_protobuf_GeneratedCodeInfo_set_annotation(google_protobuf_GeneratedCodeInfo *msg, upb_array* value); + + +/* google_protobuf_GeneratedCodeInfo_Annotation */ +extern const upb_msglayout_msginit_v1 google_protobuf_GeneratedCodeInfo_Annotation_msginit; +google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_env *env); +google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parsenew(upb_stringview buf, upb_env *env); +char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_env *env, size_t *len); +void google_protobuf_GeneratedCodeInfo_Annotation_free(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_env *env); + +/* getters. */ +const upb_array* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation *msg); +upb_stringview google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg); +int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg); +int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg); + +/* setters. */ +void google_protobuf_GeneratedCodeInfo_Annotation_set_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_array* value); +void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_stringview value); +void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value); +void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value); + + +UPB_END_EXTERN_C + +#endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ */ +/* ** structs.int.h: structures definitions that are internal to upb. */ @@ -7001,22 +7713,6 @@ extern const struct upb_refcounted_vtbl upb_filedef_vtbl; #endif /* UPB_STATICINIT_H_ */ /* -** upb_encode: parsing into a upb_msg using a upb_msglayout. -*/ - -#ifndef UPB_ENCODE_H_ -#define UPB_ENCODE_H_ - - -UPB_BEGIN_EXTERN_C - -char *upb_encode(const void *msg, const upb_msglayout_msginit_v1 *l, - upb_env *env, size_t *size); - -UPB_END_EXTERN_C - -#endif /* UPB_ENCODE_H_ */ -/* ** upb::descriptor::Reader (upb_descreader) ** ** Provides a way of building upb::Defs from data in descriptor.proto format. @@ -7118,53 +7814,6 @@ inline FileDef* Reader::file(size_t i) const { UPB_BEGIN_EXTERN_C -/* Enums */ - -typedef enum { - google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1, - google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2, - google_protobuf_FieldDescriptorProto_LABEL_REPEATED = 3 -} google_protobuf_FieldDescriptorProto_Label; - -typedef enum { - google_protobuf_FieldDescriptorProto_TYPE_DOUBLE = 1, - google_protobuf_FieldDescriptorProto_TYPE_FLOAT = 2, - google_protobuf_FieldDescriptorProto_TYPE_INT64 = 3, - google_protobuf_FieldDescriptorProto_TYPE_UINT64 = 4, - google_protobuf_FieldDescriptorProto_TYPE_INT32 = 5, - google_protobuf_FieldDescriptorProto_TYPE_FIXED64 = 6, - google_protobuf_FieldDescriptorProto_TYPE_FIXED32 = 7, - google_protobuf_FieldDescriptorProto_TYPE_BOOL = 8, - google_protobuf_FieldDescriptorProto_TYPE_STRING = 9, - google_protobuf_FieldDescriptorProto_TYPE_GROUP = 10, - google_protobuf_FieldDescriptorProto_TYPE_MESSAGE = 11, - google_protobuf_FieldDescriptorProto_TYPE_BYTES = 12, - google_protobuf_FieldDescriptorProto_TYPE_UINT32 = 13, - google_protobuf_FieldDescriptorProto_TYPE_ENUM = 14, - google_protobuf_FieldDescriptorProto_TYPE_SFIXED32 = 15, - google_protobuf_FieldDescriptorProto_TYPE_SFIXED64 = 16, - google_protobuf_FieldDescriptorProto_TYPE_SINT32 = 17, - google_protobuf_FieldDescriptorProto_TYPE_SINT64 = 18 -} google_protobuf_FieldDescriptorProto_Type; - -typedef enum { - google_protobuf_FieldOptions_STRING = 0, - google_protobuf_FieldOptions_CORD = 1, - google_protobuf_FieldOptions_STRING_PIECE = 2 -} google_protobuf_FieldOptions_CType; - -typedef enum { - google_protobuf_FieldOptions_JS_NORMAL = 0, - google_protobuf_FieldOptions_JS_STRING = 1, - google_protobuf_FieldOptions_JS_NUMBER = 2 -} google_protobuf_FieldOptions_JSType; - -typedef enum { - google_protobuf_FileOptions_SPEED = 1, - google_protobuf_FileOptions_CODE_SIZE = 2, - google_protobuf_FileOptions_LITE_RUNTIME = 3 -} google_protobuf_FileOptions_OptimizeMode; - /* MessageDefs: call these functions to get a ref to a msgdef. */ const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_get(const void *owner); const upb_msgdef *upbdefs_google_protobuf_DescriptorProto_ExtensionRange_get(const void *owner); |