sofar/buxton — pull request #17 by ikeydoherty (2013-10-21 13:29:08+00:00)
Title: Add serialization methods for wire protocol

Relevant information is in the commit message for a63046b
Essentially this is what we need to serialize and deserialize messages for our upcoming wire protocol.

I tested using the following code:
```c
key.type = STRING;
key.store.d_string = "SomeKeyThisBe";

value.type = STRING;
value.store.d_string = "SomeValue";

/* Create a message */
if (!buxton_serialize_message(&dest, BUXTON_CONTROL_GET, 2, &key, &value)) {
printf("Failed to serialize message\n");
goto end;
}
```
Now, I tried a few tactics for deserialization and decided that a dynamically generated array was going to be the best course of action, coupled with the parameter count
```c
printf("%s\n", list[1].store.d_string);
```
We should easily be able to implement a solid workflow around the `BuxtonControlMessage`, array and array length parameters. I've also added `BUXTON_CONTROL_STATUS`, my thinking being we use this for status codes. Maximum 2 parameters, the first being a status code within a `BuxtonData`, and the second (optional) being a string value for debugging purposes. (It's quite easy to imagine packing an enum in the data.store.d_int)