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>
14 #define SOUP_TYPE_SOCKET (soup_socket_get_type ())
15 #define SOUP_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_SOCKET, SoupSocket))
16 #define SOUP_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_SOCKET, SoupSocketClass))
17 #define SOUP_IS_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_SOCKET))
18 #define SOUP_IS_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_SOCKET))
19 #define SOUP_SOCKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_SOCKET, SoupSocketClass))
27 GObjectClass parent_class;
30 void (*readable) (SoupSocket *);
31 void (*writable) (SoupSocket *);
32 void (*disconnected) (SoupSocket *);
34 void (*new_connection) (SoupSocket *, SoupSocket *);
36 /* Padding for future expansion */
37 void (*_libsoup_reserved1) (void);
38 void (*_libsoup_reserved2) (void);
39 void (*_libsoup_reserved3) (void);
40 void (*_libsoup_reserved4) (void);
43 #define SOUP_SOCKET_LOCAL_ADDRESS "local-address"
44 #define SOUP_SOCKET_REMOTE_ADDRESS "remote-address"
45 #define SOUP_SOCKET_FLAG_NONBLOCKING "non-blocking"
46 #define SOUP_SOCKET_IS_SERVER "is-server"
47 #define SOUP_SOCKET_SSL_CREDENTIALS "ssl-creds"
48 #define SOUP_SOCKET_SSL_STRICT "ssl-strict"
49 #define SOUP_SOCKET_ASYNC_CONTEXT "async-context"
50 #define SOUP_SOCKET_TIMEOUT "timeout"
52 typedef void (*SoupSocketCallback) (SoupSocket *sock,
56 GType soup_socket_get_type (void);
58 SoupSocket *soup_socket_new (const char *optname1,
59 ...) G_GNUC_NULL_TERMINATED;
61 void soup_socket_connect_async (SoupSocket *sock,
62 GCancellable *cancellable,
63 SoupSocketCallback callback,
65 guint soup_socket_connect_sync (SoupSocket *sock,
66 GCancellable *cancellable);
67 int soup_socket_get_fd (SoupSocket *sock);
69 gboolean soup_socket_listen (SoupSocket *sock);
71 gboolean soup_socket_start_ssl (SoupSocket *sock,
72 GCancellable *cancellable);
73 gboolean soup_socket_start_proxy_ssl (SoupSocket *sock,
75 GCancellable *cancellable);
76 gboolean soup_socket_is_ssl (SoupSocket *sock);
78 void soup_socket_disconnect (SoupSocket *sock);
79 gboolean soup_socket_is_connected (SoupSocket *sock);
81 SoupAddress *soup_socket_get_local_address (SoupSocket *sock);
82 SoupAddress *soup_socket_get_remote_address (SoupSocket *sock);
87 SOUP_SOCKET_WOULD_BLOCK,
92 SoupSocketIOStatus soup_socket_read (SoupSocket *sock,
96 GCancellable *cancellable,
98 SoupSocketIOStatus soup_socket_read_until (SoupSocket *sock,
101 gconstpointer boundary,
104 gboolean *got_boundary,
105 GCancellable *cancellable,
108 SoupSocketIOStatus soup_socket_write (SoupSocket *sock,
109 gconstpointer buffer,
112 GCancellable *cancellable,
117 #endif /* SOUP_SOCKET_H */