13namespace L4 {
namespace Ipc {
15template<
typename CHAR =
char const,
typename LEN =
unsigned long>
16struct String : Array<CHAR, LEN>
18 static LEN strlength(CHAR *d) { LEN l = 0;
while (d[l]) ++l;
return l; }
20 String(CHAR *d) :
Array<CHAR, LEN>(strlength(d) + 1, d) {}
21 String(LEN len, CHAR *d) :
Array<CHAR, LEN>(len, d) {}
22 void copy_in(CHAR
const *s)
28 for (i = 0; i < this->length - 1 && s[i]; ++i)
31 this->data[i] = CHAR();
35#if __cplusplus >= 201103L
36template<
typename CHAR = char,
typename LEN_TYPE =
unsigned long,
37 LEN_TYPE MAX = (L4_UTCB_GENERIC_DATA_SIZE *
39using String_in_buf = Array_in_buf<CHAR, LEN_TYPE, MAX>;
43template<
typename A,
typename LEN>
44struct Clnt_xmit< String<A, LEN> > : Clnt_xmit< Array<A, LEN> > {};
46template<
typename A,
typename LEN,
typename CLASS>
47struct Svr_val_ops< String<A, LEN>, Dir_in, CLASS >
48: Svr_val_ops< Array_ref<A, LEN>, Dir_in, CLASS >
50 typedef Svr_val_ops< Array_ref<A, LEN>, Dir_in, CLASS > Base;
51 typedef typename Base::svr_type svr_type;
53 static int to_svr(
char *msg,
unsigned offset,
unsigned limit,
54 svr_type &a, Dir_in dir, Cls_data cls)
56 int r = Base::to_svr(msg, offset, limit, a, dir, cls);
64 typedef typename L4::Types::Remove_const<A>::type elem_type;
65 const_cast<elem_type*
>(a.data)[a.length - 1] = A();
70template<
typename A,
typename LEN>
71struct Clnt_xmit<String<A, LEN> &> : Clnt_xmit<Array<A, LEN> &>
73 typedef Array<A, LEN> &type;
75 using Clnt_xmit<type>::from_msg;
76 static int from_msg(
char *msg,
unsigned offset,
unsigned limit,
long ret,
77 Array<A, LEN> &a, Dir_out dir, Cls_data cls)
79 int r = Clnt_xmit<type>::from_msg(msg, offset, limit, ret, a, dir, cls);
87 a.data[a.length - 1] = A();
92template<
typename A,
typename LEN>
93struct Clnt_xmit<String<A, LEN> *> : Clnt_xmit<String<A, LEN> &> {};
95template<
typename A,
typename LEN,
typename CLASS>
96struct Svr_val_ops<String<A, LEN>, Dir_out, CLASS>
97: Svr_val_ops<Array_ref<A, LEN>, Dir_out, CLASS>
100template<
typename A,
typename LEN>
102template<
typename A,
typename LEN>
unsigned long l4_umword_t
Unsigned machine word.
@ L4_EMSGTOOSHORT
Message too short.
L4 low-level kernel interface.