Hi,

I'm trying to implement a system like described 
here<http://blog.florindinu.ro/posts/message-dispatching-in-c-part-0-problem.html>
 where 
I have a Type List of Messages.
Now, when I receive a message from an endpoint, I need a way to retrieve 
the message opCode (which is a filed contained in all messages) to build my 
message template class.

My .proto is like this:

enum EMessages
{
  E_MSG_METHOD_CONNECT  = 0x8001;
  E_MSG_EVENT_CONNECT   = 0xA001;
  ....
}

message MsgHeader
{
  required google.protobuf.FileDescriptorSet  proto_files = 1;
  required long  sessionRef    = 3;
  optional long   transactionId = 4 [default = 0];
  optional long   status        = 5 [default = 0];
}

message MSG_METHOD_CONNECT
{
  optional EMessages    opCode = 1 [default = E_MSG_METHOD_CONNECT];
  required MsgHeader    header = 2;
  ... other fields ...
}

message MSG_EVENT_CONNECT
{
  optional EMessages    opCode = 1 [default = E_MSG_EVENT_CONNECT];
  required MsgHeader    header = 2;
  ... other fields ...
}

So each message contains the opCode field.
Is there a way to retrieve the opCode value from a received stream?

Regards,
Daniele.

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/protobuf/-/EQXctYueZtUJ.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to