From a51a1bbb212e98272ab0b7f2a47c6d4af34b6cfe Mon Sep 17 00:00:00 2001 From: hvlad Date: Tue, 18 Sep 2018 19:47:36 +0300 Subject: [PATCH] Implement sub-task CORE-5913 : Add context variables with compression and encryption status of current connection --- doc/sql.extensions/README.context_variables2 | 8 ++++++++ src/jrd/SysFunction.cpp | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/doc/sql.extensions/README.context_variables2 b/doc/sql.extensions/README.context_variables2 index 12dfd100a7..32a1e844e8 100644 --- a/doc/sql.extensions/README.context_variables2 +++ b/doc/sql.extensions/README.context_variables2 @@ -56,6 +56,14 @@ Usage: NETWORK_PROTOCOL | The network protocol used by client to connect. Currently | used values: "TCPv4", "TCPv6", "WNET", "XNET" and NULL | + WIRE_COMPRESSED | Compression status of current connection. + | If connection is compressed - returns "TRUE", if it is + | not compressed - returns "FALSE". + | If connection is embedded - returns NULL. + | + WIRE_ENCRYPTED | Encryption status of current connection. + | Value is the same as for compression status above. + | CLIENT_ADDRESS | The wire protocol address and port number of remote client | represented as string. Value is IP address concatenated with | port number using the '/' separator character. Value is diff --git a/src/jrd/SysFunction.cpp b/src/jrd/SysFunction.cpp index 2c4cc72cb7..60b7a5209e 100644 --- a/src/jrd/SysFunction.cpp +++ b/src/jrd/SysFunction.cpp @@ -283,6 +283,8 @@ const char // SYSTEM namespace: connection wise items SESSION_ID_NAME[] = "SESSION_ID", NETWORK_PROTOCOL_NAME[] = "NETWORK_PROTOCOL", + WIRE_COMPRESSED_NAME[] = "WIRE_COMPRESSED", + WIRE_ENCRYPTED_NAME[] = "WIRE_ENCRYPTED", CLIENT_ADDRESS_NAME[] = "CLIENT_ADDRESS", CLIENT_HOST_NAME[] = "CLIENT_HOST", CLIENT_PID_NAME[] = "CLIENT_PID", @@ -2602,6 +2604,20 @@ dsc* evlGetContext(thread_db* tdbb, const SysFunction*, const NestValueArray& ar resultStr = attachment->att_network_protocol; } + else if (nameStr == WIRE_COMPRESSED_NAME) + { + if (attachment->att_network_protocol.isEmpty()) + return NULL; + + resultStr = (attachment->att_remote_flags & isc_dpb_addr_flag_conn_compressed) ? TRUE_VALUE : FALSE_VALUE; + } + else if (nameStr == WIRE_ENCRYPTED_NAME) + { + if (attachment->att_network_protocol.isEmpty()) + return NULL; + + resultStr = (attachment->att_remote_flags & isc_dpb_addr_flag_conn_encrypted) ? TRUE_VALUE : FALSE_VALUE; + } else if (nameStr == CLIENT_ADDRESS_NAME) { if (attachment->att_remote_address.isEmpty())