diff options
Diffstat (limited to 'src/libusbmuxd.c')
-rw-r--r-- | src/libusbmuxd.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c index 95e322f..4c2e7d8 100644 --- a/src/libusbmuxd.c +++ b/src/libusbmuxd.c @@ -29,10 +29,12 @@ #include <stdio.h> #include <string.h> -#ifdef WIN32 +#ifdef LIBUSBMUXD_STATIC + #define USBMUXD_API +#elif defined(_WIN32) #define USBMUXD_API __declspec( dllexport ) #else - #ifdef HAVE_FVISIBILITY + #if __GNUC__ >= 4 #define USBMUXD_API __attribute__((visibility("default"))) #else #define USBMUXD_API @@ -1154,7 +1156,7 @@ static void init_listeners(void) mutex_init(&listener_mutex); } -USBMUXD_API int usbmuxd_events_subscribe(usbmuxd_subscription_context_t *context, usbmuxd_event_cb_t callback, void *user_data) +int usbmuxd_events_subscribe(usbmuxd_subscription_context_t *context, usbmuxd_event_cb_t callback, void *user_data) { if (!context || !callback) { return -EINVAL; @@ -1198,7 +1200,7 @@ USBMUXD_API int usbmuxd_events_subscribe(usbmuxd_subscription_context_t *context return 0; } -USBMUXD_API int usbmuxd_events_unsubscribe(usbmuxd_subscription_context_t context) +int usbmuxd_events_unsubscribe(usbmuxd_subscription_context_t context) { int ret = 0; int num = 0; @@ -1245,7 +1247,7 @@ USBMUXD_API int usbmuxd_events_unsubscribe(usbmuxd_subscription_context_t contex return ret; } -USBMUXD_API int usbmuxd_subscribe(usbmuxd_event_cb_t callback, void *user_data) +int usbmuxd_subscribe(usbmuxd_event_cb_t callback, void *user_data) { if (!callback) { return -EINVAL; @@ -1258,14 +1260,14 @@ USBMUXD_API int usbmuxd_subscribe(usbmuxd_event_cb_t callback, void *user_data) return usbmuxd_events_subscribe(&event_ctx, callback, user_data); } -USBMUXD_API int usbmuxd_unsubscribe(void) +int usbmuxd_unsubscribe(void) { int res = usbmuxd_events_unsubscribe(event_ctx); event_ctx = NULL; return res; } -USBMUXD_API int usbmuxd_get_device_list(usbmuxd_device_info_t **device_list) +int usbmuxd_get_device_list(usbmuxd_device_info_t **device_list) { int sfd; int tag; @@ -1406,7 +1408,7 @@ got_device_list: return dev_cnt; } -USBMUXD_API int usbmuxd_device_list_free(usbmuxd_device_info_t **device_list) +int usbmuxd_device_list_free(usbmuxd_device_info_t **device_list) { if (device_list) { free(*device_list); @@ -1414,7 +1416,7 @@ USBMUXD_API int usbmuxd_device_list_free(usbmuxd_device_info_t **device_list) return 0; } -USBMUXD_API int usbmuxd_get_device_by_udid(const char *udid, usbmuxd_device_info_t *device) +int usbmuxd_get_device_by_udid(const char *udid, usbmuxd_device_info_t *device) { usbmuxd_device_info_t *dev_list = NULL; usbmuxd_device_info_t *dev = NULL; @@ -1457,7 +1459,7 @@ USBMUXD_API int usbmuxd_get_device_by_udid(const char *udid, usbmuxd_device_info return result; } -USBMUXD_API int usbmuxd_get_device(const char *udid, usbmuxd_device_info_t *device, enum usbmux_lookup_options options) +int usbmuxd_get_device(const char *udid, usbmuxd_device_info_t *device, enum usbmux_lookup_options options) { usbmuxd_device_info_t *dev_list = NULL; usbmuxd_device_info_t *dev_network = NULL; @@ -1522,7 +1524,7 @@ USBMUXD_API int usbmuxd_get_device(const char *udid, usbmuxd_device_info_t *devi return result; } -USBMUXD_API int usbmuxd_connect(const uint32_t handle, const unsigned short port) +int usbmuxd_connect(const uint32_t handle, const unsigned short port) { int sfd; int tag; @@ -1574,12 +1576,12 @@ retry: return -result; } -USBMUXD_API int usbmuxd_disconnect(int sfd) +int usbmuxd_disconnect(int sfd) { return socket_close(sfd); } -USBMUXD_API int usbmuxd_send(int sfd, const char *data, uint32_t len, uint32_t *sent_bytes) +int usbmuxd_send(int sfd, const char *data, uint32_t len, uint32_t *sent_bytes) { int num_sent; @@ -1604,7 +1606,7 @@ USBMUXD_API int usbmuxd_send(int sfd, const char *data, uint32_t len, uint32_t * return 0; } -USBMUXD_API int usbmuxd_recv_timeout(int sfd, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout) +int usbmuxd_recv_timeout(int sfd, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout) { int num_recv = socket_receive_timeout(sfd, (void*)data, len, 0, timeout); if (num_recv < 0) { @@ -1617,12 +1619,12 @@ USBMUXD_API int usbmuxd_recv_timeout(int sfd, char *data, uint32_t len, uint32_t return 0; } -USBMUXD_API int usbmuxd_recv(int sfd, char *data, uint32_t len, uint32_t *recv_bytes) +int usbmuxd_recv(int sfd, char *data, uint32_t len, uint32_t *recv_bytes) { return usbmuxd_recv_timeout(sfd, data, len, recv_bytes, 5000); } -USBMUXD_API int usbmuxd_read_buid(char **buid) +int usbmuxd_read_buid(char **buid) { int sfd; int tag; @@ -1663,7 +1665,7 @@ USBMUXD_API int usbmuxd_read_buid(char **buid) return ret; } -USBMUXD_API int usbmuxd_read_pair_record(const char* record_id, char **record_data, uint32_t *record_size) +int usbmuxd_read_pair_record(const char* record_id, char **record_data, uint32_t *record_size) { int sfd; int tag; @@ -1710,7 +1712,7 @@ USBMUXD_API int usbmuxd_read_pair_record(const char* record_id, char **record_da return ret; } -USBMUXD_API int usbmuxd_save_pair_record_with_device_id(const char* record_id, uint32_t device_id, const char *record_data, uint32_t record_size) +int usbmuxd_save_pair_record_with_device_id(const char* record_id, uint32_t device_id, const char *record_data, uint32_t record_size) { int sfd; int tag; @@ -1748,12 +1750,12 @@ USBMUXD_API int usbmuxd_save_pair_record_with_device_id(const char* record_id, u return ret; } -USBMUXD_API int usbmuxd_save_pair_record(const char* record_id, const char *record_data, uint32_t record_size) +int usbmuxd_save_pair_record(const char* record_id, const char *record_data, uint32_t record_size) { return usbmuxd_save_pair_record_with_device_id(record_id, 0, record_data, record_size); } -USBMUXD_API int usbmuxd_delete_pair_record(const char* record_id) +int usbmuxd_delete_pair_record(const char* record_id) { int sfd; int tag; @@ -1789,14 +1791,14 @@ USBMUXD_API int usbmuxd_delete_pair_record(const char* record_id) return ret; } -USBMUXD_API void libusbmuxd_set_use_inotify(int set) +void libusbmuxd_set_use_inotify(int set) { #ifdef HAVE_INOTIFY use_inotify = set; #endif } -USBMUXD_API void libusbmuxd_set_debug_level(int level) +void libusbmuxd_set_debug_level(int level) { libusbmuxd_debug = level; socket_set_verbose(level); |