コード例 #1
0
        /// <summary>
        /// Attempts to send a <see cref="BroEvent"/> to a Bro agent.
        /// </summary>
        /// <param name="event"><see cref="BroEvent"/> to attempt to send.</param>
        /// <returns><c>true</c> if the event was sent or queued for later transmission; otherwise <c>false</c> on error.</returns>
        /// <remarks>
        /// There are no automatic repeated send attempts (to minimize the effect on the code that Broccoli is linked to).
        /// To verify all events were sent, attempt to empty the queue using <see cref="BroEventQueue.Flush"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException"><paramref name="event"/> is <c>null</c>.</exception>
        /// <exception cref="ObjectDisposedException">Cannot send event, <see cref="BroConnection"/> or <see cref="BroEvent"/> is disposed.</exception>
        public bool SendEvent(BroEvent @event)
        {
            if ((object)@event == null)
            {
                throw new ArgumentNullException("event");
            }

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

            return(BroApi.bro_event_send(m_connectionPtr, @event.GetValuePtr()) != 0);
        }