Wire protocol questions
Kristian Høgsberg
hoegsberg at gmail.com
Mon Feb 18 14:22:22 PST 2013
On Mon, Feb 18, 2013 at 10:35:55PM +0100, Peter Hultqvist wrote:
> I've been reading the
> http://wayland.freedesktop.org/docs/html/sect-Protocol-Wire-Format.html
> and done some testing with the wayland socket.
>
> From the docs I got the package sender object id, packet size and opcode.
> I also understand the argument formats.
>
> From looking at the initial packets sent by the server and correlating
> with the arguments in wayland.xml
>
> ObjectID: 1 (interface "wl_registry"?)
> Opcode: 1 (event "global"?)
> Name: uint
> Interface: string
> Version: uint
>
> I'm guessing that these Names are the objectID to be used for further
> requests. Am I mixing up object ID and names here or are they the same?
Global names are different from object IDs. They're both uint32_t,
which is confusing, of course. The global name is an identifier you
pass to wl_registry_bind, to bind the global object to an object ID.
Once you've bound the global to an object ID, you can start sending
requests to it and receive events from it using that object ID.
Object IDs are private to each client and each client has it's own
object ID namespace.
> What I cannot figure out is how to map a request to an opcode integer.
> global happened to be the first event in the wl_registry interface, is
> the order in the xml-file dictating the opcodes?
The order in the XML file defines the opcodes.
> Also if there is any better source for this information such as a
> specific source code file I'm eager to read it.
Most of these conventions are in scanner.c, which is what reads the
XML and dumps the C code and headers.
Kristian
More information about the wayland-devel
mailing list