From e7a751c930c8662a1e548a16acf77688f807f717 Mon Sep 17 00:00:00 2001 From: Corey C Date: Fri, 5 Oct 2012 18:18:59 -0400 Subject: [PATCH] wfreerdp-server: added support for getting number of peers and hostname --- server/Windows/wf_interface.c | 33 +++++++++++++++++++++++++++++++++ server/Windows/wf_interface.h | 4 ++++ 2 files changed, 37 insertions(+) diff --git a/server/Windows/wf_interface.c b/server/Windows/wf_interface.c index 98223efb9..1f6825e1f 100644 --- a/server/Windows/wf_interface.c +++ b/server/Windows/wf_interface.c @@ -178,3 +178,36 @@ FREERDP_API BOOL wfreerdp_server_is_running(wfServer* server) return TRUE; return FALSE; } + +FREERDP_API UINT32 wfreerdp_server_num_peers() +{ + wfInfo* wfi; + + wfi = wf_info_get_instance(); + return wfi->peerCount; +} + +FREERDP_API UINT32 wfreerdp_server_get_peer_hostname(int pId, wchar_t * dstStr) +{ + wfInfo* wfi; + freerdp_peer* peer; + + wfi = wf_info_get_instance(); + peer = wfi->peers[pId]; + + + if (peer) + { + UINT32 sLen; + + sLen = strnlen_s(peer->hostname, 50); + swprintf(dstStr, 50, L"%hs", peer->hostname); + return sLen; + } + else + { + printf("nonexistent peer\n"); + return 0; + } + +} diff --git a/server/Windows/wf_interface.h b/server/Windows/wf_interface.h index 173713896..d76687189 100644 --- a/server/Windows/wf_interface.h +++ b/server/Windows/wf_interface.h @@ -94,4 +94,8 @@ FREERDP_API void wfreerdp_server_free(wfServer* server); FREERDP_API BOOL wfreerdp_server_is_running(wfServer* server); +FREERDP_API UINT32 wfreerdp_server_num_peers(); + +FREERDP_API UINT32 wfreerdp_server_get_peer_hostname(int pId, wchar_t * dstStr); + #endif /* WF_INTERFACE_H */