예제 #1
0
        /// <summary>
        /// Gets or sets arbitrary data associated with this <see cref="BroConnection"/>.
        /// </summary>
        /// <param name="key">Key identifier of data.</param>
        /// <returns>Data for given <paramref name="key"/>.</returns>
        /// <exception cref="ObjectDisposedException">Cannot get or set connection data, <see cref="BroConnection"/> is disposed.</exception>
        public IntPtr this[string key]
        {
            get
            {
                IntPtr connection = m_parent.GetValuePtr();

                if (connection == IntPtr.Zero)
                {
                    throw new ObjectDisposedException("Cannot get connection data, Bro connection is disposed.");
                }

                return(BroApi.bro_conn_data_get(connection, key));
            }
            set
            {
                IntPtr connection = m_parent.GetValuePtr();

                if (connection == IntPtr.Zero)
                {
                    throw new ObjectDisposedException("Cannot set connection data, Bro connection is disposed.");
                }

                BroApi.bro_conn_data_set(connection, key, value);
            }
        }