base/utils/queue.zeek

Queue

A FIFO queue.

Namespace

Queue

Summary

Types

Queue::Queue: record

The internal data structure for the queue.

Queue::Settings: record

Settings for initializing the queue.

Redefinitions

Queue::Queue: record

New Fields

Queue::Queue

initialized: bool &default = F &optional

vals: table [count] of any &optional

settings: Queue::Settings &optional

top: count &default = 0 &optional

bottom: count &default = 0 &optional

size: count &default = 0 &optional

Functions

Queue::get: function

Get a value from the end of a queue.

Queue::get_vector: function

Get the contents of the queue as a vector.

Queue::init: function

Initialize a queue record structure.

Queue::len: function

Get the number of items in a queue.

Queue::merge: function

Merge two queues together.

Queue::peek: function

Peek at the value at the end of the queue without removing it.

Queue::put: function

Put a value onto the beginning of a queue.

Detailed Interface

Types

Queue::Queue
Type

record

initialized: bool &default = F &optional

vals: table [count] of any &optional

settings: Queue::Settings &optional

top: count &default = 0 &optional

bottom: count &default = 0 &optional

size: count &default = 0 &optional

The internal data structure for the queue.

Queue::Settings
Type

record

max_len: count &optional

If a maximum length is set for the queue it will maintain itself at that maximum length automatically.

Settings for initializing the queue.

Functions

Queue::get
Type

function (q: Queue::Queue) : any

Get a value from the end of a queue.

Parameters

q – The queue to get the value from.

Returns

The value gotten from the queue.

Queue::get_vector
Type

function (q: Queue::Queue, ret: vector of any) : void

Get the contents of the queue as a vector.

Parameters
  • q – The queue.

  • ret – A vector containing the current contents of the queue as the type of ret.

Queue::init
Type

function (s: Queue::Settings &default = [] &optional) : Queue::Queue

Initialize a queue record structure.

Parameters

s – A record which configures the queue.

Returns

An opaque queue record.

Queue::len
Type

function (q: Queue::Queue) : count

Get the number of items in a queue.

Parameters

q – The queue.

Returns

The length of the queue.

Queue::merge
Type

function (q1: Queue::Queue, q2: Queue::Queue) : Queue::Queue

Merge two queues together. If any settings are applied to the queues, the settings from q1 are used for the new merged queue.

Parameters
  • q1 – The first queue. Settings are taken from here.

  • q2 – The second queue.

Returns

A new queue from merging the other two together.

Queue::peek
Type

function (q: Queue::Queue) : any

Peek at the value at the end of the queue without removing it.

Parameters

q – The queue to get the value from.

Returns

The value at the end of the queue.

Queue::put
Type

function (q: Queue::Queue, val: any) : void

Put a value onto the beginning of a queue.

Parameters
  • q – The queue to put the value into.

  • val – The value to insert into the queue.