nmsg  0.9.0
packet.pb-c.c
1 /* Generated by the protocol buffer compiler. DO NOT EDIT! */
2 /* Generated from: nmsg/base/packet.proto */
3 
4 /* Do not generate deprecated warnings for self */
5 #ifndef PROTOBUF_C__NO_DEPRECATED
6 #define PROTOBUF_C__NO_DEPRECATED
7 #endif
8 
9 #include "nmsg/base/packet.pb-c.h"
10 void nmsg__base__packet__init
11  (Nmsg__Base__Packet *message)
12 {
13  static Nmsg__Base__Packet init_value = NMSG__BASE__PACKET__INIT;
14  *message = init_value;
15 }
16 size_t nmsg__base__packet__get_packed_size
17  (const Nmsg__Base__Packet *message)
18 {
19  assert(message->base.descriptor == &nmsg__base__packet__descriptor);
20  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
21 }
22 size_t nmsg__base__packet__pack
23  (const Nmsg__Base__Packet *message,
24  uint8_t *out)
25 {
26  assert(message->base.descriptor == &nmsg__base__packet__descriptor);
27  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
28 }
29 size_t nmsg__base__packet__pack_to_buffer
30  (const Nmsg__Base__Packet *message,
31  ProtobufCBuffer *buffer)
32 {
33  assert(message->base.descriptor == &nmsg__base__packet__descriptor);
34  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
35 }
36 Nmsg__Base__Packet *
37  nmsg__base__packet__unpack
38  (ProtobufCAllocator *allocator,
39  size_t len,
40  const uint8_t *data)
41 {
42  return (Nmsg__Base__Packet *)
43  protobuf_c_message_unpack (&nmsg__base__packet__descriptor,
44  allocator, len, data);
45 }
46 void nmsg__base__packet__free_unpacked
47  (Nmsg__Base__Packet *message,
48  ProtobufCAllocator *allocator)
49 {
50  assert(message->base.descriptor == &nmsg__base__packet__descriptor);
51  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
52 }
53 static const ProtobufCFieldDescriptor nmsg__base__packet__field_descriptors[2] =
54 {
55  {
56  "payload_type",
57  1,
58  PROTOBUF_C_LABEL_REQUIRED,
59  PROTOBUF_C_TYPE_ENUM,
60  0, /* quantifier_offset */
61  offsetof(Nmsg__Base__Packet, payload_type),
62  &nmsg__base__packet_type__descriptor,
63  NULL,
64  0, /* flags */
65  0,NULL,NULL /* reserved1,reserved2, etc */
66  },
67  {
68  "payload",
69  2,
70  PROTOBUF_C_LABEL_REQUIRED,
71  PROTOBUF_C_TYPE_BYTES,
72  0, /* quantifier_offset */
73  offsetof(Nmsg__Base__Packet, payload),
74  NULL,
75  NULL,
76  0, /* flags */
77  0,NULL,NULL /* reserved1,reserved2, etc */
78  },
79 };
80 static const unsigned nmsg__base__packet__field_indices_by_name[] = {
81  1, /* field[1] = payload */
82  0, /* field[0] = payload_type */
83 };
84 static const ProtobufCIntRange nmsg__base__packet__number_ranges[1 + 1] =
85 {
86  { 1, 0 },
87  { 0, 2 }
88 };
89 const ProtobufCMessageDescriptor nmsg__base__packet__descriptor =
90 {
91  PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
92  "nmsg.base.Packet",
93  "Packet",
94  "Nmsg__Base__Packet",
95  "nmsg.base",
96  sizeof(Nmsg__Base__Packet),
97  2,
98  nmsg__base__packet__field_descriptors,
99  nmsg__base__packet__field_indices_by_name,
100  1, nmsg__base__packet__number_ranges,
101  (ProtobufCMessageInit) nmsg__base__packet__init,
102  NULL,NULL,NULL /* reserved[123] */
103 };
104 const ProtobufCEnumValue nmsg__base__packet_type__enum_values_by_number[1] =
105 {
106  { "IP", "NMSG__BASE__PACKET_TYPE__IP", 1 },
107 };
108 static const ProtobufCIntRange nmsg__base__packet_type__value_ranges[] = {
109 {1, 0},{0, 1}
110 };
111 const ProtobufCEnumValueIndex nmsg__base__packet_type__enum_values_by_name[1] =
112 {
113  { "IP", 0 },
114 };
115 const ProtobufCEnumDescriptor nmsg__base__packet_type__descriptor =
116 {
117  PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC,
118  "nmsg.base.PacketType",
119  "PacketType",
120  "Nmsg__Base__PacketType",
121  "nmsg.base",
122  1,
123  nmsg__base__packet_type__enum_values_by_number,
124  1,
125  nmsg__base__packet_type__enum_values_by_name,
126  1,
127  nmsg__base__packet_type__value_ranges,
128  NULL,NULL,NULL,NULL /* reserved[1234] */
129 };