ANSI C UA Server SDK
1.5.1.313
|
Get configuration from a settings backend. More...
Data Structures | |
struct | UaBase_Settings |
Settings structure to get configuration from a settings backend. More... | |
Functions | |
OpcUa_StatusCode | UaBase_Settings_Initialize (UaBase_Settings *pSettings, const char *szPath) |
Initializes a settings structure using the passed file path. More... | |
OpcUa_StatusCode | UaBase_Settings_Flush (UaBase_Settings *pSettings) |
Writes all changes in the passed settings structure to disk. More... | |
OpcUa_StatusCode | UaBase_Settings_Clear (UaBase_Settings *pSettings) |
Closes the passed settings structure. More... | |
OpcUa_StatusCode | UaBase_Settings_BeginGroup (UaBase_Settings *pSettings, const char *szGroup) |
Set the current group of the settings. More... | |
OpcUa_StatusCode | UaBase_Settings_EndGroup (UaBase_Settings *pSettings) |
Clear the current group of the settings. More... | |
OpcUa_StatusCode | UaBase_Settings_ReadString (UaBase_Settings *pSettings, const char *szKey, char *szValue, int len, const char *szDefaultValue) |
Reads a setting as string. More... | |
OpcUa_StatusCode | UaBase_Settings_WriteString (UaBase_Settings *pSettings, const char *szKey, const char *szValue) |
Writes a setting as string. More... | |
OpcUa_StatusCode | UaBase_Settings_ReadUaString (UaBase_Settings *pSettings, const char *szKey, OpcUa_String *pValue, const char *szDefaultValue) |
Reads a setting as string. More... | |
OpcUa_StatusCode | UaBase_Settings_WriteUaString (UaBase_Settings *pSettings, const char *szKey, const OpcUa_String *pValue) |
Writes a setting as string. More... | |
OpcUa_StatusCode | UaBase_Settings_ReadBool (UaBase_Settings *pSettings, const char *szKey, OpcUa_Boolean *pbVal, OpcUa_Boolean bDefVal) |
Returns the boolean value of setting szKey . More... | |
OpcUa_StatusCode | UaBase_Settings_WriteBool (UaBase_Settings *pSettings, const char *szKey, OpcUa_Boolean bVal) |
Write a boolean value to setting szKey . More... | |
OpcUa_StatusCode | UaBase_Settings_ReadInt (UaBase_Settings *pSettings, const char *szKey, OpcUa_Int *piVal, OpcUa_Int iDefVal) |
Returns the integer value of setting szKey . More... | |
OpcUa_StatusCode | UaBase_Settings_WriteInt (UaBase_Settings *pSettings, const char *szKey, OpcUa_Int iVal) |
Write an integer value to setting szKey . More... | |
OpcUa_StatusCode | UaBase_Settings_ReadUInt (UaBase_Settings *pSettings, const char *szKey, OpcUa_UInt *piVal, OpcUa_UInt iDefVal) |
Returns the unsigned integer value of setting szKey . More... | |
OpcUa_StatusCode | UaBase_Settings_WriteUInt (UaBase_Settings *pSettings, const char *szKey, OpcUa_UInt iVal) |
Write an unsigned integer value to setting szKey . More... | |
OpcUa_StatusCode | UaBase_Settings_ReadFloat (UaBase_Settings *pSettings, const char *szKey, OpcUa_Float *pfltVal, OpcUa_Float fltDefVal) |
Returns the float value of setting szKey . More... | |
OpcUa_StatusCode | UaBase_Settings_WriteFloat (UaBase_Settings *pSettings, const char *szKey, OpcUa_Float fltVal) |
Write a float value to setting szKey . More... | |
OpcUa_StatusCode | UaBase_Settings_ReadDouble (UaBase_Settings *pSettings, const char *szKey, OpcUa_Double *pdblVal, OpcUa_Double dblDefVal) |
Returns the double value of setting szKey . More... | |
OpcUa_StatusCode | UaBase_Settings_WriteDouble (UaBase_Settings *pSettings, const char *szKey, OpcUa_Double dblVal) |
Write a double value to setting szKey . More... | |
Get configuration from a settings backend.
The following paragraphs give an overview of the configuration settings. Details about the entries and their valid values can be found in the comments of the configuration file and in the documentation of the UaServer_Configuration structure.
The 'General' section contains settings of the SDK regarding limits in providers, sessions and subscriptions.
In the 'Endpoints' section the endpoints of the server are configured. 'Endpoints/size' is the number of endpoints to be created. The settings of the endpoints follow as 'Endpoints/n/...', where n is the number of the endpoint.
For 'EndpointURL' and 'BindURL' the placeholder [gethostname] can be used. It will be replaced with the content of szHostname passed to the function.
The endpoint settings 'SecurityPolicies' and 'UserTokenPolicies' contain a comma separated list of sections containing suitable settings as described below. The setting 'PKIStore' contains the name of a section containing suitable settings as described below.
For running the server without security, set the PKIStore to a configuration with a PkiType of 'None' ('PKIStore_None' in the example delivered with the SDK), set 'SecurityPolicies' to 'SecurityPolicy_None' only and 'UserTokenPolicies' to 'Anonymous' only.
As an example, there is a commented out HTTPS endpoint declared, by uncommenting it and setting the 'Endpoints/size' setting to 2, the endpoint is created when starting the server.
Sections containing settings for a security policy to be used in the endpoint setting 'SecurityPolicies' are expected to contain two settings, 'Url' and 'MessageSecurity'.
The setting 'MessageSecurity' is one of 'None', 'Sign' or 'SignAndEncrypt', or a combination of the last two.
Sections containing settings for a user token policy to be used in the endpoint setting 'UserTokenPolicies' are expected to contain at least two settings, 'PolicyId' and 'TokenType'.
The 'TokenType' may be one of 'Anonymous', 'UserName' or 'Certificate'. If declaring a user name or a certificate token, a SecurityPolicyUri should be provided for defining how the secret of the token should be encrypted by a client.
Sections containing settings for a PKI store to be used in the endpoint setting 'PKIStore' are expected to contain at least the setting 'PkiType'.
The 'PkiType' may be one of 'None', 'OpenSSL' or, on Windows, 'WIN32'. If declaring an OpenSSL or WIN32 store, additional settings are required as described below:
If a self signed certificate should be created when starting the server, the setting 'GenerateCertificate' has to be set to true and additional settings are required as described below:
The 'PKI' section contains settings for rejected certificates and a list of all existing sections containing settings of a PKI store. The list of stores is needed for creating the certificates before starting up the server.
The 'Discovery' section contains all settings for the registration at a discovery server.
The 'Authentication' section contains settings required by the internal authentication and the authorization module.
OpcUa_StatusCode UaBase_Settings_BeginGroup | ( | UaBase_Settings * | pSettings, |
const char * | szGroup | ||
) |
Set the current group of the settings.
If the group does not exist, it is created. Groups cannot be nested.
pSettings | Pointer to settings object |
szGroup | Name of the group |
OpcUa_StatusCode UaBase_Settings_Clear | ( | UaBase_Settings * | pSettings | ) |
Closes the passed settings structure.
The settings are not flushed automatically, call UaBase_Settings_Flush before if changes should be written to disk.
pSettings | Pointer to settings object. |
OpcUa_StatusCode UaBase_Settings_EndGroup | ( | UaBase_Settings * | pSettings | ) |
Clear the current group of the settings.
pSettings | Pointer to settings object |
OpcUa_StatusCode UaBase_Settings_Flush | ( | UaBase_Settings * | pSettings | ) |
Writes all changes in the passed settings structure to disk.
pSettings | Pointer to settings object |
OpcUa_StatusCode UaBase_Settings_Initialize | ( | UaBase_Settings * | pSettings, |
const char * | szPath | ||
) |
Initializes a settings structure using the passed file path.
The default implementation uses a file based backend.
pSettings | Pointer to settings object |
szPath | Path to the settings file |
OpcUa_StatusCode UaBase_Settings_ReadBool | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
OpcUa_Boolean * | pbVal, | ||
OpcUa_Boolean | bDefVal | ||
) |
Returns the boolean value of setting szKey
.
pSettings | Pointer to settings object |
szKey | Key name which should be read |
pbVal | Pointer to an OpcUa_Boolean where the value is stored |
bDefVal | The default value to return if the setting does not exist |
OpcUa_StatusCode UaBase_Settings_ReadDouble | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
OpcUa_Double * | pdblVal, | ||
OpcUa_Double | dblDefVal | ||
) |
Returns the double value of setting szKey
.
pSettings | Pointer to settings object |
szKey | Key name which should be read |
pdblVal | Pointer to an OpcUa_Double where the value is stored |
dblDefVal | The default value to return if the setting does not exist |
OpcUa_StatusCode UaBase_Settings_ReadFloat | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
OpcUa_Float * | pfltVal, | ||
OpcUa_Float | fltDefVal | ||
) |
Returns the float value of setting szKey
.
pSettings | Pointer to settings object |
szKey | Key name which should be read |
pfltVal | Pointer to an OpcUa_Float where the value is stored |
fltDefVal | The default value to return if the setting does not exist |
OpcUa_StatusCode UaBase_Settings_ReadInt | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
OpcUa_Int * | piVal, | ||
OpcUa_Int | iDefVal | ||
) |
Returns the integer value of setting szKey
.
pSettings | Pointer to settings object |
szKey | Key name which should be read |
piVal | Pointer to an OpcUa_Int where the value is stored |
iDefVal | The default value to return if the setting does not exist |
OpcUa_StatusCode UaBase_Settings_ReadString | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
char * | szValue, | ||
int | len, | ||
const char * | szDefaultValue | ||
) |
Reads a setting as string.
Placeholders of the format $ENV{NAME} are automatically replaced with the content of the environment variable NAME.
pSettings | Pointer to settings object |
szKey | Key name which should be read |
szValue | Pointer to string which receives the read result |
len | Length of szValue in bytes |
szDefaultValue | Default value which should be returned if the key does not exist yet |
OpcUa_StatusCode UaBase_Settings_ReadUaString | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
OpcUa_String * | pValue, | ||
const char * | szDefaultValue | ||
) |
Reads a setting as string.
Placeholders of the format $ENV{NAME} are automatically replaced with the content of the environment variable NAME.
pSettings | Pointer to settings object |
szKey | Key name which should be read |
pValue | Pointer to string which receives the read result |
szDefaultValue | Default value which should be returned if the key does not exist yet |
OpcUa_StatusCode UaBase_Settings_ReadUInt | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
OpcUa_UInt * | piVal, | ||
OpcUa_UInt | iDefVal | ||
) |
Returns the unsigned integer value of setting szKey
.
pSettings | Pointer to settings object |
szKey | Key name which should be read |
piVal | Pointer to an OpcUa_UInt where the value is stored |
iDefVal | The default value to return if the setting does not exist |
OpcUa_StatusCode UaBase_Settings_WriteBool | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
OpcUa_Boolean | bVal | ||
) |
Write a boolean value to setting szKey
.
pSettings | Pointer to settings object |
szKey | Key name which should be written |
bVal | The value to write |
OpcUa_StatusCode UaBase_Settings_WriteDouble | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
OpcUa_Double | dblVal | ||
) |
Write a double value to setting szKey
.
pSettings | Pointer to settings object |
szKey | Key name which should be written |
dblVal | The value to write |
OpcUa_StatusCode UaBase_Settings_WriteFloat | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
OpcUa_Float | fltVal | ||
) |
Write a float value to setting szKey
.
pSettings | Pointer to settings object |
szKey | Key name which should be written |
fltVal | The value to write |
OpcUa_StatusCode UaBase_Settings_WriteInt | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
OpcUa_Int | iVal | ||
) |
Write an integer value to setting szKey
.
pSettings | Pointer to settings object |
szKey | Key name which should be written |
iVal | The value to write |
OpcUa_StatusCode UaBase_Settings_WriteString | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
const char * | szValue | ||
) |
Writes a setting as string.
pSettings | Pointer to settings object |
szKey | Key name which should be written |
szValue | Pointer to string to write |
OpcUa_StatusCode UaBase_Settings_WriteUaString | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
const OpcUa_String * | pValue | ||
) |
Writes a setting as string.
pSettings | Pointer to settings object |
szKey | Key name which should be written |
pValue | Pointer to string to write |
OpcUa_StatusCode UaBase_Settings_WriteUInt | ( | UaBase_Settings * | pSettings, |
const char * | szKey, | ||
OpcUa_UInt | iVal | ||
) |
Write an unsigned integer value to setting szKey
.
pSettings | Pointer to settings object |
szKey | Key name which should be written |
iVal | The value to write |