1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * soup-socket.c: ronous Callback-based SOAP Request Queue.
6 * David Helder (dhelder@umich.edu)
7 * Alex Graveley (alex@helixcode.com)
9 * Original code compliments of David Helder's GNET Networking Library.
11 * Copyright (C) 2000, Helix Code, Inc.
15 #define SOUP_SOCKET_H 1
19 typedef struct _SoupAddress SoupAddress;
21 typedef gpointer SoupAddressNewId;
24 SOUP_ADDRESS_STATUS_OK,
25 SOUP_ADDRESS_STATUS_ERROR
28 typedef void (*SoupAddressNewFn) (SoupAddress *inetaddr,
29 SoupAddressStatus status,
32 SoupAddressNewId soup_address_new (const gchar* name,
34 SoupAddressNewFn func,
37 void soup_address_new_cancel (SoupAddressNewId id);
39 SoupAddress *soup_address_new_sync (const gchar *name,
42 void soup_address_ref (SoupAddress* ia);
44 void soup_address_unref (SoupAddress* ia);
46 SoupAddress * soup_address_copy (SoupAddress* ia);
49 typedef gpointer SoupAddressGetNameId;
51 typedef void (*SoupAddressGetNameFn) (SoupAddress *inetaddr,
52 SoupAddressStatus status,
56 SoupAddressGetNameId soup_address_get_name (SoupAddress* ia,
57 SoupAddressGetNameFn func,
60 void soup_address_get_name_cancel (SoupAddressGetNameId id);
62 const gchar *soup_address_get_name_sync (SoupAddress *addr);
64 gchar* soup_address_get_canonical_name (SoupAddress* ia);
66 gint soup_address_get_port (const SoupAddress* ia);
68 void soup_address_set_port (const SoupAddress* ia,
71 guint soup_address_hash (const gpointer p);
73 gint soup_address_equal (const gpointer p1,
76 gint soup_address_noport_equal (const gpointer p1,
79 gchar* soup_address_gethostname (void);
81 SoupAddress* soup_address_gethostaddr (void);
84 typedef struct _SoupSocket SoupSocket;
86 typedef gpointer SoupSocketConnectId;
89 SOUP_SOCKET_CONNECT_ERROR_NONE,
90 SOUP_SOCKET_CONNECT_ERROR_ADDR_RESOLVE,
91 SOUP_SOCKET_CONNECT_ERROR_NETWORK
92 } SoupSocketConnectStatus;
94 typedef void (*SoupSocketConnectFn) (SoupSocket *socket,
95 SoupSocketConnectStatus status,
98 SoupSocketConnectId soup_socket_connect (const gchar* hostname,
100 SoupSocketConnectFn func,
103 void soup_socket_connect_cancel (SoupSocketConnectId id);
105 SoupSocket *soup_socket_connect_sync (const gchar *hostname,
110 typedef gpointer SoupSocketNewId;
113 SOUP_SOCKET_NEW_STATUS_OK,
114 SOUP_SOCKET_NEW_STATUS_ERROR
115 } SoupSocketNewStatus;
117 typedef void (*SoupSocketNewFn) (SoupSocket* socket,
118 SoupSocketNewStatus status,
121 SoupSocketNewId soup_socket_new (SoupAddress *addr,
122 SoupSocketNewFn func,
125 void soup_socket_new_cancel (SoupSocketNewId id);
127 SoupSocket *soup_socket_new_sync (SoupAddress *addr);
130 void soup_socket_ref (SoupSocket* s);
132 void soup_socket_unref (SoupSocket* s);
134 GIOChannel *soup_socket_get_iochannel (SoupSocket* socket);
136 SoupAddress *soup_socket_get_address (const SoupSocket* socket);
138 gint soup_socket_get_port (const SoupSocket* socket);
141 #define SOUP_SERVER_ANY_PORT 0
143 SoupSocket *soup_socket_server_new (const gint port);
145 SoupSocket *soup_socket_server_accept (SoupSocket *socket);
147 SoupSocket *soup_socket_server_try_accept (SoupSocket *socket);
149 #endif /* SOUP_SOCKET_H */