summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2007-06-29 13:23:13 +0000
committerDaniel Veillard <veillard@redhat.com>2007-06-29 13:23:13 +0000
commitb4c282a79bc0d60609624eaa7193b511477dfa46 (patch)
treee1a50daddcbf064b91fdfb413d1ade34f35fad6c
parent4c0f24c10f5fa8d87b57f04374c3b85c79976e95 (diff)
downloadlibvirt-b4c282a79bc0d60609624eaa7193b511477dfa46.tar.gz
* docs/apibuild.py docs/newapi.xsl: fix generation of XML and
stylesheet * docs/*: regenerated * src/bridge.c src/bridge.h src/buf.c src/iptables.c src/libvirt.c src/qemu_driver.c src/qemu_driver.h src/uuid.c src/uuid.h: cleanup, addd comments, made functions static and fixe a few bugs Daniel
-rw-r--r--ChangeLog9
-rw-r--r--docs/APIchunk0.html4
-rwxr-xr-xdocs/apibuild.py11
-rw-r--r--docs/devhelp/libvirt-libvirt.html8
-rw-r--r--docs/examples/.cvsignore2
-rw-r--r--docs/examples/Makefile.am14
-rw-r--r--docs/examples/examples.xml50
-rw-r--r--docs/html/libvirt-libvirt.html8
-rw-r--r--docs/libvirt-api.xml8
-rw-r--r--docs/libvirt-refs.xml6
-rw-r--r--docs/newapi.xsl11
-rw-r--r--src/bridge.c176
-rw-r--r--src/bridge.h9
-rw-r--r--src/buf.c30
-rw-r--r--src/iptables.c203
-rw-r--r--src/libvirt.c4
-rw-r--r--src/qemu_driver.c133
-rw-r--r--src/qemu_driver.h81
-rw-r--r--src/uuid.c24
-rw-r--r--src/uuid.h4
20 files changed, 597 insertions, 198 deletions
diff --git a/ChangeLog b/ChangeLog
index 3a2e3e7d72..a387e53534 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Fri Jun 29 15:18:36 CEST 2007 Daniel Veillard <veillard@redhat.com>
+
+ * docs/apibuild.py docs/newapi.xsl: fix generation of XML and
+ stylesheet
+ * docs/*: regenerated
+ * src/bridge.c src/bridge.h src/buf.c src/iptables.c src/libvirt.c
+ src/qemu_driver.c src/qemu_driver.h src/uuid.c src/uuid.h: cleanup,
+ addd comments, made functions static and fixe a few bugs
+
Tue Jun 29 13:44:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* docs/site.xsl, docs/libvir.html, docs/hvsupport.html:
diff --git a/docs/APIchunk0.html b/docs/APIchunk0.html
index 9cca4a7cbc..af33c757fa 100644
--- a/docs/APIchunk0.html
+++ b/docs/APIchunk0.html
@@ -125,10 +125,12 @@
<a href="html/libvirt-libvirt.html#virConnectNumOfDomains">virConnectNumOfDomains</a><br />
<a href="html/libvirt-libvirt.html#virConnectNumOfNetworks">virConnectNumOfNetworks</a><br />
<a href="html/libvirt-libvirt.html#virDomainGetAutostart">virDomainGetAutostart</a><br />
+<a href="html/libvirt-libvirt.html#virDomainGetConnect">virDomainGetConnect</a><br />
<a href="html/libvirt-libvirt.html#virDomainGetMaxVcpus">virDomainGetMaxVcpus</a><br />
<a href="html/libvirt-libvirt.html#virGetVersion">virGetVersion</a><br />
<a href="html/libvirt-libvirt.html#virNetworkGetAutostart">virNetworkGetAutostart</a><br />
<a href="html/libvirt-libvirt.html#virNetworkGetBridgeName">virNetworkGetBridgeName</a><br />
+<a href="html/libvirt-libvirt.html#virNetworkGetConnect">virNetworkGetConnect</a><br />
</dd></dl><h2>Letter R:</h2><dl><dt>RFC4122</dt><dd><a href="html/libvirt-libvirt.html#virDomainGetUUIDString">virDomainGetUUIDString</a><br />
<a href="html/libvirt-libvirt.html#virNetworkGetUUIDString">virNetworkGetUUIDString</a><br />
</dd><dt>Read-Only</dt><dd><a href="html/libvirt-libvirt.html#virConnectGetVersion">virConnectGetVersion</a><br />
@@ -138,8 +140,6 @@
<a href="html/libvirt-virterror.html#virResetLastError">virResetLastError</a><br />
</dd><dt>Resume</dt><dd><a href="html/libvirt-libvirt.html#virDomainResume">virDomainResume</a><br />
</dd><dt>Retrieve</dt><dd><a href="html/libvirt-libvirt.html#virDomainGetMaxMemory">virDomainGetMaxMemory</a><br />
-</dd><dt>Returns</dt><dd><a href="html/libvirt-libvirt.html#virDomainGetConnect">virDomainGetConnect</a><br />
-<a href="html/libvirt-libvirt.html#virNetworkGetConnect">virNetworkGetConnect</a><br />
</dd></dl><h2>Letter S:</h2><dl><dt>See</dt><dd><a href="html/libvirt-libvirt.html#virConnectGetType">virConnectGetType</a><br />
</dd><dt>Set</dt><dd><a href="html/libvirt-virterror.html#virConnSetErrorFunc">virConnSetErrorFunc</a><br />
<a href="html/libvirt-virterror.html#virSetErrorFunc">virSetErrorFunc</a><br />
diff --git a/docs/apibuild.py b/docs/apibuild.py
index dd7670495a..4cf6454cd0 100755
--- a/docs/apibuild.py
+++ b/docs/apibuild.py
@@ -51,6 +51,17 @@ ignored_files = {
"console.c": "internal code",
"event.h": "internal code",
"event.c": "internal code",
+ "iptables.h": "internal code",
+ "iptables.c": "internal code",
+ "buf.h": "internal code",
+ "buf.c": "internal code",
+ "qemu_driver.c": "internal code",
+ "remote_internal.c": "internal code",
+ "bridge.h": "internal code",
+ "bridge.c": "internal code",
+ "uuid.h": "internal code",
+ "uuid.c": "internal code",
+
}
ignored_words = {
diff --git a/docs/devhelp/libvirt-libvirt.html b/docs/devhelp/libvirt-libvirt.html
index 3ea4bef7d4..421d7de24f 100644
--- a/docs/devhelp/libvirt-libvirt.html
+++ b/docs/devhelp/libvirt-libvirt.html
@@ -442,8 +442,8 @@ The content of this structure is not made public by the API.
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>autostart</tt></i>:</span></td><td>the value returned</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 in case of success</td></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="virDomainGetConnect"/>virDomainGetConnect ()</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virDomainGetConnect (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom)<br/>
-</pre><p/>
-<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to a domain</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the connection pointer associated with a domain. The reference counter on the connection is not increased by this call. Returns the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div></div>
+</pre><p>Provides the connection pointer associated with a domain. The reference counter on the connection is not increased by this call.</p>
+<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to a domain</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="virDomainGetID"/>virDomainGetID ()</h3><pre class="programlisting">unsigned int virDomainGetID (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>Get the hypervisor ID number for the domain</p>
@@ -598,8 +598,8 @@ The content of this structure is not made public by the API.
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a 0 terminated interface name, or NULL in case of error. the caller must free() the returned value.</td></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="virNetworkGetConnect"/>virNetworkGetConnect ()</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virNetworkGetConnect (<a href="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> net)<br/>
-</pre><p/>
-<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>net</tt></i>:</span></td><td>pointer to a network</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the connection pointer associated with a network. The reference counter on the connection is not increased by this call. Returns the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div></div>
+</pre><p>Provides the connection pointer associated with a network. The reference counter on the connection is not increased by this call.</p>
+<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>net</tt></i>:</span></td><td>pointer to a network</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="virNetworkGetName"/>virNetworkGetName ()</h3><pre class="programlisting">const char * virNetworkGetName (<a href="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)<br/>
</pre><p>Get the public name for that network</p>
diff --git a/docs/examples/.cvsignore b/docs/examples/.cvsignore
index 5f0e25166a..aa743cb715 100644
--- a/docs/examples/.cvsignore
+++ b/docs/examples/.cvsignore
@@ -3,5 +3,5 @@ Makefile.in
Makefile
.deps
.libs
-info1
suspend
+info1
diff --git a/docs/examples/Makefile.am b/docs/examples/Makefile.am
index 6da54d6d30..c62d128208 100644
--- a/docs/examples/Makefile.am
+++ b/docs/examples/Makefile.am
@@ -18,24 +18,24 @@ install-data-local:
EXTRA_DIST=examples.xsl index.py examples.xml
-noinst_PROGRAMS=info1 suspend
-
-info1_SOURCES=info1.c
-info1_LDFLAGS=
-info1_DEPENDENCIES= $(DEPS)
-info1_LDADD= $(LDADDS)
+noinst_PROGRAMS=suspend info1
suspend_SOURCES=suspend.c
suspend_LDFLAGS=
suspend_DEPENDENCIES= $(DEPS)
suspend_LDADD= $(LDADDS)
+info1_SOURCES=info1.c
+info1_LDFLAGS=
+info1_DEPENDENCIES= $(DEPS)
+info1_LDADD= $(LDADDS)
+
valgrind:
$(MAKE) CHECKER='valgrind' tests
tests: $(noinst_PROGRAMS)
@(echo '## examples regression tests')
- @($(CHECKER) ./info1)
@($(CHECKER) ./suspend)
+ @($(CHECKER) ./info1)
diff --git a/docs/examples/examples.xml b/docs/examples/examples.xml
index 5e54567843..af7d4b9fbb 100644
--- a/docs/examples/examples.xml
+++ b/docs/examples/examples.xml
@@ -1,23 +1,4 @@
<examples>
- <example filename='info1.c'>
- <synopsis>Extract informations about Xen domain 0</synopsis>
- <purpose>Demonstrate the basic use of the library to connect to the hypervisor and extract domain informations.</purpose>
- <usage>info1</usage>
- <test>info1</test>
- <author>Daniel Veillard</author>
- <copy>see Copyright for the status of this software. </copy>
- <section>Informations</section>
- <includes>
- </includes>
- <uses>
- <function line='43' file='libvirt' name='virDomainGetInfo'/>
- <function line='53' file='libvirt' name='virDomainFree'/>
- <function line='36' file='libvirt' name='virDomainLookupByID'/>
- <function line='55' file='libvirt' name='virConnectClose'/>
- <struct line='25' file='libvirt' name='virDomainInfo'/>
- <function line='29' file='libvirt' name='virConnectOpenReadOnly'/>
- </uses>
- </example>
<example filename='suspend.c'>
<synopsis>Suspend a domain and then resume its execution</synopsis>
<purpose>Demonstrate the basic use of the library to suspend and resume a domain. If no id is given on the command line this script will suspend and resume the first domain found which is not Domain 0.</purpose>
@@ -40,33 +21,52 @@
<function line='100' file='libvirt' name='virConnectOpenReadOnly'/>
</uses>
</example>
+ <example filename='info1.c'>
+ <synopsis>Extract informations about Xen domain 0</synopsis>
+ <purpose>Demonstrate the basic use of the library to connect to the hypervisor and extract domain informations.</purpose>
+ <usage>info1</usage>
+ <test>info1</test>
+ <author>Daniel Veillard</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>Informations</section>
+ <includes>
+ </includes>
+ <uses>
+ <function line='43' file='libvirt' name='virDomainGetInfo'/>
+ <function line='53' file='libvirt' name='virDomainFree'/>
+ <function line='36' file='libvirt' name='virDomainLookupByID'/>
+ <function line='55' file='libvirt' name='virConnectClose'/>
+ <struct line='25' file='libvirt' name='virDomainInfo'/>
+ <function line='29' file='libvirt' name='virConnectOpenReadOnly'/>
+ </uses>
+ </example>
<symbols>
<symbol name='virConnectClose'>
- <ref filename='info1.c'/>
<ref filename='suspend.c'/>
+ <ref filename='info1.c'/>
</symbol>
<symbol name='virConnectListDomains'>
<ref filename='suspend.c'/>
</symbol>
<symbol name='virConnectOpenReadOnly'>
- <ref filename='info1.c'/>
<ref filename='suspend.c'/>
+ <ref filename='info1.c'/>
</symbol>
<symbol name='virDomainFree'>
- <ref filename='info1.c'/>
<ref filename='suspend.c'/>
+ <ref filename='info1.c'/>
</symbol>
<symbol name='virDomainGetInfo'>
- <ref filename='info1.c'/>
<ref filename='suspend.c'/>
+ <ref filename='info1.c'/>
</symbol>
<symbol name='virDomainInfo'>
- <ref filename='info1.c'/>
<ref filename='suspend.c'/>
+ <ref filename='info1.c'/>
</symbol>
<symbol name='virDomainLookupByID'>
- <ref filename='info1.c'/>
<ref filename='suspend.c'/>
+ <ref filename='info1.c'/>
</symbol>
<symbol name='virDomainResume'>
<ref filename='suspend.c'/>
diff --git a/docs/html/libvirt-libvirt.html b/docs/html/libvirt-libvirt.html
index 7d67c9281a..c5077940fe 100644
--- a/docs/html/libvirt-libvirt.html
+++ b/docs/html/libvirt-libvirt.html
@@ -242,8 +242,8 @@ The content of this structure is not made public by the API.
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><a name="virDomainGetAutostart" id="virDomainGetAutostart"></a>Function: virDomainGetAutostart</h3><pre class="programlisting">int virDomainGetAutostart (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> int * autostart)<br />
</pre><p>Provides a boolean value indicating whether the domain configured to be automatically started when the host machine boots.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>autostart</tt></i>:</span></td><td>the value returned</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 in case of success</td></tr></tbody></table></div><h3><a name="virDomainGetConnect" id="virDomainGetConnect"></a>Function: virDomainGetConnect</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virDomainGetConnect (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom)<br />
-</pre><p></p>
-<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to a domain</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the connection pointer associated with a domain. The reference counter on the connection is not increased by this call. Returns the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div><h3><a name="virDomainGetID" id="virDomainGetID"></a>Function: virDomainGetID</h3><pre class="programlisting">unsigned int virDomainGetID (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
+</pre><p>Provides the connection pointer associated with a domain. The reference counter on the connection is not increased by this call.</p>
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to a domain</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div><h3><a name="virDomainGetID" id="virDomainGetID"></a>Function: virDomainGetID</h3><pre class="programlisting">unsigned int virDomainGetID (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
</pre><p>Get the hypervisor ID number for the domain</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the domain ID number or (unsigned int) -1 in case of error</td></tr></tbody></table></div><h3><a name="virDomainGetInfo" id="virDomainGetInfo"></a>Function: virDomainGetInfo</h3><pre class="programlisting">int virDomainGetInfo (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virDomainInfoPtr">virDomainInfoPtr</a> info)<br />
</pre><p>Extract information about a domain. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted.</p>
@@ -320,8 +320,8 @@ The content of this structure is not made public by the API.
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><span class="term"><i><tt>autostart</tt></i>:</span></td><td>the value returned</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 in case of success</td></tr></tbody></table></div><h3><a name="virNetworkGetBridgeName" id="virNetworkGetBridgeName"></a>Function: virNetworkGetBridgeName</h3><pre class="programlisting">char * virNetworkGetBridgeName (<a href="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)<br />
</pre><p>Provides a bridge interface name to which a domain may connect a network interface in order to join the network.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a 0 terminated interface name, or NULL in case of error. the caller must free() the returned value.</td></tr></tbody></table></div><h3><a name="virNetworkGetConnect" id="virNetworkGetConnect"></a>Function: virNetworkGetConnect</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virNetworkGetConnect (<a href="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> net)<br />
-</pre><p></p>
-<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>net</tt></i>:</span></td><td>pointer to a network</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the connection pointer associated with a network. The reference counter on the connection is not increased by this call. Returns the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div><h3><a name="virNetworkGetName" id="virNetworkGetName"></a>Function: virNetworkGetName</h3><pre class="programlisting">const char * virNetworkGetName (<a href="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)<br />
+</pre><p>Provides the connection pointer associated with a network. The reference counter on the connection is not increased by this call.</p>
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>net</tt></i>:</span></td><td>pointer to a network</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div><h3><a name="virNetworkGetName" id="virNetworkGetName"></a>Function: virNetworkGetName</h3><pre class="programlisting">const char * virNetworkGetName (<a href="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)<br />
</pre><p>Get the public name for that network</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the name or NULL, the string need not be deallocated its lifetime will be the same as the network object.</td></tr></tbody></table></div><h3><a name="virNetworkGetUUID" id="virNetworkGetUUID"></a>Function: virNetworkGetUUID</h3><pre class="programlisting">int virNetworkGetUUID (<a href="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network, <br /> unsigned char * uuid)<br />
</pre><p>Get the UUID for a network</p>
diff --git a/docs/libvirt-api.xml b/docs/libvirt-api.xml
index 093b2430f3..7a8413b3f7 100644
--- a/docs/libvirt-api.xml
+++ b/docs/libvirt-api.xml
@@ -614,8 +614,8 @@
<arg name='autostart' type='int *' info='the value returned'/>
</function>
<function name='virDomainGetConnect' file='libvirt' module='libvirt'>
- <info></info>
- <return type='virConnectPtr' info='the connection pointer associated with a domain. The reference counter on the connection is not increased by this call. Returns the virConnectPtr or NULL in case of failure.'/>
+ <info>Provides the connection pointer associated with a domain. The reference counter on the connection is not increased by this call.</info>
+ <return type='virConnectPtr' info='the virConnectPtr or NULL in case of failure.'/>
<arg name='dom' type='virDomainPtr' info='pointer to a domain'/>
</function>
<function name='virDomainGetID' file='libvirt' module='libvirt'>
@@ -850,8 +850,8 @@
<arg name='network' type='virNetworkPtr' info='a network object'/>
</function>
<function name='virNetworkGetConnect' file='libvirt' module='libvirt'>
- <info></info>
- <return type='virConnectPtr' info='the connection pointer associated with a network. The reference counter on the connection is not increased by this call. Returns the virConnectPtr or NULL in case of failure.'/>
+ <info>Provides the connection pointer associated with a network. The reference counter on the connection is not increased by this call.</info>
+ <return type='virConnectPtr' info='the virConnectPtr or NULL in case of failure.'/>
<arg name='net' type='virNetworkPtr' info='pointer to a network'/>
</function>
<function name='virNetworkGetName' file='libvirt' module='libvirt'>
diff --git a/docs/libvirt-refs.xml b/docs/libvirt-refs.xml
index b492f38aee..2a1373f2b3 100644
--- a/docs/libvirt-refs.xml
+++ b/docs/libvirt-refs.xml
@@ -1058,10 +1058,12 @@
<ref name='virConnectNumOfDomains'/>
<ref name='virConnectNumOfNetworks'/>
<ref name='virDomainGetAutostart'/>
+ <ref name='virDomainGetConnect'/>
<ref name='virDomainGetMaxVcpus'/>
<ref name='virGetVersion'/>
<ref name='virNetworkGetAutostart'/>
<ref name='virNetworkGetBridgeName'/>
+ <ref name='virNetworkGetConnect'/>
</word>
</letter>
<letter name='R'>
@@ -1086,10 +1088,6 @@
<word name='Retrieve'>
<ref name='virDomainGetMaxMemory'/>
</word>
- <word name='Returns'>
- <ref name='virDomainGetConnect'/>
- <ref name='virNetworkGetConnect'/>
- </word>
</letter>
<letter name='S'>
<word name='See'>
diff --git a/docs/newapi.xsl b/docs/newapi.xsl
index b20dc84381..6fae4c8001 100644
--- a/docs/newapi.xsl
+++ b/docs/newapi.xsl
@@ -476,20 +476,19 @@
</xsl:template>
<xsl:template name="docomponents">
- <xsl:param name="mode"/>
- <xsl:apply-templates select="exports[@type='macro']" mode="$mode">
+ <xsl:apply-templates select="exports[@type='macro']">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
- <xsl:apply-templates select="exports[@type='enum']" mode="$mode">
+ <xsl:apply-templates select="exports[@type='enum']">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
- <xsl:apply-templates select="exports[@type='typedef']" mode="$mode">
+ <xsl:apply-templates select="exports[@type='typedef']">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
- <xsl:apply-templates select="exports[@type='struct']" mode="$mode">
+ <xsl:apply-templates select="exports[@type='struct']">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
- <xsl:apply-templates select="exports[@type='function']" mode="$mode">
+ <xsl:apply-templates select="exports[@type='function']">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</xsl:template>
diff --git a/src/bridge.c b/src/bridge.c
index 133180db5e..0bcbd76da3 100644
--- a/src/bridge.c
+++ b/src/bridge.c
@@ -53,6 +53,15 @@ struct _brControl {
int fd;
};
+/**
+ * brInit:
+ * @ctlp: pointer to bridge control return value
+ *
+ * Initialize a new bridge layer. In case of success
+ * @ctlp will contain a pointer to the new bridge structure.
+ *
+ * Returns 0 in case of success, an error code otherwise.
+ */
int
brInit(brControl **ctlp)
{
@@ -74,14 +83,22 @@ brInit(brControl **ctlp)
}
*ctlp = (brControl *)malloc(sizeof(struct _brControl));
- if (!*ctlp)
+ if (!*ctlp) {
+ close(fd);
return ENOMEM;
+ }
(*ctlp)->fd = fd;
return 0;
}
+/**
+ * brShutdown:
+ * @ctl: pointer to a bridge control
+ *
+ * Shutdown the bridge layer and deallocate the associated structures
+ */
void
brShutdown(brControl *ctl)
{
@@ -94,6 +111,19 @@ brShutdown(brControl *ctl)
free(ctl);
}
+/**
+ * brAddBridge:
+ * @ctl: bridge control pointer
+ * @nameOrFmt: the bridge name (or name template)
+ * @name: pointer to @maxlen bytes to store the bridge name
+ * @maxlen: size of @name array
+ *
+ * This function register a new bridge, @nameOrFmt can be either
+ * a fixed name or a name template with '%d' for dynamic name allocation.
+ * in either case the final name for the bridge will be stored in @name.
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
int
brAddBridge(brControl *ctl,
const char *nameOrFmt,
@@ -141,6 +171,15 @@ brAddBridge(brControl *ctl,
return errno;
}
+/**
+ * brDeleteBridge:
+ * @ctl: bridge control pointer
+ * @name: the bridge name
+ *
+ * Remove a bridge from the layer.
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
int
brDeleteBridge(brControl *ctl,
const char *name)
@@ -177,6 +216,16 @@ brAddDelInterface(brControl *ctl,
return ioctl(ctl->fd, cmd, &ifr) == 0 ? 0 : errno;
}
+/**
+ * brAddInterface:
+ * @ctl: bridge control pointer
+ * @bridge: the bridge name
+ * @iface: the network interface name
+ *
+ * Adds an interface to a bridge
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
int
brAddInterface(brControl *ctl,
const char *bridge,
@@ -185,6 +234,16 @@ brAddInterface(brControl *ctl,
return brAddDelInterface(ctl, SIOCBRADDIF, bridge, iface);
}
+/**
+ * brDeleteInterface:
+ * @ctl: bridge control pointer
+ * @bridge: the bridge name
+ * @iface: the network interface name
+ *
+ * Removes an interface from a bridge
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
int
brDeleteInterface(brControl *ctl,
const char *bridge,
@@ -194,6 +253,21 @@ brDeleteInterface(brControl *ctl,
}
+/**
+ * brAddTap:
+ * @ctl: bridge control pointer
+ * @bridge: the bridge name
+ * @ifname: the interface name (or name template)
+ * @maxlen: size of @ifname array
+ * @tapfd: file descriptor return value for the new tap device
+ *
+ * This function reates a new tap device on a bridge. @ifname can be either
+ * a fixed name or a name template with '%d' for dynamic name allocation.
+ * in either case the final name for the bridge will be stored in @ifname
+ * and the associated file descriptor in @tapfd.
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
int
brAddTap(brControl *ctl,
const char *bridge,
@@ -259,6 +333,16 @@ brAddTap(brControl *ctl,
return errno;
}
+/**
+ * brSetInterfaceUp:
+ * @ctl: bridge control pointer
+ * @ifname: the interface name
+ * @up: 1 for up, 0 for down
+ *
+ * Function to control if an interface is activated (up, 1) or not (down, 0)
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
int
brSetInterfaceUp(brControl *ctl,
const char *ifname,
@@ -294,6 +378,16 @@ brSetInterfaceUp(brControl *ctl,
return 0;
}
+/**
+ * brGetInterfaceUp:
+ * @ctl: bridge control pointer
+ * @ifname: the interface name
+ * @up: where to store the status
+ *
+ * Function to query if an interface is activated (1) or not (0)
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
int
brGetInterfaceUp(brControl *ctl,
const char *ifname,
@@ -302,7 +396,7 @@ brGetInterfaceUp(brControl *ctl,
struct ifreq ifr;
int len;
- if (!ctl || !ifname)
+ if (!ctl || !ifname || !up)
return EINVAL;
if ((len = strlen(ifname)) >= BR_IFNAME_MAXLEN)
@@ -392,6 +486,19 @@ brGetInetAddr(brControl *ctl,
return 0;
}
+/**
+ * brSetInetAddress:
+ * @ctl: bridge control pointer
+ * @ifname: the interface name
+ * @addr: the string representation of the IP adress
+ *
+ * Function to bind the interface to an IP address, it should handle
+ * IPV4 and IPv6. The string for addr would be of the form
+ * "ddd.ddd.ddd.ddd" assuming the common IPv4 format.
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
+
int
brSetInetAddress(brControl *ctl,
const char *ifname,
@@ -400,6 +507,20 @@ brSetInetAddress(brControl *ctl,
return brSetInetAddr(ctl, ifname, SIOCSIFADDR, addr);
}
+/**
+ * brGetInetAddress:
+ * @ctl: bridge control pointer
+ * @ifname: the interface name
+ * @addr: the array for the string representation of the IP adress
+ * @maxlen: size of @addr in bytes
+ *
+ * Function to get the IP address of an interface, it should handle
+ * IPV4 and IPv6. The returned string for addr would be of the form
+ * "ddd.ddd.ddd.ddd" assuming the common IPv4 format.
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
+
int
brGetInetAddress(brControl *ctl,
const char *ifname,
@@ -409,6 +530,19 @@ brGetInetAddress(brControl *ctl,
return brGetInetAddr(ctl, ifname, SIOCGIFADDR, addr, maxlen);
}
+/**
+ * brSetInetNetmask:
+ * @ctl: bridge control pointer
+ * @ifname: the interface name
+ * @addr: the string representation of the netmask
+ *
+ * Function to set the netmask of an interface, it should handle
+ * IPV4 and IPv6 forms. The string for addr would be of the form
+ * "ddd.ddd.ddd.ddd" assuming the common IPv4 format.
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
+
int
brSetInetNetmask(brControl *ctl,
const char *ifname,
@@ -417,6 +551,20 @@ brSetInetNetmask(brControl *ctl,
return brSetInetAddr(ctl, ifname, SIOCSIFNETMASK, addr);
}
+/**
+ * brGetInetNetmask:
+ * @ctl: bridge control pointer
+ * @ifname: the interface name
+ * @addr: the array for the string representation of the netmask
+ * @maxlen: size of @addr in bytes
+ *
+ * Function to get the netmask of an interface, it should handle
+ * IPV4 and IPv6. The returned string for addr would be of the form
+ * "ddd.ddd.ddd.ddd" assuming the common IPv4 format.
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
+
int
brGetInetNetmask(brControl *ctl,
const char *ifname,
@@ -463,6 +611,17 @@ brctlSpawn(char * const *argv)
return (WIFEXITED(status) && WEXITSTATUS(status) == 0) ? 0 : EINVAL;
}
+/**
+ * brSetForwardDelay:
+ * @ctl: bridge control pointer
+ * @bridge: the bridge name
+ * @delay: delay in seconds
+ *
+ * Set the bridge forward delay
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
+
int
brSetForwardDelay(brControl *ctl ATTRIBUTE_UNUSED,
const char *bridge,
@@ -512,6 +671,17 @@ brSetForwardDelay(brControl *ctl ATTRIBUTE_UNUSED,
return retval;
}
+/**
+ * brSetEnableSTP:
+ * @ctl: bridge control pointer
+ * @bridge: the bridge name
+ * @enable: 1 to enable, 0 to disable
+ *
+ * Control whether the bridge participates in the spanning tree protocol,
+ * in general don't disable it without good reasons.
+ *
+ * Returns 0 in case of success or an errno code in case of failure.
+ */
int
brSetEnableSTP(brControl *ctl ATTRIBUTE_UNUSED,
const char *bridge,
@@ -534,7 +704,7 @@ brSetEnableSTP(brControl *ctl ATTRIBUTE_UNUSED,
if (!(argv[n++] = strdup(BRCTL_PATH)))
goto error;
- if (!(argv[n++] = strdup("setfd")))
+ if (!(argv[n++] = strdup("stp")))
goto error;
if (!(argv[n++] = strdup(bridge)))
diff --git a/src/bridge.h b/src/bridge.h
index df461e0dd2..f970a7c643 100644
--- a/src/bridge.h
+++ b/src/bridge.h
@@ -25,7 +25,16 @@
#include <net/if.h>
#include <netinet/in.h>
+/**
+ * BR_IFNAME_MAXLEN:
+ * maximum size in byte of the name for an interface
+ */
#define BR_IFNAME_MAXLEN IF_NAMESIZE
+
+/**
+ * BR_INET_ADDR_MAXLEN:
+ * maximum size in bytes for an inet addess name
+ */
#define BR_INET_ADDR_MAXLEN INET_ADDRSTRLEN
typedef struct _brControl brControl;
diff --git a/src/buf.c b/src/buf.c
index 567fdf7ea1..c466eb239d 100644
--- a/src/buf.c
+++ b/src/buf.c
@@ -83,6 +83,14 @@ virBufferAdd(virBufferPtr buf, const char *str, int len)
return (0);
}
+/**
+ * virBufferNew:
+ * @size: creation size in bytes
+ *
+ * Creates a new buffer
+ *
+ * Returns a pointer to the buffer or NULL in case of error
+ */
virBufferPtr
virBufferNew(unsigned int size)
{
@@ -99,6 +107,13 @@ virBufferNew(unsigned int size)
return buf;
}
+/**
+ * virBufferFree:
+ * @buf: the buffer to deallocate
+ *
+ * Free the set of resources used by a buffer.
+ */
+
void
virBufferFree(virBufferPtr buf)
{
@@ -113,12 +128,19 @@ virBufferFree(virBufferPtr buf)
* virBufferContentAndFree:
* @buf: Buffer
*
- * Return the content from the buffer and free (only) the buffer structure.
+ * Get the content from the buffer and free (only) the buffer structure.
+ *
+ * Returns the buffer content or NULL in case of error.
*/
char *
virBufferContentAndFree (virBufferPtr buf)
{
- char *content = buf->content;
+ char *content;
+
+ if (buf == NULL)
+ return(NULL);
+
+ content = buf->content;
free (buf);
return content;
@@ -128,7 +150,7 @@ virBufferContentAndFree (virBufferPtr buf)
* virBufferVSprintf:
* @buf: the buffer to dump
* @format: the format
- * @argptr: the variable list of arguments
+ * @...: the variable list of arguments
*
* Do a formatted print to an XML buffer.
*
@@ -165,7 +187,7 @@ virBufferVSprintf(virBufferPtr buf, const char *format, ...)
/**
* virBufferStrcat:
* @buf: the buffer to dump
- * @argptr: the variable list of strings, the last argument must be NULL
+ * @...: the variable list of strings, the last argument must be NULL
*
* Concatenate strings to an XML buffer.
*
diff --git a/src/iptables.c b/src/iptables.c
index c871c4bc2b..449782b322 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -530,6 +530,13 @@ iptablesAddRemoveRule(iptRules *rules, int action, const char *arg, ...)
return retval;
}
+/**
+ * iptablesContextNew:
+ *
+ * Create a new IPtable context
+ *
+ * Returns a pointer to the new structure or NULL in case of error
+ */
iptablesContext *
iptablesContextNew(void)
{
@@ -554,6 +561,12 @@ iptablesContextNew(void)
return NULL;
}
+/**
+ * iptablesContextFree:
+ * @ctx: pointer to the IP table context
+ *
+ * Free the ressources associated with an IP table context
+ */
void
iptablesContextFree(iptablesContext *ctx)
{
@@ -597,6 +610,12 @@ iptRulesReload(iptRules *rules)
rules->rules[i].rule, rules->chain, rules->table, strerror(retval));
}
+/**
+ * iptablesReloadRules:
+ * @ctx: pointer to the IP table context
+ *
+ * Reloads all the IP table rules associated to a context
+ */
void
iptablesReloadRules(iptablesContext *ctx)
{
@@ -626,6 +645,18 @@ iptablesInput(iptablesContext *ctx,
NULL);
}
+/**
+ * iptablesAddTcpInput:
+ * @ctx: pointer to the IP table context
+ * @iface: the interface name
+ * @port: the TCP port to add
+ *
+ * Add an input to the IP table allowing access to the given @port on
+ * the given @iface interface for TCP packets
+ *
+ * Returns 0 in case of success or an error code in case of error
+ */
+
int
iptablesAddTcpInput(iptablesContext *ctx,
const char *iface,
@@ -634,6 +665,17 @@ iptablesAddTcpInput(iptablesContext *ctx,
return iptablesInput(ctx, iface, port, ADD, 1);
}
+/**
+ * iptablesRemoveTcpInput:
+ * @ctx: pointer to the IP table context
+ * @iface: the interface name
+ * @port: the TCP port to remove
+ *
+ * Removes an input from the IP table, hence forbiding access to the given
+ * @port on the given @iface interface for TCP packets
+ *
+ * Returns 0 in case of success or an error code in case of error
+ */
int
iptablesRemoveTcpInput(iptablesContext *ctx,
const char *iface,
@@ -642,6 +684,18 @@ iptablesRemoveTcpInput(iptablesContext *ctx,
return iptablesInput(ctx, iface, port, REMOVE, 1);
}
+/**
+ * iptablesAddUdpInput:
+ * @ctx: pointer to the IP table context
+ * @iface: the interface name
+ * @port: the UDP port to add
+ *
+ * Add an input to the IP table allowing access to the given @port on
+ * the given @iface interface for UDP packets
+ *
+ * Returns 0 in case of success or an error code in case of error
+ */
+
int
iptablesAddUdpInput(iptablesContext *ctx,
const char *iface,
@@ -650,6 +704,17 @@ iptablesAddUdpInput(iptablesContext *ctx,
return iptablesInput(ctx, iface, port, ADD, 0);
}
+/**
+ * iptablesRemoveUdpInput:
+ * @ctx: pointer to the IP table context
+ * @iface: the interface name
+ * @port: the UDP port to remove
+ *
+ * Removes an input from the IP table, hence forbiding access to the given
+ * @port on the given @iface interface for UDP packets
+ *
+ * Returns 0 in case of success or an error code in case of error
+ */
int
iptablesRemoveUdpInput(iptablesContext *ctx,
const char *iface,
@@ -687,6 +752,19 @@ iptablesForwardAllowOut(iptablesContext *ctx,
}
}
+/**
+ * iptablesAddForwardAllowOut:
+ * @ctx: pointer to the IP table context
+ * @network: the source network name
+ * @iface: the source interface name
+ * @physdev: the physical output device
+ *
+ * Add a rule to the IP table context to allow the traffic for the
+ * network @network via interface @iface to be forwarded to
+ * @physdev device. This allow the outbound traffic on a bridge.
+ *
+ * Returns 0 in case of success or an error code otherwise
+ */
int
iptablesAddForwardAllowOut(iptablesContext *ctx,
const char *network,
@@ -696,6 +774,19 @@ iptablesAddForwardAllowOut(iptablesContext *ctx,
return iptablesForwardAllowOut(ctx, network, iface, physdev, ADD);
}
+/**
+ * iptablesRemoveForwardAllowOut:
+ * @ctx: pointer to the IP table context
+ * @network: the source network name
+ * @iface: the source interface name
+ * @physdev: the physical output device
+ *
+ * Remove a rule from the IP table context hence forbidding forwarding
+ * of the traffic for the network @network via interface @iface
+ * to the @physdev device output. This stops the outbound traffic on a bridge.
+ *
+ * Returns 0 in case of success or an error code otherwise
+ */
int
iptablesRemoveForwardAllowOut(iptablesContext *ctx,
const char *network,
@@ -738,6 +829,19 @@ iptablesForwardAllowIn(iptablesContext *ctx,
}
}
+/**
+ * iptablesAddForwardAllowIn:
+ * @ctx: pointer to the IP table context
+ * @network: the source network name
+ * @iface: the output interface name
+ * @physdev: the physical input device or NULL
+ *
+ * Add rules to the IP table context to allow the traffic for the
+ * network @network on @physdev device to be forwarded to
+ * interface @iface. This allow the inbound traffic on a bridge.
+ *
+ * Returns 0 in case of success or an error code otherwise
+ */
int
iptablesAddForwardAllowIn(iptablesContext *ctx,
const char *network,
@@ -747,6 +851,19 @@ iptablesAddForwardAllowIn(iptablesContext *ctx,
return iptablesForwardAllowIn(ctx, network, iface, physdev, ADD);
}
+/**
+ * iptablesRemoveForwardAllowIn:
+ * @ctx: pointer to the IP table context
+ * @network: the source network name
+ * @iface: the output interface name
+ * @physdev: the physical input device or NULL
+ *
+ * Remove rules from the IP table context hence forbidding the traffic for
+ * network @network on @physdev device to be forwarded to
+ * interface @iface. This stops the inbound traffic on a bridge.
+ *
+ * Returns 0 in case of success or an error code otherwise
+ */
int
iptablesRemoveForwardAllowIn(iptablesContext *ctx,
const char *network,
@@ -773,12 +890,34 @@ iptablesForwardAllowCross(iptablesContext *ctx,
NULL);
}
+/**
+ * iptablesAddForwardAllowCross:
+ * @ctx: pointer to the IP table context
+ * @iface: the input/output interface name
+ *
+ * Add rules to the IP table context to allow traffic to cross that
+ * interface. It allows all traffic between guests on the same bridge
+ * represented by that interface.
+ *
+ * Returns 0 in case of success or an error code otherwise
+ */
int
iptablesAddForwardAllowCross(iptablesContext *ctx,
const char *iface) {
return iptablesForwardAllowCross(ctx, iface, ADD);
}
+/**
+ * iptablesRemoveForwardAllowCross:
+ * @ctx: pointer to the IP table context
+ * @iface: the input/output interface name
+ *
+ * Remove rules to the IP table context to block traffic to cross that
+ * interface. It forbids traffic between guests on the same bridge
+ * represented by that interface.
+ *
+ * Returns 0 in case of success or an error code otherwise
+ */
int
iptablesRemoveForwardAllowCross(iptablesContext *ctx,
const char *iface) {
@@ -801,6 +940,16 @@ iptablesForwardRejectOut(iptablesContext *ctx,
NULL);
}
+/**
+ * iptablesAddForwardRejectOut:
+ * @ctx: pointer to the IP table context
+ * @iface: the output interface name
+ *
+ * Add rules to the IP table context to forbid all traffic to that
+ * interface. It forbids forwarding from the bridge to that interface.
+ *
+ * Returns 0 in case of success or an error code otherwise
+ */
int
iptablesAddForwardRejectOut(iptablesContext *ctx,
const char *iface)
@@ -808,6 +957,16 @@ iptablesAddForwardRejectOut(iptablesContext *ctx,
return iptablesForwardRejectOut(ctx, iface, ADD);
}
+/**
+ * iptablesRemoveForwardRejectOut:
+ * @ctx: pointer to the IP table context
+ * @iface: the output interface name
+ *
+ * Remove rules from the IP table context forbidding all traffic to that
+ * interface. It reallow forwarding from the bridge to that interface.
+ *
+ * Returns 0 in case of success or an error code otherwise
+ */
int
iptablesRemoveForwardRejectOut(iptablesContext *ctx,
const char *iface)
@@ -833,6 +992,16 @@ iptablesForwardRejectIn(iptablesContext *ctx,
NULL);
}
+/**
+ * iptablesAddForwardRejectIn:
+ * @ctx: pointer to the IP table context
+ * @iface: the input interface name
+ *
+ * Add rules to the IP table context to forbid all traffic from that
+ * interface. It forbids forwarding from that interface to the bridge.
+ *
+ * Returns 0 in case of success or an error code otherwise
+ */
int
iptablesAddForwardRejectIn(iptablesContext *ctx,
const char *iface)
@@ -840,6 +1009,16 @@ iptablesAddForwardRejectIn(iptablesContext *ctx,
return iptablesForwardRejectIn(ctx, iface, ADD);
}
+/**
+ * iptablesRemoveForwardRejectIn:
+ * @ctx: pointer to the IP table context
+ * @iface: the input interface name
+ *
+ * Remove rules from the IP table context forbidding all traffic from that
+ * interface. It allows forwarding from that interface to the bridge.
+ *
+ * Returns 0 in case of success or an error code otherwise
+ */
int
iptablesRemoveForwardRejectIn(iptablesContext *ctx,
const char *iface)
@@ -873,6 +1052,18 @@ iptablesForwardMasquerade(iptablesContext *ctx,
}
}
+/**
+ * iptablesAddForwardMasquerade:
+ * @ctx: pointer to the IP table context
+ * @network: the source network name
+ * @physdev: the physical input device or NULL
+ *
+ * Add rules to the IP table context to allow masquerading
+ * network @network on @physdev. This allow the bridge to
+ * masquerade for that network (on @physdev).
+ *
+ * Returns 0 in case of success or an error code otherwise
+ */
int
iptablesAddForwardMasquerade(iptablesContext *ctx,
const char *network,
@@ -881,6 +1072,18 @@ iptablesAddForwardMasquerade(iptablesContext *ctx,
return iptablesForwardMasquerade(ctx, network, physdev, ADD);
}
+/**
+ * iptablesRemoveForwardMasquerade:
+ * @ctx: pointer to the IP table context
+ * @network: the source network name
+ * @physdev: the physical input device or NULL
+ *
+ * Remove rules from the IP table context to stop masquerading
+ * network @network on @physdev. This stops the bridge from
+ * masquerading for that network (on @physdev).
+ *
+ * Returns 0 in case of success or an error code otherwise
+ */
int
iptablesRemoveForwardMasquerade(iptablesContext *ctx,
const char *network,
diff --git a/src/libvirt.c b/src/libvirt.c
index 83ce5e0767..876d4cd08c 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -684,7 +684,7 @@ virConnectNumOfDomains(virConnectPtr conn)
* virDomainGetConnect:
* @dom: pointer to a domain
*
- * Returns the connection pointer associated with a domain. The
+ * Provides the connection pointer associated with a domain. The
* reference counter on the connection is not increased by this
* call.
*
@@ -2195,7 +2195,7 @@ virDomainDetachDevice(virDomainPtr domain, char *xml)
* virNetworkGetConnect:
* @net: pointer to a network
*
- * Returns the connection pointer associated with a network. The
+ * Provides the connection pointer associated with a network. The
* reference counter on the connection is not increased by this
* call.
*
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 81ee3b374a..a854ab3ba8 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -53,6 +53,9 @@
#include "qemu_driver.h"
#include "qemu_conf.h"
+static int qemudShutdown(void);
+
+
#define qemudLog(level, msg...) fprintf(stderr, msg)
static int qemudSetCloseExec(int fd) {
@@ -84,16 +87,16 @@ static int qemudSetNonBlock(int fd) {
static void qemudDispatchVMEvent(int fd, int events, void *opaque);
-int qemudStartVMDaemon(struct qemud_driver *driver,
+static int qemudStartVMDaemon(struct qemud_driver *driver,
struct qemud_vm *vm);
-int qemudShutdownVMDaemon(struct qemud_driver *driver,
+static int qemudShutdownVMDaemon(struct qemud_driver *driver,
struct qemud_vm *vm);
-int qemudStartNetworkDaemon(struct qemud_driver *driver,
+static int qemudStartNetworkDaemon(struct qemud_driver *driver,
struct qemud_network *network);
-int qemudShutdownNetworkDaemon(struct qemud_driver *driver,
+static int qemudShutdownNetworkDaemon(struct qemud_driver *driver,
struct qemud_network *network);
struct qemud_driver *qemu_driver = NULL;
@@ -135,7 +138,13 @@ void qemudAutostartConfigs(struct qemud_driver *driver) {
}
}
-int qemudStartup(void) {
+/**
+ * qemudStartup:
+ *
+ * Initialization function for the QEmu daemon
+ */
+static int
+qemudStartup(void) {
uid_t uid = geteuid();
struct passwd *pw;
char *base = NULL;
@@ -203,7 +212,14 @@ int qemudStartup(void) {
return -1;
}
-int qemudReload(void) {
+/**
+ * qemudReload:
+ *
+ * Function to restart the QEmu daemon, it will recheck the configuration
+ * files and update its state and the networking
+ */
+static int
+qemudReload(void) {
qemudScanConfigs(qemu_driver);
if (qemu_driver->iptables) {
@@ -216,7 +232,16 @@ int qemudReload(void) {
return 0;
}
-int qemudActive(void) {
+/**
+ * qemudActive:
+ *
+ * Checks if the QEmu daemon is active, i.e. has an active domain or
+ * an active network
+ *
+ * Returns 1 if active, 0 otherwise
+ */
+static int
+qemudActive(void) {
/* If we've any active networks or guests, then we
* mark this driver as active
*/
@@ -228,7 +253,13 @@ int qemudActive(void) {
return 0;
}
-int qemudShutdown() {
+/**
+ * qemudShutdown:
+ *
+ * Shutdown the QEmu daemon, it will stop all active domains and networks
+ */
+static int
+qemudShutdown(void) {
struct qemud_vm *vm;
struct qemud_network *network;
@@ -602,7 +633,7 @@ static int qemudNextFreeVNCPort(struct qemud_driver *driver ATTRIBUTE_UNUSED) {
return -1;
}
-int qemudStartVMDaemon(struct qemud_driver *driver,
+static int qemudStartVMDaemon(struct qemud_driver *driver,
struct qemud_vm *vm) {
char **argv = NULL, **tmp;
int i;
@@ -754,7 +785,7 @@ static int qemudVMData(struct qemud_driver *driver ATTRIBUTE_UNUSED,
}
-int qemudShutdownVMDaemon(struct qemud_driver *driver, struct qemud_vm *vm) {
+static int qemudShutdownVMDaemon(struct qemud_driver *driver, struct qemud_vm *vm) {
if (!qemudIsActiveVM(vm))
return 0;
@@ -1122,7 +1153,7 @@ qemudEnableIpForwarding(void)
#undef PROC_IP_FORWARD
}
-int qemudStartNetworkDaemon(struct qemud_driver *driver,
+static int qemudStartNetworkDaemon(struct qemud_driver *driver,
struct qemud_network *network) {
const char *name;
int err;
@@ -1233,7 +1264,7 @@ int qemudStartNetworkDaemon(struct qemud_driver *driver,
}
-int qemudShutdownNetworkDaemon(struct qemud_driver *driver,
+static int qemudShutdownNetworkDaemon(struct qemud_driver *driver,
struct qemud_network *network) {
int err;
@@ -1452,7 +1483,7 @@ static int qemudGetCPUInfo(unsigned int *cpus, unsigned int *mhz,
return 0;
}
-virDrvOpenStatus qemudOpen(virConnectPtr conn,
+static virDrvOpenStatus qemudOpen(virConnectPtr conn,
const char *name,
int flags ATTRIBUTE_UNUSED) {
uid_t uid = getuid();
@@ -1503,7 +1534,7 @@ static int qemudGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED,
return -1;
}
-int qemudGetNodeInfo(virConnectPtr conn ATTRIBUTE_UNUSED,
+static int qemudGetNodeInfo(virConnectPtr conn ATTRIBUTE_UNUSED,
virNodeInfoPtr node) {
struct utsname info;
@@ -1522,7 +1553,7 @@ int qemudGetNodeInfo(virConnectPtr conn ATTRIBUTE_UNUSED,
return 0;
}
-char *qemudGetCapabilities(virConnectPtr conn ATTRIBUTE_UNUSED) {
+static char *qemudGetCapabilities(virConnectPtr conn ATTRIBUTE_UNUSED) {
struct utsname utsname;
int i, j, r;
int have_kqemu = 0;
@@ -1710,7 +1741,7 @@ static int qemudGetProcessInfo(unsigned long long *cpuTime, int pid) {
}
-virDomainPtr qemudDomainLookupByID(virConnectPtr conn,
+static virDomainPtr qemudDomainLookupByID(virConnectPtr conn,
int id) {
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
struct qemud_vm *vm = qemudFindVMByID(driver, id);
@@ -1730,7 +1761,7 @@ virDomainPtr qemudDomainLookupByID(virConnectPtr conn,
dom->id = vm->id;
return dom;
}
-virDomainPtr qemudDomainLookupByUUID(virConnectPtr conn,
+static virDomainPtr qemudDomainLookupByUUID(virConnectPtr conn,
const unsigned char *uuid) {
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
struct qemud_vm *vm = qemudFindVMByUUID(driver, uuid);
@@ -1750,7 +1781,7 @@ virDomainPtr qemudDomainLookupByUUID(virConnectPtr conn,
dom->id = vm->id;
return dom;
}
-virDomainPtr qemudDomainLookupByName(virConnectPtr conn,
+static virDomainPtr qemudDomainLookupByName(virConnectPtr conn,
const char *name) {
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
struct qemud_vm *vm = qemudFindVMByName(driver, name);
@@ -1771,7 +1802,7 @@ virDomainPtr qemudDomainLookupByName(virConnectPtr conn,
return dom;
}
-int qemudGetVersion(virConnectPtr conn, unsigned long *version) {
+static int qemudGetVersion(virConnectPtr conn, unsigned long *version) {
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
if (qemudExtractVersion(driver) < 0)
return -1;
@@ -1780,7 +1811,7 @@ int qemudGetVersion(virConnectPtr conn, unsigned long *version) {
return 0;
}
-int qemudListDomains(virConnectPtr conn, int *ids, int nids) {
+static int qemudListDomains(virConnectPtr conn, int *ids, int nids) {
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
struct qemud_vm *vm = driver->vms;
int got = 0;
@@ -1793,11 +1824,11 @@ int qemudListDomains(virConnectPtr conn, int *ids, int nids) {
}
return got;
}
-int qemudNumDomains(virConnectPtr conn) {
+static int qemudNumDomains(virConnectPtr conn) {
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
return driver->nactivevms;
}
-virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
+static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
unsigned int flags ATTRIBUTE_UNUSED) {
struct qemud_vm_def *def;
struct qemud_vm *vm;
@@ -1828,7 +1859,7 @@ virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
}
-int qemudDomainSuspend(virDomainPtr dom) {
+static int qemudDomainSuspend(virDomainPtr dom) {
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
char *info;
struct qemud_vm *vm = qemudFindVMByID(driver, dom->id);
@@ -1854,7 +1885,7 @@ int qemudDomainSuspend(virDomainPtr dom) {
}
-int qemudDomainResume(virDomainPtr dom) {
+static int qemudDomainResume(virDomainPtr dom) {
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
char *info;
struct qemud_vm *vm = qemudFindVMByID(driver, dom->id);
@@ -1879,7 +1910,7 @@ int qemudDomainResume(virDomainPtr dom) {
}
-int qemudDomainDestroy(virDomainPtr dom) {
+static int qemudDomainDestroy(virDomainPtr dom) {
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
struct qemud_vm *vm = qemudFindVMByID(driver, dom->id);
int ret;
@@ -1914,7 +1945,7 @@ static char *qemudDomainGetOSType(virDomainPtr dom) {
return type;
}
-int qemudDomainGetInfo(virDomainPtr dom,
+static int qemudDomainGetInfo(virDomainPtr dom,
virDomainInfoPtr info) {
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
@@ -1941,7 +1972,7 @@ int qemudDomainGetInfo(virDomainPtr dom,
}
-int qemudDomainSave(virDomainPtr dom,
+static int qemudDomainSave(virDomainPtr dom,
const char *path ATTRIBUTE_UNUSED) {
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
struct qemud_vm *vm = qemudFindVMByID(driver, dom->id);
@@ -1958,7 +1989,7 @@ int qemudDomainSave(virDomainPtr dom,
}
-int qemudDomainRestore(virConnectPtr conn,
+static int qemudDomainRestore(virConnectPtr conn,
const char *path ATTRIBUTE_UNUSED) {
/*struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;*/
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, "restore is not supported");
@@ -1966,7 +1997,7 @@ int qemudDomainRestore(virConnectPtr conn,
}
-char *qemudDomainDumpXML(virDomainPtr dom,
+static char *qemudDomainDumpXML(virDomainPtr dom,
int flags ATTRIBUTE_UNUSED) {
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
@@ -1979,7 +2010,7 @@ char *qemudDomainDumpXML(virDomainPtr dom,
}
-int qemudListDefinedDomains(virConnectPtr conn,
+static int qemudListDefinedDomains(virConnectPtr conn,
char **const names, int nnames) {
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
struct qemud_vm *vm = driver->vms;
@@ -2003,13 +2034,13 @@ int qemudListDefinedDomains(virConnectPtr conn,
}
-int qemudNumDefinedDomains(virConnectPtr conn) {
+static int qemudNumDefinedDomains(virConnectPtr conn) {
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
return driver->ninactivevms;
}
-int qemudDomainStart(virDomainPtr dom) {
+static int qemudDomainStart(virDomainPtr dom) {
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
@@ -2023,7 +2054,7 @@ int qemudDomainStart(virDomainPtr dom) {
}
-virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) {
+static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) {
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
struct qemud_vm_def *def;
struct qemud_vm *vm;
@@ -2052,7 +2083,7 @@ virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) {
return dom;
}
-int qemudDomainUndefine(virDomainPtr dom) {
+static int qemudDomainUndefine(virDomainPtr dom) {
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
@@ -2081,7 +2112,7 @@ int qemudDomainUndefine(virDomainPtr dom) {
return 0;
}
-int qemudDomainGetAutostart(virDomainPtr dom,
+static int qemudDomainGetAutostart(virDomainPtr dom,
int *autostart) {
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
@@ -2096,7 +2127,7 @@ int qemudDomainGetAutostart(virDomainPtr dom,
return 0;
}
-int qemudDomainSetAutostart(virDomainPtr dom,
+static int qemudDomainSetAutostart(virDomainPtr dom,
int autostart) {
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
@@ -2141,7 +2172,7 @@ int qemudDomainSetAutostart(virDomainPtr dom,
return 0;
}
-virNetworkPtr qemudNetworkLookupByUUID(virConnectPtr conn ATTRIBUTE_UNUSED,
+static virNetworkPtr qemudNetworkLookupByUUID(virConnectPtr conn ATTRIBUTE_UNUSED,
const unsigned char *uuid) {
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
struct qemud_network *network = qemudFindNetworkByUUID(driver, uuid);
@@ -2159,7 +2190,7 @@ virNetworkPtr qemudNetworkLookupByUUID(virConnectPtr conn ATTRIBUTE_UNUSED,
}
return net;
}
-virNetworkPtr qemudNetworkLookupByName(virConnectPtr conn ATTRIBUTE_UNUSED,
+static virNetworkPtr qemudNetworkLookupByName(virConnectPtr conn ATTRIBUTE_UNUSED,
const char *name) {
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
struct qemud_network *network = qemudFindNetworkByName(driver, name);
@@ -2193,12 +2224,12 @@ static int qemudCloseNetwork(virConnectPtr conn) {
return 0;
}
-int qemudNumNetworks(virConnectPtr conn) {
+static int qemudNumNetworks(virConnectPtr conn) {
struct qemud_driver *driver = (struct qemud_driver *)conn->networkPrivateData;
return driver->nactivenetworks;
}
-int qemudListNetworks(virConnectPtr conn, char **const names, int nnames) {
+static int qemudListNetworks(virConnectPtr conn, char **const names, int nnames) {
struct qemud_driver *driver = (struct qemud_driver *)conn->networkPrivateData;
struct qemud_network *network = driver->networks;
int got = 0, i;
@@ -2220,12 +2251,12 @@ int qemudListNetworks(virConnectPtr conn, char **const names, int nnames) {
return -1;
}
-int qemudNumDefinedNetworks(virConnectPtr conn) {
+static int qemudNumDefinedNetworks(virConnectPtr conn) {
struct qemud_driver *driver = (struct qemud_driver *)conn->networkPrivateData;
return driver->ninactivenetworks;
}
-int qemudListDefinedNetworks(virConnectPtr conn, char **const names, int nnames) {
+static int qemudListDefinedNetworks(virConnectPtr conn, char **const names, int nnames) {
struct qemud_driver *driver = (struct qemud_driver *)conn->networkPrivateData;
struct qemud_network *network = driver->networks;
int got = 0, i;
@@ -2247,7 +2278,7 @@ int qemudListDefinedNetworks(virConnectPtr conn, char **const names, int nnames)
return -1;
}
-virNetworkPtr qemudNetworkCreate(virConnectPtr conn, const char *xml) {
+static virNetworkPtr qemudNetworkCreate(virConnectPtr conn, const char *xml) {
struct qemud_driver *driver = (struct qemud_driver *)conn->networkPrivateData;
struct qemud_network_def *def;
struct qemud_network *network;
@@ -2274,7 +2305,7 @@ virNetworkPtr qemudNetworkCreate(virConnectPtr conn, const char *xml) {
return net;
}
-virNetworkPtr qemudNetworkDefine(virConnectPtr conn, const char *xml) {
+static virNetworkPtr qemudNetworkDefine(virConnectPtr conn, const char *xml) {
struct qemud_driver *driver = (struct qemud_driver *)conn->networkPrivateData;
struct qemud_network_def *def;
struct qemud_network *network;
@@ -2301,7 +2332,7 @@ virNetworkPtr qemudNetworkDefine(virConnectPtr conn, const char *xml) {
return net;
}
-int qemudNetworkUndefine(virNetworkPtr net) {
+static int qemudNetworkUndefine(virNetworkPtr net) {
struct qemud_driver *driver = (struct qemud_driver *)net->conn->networkPrivateData;
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
@@ -2325,7 +2356,7 @@ int qemudNetworkUndefine(virNetworkPtr net) {
return 0;
}
-int qemudNetworkStart(virNetworkPtr net) {
+static int qemudNetworkStart(virNetworkPtr net) {
struct qemud_driver *driver = (struct qemud_driver *)net->conn->networkPrivateData;
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
@@ -2338,7 +2369,7 @@ int qemudNetworkStart(virNetworkPtr net) {
return qemudStartNetworkDaemon(driver, network);
}
-int qemudNetworkDestroy(virNetworkPtr net) {
+static int qemudNetworkDestroy(virNetworkPtr net) {
struct qemud_driver *driver = (struct qemud_driver *)net->conn->networkPrivateData;
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
@@ -2351,7 +2382,7 @@ int qemudNetworkDestroy(virNetworkPtr net) {
return qemudShutdownNetworkDaemon(driver, network);
}
-char *qemudNetworkDumpXML(virNetworkPtr net, int flags ATTRIBUTE_UNUSED) {
+static char *qemudNetworkDumpXML(virNetworkPtr net, int flags ATTRIBUTE_UNUSED) {
struct qemud_driver *driver = (struct qemud_driver *)net->conn->networkPrivateData;
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
@@ -2364,7 +2395,7 @@ char *qemudNetworkDumpXML(virNetworkPtr net, int flags ATTRIBUTE_UNUSED) {
return qemudGenerateNetworkXML(driver, network, network->def);
}
-char *qemudNetworkGetBridgeName(virNetworkPtr net) {
+static char *qemudNetworkGetBridgeName(virNetworkPtr net) {
struct qemud_driver *driver = (struct qemud_driver *)net->conn->networkPrivateData;
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
char *bridge;
@@ -2381,7 +2412,7 @@ char *qemudNetworkGetBridgeName(virNetworkPtr net) {
return bridge;
}
-int qemudNetworkGetAutostart(virNetworkPtr net,
+static int qemudNetworkGetAutostart(virNetworkPtr net,
int *autostart) {
struct qemud_driver *driver = (struct qemud_driver *)net->conn->networkPrivateData;
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
@@ -2396,7 +2427,7 @@ int qemudNetworkGetAutostart(virNetworkPtr net,
return 0;
}
-int qemudNetworkSetAutostart(virNetworkPtr net,
+static int qemudNetworkSetAutostart(virNetworkPtr net,
int autostart) {
struct qemud_driver *driver = (struct qemud_driver *)net->conn->networkPrivateData;
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
diff --git a/src/qemu_driver.h b/src/qemu_driver.h
index e38d1d9ed0..a318d5544a 100644
--- a/src/qemu_driver.h
+++ b/src/qemu_driver.h
@@ -27,89 +27,8 @@
#include "internal.h"
-int qemudStartup(void);
-int qemudReload(void);
-int qemudShutdown(void);
-int qemudActive(void);
int qemudRegister(void);
-virDrvOpenStatus qemudOpen(virConnectPtr conn,
- const char *name,
- int flags);
-
-int qemudGetNodeInfo(virConnectPtr conn,
- virNodeInfoPtr info);
-
-char *qemudGetCapabilities(virConnectPtr conn);
-
-virDomainPtr qemudDomainLookupByID(virConnectPtr conn,
- int id);
-virDomainPtr qemudDomainLookupByUUID(virConnectPtr conn,
- const unsigned char *uuid);
-virDomainPtr qemudDomainLookupByName(virConnectPtr conn,
- const char *name);
-
-int qemudGetVersion(virConnectPtr conn, unsigned long *version);
-int qemudListDomains(virConnectPtr conn,
- int *ids,
- int nids);
-int qemudNumDomains(virConnectPtr conn);
-virDomainPtr qemudDomainCreate(virConnectPtr conn,
- const char *xml,
- unsigned int flags);
-int qemudDomainSuspend(virDomainPtr dom);
-int qemudDomainResume(virDomainPtr dom);
-int qemudDomainDestroy(virDomainPtr dom);
-int qemudDomainGetInfo(virDomainPtr dom,
- virDomainInfoPtr info);
-int qemudDomainSave(virDomainPtr dom,
- const char *path);
-int qemudDomainRestore(virConnectPtr conn,
- const char *path);
-char *qemudDomainDumpXML(virDomainPtr dom,
- int flags);
-int qemudListDefinedDomains(virConnectPtr conn,
- char **const names,
- int nnames);
-int qemudNumDefinedDomains(virConnectPtr conn);
-int qemudDomainStart(virDomainPtr dom);
-virDomainPtr qemudDomainDefine(virConnectPtr conn,
- const char *xml);
-int qemudDomainUndefine(virDomainPtr dom);
-int qemudDomainGetAutostart(virDomainPtr dom,
- int *autostart);
-int qemudDomainSetAutostart(virDomainPtr dom,
- int autostart);
-
-
-virNetworkPtr qemudNetworkLookupByUUID(virConnectPtr conn,
- const unsigned char *uuid);
-virNetworkPtr qemudNetworkLookupByName(virConnectPtr conn,
- const char *name);
-
-int qemudNumNetworks(virConnectPtr conn);
-int qemudListNetworks(virConnectPtr conn,
- char **const names,
- int nnames);
-int qemudNumDefinedNetworks(virConnectPtr conn);
-int qemudListDefinedNetworks(virConnectPtr conn,
- char **const names,
- int nnames);
-virNetworkPtr qemudNetworkCreate(virConnectPtr conn,
- const char *xml);
-virNetworkPtr qemudNetworkDefine(virConnectPtr conn,
- const char *xml);
-int qemudNetworkStart(virNetworkPtr net);
-int qemudNetworkUndefine(virNetworkPtr net);
-int qemudNetworkDestroy(virNetworkPtr net);
-char *qemudNetworkDumpXML(virNetworkPtr net,
- int flags);
-char *qemudNetworkGetBridgeName(virNetworkPtr net);
-int qemudNetworkGetAutostart(virNetworkPtr net,
- int *autostart);
-int qemudNetworkSetAutostart(virNetworkPtr net,
- int autostart);
-
#endif
diff --git a/src/uuid.c b/src/uuid.c
index 29105fac71..6e1dbd7871 100644
--- a/src/uuid.c
+++ b/src/uuid.c
@@ -77,11 +77,22 @@ virUUIDGeneratePseudoRandomBytes(unsigned char *buf,
return 0;
}
+/**
+ * virUUIDGenerate:
+ * @uuid: array of VIR_UUID_RAW_LEN bytes to store the new UUID
+ *
+ * Generates a randomized unique identifier.
+ *
+ * Returns 0 in case of success and -1 in case of failure
+ */
int
virUUIDGenerate(unsigned char *uuid)
{
int err;
+ if (uuid == NULL)
+ return(-1);
+
if ((err = virUUIDGenerateRandomBytes(uuid, VIR_UUID_RAW_LEN)))
qemudLog(QEMUD_WARN,
"Falling back to pseudorandom UUID, "
@@ -90,11 +101,24 @@ virUUIDGenerate(unsigned char *uuid)
return virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_RAW_LEN);
}
+/**
+ * virUUIDParse:
+ * @uuid: zero terminated string representation of the UUID
+ * @rawuuid: array of VIR_UUID_RAW_LEN bytes to store the raw UUID
+ *
+ * Parses the external string representation, allowing spaces and '-'
+ * character in the sequence, and storing the result as a raw UUID
+ *
+ * Returns 0 in case of success and -1 in case of error.
+ */
int
virUUIDParse(const char *uuid, unsigned char *rawuuid) {
const char *cur;
int i;
+ if ((uuid == NULL) || (rawuuid == NULL))
+ return(-1);
+
/*
* do a liberal scan allowing '-' and ' ' anywhere between character
* pairs as long as there is 32 of them in the end.
diff --git a/src/uuid.h b/src/uuid.h
index 65a39010b3..2584694d41 100644
--- a/src/uuid.h
+++ b/src/uuid.h
@@ -22,6 +22,10 @@
#ifndef __VIR_UUID_H__
#define __VIR_UUID_H__
+/**
+ * VIR_UUID_RAW_LEN:
+ * number of bytes used by an UUID in raw form
+ */
#define VIR_UUID_RAW_LEN 16
int virUUIDGenerate(unsigned char *uuid);