diff --git a/Connect.cs b/Connect.cs index 5530c32..516bc5a 100644 --- a/Connect.cs +++ b/Connect.cs @@ -11,6 +11,9 @@ namespace Libvirt { + /// + /// The Connect class expose all connection related methods + /// public class Connect { private const int MaxStringLength = 1024; diff --git a/Domain.cs b/Domain.cs index ec33fcf..2f8c9d8 100644 --- a/Domain.cs +++ b/Domain.cs @@ -11,6 +11,9 @@ namespace Libvirt { + /// + /// The Domain class expose the domains related methods + /// public class Domain { /// @@ -314,7 +317,7 @@ public class Domain /// Path to the interface. /// /// - /// A network interface stats (returned). + /// A network interface stats (returned). /// /// /// Size of stats structure. diff --git a/Errors.cs b/Errors.cs index 06aa957..a107cb6 100644 --- a/Errors.cs +++ b/Errors.cs @@ -38,7 +38,7 @@ public class Errors /// A pointer to the user data provided in the handler callback. /// /// - /// A function to get called in case of error or NULL + /// A function to get called in case of error or NULL /// [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virConnSetErrorFunc")] public static extern void ConnSetErrorFunc(IntPtr conn, IntPtr userData, [MarshalAs(UnmanagedType.FunctionPtr)] ErrorFunc handler); @@ -49,7 +49,7 @@ public class Errors /// One will need to free the result with virResetError(). /// /// - /// A target to receive the copy. + /// A target to receive the copy. /// /// /// 0 if no error was found and the error code otherwise and -1 in case of parameter error. @@ -61,7 +61,7 @@ public class Errors /// Default routine reporting an error to stderr. /// /// - /// A pointer to the error. + /// A pointer to the error. /// [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virDefaultErrorFunc")] public static extern void DefaultErrorFunc([In] Error err); @@ -70,7 +70,7 @@ public class Errors /// Resets and frees the given error. /// /// - /// A error to free. + /// A error to free. /// [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virFreeError")] public static extern void FreeError(Error err); // Does not work, anybody know why? @@ -89,7 +89,7 @@ public class Errors /// Reset the error being pointed to. /// /// - /// A pointer to the to clean up. + /// A pointer to the to clean up. /// [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virResetError")] public static extern void ResetError(Error err); @@ -105,7 +105,7 @@ public class Errors /// Save the last error into a new error object. /// /// - /// A pointer to the copied error or NULL if allocation failed. + /// A pointer to the copied error or NULL if allocation failed. /// It is the caller's responsibility to free the error with virFreeError(). /// [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virSaveLastError")] @@ -119,7 +119,7 @@ public class Errors /// A pointer to the user data provided in the handler callback. /// /// - /// A function to get called in case of error or NULL. + /// A function to get called in case of error or NULL. /// [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virSetErrorFunc")] public static extern void SetErrorFunc(IntPtr userData, [MarshalAs(UnmanagedType.FunctionPtr)] ErrorFunc handler); diff --git a/Event.cs b/Event.cs index 1540d70..c6a0673 100644 --- a/Event.cs +++ b/Event.cs @@ -10,6 +10,9 @@ namespace Libvirt { + /// + /// The Event class expose all the event related methods + /// public class Event { /// diff --git a/Interface.cs b/Interface.cs index 51d1f76..9434b2b 100644 --- a/Interface.cs +++ b/Interface.cs @@ -8,6 +8,9 @@ namespace Libvirt { + /// + /// The Interface class expose all interface related methods + /// public class Interface { // TODO virInterfaceCreate diff --git a/Library.cs b/Library.cs index 63348d4..04dcea9 100644 --- a/Library.cs +++ b/Library.cs @@ -10,6 +10,9 @@ namespace Libvirt { + /// + /// The Library class expose all libvirt library related methods + /// public class Library { /// diff --git a/MarshalHelper.cs b/MarshalHelper.cs index fc93893..4776dc5 100644 --- a/MarshalHelper.cs +++ b/MarshalHelper.cs @@ -11,8 +11,17 @@ namespace Libvirt { + /// + /// The MarshalHelper class provide some methods that simplify marshaling + /// public class MarshalHelper { + /// + /// Convert an IntPtr to a string array + /// + /// The pointer to the first element of the array + /// The number of elements in the array + /// The string array public static string[] ptrToStringArray(IntPtr stringPtr, int stringCount) { string[] members = new string[stringCount]; @@ -23,13 +32,22 @@ public static string[] ptrToStringArray(IntPtr stringPtr, int stringCount) } return members; } - + /// + /// Convert an IntPtr to a string + /// + /// The pointer + /// The string public static string ptrToString(IntPtr stringPtr) { IntPtr s = Marshal.ReadIntPtr(stringPtr, IntPtr.Size); return Marshal.PtrToStringAnsi(s); } - + /// + /// Shift a pointer by offset (32 or 64 bits pointer) + /// + /// The pointer + /// The offset in bytes + /// the shifted pointer public static IntPtr IntPtrOffset(IntPtr src, int offset) { switch (IntPtr.Size) diff --git a/NativeFunctions.cs b/NativeFunctions.cs index 71136b8..dc27991 100644 --- a/NativeFunctions.cs +++ b/NativeFunctions.cs @@ -7,16 +7,21 @@ */ using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; namespace Libvirt { + /// + /// The class expose some useful native functions + /// public class NativeFunctions { // TODO : this is a temporary workaround for virConnectOpenAuth callback, this should be removed + /// + /// duplicate a string. The strdup function shall return a pointer to a new string, which is a duplicate of the string pointed to by s1. + /// + /// Pointer to the string that should be duplicated + /// a pointer to a new string on success. Otherwise, it shall return a null pointer [DllImport("msvcrt.dll", EntryPoint = "_strdup", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr StrDup(IntPtr strSource); diff --git a/Network.cs b/Network.cs index 14f418b..43ba779 100644 --- a/Network.cs +++ b/Network.cs @@ -11,6 +11,9 @@ namespace Libvirt { + /// + /// The Network clas expose all libvirt network related functions + /// public class Network { /// diff --git a/Node.cs b/Node.cs index aae0ae9..681269b 100644 --- a/Node.cs +++ b/Node.cs @@ -11,6 +11,9 @@ namespace Libvirt { + /// + /// The Node class expose all libvirt node related functions + /// public class Node { private const int MaxStringLength = 1024; diff --git a/Secret.cs b/Secret.cs index 34f38a0..885a52e 100644 --- a/Secret.cs +++ b/Secret.cs @@ -8,6 +8,9 @@ namespace Libvirt { + /// + /// The Secret class expose all libvirt secret related functions + /// public class Secret { // TODO virSecretDefineXML diff --git a/StoragePool.cs b/StoragePool.cs index 77a991c..da35f3b 100644 --- a/StoragePool.cs +++ b/StoragePool.cs @@ -11,6 +11,9 @@ namespace Libvirt { + /// + /// The StoragePool class expose all libvirt storage pool related functions + /// public class StoragePool { private const int MaxStringLength = 1024; @@ -90,7 +93,7 @@ public class StoragePool /// A pointer to storage pool. /// /// - /// A flags for obliteration process. + /// A flags for obliteration process. /// /// /// 0 on success, or -1 if it could not be obliterate. diff --git a/StorageVol.cs b/StorageVol.cs index f5d2927..6c44073 100644 --- a/StorageVol.cs +++ b/StorageVol.cs @@ -11,24 +11,19 @@ namespace Libvirt { + /// + /// The StorageVol class expose all libvirt storage volume related functions + /// public class StorageVol { /// /// Create a storage volume within a pool based on an XML description. Not all pools support creation of volumes. /// - /// - /// A pointer to storage pool. - /// - /// - /// A description of volume to create. - /// - /// - /// A flags for creation (unused, pass 0). - /// - /// - /// The storage volume, or NULL on error. - /// + /// A pointer to storage pool. + /// A description of volume to create. + /// A flags for creation (unused, pass 0). + /// The storage volume, or NULL on error. [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virStorageVolCreateXML")] public static extern IntPtr CreateXML(IntPtr pool, string xmldesc, uint flags); @@ -36,18 +31,10 @@ public class StorageVol /// Create a storage volume in the parent pool, using the 'clonevol' volume as input. /// Information for the new volume (name, perms) are passed via a typical volume XML description. /// - /// - /// A pointer to parent pool for the new volume. - /// - /// - /// A description of volume to create. - /// - /// - /// A storage volume to use as input. - /// - /// - /// A flags for creation (unused, pass 0). - /// + /// A pointer to parent pool for the new volume. + /// A description of volume to create. + /// A storage volume to use as input. + /// A flags for creation (unused, pass 0). /// /// A the storage volume, or NULL on error. /// @@ -57,27 +44,17 @@ public class StorageVol /// /// Delete the storage volume from the pool. /// - /// - /// A pointer to storage volume. - /// - /// - /// A future flags, use 0 for now. - /// - /// - /// 0 on success, or -1 on error. - /// + /// A pointer to storage volume. + /// A future flags, use 0 for now. + /// 0 on success, or -1 on error. [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virStorageVolDelete")] public static extern int Delete(IntPtr vol, uint flags); /// /// Release the storage volume handle. The underlying storage volume continues to exist. /// - /// - /// A pointer to storage volume. - /// - /// - /// 0 on success, or -1 on error. - /// + /// A pointer to storage volume. + /// 0 on success, or -1 on error. [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virStorageVolFree")] public static extern int Free(IntPtr vol); @@ -87,27 +64,17 @@ public class StorageVol /// WARNING: When writing libvirt bindings in other languages, do not use this function. /// Instead, store the connection and the volume object together. /// - /// - /// A - /// - /// - /// A - /// + /// A pointer to the storage volume + /// A A Pointer to the connect that hold the storage volume [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virStorageVolGetConnect")] public static extern IntPtr GetConnect(IntPtr vol); /// /// Fetches volatile information about the storage volume such as its current allocation. /// - /// - /// A pointer to storage volume. - /// - /// - /// A pointer at which to store info. - /// - /// - /// 0 on success, or -1 on failure. - /// + /// A pointer to storage volume. + /// A pointer at which to store info. + /// 0 on success, or -1 on failure. [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virStorageVolGetInfo")] public static extern int GetInfo(IntPtr vol, ref StorageVolInfo info); @@ -115,12 +82,8 @@ public class StorageVol /// Fetch the storage volume key. /// This is globally unique, so the same volume will have the same key no matter what host it is accessed from /// - /// - /// A pointer to storage volume. - /// - /// - /// The volume key, or NULL on error. - /// + /// A pointer to storage volume. + /// The volume key, or NULL on error. [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virStorageVolGetKey")] [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(StringWithoutNativeCleanUpMarshaler))] public static extern string GetKey(IntPtr vol); @@ -128,12 +91,8 @@ public class StorageVol /// /// Fetch the storage volume name. This is unique within the scope of a pool. /// - /// - /// A pointer to storage volume. - /// - /// - /// The volume name, or NULL on error. - /// + /// A pointer to storage volume. + /// The volume name, or NULL on error. [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virStorageVolGetName")] [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(StringWithoutNativeCleanUpMarshaler))] public static extern string GetName(IntPtr vol); @@ -144,9 +103,7 @@ public class StorageVol /// or dynamically assigned at pool startup. /// Consult pool documentation for information on getting the persistent naming. /// - /// - /// A pointer to storage volume. - /// + /// A pointer to storage volume. /// /// The storage volume path, or NULL on error. /// @@ -157,15 +114,9 @@ public class StorageVol /// /// Fetch an XML document describing all aspects of the storage volume. /// - /// - /// A pointer to storage volume. - /// - /// - /// A flags for XML generation (unused, pass 0). - /// - /// - /// The XML document, or NULL on error. - /// + /// A pointer to storage volume. + /// A flags for XML generation (unused, pass 0). + /// The XML document, or NULL on error. [DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virStorageVolGetXMLDesc")] [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(StringWithoutNativeCleanUpMarshaler))] public static extern string GetXMLDesc(IntPtr vol, uint flags); @@ -173,12 +124,8 @@ public class StorageVol /// /// Fetch a pointer to a storage volume based on its globally unique key. /// - /// - /// A pointer to hypervisor connection. - /// - /// - /// A globally unique key. - /// + /// A pointer to hypervisor connection. + /// A globally unique key. /// /// A storage volume, or NULL if not found / error. /// @@ -188,12 +135,8 @@ public class StorageVol /// /// Fetch a pointer to a storage volume based on its name within a pool. /// - /// - /// A pointer to storage pool. - /// - /// - /// A name of storage volume. - /// + /// A pointer to storage pool. + /// A name of storage volume. /// /// A storage volume, or NULL if not found / error. /// @@ -203,12 +146,8 @@ public class StorageVol /// /// Fetch a pointer to a storage volume based on its locally (host) unique path. /// - /// - /// A pointer to hypervisor connection. - /// - /// - /// A locally unique path. - /// + /// A pointer to hypervisor connection. + /// A locally unique path. /// /// A storage volume, or NULL if not found / error. /// @@ -223,9 +162,7 @@ public class StorageVol /// and it is required that the connection remain open until all threads have finished using it. ie, /// each new thread using a vol would increment the reference count. /// - /// - /// A the vol to hold a reference on. - /// + /// A the vol to hold a reference on. /// /// A 0 in case of success, -1 in case of failure. /// diff --git a/Stream.cs b/Stream.cs index 3b24543..bef3719 100644 --- a/Stream.cs +++ b/Stream.cs @@ -8,6 +8,9 @@ namespace Libvirt { + /// + /// The Stream class expose all libvirt stream related functions + /// public class Stream { // TODO virStreamAbort