implemented IETF Numeric Version attribute

This commit is contained in:
Andreas Steffen
2012-10-18 22:33:26 +02:00
parent ef315c5a1c
commit a9c9414d58
9 changed files with 436 additions and 8 deletions
+17
View File
@@ -58,6 +58,22 @@ METHOD(os_info_t, get_name, chunk_t,
return this->name;
}
METHOD(os_info_t, get_numeric_version, void,
private_os_info_t *this, u_int32_t *major, u_int32_t *minor)
{
u_char *pos;
if (major)
{
*major = atol(this->version.ptr);
}
pos = memchr(this->version.ptr, '.', this->version.len);
if (minor)
{
*minor = pos ? atol(pos + 1) : 0;
}
}
METHOD(os_info_t, get_version, chunk_t,
private_os_info_t *this)
{
@@ -367,6 +383,7 @@ os_info_t *os_info_create(void)
INIT(this,
.public = {
.get_name = _get_name,
.get_numeric_version = _get_numeric_version,
.get_version = _get_version,
.get_fwd_status = _get_fwd_status,
.get_uptime = _get_uptime,
+9
View File
@@ -51,6 +51,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
*