diff options
| author | 2013-08-05 20:07:04 +0200 | |
|---|---|---|
| committer | 2013-08-05 20:07:04 +0200 | |
| commit | 3604756139b1a2dde383122745d37fe9d1c95f88 (patch) | |
| tree | 84f7a312bfc539abc8c7e78d99fcd9c8608f6a9c /src/afc.c | |
| parent | d0635a7dc686e21d3eea6bf1c030657d6d575562 (diff) | |
| download | libimobiledevice-3604756139b1a2dde383122745d37fe9d1c95f88.tar.gz libimobiledevice-3604756139b1a2dde383122745d37fe9d1c95f88.tar.bz2 | |
Implement *_start_service() helper to simplify creation of service clients
Diffstat (limited to 'src/afc.c')
| -rw-r--r-- | src/afc.c | 20 |
1 files changed, 20 insertions, 0 deletions
| @@ -129,6 +129,26 @@ afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t serv | |||
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | /** | 131 | /** |
| 132 | * Starts a new AFC service on the specified device and connects to it. | ||
| 133 | * | ||
| 134 | * @param device The device to connect to. | ||
| 135 | * @param client Pointer that will point to a newly allocated | ||
| 136 | * afc_client_t upon successful return. Must be freed using | ||
| 137 | * afc_client_free() after use. | ||
| 138 | * @param label The label to use for communication. Usually the program name. | ||
| 139 | * Pass NULL to disable sending the label in requests to lockdownd. | ||
| 140 | * | ||
| 141 | * @return AFC_E_SUCCESS on success, or an AFC_E_* error | ||
| 142 | * code otherwise. | ||
| 143 | */ | ||
| 144 | afc_error_t afc_client_start_service(idevice_t device, afc_client_t * client, const char* label) | ||
| 145 | { | ||
| 146 | afc_error_t err = AFC_E_UNKNOWN_ERROR; | ||
| 147 | service_client_factory_start_service(device, AFC_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(afc_client_new), &err); | ||
| 148 | return err; | ||
| 149 | } | ||
| 150 | |||
| 151 | /** | ||
| 132 | * Frees up an AFC client. If the connection was created by the | 152 | * Frees up an AFC client. If the connection was created by the |
| 133 | * client itself, the connection will be closed. | 153 | * client itself, the connection will be closed. |
| 134 | * | 154 | * |
