mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-16 09:50:18 +00:00
1fde4d638c
This patch equips init with the ability to act as a server that forwards session requests to its children. Session requests can be routed depending of the requested service type and the session label originating from init's parent. The feature is configured by one or multiple <service> nodes hosted in init's <config> node. The routing policy is selected by via the regular server-side policy-selection mechanism, for example: <config> ... <service name="LOG"> <policy label="noux"> <child name="terminal_log" label="important"/> </policy> <default-policy> <child name="nitlog"/> </default-policy> </service> ... </config> Each policy node must have a <child> sub node, which denotes name of the server with the 'name' attribute. The optional 'label' attribute defines the session label presented to the server, analogous to how the rewriting of session labels works in session routes. If not specified, the client-provided label is presented to the server as is. Fixes #2247
59 lines
1.2 KiB
C++
59 lines
1.2 KiB
C++
/*
|
|
* \brief Utility for buffering XML nodes
|
|
* \author Norman Feske
|
|
* \date 2017-03-03
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2017 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU Affero General Public License version 3.
|
|
*/
|
|
|
|
#ifndef _SRC__INIT__BUFFERED_XML_H_
|
|
#define _SRC__INIT__BUFFERED_XML_H_
|
|
|
|
/* Genode includes */
|
|
#include <util/xml_node.h>
|
|
|
|
namespace Init { class Buffered_xml; }
|
|
|
|
|
|
class Init::Buffered_xml
|
|
{
|
|
private:
|
|
|
|
Allocator &_alloc;
|
|
char const * const _ptr; /* pointer to dynamically allocated buffer */
|
|
Xml_node const _xml; /* referring to buffer of '_ptr' */
|
|
|
|
/**
|
|
* \throw Allocator::Out_of_memory
|
|
*/
|
|
static char const *_init_ptr(Allocator &alloc, Xml_node node)
|
|
{
|
|
char *ptr = (char *)alloc.alloc(node.size());
|
|
Genode::memcpy(ptr, node.addr(), node.size());
|
|
return ptr;
|
|
}
|
|
|
|
public:
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* \throw Allocator::Out_of_memory
|
|
*/
|
|
Buffered_xml(Allocator &alloc, Xml_node node)
|
|
:
|
|
_alloc(alloc), _ptr(_init_ptr(alloc, node)), _xml(_ptr, node.size())
|
|
{ }
|
|
|
|
~Buffered_xml() { _alloc.free(const_cast<char *>(_ptr), _xml.size()); }
|
|
|
|
Xml_node xml() const { return _xml; }
|
|
};
|
|
|
|
#endif /* _SRC__INIT__BUFFERED_XML_H_ */
|