mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-14 00:04:13 +09:00
Merge pull request #210 from FDH2/testing
control clients allowed to connect
This commit is contained in:
@@ -70,6 +70,7 @@ struct raop_callbacks_s {
|
||||
void (*audio_set_progress)(void *cls, unsigned int start, unsigned int curr, unsigned int end);
|
||||
void (*audio_get_format)(void *cls, unsigned char *ct, unsigned short *spf, bool *usingScreen, bool *isMedia, uint64_t *audioFormat);
|
||||
void (*video_report_size)(void *cls, float *width_source, float *height_source, float *width, float *height);
|
||||
void (*report_client_request) (void *cls, char *deviceid, char *model, char *name, bool *admit);
|
||||
};
|
||||
typedef struct raop_callbacks_s raop_callbacks_t;
|
||||
raop_ntp_t *raop_ntp_init(logger_t *logger, raop_callbacks_t *callbacks, const char *remote, int remote_addr_len,
|
||||
|
||||
@@ -354,6 +354,33 @@ raop_handler_setup(raop_conn_t *conn,
|
||||
// First setup
|
||||
char* eiv = NULL;
|
||||
uint64_t eiv_len = 0;
|
||||
|
||||
char *deviceID = NULL;
|
||||
char *model = NULL;
|
||||
char *name = NULL;
|
||||
bool admit_client = true;
|
||||
plist_t req_deviceid_node = plist_dict_get_item(req_root_node, "deviceID");
|
||||
plist_get_string_val(req_deviceid_node, &deviceID);
|
||||
plist_t req_model_node = plist_dict_get_item(req_root_node, "model");
|
||||
plist_get_string_val(req_model_node, &model);
|
||||
plist_t req_name_node = plist_dict_get_item(req_root_node, "name");
|
||||
plist_get_string_val(req_name_node, &name);
|
||||
if (conn->raop->callbacks.report_client_request) {
|
||||
conn->raop->callbacks.report_client_request(conn->raop->callbacks.cls, deviceID, model, name, &admit_client);
|
||||
}
|
||||
free (deviceID);
|
||||
deviceID = NULL;
|
||||
free (model);
|
||||
model = NULL;
|
||||
free (name);
|
||||
name = NULL;
|
||||
if (admit_client == false) {
|
||||
/* client is not authorized to connect */
|
||||
plist_free(res_root_node);
|
||||
plist_free(req_root_node);
|
||||
return;
|
||||
}
|
||||
|
||||
plist_get_data_val(req_eiv_node, &eiv, &eiv_len);
|
||||
memcpy(aesiv, eiv, 16);
|
||||
free(eiv);
|
||||
|
||||
Reference in New Issue
Block a user