Beispiel #1
0
 /// <summary>
 /// Attempts to send an event to a Bro agent with the specified <paramref name="name"/> and <paramref name="parameters"/>.
 /// </summary>
 /// <param name="name">Name of the event to send.</param>
 /// <param name="parameters">Parameters to add to event.</param>
 /// <returns><c>true</c> if the event was sent or queued for later transmission; otherwise <c>false</c> on error.</returns>
 /// <exception cref="ArgumentNullException"><paramref name="name"/> is <c>null</c>.</exception>
 public bool SendEvent(string name, params BroValue[] parameters)
 {
     using (BroEvent @event = new BroEvent(name, parameters))
     {
         return(SendEvent(@event));
     }
 }
Beispiel #2
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);
        }