4 * \brief Meta interface for getting dynamic type information
5 * about objects behind capabilities.
9 * (c) 2008-2009 Alexander Warg <warg@os.inf.tu-dresden.de>
10 * economic rights: Technische Universität Dresden (Germany)
12 * This file is part of TUD:OS and distributed under the terms of the
13 * GNU General Public License 2.
14 * Please see the COPYING-GPL-2 file for details.
16 * As a special exception, you may use this file as part of a free software
17 * library without restriction. Specifically, if other files instantiate
18 * templates or use macros or inline functions from this file, or you compile
19 * this file and link it with other files to produce an executable, this
20 * file does not by itself cause the resulting executable to be covered by
21 * the GNU General Public License. This exception does not however
22 * invalidate any other reasons why the executable file might be covered by
23 * the GNU General Public License.
28 #include <l4/sys/capability>
32 * \addtogroup l4_kernel_object_api
37 * \brief Meta interface that shall be implemented by each L4Re object
38 * and gives access to the dynamic type information for
41 class Meta : public Kobject_t<Meta, Kobject, L4_PROTO_META>
54 * \brief Get the number of interfaces implemented by this object.
55 * \param utcb is the utcb to use for sending the message.
56 * \return The message tag for the operation, the label (l4_msgtag_t::label())
57 * is set to the number of interfaces if successful, or to -error
58 * when an error occured.
60 l4_msgtag_t num_interfaces(l4_utcb_t *utcb = l4_utcb()) throw();
63 * \brief Get the protocol number that must be used for the interface with
65 * \param idx is the index of the interface to get the protocol number for.
66 * \a idx must be \>= 0 and \< the return value of
68 * \param utcb is the utcb to use for sending the message.
69 * \return System call return tag. Negative label on error,
70 * success with value 0 in label.
72 l4_msgtag_t interface(int idx, l4_utcb_t *u = l4_utcb()) throw();
75 * \brief Figure out if the object supports the given \a protocol (number).
76 * \param protocol is the protocol number to check for.
77 * \param utcb is the utcb to use for sending the message.
78 * \return The message tag for the operation, the label (l4_msgtag_t::label())
79 * is set to 1 if \a protocol is supported to 0 if not.
81 * This method is intended to be used for statically assigned protocol
84 l4_msgtag_t supports(long protocol, l4_utcb_t *u = l4_utcb()) throw();
90 Meta::num_interfaces(l4_utcb_t *u) throw()
92 l4_msg_regs_t *mr = l4_utcb_mr_u(u);
93 mr->mr[0] = O_num_ifaces;
94 return l4_ipc_call(cap(), u, l4_msgtag(Protocol, 1, 0, 0),
99 Meta::interface(int idx, l4_utcb_t *u) throw()
101 l4_msg_regs_t *mr = l4_utcb_mr_u(u);
104 return l4_ipc_call(cap(), u, l4_msgtag(Protocol, 2, 0, 0),
109 Meta::supports(long protocol, l4_utcb_t *u) throw()
111 l4_msg_regs_t *mr = l4_utcb_mr_u(u);
112 mr->mr[0] = O_supports;
113 mr->mr[1] = protocol;
114 return l4_ipc_call(cap(), u, l4_msgtag(Protocol, 2, 0, 0),