Hello Shilpa,

On Thu, Apr 28, 2011 at 3:11 PM, Shilpa Sodani <sa_sod...@hotmail.com>wrote:

>  Hello all,
>
>
>     Just wanted to give update on integrating Google Protocol Buffer (GPB)
> in mira. As decided in one of the meetings,
> to support the transfer of binary data over network we want to structure
> the network messages using GPB. Currently the network
> messages are transferred in string format over the network. I believe in
> C++  we can transfer binary data using strings as well.
>
> So my questions is; binary data, only the reason we want to change the
> network message type?
>
No, not really. It is definitely possible to transfer binary data using
std::strings. The main issue is that the current protocol makes it difficult
to add multiple parameters of binary data. Right now what is used to
parametrize arguments is comma (,) and quotation characters (") which is an
issue for binary data. The issue being that a byte could contain
the ASCII value of those characters and confuse the Msg parsers.

One option could be to use a standard way of identifying binary data such as
<binary length=14>bi,na"rydata&*#)</binary> (this is just a random example).
I think however that since we're in the need of such a change, we should
change to something scalable that will benefit the protocol in the long run.

Although the current implementation works, I must say that I'm not
necessarily proud of it. I didn't really have much experience in the area
back when I came up with it. The current protocol is really just a mirror of
IRCU's server-server (text-based) protocol.

>
> My research about GBP indicates that even with the GPB structured data, the
> binary data will be transferred  using strings
> a the basic type.
>
> Consider for example we have following as GPB message for mira n/w message;
>
> Message NetworkMsg
>   {
>       required  string token = 1;
>       repeated Parameter parameter = 2;
>
>        Message Parameter
>       {
>           enum Type { STR_DATA = 1; BINARY_DATA = 2; }
>           require Type type = 1;
>           optional string str_data = 2;
>           optional bytes  binary_data = 3;
>        }
>
>   }
>
>
> For field "binary_data" of type bytes, the protocol buffer compiler will
> generated the following C++ accessor methods,
>
> bool has_binary_data() const
> const string& binary_data() const
> void set_binary_data(const string& value)
> void set_binary_data(const char* value)
> void set_binary_data(const char* value, int size)
> string* mutable_binary_data()
> void clear_binary_data()
> string* release_foo()
>
> The GPB bytes type gets converted into is c++ string type.
>
> So I think we can transfer the binary data with the existing string format
> of the network message. Only thing
> we should consider on having accessor  methods for handling binary data
> should not accept c-style(null terminated)
> strings as the binary data may have "\0" as it's data.
>
> I think GPB is a good option for n/w messages if we want to speed up the
> process of transfer.
>
I think so too. I think it will also make the code easier to read. I'm
willing to offer my help in changing the current network-related code both
in the design and implementation phases.


> Please share your thoughts.
>
> Thanks,
> Shilpa Sodani.
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today.  Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Mira-development mailing list
> Mira-development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mira-development
>
>


-- 
regards,

Alan Alvarez
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Mira-development mailing list
Mira-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mira-development

Reply via email to