summaryrefslogtreecommitdiff
path: root/ovsdb/ovsdb-idlc.1
blob: 1e9f30ca7f644c17323511fec102a805cdd19535 (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
.\" -*- nroff -*-
.de IQ
.  br
.  ns
.  IP "\\$1"
..
.TH ovsdb\-idlc 1 "November 2009" "Open vSwitch" "Open vSwitch Manual"
.ds PN ovsdb\-idlc
.
.SH NAME
ovsdb\-idlc \- Open vSwitch IDL (Interface Definition Language) compiler
.
.SH SYNOPSIS
\fBovsdb\-idlc \fBannotate\fI schema annotations\fR
.br
\fBovsdb\-idlc \fBc\-idl\-header\fI idl\fR
.br
\fBovsdb\-idlc \fBc\-idl\-source\fI idl\fR
.br
\fBovsdb\-idlc \-\-help\fR
.br
\fBovsdb\-idlc \-\-version\fR
.
.SH DESCRIPTION
The \fBovsdb\-idlc\fR program is a command-line tool for translating
Open vSwitch database interface definition language (IDL) schemas into
other formats.  It is used while building Open vSwitch, not at
installation or configuration time.  Thus, it is not normally
installed as part of Open vSwitch.
.
.PP
The \fIidl\fR files used as input for most \fBovsdb\-idlc\fR commands
have the same format as the OVSDB schemas, specified in the OVSDB
specification, with a few additions:
.
.IP """\fBidlPrefix\fR"" member of <database-schema>"
This member, which is required, specifies a string that is prefixed to
top-level names in C bindings.  It should probably end in an
underscore.
.
.IP """\fBidlHeader\fR"" member of <database-schema>"
This member, which is required, specifies the name of the IDL header.
It will be output on an \fB#include\fR line in the source file
generated by the C bindings.  It should include the bracketing
\fB""\fR or \fB<>\fR.
.
.IP """\fBcDecls\fR"" member of <database-schema>"
.IQ """\fBhDecls\fR"" member of <database-schema>"
These optional members may specify arbitrary code to include in the
generated \fB.c\fR or \fB.h\fR file, respectively, in each case just
after the \fB#include\fR directives in those files.
.
.IP """\fBextensions\fR"" member of <table-schema>"
.IQ """\fBextensions\fR"" member of <column-schema>"
This member is optional.  If specified, it is an object whose contents
describes extensions to the OVSDB schema language, for the purpose of
specifying interpretation by the IDL.
.
.IP """\fBsynthetic\fR"" member of <column-schema> ""\fBextensions\fR"" object"
If this optional member is set to \fBtrue\fR, then it indicates that
the column is not expected to be found in the actual database.
Instead, code supplied by the IDL's client fills in the desired
structure members based on the value of one or more other database
columns.  This can be used to cache the result of a calculation, for
example.
.
.IP """\fBparse\fR"" member of <column-schema> ""\fBextensions\fR"" object"
This member should be present if and only if the column is synthetic.
It should be a string that contains C code to set the value of the
column's member in an object named \fBrow\fR, e.g. "\fBrow->column =
1;\fR" if the column's name is \fBcolumn\fR and has integer type.  The
code may rely on the columns named in \fBdependencies\fR to be
initialized.  The function can get called for rows that do not satisfy
the constraints in the schema, e.g. that a pointer to another is
nonnull, so it must not rely on those constraints.
.
.IP """\fBunparse\fR"" member of <column-schema> ""\fBextensions\fR"" object"
This member is honored only if the column is synthetic.  It should be
a string that contains C code to free the data in the column's member
in an object named \fBrow\fR, e.g. "\fBfree(row->column);\fR" if the
column's name is \fBcolumn\fR and points to data that was allocated by
the \fBparse\fR function and needs to be freed.
.
.IP """\fBdependencies\fR"" member of <column-schema> ""\fBextensions\fR"" object"
This member should be a list of the names of columns whose values are
used by the code in \fBparse\fR and \fBunparse\fR.  The IDL ensures
that dependencies are parsed before the columns that depends on them,
and vice versa for unparsing.
.SS "Commands"
.IP "\fBannotate\fI schema annotations\fR"
Reads \fIschema\fR, which should be a file in JSON format (ordinarily
an OVSDB schema file), then reads and executes the Python syntax
fragment in \fIannotations\fR.  The Python syntax fragment is passed
the JSON object as a local variable named \fBs\fR.  It may modify this
data in any way.  After the Python code returns, the object as
modified is re-serialized as JSON on standard output.
.
.IP "\fBc\-idl\-header\fI idl\fR"
Reads \fIidl\fR and prints on standard output a C header file that
defines a structure for each table defined by the schema.  If a column
name in \fIidl\fR is a C or C++ keyword, it will be appended with an
underscore.
.
.IP "\fBc\-idl\-source\fI idl\fR"
Reads \fIidl\fR and prints on standard output a C source file that
implements C bindings for the database defined by the schema.  If a column
name in \fIidl\fR is a C or C++ keyword, it will be appended with an
underscore.
.
.SS "Options"
.so lib/common.man
.
.SH "BUGS"
\fBovsdb\-idlc\fR is more lenient about the format of OVSDB schemas
than other OVSDB tools.  It may successfully parse schemas that, e.g.,
\fBovsdb\-tool\fR rejects.
.
.SH "SEE ALSO"
The OVSDB specification.