summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--include/usbmuxd.h12
-rw-r--r--src/libusbmuxd.c18
3 files changed, 26 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 13d6b20..b6bb9fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,7 +15,7 @@ dnl libtool versioning
# changes to the signature and the semantic)
# ? :+1 : ? == just internal changes
# CURRENT : REVISION : AGE
-LIBUSBMUXD_SO_VERSION=4:0:0
+LIBUSBMUXD_SO_VERSION=5:0:1
dnl Minimum package versions
diff --git a/include/usbmuxd.h b/include/usbmuxd.h
index f345be2..0efebed 100644
--- a/include/usbmuxd.h
+++ b/include/usbmuxd.h
@@ -209,6 +209,18 @@ int usbmuxd_read_pair_record(const char* record_id, char **record_data, uint32_t
int usbmuxd_save_pair_record(const char* record_id, const char *record_data, uint32_t record_size);
/**
+ * Save a pairing record with device identifier
+ *
+ * @param record_id the record identifier of the pairing record to save
+ * @param device_id the device identifier of the connected device, or 0
+ * @param record_data buffer containing the pairing record data
+ * @param record_size size of the buffer passed in record_data
+ *
+ * @return 0 on success, a negative error value otherwise.
+ */
+int usbmuxd_save_pair_record_with_device_id(const char* record_id, uint32_t device_id, const char *record_data, uint32_t record_size);
+
+/**
* Delete a pairing record
*
* @param record_id the record identifier of the pairing record to delete.
diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c
index 1e707b1..1097f1d 100644
--- a/src/libusbmuxd.c
+++ b/src/libusbmuxd.c
@@ -644,7 +644,7 @@ static int send_read_buid_packet(int sfd, uint32_t tag)
return res;
}
-static int send_pair_record_packet(int sfd, uint32_t tag, const char* msgtype, const char* pair_record_id, plist_t data)
+static int send_pair_record_packet(int sfd, uint32_t tag, const char* msgtype, const char* pair_record_id, uint32_t device_id, plist_t data)
{
int res = -1;
@@ -654,6 +654,9 @@ static int send_pair_record_packet(int sfd, uint32_t tag, const char* msgtype, c
if (data) {
plist_dict_set_item(plist, "PairRecordData", plist_copy(data));
}
+ if (device_id > 0) {
+ plist_dict_set_item(plist, "DeviceID", plist_new_uint(device_id));
+ }
res = send_plist_packet(sfd, tag, plist);
plist_free(plist);
@@ -1365,7 +1368,7 @@ USBMUXD_API int usbmuxd_read_pair_record(const char* record_id, char **record_da
proto_version = 1;
tag = ++use_tag;
- if (send_pair_record_packet(sfd, tag, "ReadPairRecord", record_id, NULL) <= 0) {
+ if (send_pair_record_packet(sfd, tag, "ReadPairRecord", record_id, 0, NULL) <= 0) {
DEBUG(1, "%s: Error sending ReadPairRecord message!\n", __func__);
} else {
uint32_t rc = 0;
@@ -1391,7 +1394,7 @@ USBMUXD_API int usbmuxd_read_pair_record(const char* record_id, char **record_da
return ret;
}
-USBMUXD_API int usbmuxd_save_pair_record(const char* record_id, const char *record_data, uint32_t record_size)
+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 sfd;
int tag;
@@ -1412,7 +1415,7 @@ USBMUXD_API int usbmuxd_save_pair_record(const char* record_id, const char *reco
tag = ++use_tag;
plist_t data = plist_new_data(record_data, record_size);
- if (send_pair_record_packet(sfd, tag, "SavePairRecord", record_id, data) <= 0) {
+ if (send_pair_record_packet(sfd, tag, "SavePairRecord", record_id, device_id, data) <= 0) {
DEBUG(1, "%s: Error sending SavePairRecord message!\n", __func__);
} else {
uint32_t rc = 0;
@@ -1430,6 +1433,11 @@ USBMUXD_API int usbmuxd_save_pair_record(const char* record_id, const char *reco
return ret;
}
+USBMUXD_API 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 sfd;
@@ -1450,7 +1458,7 @@ USBMUXD_API int usbmuxd_delete_pair_record(const char* record_id)
proto_version = 1;
tag = ++use_tag;
- if (send_pair_record_packet(sfd, tag, "DeletePairRecord", record_id, NULL) <= 0) {
+ if (send_pair_record_packet(sfd, tag, "DeletePairRecord", record_id, 0, NULL) <= 0) {
DEBUG(1, "%s: Error sending DeletePairRecord message!\n", __func__);
} else {
uint32_t rc = 0;