summaryrefslogtreecommitdiffstats
path: root/src/idevice.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/idevice.c')
-rw-r--r--src/idevice.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/idevice.c b/src/idevice.c
index 0bdf3f5..b72b623 100644
--- a/src/idevice.c
+++ b/src/idevice.c
@@ -172,7 +172,8 @@ idevice_error_t idevice_new(idevice_t * device, const char *uuid)
172 return IDEVICE_E_NO_DEVICE; 172 return IDEVICE_E_NO_DEVICE;
173} 173}
174 174
175/** Cleans up an idevice structure, then frees the structure itself. 175/**
176 * Cleans up an idevice structure, then frees the structure itself.
176 * This is a library-level function; deals directly with the device to tear 177 * This is a library-level function; deals directly with the device to tear
177 * down relations, but otherwise is mostly internal. 178 * down relations, but otherwise is mostly internal.
178 * 179 *
@@ -422,6 +423,9 @@ idevice_error_t idevice_connection_receive(idevice_connection_t connection, char
422 return internal_connection_receive(connection, data, len, recv_bytes); 423 return internal_connection_receive(connection, data, len, recv_bytes);
423} 424}
424 425
426/**
427 * Gets the handle of the device. Depends on the connection type.
428 */
425idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle) 429idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle)
426{ 430{
427 if (!device) 431 if (!device)
@@ -436,6 +440,9 @@ idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle)
436 return IDEVICE_E_UNKNOWN_ERROR; 440 return IDEVICE_E_UNKNOWN_ERROR;
437} 441}
438 442
443/**
444 * Gets the unique id for the device.
445 */
439idevice_error_t idevice_get_uuid(idevice_t device, char **uuid) 446idevice_error_t idevice_get_uuid(idevice_t device, char **uuid)
440{ 447{
441 if (!device) 448 if (!device)
@@ -469,10 +476,10 @@ static ssize_t internal_ssl_read(gnutls_transport_ptr_t transport, char *buffer,
469 } 476 }
470 debug_info("post-read we got %i bytes", bytes); 477 debug_info("post-read we got %i bytes", bytes);
471 478
472 // increase read count 479 /* increase read count */
473 tbytes += bytes; 480 tbytes += bytes;
474 481
475 // fill the buffer with what we got right now 482 /* fill the buffer with what we got right now */
476 memcpy(buffer + pos_start_fill, recv_buffer, bytes); 483 memcpy(buffer + pos_start_fill, recv_buffer, bytes);
477 pos_start_fill += bytes; 484 pos_start_fill += bytes;
478 485
@@ -538,7 +545,7 @@ idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection)
538 545
539 ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_private)); 546 ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_private));
540 547
541 // Set up GnuTLS... 548 /* Set up GnuTLS... */
542 debug_info("enabling SSL mode"); 549 debug_info("enabling SSL mode");
543 errno = 0; 550 errno = 0;
544 gnutls_global_init(); 551 gnutls_global_init();
@@ -558,7 +565,7 @@ idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection)
558 gnutls_protocol_set_priority(ssl_data_loc->session, protocol_priority); 565 gnutls_protocol_set_priority(ssl_data_loc->session, protocol_priority);
559 gnutls_mac_set_priority(ssl_data_loc->session, mac_priority); 566 gnutls_mac_set_priority(ssl_data_loc->session, mac_priority);
560 } 567 }
561 gnutls_credentials_set(ssl_data_loc->session, GNUTLS_CRD_CERTIFICATE, ssl_data_loc->certificate); // this part is killing me. 568 gnutls_credentials_set(ssl_data_loc->session, GNUTLS_CRD_CERTIFICATE, ssl_data_loc->certificate); /* this part is killing me. */
562 569
563 debug_info("GnuTLS step 1..."); 570 debug_info("GnuTLS step 1...");
564 gnutls_transport_set_ptr(ssl_data_loc->session, (gnutls_transport_ptr_t)connection); 571 gnutls_transport_set_ptr(ssl_data_loc->session, (gnutls_transport_ptr_t)connection);