Although we document 6 types of transport that we support, internally we can
only differentiate between TCP, TLS, and UNIX transports only, since both SSH
and libssh2 transports, due to using netcat, behave in the exactly the same
way as a UNIX socket.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/rpc/virnetserverclient.c | 22 ++++++++++++++++++++++
src/rpc/virnetserverclient.h | 2 +-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index a1543b9..a9d70e1 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -1568,3 +1568,25 @@ virNetServerClientStartKeepAlive(virNetServerClientPtr client)
virObjectUnlock(client);
return ret;
}
+
+int
+virNetServerClientGetTransport(virNetServerClientPtr client)
+{
+ int ret = -1;
+
+ virObjectLock(client);
+
+ if (client->sock && virNetSocketIsLocal(client->sock))
+ ret = VIR_CLIENT_TRANS_UNIX;
+ else
+ ret = VIR_CLIENT_TRANS_TCP;
+
+#ifdef WITH_GNUTLS
+ if (client->tls)
+ ret = VIR_CLIENT_TRANS_TLS;
+#endif
+
+ virObjectUnlock(client);
+
+ return ret;
+}
diff --git a/src/rpc/virnetserverclient.h b/src/rpc/virnetserverclient.h
index e68ef76..55a8af1 100644
--- a/src/rpc/virnetserverclient.h
+++ b/src/rpc/virnetserverclient.h
@@ -144,6 +144,6 @@ int virNetServerClientSendMessage(virNetServerClientPtr client,
virNetMessagePtr msg);
bool virNetServerClientNeedAuth(virNetServerClientPtr client);
-
+int virNetServerClientGetTransport(virNetServerClientPtr client);
#endif /* __VIR_NET_SERVER_CLIENT_H__ */
--
2.4.11