// Copyright 2018 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include #include #include #include namespace svc { Outgoing::Outgoing(async_dispatcher_t* dispatcher) : vfs_(dispatcher), root_dir_(fbl::MakeRefCounted()), public_dir_(fbl::MakeRefCounted()) { root_dir_->AddEntry("public", public_dir_); } Outgoing::~Outgoing() = default; zx_status_t Outgoing::Serve(zx::channel dir_request) { if (!dir_request) return ZX_ERR_BAD_HANDLE; return vfs_.ServeDirectory(root_dir_, std::move(dir_request)); } zx_status_t Outgoing::ServeFromStartupInfo() { zx_handle_t dir_request = zx_take_startup_handle(PA_DIRECTORY_REQUEST); return Serve(zx::channel(dir_request)); } } // namespace svc