diff options
Diffstat (limited to 'src/idevice.h')
| -rw-r--r-- | src/idevice.h | 72 |
1 files changed, 58 insertions, 14 deletions
diff --git a/src/idevice.h b/src/idevice.h index 231b3ab..e05338e 100644 --- a/src/idevice.h +++ b/src/idevice.h | |||
| @@ -8,51 +8,95 @@ | |||
| 8 | * modify it under the terms of the GNU Lesser General Public | 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation; either | 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2.1 of the License, or (at your option) any later version. | 10 | * version 2.1 of the License, or (at your option) any later version. |
| 11 | * | 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, | 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. | 15 | * Lesser General Public License for more details. |
| 16 | * | 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public | 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software | 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ | 20 | */ |
| 21 | #ifndef IDEVICE_H | ||
| 22 | #define IDEVICE_H | ||
| 23 | 21 | ||
| 22 | #ifndef __DEVICE_H | ||
| 23 | #define __DEVICE_H | ||
| 24 | |||
| 25 | #ifdef HAVE_CONFIG_H | ||
| 26 | #include <config.h> | ||
| 27 | #endif | ||
| 28 | |||
| 29 | #if defined(HAVE_OPENSSL) | ||
| 30 | #include <openssl/ssl.h> | ||
| 31 | #elif defined(HAVE_GNUTLS) | ||
| 24 | #include <gnutls/gnutls.h> | 32 | #include <gnutls/gnutls.h> |
| 25 | #include <gnutls/x509.h> | 33 | #include <gnutls/x509.h> |
| 34 | #elif defined(HAVE_MBEDTLS) | ||
| 35 | #include <mbedtls/ssl.h> | ||
| 36 | #include <mbedtls/entropy.h> | ||
| 37 | #include <mbedtls/ctr_drbg.h> | ||
| 38 | #endif | ||
| 26 | 39 | ||
| 40 | #ifdef LIBIMOBILEDEVICE_STATIC | ||
| 41 | #define LIBIMOBILEDEVICE_API | ||
| 42 | #elif defined(_WIN32) | ||
| 43 | #define LIBIMOBILEDEVICE_API __declspec( dllexport ) | ||
| 44 | #else | ||
| 45 | #if __GNUC__ >= 4 | ||
| 46 | #define LIBIMOBILEDEVICE_API __attribute__((visibility("default"))) | ||
| 47 | #else | ||
| 48 | #define LIBIMOBILEDEVICE_API | ||
| 49 | #endif | ||
| 50 | #endif | ||
| 51 | |||
| 52 | #include "common/userpref.h" | ||
| 27 | #include "libimobiledevice/libimobiledevice.h" | 53 | #include "libimobiledevice/libimobiledevice.h" |
| 28 | 54 | ||
| 29 | enum connection_type { | 55 | #define DEVICE_CLASS_IPHONE 1 |
| 30 | CONNECTION_USBMUXD = 1 | 56 | #define DEVICE_CLASS_IPAD 2 |
| 31 | }; | 57 | #define DEVICE_CLASS_IPOD 3 |
| 58 | #define DEVICE_CLASS_APPLETV 4 | ||
| 59 | #define DEVICE_CLASS_WATCH 5 | ||
| 60 | #define DEVICE_CLASS_UNKNOWN 255 | ||
| 32 | 61 | ||
| 33 | struct ssl_data_private { | 62 | struct ssl_data_private { |
| 63 | #if defined(HAVE_OPENSSL) | ||
| 64 | SSL *session; | ||
| 65 | SSL_CTX *ctx; | ||
| 66 | #elif defined(HAVE_GNUTLS) | ||
| 34 | gnutls_certificate_credentials_t certificate; | 67 | gnutls_certificate_credentials_t certificate; |
| 35 | gnutls_session_t session; | 68 | gnutls_session_t session; |
| 36 | gnutls_x509_privkey_t root_privkey; | 69 | gnutls_x509_privkey_t root_privkey; |
| 37 | gnutls_x509_crt_t root_cert; | 70 | gnutls_x509_crt_t root_cert; |
| 38 | gnutls_x509_privkey_t host_privkey; | 71 | gnutls_x509_privkey_t host_privkey; |
| 39 | gnutls_x509_crt_t host_cert; | 72 | gnutls_x509_crt_t host_cert; |
| 73 | #elif defined(HAVE_MBEDTLS) | ||
| 74 | mbedtls_ssl_context ctx; | ||
| 75 | mbedtls_ssl_config config; | ||
| 76 | mbedtls_entropy_context entropy; | ||
| 77 | mbedtls_ctr_drbg_context ctr_drbg; | ||
| 78 | mbedtls_x509_crt certificate; | ||
| 79 | mbedtls_pk_context root_privkey; | ||
| 80 | #endif | ||
| 40 | }; | 81 | }; |
| 41 | typedef struct ssl_data_private *ssl_data_t; | 82 | typedef struct ssl_data_private *ssl_data_t; |
| 42 | 83 | ||
| 43 | struct idevice_connection_private { | 84 | struct idevice_connection_private { |
| 44 | enum connection_type type; | 85 | idevice_t device; |
| 86 | enum idevice_connection_type type; | ||
| 45 | void *data; | 87 | void *data; |
| 46 | ssl_data_t ssl_data; | 88 | ssl_data_t ssl_data; |
| 89 | unsigned int ssl_recv_timeout; | ||
| 90 | idevice_error_t status; | ||
| 47 | }; | 91 | }; |
| 48 | 92 | ||
| 49 | struct idevice_private { | 93 | struct idevice_private { |
| 50 | char *uuid; | 94 | char *udid; |
| 51 | enum connection_type conn_type; | 95 | uint32_t mux_id; |
| 96 | enum idevice_connection_type conn_type; | ||
| 52 | void *conn_data; | 97 | void *conn_data; |
| 98 | int version; | ||
| 99 | int device_class; | ||
| 53 | }; | 100 | }; |
| 54 | 101 | ||
| 55 | idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection); | ||
| 56 | idevice_error_t idevice_connection_disable_ssl(idevice_connection_t connection); | ||
| 57 | |||
| 58 | #endif | 102 | #endif |
