summaryrefslogtreecommitdiffstats
path: root/include/libiphone/libiphone.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libiphone/libiphone.h')
-rw-r--r--include/libiphone/libiphone.h102
1 files changed, 0 insertions, 102 deletions
diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h
deleted file mode 100644
index efe9a63..0000000
--- a/include/libiphone/libiphone.h
+++ /dev/null
@@ -1,102 +0,0 @@
1/**
2 * @file libiphone/libiphone.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 LIBIPHONE_H
24#define LIBIPHONE_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 IPHONE_E_SUCCESS 0
37#define IPHONE_E_INVALID_ARG -1
38#define IPHONE_E_UNKNOWN_ERROR -2
39#define IPHONE_E_NO_DEVICE -3
40#define IPHONE_E_NOT_ENOUGH_DATA -4
41#define IPHONE_E_BAD_HEADER -5
42#define IPHONE_E_SSL_ERROR -6
43
44typedef int16_t iphone_error_t;
45
46struct iphone_device_int;
47typedef struct iphone_device_int *iphone_device_t;
48
49struct iphone_connection_int;
50typedef struct iphone_connection_int *iphone_connection_t;
51
52/* generic */
53void iphone_set_debug_level(int level);
54
55/* discovery (events/asynchronous) */
56// event type
57enum iphone_event_type {
58 IPHONE_DEVICE_ADD = 1,
59 IPHONE_DEVICE_REMOVE
60};
61
62// event data structure
63typedef struct {
64 enum iphone_event_type event;
65 const char *uuid;
66 int conn_type;
67} iphone_event_t;
68
69// event callback function prototype
70typedef void (*iphone_event_cb_t) (const iphone_event_t *event, void *user_data);
71
72// functions
73iphone_error_t iphone_event_subscribe(iphone_event_cb_t callback, void *user_data);
74iphone_error_t iphone_event_unsubscribe();
75
76/* discovery (synchronous) */
77iphone_error_t iphone_get_device_list(char ***devices, int *count);
78iphone_error_t iphone_device_list_free(char **devices);
79
80/* device structure creation and destruction */
81iphone_error_t iphone_device_new(iphone_device_t *device, const char *uuid);
82iphone_error_t iphone_device_free(iphone_device_t device);
83
84/* connection/disconnection */
85iphone_error_t iphone_device_connect(iphone_device_t device, uint16_t port, iphone_connection_t *connection);
86iphone_error_t iphone_device_disconnect(iphone_connection_t connection);
87
88/* communication */
89iphone_error_t iphone_connection_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes);
90iphone_error_t iphone_connection_receive_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout);
91iphone_error_t iphone_connection_receive(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes);
92
93/* misc */
94iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle);
95iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid);
96
97#ifdef __cplusplus
98}
99#endif
100
101#endif
102