Fixed all gtk-doc moans in soup-core documentation
[platform/upstream/libsoup.git] / libsoup / soup-socket.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * soup-socket.c: ronous Callback-based SOAP Request Queue.
4  *
5  * Authors:
6  *      David Helder  (dhelder@umich.edu)
7  *      Alex Graveley (alex@helixcode.com)
8  * 
9  * Original code compliments of David Helder's GNET Networking Library.
10  *
11  * Copyright (C) 2000, Helix Code, Inc.
12  */
13
14 #ifndef SOUP_SOCKET_H
15 #define SOUP_SOCKET_H 1
16
17 #include <glib.h>
18
19 typedef struct _SoupAddress SoupAddress;
20
21 typedef gpointer SoupAddressNewId;
22
23 typedef enum {
24         SOUP_ADDRESS_STATUS_OK,
25         SOUP_ADDRESS_STATUS_ERROR
26 } SoupAddressStatus;
27
28 typedef void (*SoupAddressNewFn) (SoupAddress       *inetaddr, 
29                                   SoupAddressStatus  status, 
30                                   gpointer           user_data);
31
32 SoupAddressNewId     soup_address_new                (const gchar*       name, 
33                                                       const gint         port, 
34                                                       SoupAddressNewFn   func, 
35                                                       gpointer           data);
36
37 void                 soup_address_new_cancel         (SoupAddressNewId   id);
38
39 SoupAddress         *soup_address_new_sync           (const gchar *name, 
40                                                       const gint port);
41
42 void                 soup_address_ref                (SoupAddress*       ia);
43
44 void                 soup_address_unref              (SoupAddress*       ia);
45
46
47 typedef gpointer SoupAddressGetNameId;
48
49 typedef void (*SoupAddressGetNameFn) (SoupAddress       *inetaddr, 
50                                       SoupAddressStatus  status, 
51                                       const gchar       *name,
52                                       gpointer           user_data);
53
54 SoupAddressGetNameId soup_address_get_name           (SoupAddress*         ia, 
55                                                       SoupAddressGetNameFn func,
56                                                       gpointer             data);
57
58 void                 soup_address_get_name_cancel    (SoupAddressGetNameId id);
59
60 gchar*               soup_address_get_canonical_name (SoupAddress*         ia);
61
62 gint                 soup_address_get_port           (const SoupAddress*   ia);
63
64 void                 soup_address_set_port           (const SoupAddress*   ia, 
65                                                       guint                port);
66
67 guint                soup_address_hash               (const gpointer       p);
68
69 gint                 soup_address_equal              (const gpointer       p1, 
70                                                       const gpointer       p2);
71
72 gint                 soup_address_noport_equal       (const gpointer       p1, 
73                                                       const gpointer       p2);
74
75 gchar*               soup_address_gethostname        (void);
76
77 SoupAddress*         soup_address_gethostaddr        (void);
78
79
80 typedef struct _SoupSocket SoupSocket;
81
82 typedef gpointer SoupSocketConnectId;
83
84 typedef enum {
85         SOUP_SOCKET_CONNECT_ERROR_NONE,
86         SOUP_SOCKET_CONNECT_ERROR_ADDR_RESOLVE,
87         SOUP_SOCKET_CONNECT_ERROR_NETWORK
88 } SoupSocketConnectStatus;
89
90 typedef void (*SoupSocketConnectFn) (SoupSocket              *socket, 
91                                      SoupSocketConnectStatus  status, 
92                                      gpointer                 data);
93
94 SoupSocketConnectId  soup_socket_connect        (const gchar*        hostname,
95                                                  const gint          port, 
96                                                  SoupSocketConnectFn func, 
97                                                  gpointer            data);
98
99 void                 soup_socket_connect_cancel (SoupSocketConnectId id);
100
101 SoupSocket          *soup_socket_connect_sync   (const gchar        *hostname, 
102                                                  const gint          port);
103
104
105
106 typedef gpointer SoupSocketNewId;
107
108 typedef enum {
109         SOUP_SOCKET_NEW_STATUS_OK,
110         SOUP_SOCKET_NEW_STATUS_ERROR
111 } SoupSocketNewStatus;
112
113 typedef void (*SoupSocketNewFn) (SoupSocket*         socket, 
114                                  SoupSocketNewStatus status, 
115                                  gpointer            data);
116
117 SoupSocketNewId     soup_socket_new             (SoupAddress        *addr, 
118                                                  SoupSocketNewFn     func,
119                                                  gpointer            data);
120
121 void                soup_socket_new_cancel      (SoupSocketNewId     id);
122
123 SoupSocket         *soup_socket_new_sync        (SoupAddress        *addr);
124
125
126 void                soup_socket_ref             (SoupSocket*         s);
127
128 void                soup_socket_unref           (SoupSocket*         s);
129
130 GIOChannel         *soup_socket_get_iochannel   (SoupSocket*         socket);
131
132 SoupAddress        *soup_socket_get_address     (const SoupSocket*   socket);
133
134 gint                soup_socket_get_port        (const SoupSocket*   socket);
135
136 #endif /* SOUP_SOCKET_H */