summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2008-08-11 22:32:01 +0200
committerGravatar Jonathan Beck2008-08-31 19:27:19 +0200
commite1b22c51edd2c3b416d111a63e1a84ab3ba7817e (patch)
tree5c22a2f6ab33927ab61b9e43c9382e0a2ffd8734 /src
parentde4b279089d40131346cbd28e4f27b6e9716fab9 (diff)
downloadlibimobiledevice-e1b22c51edd2c3b416d111a63e1a84ab3ba7817e.tar.gz
libimobiledevice-e1b22c51edd2c3b416d111a63e1a84ab3ba7817e.tar.bz2
first shot at setting up a library
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am12
-rw-r--r--src/iphone.c4
-rw-r--r--src/iphone.h3
-rw-r--r--src/lockdown.c2
-rw-r--r--src/lockdown.h5
5 files changed, 18 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index e225512..f26deb1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,11 +1,19 @@
+INCLUDES = -I$(top_srcdir)/include
+
AM_CFLAGS = $(libxml2_CFLAGS) $(libusb_CFLAGS) $(libglib2_CFLAGS) $(libfuse_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) -g
AM_LDFLAGS = $(libxml2_LIBS) $(libusb_LIBS) $(libglib2_LIBS) $(libfuse_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS)
bin_PROGRAMS = iphoneclient ifuse libiphone-initconf
-iphoneclient_SOURCES = usbmux.c main.c iphone.c plist.c lockdown.c AFC.c userpref.c
-ifuse_SOURCES = ifuse.c usbmux.c iphone.c plist.c lockdown.c AFC.c userpref.c
+iphoneclient_SOURCES = main.c
+iphoneclient_LDADD = libiphone.la
libiphone_initconf_SOURCES = initconf.c userpref.c lockdown.c plist.c usbmux.c iphone.c
libiphone_initconf_CFLAGS = $(libgthread2_CFLAGS) $(AM_CFLAGS)
libiphone_initconf_LDFLAGS = $(libgthread2_LIBS) $(AM_LDFLAGS)
+ifuse_SOURCES = ifuse.c
+ifuse_LDADD = libiphone.la
+
+lib_LTLIBRARIES = libiphone.la
+libiphone_la_SOURCES = usbmux.c iphone.c plist.c lockdown.c AFC.c userpref.c
+
diff --git a/src/iphone.c b/src/iphone.c
index d8bb9ae..e0e150f 100644
--- a/src/iphone.c
+++ b/src/iphone.c
@@ -34,7 +34,7 @@ extern int debug;
* @return A structure with data on the first iPhone it finds. (Or NULL, on
* error)
*/
-iPhone *get_iPhone() {
+iPhone_t get_iPhone() {
iPhone *phone = (iPhone*)malloc(sizeof(iPhone));
struct usb_bus *bus, *busses;
struct usb_device *dev;
@@ -129,7 +129,7 @@ iPhone *get_iPhone() {
*
* @param phone A pointer to an iPhone structure.
*/
-void free_iPhone(iPhone *phone) {
+void free_iPhone(iPhone_t phone) {
if (phone->buffer) free(phone->buffer);
if (phone->device) {
usb_release_interface(phone->device, 1);
diff --git a/src/iphone.h b/src/iphone.h
index ec5e70d..746941f 100644
--- a/src/iphone.h
+++ b/src/iphone.h
@@ -28,6 +28,7 @@
#endif
#include <usb.h>
+#include <libiphone/libiphone.h>
#define BULKIN 0x85
#define BULKOUT 0x04
@@ -39,8 +40,6 @@ typedef struct {
} iPhone;
// Function definitions
-void free_iPhone(iPhone *victim);
-iPhone *get_iPhone();
int send_to_phone(iPhone *phone, char *data, int datalen);
int recv_from_phone(iPhone *phone, char *data, int datalen);
#endif
diff --git a/src/lockdown.c b/src/lockdown.c
index c8275eb..452ee0e 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -307,7 +307,7 @@ int lockdownd_get_device_public_key(lockdownd_client *control, char **public_key
*
* @return 1 on success and 0 on failure
*/
-int lockdownd_init(iPhone *phone, lockdownd_client **control)
+int lockdownd_init(iPhone_t phone, lockdownd_client_t *control)
{
int ret = 0;
char *host_id = NULL;
diff --git a/src/lockdown.h b/src/lockdown.h
index c542d65..a16e148 100644
--- a/src/lockdown.h
+++ b/src/lockdown.h
@@ -27,6 +27,10 @@
#include <gnutls/gnutls.h>
#include <string.h>
+#include <libiphone/libiphone.h>
+
+
+
typedef struct {
usbmux_connection *connection;
@@ -36,7 +40,6 @@ typedef struct {
int gtls_buffer_hack_len;
} lockdownd_client;
-int lockdownd_init(iPhone *phone, lockdownd_client **control);
char *lockdownd_generate_hostid();
lockdownd_client *new_lockdownd_client(iPhone *phone);