summaryrefslogtreecommitdiffstats
path: root/include/libimobiledevice/libimobiledevice.h
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2010-01-28 22:18:41 +0100
committerGravatar Martin Szulecki2010-01-29 02:16:00 +0100
commit96101a1231a4ddfeb40fd738a24e108a3a904048 (patch)
tree65a8f54354d9acbbba93dac2c8602d07e469482c /include/libimobiledevice/libimobiledevice.h
parent45b88ae3956de089fdc35605910f1359a1d3961c (diff)
downloadlibimobiledevice-96101a1231a4ddfeb40fd738a24e108a3a904048.tar.gz
libimobiledevice-96101a1231a4ddfeb40fd738a24e108a3a904048.tar.bz2
Global renames due to project rename to libimobiledevice
Diffstat (limited to 'include/libimobiledevice/libimobiledevice.h')
-rw-r--r--include/libimobiledevice/libimobiledevice.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h
new file mode 100644
index 0000000..87b078a
--- /dev/null
+++ b/include/libimobiledevice/libimobiledevice.h
@@ -0,0 +1,102 @@
1/**
2 * @file libimobiledevice/libimobiledevice.h
3 * @brief Common code and device handling
4 * \internal
5 *
6 * Copyright (c) 2008 Jonathan Beck All Rights Reserved.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef LIBIMOBILEDEVICE_H
24#define LIBIMOBILEDEVICE_H
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#include <stdint.h>
31#include <sys/types.h>
32#include <sys/stat.h>
33#include <plist/plist.h>
34
35/* Error Codes */
36#define IDEVICE_E_SUCCESS 0
37#define IDEVICE_E_INVALID_ARG -1
38#define IDEVICE_E_UNKNOWN_ERROR -2
39#define IDEVICE_E_NO_DEVICE -3
40#define IDEVICE_E_NOT_ENOUGH_DATA -4
41#define IDEVICE_E_BAD_HEADER -5
42#define IDEVICE_E_SSL_ERROR -6
43
44typedef int16_t idevice_error_t;
45
46struct idevice_int;
47typedef struct idevice_int *idevice_t;
48
49struct idevice_connection_int;
50typedef struct idevice_connection_int *idevice_connection_t;
51
52/* generic */
53void idevice_set_debug_level(int level);
54
55/* discovery (events/asynchronous) */
56// event type
57enum idevice_event_type {
58 IDEVICE_DEVICE_ADD = 1,
59 IDEVICE_DEVICE_REMOVE
60};
61
62// event data structure
63typedef struct {
64 enum idevice_event_type event;
65 const char *uuid;
66 int conn_type;
67} idevice_event_t;
68
69// event callback function prototype
70typedef void (*idevice_event_cb_t) (const idevice_event_t *event, void *user_data);
71
72// functions
73idevice_error_t idevice_event_subscribe(idevice_event_cb_t callback, void *user_data);
74idevice_error_t idevice_event_unsubscribe();
75
76/* discovery (synchronous) */
77idevice_error_t idevice_get_device_list(char ***devices, int *count);
78idevice_error_t idevice_device_list_free(char **devices);
79
80/* device structure creation and destruction */
81idevice_error_t idevice_new(idevice_t *device, const char *uuid);
82idevice_error_t idevice_free(idevice_t device);
83
84/* connection/disconnection */
85idevice_error_t idevice_connect(idevice_t device, uint16_t port, idevice_connection_t *connection);
86idevice_error_t idevice_disconnect(idevice_connection_t connection);
87
88/* communication */
89idevice_error_t idevice_connection_send(idevice_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes);
90idevice_error_t idevice_connection_receive_timeout(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout);
91idevice_error_t idevice_connection_receive(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes);
92
93/* misc */
94idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle);
95idevice_error_t idevice_get_uuid(idevice_t device, char **uuid);
96
97#ifdef __cplusplus
98}
99#endif
100
101#endif
102