1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
/*
Copyright (C) 2011 Samsung Electronics
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/**
* @file ewk_network.h
* @brief Describes the network API.
*/
#ifndef ewk_network_h
#define ewk_network_h
#include <Eina.h>
#include <libsoup/soup.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Sets the given proxy URI to network backend.
*
* @param proxy URI to set
*
* @note If the libsoup backend is being used, this function has effect on
* the @b default SoupSession, returned by ewk_network_default_soup_session_get().
* If a different SoupSession is used and passed to ewk_view_soup_session_set(),
* this function will not have any effect on it.
*/
EAPI void ewk_network_proxy_uri_set(const char *proxy);
/**
* Gets the proxy URI from the network backend.
*
* The returned string should be freed by eina_stringshare_del() after use.
*
* @return current proxy URI or @c NULL if it's not set
*
* @note If the libsoup backend is being used, this function has effect on
* the @b default SoupSession, returned by ewk_network_default_soup_session_get().
* If a different SoupSession is used and passed to ewk_view_soup_session_set(),
* this function will not have any effect on it.
*/
EAPI const char *ewk_network_proxy_uri_get(void);
/**
* Returns whether HTTPS connections should check the received certificate and error out if it is invalid.
*
* By default, HTTPS connections are performed regardless of the validity of the certificate provided.
*
* @sa ewk_network_tls_ca_certificates_path_set
*
* @note If the libsoup backend is being used, this function has effect on
* the @b default SoupSession, returned by ewk_network_default_soup_session_get().
* If a different SoupSession is used and passed to ewk_view_soup_session_set(),
* this function will not have any effect on it.
*/
EAPI Eina_Bool ewk_network_tls_certificate_check_get(void);
/**
* Sets whether HTTPS connections should check the received certificate and error out if it is invalid.
*
* By default, HTTPS connections are performed regardless of the validity of the certificate provided.
*
* @param enable Whether to check the provided certificates or not.
*
* @sa ewk_network_tls_ca_certificates_path_set
*
* @note If the libsoup backend is being used, this function has effect on
* the @b default SoupSession, returned by ewk_network_default_soup_session_get().
* If a different SoupSession is used and passed to ewk_view_soup_session_set(),
* this function will not have any effect on it.
*/
EAPI void ewk_network_tls_certificate_check_set(Eina_Bool enable);
/**
* Returns the path to a file containing the platform's root X.509 CA certificates.
*
* The file is a list of concatenated PEM-format X.509 certificates used as root CA certificates.
* They are used to validate all the certificates received when a TLS connection (such as an HTTPS one) is made.
*
* If @c ewk_network_tls_certificate_check_get() returns @c EINA_TRUE, the certificates set by this function
* will be used to decide whether a certificate provided by a web site is invalid and the request should then
* be cancelled.
*
* By default, the path is not set, so all certificates are considered as not signed by a trusted root CA.
*
* @sa ewk_network_tls_certificate_check_set
*
* @note If the libsoup backend is being used, this function has effect on
* the @b default SoupSession, returned by ewk_network_default_soup_session_get().
* If a different SoupSession is used and passed to ewk_view_soup_session_set(),
* this function will not have any effect on it.
*/
EAPI const char *ewk_network_tls_ca_certificates_path_get(void);
/**
* Sets the path to a file containing the platform's root X.509 CA certificates.
*
* The file is a list of concatenated PEM-format X.509 certificates used as root CA certificates.
* They are used to validate all the certificates received when a TLS connection (such as an HTTPS one) is made.
*
* If @c ewk_network_tls_certificate_check_get() returns @c EINA_TRUE, the certificates set by this function
* will be used to decide whether a certificate provided by a web site is invalid and the request should then
* be cancelled.
*
* By default, the path is not set, so all certificates are considered as not signed by a trusted root CA.
*
* @param path The path to the certificate bundle.
*
* @sa ewk_network_tls_certificate_check_set
*
* @note If the libsoup backend is being used, this function has effect on
* the @b default SoupSession, returned by ewk_network_default_soup_session_get().
* If a different SoupSession is used and passed to ewk_view_soup_session_set(),
* this function will not have any effect on it.
*/
EAPI void ewk_network_tls_ca_certificates_path_set(const char *path);
/**
* Returns the default @c SoupSession used by all views.
*
* @return The default @c SoupSession in use.
*/
EAPI SoupSession *ewk_network_default_soup_session_get(void);
#ifdef __cplusplus
}
#endif
#endif // ewk_network_h
|