aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/idl.txt
blob: e9c2956b777b0421fe05dc24821c1a97e10bc51e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
libxltypes IDL
--------------

Each type in the libxl interface is represented by an object of type
libxltypes.Type (or a subclass thereof). Every local variable defined
by the .idl file must be an instance of libxltypes.Type (e.g. you may
not define Python functions or any other construct other than defining
variables)

The name of the type must be passed as the first argument to the
constructor when defining a new type. The name given should not
contain the initial namespace element (e.g. "libxl_"). See below for
how to specify a namespace.

The Type.typename contains the C name of the type _including_ the
namespace element while Type.rawname is always set to the 'base' name
of the type.

The libxltypes.Type base class has several other properties which
apply to all types. The properties are set by passing a named
parameter to the constructor.

Type.comment:

  A free text comment which describes the type.

Type.namespace: (default: "libxl_")

 The namespace in which the type resides. Usually this is "libxl_" but
 system defined and builtin types may differ.

 If the typename is not None then the namespace is prepended to the
 type.
 
Type.passby: (default: libxltypes.PASS_BY_VALUE)

 Defines the manner in which a type should be passed to C
 functions. Valid values for this fields are:
   libxltypes.PASS_BY_VALUE
   libxltypes.PASS_BY_REFERENCE

Type.dispose_fn: (default: typename + "_dispose" or None if type == None)

 The name of the C function which will free all dynamically allocated
 memory contained within this type (but not the type itself).

Type.autogenerate_dispose_fn: (default: True)

 Indicates if the above named Type.dispose_fn should be
 autogenerated.

Type.json_fn: (default: typename + "_gen_json" or None if type == None)

 The name of the C function which will generate a YAJL data structure
 representing this type.

Type.autogenerate_json: (default: True)

 Indicates if the above named Type.json_fn should be autogenerated.

Other simple type-Classes
-------------------------

libxltype.Builtin

 Instances of this class represent types which are predefined within
 the system.

libxltype.UInt

 Instances of this class represent the standard uint<N>_t types.

 The <N> for a given instance must be passed to the constructor and is
 then available in UInt.width

Complex type-Classes
--------------------

libxltype.Enumeration

  A class representing an enumeration (named integer values).

  The values are available in the list Enumeration.values. Each
  element in the list is of type libxltype.EnumerationValue.

  Each EnumerationValue has the following properties:

    EnumerationValue.enum	Reference to containing Enumeration
    EnumerationValue.name       The C name of this value, including
                                    the namespace and typename of the
                                    containing Enumeration (e.g.
                                    "LIBXL_FOOENUM_VALUE")
    EnumerationValue.rawname    The C name of this value, excluding
                                    the namespace but including the
                                    typename of the containing
                                    Enumeration (e.g. "FOOENUM_VALUE")
    EnumerationValue.valuename	The name of this value, excluding the
				    name of the containing Enumeration
				    and any namespace (e.g. "VALUE")
    EnumerationValue.value	The integer value associated with this name.
    EnumerationValue.comment	A free text comment which describes the member.

libxltype.Aggregate

 Base class for type-Classes which contain a number of other types
 (e.g. structs and unions).

 The contained types are available in the list Aggregate.fields. Each
 element in the list is of type libxltype.Field representing a member
 of the aggregate.

 Each field has the following properties:

  Field.type	The type of the member (a libxltypes.Type).
  Field.name    The name of the member (can be None for anonymous
		fields).
  Field.const	Boolean, true if the member is const.
  Field.comment	A free text comment which describes the member.

libxltype.Struct

 A subclass of libxltype.Aggregate representing the C struct type.

 Struct.kind == "struct"

libxltype.Union

 A subclass of libxltype.Aggregate representing the C union type.

 Union.kind == "union"

libxltype.KeyedUnion

 A subclass of libxltype.Aggregate which represents the C union type
 where the currently valid member of the union can be determined based
 upon another member in the containing type.

 The KeyedUnion.keyvar_name must contain the name of the member of the
 containing type which determines the valid member of the union. The
 member referenced by KeyedUnion.keyvar_name has type
 KeyedUnion.keyvar_type which must be an instance of the Enumeration type.

Standard Types
--------------

Several standard types a predefined. They are

void			(void pointer type)
bool
size_t
integer			24 bit signed integer.

uint{8,16,32,64}	uint{8,16,32,64}_t

domid			Domain ID

string			NULL terminated string

inaddr_ip		struct in_addr