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)) {}
47 Name(
const char *name,
unsigned long len) :
String(name, len) {}
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())
123 Obj(
unsigned f, L4::Epiface *o)
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));
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)
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;
230 virtual Entry *alloc_dynamic_entry(
Name const &n,
unsigned flags) = 0;
237 virtual void free_dynamic_entry(Entry *e) = 0;
261 virtual int get_epiface(
l4_umword_t data,
bool is_local, L4::Epiface **lo) = 0;
295 virtual void free_epiface(L4::Epiface *epiface) = 0;
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,
Invalid capability selector.
Node * remove(Key_param_type key)
Remove the node with key from the tree.
Pair< Node *, bool > insert(Node *new_node)
Insert a new node into this AVL tree.
unsigned long l4_cap_idx_t
L4 Capability selector Type.
char const * find(char const *c) const
Find character. Return end() if not found.
Abstract server-side implementation of the L4::Namespace interface.
L4::Cap related definitions.
Node * find_node(Key_param_type key) const
find the node with the given key.
Bst::Const_iterator Const_iterator
Constant forward iterator for the tree.
Allocation free string class with explicit length field.
l4_cap_idx_t cap() const
Return capability selector.
unsigned long l4_umword_t
Unsigned machine word.
Server-side copy in buffer for Array.
Attribute for defining an optional RPC argument.
Index start() const
Pointer to first character.
Const_iterator begin() const
Get the constant forward iterator for the first element in the set.
Index end() const
Pointer to first byte behind the string.
Array reference data type for arrays located in the message.
Const_iterator end() const
Get the end marker for the constant forward iterator.
C++ interface for capabilities.
String()
Zero-initialize. Create an invalid string.
Generic RPC wrapper for L4 flex-pages.