source: trunk/third/libsoup/libsoup/soup-address.h @ 21108

Revision 21108, 2.5 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21107, which included commits to RCS files with non-trunk default branches.
Line 
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
21typedef struct SoupAddressPrivate SoupAddressPrivate;
22
23struct SoupAddress {
24        GObject parent;
25
26        SoupAddressPrivate *priv;
27};
28
29typedef 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
40typedef enum {
41        SOUP_ADDRESS_FAMILY_IPV4 = AF_INET,
42        SOUP_ADDRESS_FAMILY_IPV6 = AF_INET6
43} SoupAddressFamily;
44#else
45typedef 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
53GType soup_address_get_type (void);
54
55SoupAddress     *soup_address_new                (const char          *name,
56                                                  guint                port);
57SoupAddress     *soup_address_new_from_sockaddr  (struct sockaddr     *sa,
58                                                  int                  len);
59SoupAddress     *soup_address_new_any            (SoupAddressFamily    family,
60                                                  guint                port);
61
62typedef void   (*SoupAddressCallback)            (SoupAddress         *addr,
63                                                  guint                status,
64                                                  gpointer             data);
65void             soup_address_resolve_async      (SoupAddress         *addr,
66                                                  SoupAddressCallback  callback,
67                                                  gpointer             user_data);
68guint            soup_address_resolve_sync       (SoupAddress         *addr);
69
70const char      *soup_address_get_name           (SoupAddress         *addr);
71struct sockaddr *soup_address_get_sockaddr       (SoupAddress         *addr,
72                                                  int                 *len);
73const char      *soup_address_get_physical       (SoupAddress         *addr);
74guint            soup_address_get_port           (SoupAddress         *addr);
75
76#endif /* SOUP_ADDRESS_H */
Note: See TracBrowser for help on using the repository browser.