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 #include "pipe/p_compiler.h"
26 #include "util/u_memory.h"
27 #include "util/u_debug.h"
28 #include "util/u_network.h"
29 
30 #include "rbug/rbug.h"
31 
rbug_wait()32 static void rbug_wait()
33 {
34    int s = u_socket_listen_on_port(13370);
35    int c = u_socket_accept(s);
36    struct rbug_connection *con = rbug_from_socket(c);
37    struct rbug_header *header;
38    rbug_texture_t texs[2];
39    uint32_t serial;
40    texs[0] = 1337;
41    texs[1] = 7331;
42 
43    assert(s >= 0);
44    assert(c >= 0);
45    assert(con);
46    debug_printf("Connection get!\n");
47 
48    debug_printf("Waiting for get textures\n");
49    header = rbug_get_message(con, &serial);
50    assert(header);
51    assert(header->opcode == RBUG_OP_TEXTURE_LIST);
52    rbug_free_header(header);
53 
54    rbug_send_texture_list_reply(con, serial, texs, 2, NULL);
55    rbug_disconnect(con);
56 }
57 
main(int argc,char ** argv)58 int main(int argc, char** argv)
59 {
60    rbug_wait();
61    return 0;
62 }
63