1 /* --- protobuf-c-private.h: private structures and functions --- */
3 * Copyright 2008, Dave Benson.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License
8 * at http://www.apache.org/licenses/LICENSE-2.0 Unless
9 * required by applicable law or agreed to in writing,
10 * software distributed under the License is distributed on
11 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
12 * KIND, either express or implied. See the License for the
13 * specific language governing permissions and limitations
18 /* === needs to be declared for the PROTOBUF_C_BUFFER_SIMPLE_INIT macro === */
20 void protobuf_c_buffer_simple_append (ProtobufCBuffer *buffer,
22 const unsigned char *data);
24 /* === stuff which needs to be declared for use in the generated code === */
26 struct _ProtobufCEnumValueIndex
29 unsigned index; /* into values[] array */
32 /* IntRange: helper structure for optimizing
34 in the case where the keys are mostly consecutive values,
35 as they presumably are for enums and fields.
37 The data structures assumes that the values in the original
39 struct _ProtobufCIntRange
43 /* NOTE: the number of values in the range can
44 be inferred by looking at the next element's orig_index.
45 a dummy element is added to make this simple */
49 /* === declared for exposition on ProtobufCIntRange === */
50 /* note: ranges must have an extra sentinel IntRange at the end whose
51 orig_index is set to the number of actual values in the original array */
52 /* returns -1 if no orig_index found */
53 int protobuf_c_int_ranges_lookup (unsigned n_ranges,
54 ProtobufCIntRange *ranges);
56 #define PROTOBUF_C_SERVICE_DESCRIPTOR_MAGIC 0x14159bc3
57 #define PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC 0x28aaeef9
58 #define PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC 0x114315af
60 /* === behind the scenes on the generated service's __init functions */
61 typedef void (*ProtobufCServiceDestroy) (ProtobufCService *service);
63 protobuf_c_service_generated_init (ProtobufCService *service,
64 const ProtobufCServiceDescriptor *descriptor,
65 ProtobufCServiceDestroy destroy);
68 protobuf_c_service_invoke_internal(ProtobufCService *service,
69 unsigned method_index,
70 const ProtobufCMessage *input,
71 ProtobufCClosure closure,