• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright 2011-2014 Red Hat, Inc.
4  */
5 
6 #ifndef __SOUP_SOCKET_PRIVATE_H__
7 #define __SOUP_SOCKET_PRIVATE_H__ 1
8 
9 #include "soup-socket.h"
10 
11 #define SOUP_SOCKET_SOCKET_PROPERTIES "socket-properties"
12 #define SOUP_SOCKET_FD                "fd"
13 #define SOUP_SOCKET_GSOCKET           "gsocket"
14 #define SOUP_SOCKET_IOSTREAM          "iostream"
15 #define SOUP_SOCKET_IPV6_ONLY         "ipv6-only"
16 
17 gboolean   soup_socket_connect_sync_internal   (SoupSocket           *sock,
18 						GCancellable         *cancellable,
19 						GError              **error);
20 void       soup_socket_connect_async_internal  (SoupSocket           *sock,
21 						GCancellable         *cancellable,
22 						GAsyncReadyCallback   callback,
23 						gpointer              user_data);
24 gboolean   soup_socket_connect_finish_internal (SoupSocket           *sock,
25 						GAsyncResult         *result,
26 						GError              **error);
27 
28 gboolean   soup_socket_handshake_sync          (SoupSocket           *sock,
29 						const char           *host,
30 						GCancellable         *cancellable,
31 						GError              **error);
32 void       soup_socket_handshake_async         (SoupSocket           *sock,
33 						const char           *host,
34 						GCancellable         *cancellable,
35 						GAsyncReadyCallback   callback,
36 						gpointer              user_data);
37 gboolean   soup_socket_handshake_finish        (SoupSocket           *sock,
38 						GAsyncResult         *result,
39 						GError              **error);
40 
41 GSocket   *soup_socket_get_gsocket             (SoupSocket           *sock);
42 GSocket   *soup_socket_steal_gsocket           (SoupSocket           *sock);
43 GIOStream *soup_socket_get_connection          (SoupSocket           *sock);
44 GIOStream *soup_socket_get_iostream            (SoupSocket           *sock);
45 
46 SoupURI   *soup_socket_get_http_proxy_uri      (SoupSocket           *sock);
47 
48 gboolean   soup_socket_listen_full             (SoupSocket           *sock,
49                                                 GError              **error);
50 
51 
52 
53 typedef struct {
54 	GMainContext *async_context;
55 	gboolean use_thread_context;
56 
57 	GProxyResolver *proxy_resolver;
58 	SoupAddress *local_addr;
59 
60 	GTlsDatabase *tlsdb;
61 	GTlsInteraction *tls_interaction;
62 	gboolean ssl_strict;
63 
64 	guint io_timeout;
65 	guint idle_timeout;
66 
67 	/*< private >*/
68 	guint ref_count;
69 } SoupSocketProperties;
70 
71 GType soup_socket_properties_get_type (void);
72 #define SOUP_TYPE_SOCKET_PROPERTIES (soup_socket_properties_get_type ())
73 
74 SoupSocketProperties *soup_socket_properties_new   (GMainContext    *async_context,
75 						    gboolean         use_thread_context,
76 						    GProxyResolver  *proxy_resolver,
77 						    SoupAddress     *local_addr,
78 						    GTlsDatabase    *tlsdb,
79 						    GTlsInteraction *tls_interaction,
80 						    gboolean         ssl_strict,
81 						    guint            io_timeout,
82 						    guint            idle_timeout);
83 
84 SoupSocketProperties *soup_socket_properties_ref   (SoupSocketProperties *props);
85 void                  soup_socket_properties_unref (SoupSocketProperties *props);
86 
87 void soup_socket_properties_push_async_context (SoupSocketProperties *props);
88 void soup_socket_properties_pop_async_context  (SoupSocketProperties *props);
89 
90 #endif /* __SOUP_SOCKET_PRIVATE_H__ */
91