summaryrefslogtreecommitdiff
path: root/libsoup/soup-address.h
blob: 7d9435f8f1ed4d198cf68d7c0ee0d86be8050d29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
 * Authors:
 *      David Helder  (dhelder@umich.edu)
 *      Alex Graveley (alex@ximian.com)
 * 
 * Original code compliments of David Helder's GNET Networking Library.
 *
 * Copyright (C) 2000-2002, Ximian, Inc.
 */

#ifndef SOUP_ADDRESS_H
#define SOUP_ADDRESS_H

#include <glib.h>
#include <sys/types.h>
#include <sys/socket.h>

#include <libsoup/soup-error.h>

typedef struct _SoupAddress SoupAddress;

typedef gpointer SoupAddressNewId;

typedef void (*SoupAddressNewFn) (SoupAddress        *inetaddr, 
				  SoupKnownErrorCode  status, 
				  gpointer            user_data);

SoupAddressNewId     soup_address_new                (const gchar*       name, 
						      SoupAddressNewFn   func, 
						      gpointer           data);

void                 soup_address_new_cancel         (SoupAddressNewId   id);

SoupAddress         *soup_address_new_sync           (const gchar       *name);

SoupAddress         *soup_address_ipv4_any           (void);
SoupAddress         *soup_address_ipv6_any           (void);

void                 soup_address_ref                (SoupAddress*       ia);

void                 soup_address_unref              (SoupAddress*       ia);

SoupAddress *        soup_address_copy               (SoupAddress*       ia);


typedef gpointer SoupAddressGetNameId;

typedef void (*SoupAddressGetNameFn) (SoupAddress        *inetaddr, 
				      SoupKnownErrorCode  status, 
				      const gchar        *name,
				      gpointer           user_data);

SoupAddressGetNameId soup_address_get_name           (SoupAddress*         ia, 
						      SoupAddressGetNameFn func,
						      gpointer             data);

void                 soup_address_get_name_cancel    (SoupAddressGetNameId id);

const gchar         *soup_address_get_name_sync      (SoupAddress *addr);

gchar*               soup_address_get_canonical_name (SoupAddress*         ia);


SoupAddress         *soup_address_new_from_sockaddr  (struct sockaddr   *sa,
						      guint             *port);

void                 soup_address_make_sockaddr      (SoupAddress       *ia,
						      guint              port,
						      struct sockaddr  **sa,
						      int               *len);

guint                soup_address_hash               (const gpointer     p);

gint                 soup_address_equal              (const gpointer     p1, 
						      const gpointer     p2);

#endif /* SOUP_ADDRESS_H */