File: lookup_request.h

package info (click to toggle)
falcosecurity-libs 0.1.1dev%2Bgit20220316.e5c53d64-5.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,732 kB
  • sloc: cpp: 55,770; ansic: 37,330; makefile: 74; sh: 13
file content (71 lines) | stat: -rw-r--r-- 1,519 bytes parent folder | download
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
#pragma once

#include "container_engine/sinsp_container_type.h"

namespace libsinsp {
namespace container_engine {

struct docker_lookup_request
{
	docker_lookup_request() :
		container_type(CT_DOCKER),
		uid(0),
		request_rw_size(false)
	{}

	docker_lookup_request(const std::string& container_id_value,
			      const std::string& docker_socket_value,
			      sinsp_container_type container_type_value,
			      unsigned long uid_value,
			      bool rw_size_value) :
		container_id(container_id_value),
		docker_socket(docker_socket_value),
		container_type(container_type_value),
		uid(uid_value),
		request_rw_size(rw_size_value)
	{}

	bool operator<(const docker_lookup_request& rhs) const
	{
		if(container_id != rhs.container_id)
		{
			return container_id < rhs.container_id;
		}

		if(docker_socket != rhs.docker_socket)
		{
			return docker_socket < rhs.docker_socket;
		}

		if(container_type != rhs.container_type)
		{
			return container_type < rhs.container_type;
		}

		if(uid != rhs.uid)
		{
			return uid < rhs.uid;
		}

		return request_rw_size < rhs.request_rw_size;
	}

	bool operator==(const docker_lookup_request& rhs) const
	{
		return container_id == rhs.container_id &&
		       docker_socket == rhs.docker_socket &&
		       container_type == rhs.container_type &&
		       uid == rhs.uid &&
		       request_rw_size == rhs.request_rw_size;
	}

	std::string container_id;
	std::string docker_socket;
	sinsp_container_type container_type;
	unsigned long uid;
	bool request_rw_size;
};


}
}