class OutgoingDirectory
Defined at line 34 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
Driver specific implementation for an outgoing directory that wraps around
|component::OutgoingDirectory|.
# Thread safety
This class is thread-unsafe. Instances must be managed and used from tasks
running on the |fdf_dispatcher_t|, and the dispatcher must be synchronized.
See
https://fuchsia.dev/fuchsia-src/development/languages/c-cpp/thread-safe-async#mutual-exclusion-guarantee
Public Methods
void OutgoingDirectory (OutgoingDirectory && )
OutgoingDirectory can be moved. Once moved, invoking a method on an
instance will yield undefined behavior.
Defined at line 10 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.cc
OutgoingDirectory & operator= (OutgoingDirectory && )
Defined at line 15 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.cc
OutgoingDirectory Create (fdf_dispatcher_t * dispatcher)
Defined at line 36 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
void OutgoingDirectory (fdf_dispatcher_t * dispatcher)
Defined at line 42 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
void OutgoingDirectory (const OutgoingDirectory & )
OutgoingDirectory cannot be copied.
Defined at line 52 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
OutgoingDirectory & operator= (const OutgoingDirectory & )
Defined at line 53 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
template <typename TransportHandler, typename Service>
zx::result<> AddService (TransportHandler handler, std::string_view instance)
Adds an instance of a FIDL Service.
A |handler| is added to provide an |instance| of a service.
The template type |Service| must be the generated type representing a FIDL Service.
The template type must be a specialization of |fidl::ServiceInstanceHandler
<Transport
>|
where Transport must be either |fidl::internal::ChannelTransport| for |zx::channel|
transports, or |fidl::internal::DriverTransport| for |fdf::Channel| transport. Users
should not use this method directly and instead should use the specialization
for |component::ServiceInstanceHandler| and |fdf::ServiceInstanceHandler|
instead.
# Errors
ZX_ERR_ALREADY_EXISTS: The instance already exists.
ZX_ERR_INVALID_ARGS: |instance| is an empty string or |handler| is empty.
Defined at line 73 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
template <typename Service>
zx::result<> AddService (fdf::ServiceInstanceHandler handler, std::string_view instance)
Same as above but strictly for services using the driver channel transport.
Defined at line 123 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
template <typename Service>
zx::result<> AddService (component::ServiceInstanceHandler handler, std::string_view instance)
Same as above but strictly for services using the Zircon channel transport.
Defined at line 130 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
zx::result<> Serve (fidl::ServerEnd<fuchsia_io::Directory> directory_server_end)
Starts serving the outgoing directory on the given channel. This should
be invoked after the outgoing directory has been populated, e.g. via
|AddService|.
This object will implement the |fuchsia.io.Directory| interface using this
channel. Note that this method returns immediately and that the |dispatcher|
provided to the constructor will be responsible for processing messages
sent to the server endpoint.
# Errors
ZX_ERR_BAD_HANDLE: |directory_server_end| is not a valid handle.
ZX_ERR_ACCESS_DENIED: |directory_server_end| has insufficient rights.
Defined at line 155 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
zx::result<> AddDirectory (fidl::ClientEnd<fuchsia_io::Directory> remote_dir, std::string_view directory_name)
Serve a subdirectory at the root of this outgoing directory.
The directory will be installed under the path |directory_name|. When
a request is received under this path, then it will be forwarded to
|remote_dir|.
# Errors
ZX_ERR_ALREADY_EXISTS: An entry with the provided name already exists.
ZX_ERR_BAD_HANDLE: |remote_dir| is an invalid handle.
ZX_ERR_INVALID_ARGS: |directory_name| is an empty string.
Defined at line 172 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
zx::result<> AddDirectoryAt (fidl::ClientEnd<fuchsia_io::Directory> remote_dir, std::string_view path, std::string_view directory_name)
Same as |AddDirectory| but allows setting the parent directory
in which the directory will be installed.
Defined at line 179 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
template <typename Service>
zx::result<> RemoveService (std::string_view instance)
Removes an instance of a FIDL Service.
# Errors
ZX_ERR_NOT_FOUND: The instance was not found.
# Example
```
outgoing.RemoveService
<lib
_example::MyService>("my-instance");
```
Defined at line 196 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
zx::result<> RemoveService (std::string_view service, std::string_view instance)
Same as above but untyped.
Defined at line 201 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
zx::result<> RemoveDirectory (std::string_view directory_name)
Removes the subdirectory on the provided |directory_name|.
# Errors
ZX_ERR_NOT_FOUND: No entry was found with provided name.
Defined at line 211 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
zx::result<> RemoveDirectoryAt (std::string_view path, std::string_view directory_name)
Same as |RemoveDirectory| but allows specifying the parent directory
that the directory will be removed from. The parent directory, |path|,
will not be removed.
Defined at line 218 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
std::unordered_map<std::string, std::unordered_set<std::string>> GetDriverServices ()
Defined at line 222 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
std::unordered_map<std::string, std::unordered_set<std::string>> GetZirconServices ()
Defined at line 226 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h
component::OutgoingDirectory & component ()
Get the underlying component outgoing directory. These APIs will only support
FIDL, they do not support DriverTransport.
Defined at line 232 of file ../../sdk/lib/driver/outgoing/cpp/outgoing_directory.h