summaryrefslogtreecommitdiff
path: root/libgssdp/gssdp-socket-source.h
blob: d2e9611f75d6a7e68c3f887f79dd9733814146d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* 
 * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd.
 * Copyright (C) 2010 Jens Georg <mail@jensge.org>
 *
 * Author: Jorn Baayen <jorn@openedhand.com>
 *         Jens Georg <mail@jensge.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef __GSSDP_SOCKET_SOURCE_H__
#define __GSSDP_SOCKET_SOURCE_H__

#include <glib-object.h>

#include <gio/gio.h>

G_BEGIN_DECLS

G_GNUC_INTERNAL GType
gssdp_socket_source_get_type (void) G_GNUC_CONST;

#define GSSDP_TYPE_SOCKET_SOURCE \
                (gssdp_socket_source_get_type ())
#define GSSDP_SOCKET_SOURCE(obj) \
                (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
                 GSSDP_TYPE_SOCKET_SOURCE, \
                 GSSDPSocketSource))
#define GSSDP_SOCKET_SOURCE_CLASS(klass) \
                (G_TYPE_CHECK_CLASS_CAST ((klass), \
                 GSSDP_TYPE_SOCKET_SOURCE, \
                 GSSDPSocketSourceClass))
#define GSSDP_IS_SOCKET_SOURCE(obj) \
                (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
                 GSSDP_TYPE_SOCKET_SOURCE))
#define GSSDP_IS_SOCKET_SOURCE_CLASS(klass) \
                (G_TYPE_CHECK_CLASS_TYPE ((klass), \
                 GSSDP_TYPE_SOCKET_SOURCE))
#define GSSDP_SOCKET_SOURCE_GET_CLASS(obj) \
                (G_TYPE_INSTANCE_GET_CLASS ((obj), \
                 GSSDP_TYPE_SOCKET_SOURCE, \
                 GSSDPSocketSourceClass))

typedef struct _GSSDPSocketSourcePrivate GSSDPSocketSourcePrivate;

typedef enum {
        GSSDP_SOCKET_SOURCE_TYPE_REQUEST,
        GSSDP_SOCKET_SOURCE_TYPE_MULTICAST,
        GSSDP_SOCKET_SOURCE_TYPE_SEARCH
} GSSDPSocketSourceType;

typedef struct _GSSDPSocketSource {
        GObject                   parent;

        GSSDPSocketSourcePrivate *priv;
} GSSDPSocketSource;

typedef struct _GSSDPSocketSourceClass {
        GObjectClass parent_class;
} GSSDPSocketSourceClass;

G_GNUC_INTERNAL GSSDPSocketSource *
gssdp_socket_source_new        (GSSDPSocketSourceType  type,
                                const char            *host_ip,
                                guint                  ttl,
                                const char            *device_name,
                                GError               **error);

G_GNUC_INTERNAL GSocket*
gssdp_socket_source_get_socket (GSSDPSocketSource     *socket_source);

G_GNUC_INTERNAL void
gssdp_socket_source_set_callback (GSSDPSocketSource   *socket_source,
                                  GSourceFunc          callback,
                                  gpointer             user_data);

G_GNUC_INTERNAL void
gssdp_socket_source_attach       (GSSDPSocketSource   *socket_source);

G_END_DECLS

#endif /* __GSSDP_SOCKET_SOURCE_H__ */