1 /*
2  * Copyright 2009 VMware, Inc.
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * on the rights to use, copy, modify, merge, publish, distribute, sub
9  * license, and/or sell copies of the Software, and to permit persons to whom
10  * the Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
19  * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22  * USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 /*
26  * This file holds structs decelerations and function prototypes for one of
27  * the rbug extensions. Implementation of the functions is in the same folder
28  * in the c file matching this file's name.
29  *
30  * The structs what is returned from the demarshal functions. The functions
31  * starting rbug_send_* encodes a call to the write format and sends that to
32  * the supplied connection, while functions starting with rbug_demarshal_*
33  * demarshal data from the wire protocol.
34  *
35  * Structs and functions ending with _reply are replies to requests.
36  */
37 
38 #ifndef _RBUG_PROTO_CORE_H_
39 #define _RBUG_PROTO_CORE_H_
40 
41 #include "rbug_proto.h"
42 
43 typedef uint64_t rbug_shader_t;
44 typedef uint64_t rbug_context_t;
45 typedef uint64_t rbug_texture_t;
46 
47 struct rbug_proto_noop
48 {
49 	struct rbug_header header;
50 };
51 
52 struct rbug_proto_ping
53 {
54 	struct rbug_header header;
55 };
56 
57 struct rbug_proto_error
58 {
59 	struct rbug_header header;
60 	uint32_t error;
61 };
62 
63 struct rbug_proto_ping_reply
64 {
65 	struct rbug_header header;
66 	uint32_t serial;
67 };
68 
69 struct rbug_proto_error_reply
70 {
71 	struct rbug_header header;
72 	uint32_t serial;
73 	uint32_t error;
74 };
75 
76 int rbug_send_noop(struct rbug_connection *__con,
77                    uint32_t *__serial);
78 
79 int rbug_send_ping(struct rbug_connection *__con,
80                    uint32_t *__serial);
81 
82 int rbug_send_error(struct rbug_connection *__con,
83                     uint32_t error,
84                     uint32_t *__serial);
85 
86 int rbug_send_ping_reply(struct rbug_connection *__con,
87                          uint32_t serial,
88                          uint32_t *__serial);
89 
90 int rbug_send_error_reply(struct rbug_connection *__con,
91                           uint32_t serial,
92                           uint32_t error,
93                           uint32_t *__serial);
94 
95 struct rbug_proto_noop * rbug_demarshal_noop(struct rbug_proto_header *header);
96 
97 struct rbug_proto_ping * rbug_demarshal_ping(struct rbug_proto_header *header);
98 
99 struct rbug_proto_error * rbug_demarshal_error(struct rbug_proto_header *header);
100 
101 struct rbug_proto_ping_reply * rbug_demarshal_ping_reply(struct rbug_proto_header *header);
102 
103 struct rbug_proto_error_reply * rbug_demarshal_error_reply(struct rbug_proto_header *header);
104 
105 #endif
106