Debian Codegraph @

src/idevice.h

raw
1 /*
2 * idevice.h
3 * Device discovery and communication interface -- header file.
4 *
5 * Copyright (c) 2008 Zach C. All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
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
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
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)
32 #include <gnutls/gnutls.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
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"
53 #include "libimobiledevice/libimobiledevice.h"
54
55 #define DEVICE_CLASS_IPHONE 1
56 #define DEVICE_CLASS_IPAD 2
57 #define DEVICE_CLASS_IPOD 3
58 #define DEVICE_CLASS_APPLETV 4
59 #define DEVICE_CLASS_WATCH 5
60 #define DEVICE_CLASS_UNKNOWN 255
61
62 struct ssl_data_private {
63 #if defined(HAVE_OPENSSL)
64 SSL *session;
65 SSL_CTX *ctx;
66 #elif defined(HAVE_GNUTLS)
67 gnutls_certificate_credentials_t certificate;
68 gnutls_session_t session;
69 gnutls_x509_privkey_t root_privkey;
70 gnutls_x509_crt_t root_cert;
71 gnutls_x509_privkey_t host_privkey;
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
81 };
82 typedef struct ssl_data_private *ssl_data_t;
83
84 struct idevice_connection_private {
85 idevice_t device;
86 enum idevice_connection_type type;
87 void *data;
88 ssl_data_t ssl_data;
89 unsigned int ssl_recv_timeout;
90 idevice_error_t status;
91 };
92
93 struct idevice_private {
94 char *udid;
95 uint32_t mux_id;
96 enum idevice_connection_type conn_type;
97 void *conn_data;
98 int version;
99 int device_class;
100 };
101
102 #endif