-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src/version.[ch]: Add version information API calls
Add shared object library and project version information API calls. This will enable downstream projects to compare the library versions of the one installed on the system (via API calls) and the one linked against (via defines in 'version.h' during build) at runtime. Signed-off-by: David Schweizer <[email protected]>
- Loading branch information
Showing
3 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,7 @@ set(libsrc | |
src/xml.c | ||
src/xpath.c | ||
src/validation.c | ||
src/version.c | ||
${type_plugins}) | ||
|
||
set(headers | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* @file version.c | ||
* @author David Schweizer <[email protected]> | ||
* @brief Libyang version API calls | ||
* | ||
* Copyright (c) 2024 Network Device Education Foundation (NetDEF), Inc. | ||
* | ||
* This source code is licensed under BSD 3-Clause License (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
|
||
#include "version.h" | ||
|
||
static struct ly_version _v_so = { | ||
.major = LY_VERSION_MAJOR, | ||
.minor = LY_VERSION_MINOR, | ||
.micro = LY_VERSION_MICRO, | ||
.str = LY_VERSION | ||
}; | ||
|
||
static struct ly_version _v_proj = { | ||
.major = LY_PROJ_VERSION_MAJOR, | ||
.minor = LY_PROJ_VERSION_MINOR, | ||
.micro = LY_PROJ_VERSION_MICRO, | ||
.str = LY_PROJ_VERSION | ||
}; | ||
|
||
LIBYANG_API_DEF struct ly_version ly_get_so_version(void) | ||
{ | ||
return _v_so; | ||
} | ||
|
||
LIBYANG_API_DEF const char *ly_get_so_version_str(void) | ||
{ | ||
return _v_so.str; | ||
} | ||
|
||
LIBYANG_API_DEF struct ly_version ly_get_project_version(void) | ||
{ | ||
return _v_proj; | ||
} | ||
|
||
LIBYANG_API_DEF const char *ly_get_project_version_str(void) | ||
{ | ||
return _v_proj.str; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters