server: add PostConnect callback.

This commit is contained in:
Vic Lee 2011-08-22 23:02:56 +08:00
parent 7dcb87d7a3
commit ab7a53ea51
3 changed files with 33 additions and 0 deletions

View File

@ -30,6 +30,7 @@ typedef boolean (*psPeerInitialize)(freerdp_peer* client);
typedef boolean (*psPeerGetFileDescriptor)(freerdp_peer* client, void** rfds, int* rcount);
typedef boolean (*psPeerCheckFileDescriptor)(freerdp_peer* client);
typedef void (*psPeerDisconnect)(freerdp_peer* client);
typedef boolean (*psPeerPostConnect)(freerdp_peer* client);
struct rdp_freerdp_peer
{
@ -45,6 +46,8 @@ struct rdp_freerdp_peer
psPeerGetFileDescriptor GetFileDescriptor;
psPeerCheckFileDescriptor CheckFileDescriptor;
psPeerDisconnect Disconnect;
psPeerPostConnect PostConnect;
};
FREERDP_API freerdp_peer* freerdp_peer_new(int sockfd);

View File

@ -82,6 +82,11 @@ static boolean peer_read_data_pdu(rdpPeer* peer, STREAM* s)
case DATA_PDU_TYPE_FONT_LIST:
if (!rdp_server_accept_client_font_list_pdu(peer->rdp, s))
return False;
if (peer->client->PostConnect)
{
if (!peer->client->PostConnect(peer->client))
return False;
}
break;
default:

View File

@ -26,6 +26,29 @@
#include <freerdp/utils/thread.h>
#include <freerdp/listener.h>
boolean test_peer_post_connect(freerdp_peer* client)
{
/**
* This callback is called when the entire connection sequence is done, i.e. we've received the
* Font List PDU from the client and sent out the Font Map PDU.
* The server may start sending graphics output and receiving keyboard/mouse input after this
* callback returns.
*/
printf("Client %s is activated", client->settings->hostname);
if (client->settings->autologon)
{
printf(" and wants to login automatically as %s\\%s",
client->settings->domain ? client->settings->domain : "",
client->settings->username);
/* A real server may perform OS login here if NLA is not executed previously. */
}
printf("\n");
/* Return False here would stop the execution of the peer mainloop. */
return True;
}
static void* test_peer_mainloop(void* arg)
{
freerdp_peer* client = (freerdp_peer*)arg;
@ -43,6 +66,8 @@ static void* test_peer_mainloop(void* arg)
client->settings->cert_file = xstrdup("server.crt");
client->settings->privatekey_file = xstrdup("server.key");
client->settings->nla_security = False;
client->PostConnect = test_peer_post_connect;
client->Initialize(client);
while (1)