This file is indexed.

/usr/share/bro/base/utils/queue.bro is in bro-common 2.5-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
##! A FIFO queue.

module Queue;

export {
	## Settings for initializing the queue.
	type Settings: record {
		## If a maximum length is set for the queue
		## it will maintain itself at that
		## maximum length automatically.
		max_len: count &optional;
	};

	## The internal data structure for the queue.
	type Queue: record {};

	## Initialize a queue record structure.
	##
	## s: A record which configures the queue.
	##
	## Returns: An opaque queue record.
	global init:       function(s: Settings &default=[]): Queue;

	## Put a value onto the beginning of a queue.
	##
	## q: The queue to put the value into.
	##
	## val: The value to insert into the queue.
	global put:       function(q: Queue, val: any);

	## Get a value from the end of a queue.
	##
	## q: The queue to get the value from.
	##
	## Returns: The value gotten from the queue.
	global get:        function(q: Queue): any;

	## Peek at the value at the end of the queue without removing it.
	##
	## q: The queue to get the value from.
	##
	## Returns: The value at the end of the queue.
	global peek:      function(q: Queue): any;

	## Merge two queues together.  If any settings are applied
	## to the queues, the settings from *q1* are used for the new
	## merged queue.
	##
	## q1: The first queue.  Settings are taken from here.
	##
	## q2: The second queue.
	##
	## Returns: A new queue from merging the other two together.
	global merge:      function(q1: Queue, q2: Queue): Queue;

	## Get the number of items in a queue.
	##
	## q: The queue.
	##
	## Returns: The length of the queue.
	global len:     function(q: Queue): count;

	## Get the contents of the queue as a vector.
	##
	## q: The queue.
	##
	## ret: A vector containing the current contents of the queue
	##      as the type of ret.
	global get_vector: function(q: Queue, ret: vector of any);

}

redef record Queue += {
	# Indicator for if the queue was appropriately initialized.
	initialized: bool                   &default=F;
	# The values are stored here.
	vals:        table[count] of any &optional;
	# Settings for the queue.
	settings:    Settings               &optional;
	# The top value in the vals table.
	top:         count                  &default=0;
	# The bottom value in the vals table.
	bottom:      count                  &default=0;
	# The number of bytes in the queue.
	size:        count                  &default=0;
};

function init(s: Settings): Queue
	{
	local q: Queue;
	q$vals=table();
	q$settings = copy(s);
	q$initialized=T;
	return q;
	}

function put(q: Queue, val: any)
	{
	if ( q$settings?$max_len && len(q) >= q$settings$max_len )
		get(q);
	q$vals[q$top] = val;
	++q$top;
	}

function get(q: Queue): any
	{
	local ret = q$vals[q$bottom];
	delete q$vals[q$bottom];
	++q$bottom;
	return ret;
	}

function peek(q: Queue): any
	{
	return q$vals[q$bottom];
	}

function merge(q1: Queue, q2: Queue): Queue
	{
	local ret = init(q1$settings);
	local i = q1$bottom;
	local j = q2$bottom;
	for ( ignored_val in q1$vals )
		{
		if ( i in q1$vals )
			put(ret, q1$vals[i]);
		if ( j in q2$vals )
			put(ret, q2$vals[j]);
		++i;
		++j;
		}
	return ret;
	}

function len(q: Queue): count
	{
	return |q$vals|;
	}

function get_vector(q: Queue, ret: vector of any)
	{
	local i = q$bottom;
	local j = 0;
	# Really dumb hack, this is only to provide
	# the iteration for the correct number of
	# values in q$vals.
	for ( ignored_val in q$vals )
		{
		if ( i >= q$top )
			break;

		ret[j] = q$vals[i];
		++j; ++i;
		}
	}