libfreerdp-core: add network module prototype.

This commit is contained in:
Vic Lee
2011-07-03 09:50:11 +08:00
parent 2cc8ea32c9
commit 3bd924aa56
3 changed files with 125 additions and 0 deletions

View File

@@ -30,6 +30,8 @@ set(LIBFREERDP_CORE_SRCS
# credssp.h
# ntlmssp.c
# ntlmssp.h
network.c
network.h
tpdu.c
tpdu.h
tpkt.c

73
libfreerdp-core/network.c Normal file
View File

@@ -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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/memory.h>
#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;
}

50
libfreerdp-core/network.h Normal file
View File

@@ -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 <freerdp/utils/stream.h>
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