From bf3dc421b2b5ccfe2fcd3cd4ec1ef90f39599600 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 12 Jan 2010 17:53:55 +0100 Subject: Remove support for debug masks due to inconsistent use --- dev/afccheck.c | 2 -- dev/iphoneclient.c | 2 -- dev/iphoneenterrecovery.c | 1 - dev/msyncclient.c | 2 +- include/libiphone/libiphone.h | 8 ----- src/InstallationProxy.c | 36 +++++++++---------- src/MobileSync.c | 6 ++-- src/debug.c | 27 -------------- src/debug.h | 2 -- src/lockdown.c | 82 +++++++++++++++++++++---------------------- swig/iphone.i | 9 ----- tools/iphone_id.c | 1 - tools/iphoneinfo.c | 1 - tools/iphonesyslog.c | 1 - 14 files changed, 63 insertions(+), 117 deletions(-) diff --git a/dev/afccheck.c b/dev/afccheck.c index 7a17a31..8e11b8a 100644 --- a/dev/afccheck.c +++ b/dev/afccheck.c @@ -98,10 +98,8 @@ int main(int argc, char *argv[]) if (argc > 1 && !strcasecmp(argv[1], "--debug")) { iphone_set_debug_level(1); - iphone_set_debug_mask(DBGMASK_ALL); } else { iphone_set_debug_level(0); - iphone_set_debug_mask(DBGMASK_NONE); } if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) { diff --git a/dev/iphoneclient.c b/dev/iphoneclient.c index dbdf0f1..eaced60 100644 --- a/dev/iphoneclient.c +++ b/dev/iphoneclient.c @@ -68,10 +68,8 @@ int main(int argc, char *argv[]) if (argc > 1 && !strcasecmp(argv[1], "--debug")) { iphone_set_debug_level(1); - iphone_set_debug_mask(DBGMASK_ALL); } else { iphone_set_debug_level(0); - iphone_set_debug_mask(DBGMASK_NONE); } if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) { diff --git a/dev/iphoneenterrecovery.c b/dev/iphoneenterrecovery.c index cab41f8..153df15 100644 --- a/dev/iphoneenterrecovery.c +++ b/dev/iphoneenterrecovery.c @@ -51,7 +51,6 @@ int main(int argc, char *argv[]) /* parse cmdline args */ for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { - iphone_set_debug_mask(DBGMASK_ALL); iphone_set_debug_level(1); continue; } diff --git a/dev/msyncclient.c b/dev/msyncclient.c index 6e40390..6134649 100644 --- a/dev/msyncclient.c +++ b/dev/msyncclient.c @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) iphone_device_t phone = NULL; if (argc > 1 && !strcasecmp(argv[1], "--debug")) - iphone_set_debug_mask(DBGMASK_MOBILESYNC); + iphone_set_debug_level(1); if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) { printf("No iPhone found, is it plugged in?\n"); diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index eb58d5c..70e0068 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -49,15 +49,7 @@ typedef struct iphone_device_int *iphone_device_t; struct iphone_connection_int; typedef struct iphone_connection_int *iphone_connection_t; -/* Debugging */ -#define DBGMASK_ALL 0xFFFF -#define DBGMASK_NONE 0x0000 -#define DBGMASK_LOCKDOWND (1 << 1) -#define DBGMASK_MOBILESYNC (1 << 2) -#define DBGMASK_INSTPROXY (1 << 3) - /* generic */ -void iphone_set_debug_mask(uint16_t mask); void iphone_set_debug_level(int level); /* discovery (events/asynchronous) */ diff --git a/src/InstallationProxy.c b/src/InstallationProxy.c index 8d994c6..6b267c4 100644 --- a/src/InstallationProxy.c +++ b/src/InstallationProxy.c @@ -131,7 +131,7 @@ instproxy_error_t instproxy_client_free(instproxy_client_t client) property_list_service_client_free(client->parent); client->parent = NULL; if (client->status_updater) { - log_dbg_msg(DBGMASK_INSTPROXY, "joining status_updater"); + log_debug_msg("joining status_updater"); g_thread_join(client->status_updater); } if (client->mutex) { @@ -174,7 +174,7 @@ instproxy_error_t instproxy_browse(instproxy_client_t client, instproxy_apptype_ p_apptype = plist_new_string("User"); break; default: - log_dbg_msg(DBGMASK_INSTPROXY, "%s: unknown apptype %d given, using INSTPROXY_APPTYPE_USER instead\n", __func__, apptype); + log_debug_msg("%s: unknown apptype %d given, using INSTPROXY_APPTYPE_USER instead\n", __func__, apptype); p_apptype = plist_new_string("User"); break; } @@ -187,7 +187,7 @@ instproxy_error_t instproxy_browse(instproxy_client_t client, instproxy_apptype_ res = instproxy_error(property_list_service_send_xml_plist(client->parent, dict)); plist_free(dict); if (res != INSTPROXY_E_SUCCESS) { - log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist\n", __func__); + log_debug_msg("%s: could not send plist\n", __func__); goto leave_unlock; } @@ -223,7 +223,7 @@ instproxy_error_t instproxy_browse(instproxy_client_t client, instproxy_apptype_ if (!strcmp(status, "BrowsingApplications")) { browsing = 1; } else if (!strcmp(status, "Complete")) { - log_dbg_msg(DBGMASK_INSTPROXY, "%s: Browsing applications completed\n"); + log_debug_msg("%s: Browsing applications completed\n"); res = INSTPROXY_E_SUCCESS; } free(status); @@ -264,7 +264,7 @@ static instproxy_error_t instproxy_perform_operation(instproxy_client_t client, res = instproxy_error(property_list_service_receive_plist_with_timeout(client->parent, &dict, 30000)); instproxy_unlock(client); if (res != INSTPROXY_E_SUCCESS) { - log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not receive plist, error %d\n", __func__, res); + log_debug_msg("%s: could not receive plist, error %d\n", __func__, res); break; } if (dict) { @@ -279,7 +279,7 @@ static instproxy_error_t instproxy_perform_operation(instproxy_client_t client, char *err_msg = NULL; plist_get_string_val(err, &err_msg); if (err_msg) { - log_dbg_msg(DBGMASK_INSTPROXY, "%s(%s): ERROR: %s\n", __func__, operation, err_msg); + log_debug_msg("%s(%s): ERROR: %s\n", __func__, operation, err_msg); free(err_msg); } #endif @@ -303,9 +303,9 @@ static instproxy_error_t instproxy_perform_operation(instproxy_client_t client, int percent; plist_get_uint_val(npercent, &val); percent = val; - log_dbg_msg(DBGMASK_INSTPROXY, "%s(%s): %s (%d%%)\n", __func__, operation, status_msg, percent); + log_debug_msg("%s(%s): %s (%d%%)\n", __func__, operation, status_msg, percent); } else { - log_dbg_msg(DBGMASK_INSTPROXY, "%s(%s): %s\n", __func__, operation, status_msg); + log_debug_msg("%s(%s): %s\n", __func__, operation, status_msg); } #endif free(status_msg); @@ -338,7 +338,7 @@ static gpointer instproxy_status_updater(gpointer arg) /* cleanup */ instproxy_lock(data->client); - log_dbg_msg(DBGMASK_INSTPROXY, "%s: done, cleaning up.\n", __func__); + log_debug_msg("%s: done, cleaning up.\n", __func__); if (data->operation) { free(data->operation); } @@ -408,11 +408,11 @@ static instproxy_error_t instproxy_install_or_upgrade(instproxy_client_t client, return INSTPROXY_E_INVALID_ARG; } if (sinf && (plist_get_node_type(sinf) != PLIST_DATA)) { - log_dbg_msg(DBGMASK_INSTPROXY, "%s(%s): ERROR: sinf data is not a PLIST_DATA node!\n", __func__, command); + log_debug_msg("%s(%s): ERROR: sinf data is not a PLIST_DATA node!\n", __func__, command); return INSTPROXY_E_INVALID_ARG; } if (metadata && (plist_get_node_type(metadata) != PLIST_DATA)) { - log_dbg_msg(DBGMASK_INSTPROXY, "%s(%s): ERROR: metadata is not a PLIST_DATA node!\n", __func__, command); + log_debug_msg("%s(%s): ERROR: metadata is not a PLIST_DATA node!\n", __func__, command); return INSTPROXY_E_INVALID_ARG; } @@ -439,7 +439,7 @@ static instproxy_error_t instproxy_install_or_upgrade(instproxy_client_t client, plist_free(dict); if (res != INSTPROXY_E_SUCCESS) { - log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist, error %d\n", __func__, res); + log_debug_msg("%s: could not send plist, error %d\n", __func__, res); return res; } @@ -532,7 +532,7 @@ instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *app plist_free(dict); if (res != INSTPROXY_E_SUCCESS) { - log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist, error %d\n", __func__, res); + log_debug_msg("%s: could not send plist, error %d\n", __func__, res); return res; } @@ -567,13 +567,13 @@ instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t * plist_free(dict); if (res != INSTPROXY_E_SUCCESS) { - log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist, error %d\n", __func__, res); + log_debug_msg("%s: could not send plist, error %d\n", __func__, res); goto leave_unlock; } res = instproxy_error(property_list_service_receive_plist(client->parent, result)); if (res != INSTPROXY_E_SUCCESS) { - log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not receive plist, error %d\n", __func__, res); + log_debug_msg("%s: could not receive plist, error %d\n", __func__, res); goto leave_unlock; } @@ -640,7 +640,7 @@ instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid plist_free(dict); if (res != INSTPROXY_E_SUCCESS) { - log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist, error %d\n", __func__, res); + log_debug_msg("%s: could not send plist, error %d\n", __func__, res); return res; } return instproxy_create_status_updater(client, status_cb, "Archive"); @@ -686,7 +686,7 @@ instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid plist_free(dict); if (res != INSTPROXY_E_SUCCESS) { - log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist, error %d\n", __func__, res); + log_debug_msg("%s: could not send plist, error %d\n", __func__, res); return res; } return instproxy_create_status_updater(client, status_cb, "Restore"); @@ -732,7 +732,7 @@ instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char plist_free(dict); if (res != INSTPROXY_E_SUCCESS) { - log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist, error %d\n", __func__, res); + log_debug_msg("%s: could not send plist, error %d\n", __func__, res); return res; } return instproxy_create_status_updater(client, status_cb, "RemoveArchive"); diff --git a/src/MobileSync.c b/src/MobileSync.c index e904fcc..ef3571a 100644 --- a/src/MobileSync.c +++ b/src/MobileSync.c @@ -77,7 +77,7 @@ mobilesync_error_t mobilesync_client_new(iphone_device_t device, int dst_port, /* perform handshake */ ret = mobilesync_error(device_link_service_version_exchange(dlclient, MSYNC_VERSION_INT1, MSYNC_VERSION_INT2)); if (ret != MOBILESYNC_E_SUCCESS) { - log_dbg_msg(DBGMASK_MOBILESYNC, "%s: version exchange failed, error %d\n", __func__, ret); + log_debug_msg("%s: version exchange failed, error %d\n", __func__, ret); mobilesync_client_free(client_loc); return ret; } @@ -116,7 +116,7 @@ mobilesync_error_t mobilesync_recv(mobilesync_client_t client, plist_t * plist) char *XMLContent = NULL; uint32_t length = 0; plist_to_xml(*plist, &XMLContent, &length); - log_dbg_msg(DBGMASK_MOBILESYNC, "%s: plist size: %i\nbuffer :\n%s\n", __func__, length, XMLContent); + log_debug_msg("%s: plist size: %i\nbuffer :\n%s\n", __func__, length, XMLContent); free(XMLContent); #endif return ret; @@ -141,7 +141,7 @@ mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist) char *XMLContent = NULL; uint32_t length = 0; plist_to_xml(plist, &XMLContent, &length); - log_dbg_msg(DBGMASK_MOBILESYNC, "%s: plist size: %i\nbuffer :\n%s\n", __func__, length, XMLContent); + log_debug_msg("%s: plist size: %i\nbuffer :\n%s\n", __func__, length, XMLContent); free(XMLContent); #endif return mobilesync_error(device_link_service_send(client->parent, plist)); diff --git a/src/debug.c b/src/debug.c index b5f74ad..78f3a17 100644 --- a/src/debug.c +++ b/src/debug.c @@ -26,7 +26,6 @@ #include "libiphone/libiphone.h" int toto_debug = 0; -uint16_t dbg_mask = 0; /** * Sets the level of debugging. Currently the only acceptable values are 0 and @@ -39,17 +38,6 @@ void iphone_set_debug_level(int level) toto_debug = level; } - -/** - * Set debug ids to display. Values can be OR-ed - * - * @param level Set to 0 for no debugging or 1 for debugging. - */ -void iphone_set_debug_mask(uint16_t mask) -{ - dbg_mask = mask; -} - void log_debug_msg(const char *format, ...) { #ifndef STRIP_DEBUG_CODE @@ -66,21 +54,6 @@ void log_debug_msg(const char *format, ...) #endif } -void log_dbg_msg(uint16_t id, const char *format, ...) -{ -#ifndef STRIP_DEBUG_CODE - if (id & dbg_mask) { - va_list args; - /* run the real fprintf */ - va_start(args, format); - - vfprintf(stderr, format, args); - - va_end(args); - } -#endif -} - inline void log_debug_buffer(const char *data, const int length) { #ifndef STRIP_DEBUG_CODE diff --git a/src/debug.h b/src/debug.h index 96844dd..398508e 100644 --- a/src/debug.h +++ b/src/debug.h @@ -25,8 +25,6 @@ #include G_GNUC_INTERNAL inline void log_debug_msg(const char *format, ...); -G_GNUC_INTERNAL inline void log_dbg_msg(uint16_t id, const char *format, ...); - G_GNUC_INTERNAL inline void log_debug_buffer(const char *data, const int length); G_GNUC_INTERNAL inline void dump_debug_buffer(const char *file, const char *data, const int length); diff --git a/src/lockdown.c b/src/lockdown.c index 5927192..5e0f579 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -99,7 +99,7 @@ static int lockdown_check_result(plist_t dict, const char *query_match) } else if (!strcmp(result_value, "Failure")) { ret = RESULT_FAILURE; } else { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: ERROR: unknown result value '%s'\n", __func__, result_value); + log_debug_msg("%s: ERROR: unknown result value '%s'\n", __func__, result_value); } } if (result_value) @@ -136,9 +136,9 @@ static ssize_t lockdownd_ssl_write(gnutls_transport_ptr_t transport, char *buffe uint32_t bytes = 0; lockdownd_client_t client; client = (lockdownd_client_t) transport; - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: pre-send length = %zi\n", __func__, length); + log_debug_msg("%s: pre-send length = %zi\n", __func__, length); iphone_device_send(property_list_service_get_connection(client->parent), buffer, length, &bytes); - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: post-send sent %i bytes\n", __func__, bytes); + log_debug_msg("%s: post-send sent %i bytes\n", __func__, bytes); return bytes; } @@ -207,7 +207,7 @@ static lockdownd_error_t lockdownd_ssl_start_session(lockdownd_client_t client) uint32_t return_me = 0; // Set up GnuTLS... - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: enabling SSL mode\n", __func__); + log_debug_msg("%s: enabling SSL mode\n", __func__); errno = 0; gnutls_global_init(); gnutls_certificate_allocate_credentials(&client->ssl_certificate); @@ -228,26 +228,26 @@ static lockdownd_error_t lockdownd_ssl_start_session(lockdownd_client_t client) } gnutls_credentials_set(client->ssl_session, GNUTLS_CRD_CERTIFICATE, client->ssl_certificate); // this part is killing me. - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS step 1...\n", __func__); + log_debug_msg("%s: GnuTLS step 1...\n", __func__); gnutls_transport_set_ptr(client->ssl_session, (gnutls_transport_ptr_t) client); - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS step 2...\n", __func__); + log_debug_msg("%s: GnuTLS step 2...\n", __func__); gnutls_transport_set_push_function(client->ssl_session, (gnutls_push_func) & lockdownd_ssl_write); - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS step 3...\n", __func__); + log_debug_msg("%s: GnuTLS step 3...\n", __func__); gnutls_transport_set_pull_function(client->ssl_session, (gnutls_pull_func) & lockdownd_ssl_read); - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS step 4 -- now handshaking...\n", __func__); + log_debug_msg("%s: GnuTLS step 4 -- now handshaking...\n", __func__); if (errno) - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: WARN: errno says %s before handshake!\n", __func__, strerror(errno)); + log_debug_msg("%s: WARN: errno says %s before handshake!\n", __func__, strerror(errno)); return_me = gnutls_handshake(client->ssl_session); - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS handshake done...\n", __func__); + log_debug_msg("%s: GnuTLS handshake done...\n", __func__); if (return_me != GNUTLS_E_SUCCESS) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS reported something wrong.\n", __func__); + log_debug_msg("%s: GnuTLS reported something wrong.\n", __func__); gnutls_perror(return_me); - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: oh.. errno says %s\n", __func__, strerror(errno)); + log_debug_msg("%s: oh.. errno says %s\n", __func__, strerror(errno)); } else { client->ssl_enabled = 1; ret = LOCKDOWN_E_SUCCESS; - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: SSL mode enabled\n", __func__); + log_debug_msg("%s: SSL mode enabled\n", __func__); } return ret; @@ -264,13 +264,13 @@ static lockdownd_error_t lockdownd_ssl_start_session(lockdownd_client_t client) static lockdownd_error_t lockdownd_ssl_stop_session(lockdownd_client_t client) { if (!client) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: invalid argument!\n", __func__); + log_debug_msg("%s: invalid argument!\n", __func__); return LOCKDOWN_E_INVALID_ARG; } lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; if (client->ssl_enabled) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: sending SSL close notify\n", __func__); + log_debug_msg("%s: sending SSL close notify\n", __func__); gnutls_bye(client->ssl_session, GNUTLS_SHUT_RDWR); } if (client->ssl_session) { @@ -285,7 +285,7 @@ static lockdownd_error_t lockdownd_ssl_stop_session(lockdownd_client_t client) free(client->session_id); client->session_id = NULL; - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: SSL mode disabled\n", __func__); + log_debug_msg("%s: SSL mode disabled\n", __func__); return ret; } @@ -307,7 +307,7 @@ lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, const char * return LOCKDOWN_E_INVALID_ARG; if (!session_id) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: no session_id given, cannot stop session\n", __func__); + log_debug_msg("%s: no session_id given, cannot stop session\n", __func__); return LOCKDOWN_E_INVALID_ARG; } @@ -318,7 +318,7 @@ lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, const char * plist_dict_insert_item(dict,"Request", plist_new_string("StopSession")); plist_dict_insert_item(dict,"SessionID", plist_new_string(session_id)); - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: stopping session %s\n", __func__, session_id); + log_debug_msg("%s: stopping session %s\n", __func__, session_id); ret = lockdownd_send(client, dict); @@ -328,13 +328,13 @@ lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, const char * ret = lockdownd_recv(client, &dict); if (!dict) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); + log_debug_msg("%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); return LOCKDOWN_E_PLIST_ERROR; } ret = LOCKDOWN_E_UNKNOWN_ERROR; if (lockdown_check_result(dict, "StopSession") == RESULT_SUCCESS) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); + log_debug_msg("%s: success\n", __func__); ret = LOCKDOWN_E_SUCCESS; } plist_free(dict); @@ -480,7 +480,7 @@ lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type) plist_dict_add_label(dict, client->label); plist_dict_insert_item(dict,"Request", plist_new_string("QueryType")); - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: called\n", __func__); + log_debug_msg("%s: called\n", __func__); ret = lockdownd_send(client, dict); plist_free(dict); @@ -498,7 +498,7 @@ lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type) plist_t type_node = plist_dict_get_item(dict, "Type"); plist_get_string_val(type_node, type); } - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success with type %s\n", __func__, *type); + log_debug_msg("%s: success with type %s\n", __func__, *type); ret = LOCKDOWN_E_SUCCESS; } plist_free(dict); @@ -550,7 +550,7 @@ lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, const char *dom return ret; if (lockdown_check_result(dict, "GetValue") == RESULT_SUCCESS) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); + log_debug_msg("%s: success\n", __func__); ret = LOCKDOWN_E_SUCCESS; } if (ret != LOCKDOWN_E_SUCCESS) { @@ -561,7 +561,7 @@ lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, const char *dom plist_t value_node = plist_dict_get_item(dict, "Value"); if (value_node) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: has a value\n", __func__); + log_debug_msg("%s: has a value\n", __func__); *value = plist_copy(value_node); } @@ -613,7 +613,7 @@ lockdownd_error_t lockdownd_set_value(lockdownd_client_t client, const char *dom return ret; if (lockdown_check_result(dict, "SetValue") == RESULT_SUCCESS) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); + log_debug_msg("%s: success\n", __func__); ret = LOCKDOWN_E_SUCCESS; } @@ -670,7 +670,7 @@ lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, const char * return ret; if (lockdown_check_result(dict, "RemoveValue") == RESULT_SUCCESS) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); + log_debug_msg("%s: success\n", __func__); ret = LOCKDOWN_E_SUCCESS; } @@ -944,7 +944,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, char *host /* if pairing succeeded */ if (ret == LOCKDOWN_E_SUCCESS) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: %s success\n", __func__, verb); + log_debug_msg("%s: %s success\n", __func__, verb); if (!strcmp("Unpair", verb)) { /* remove public key from config */ userpref_remove_device_public_key(client->uuid); @@ -953,7 +953,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, char *host userpref_set_device_public_key(client->uuid, public_key); } } else { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: %s failure\n", __func__, verb); + log_debug_msg("%s: %s failure\n", __func__, verb); plist_t error_node = NULL; /* verify error condition */ error_node = plist_dict_get_item(dict, "Error"); @@ -1041,7 +1041,7 @@ lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client) plist_dict_add_label(dict, client->label); plist_dict_insert_item(dict,"Request", plist_new_string("EnterRecovery")); - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: telling device to enter recovery mode\n", __func__); + log_debug_msg("%s: telling device to enter recovery mode\n", __func__); ret = lockdownd_send(client, dict); plist_free(dict); @@ -1050,7 +1050,7 @@ lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client) ret = lockdownd_recv(client, &dict); if (lockdown_check_result(dict, "EnterRecovery") == RESULT_SUCCESS) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); + log_debug_msg("%s: success\n", __func__); ret = LOCKDOWN_E_SUCCESS; } plist_free(dict); @@ -1077,7 +1077,7 @@ lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client) plist_dict_add_label(dict, client->label); plist_dict_insert_item(dict,"Request", plist_new_string("Goodbye")); - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: called\n", __func__); + log_debug_msg("%s: called\n", __func__); ret = lockdownd_send(client, dict); plist_free(dict); @@ -1085,12 +1085,12 @@ lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client) ret = lockdownd_recv(client, &dict); if (!dict) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: did not get goodbye response back\n", __func__); + log_debug_msg("%s: did not get goodbye response back\n", __func__); return LOCKDOWN_E_PLIST_ERROR; } if (lockdown_check_result(dict, "Goodbye") == RESULT_SUCCESS) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); + log_debug_msg("%s: success\n", __func__); ret = LOCKDOWN_E_SUCCESS; } plist_free(dict); @@ -1294,7 +1294,7 @@ lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, const char if (enable_ssl && (plist_get_node_type(enable_ssl) == PLIST_BOOLEAN)) { plist_get_bool_val(enable_ssl, &use_ssl); } - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: Session startup OK\n", __func__); + log_debug_msg("%s: Session startup OK\n", __func__); if (ssl_enabled != NULL) *ssl_enabled = use_ssl; @@ -1305,13 +1305,13 @@ lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, const char plist_get_string_val(session_node, &client->session_id); } if (client->session_id) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: SessionID: %s\n", __func__, client->session_id); + log_debug_msg("%s: SessionID: %s\n", __func__, client->session_id); if (session_id != NULL) *session_id = strdup(client->session_id); } else { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: Failed to get SessionID!\n", __func__); + log_debug_msg("%s: Failed to get SessionID!\n", __func__); } - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: Enable SSL Session: %s\n", __func__, (use_ssl?"true":"false")); + log_debug_msg("%s: Enable SSL Session: %s\n", __func__, (use_ssl?"true":"false")); if (use_ssl) { ret = lockdownd_ssl_start_session(client); } else { @@ -1434,13 +1434,13 @@ lockdownd_error_t lockdownd_activate(lockdownd_client_t client, plist_t activati ret = lockdownd_recv(client, &dict); if (!dict) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); + log_debug_msg("%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); return LOCKDOWN_E_PLIST_ERROR; } ret = LOCKDOWN_E_ACTIVATION_FAILED; if (lockdown_check_result(dict, "Activate") == RESULT_SUCCESS) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); + log_debug_msg("%s: success\n", __func__); ret = LOCKDOWN_E_SUCCESS; } plist_free(dict); @@ -1477,13 +1477,13 @@ lockdownd_error_t lockdownd_deactivate(lockdownd_client_t client) ret = lockdownd_recv(client, &dict); if (!dict) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); + log_debug_msg("%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); return LOCKDOWN_E_PLIST_ERROR; } ret = LOCKDOWN_E_UNKNOWN_ERROR; if (lockdown_check_result(dict, "Deactivate") == RESULT_SUCCESS) { - log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); + log_debug_msg("%s: success\n", __func__); ret = LOCKDOWN_E_SUCCESS; } plist_free(dict); diff --git a/swig/iphone.i b/swig/iphone.i index 184f7f9..de6b80f 100644 --- a/swig/iphone.i +++ b/swig/iphone.i @@ -36,11 +36,6 @@ PList::Node* new_node_from_plist(plist_t node); %include "cstring.i" %include "plist/swig/plist.i" -#define DBGMASK_ALL 0xFFFF -#define DBGMASK_NONE 0x0000 -#define DBGMASK_LOCKDOWND (1 << 1) -#define DBGMASK_MOBILESYNC (1 << 2) - typedef struct { iphone_device_t dev; } iPhone; @@ -149,10 +144,6 @@ PList::Node* new_node_from_plist(plist_t node) my_delete_iPhone($self); } - void set_debug_mask(uint16_t mask) { - iphone_set_debug_mask(mask); - } - void set_debug_level(int level) { iphone_set_debug_level(level); } diff --git a/tools/iphone_id.c b/tools/iphone_id.c index a293469..4a2c3af 100644 --- a/tools/iphone_id.c +++ b/tools/iphone_id.c @@ -38,7 +38,6 @@ int main(int argc, char **argv) /* parse cmdline args */ for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { - iphone_set_debug_mask(DBGMASK_ALL); iphone_set_debug_level(1); continue; } diff --git a/tools/iphoneinfo.c b/tools/iphoneinfo.c index a8fba5f..7c41033 100644 --- a/tools/iphoneinfo.c +++ b/tools/iphoneinfo.c @@ -78,7 +78,6 @@ int main(int argc, char *argv[]) /* parse cmdline args */ for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { - iphone_set_debug_mask(DBGMASK_ALL); iphone_set_debug_level(1); continue; } diff --git a/tools/iphonesyslog.c b/tools/iphonesyslog.c index 14a8223..195fc7c 100644 --- a/tools/iphonesyslog.c +++ b/tools/iphonesyslog.c @@ -60,7 +60,6 @@ int main(int argc, char *argv[]) /* parse cmdline args */ for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { - iphone_set_debug_mask(DBGMASK_ALL); iphone_set_debug_level(1); continue; } -- cgit v1.1-32-gdbae