summaryrefslogtreecommitdiffstats
path: root/include/libimobiledevice/syslog_relay.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libimobiledevice/syslog_relay.h')
-rw-r--r--include/libimobiledevice/syslog_relay.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/include/libimobiledevice/syslog_relay.h b/include/libimobiledevice/syslog_relay.h
index 7ccfd74..952840e 100644
--- a/include/libimobiledevice/syslog_relay.h
+++ b/include/libimobiledevice/syslog_relay.h
@@ -51,15 +51,109 @@ typedef syslog_relay_client_private *syslog_relay_client_t; /**< The client hand
51typedef void (*syslog_relay_receive_cb_t)(char c, void *user_data); 51typedef void (*syslog_relay_receive_cb_t)(char c, void *user_data);
52 52
53/* Interface */ 53/* Interface */
54
55/**
56 * Connects to the syslog_relay service on the specified device.
57 *
58 * @param device The device to connect to.
59 * @param service The service descriptor returned by lockdownd_start_service.
60 * @param client Pointer that will point to a newly allocated
61 * syslog_relay_client_t upon successful return. Must be freed using
62 * syslog_relay_client_free() after use.
63 *
64 * @return SYSLOG_RELAY_E_SUCCESS on success, SYSLOG_RELAY_E_INVALID_ARG when
65 * client is NULL, or an SYSLOG_RELAY_E_* error code otherwise.
66 */
54syslog_relay_error_t syslog_relay_client_new(idevice_t device, lockdownd_service_descriptor_t service, syslog_relay_client_t * client); 67syslog_relay_error_t syslog_relay_client_new(idevice_t device, lockdownd_service_descriptor_t service, syslog_relay_client_t * client);
68
69/**
70 * Starts a new syslog_relay service on the specified device and connects to it.
71 *
72 * @param device The device to connect to.
73 * @param client Pointer that will point to a newly allocated
74 * syslog_relay_client_t upon successful return. Must be freed using
75 * syslog_relay_client_free() after use.
76 * @param label The label to use for communication. Usually the program name.
77 * Pass NULL to disable sending the label in requests to lockdownd.
78 *
79 * @return SYSLOG_RELAY_E_SUCCESS on success, or an SYSLOG_RELAY_E_* error
80 * code otherwise.
81 */
55syslog_relay_error_t syslog_relay_client_start_service(idevice_t device, syslog_relay_client_t * client, const char* label); 82syslog_relay_error_t syslog_relay_client_start_service(idevice_t device, syslog_relay_client_t * client, const char* label);
83
84/**
85 * Disconnects a syslog_relay client from the device and frees up the
86 * syslog_relay client data.
87 *
88 * @param client The syslog_relay client to disconnect and free.
89 *
90 * @return SYSLOG_RELAY_E_SUCCESS on success, SYSLOG_RELAY_E_INVALID_ARG when
91 * client is NULL, or an SYSLOG_RELAY_E_* error code otherwise.
92 */
56syslog_relay_error_t syslog_relay_client_free(syslog_relay_client_t client); 93syslog_relay_error_t syslog_relay_client_free(syslog_relay_client_t client);
57 94
95
96/**
97 * Starts capturing the syslog of the device using a callback.
98 *
99 * Use syslog_relay_stop_capture() to stop receiving the syslog.
100 *
101 * @param client The syslog_relay client to use
102 * @param callback Callback to receive each character from the syslog.
103 * @param user_data Custom pointer passed to the callback function.
104 *
105 * @return SYSLOG_RELAY_E_SUCCESS on success,
106 * SYSLOG_RELAY_E_INVALID_ARG when one or more parameters are
107 * invalid or SYSLOG_RELAY_E_UNKNOWN_ERROR when an unspecified
108 * error occurs or a syslog capture has already been started.
109 */
58syslog_relay_error_t syslog_relay_start_capture(syslog_relay_client_t client, syslog_relay_receive_cb_t callback, void* user_data); 110syslog_relay_error_t syslog_relay_start_capture(syslog_relay_client_t client, syslog_relay_receive_cb_t callback, void* user_data);
111
112/**
113 * Stops capturing the syslog of the device.
114 *
115 * Use syslog_relay_start_capture() to start receiving the syslog.
116 *
117 * @param client The syslog_relay client to use
118 *
119 * @return SYSLOG_RELAY_E_SUCCESS on success,
120 * SYSLOG_RELAY_E_INVALID_ARG when one or more parameters are
121 * invalid or SYSLOG_RELAY_E_UNKNOWN_ERROR when an unspecified
122 * error occurs or a syslog capture has already been started.
123 */
59syslog_relay_error_t syslog_relay_stop_capture(syslog_relay_client_t client); 124syslog_relay_error_t syslog_relay_stop_capture(syslog_relay_client_t client);
60 125
61/* Receiving */ 126/* Receiving */
127
128/**
129 * Receives data using the given syslog_relay client with specified timeout.
130 *
131 * @param client The syslog_relay client to use for receiving
132 * @param data Buffer that will be filled with the data received
133 * @param size Number of bytes to receive
134 * @param received Number of bytes received (can be NULL to ignore)
135 * @param timeout Maximum time in milliseconds to wait for data.
136 *
137 * @return SYSLOG_RELAY_E_SUCCESS on success,
138 * SYSLOG_RELAY_E_INVALID_ARG when one or more parameters are
139 * invalid, SYSLOG_RELAY_E_MUX_ERROR when a communication error
140 * occurs, or SYSLOG_RELAY_E_UNKNOWN_ERROR when an unspecified
141 * error occurs.
142 */
62syslog_relay_error_t syslog_relay_receive_with_timeout(syslog_relay_client_t client, char *data, uint32_t size, uint32_t *received, unsigned int timeout); 143syslog_relay_error_t syslog_relay_receive_with_timeout(syslog_relay_client_t client, char *data, uint32_t size, uint32_t *received, unsigned int timeout);
144
145/**
146 * Receives data from the service.
147 *
148 * @param client The syslog_relay client
149 * @param data Buffer that will be filled with the data received
150 * @param size Number of bytes to receive
151 * @param received Number of bytes received (can be NULL to ignore)
152 * @param timeout Maximum time in milliseconds to wait for data.
153 *
154 * @return SYSLOG_RELAY_E_SUCCESS on success,
155 * SYSLOG_RELAY_E_INVALID_ARG when client or plist is NULL
156 */
63syslog_relay_error_t syslog_relay_receive(syslog_relay_client_t client, char *data, uint32_t size, uint32_t *received); 157syslog_relay_error_t syslog_relay_receive(syslog_relay_client_t client, char *data, uint32_t size, uint32_t *received);
64 158
65#ifdef __cplusplus 159#ifdef __cplusplus