summaryrefslogtreecommitdiff
path: root/vio
diff options
context:
space:
mode:
Diffstat (limited to 'vio')
-rw-r--r--vio/viosocket.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 9ef703dee8d..c4d55901a16 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -645,6 +645,26 @@ enum enum_vio_type vio_type(Vio* vio)
return vio->type;
}
+static const LEX_CSTRING vio_type_names[] =
+{
+ { STRING_WITH_LEN("Error") }, // cannot happen
+ { STRING_WITH_LEN("TCP/IP") },
+ { STRING_WITH_LEN("Socket") },
+ { STRING_WITH_LEN("Named Pipe") },
+ { STRING_WITH_LEN("SSL/TLS") },
+ { STRING_WITH_LEN("Shared Memory") }
+};
+
+const char *vio_type_name(enum enum_vio_type vio_type, size_t *len)
+{
+ int index= vio_type >= FIRST_VIO_TYPE && vio_type <= LAST_VIO_TYPE
+ ? vio_type : 0;
+
+ *len= vio_type_names[index].length;
+ return vio_type_names[index].str;
+}
+
+
my_socket vio_fd(Vio* vio)
{
return mysql_socket_getfd(vio->mysql_socket);