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 <libsoup/soup-types.h>
11 #define SOUP_TYPE_SOCKET (soup_socket_get_type ())
12 #define SOUP_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_SOCKET, SoupSocket))
13 #define SOUP_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_SOCKET, SoupSocketClass))
14 #define SOUP_IS_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_SOCKET))
15 #define SOUP_IS_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_SOCKET))
16 #define SOUP_SOCKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_SOCKET, SoupSocketClass))
18 typedef struct SoupSocketPrivate SoupSocketPrivate;
23 SoupSocketPrivate *priv;
27 GObjectClass parent_class;
30 void (*connect_result) (SoupSocket *, SoupKnownErrorCode);
31 void (*readable) (SoupSocket *);
32 void (*writable) (SoupSocket *);
33 void (*disconnected) (SoupSocket *);
35 void (*new_connection) (SoupSocket *, SoupSocket *);
39 SOUP_SOCKET_FLAG_NONBLOCKING,
40 SOUP_SOCKET_FLAG_NODELAY,
41 SOUP_SOCKET_FLAG_REUSEADDR,
44 GType soup_socket_get_type (void);
46 SoupSocket *soup_socket_new (void);
47 void soup_socket_set_flag (SoupSocket *sock,
51 void soup_socket_connect (SoupSocket *sock,
52 SoupAddress *rem_addr);
53 gboolean soup_socket_listen (SoupSocket *sock,
54 SoupAddress *local_addr);
55 void soup_socket_start_ssl (SoupSocket *sock);
57 void soup_socket_disconnect (SoupSocket *sock);
58 gboolean soup_socket_is_connected (SoupSocket *sock);
60 typedef void (*SoupSocketCallback) (SoupSocket *sock,
61 SoupKnownErrorCode status,
63 typedef void (*SoupSocketListenerCallback) (SoupSocket *listener,
67 SoupSocket *soup_socket_client_new (const char *hostname,
70 SoupSocketCallback callback,
72 SoupSocket *soup_socket_server_new (SoupAddress *local_addr,
74 SoupSocketListenerCallback,
78 GIOChannel *soup_socket_get_iochannel (SoupSocket *sock);
80 SoupAddress *soup_socket_get_local_address (SoupSocket *sock);
81 SoupAddress *soup_socket_get_remote_address (SoupSocket *sock);
86 SOUP_SOCKET_WOULD_BLOCK,
91 SoupSocketIOStatus soup_socket_read (SoupSocket *sock,
95 SoupSocketIOStatus soup_socket_read_until (SoupSocket *sock,
98 gconstpointer boundary,
101 gboolean *got_boundary);
103 SoupSocketIOStatus soup_socket_write (SoupSocket *sock,
104 gconstpointer buffer,
109 #endif /* SOUP_SOCKET_H */