23 #include <l4/cxx/std_ops>
24 #include <l4/sys/cxx/ipc_epiface>
25 #include <l4/cxx/string>
32 namespace L4Re {
namespace Util {
46 Name(
const char *name =
"") :
String(name, __builtin_strlen(name)) {}
49 char const *name()
const {
return start(); }
50 bool operator < (
Name const &r)
const;
76 F_rights_mask = F_rw | F_strong | F_trusted,
85 unsigned flags()
const {
return _f; }
86 void restrict_flags(
unsigned max_rights)
87 { _f &= (~F_rights_mask | (max_rights & F_rights_mask)); }
89 bool is_rw()
const {
return (_f & F_rw) == F_rw; }
90 bool is_strong()
const {
return _f & F_strong; }
92 bool is_valid()
const {
return _f & F_cap; }
93 bool is_complete()
const {
return is_valid(); }
94 bool is_local()
const {
return _f & F_local; }
95 bool is_replacable()
const {
return _f & F_replacable; }
96 bool is_trusted()
const {
return _f & F_trusted; }
98 L4::Epiface *obj()
const {
if (is_local())
return _obj;
return 0; }
105 return _obj->obj_cap();
109 void set(Obj
const &o,
unsigned flags)
112 restrict_flags(flags);
115 explicit Obj(
unsigned flags = 0)
120 : _f((f & ~F_base_mask) | F_cap), _cap(cap.cap())
124 : _f((f & ~F_base_mask) | F_cap | F_local), _obj(o)
127 void reset(
unsigned flags)
129 _f = (_f & F_replacable) | (flags & ~(F_cap | F_local));
143 friend class Name_space;
150 Entry(Name
const &n, Obj
const &o,
bool dynamic =
false)
151 : _n(n), _o(o), _dynamic(dynamic) {}
153 Name
const &name()
const {
return _n; }
154 Obj
const *obj()
const {
return &_o; }
155 Obj *obj() {
return &_o; }
156 void obj(Obj
const &o) { _o = o; }
158 bool is_placeholder()
const
159 {
return !obj()->is_complete(); }
161 bool is_dynamic()
const {
return _dynamic; }
163 void set(Obj
const &o);
166 void *
operator new (
size_t s);
167 void operator delete(
void *b);
173 typedef Name Key_type;
174 static Key_type
const &key_of(Entry
const *e)
175 {
return e->name(); }
193 L4Re::Util::Dbg
const &_dbg;
194 L4Re::Util::Err
const &_err;
200 Const_iterator begin()
const {
return _tree.
begin(); }
201 Const_iterator end()
const {
return _tree.
end(); }
203 Name_space(L4Re::Util::Dbg
const &dbg, L4Re::Util::Err
const &err)
204 : _dbg(dbg), _err(err)
209 Entry *find(
Name const &name)
const {
return _tree.
find_node(name); }
210 Entry *remove(
Name const &name) {
return _tree.
remove(name); }
211 Entry *find_iter(
Name const &name)
const;
212 bool insert(Entry *e) {
return _tree.
insert(e).second; }
214 void dump(
bool rec =
false,
int indent = 0)
const;
297 int insert_entry(
Name const &name,
unsigned flags, Entry **e);
301 int op_query(L4Re::Namespace::Rights,
306 int op_register_obj(L4Re::Namespace::Rights,
unsigned flags,
310 int op_unlink(L4Re::Namespace::Rights r,
L4::Cap related definitions.
@ Trusted
Obsolete, do not use.
Abstract server-side implementation of the L4::Namespace interface.
virtual void free_dynamic_entry(Entry *e)=0
Free an entry previously allocated with alloc_dynamic_entry().
virtual int get_epiface(l4_umword_t data, bool is_local, L4::Epiface **lo)=0
Return a pointer to the epiface assigned to a given label.
virtual Entry * alloc_dynamic_entry(Name const &n, unsigned flags)=0
Allocate a new entry for the given name.
virtual int copy_receive_cap(L4::Cap< void > *cap)=0
Return the receive capability for permanent use.
virtual void free_capability(L4::Cap< void > cap)=0
Free a capability previously acquired with copy_receive_cap().
virtual void free_epiface(L4::Epiface *epiface)=0
Free epiface previously acquired with get_epiface().
C++ interface for capabilities.
Generic RPC wrapper for L4 flex-pages.
Pair< Node *, bool > insert(Node *new_node)
Insert a new node into this AVL tree.
Node * remove(Key_param_type key)
Remove the node with key from the tree.
Bst::Const_iterator Const_iterator
Constant forward iterator for the tree.
Node * find_node(Key_param_type key) const
find the node with the given key.
Const_iterator end() const
Get the end marker for the constant forward iterator.
Const_iterator begin() const
Get the constant forward iterator for the first element in the set.
Allocation free string class with explicit length field.
Index start() const
Pointer to first character.
String()
Zero-initialize. Create an invalid string.
unsigned long l4_umword_t
Unsigned machine word.
unsigned long l4_cap_idx_t
L4 Capability selector Type.
@ L4_INVALID_CAP
Invalid capability selector.
Base class for interface implementations.
Server-side copy in buffer for Array.
Array reference data type for arrays located in the message.
Attribute for defining an optional RPC argument.