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>
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))
26 GObjectClass parent_class;
29 void (*readable) (SoupSocket *);
30 void (*writable) (SoupSocket *);
31 void (*disconnected) (SoupSocket *);
33 void (*new_connection) (SoupSocket *, SoupSocket *);
35 /* Padding for future expansion */
36 void (*_libsoup_reserved1) (void);
37 void (*_libsoup_reserved2) (void);
38 void (*_libsoup_reserved3) (void);
39 void (*_libsoup_reserved4) (void);
42 #define SOUP_SOCKET_LOCAL_ADDRESS "local-address"
43 #define SOUP_SOCKET_REMOTE_ADDRESS "remote-address"
44 #define SOUP_SOCKET_FLAG_NONBLOCKING "non-blocking"
45 #define SOUP_SOCKET_IS_SERVER "is-server"
46 #define SOUP_SOCKET_SSL_CREDENTIALS "ssl-creds"
47 #define SOUP_SOCKET_SSL_STRICT "ssl-strict"
48 #define SOUP_SOCKET_SSL_FALLBACK "ssl-fallback"
49 #define SOUP_SOCKET_TRUSTED_CERTIFICATE "trusted-certificate"
50 #define SOUP_SOCKET_ASYNC_CONTEXT "async-context"
51 #define SOUP_SOCKET_TIMEOUT "timeout"
52 #define SOUP_SOCKET_TLS_CERTIFICATE "tls-certificate"
53 #define SOUP_SOCKET_TLS_ERRORS "tls-errors"
55 typedef void (*SoupSocketCallback) (SoupSocket *sock,
59 GType soup_socket_get_type (void);
61 SoupSocket *soup_socket_new (const char *optname1,
62 ...) G_GNUC_NULL_TERMINATED;
64 void soup_socket_connect_async (SoupSocket *sock,
65 GCancellable *cancellable,
66 SoupSocketCallback callback,
68 guint soup_socket_connect_sync (SoupSocket *sock,
69 GCancellable *cancellable);
70 int soup_socket_get_fd (SoupSocket *sock);
72 gboolean soup_socket_listen (SoupSocket *sock);
74 gboolean soup_socket_start_ssl (SoupSocket *sock,
75 GCancellable *cancellable);
76 gboolean soup_socket_start_proxy_ssl (SoupSocket *sock,
78 GCancellable *cancellable);
79 gboolean soup_socket_is_ssl (SoupSocket *sock);
81 void soup_socket_disconnect (SoupSocket *sock);
82 gboolean soup_socket_is_connected (SoupSocket *sock);
84 SoupAddress *soup_socket_get_local_address (SoupSocket *sock);
85 SoupAddress *soup_socket_get_remote_address (SoupSocket *sock);
90 SOUP_SOCKET_WOULD_BLOCK,
95 SoupSocketIOStatus soup_socket_read (SoupSocket *sock,
99 GCancellable *cancellable,
101 SoupSocketIOStatus soup_socket_read_until (SoupSocket *sock,
104 gconstpointer boundary,
107 gboolean *got_boundary,
108 GCancellable *cancellable,
111 SoupSocketIOStatus soup_socket_write (SoupSocket *sock,
112 gconstpointer buffer,
115 GCancellable *cancellable,
120 #endif /* SOUP_SOCKET_H */