Implement get for SVC.

This commit is contained in:
Michael Jumper 2014-03-02 10:46:38 -08:00
parent 67a647b88d
commit d630d66c8b
2 changed files with 26 additions and 4 deletions

View File

@ -63,8 +63,30 @@ void guac_rdp_add_svc(guac_client* client, guac_rdp_svc* svc) {
} }
guac_rdp_svc* guac_rdp_get_svc(guac_client* client, char* name) { guac_rdp_svc* guac_rdp_get_svc(guac_client* client, const char* name) {
/* STUB */
return NULL; rdp_guac_client_data* client_data = (rdp_guac_client_data*) client->data;
guac_common_list_element* current;
guac_rdp_svc* found = NULL;
/* For each available SVC */
guac_common_list_lock(client_data->available_svc);
current = client_data->available_svc->head;
while (current != NULL) {
/* If name matches, found */
guac_rdp_svc* current_svc = (guac_rdp_svc*) current->data;
if (strcmp(current_svc->name, name) == 0) {
found = current_svc;
break;
}
current = current->next;
}
guac_common_list_unlock(client_data->available_svc);
return found;
} }

View File

@ -82,7 +82,7 @@ void guac_rdp_add_svc(guac_client* client, guac_rdp_svc* svc);
/** /**
* Retrieve the SVC with the given name from the list stored in the client. * Retrieve the SVC with the given name from the list stored in the client.
*/ */
guac_rdp_svc* guac_rdp_get_svc(guac_client* client, char* name); guac_rdp_svc* guac_rdp_get_svc(guac_client* client, const char* name);
#endif #endif