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 | #include <sys/socket.h> |
---|
11 | |
---|
12 | #include <libsoup/soup-types.h> |
---|
13 | |
---|
14 | #define SOUP_TYPE_ADDRESS (soup_address_get_type ()) |
---|
15 | #define SOUP_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_ADDRESS, SoupAddress)) |
---|
16 | #define SOUP_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_ADDRESS, SoupAddressClass)) |
---|
17 | #define SOUP_IS_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_ADDRESS)) |
---|
18 | #define SOUP_IS_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_ADDRESS)) |
---|
19 | #define SOUP_ADDRESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_ADDRESS, SoupAddressClass)) |
---|
20 | |
---|
21 | typedef struct SoupAddressPrivate SoupAddressPrivate; |
---|
22 | |
---|
23 | struct SoupAddress { |
---|
24 | GObject parent; |
---|
25 | |
---|
26 | SoupAddressPrivate *priv; |
---|
27 | }; |
---|
28 | |
---|
29 | typedef struct { |
---|
30 | GObjectClass parent_class; |
---|
31 | |
---|
32 | /* signals */ |
---|
33 | void (*dns_result) (SoupAddress *addr, guint status); |
---|
34 | } SoupAddressClass; |
---|
35 | |
---|
36 | /* This is messy, but gtk-doc doesn't understand if the #if occurs |
---|
37 | * inside the typedef. |
---|
38 | */ |
---|
39 | #ifdef AF_INET6 |
---|
40 | typedef enum { |
---|
41 | SOUP_ADDRESS_FAMILY_IPV4 = AF_INET, |
---|
42 | SOUP_ADDRESS_FAMILY_IPV6 = AF_INET6 |
---|
43 | } SoupAddressFamily; |
---|
44 | #else |
---|
45 | typedef enum { |
---|
46 | SOUP_ADDRESS_FAMILY_IPV4 = AF_INET, |
---|
47 | SOUP_ADDRESS_FAMILY_IPV6 = -1 |
---|
48 | } SoupAddressFamily; |
---|
49 | #endif |
---|
50 | |
---|
51 | #define SOUP_ADDRESS_ANY_PORT 0 |
---|
52 | |
---|
53 | GType soup_address_get_type (void); |
---|
54 | |
---|
55 | SoupAddress *soup_address_new (const char *name, |
---|
56 | guint port); |
---|
57 | SoupAddress *soup_address_new_from_sockaddr (struct sockaddr *sa, |
---|
58 | int len); |
---|
59 | SoupAddress *soup_address_new_any (SoupAddressFamily family, |
---|
60 | guint port); |
---|
61 | |
---|
62 | typedef void (*SoupAddressCallback) (SoupAddress *addr, |
---|
63 | guint status, |
---|
64 | gpointer data); |
---|
65 | void soup_address_resolve_async (SoupAddress *addr, |
---|
66 | SoupAddressCallback callback, |
---|
67 | gpointer user_data); |
---|
68 | guint soup_address_resolve_sync (SoupAddress *addr); |
---|
69 | |
---|
70 | const char *soup_address_get_name (SoupAddress *addr); |
---|
71 | struct sockaddr *soup_address_get_sockaddr (SoupAddress *addr, |
---|
72 | int *len); |
---|
73 | const char *soup_address_get_physical (SoupAddress *addr); |
---|
74 | guint soup_address_get_port (SoupAddress *addr); |
---|
75 | |
---|
76 | #endif /* SOUP_ADDRESS_H */ |
---|