1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
2 | /* |
3 | * Copyright (C) 2000-2003, Ximian, Inc. |
4 | */ |
5 | |
6 | #ifndef __SOUP_ADDRESS_H__ |
7 | #define __SOUP_ADDRESS_H__ |
8 | |
9 | #include <sys/types.h> |
10 | |
11 | #include <libsoup/soup-types.h> |
12 | |
13 | G_BEGIN_DECLS |
14 | |
15 | #define SOUP_TYPE_ADDRESS (soup_address_get_type ()) |
16 | #define SOUP_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_ADDRESS, SoupAddress)) |
17 | #define SOUP_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_ADDRESS, SoupAddressClass)) |
18 | #define SOUP_IS_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_ADDRESS)) |
19 | #define SOUP_IS_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_ADDRESS)) |
20 | #define SOUP_ADDRESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_ADDRESS, SoupAddressClass)) |
21 | |
22 | struct _SoupAddress { |
23 | GObject parent; |
24 | |
25 | }; |
26 | |
27 | typedef struct { |
28 | GObjectClass parent_class; |
29 | |
30 | /* Padding for future expansion */ |
31 | void (*_libsoup_reserved1) (void); |
32 | void (*_libsoup_reserved2) (void); |
33 | void (*_libsoup_reserved3) (void); |
34 | void (*_libsoup_reserved4) (void); |
35 | } SoupAddressClass; |
36 | |
37 | #define SOUP_ADDRESS_NAME "name" |
38 | #define SOUP_ADDRESS_FAMILY "family" |
39 | #define SOUP_ADDRESS_PORT "port" |
40 | #define SOUP_ADDRESS_PROTOCOL "protocol" |
41 | #define SOUP_ADDRESS_PHYSICAL "physical" |
42 | #define SOUP_ADDRESS_SOCKADDR "sockaddr" |
43 | |
44 | typedef enum { |
45 | SOUP_ADDRESS_FAMILY_INVALID = -1, |
46 | |
47 | SOUP_ADDRESS_FAMILY_IPV4 = G_SOCKET_FAMILY_IPV4, |
48 | SOUP_ADDRESS_FAMILY_IPV6 = G_SOCKET_FAMILY_IPV6 |
49 | } SoupAddressFamily; |
50 | |
51 | #define SOUP_ADDRESS_ANY_PORT 0 |
52 | |
53 | struct sockaddr; |
54 | |
55 | typedef void (*SoupAddressCallback) (SoupAddress *addr, |
56 | guint status, |
57 | gpointer user_data); |
58 | |
59 | SOUP_AVAILABLE_IN_2_4 |
60 | GType soup_address_get_type (void); |
61 | |
62 | SOUP_AVAILABLE_IN_2_4 |
63 | SoupAddress *soup_address_new (const char *name, |
64 | guint port); |
65 | SOUP_AVAILABLE_IN_2_4 |
66 | SoupAddress *soup_address_new_from_sockaddr (struct sockaddr *sa, |
67 | int len); |
68 | SOUP_AVAILABLE_IN_2_4 |
69 | SoupAddress *soup_address_new_any (SoupAddressFamily family, |
70 | guint port); |
71 | |
72 | SOUP_AVAILABLE_IN_2_4 |
73 | void soup_address_resolve_async (SoupAddress *addr, |
74 | GMainContext *async_context, |
75 | GCancellable *cancellable, |
76 | SoupAddressCallback callback, |
77 | gpointer user_data); |
78 | SOUP_AVAILABLE_IN_2_4 |
79 | guint soup_address_resolve_sync (SoupAddress *addr, |
80 | GCancellable *cancellable); |
81 | |
82 | SOUP_AVAILABLE_IN_2_4 |
83 | const char *soup_address_get_name (SoupAddress *addr); |
84 | SOUP_AVAILABLE_IN_2_4 |
85 | const char *soup_address_get_physical (SoupAddress *addr); |
86 | SOUP_AVAILABLE_IN_2_4 |
87 | guint soup_address_get_port (SoupAddress *addr); |
88 | SOUP_AVAILABLE_IN_2_4 |
89 | struct sockaddr *soup_address_get_sockaddr (SoupAddress *addr, |
90 | int *len); |
91 | SOUP_AVAILABLE_IN_2_32 |
92 | GSocketAddress *soup_address_get_gsockaddr (SoupAddress *addr); |
93 | SOUP_AVAILABLE_IN_2_4 |
94 | gboolean soup_address_is_resolved (SoupAddress *addr); |
95 | |
96 | SOUP_AVAILABLE_IN_2_26 |
97 | guint soup_address_hash_by_name (gconstpointer addr); |
98 | SOUP_AVAILABLE_IN_2_26 |
99 | gboolean soup_address_equal_by_name (gconstpointer addr1, |
100 | gconstpointer addr2); |
101 | SOUP_AVAILABLE_IN_2_26 |
102 | guint soup_address_hash_by_ip (gconstpointer addr); |
103 | SOUP_AVAILABLE_IN_2_26 |
104 | gboolean soup_address_equal_by_ip (gconstpointer addr1, |
105 | gconstpointer addr2); |
106 | |
107 | |
108 | G_END_DECLS |
109 | |
110 | #endif /* __SOUP_ADDRESS_H__ */ |
111 | |