title: protobuf-c: How to pack nested messages
body: <p>I have a Protobuf Protocol file that looks something like this:</p>
  
  <pre><code>message Foo {
      message Bar {
          required string name = 1;
          required string value = 2;
      }
  
      message Baz {
          required Bar a = 1;
      }
  }
  </code></pre>
  
  <p>Given this protocol file, I need to write an encoder using protobuf-c, the C extension for Protobuf. I wrote the following code:</p>
  
  <pre><code>Foo myfoo = FOO__INIT;
  Foo__Bar mybar = FOO__BAR__INIT;
  Foo__Baz mybaz = FOO__BAZ__INIT;
  mybaz.a = &amp;mybar;
  </code></pre>
  
  <p>However, I am stuck at this point on how to serialize <code>mybaz</code>. The generated struct for Foo, does not contain any entry that I can assign <code>mybaz</code> to. And no method for generated to directly pack Baz.</p>
  
  <p>In Python, this was a lot more simpler, since a <code>mybaz.SerializeToString()</code> function had been generated. How should I go about this in C?</p>