1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2000-2003, Ximian, Inc.
7 #define SOUP_SOCKET_H 1
9 #include <glib-object.h>
10 #include <libsoup/soup-address.h>
11 #include <libsoup/soup-error.h>
13 #define SOUP_TYPE_SOCKET (soup_socket_get_type ())
14 #define SOUP_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_SOCKET, SoupSocket))
15 #define SOUP_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_SOCKET, SoupSocketClass))
16 #define SOUP_IS_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_SOCKET))
17 #define SOUP_IS_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_SOCKET))
18 #define SOUP_SOCKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_SOCKET, SoupSocketClass))
20 typedef struct SoupSocketPrivate SoupSocketPrivate;
25 SoupSocketPrivate *priv;
29 GObjectClass parent_class;
32 void (*connect_result) (SoupSocket *, SoupKnownErrorCode);
34 void (*new_connection) (SoupSocket *, SoupSocket *);
37 GType soup_socket_get_type (void);
39 SoupSocket *soup_socket_new (void);
41 void soup_socket_connect (SoupSocket *sock,
42 SoupAddress *rem_addr);
43 gboolean soup_socket_listen (SoupSocket *sock,
44 SoupAddress *local_addr);
45 void soup_socket_start_ssl (SoupSocket *sock);
48 typedef void (*SoupSocketCallback) (SoupSocket *sock,
49 SoupKnownErrorCode status,
51 typedef void (*SoupSocketListenerCallback) (SoupSocket *listener,
55 SoupSocket *soup_socket_client_new (const char *hostname,
58 SoupSocketCallback callback,
60 SoupSocket *soup_socket_server_new (SoupAddress *local_addr,
62 SoupSocketListenerCallback,
66 GIOChannel *soup_socket_get_iochannel (SoupSocket *sock);
68 SoupAddress *soup_socket_get_local_address (SoupSocket *sock);
69 SoupAddress *soup_socket_get_remote_address (SoupSocket *sock);
71 #endif /* SOUP_SOCKET_H */