Navit SVN

/work/compile/navit/src/navit/maptool/google/protobuf-c/protobuf-c-private.h

00001 /* --- protobuf-c-private.h: private structures and functions --- */
00002 /*
00003  * Copyright 2008, Dave Benson.
00004  * 
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License
00008  * at http://www.apache.org/licenses/LICENSE-2.0 Unless
00009  * required by applicable law or agreed to in writing,
00010  * software distributed under the License is distributed on
00011  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00012  * KIND, either express or implied. See the License for the
00013  * specific language governing permissions and limitations
00014  * under the License.
00015  */
00016 
00017 
00018 /* === needs to be declared for the PROTOBUF_C_BUFFER_SIMPLE_INIT macro === */
00019 
00020 void protobuf_c_buffer_simple_append (ProtobufCBuffer *buffer,
00021                                       size_t           len,
00022                                       const unsigned char *data);
00023 
00024 /* === stuff which needs to be declared for use in the generated code === */
00025 
00026 struct _ProtobufCEnumValueIndex
00027 {
00028   const char *name;
00029   unsigned index;               /* into values[] array */
00030 };
00031 
00032 /* IntRange: helper structure for optimizing
00033      int => index lookups
00034    in the case where the keys are mostly consecutive values,
00035    as they presumably are for enums and fields.
00036 
00037    The data structures assumes that the values in the original
00038    array are sorted */
00039 struct _ProtobufCIntRange
00040 {
00041   int start_value;
00042   unsigned orig_index;
00043   /* NOTE: the number of values in the range can
00044      be inferred by looking at the next element's orig_index.
00045      a dummy element is added to make this simple */
00046 };
00047 
00048 
00049 /* === declared for exposition on ProtobufCIntRange === */
00050 /* note: ranges must have an extra sentinel IntRange at the end whose
00051    orig_index is set to the number of actual values in the original array */
00052 /* returns -1 if no orig_index found */
00053 int protobuf_c_int_ranges_lookup (unsigned n_ranges,
00054                                   ProtobufCIntRange *ranges);
00055 
00056 #define PROTOBUF_C_SERVICE_DESCRIPTOR_MAGIC  0x14159bc3
00057 #define PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC  0x28aaeef9
00058 #define PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC     0x114315af
00059 
00060 /* === behind the scenes on the generated service's __init functions */
00061 typedef void (*ProtobufCServiceDestroy) (ProtobufCService *service);
00062 void
00063 protobuf_c_service_generated_init (ProtobufCService *service,
00064                                    const ProtobufCServiceDescriptor *descriptor,
00065                                    ProtobufCServiceDestroy destroy);
00066 
00067 void 
00068 protobuf_c_service_invoke_internal(ProtobufCService *service,
00069                                   unsigned          method_index,
00070                                   const ProtobufCMessage *input,
00071                                   ProtobufCClosure  closure,
00072                                   void             *closure_data);