use OS type on IMV side
[strongswan.git] / src / libimcv / os_info / os_info.h
index 1044263..6946b1e 100644 (file)
 #define OS_INFO_H_
 
 typedef struct os_info_t os_info_t;
+typedef enum os_type_t os_type_t;
 typedef enum os_fwd_status_t os_fwd_status_t;
 
 #include <library.h>
 
+#include <time.h>
+
+enum os_type_t {
+       OS_TYPE_UNKNOWN,
+       OS_TYPE_DEBIAN,
+       OS_TYPE_UBUNTU,
+       OS_TYPE_FEDORA,
+       OS_TYPE_REDHAT,
+       OS_TYPE_CENTOS,
+       OS_TYPE_SUSE,
+       OS_TYPE_GENTOO,
+       OS_TYPE_ANDROID,
+       OS_TYPE_ROOF
+};
+
+extern enum_name_t *os_type_names;
+
 /**
  * Defines the IPv4 forwarding status
  */
@@ -43,6 +61,13 @@ extern enum_name_t *os_fwd_status_names;
 struct os_info_t {
 
        /**
+        * Get the OS type if it can be determined
+        *
+        * @return                                      OS type
+        */
+       os_type_t (*get_type)(os_info_t *this);
+
+       /**
         * Get the OS product name or distribution
         *
         * @return                                      OS name
@@ -50,6 +75,15 @@ struct os_info_t {
        chunk_t (*get_name)(os_info_t *this);
 
        /**
+        * Get the numeric OS version or release
+        *
+        * @param major                         OS major version number
+        * @param minor                         OS minor version number
+        */
+       void (*get_numeric_version)(os_info_t *this, u_int32_t *major,
+                                                                                                u_int32_t *minor);
+
+       /**
         * Get the OS version or release
         *
         * @return                                      OS version
@@ -64,6 +98,21 @@ struct os_info_t {
        os_fwd_status_t (*get_fwd_status)(os_info_t *this);
 
        /**
+        * Get the OS uptime in seconds
+        *
+        * @return                                      OS uptime
+        */
+       time_t (*get_uptime)(os_info_t *this);
+
+       /**
+        * Get an OS setting (restricted to /proc, /sys, and /etc)
+        *
+        * @param name                          name of OS setting
+        * @return                                      value of OS setting
+        */
+       chunk_t (*get_setting)(os_info_t *this, char *name);
+
+       /**
         * Enumerates over all installed packages
         *
         * @return                              return package enumerator
@@ -77,6 +126,14 @@ struct os_info_t {
 };
 
 /**
+ * Convert an OS name into an OS enumeration type
+ *
+ * @param name                         OS name
+ * @return                                     OS enumeration type
+ */
+os_type_t os_type_from_name(chunk_t name);
+
+/**
  * Create an os_info_t object
  */
 os_info_t* os_info_create(void);