From e1b22c51edd2c3b416d111a63e1a84ab3ba7817e Mon Sep 17 00:00:00 2001 From: Jonathan Beck Date: Mon, 11 Aug 2008 22:32:01 +0200 Subject: first shot at setting up a library --- src/Makefile.am | 12 ++++++++++-- src/iphone.c | 4 ++-- src/iphone.h | 3 +-- src/lockdown.c | 2 +- src/lockdown.h | 5 ++++- 5 files changed, 18 insertions(+), 8 deletions(-) (limited to 'src') 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 +#include #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 #include +#include + + + 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); -- cgit v1.1-32-gdbae