~ubuntu-branches/ubuntu/lucid/libimobiledevice/lucid

« back to all changes in this revision

Viewing changes to include/libimobiledevice/libimobiledevice.h

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-02-02 21:19:51 UTC
  • Revision ID: james.westby@ubuntu.com-20100202211951-qv87ejwmucigqezf
Tags: upstream-0.9.7
ImportĀ upstreamĀ versionĀ 0.9.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
27
extern "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
 
 
44
typedef int16_t idevice_error_t;
 
45
 
 
46
struct idevice_int;
 
47
typedef struct idevice_int *idevice_t;
 
48
 
 
49
struct idevice_connection_int;
 
50
typedef struct idevice_connection_int *idevice_connection_t;
 
51
 
 
52
/* generic */
 
53
void idevice_set_debug_level(int level);
 
54
 
 
55
/* discovery (events/asynchronous) */
 
56
// event type
 
57
enum idevice_event_type {
 
58
        IDEVICE_DEVICE_ADD = 1,
 
59
        IDEVICE_DEVICE_REMOVE
 
60
};
 
61
 
 
62
// event data structure
 
63
typedef 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
 
70
typedef void (*idevice_event_cb_t) (const idevice_event_t *event, void *user_data);
 
71
 
 
72
// functions
 
73
idevice_error_t idevice_event_subscribe(idevice_event_cb_t callback, void *user_data);
 
74
idevice_error_t idevice_event_unsubscribe();
 
75
 
 
76
/* discovery (synchronous) */
 
77
idevice_error_t idevice_get_device_list(char ***devices, int *count);
 
78
idevice_error_t idevice_device_list_free(char **devices);
 
79
 
 
80
/* device structure creation and destruction */
 
81
idevice_error_t idevice_new(idevice_t *device, const char *uuid);
 
82
idevice_error_t idevice_free(idevice_t device);
 
83
 
 
84
/* connection/disconnection */
 
85
idevice_error_t idevice_connect(idevice_t device, uint16_t port, idevice_connection_t *connection);
 
86
idevice_error_t idevice_disconnect(idevice_connection_t connection);
 
87
 
 
88
/* communication */
 
89
idevice_error_t idevice_connection_send(idevice_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes);
 
90
idevice_error_t idevice_connection_receive_timeout(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout);
 
91
idevice_error_t idevice_connection_receive(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes);
 
92
 
 
93
/* misc */
 
94
idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle);
 
95
idevice_error_t idevice_get_uuid(idevice_t device, char **uuid);
 
96
 
 
97
#ifdef __cplusplus
 
98
}
 
99
#endif
 
100
 
 
101
#endif
 
102