Example #1
0
        /// <summary>
        /// Sends Bro <paramref name="packet"/> from this <see cref="BroConnection"/>.
        /// </summary>
        /// <param name="packet"><see cref="BroPacket"/> to send.</param>
        /// <returns><c>true</c> if successful; otherwise, <c>false</c>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="packet"/> is <c>null</c>.</exception>
        /// <exception cref="ObjectDisposedException">Cannot send packet, <see cref="BroConnection"/> is disposed.</exception>
        public bool SendPacket(BroPacket packet)
        {
            if ((object)packet == null)
            {
                throw new ArgumentNullException("packet");
            }

            if (m_connectionPtr.IsInvalid())
            {
                throw new ObjectDisposedException("Cannot send packet, Bro connection is disposed.");
            }

            return(BroApi.bro_packet_send(m_connectionPtr, packet.GetValuePtr()) != 0);
        }