remove hack to look at internals of GNET by using the new forked GNET :)
[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_clone              (const SoupAddress* ia);
40
41 void                 soup_address_ref                (SoupAddress*       ia);
42
43 void                 soup_address_unref              (SoupAddress*       ia);
44
45
46 typedef gpointer SoupAddressGetNameId;
47
48 typedef void (*SoupAddressGetNameFn) (SoupAddress       *inetaddr, 
49                                       SoupAddressStatus  status, 
50                                       gchar             *name,
51                                       gpointer           user_data);
52
53 SoupAddressGetNameId soup_address_get_name           (SoupAddress*         ia, 
54                                                       SoupAddressGetNameFn func,
55                                                       gpointer             data);
56
57 void                 soup_address_get_name_cancel    (SoupAddressGetNameId id);
58
59 gchar*               soup_address_get_canonical_name (SoupAddress*         ia);
60
61 gint                 soup_address_get_port           (const SoupAddress*   ia);
62
63 void                 soup_address_set_port           (const SoupAddress*   ia, 
64                                                       guint                port);
65
66 guint                soup_address_hash               (const gpointer       p);
67
68 gint                 soup_address_equal              (const gpointer       p1, 
69                                                       const gpointer       p2);
70
71 gint                 soup_address_noport_equal       (const gpointer       p1, 
72                                                       const gpointer       p2);
73
74 gchar*               soup_address_gethostname        (void);
75
76 SoupAddress*         soup_address_gethostaddr        (void);
77
78
79 typedef struct _SoupSocket SoupSocket;
80
81 typedef gpointer SoupSocketConnectId;
82
83 typedef enum {
84         SOUP_SOCKET_CONNECT_ERROR_NONE,
85         SOUP_SOCKET_CONNECT_ERROR_ADDR_RESOLVE,
86         SOUP_SOCKET_CONNECT_ERROR_NETWORK
87 } SoupSocketConnectStatus;
88
89 typedef void (*SoupSocketConnectFn) (SoupSocket* socket, 
90                                      SoupAddress* ia,
91                                      SoupSocketConnectStatus status, 
92                                      gpointer data);
93
94 SoupSocketConnectId soup_socket_connect        (gchar*              hostname,
95                                                 gint                port, 
96                                                 SoupSocketConnectFn func, 
97                                                 gpointer            user_data);
98
99 void                soup_socket_connect_cancel (SoupSocketConnectId id);
100
101
102 typedef gpointer SoupSocketNewId;
103
104 typedef enum {
105         SOUP_SOCKET_NEW_STATUS_OK,
106         SOUP_SOCKET_NEW_STATUS_ERROR
107 } SoupSocketNewStatus;
108
109 typedef void (*SoupSocketNewFn) (SoupSocket*         socket, 
110                                  SoupSocketNewStatus status, 
111                                  gpointer            data);
112
113 SoupSocketNewId     soup_socket_new            (const SoupAddress*  addr, 
114                                                 SoupSocketNewFn     func,
115                                                 gpointer            user_data);
116
117 void                soup_socket_new_cancel     (SoupSocketNewId     id);
118
119
120 void                soup_socket_ref            (SoupSocket*         s);
121
122 void                soup_socket_unref          (SoupSocket*         s);
123
124 GIOChannel         *soup_socket_get_iochannel  (SoupSocket*         socket);
125
126 SoupAddress        *soup_socket_get_address    (const SoupSocket*   socket);
127
128 gint                soup_socket_get_port       (const SoupSocket*   socket);
129
130 #endif /* SOUP_SOCKET_H */