52889fb07cd06371d8781dd16335f9b0cf02470e
[profile/ivi/GSSDP.git] / tests / test-publish.c
1 /* 
2  * Copyright (C) 2006 OpenedHand Ltd.
3  *
4  * Author: Jorn Baayen <jorn@openedhand.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #include <libgssdp/gssdp.h>
23 #include <gio/gio.h>
24 #include <stdlib.h>
25
26 int
27 main (int    argc,
28       char **argv)
29 {
30         GSSDPClient *client;
31         GSSDPResourceGroup *resource_group;
32         GError *error;
33         GMainLoop *main_loop;
34
35         g_type_init ();
36
37         error = NULL;
38         client = g_initable_new (GSSDP_TYPE_CLIENT,
39                                  NULL,
40                                  &error,
41                                  NULL);
42         if (error) {
43                 g_printerr ("Error creating the GSSDP client: %s\n",
44                             error->message);
45
46                 g_error_free (error);
47
48                 return EXIT_FAILURE;
49         }
50
51         resource_group = gssdp_resource_group_new (client);
52
53         gssdp_resource_group_add_resource_simple
54                 (resource_group,
55                  "upnp:rootdevice",
56                  "uuid:1234abcd-12ab-12ab-12ab-1234567abc12::upnp:rootdevice",
57                  "http://192.168.1.100/");
58
59         gssdp_resource_group_set_available (resource_group, TRUE);
60
61         main_loop = g_main_loop_new (NULL, FALSE);
62         g_main_loop_run (main_loop);
63         g_main_loop_unref (main_loop);
64
65         g_object_unref (resource_group);
66         g_object_unref (client);
67
68         return EXIT_SUCCESS;
69 }