author | Mikael Berthe <mikael@lilotux.net> |
Sat, 10 Jul 2021 09:37:34 +0200 | |
changeset 743 | 9098ee1972df |
parent 733 | 3a3f9df8b9fd |
permissions | -rw-r--r-- |
516
4dd3aa6b83e5
Change the tab width to 4 steps in the emacs headers
Mikael Hallendal <micke@imendio.com>
parents:
515
diff
changeset
|
1 |
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
2 |
/* |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
3 |
* Copyright (C) 2008 Imendio AB |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
4 |
* |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
6 |
* modify it under the terms of the GNU Lesser General Public License as |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; either version 2 of the |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
8 |
* License, or (at your option) any later version. |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
9 |
* |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
13 |
* Lesser General Public License for more details. |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
14 |
* |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU Lesser General Public |
690
7ccf2113ec5f
Update the postal address of the FSF
Frank Zschockelt <lm@freakysoft.de>
parents:
677
diff
changeset
|
16 |
* License along with this program; if not, see <https://www.gnu.org/licenses> |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
17 |
*/ |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
18 |
|
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
19 |
#include <config.h> |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
20 |
|
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
21 |
#include <string.h> |
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
22 |
|
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
23 |
/* Needed on Mac OS X */ |
733
3a3f9df8b9fd
lm-resolver.c: limit conditional include to OS X
David H. Gutteridge <dhgutteridge@users.noreply.github.com>
parents:
728
diff
changeset
|
24 |
#if defined(__APPLE__) && HAVE_ARPA_NAMESER_COMPAT_H |
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
25 |
#include <arpa/nameser_compat.h> |
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
26 |
#endif |
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
27 |
|
677
a6a41aec40f2
include netinet/in.h in resolver
Christoph Moench-Tegeder <cmt@burggraben.net>
parents:
647
diff
changeset
|
28 |
#include <netinet/in.h> |
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
29 |
#include <arpa/nameser.h> |
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
30 |
#include <resolv.h> |
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
31 |
|
472
5aa76e995f0d
Renamed the test to test-dns and fixed a bug in the asyncns resolver.
Mikael Hallendal <micke@imendio.com>
parents:
467
diff
changeset
|
32 |
#include "lm-asyncns-resolver.h" |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
33 |
#include "lm-blocking-resolver.h" |
549 | 34 |
#include "lm-debug.h" |
463
158aebfa7b7c
Moved MIN_PORT and MAX_PORT to lm-internals.h and renamed them.
Mikael Hallendal <micke@imendio.com>
parents:
462
diff
changeset
|
35 |
#include "lm-internals.h" |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
36 |
#include "lm-marshal.h" |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
37 |
#include "lm-resolver.h" |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
38 |
|
725
05fa3e01e5b1
Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents:
712
diff
changeset
|
39 |
#define GET_PRIV(obj) (lm_resolver_get_instance_private (LM_RESOLVER(obj))) |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
40 |
|
725
05fa3e01e5b1
Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents:
712
diff
changeset
|
41 |
typedef struct LmResolverPrivate LmResolverPrivate; |
05fa3e01e5b1
Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents:
712
diff
changeset
|
42 |
struct LmResolverPrivate { |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
43 |
GMainContext *context; |
462
11f85004aa32
Added GMainContext to LmResolver and use lm_misc_add_idle to add an idle in it.
Mikael Hallendal <micke@imendio.com>
parents:
461
diff
changeset
|
44 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
45 |
LmResolverCallback callback; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
46 |
gpointer user_data; |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
47 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
48 |
/* -- Properties -- */ |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
49 |
LmResolverType type; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
50 |
gchar *host; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
51 |
guint port; |
461
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
52 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
53 |
/* For SRV lookups */ |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
54 |
gchar *domain; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
55 |
gchar *service; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
56 |
gchar *protocol; |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
57 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
58 |
/* The results */ |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
59 |
LmResolverResult result; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
60 |
struct addrinfo *results; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
61 |
struct addrinfo *current_result; |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
62 |
}; |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
63 |
|
712
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
64 |
static void resolver_dispose (GObject *object); |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
65 |
static void resolver_finalize (GObject *object); |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
66 |
static void resolver_get_property (GObject *object, |
461
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
67 |
guint param_id, |
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
68 |
GValue *value, |
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
69 |
GParamSpec *pspec); |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
70 |
static void resolver_set_property (GObject *object, |
461
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
71 |
guint param_id, |
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
72 |
const GValue *value, |
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
73 |
GParamSpec *pspec); |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
74 |
|
725
05fa3e01e5b1
Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents:
712
diff
changeset
|
75 |
G_DEFINE_TYPE_WITH_PRIVATE (LmResolver, lm_resolver, G_TYPE_OBJECT) |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
76 |
|
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
77 |
enum { |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
78 |
PROP_0, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
79 |
PROP_CONTEXT, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
80 |
PROP_TYPE, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
81 |
PROP_HOST, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
82 |
PROP_PORT, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
83 |
PROP_DOMAIN, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
84 |
PROP_SERVICE, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
85 |
PROP_PROTOCOL |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
86 |
}; |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
87 |
|
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
88 |
static void |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
89 |
lm_resolver_class_init (LmResolverClass *class) |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
90 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
91 |
GObjectClass *object_class = G_OBJECT_CLASS (class); |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
92 |
|
712
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
93 |
object_class->dispose = resolver_dispose; |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
94 |
object_class->finalize = resolver_finalize; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
95 |
object_class->get_property = resolver_get_property; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
96 |
object_class->set_property = resolver_set_property; |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
97 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
98 |
g_object_class_install_property (object_class, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
99 |
PROP_CONTEXT, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
100 |
g_param_spec_pointer ("context", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
101 |
"Context", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
102 |
"Main context to use", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
103 |
G_PARAM_READWRITE)); |
462
11f85004aa32
Added GMainContext to LmResolver and use lm_misc_add_idle to add an idle in it.
Mikael Hallendal <micke@imendio.com>
parents:
461
diff
changeset
|
104 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
105 |
g_object_class_install_property (object_class, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
106 |
PROP_TYPE, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
107 |
g_param_spec_int ("type", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
108 |
"Type", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
109 |
"Resolver Type", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
110 |
LM_RESOLVER_HOST, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
111 |
LM_RESOLVER_SRV, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
112 |
LM_RESOLVER_HOST, |
539
4e387d919a46
Made type property on LmResolver settable after creation.
Mikael Hallendal <micke@imendio.com>
parents:
518
diff
changeset
|
113 |
G_PARAM_READWRITE)); |
455
d42ef653a60c
Added type property to LmResolver
Mikael Hallendal <micke@imendio.com>
parents:
454
diff
changeset
|
114 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
115 |
g_object_class_install_property (object_class, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
116 |
PROP_HOST, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
117 |
g_param_spec_string ("host", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
118 |
"Host", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
119 |
"Host to lookup", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
120 |
NULL, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
121 |
G_PARAM_READWRITE)); |
463
158aebfa7b7c
Moved MIN_PORT and MAX_PORT to lm-internals.h and renamed them.
Mikael Hallendal <micke@imendio.com>
parents:
462
diff
changeset
|
122 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
123 |
g_object_class_install_property (object_class, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
124 |
PROP_PORT, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
125 |
g_param_spec_uint ("port", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
126 |
"Port", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
127 |
"Port number", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
128 |
0, |
607 | 129 |
LM_MAX_PORT, |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
130 |
0, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
131 |
G_PARAM_READWRITE)); |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
132 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
133 |
g_object_class_install_property (object_class, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
134 |
PROP_DOMAIN, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
135 |
g_param_spec_string ("domain", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
136 |
"Domain", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
137 |
"Domain to lookup", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
138 |
NULL, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
139 |
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
140 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
141 |
g_object_class_install_property (object_class, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
142 |
PROP_SERVICE, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
143 |
g_param_spec_string ("service", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
144 |
"Service", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
145 |
"Service to lookup", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
146 |
NULL, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
147 |
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
148 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
149 |
g_object_class_install_property (object_class, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
150 |
PROP_PROTOCOL, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
151 |
g_param_spec_string ("protocol", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
152 |
"Protocol", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
153 |
"Protocol for SRV lookup", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
154 |
NULL, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
155 |
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
156 |
} |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
157 |
|
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
158 |
static void |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
159 |
lm_resolver_init (LmResolver *resolver) |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
160 |
{ |
712
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
161 |
} |
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
162 |
|
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
163 |
static void |
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
164 |
resolver_dispose (GObject *object) |
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
165 |
{ |
725
05fa3e01e5b1
Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents:
712
diff
changeset
|
166 |
LmResolverPrivate *priv = GET_PRIV (object); |
712
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
167 |
|
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
168 |
if (priv->context) { |
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
169 |
g_main_context_unref (priv->context); |
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
170 |
priv->context = NULL; |
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
171 |
} |
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
172 |
|
ba47719252ad
lm-asyncns-resolver: Fix resolver uninitialization
Mykhailo Danylenko <risbea@gmail.com>
parents:
690
diff
changeset
|
173 |
(G_OBJECT_CLASS (lm_resolver_parent_class)->dispose) (object); |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
174 |
} |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
175 |
|
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
176 |
static void |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
177 |
resolver_finalize (GObject *object) |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
178 |
{ |
725
05fa3e01e5b1
Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents:
712
diff
changeset
|
179 |
LmResolverPrivate *priv; |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
180 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
181 |
priv = GET_PRIV (object); |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
182 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
183 |
g_free (priv->host); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
184 |
g_free (priv->domain); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
185 |
g_free (priv->service); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
186 |
g_free (priv->protocol); |
461
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
187 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
188 |
if (priv->results) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
189 |
freeaddrinfo (priv->results); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
190 |
} |
476
08d36982e998
First cut of integrating the new resolver in LmOldSocket
Mikael Hallendal <micke@imendio.com>
parents:
474
diff
changeset
|
191 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
192 |
(G_OBJECT_CLASS (lm_resolver_parent_class)->finalize) (object); |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
193 |
} |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
194 |
|
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
195 |
static void |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
196 |
resolver_get_property (GObject *object, |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
197 |
guint param_id, |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
198 |
GValue *value, |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
199 |
GParamSpec *pspec) |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
200 |
{ |
725
05fa3e01e5b1
Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents:
712
diff
changeset
|
201 |
LmResolverPrivate *priv; |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
202 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
203 |
priv = GET_PRIV (object); |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
204 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
205 |
switch (param_id) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
206 |
case PROP_CONTEXT: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
207 |
g_value_set_pointer (value, priv->context); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
208 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
209 |
case PROP_TYPE: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
210 |
g_value_set_int (value, priv->type); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
211 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
212 |
case PROP_HOST: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
213 |
g_value_set_string (value, priv->host); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
214 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
215 |
case PROP_PORT: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
216 |
g_value_set_uint (value, priv->port); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
217 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
218 |
case PROP_DOMAIN: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
219 |
g_value_set_string (value, priv->domain); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
220 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
221 |
case PROP_SERVICE: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
222 |
g_value_set_string (value, priv->service); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
223 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
224 |
case PROP_PROTOCOL: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
225 |
g_value_set_string (value, priv->protocol); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
226 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
227 |
default: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
228 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
229 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
230 |
}; |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
231 |
} |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
232 |
|
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
233 |
static void |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
234 |
resolver_set_property (GObject *object, |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
235 |
guint param_id, |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
236 |
const GValue *value, |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
237 |
GParamSpec *pspec) |
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
238 |
{ |
725
05fa3e01e5b1
Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents:
712
diff
changeset
|
239 |
LmResolverPrivate *priv; |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
240 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
241 |
priv = GET_PRIV (object); |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
242 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
243 |
switch (param_id) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
244 |
case PROP_CONTEXT: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
245 |
if (priv->context) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
246 |
g_main_context_unref (priv->context); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
247 |
} |
462
11f85004aa32
Added GMainContext to LmResolver and use lm_misc_add_idle to add an idle in it.
Mikael Hallendal <micke@imendio.com>
parents:
461
diff
changeset
|
248 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
249 |
priv->context = (GMainContext *) g_value_get_pointer (value); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
250 |
g_main_context_ref (priv->context); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
251 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
252 |
case PROP_TYPE: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
253 |
priv->type = g_value_get_int (value); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
254 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
255 |
case PROP_HOST: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
256 |
g_free (priv->host); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
257 |
priv->host = g_value_dup_string (value); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
258 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
259 |
case PROP_PORT: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
260 |
priv->port = g_value_get_uint (value); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
261 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
262 |
case PROP_DOMAIN: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
263 |
g_free (priv->domain); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
264 |
priv->domain = g_value_dup_string (value); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
265 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
266 |
case PROP_SERVICE: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
267 |
g_free (priv->service); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
268 |
priv->service = g_value_dup_string (value); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
269 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
270 |
case PROP_PROTOCOL: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
271 |
g_free (priv->protocol); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
272 |
priv->protocol = g_value_dup_string (value); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
273 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
274 |
default: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
275 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
276 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
277 |
}; |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
278 |
} |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
279 |
|
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
280 |
LmResolver * |
478
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
281 |
lm_resolver_new (GMainContext *context) |
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
282 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
283 |
LmResolver *resolver; |
478
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
284 |
|
547
692c7753f64e
Improved the resolvers a bit.
Mikael Hallendal <micke@imendio.com>
parents:
539
diff
changeset
|
285 |
#ifdef HAVE_ASYNCNS |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
286 |
resolver = g_object_new (LM_TYPE_ASYNCNS_RESOLVER, NULL); |
499
1d61af397e09
Fixed compile error when asyncns is not available [#17]
Jelmer Vernooij <jelmer@samba.org>
parents:
478
diff
changeset
|
287 |
#else |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
288 |
resolver = g_object_new (LM_TYPE_BLOCKING_RESOLVER, NULL); |
478
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
289 |
#endif |
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
290 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
291 |
g_object_set (resolver, "context", context, NULL); |
478
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
292 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
293 |
return resolver; |
478
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
294 |
} |
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
295 |
|
547
692c7753f64e
Improved the resolvers a bit.
Mikael Hallendal <micke@imendio.com>
parents:
539
diff
changeset
|
296 |
static GType |
692c7753f64e
Improved the resolvers a bit.
Mikael Hallendal <micke@imendio.com>
parents:
539
diff
changeset
|
297 |
resolver_get_gtype (void) |
692c7753f64e
Improved the resolvers a bit.
Mikael Hallendal <micke@imendio.com>
parents:
539
diff
changeset
|
298 |
{ |
692c7753f64e
Improved the resolvers a bit.
Mikael Hallendal <micke@imendio.com>
parents:
539
diff
changeset
|
299 |
#ifdef HAVE_ASYNCNS |
692c7753f64e
Improved the resolvers a bit.
Mikael Hallendal <micke@imendio.com>
parents:
539
diff
changeset
|
300 |
return LM_TYPE_ASYNCNS_RESOLVER; |
692c7753f64e
Improved the resolvers a bit.
Mikael Hallendal <micke@imendio.com>
parents:
539
diff
changeset
|
301 |
#else |
692c7753f64e
Improved the resolvers a bit.
Mikael Hallendal <micke@imendio.com>
parents:
539
diff
changeset
|
302 |
return LM_TYPE_BLOCKING_RESOLVER; |
692c7753f64e
Improved the resolvers a bit.
Mikael Hallendal <micke@imendio.com>
parents:
539
diff
changeset
|
303 |
#endif /* HAVE_ASYNCNS */ |
692c7753f64e
Improved the resolvers a bit.
Mikael Hallendal <micke@imendio.com>
parents:
539
diff
changeset
|
304 |
} |
692c7753f64e
Improved the resolvers a bit.
Mikael Hallendal <micke@imendio.com>
parents:
539
diff
changeset
|
305 |
|
478
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
306 |
LmResolver * |
454
18ffac09f030
Changed so that we create a resolver with various arguments depending on type.
Mikael Hallendal <micke@imendio.com>
parents:
453
diff
changeset
|
307 |
lm_resolver_new_for_host (const gchar *host, |
18ffac09f030
Changed so that we create a resolver with various arguments depending on type.
Mikael Hallendal <micke@imendio.com>
parents:
453
diff
changeset
|
308 |
LmResolverCallback callback, |
18ffac09f030
Changed so that we create a resolver with various arguments depending on type.
Mikael Hallendal <micke@imendio.com>
parents:
453
diff
changeset
|
309 |
gpointer user_data) |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
310 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
311 |
LmResolver *resolver; |
725
05fa3e01e5b1
Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents:
712
diff
changeset
|
312 |
LmResolverPrivate *priv; |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
313 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
314 |
g_return_val_if_fail (host != NULL, NULL); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
315 |
g_return_val_if_fail (callback != NULL, NULL); |
461
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
316 |
|
547
692c7753f64e
Improved the resolvers a bit.
Mikael Hallendal <micke@imendio.com>
parents:
539
diff
changeset
|
317 |
resolver = g_object_new (resolver_get_gtype (), |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
318 |
"type", LM_RESOLVER_HOST, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
319 |
"host", host, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
320 |
NULL); |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
321 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
322 |
priv = GET_PRIV (resolver); |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
323 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
324 |
priv->callback = callback; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
325 |
priv->user_data = user_data; |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
326 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
327 |
return resolver; |
454
18ffac09f030
Changed so that we create a resolver with various arguments depending on type.
Mikael Hallendal <micke@imendio.com>
parents:
453
diff
changeset
|
328 |
} |
18ffac09f030
Changed so that we create a resolver with various arguments depending on type.
Mikael Hallendal <micke@imendio.com>
parents:
453
diff
changeset
|
329 |
|
18ffac09f030
Changed so that we create a resolver with various arguments depending on type.
Mikael Hallendal <micke@imendio.com>
parents:
453
diff
changeset
|
330 |
LmResolver * |
607 | 331 |
lm_resolver_new_for_service (const gchar *domain, |
461
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
332 |
const gchar *service, |
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
333 |
const gchar *protocol, |
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
334 |
LmResolverCallback callback, |
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
335 |
gpointer user_data) |
454
18ffac09f030
Changed so that we create a resolver with various arguments depending on type.
Mikael Hallendal <micke@imendio.com>
parents:
453
diff
changeset
|
336 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
337 |
LmResolver *resolver; |
725
05fa3e01e5b1
Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents:
712
diff
changeset
|
338 |
LmResolverPrivate *priv; |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
339 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
340 |
g_return_val_if_fail (domain != NULL, NULL); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
341 |
g_return_val_if_fail (service != NULL, NULL); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
342 |
g_return_val_if_fail (protocol != NULL, NULL); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
343 |
g_return_val_if_fail (callback != NULL, NULL); |
461
f7c5f4b5dadd
Added protocol for srv lookups
Mikael Hallendal <micke@imendio.com>
parents:
456
diff
changeset
|
344 |
|
547
692c7753f64e
Improved the resolvers a bit.
Mikael Hallendal <micke@imendio.com>
parents:
539
diff
changeset
|
345 |
resolver = g_object_new (resolver_get_gtype (), |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
346 |
"type", LM_RESOLVER_SRV, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
347 |
"domain", domain, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
348 |
"service", service, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
349 |
"protocol", protocol, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
350 |
NULL); |
607 | 351 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
352 |
priv = GET_PRIV (resolver); |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
353 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
354 |
priv->callback = callback; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
355 |
priv->user_data = user_data; |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
356 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
357 |
return resolver; |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
358 |
} |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
359 |
|
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
360 |
void |
454
18ffac09f030
Changed so that we create a resolver with various arguments depending on type.
Mikael Hallendal <micke@imendio.com>
parents:
453
diff
changeset
|
361 |
lm_resolver_lookup (LmResolver *resolver) |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
362 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
363 |
if (!LM_RESOLVER_GET_CLASS(resolver)) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
364 |
g_assert_not_reached (); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
365 |
} |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
366 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
367 |
LM_RESOLVER_GET_CLASS(resolver)->lookup (resolver); |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
368 |
} |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
369 |
|
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
370 |
void |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
371 |
lm_resolver_cancel (LmResolver *resolver) |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
372 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
373 |
if (!LM_RESOLVER_GET_CLASS(resolver)->cancel) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
374 |
g_assert_not_reached (); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
375 |
} |
453
deebf7d6750b
Made LmResolver an object for subclassing instead of an interface
Mikael Hallendal <micke@imendio.com>
parents:
452
diff
changeset
|
376 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
377 |
LM_RESOLVER_GET_CLASS(resolver)->cancel (resolver); |
452
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
378 |
} |
ad59c48027f2
Added LmResolver interface.
Mikael Hallendal <micke@imendio.com>
parents:
diff
changeset
|
379 |
|
607 | 380 |
/* To iterate through the results */ |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
381 |
struct addrinfo * |
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
382 |
lm_resolver_results_get_next (LmResolver *resolver) |
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
383 |
{ |
725
05fa3e01e5b1
Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents:
712
diff
changeset
|
384 |
LmResolverPrivate *priv; |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
385 |
struct addrinfo *ret_val; |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
386 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
387 |
g_return_val_if_fail (LM_IS_RESOLVER (resolver), NULL); |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
388 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
389 |
priv = GET_PRIV (resolver); |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
390 |
|
588
d4468955feb1
Logging Adjustments
Jayson Vantuyl <jvantuyl@engineyard.com>
parents:
587
diff
changeset
|
391 |
if (!priv->current_result) { |
d4468955feb1
Logging Adjustments
Jayson Vantuyl <jvantuyl@engineyard.com>
parents:
587
diff
changeset
|
392 |
g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE, |
d4468955feb1
Logging Adjustments
Jayson Vantuyl <jvantuyl@engineyard.com>
parents:
587
diff
changeset
|
393 |
"no more results from resolver\n"); |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
394 |
return NULL; |
588
d4468955feb1
Logging Adjustments
Jayson Vantuyl <jvantuyl@engineyard.com>
parents:
587
diff
changeset
|
395 |
}; |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
396 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
397 |
ret_val = priv->current_result; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
398 |
priv->current_result = priv->current_result->ai_next; |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
399 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
400 |
return ret_val; |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
401 |
} |
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
402 |
|
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
403 |
void |
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
404 |
lm_resolver_results_reset (LmResolver *resolver) |
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
405 |
{ |
725
05fa3e01e5b1
Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents:
712
diff
changeset
|
406 |
LmResolverPrivate *priv; |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
407 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
408 |
g_return_if_fail (LM_IS_RESOLVER (resolver)); |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
409 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
410 |
priv = GET_PRIV (resolver); |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
411 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
412 |
priv->current_result = priv->results; |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
413 |
} |
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
414 |
|
478
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
415 |
gchar * |
607 | 416 |
_lm_resolver_create_srv_string (const gchar *domain, |
478
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
417 |
const gchar *service, |
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
418 |
const gchar *protocol) |
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
419 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
420 |
g_return_val_if_fail (domain != NULL, NULL); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
421 |
g_return_val_if_fail (service != NULL, NULL); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
422 |
g_return_val_if_fail (protocol != NULL, NULL); |
478
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
423 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
424 |
return g_strdup_printf ("_%s._%s.%s", service, protocol, domain); |
478
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
425 |
} |
acce45e212a6
Changed lm_resolver_create_srv_string to be internal to LmResolvers
Mikael Hallendal <micke@imendio.com>
parents:
476
diff
changeset
|
426 |
|
607 | 427 |
void |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
428 |
_lm_resolver_set_result (LmResolver *resolver, |
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
429 |
LmResolverResult result, |
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
430 |
struct addrinfo *results) |
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
431 |
{ |
725
05fa3e01e5b1
Move away from g_type_class_add_private()
Michał Kępień <github@kempniu.pl>
parents:
712
diff
changeset
|
432 |
LmResolverPrivate *priv; |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
433 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
434 |
g_return_if_fail (LM_IS_RESOLVER (resolver)); |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
435 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
436 |
priv = GET_PRIV (resolver); |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
437 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
438 |
priv->result = result; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
439 |
priv->results = priv->current_result = results; |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
440 |
|
548
60c1d6cbde10
Added some verbose debug output
Mikael Hallendal <micke@imendio.com>
parents:
547
diff
changeset
|
441 |
lm_verbose ("Calling resolver callback: %s\n", priv->host); |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
442 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
443 |
priv->callback (resolver, result, priv->user_data); |
467
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
444 |
} |
943afa7cfac5
The blocking dns resolver now works as expected.
Mikael Hallendal <micke@imendio.com>
parents:
464
diff
changeset
|
445 |
|
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
446 |
gboolean |
607 | 447 |
_lm_resolver_parse_srv_response (unsigned char *srv, |
448 |
int srv_len, |
|
449 |
gchar **out_server, |
|
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
450 |
guint *out_port) |
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
451 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
452 |
int qdcount; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
453 |
int ancount; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
454 |
int len; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
455 |
const unsigned char *pos; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
456 |
unsigned char *end; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
457 |
HEADER *head; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
458 |
char name[256]; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
459 |
char pref_name[256]; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
460 |
guint pref_port = 0; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
461 |
guint pref_prio = 9999; |
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
462 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
463 |
pref_name[0] = 0; |
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
464 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
465 |
pos = srv + sizeof (HEADER); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
466 |
end = srv + srv_len; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
467 |
head = (HEADER *) srv; |
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
468 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
469 |
qdcount = ntohs (head->qdcount); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
470 |
ancount = ntohs (head->ancount); |
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
471 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
472 |
/* Ignore the questions */ |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
473 |
while (qdcount-- > 0 && (len = dn_expand (srv, end, pos, name, 255)) >= 0) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
474 |
g_assert (len >= 0); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
475 |
pos += len + QFIXEDSZ; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
476 |
} |
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
477 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
478 |
/* Parse the answers */ |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
479 |
while (ancount-- > 0 && (len = dn_expand (srv, end, pos, name, 255)) >= 0) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
480 |
/* Ignore the initial string */ |
628
1ac0534623ef
Fix compilation warnings
Myhailo Danylenko <isbear@ukrpost.net>
parents:
625
diff
changeset
|
481 |
uint16_t pref, port; |
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
482 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
483 |
g_assert (len >= 0); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
484 |
pos += len; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
485 |
/* Ignore type, ttl, class and dlen */ |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
486 |
pos += 10; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
487 |
GETSHORT (pref, pos); |
647
2e35e7499ee8
Fix resolver record parsing
Myhailo Danylenko <isbear@ukrpost.net>
parents:
628
diff
changeset
|
488 |
/* Ignore weight */ |
2e35e7499ee8
Fix resolver record parsing
Myhailo Danylenko <isbear@ukrpost.net>
parents:
628
diff
changeset
|
489 |
pos += 2; |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
490 |
GETSHORT (port, pos); |
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
491 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
492 |
len = dn_expand (srv, end, pos, name, 255); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
493 |
if (pref < pref_prio) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
494 |
pref_prio = pref; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
495 |
strcpy (pref_name, name); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
496 |
pref_port = port; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
497 |
} |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
498 |
pos += len; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
499 |
} |
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
500 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
501 |
if (pref_name[0]) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
502 |
*out_server = g_strdup (pref_name); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
503 |
*out_port = pref_port; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
504 |
return TRUE; |
607 | 505 |
} |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
506 |
return FALSE; |
473
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
507 |
} |
2006c0c0a63d
More work on the asyncns srv lookup.
Mikael Hallendal <micke@imendio.com>
parents:
472
diff
changeset
|
508 |