summaryrefslogtreecommitdiffstats
path: root/src/idevice.c
AgeCommit message (Collapse)AuthorFilesLines
2022-05-10idevice: Restore original behavior for idevice_event_unsubscribe()Gravatar Nikias Bassen1-0/+1
Due to an implementation detail from the past, a call to idevice_event_unsubscribe would not cause the callback function to be called with IDEVICE_DEVICE_REMOVE events, even though originally it was planned to be that way. Due to the internal changes for the newer idevice_events_subscribe/unsubscribe API, that behavior changed and it would call the callback. Now to not break current software implementations depending on the original behavior we modify the old API to behave the same as before the change.
2022-05-09Add new idevice_events_subscribe/unsubscribe API with contextGravatar Nikias Bassen1-10/+49
The older API idevice_event_subscribe/unsubscribe can only be used by a single instance. With the addition of a context, is is now possible to register multiple callback functions in different threads. For backwards compatibility the old API will still be available for a while before being removed in a future release.
2022-05-02idevice: Fix sign issue in idevice_get_device_list_extendedGravatar Семён Марьясин1-1/+1
In sync with idevice_from_mux_device, line 384. Without this fix, data size 128 (the common value) is treated as -128, resulting in incorrect allocation. Related to #1248 but doesn't fully fix it.
2022-04-30[clang-tidy] Do not use else after returnGravatar Rosen Penev1-37/+39
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-04-22idevice: Fix mistreatment of 0-byte sent casesGravatar Li Beinan1-1/+4
Currently if 0 byte gets sent, it is treated as not-enough-data. This is wrong, because with TCP, 0-byte-sent usually means the receiver end is closed. We must set a new case for this and must not normalize the sent-bytes to 0 in general.
2022-03-29idevice: Fix debug message showing function name twiceGravatar Nikias Bassen1-1/+1
2022-03-29idevice: win32: Add winsock2.h include for struct sockaddr_storageGravatar Nikias Bassen1-4/+5
2022-03-29idevice: Make sure ECONNREFUSED is definedGravatar Nikias Bassen1-0/+4
2022-02-09Add support for wireless pairingGravatar Nikias Bassen1-1/+4
2021-10-12idevice: Add IDEVICE_E_CONNREFUSED and have idevice_connect() return ↵Gravatar Nikias Bassen1-2/+17
meaningful error codes This allows clients to properly detect that a connection to the requested port failed because it is not open on the device, instead of just returning an "unknown error"
2021-09-13Check availability of constructor attribute and use it on Windows in favor ↵Gravatar Nikias Bassen1-10/+18
of DllMain
2021-09-01Remove common code in favor of new libimobiledevice-glueGravatar Nikias Bassen1-2/+3
2021-07-30idevice: Reset receive length variable in internal_ssl_read retry loop and ↵Gravatar Nikias Bassen1-1/+2
fix wrong variable in debug message
2021-07-29lockdown: Get DeviceClass to make sure OS version dependent code is executed ↵Gravatar Nikias Bassen1-0/+1
correctly The code in lockdownd_client_new_with_handshake would call the function lockdownd_validate_pair based on the OS version being less than 7.0 without taking into account that Watch OS has a different versioning scheme compared to the other device classes. For this and any future version/device specific checks, the code now queries the DeviceClass and stores it in the idevice_private struct.
2021-07-29Handle error cases in relevant code when retrieving pair record failsGravatar Nikias Bassen1-3/+3
2021-07-27Add support for MbedTLSGravatar Nikias Bassen1-25/+170
2021-07-26idevice: Remove unnecessary memcpy from internal_ssl_read()Gravatar Nikias Bassen1-29/+15
2021-07-26idevice: Route OpenSSL reads/writes through internal_connection_*Gravatar Kabir Oberai1-42/+64
Let's not allow OpenSSL to directly access our file descriptors
2021-07-25idevice: Make sure to handle timeout condition for network connections tooGravatar Nikias Bassen1-9/+11
2021-02-01idevice: Allow partial reads in idevice_connection_receive_timeout() and ↵Gravatar Nikias Bassen1-6/+9
handle timeouts more adequate idevice_connection_receive_timeout(), when in SSL mode, was assuming it should always try to read the exact amount of data specified in `len` parameter. While this works with most protocols that have length fields or fixed sized headers/packets, some others (e.g. debugserver) break because it will request a read but doesn't know the size that is expected to be returned beforehand. This commit will handle timeouts better and return the number of bytes that were read in such cases (instead of returning 0 bytes read + error). Note that in the event of a timeout, IDEVICE_E_TIMEOUT will be returned even though actual data might have been read. The number of bytes read will be returned in recv_bytes.
2020-11-19idevice: Handle -EAGAIN in case usbmuxd_send() returns itGravatar Nikias Bassen1-1/+4
2020-08-06idevice: Fix build with LibreSSLGravatar Nikias Bassen1-1/+1
2020-06-13Allow OpenSSL >= 1.1.0 to use older/disallowed TLS versionsGravatar Author: Frederik Carlier1-1/+5
2020-06-08Remove whitespace errors from all filesGravatar Martin Szulecki1-1/+1
2020-06-08idevice: Add fix for potential SSL_write timeout error caseGravatar Nikias Bassen1-3/+3
2020-06-06idevice: Revert not copying scope id for IPv6 addresses from usbmuxd againGravatar Martin Szulecki1-2/+2
This should still catch the more common case when using usbmuxd on the same host. Not copying the scope id in that case actually removes vital routing information.
2020-06-06idevice: Slightly improve connectivity logic and fix IPv6 for network devicesGravatar Martin Szulecki1-6/+8
This change removes copying the scope id for IPv6 connections which caused problems if the usbmux connection data is used on different hosts or context.
2020-06-06idevice: Add some newlines for better code readabilityGravatar Martin Szulecki1-0/+7
2020-06-04idevice: Fix compiler warning about switch case fallthroughGravatar Martin Szulecki1-1/+1
2020-05-21idevice: [OpenSSL] Handle non-blocking SSL_writeGravatar Nikias Bassen1-0/+13
2020-05-18idevice_connection_send: Make sure send works with non-blocking socketsGravatar Nikias Bassen1-1/+17
2020-05-18Use direct socket connection for network devicesGravatar Nikias Bassen1-7/+76
Instead of relaying data via usbmuxd this change will have it connect directly to the device via network after retrieving its address from usbmuxd
2020-05-17idevice: [OpenSSL] Fix SSL_read with non-blocking socketsGravatar Nikias Bassen1-1/+10
2020-05-15idevice: [OpenSSL] Make sure SSL handshake works with non-blocking socketGravatar Nikias Bassen1-8/+18
2020-02-20introduces optional `idevice_connection_disable_ssl` with ability not to ↵Gravatar Demyan Kimitsa1-13/+23
send SSL shutdown message. As in debugserver this message will be considered as GDB server communication and break things
2020-01-05Define ETIMEDOUT if requiredGravatar Nikias Bassen1-0/+4
2019-11-07Add new idevice_get_device_list_extended() allowing to list all devices, ↵Gravatar Nikias Bassen1-0/+56
including network Instead of just returning a list of UDIDs (like idevice_get_device_list) this function will return idevice_info_t* records which also contains the type of the connection and the connection data.
2019-11-07Add propert support for network (WiFi) devices via new ↵Gravatar Nikias Bassen1-21/+71
idevice_new_with_options()
2019-09-29idevice: properly handle partial SSL writesGravatar Nikias Bassen1-8/+15
2019-09-28idevice: fix hang in SSL_shutdownGravatar Mikkel Kamstrup Erlandsen1-1/+7
2019-09-05idevice: Fix handling SSL/TLS version selection for OpenSSL 1.1.0+ and for ↵Gravatar Nikias Bassen1-11/+19
older devices
2019-08-18idevice: [win32] Move windows.h include after socket.h to prevent 'must ↵Gravatar Nikias Bassen1-4/+4
include winsock.h before windows.h'
2019-08-18Force use of TLSv1 for backwards compatibility with older iOS versionsGravatar Nikias Bassen1-1/+13
2019-07-19OpenSSL: Use SSL_pending() to determine if we want a select() before SSL_read()Gravatar Nikias Bassen1-11/+16
In order to obey the timeout in idevice_connection_receive_timeout(), we are using select() via socket_check_fd(). However, the SSL bio might have buffered more bytes than actually requested upon a call to SSL_read(), so in the next call to idevice_connection_receive_timeout() a select() would not find the fd being ready to read, and make it fail with an error, after the specified timeout is reached. With the help of SSL_pending() we can now skip calling select() so that SSL_read() will directly be called again.
2019-06-22Make sure to not use deprecated API when compiling with OpenSSL >= 1.1Gravatar Rosen Penev1-1/+7
There are several missing headers as well as deprecated functions for which compatibility was added as needed.
2019-06-21Use OPENSSL_THREADID_* API for OpenSSL >= 1.0.0 && < 1.1.0Gravatar Nikias Bassen1-0/+15
2019-06-16service: Silence timeout errorsGravatar Nikias Bassen1-1/+0
2019-06-13Timeout support for SSL connections and better timeout handeling.Gravatar DanyL1-11/+48
2019-06-10Make sure OpenSSL version checks don't fail when using LibreSSLGravatar Nikias Bassen1-7/+6
2018-09-29idevice: Add usbmux device id (handle/mux id) to internal data structureGravatar Nikias Bassen1-13/+6