summaryrefslogtreecommitdiffstats
path: root/src/idevice.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/idevice.h')
-rw-r--r--src/idevice.h74
1 files changed, 60 insertions, 14 deletions
diff --git a/src/idevice.h b/src/idevice.h
index 231b3ab..dd72f9d 100644
--- a/src/idevice.h
+++ b/src/idevice.h
@@ -8,51 +8,97 @@
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
29enum connection_type { 55#define DEVICE_VERSION(maj, min, patch) (((maj & 0xFF) << 16) | ((min & 0xFF) << 8) | (patch & 0xFF))
30 CONNECTION_USBMUXD = 1 56
31}; 57#define DEVICE_CLASS_IPHONE 1
58#define DEVICE_CLASS_IPAD 2
59#define DEVICE_CLASS_IPOD 3
60#define DEVICE_CLASS_APPLETV 4
61#define DEVICE_CLASS_WATCH 5
62#define DEVICE_CLASS_UNKNOWN 255
32 63
33struct ssl_data_private { 64struct ssl_data_private {
65#if defined(HAVE_OPENSSL)
66 SSL *session;
67 SSL_CTX *ctx;
68#elif defined(HAVE_GNUTLS)
34 gnutls_certificate_credentials_t certificate; 69 gnutls_certificate_credentials_t certificate;
35 gnutls_session_t session; 70 gnutls_session_t session;
36 gnutls_x509_privkey_t root_privkey; 71 gnutls_x509_privkey_t root_privkey;
37 gnutls_x509_crt_t root_cert; 72 gnutls_x509_crt_t root_cert;
38 gnutls_x509_privkey_t host_privkey; 73 gnutls_x509_privkey_t host_privkey;
39 gnutls_x509_crt_t host_cert; 74 gnutls_x509_crt_t host_cert;
75#elif defined(HAVE_MBEDTLS)
76 mbedtls_ssl_context ctx;
77 mbedtls_ssl_config config;
78 mbedtls_entropy_context entropy;
79 mbedtls_ctr_drbg_context ctr_drbg;
80 mbedtls_x509_crt certificate;
81 mbedtls_pk_context root_privkey;
82#endif
40}; 83};
41typedef struct ssl_data_private *ssl_data_t; 84typedef struct ssl_data_private *ssl_data_t;
42 85
43struct idevice_connection_private { 86struct idevice_connection_private {
44 enum connection_type type; 87 idevice_t device;
88 enum idevice_connection_type type;
45 void *data; 89 void *data;
46 ssl_data_t ssl_data; 90 ssl_data_t ssl_data;
91 unsigned int ssl_recv_timeout;
92 idevice_error_t status;
47}; 93};
48 94
49struct idevice_private { 95struct idevice_private {
50 char *uuid; 96 char *udid;
51 enum connection_type conn_type; 97 uint32_t mux_id;
98 enum idevice_connection_type conn_type;
52 void *conn_data; 99 void *conn_data;
100 int version;
101 int device_class;
53}; 102};
54 103
55idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection);
56idevice_error_t idevice_connection_disable_ssl(idevice_connection_t connection);
57
58#endif 104#endif