Re: Detecting message type prior parsing a ByteBuffer containing the message

2009-07-23 Thread jasonh
On Jul 23, 12:54 am, Benedikt Hallinger wrote: > Hello (and sorry for bothering) and thank you for your clarifying. > > > The "type" is simply transmitted as a tag on the wire. The wire format > > of extensions is just like the wire format of a regular field - the > > difference is that the con

Re: Detecting message type prior parsing a ByteBuffer containing the message

2009-07-23 Thread Benedikt Hallinger
Hello (and sorry for bothering) and thank you for your clarifying. > The "type" is simply transmitted as a tag on the wire. The wire format > of extensions is just like the wire format of a regular field - the > difference is that the containing type (Packet) need not know about > the extension

Re: Detecting message type prior parsing a ByteBuffer containing the message

2009-07-22 Thread jasonh
On Jul 21, 11:00 pm, Benedikt Hallinger wrote: > Hello, > thank you very much for the ideas. Since i will have a unknowable ammount > of Message types, extensions would be the way to go. > Your were right with the assumption that i use Java. > > The "construct and send that message" stuff is not

Re: Detecting message type prior parsing a ByteBuffer containing the message

2009-07-21 Thread Benedikt Hallinger
Hello, thank you very much for the ideas. Since i will have a unknowable ammount of Message types, extensions would be the way to go. Your were right with the assumption that i use Java. The "construct and send that message" stuff is not the problem, the main problem is, how i should parse the i

Re: Detecting message type prior parsing a ByteBuffer containing the message

2009-07-21 Thread jasonh
By the way you may want to look at the section on "Union Types" in the docs: http://code.google.com/apis/protocolbuffers/docs/techniques.html#union On Jul 21, 9:51 am, jasonh wrote: > How about using extensions to solve this? You could define a generic > message: > > message Packet { >   extensi

Re: Detecting message type prior parsing a ByteBuffer containing the message

2009-07-21 Thread jasonh
How about using extensions to solve this? You could define a generic message: message Packet { extensions n to m; } // Payload messages message TestMessage { extend Packet { optional TestMessage test = 10; } required string msg = 2; } message TestMessage2 { extend Packet { op

Re: Detecting message type prior parsing a ByteBuffer containing the message

2009-07-21 Thread Benedikt Hallinger
Just to be more precise: the overall goal is, that the messagetype identification stuff should be managed entirely in the proto files. the user should only be concerned to write his handlers and the network protocol definitions. Original Message Subject: Detecting message type