From 3bd924aa566c95154c797ebef88fbef636bf3370 Mon Sep 17 00:00:00 2001 From: Vic Lee Date: Sun, 3 Jul 2011 09:50:11 +0800 Subject: [PATCH] libfreerdp-core: add network module prototype. --- libfreerdp-core/CMakeLists.txt | 2 + libfreerdp-core/network.c | 73 ++++++++++++++++++++++++++++++++++ libfreerdp-core/network.h | 50 +++++++++++++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 libfreerdp-core/network.c create mode 100644 libfreerdp-core/network.h diff --git a/libfreerdp-core/CMakeLists.txt b/libfreerdp-core/CMakeLists.txt index 96492be1b..86b164d3a 100644 --- a/libfreerdp-core/CMakeLists.txt +++ b/libfreerdp-core/CMakeLists.txt @@ -30,6 +30,8 @@ set(LIBFREERDP_CORE_SRCS # credssp.h # ntlmssp.c # ntlmssp.h + network.c + network.h tpdu.c tpdu.h tpkt.c diff --git a/libfreerdp-core/network.c b/libfreerdp-core/network.c new file mode 100644 index 000000000..2a244980b --- /dev/null +++ b/libfreerdp-core/network.c @@ -0,0 +1,73 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * Network Transport Layer + * + * Copyright 2011 Vic Lee + * + * 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. + */ + +#include +#include +#include +#include +#include + +#include "network.h" + +rdpNetwork * +network_new(void) +{ + rdpNetwork * network; + + network = (rdpNetwork *) xmalloc(sizeof(rdpNetwork)); + memset(network, 0, sizeof(rdpNetwork)); + + return network; +} + +void +network_free(rdpNetwork * network) +{ + xfree(network); +} + +int +network_connect(rdpNetwork * network, const char * server, int port) +{ + return 0; +} + +int +network_disconnect(rdpNetwork * network) +{ + return 0; +} + +int +network_start_tls(rdpNetwork * network) +{ + return 0; +} + +int +network_send(rdpNetwork * network, STREAM * stream) +{ + return 0; +} + +int +network_check_fds(rdpNetwork * network) +{ + return 0; +} diff --git a/libfreerdp-core/network.h b/libfreerdp-core/network.h new file mode 100644 index 000000000..71530668f --- /dev/null +++ b/libfreerdp-core/network.h @@ -0,0 +1,50 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * Network Transport Layer + * + * Copyright 2011 Vic Lee + * + * 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. + */ + +#ifndef __NETWORK_H +#define __NETWORK_H + +#include + +typedef int (* PacketReceivedCallback) (STREAM * stream); + +struct rdp_network +{ + int sockfd; + struct crypto_tls * tls; + PacketReceivedCallback * recv_callback; +}; +typedef struct rdp_network rdpNetwork; + +rdpNetwork * +network_new(void); +void +network_free(rdpNetwork * network); +int +network_connect(rdpNetwork * network, const char * server, int port); +int +network_disconnect(rdpNetwork * network); +int +network_start_tls(rdpNetwork * network); +int +network_send(rdpNetwork * network, STREAM * stream); +int +network_check_fds(rdpNetwork * network); + +#endif