libyang 6.4.3
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
Loading...
Searching...
No Matches
semver.h File Reference

ietf-yang-semver API More...

#include <stdint.h>
#include "plugins_exts.h"
#include "tree_schema.h"
Include dependency graph for semver.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lys_ext_instance_semver
 Structure with parsed semver version. More...
 

Enumerations

enum  lys_ext_instance_semver_compat { LYS_EXT_SEMVER_COMPAT_NONE = 0 , LYS_EXT_SEMVER_COMPAT_COMPATIBLE , LYS_EXT_SEMVER_COMPAT_NON_COMPATIBLE }
 COMPAT modifier of semver. More...
 

Functions

LIBYANG_API_DECL int lys_semver_cmp (const struct lys_ext_instance_semver *ver1, const struct lys_ext_instance_semver *ver2)
 Compare semantic versions ignoring metadata.
 
LIBYANG_API_DECL const struct lys_ext_instance_semverlys_semver_get (const struct lys_module *mod, const char **semver_str)
 Get semantic version of a module.
 
LIBYANG_API_DECL const struct lys_ext_instance_semverlysp_semver_get (const struct lysp_module *pmod, const char **semver_str)
 Get semantic version of a parsed (sub)module.
 

Detailed Description

ietf-yang-semver API

Author
Michal Vasko mvask.nosp@m.o@ce.nosp@m.snet..nosp@m.cz

Copyright (c) 2026 CESNET, z.s.p.o.

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

Definition in file semver.h.


Data Structure Documentation

◆ lys_ext_instance_semver

struct lys_ext_instance_semver

Structure with parsed semver version.

MAJOR.MINOR.PATCH(_COMPAT)(-PRE_RELEASE)(+BUILD)

Definition at line 41 of file semver.h.

Data Fields
char * build_meta

Optional BUILD metadata.

enum lys_ext_instance_semver_compat compat

Optional COMPAT version modifier.

int32_t major

MAJOR version number.

int32_t minor

MINOR version number.

int32_t patch

PATCH version number.

char * pre_release_meta

Optional PRE_RELEASE matadata.

Enumeration Type Documentation

◆ lys_ext_instance_semver_compat

COMPAT modifier of semver.

Enumerator
LYS_EXT_SEMVER_COMPAT_NONE 

No COMPAT modifier.

LYS_EXT_SEMVER_COMPAT_COMPATIBLE 

COMPAT modifier "compatible".

LYS_EXT_SEMVER_COMPAT_NON_COMPATIBLE 

COMPAT modifier "non_compatible".

Definition at line 30 of file semver.h.

Function Documentation

◆ lys_semver_cmp()

LIBYANG_API_DECL int lys_semver_cmp ( const struct lys_ext_instance_semver ver1,
const struct lys_ext_instance_semver ver2 
)

Compare semantic versions ignoring metadata.

Parameters
[in]ver1First semantic version.
[in]ver2Second semantic version.
Returns
-1 if ver1 < ver2,
0 if ver1 == ver2,
1 if ver1 > ver2;

◆ lys_semver_get()

LIBYANG_API_DECL const struct lys_ext_instance_semver * lys_semver_get ( const struct lys_module mod,
const char **  semver_str 
)

Get semantic version of a module.

To get version of a submodule, use lysp_semver_get().

Parameters
[in]modModule to use.
[out]semver_strOptional string semantic version if defined for mod at its current revision. NULL otherwise.
Returns
Semantic version structure;
NULL if no semantic version is defined for mod at its current revision.

◆ lysp_semver_get()

LIBYANG_API_DECL const struct lys_ext_instance_semver * lysp_semver_get ( const struct lysp_module pmod,
const char **  semver_str 
)

Get semantic version of a parsed (sub)module.

Parameters
[in]pmodParsed (sub)module to use.
[out]semver_strOptional string semantic version if defined for mod at its current revision. NULL otherwise.
Returns
Semantic version structure;
NULL if no semantic version is defined for pmod at its current revision.