diff options
Diffstat (limited to 'src/reverse_proxy.c')
-rw-r--r-- | src/reverse_proxy.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/reverse_proxy.c b/src/reverse_proxy.c index 3ab1031..2fcfdd1 100644 --- a/src/reverse_proxy.c +++ b/src/reverse_proxy.c @@ -25,6 +25,9 @@ #endif #include <string.h> #include <stdlib.h> +#define _GNU_SOURCE 1 +#define __USE_GNU 1 +#include <stdio.h> #include <errno.h> #include <plist/plist.h> @@ -91,7 +94,7 @@ static void _reverse_proxy_log(reverse_proxy_client_t client, const char* format va_list args; va_start(args, format); char* buffer = NULL; - (void)vasprintf(&buffer, format, args); + if(vasprintf(&buffer, format, args)<0){} va_end(args); client->log_cb(client, buffer, client->log_cb_user_data); free(buffer); @@ -113,7 +116,7 @@ static void _reverse_proxy_status(reverse_proxy_client_t client, int status, con va_list args; va_start(args, format); char* buffer = NULL; - (void)vasprintf(&buffer, format, args); + if(vasprintf(&buffer, format, args)<0){} va_end(args); client->status_cb(client, status, buffer, client->status_cb_user_data); free(buffer); @@ -525,7 +528,7 @@ static void* _reverse_proxy_control_thread(void *cdata) return NULL; } -LIBIMOBILEDEVICE_API reverse_proxy_error_t reverse_proxy_client_start_proxy(reverse_proxy_client_t client, int control_protocol_version) +reverse_proxy_error_t reverse_proxy_client_start_proxy(reverse_proxy_client_t client, int control_protocol_version) { char buf[16] = {0, }; uint32_t bytes = 0; @@ -604,7 +607,7 @@ LIBIMOBILEDEVICE_API reverse_proxy_error_t reverse_proxy_client_start_proxy(reve return err; } -LIBIMOBILEDEVICE_API reverse_proxy_error_t reverse_proxy_client_create_with_service(idevice_t device, reverse_proxy_client_t* client, const char* label) +reverse_proxy_error_t reverse_proxy_client_create_with_service(idevice_t device, reverse_proxy_client_t* client, const char* label) { reverse_proxy_error_t err = REVERSE_PROXY_E_UNKNOWN_ERROR; service_client_factory_start_service(device, "com.apple.PurpleReverseProxy.Ctrl", (void**)client, label, SERVICE_CONSTRUCTOR(reverse_proxy_client_new), &err); @@ -617,7 +620,7 @@ LIBIMOBILEDEVICE_API reverse_proxy_error_t reverse_proxy_client_create_with_serv return REVERSE_PROXY_E_SUCCESS; } -LIBIMOBILEDEVICE_API reverse_proxy_error_t reverse_proxy_client_create_with_port(idevice_t device, reverse_proxy_client_t* client, uint16_t device_port) +reverse_proxy_error_t reverse_proxy_client_create_with_port(idevice_t device, reverse_proxy_client_t* client, uint16_t device_port) { reverse_proxy_client_t client_loc = NULL; reverse_proxy_error_t err; @@ -638,7 +641,7 @@ LIBIMOBILEDEVICE_API reverse_proxy_error_t reverse_proxy_client_create_with_port return REVERSE_PROXY_E_SUCCESS; } -LIBIMOBILEDEVICE_API reverse_proxy_error_t reverse_proxy_client_free(reverse_proxy_client_t client) +reverse_proxy_error_t reverse_proxy_client_free(reverse_proxy_client_t client) { if (!client) return REVERSE_PROXY_E_INVALID_ARG; @@ -657,14 +660,14 @@ LIBIMOBILEDEVICE_API reverse_proxy_error_t reverse_proxy_client_free(reverse_pro return err; } -LIBIMOBILEDEVICE_API reverse_proxy_client_type_t reverse_proxy_get_type(reverse_proxy_client_t client) +reverse_proxy_client_type_t reverse_proxy_get_type(reverse_proxy_client_t client) { if (!client) return 0; return client->type; } -LIBIMOBILEDEVICE_API void reverse_proxy_client_set_status_callback(reverse_proxy_client_t client, reverse_proxy_status_cb_t status_callback, void* user_data) +void reverse_proxy_client_set_status_callback(reverse_proxy_client_t client, reverse_proxy_status_cb_t status_callback, void* user_data) { if (!client) { return; @@ -673,7 +676,7 @@ LIBIMOBILEDEVICE_API void reverse_proxy_client_set_status_callback(reverse_proxy client->status_cb_user_data = user_data; } -LIBIMOBILEDEVICE_API void reverse_proxy_client_set_log_callback(reverse_proxy_client_t client, reverse_proxy_log_cb_t log_callback, void* user_data) +void reverse_proxy_client_set_log_callback(reverse_proxy_client_t client, reverse_proxy_log_cb_t log_callback, void* user_data) { if (!client) { return; @@ -682,7 +685,7 @@ LIBIMOBILEDEVICE_API void reverse_proxy_client_set_log_callback(reverse_proxy_cl client->log_cb_user_data = user_data; } -LIBIMOBILEDEVICE_API void reverse_proxy_client_set_data_callback(reverse_proxy_client_t client, reverse_proxy_data_cb_t data_callback, void* user_data) +void reverse_proxy_client_set_data_callback(reverse_proxy_client_t client, reverse_proxy_data_cb_t data_callback, void* user_data) { if (!client) { return; |