blob: d846f3249177d3e337d728ce8db3f33a43a0deb8 [file] [log] [blame]
// Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef VM_TOOLS_CONCIERGE_VSOCK_CID_POOL_H_
#define VM_TOOLS_CONCIERGE_VSOCK_CID_POOL_H_
#include <stdint.h>
#include <base/macros.h>
namespace vm_tools {
namespace concierge {
// Manages a pool of virtual socket context IDs to be assigned to VMs.
class VsockCidPool {
public:
VsockCidPool() = default;
~VsockCidPool() = default;
// Allocates and returns a vsock context id. Returns 0 if it is unable to
// allocate a cid because 0 is a reserved cid.
uint32_t Allocate();
private:
DISALLOW_COPY_AND_ASSIGN(VsockCidPool);
};
} // namespace concierge
} // namespace vm_tools
#endif // VM_TOOLS_CONCIERGE_VSOCK_CID_POOL_H_