1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * soup-socket.c: ronous Callback-based HTTP 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
18 #include <libsoup/soup-address.h>
20 typedef struct _SoupSocket SoupSocket;
22 typedef gpointer SoupSocketConnectId;
25 SOUP_SOCKET_CONNECT_ERROR_NONE,
26 SOUP_SOCKET_CONNECT_ERROR_ADDR_RESOLVE,
27 SOUP_SOCKET_CONNECT_ERROR_NETWORK
28 } SoupSocketConnectStatus;
30 typedef void (*SoupSocketConnectFn) (SoupSocket *socket,
31 SoupSocketConnectStatus status,
34 SoupSocketConnectId soup_socket_connect (const gchar* hostname,
36 SoupSocketConnectFn func,
39 void soup_socket_connect_cancel (SoupSocketConnectId id);
41 SoupSocket *soup_socket_connect_sync (const gchar *hostname,
45 typedef gpointer SoupSocketNewId;
48 SOUP_SOCKET_NEW_STATUS_OK,
49 SOUP_SOCKET_NEW_STATUS_ERROR
50 } SoupSocketNewStatus;
52 typedef void (*SoupSocketNewFn) (SoupSocket* socket,
53 SoupSocketNewStatus status,
56 SoupSocketNewId soup_socket_new (SoupAddress *addr,
61 void soup_socket_new_cancel (SoupSocketNewId id);
63 SoupSocket *soup_socket_new_sync (SoupAddress *addr,
67 void soup_socket_ref (SoupSocket* s);
69 void soup_socket_unref (SoupSocket* s);
71 GIOChannel *soup_socket_get_iochannel (SoupSocket* socket);
73 SoupAddress *soup_socket_get_address (const SoupSocket* socket);
75 gint soup_socket_get_port (const SoupSocket* socket);
78 #define SOUP_SERVER_ANY_PORT 0
80 SoupSocket *soup_socket_server_new (SoupAddress *local_addr,
83 SoupSocket *soup_socket_server_accept (SoupSocket *socket);
85 SoupSocket *soup_socket_server_try_accept (SoupSocket *socket);
87 #endif /* SOUP_SOCKET_H */