2012-10-06 00:01:59 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2012-10-09 03:54:11 +04:00
|
|
|
* Client Channels
|
2012-10-06 00:01:59 +04:00
|
|
|
*
|
|
|
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2012-10-08 06:53:24 +04:00
|
|
|
#include "tables.h"
|
2012-10-06 00:01:59 +04:00
|
|
|
|
2012-10-08 06:53:24 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2012-10-09 03:54:11 +04:00
|
|
|
#include <freerdp/client/channels.h>
|
|
|
|
|
2012-10-16 00:31:41 +04:00
|
|
|
extern const STATIC_ENTRY_TABLE CLIENT_STATIC_ENTRY_TABLES[];
|
2012-10-08 06:53:24 +04:00
|
|
|
|
2012-10-16 00:31:41 +04:00
|
|
|
void* freerdp_channels_find_static_entry_in_table(const STATIC_ENTRY_TABLE* table, const char* entry)
|
2012-10-08 06:53:24 +04:00
|
|
|
{
|
2012-10-09 03:54:11 +04:00
|
|
|
int index = 0;
|
2012-10-16 00:31:41 +04:00
|
|
|
STATIC_ENTRY* pEntry;
|
2012-10-08 06:53:24 +04:00
|
|
|
|
2012-10-16 00:31:41 +04:00
|
|
|
pEntry = (STATIC_ENTRY*) &table->table[index++];
|
2012-10-08 06:53:24 +04:00
|
|
|
|
2012-10-09 03:54:11 +04:00
|
|
|
while (pEntry->entry != NULL)
|
|
|
|
{
|
2012-10-16 00:31:41 +04:00
|
|
|
if (strcmp(pEntry->name, entry) == 0)
|
2012-10-08 06:53:24 +04:00
|
|
|
{
|
2012-10-09 03:54:11 +04:00
|
|
|
return (void*) pEntry->entry;
|
2012-10-08 06:53:24 +04:00
|
|
|
}
|
2012-10-09 03:54:11 +04:00
|
|
|
|
2012-10-16 00:31:41 +04:00
|
|
|
pEntry = (STATIC_ENTRY*) &table->table[index++];
|
2012-10-08 06:53:24 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 03:54:11 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
2012-10-08 06:53:24 +04:00
|
|
|
|
2012-10-16 00:31:41 +04:00
|
|
|
void* freerdp_channels_find_static_entry(const char* name, const char* entry)
|
2012-10-09 03:54:11 +04:00
|
|
|
{
|
|
|
|
int index = 0;
|
2012-10-16 00:31:41 +04:00
|
|
|
STATIC_ENTRY_TABLE* pEntry;
|
2012-10-09 03:54:11 +04:00
|
|
|
|
2012-10-16 00:31:41 +04:00
|
|
|
pEntry = (STATIC_ENTRY_TABLE*) &CLIENT_STATIC_ENTRY_TABLES[index++];
|
2012-10-08 06:53:24 +04:00
|
|
|
|
2012-10-16 00:31:41 +04:00
|
|
|
while (pEntry->table != NULL)
|
2012-10-09 03:54:11 +04:00
|
|
|
{
|
|
|
|
if (strcmp(pEntry->name, name) == 0)
|
|
|
|
{
|
2012-10-16 00:31:41 +04:00
|
|
|
return freerdp_channels_find_static_entry_in_table(pEntry, entry);
|
2012-10-08 06:53:24 +04:00
|
|
|
}
|
2012-10-09 03:54:11 +04:00
|
|
|
|
2012-10-16 00:31:41 +04:00
|
|
|
pEntry = (STATIC_ENTRY_TABLE*) &CLIENT_STATIC_ENTRY_TABLES[index++];
|
2012-10-09 03:54:11 +04:00
|
|
|
}
|
|
|
|
|
2012-10-16 00:31:41 +04:00
|
|
|
return NULL;
|
2012-10-09 03:54:11 +04:00
|
|
|
}
|
|
|
|
|
2012-10-16 00:31:41 +04:00
|
|
|
void* freerdp_channels_find_static_virtual_channel_entry(const char* name)
|
2012-10-09 03:54:11 +04:00
|
|
|
{
|
2012-10-16 00:31:41 +04:00
|
|
|
return freerdp_channels_find_static_entry("VirtualChannelEntry", name);
|
2012-10-08 06:53:24 +04:00
|
|
|
}
|
2012-10-09 03:54:11 +04:00
|
|
|
|
2012-10-16 00:31:41 +04:00
|
|
|
void* freerdp_channels_find_static_device_service_entry(const char* name)
|
|
|
|
{
|
|
|
|
return freerdp_channels_find_static_entry("DeviceServiceEntry", name);
|
|
|
|
}
|