1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- |
---|
2 | * |
---|
3 | * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu> |
---|
4 | * |
---|
5 | * This program is free software; you can redistribute it and/or modify |
---|
6 | * it under the terms of the GNU General Public License as published by |
---|
7 | * the Free Software Foundation; either version 2 of the License, or |
---|
8 | * (at your option) any later version. |
---|
9 | * |
---|
10 | * This program is distributed in the hope that it will be useful, |
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | * GNU General Public License for more details. |
---|
14 | * |
---|
15 | * You should have received a copy of the GNU General Public License |
---|
16 | * along with this program; if not, write to the Free Software |
---|
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
18 | * |
---|
19 | */ |
---|
20 | |
---|
21 | |
---|
22 | #ifndef __GDM_ADDRESS_H |
---|
23 | #define __GDM_ADDRESS_H |
---|
24 | |
---|
25 | #include <glib-object.h> |
---|
26 | #ifndef G_OS_WIN32 |
---|
27 | #include <sys/types.h> |
---|
28 | #include <sys/socket.h> |
---|
29 | #include <netdb.h> |
---|
30 | #else |
---|
31 | #include <winsock2.h> |
---|
32 | #undef interface |
---|
33 | #endif |
---|
34 | |
---|
35 | G_BEGIN_DECLS |
---|
36 | |
---|
37 | #define GDM_TYPE_ADDRESS (gdm_address_get_type ()) |
---|
38 | |
---|
39 | typedef struct _GdmAddress GdmAddress; |
---|
40 | |
---|
41 | GType gdm_address_get_type (void); |
---|
42 | |
---|
43 | GdmAddress * gdm_address_new_from_sockaddr (struct sockaddr *sa, |
---|
44 | size_t size); |
---|
45 | |
---|
46 | int gdm_address_get_family_type (GdmAddress *address); |
---|
47 | struct sockaddr_storage *gdm_address_get_sockaddr_storage (GdmAddress *address); |
---|
48 | struct sockaddr_storage *gdm_address_peek_sockaddr_storage (GdmAddress *address); |
---|
49 | |
---|
50 | gboolean gdm_address_get_hostname (GdmAddress *address, |
---|
51 | char **hostname); |
---|
52 | gboolean gdm_address_get_numeric_info (GdmAddress *address, |
---|
53 | char **numeric_hostname, |
---|
54 | char **service); |
---|
55 | gboolean gdm_address_is_local (GdmAddress *address); |
---|
56 | gboolean gdm_address_is_loopback (GdmAddress *address); |
---|
57 | |
---|
58 | gboolean gdm_address_equal (GdmAddress *a, |
---|
59 | GdmAddress *b); |
---|
60 | |
---|
61 | GdmAddress * gdm_address_copy (GdmAddress *address); |
---|
62 | void gdm_address_free (GdmAddress *address); |
---|
63 | |
---|
64 | |
---|
65 | void gdm_address_debug (GdmAddress *address); |
---|
66 | |
---|
67 | const GList * gdm_address_peek_local_list (void); |
---|
68 | |
---|
69 | |
---|
70 | G_END_DECLS |
---|
71 | |
---|
72 | #endif /* __GDM_ADDRESS_H */ |
---|