Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- Infinoted.parameter_convert_boolean(in_)¶
- Parameters:
- Raises:
- Returns:
This function always returns
True
.- out:
The pointer to the output
bool
.
- Return type:
This function simply writes the boolean value from in to out without any further validation.
This is a
Infinoted.ParameterConvertFunc
function that can be used for boolean values.
- Infinoted.parameter_convert_filename(in_)¶
- Parameters:
in (
str
) – A pointer to the input string location.- Raises:
- Returns:
True
on success, orFalse
otherwise.- out:
The pointer to the output string location.
- Return type:
This function converts the input string from UTF-8 to the Glib file name encoding.
This is a
Infinoted.ParameterConvertFunc
function that can be used for strings that should be in Glib file name encoding format instead of UTF-8.
- Infinoted.parameter_convert_flags(in_, values)¶
- Parameters:
in ([
str
]) – The pointer to the input string list.values (
GObject.FlagsValue
) – Allowed flag values.
- Raises:
- Returns:
True
on success, orFalse
otherwise.- out:
The pointer to the output flags (a
int
).
- Return type:
Converts the string list that in points to to a bitmask. This function can not directly be used as a convert function as expected by
Infinoted.ParameterInfo
since it has an additional argument. However, an actual convert function can make use of this function.Each string entry is interpreted as a value of a bitmask. The values list specifies which string constant corresponds to which flag value.
- Infinoted.parameter_convert_ip_address(in_)¶
- Parameters:
in (
str
) – The pointer to the input string location.- Raises:
- Returns:
True
on success, orFalse
otherwise.- out:
The pointer to the output
Infinity.IpAddress
location.
- Return type:
(
bool
, out:Infinity.IpAddress
)
Converts the string that in points to to an
Infinity.IpAddress
value. If the string can not be converted to an IP address, the functions fails and error is set.This is a
Infinoted.ParameterConvertFunc
function that can be used for fields of typeInfinity.IpAddress
.
- Infinoted.parameter_convert_nonnegative(in_)¶
- Parameters:
- Raises:
- Returns:
True
on success, orFalse
otherwise.- out:
The pointer to the output
int
.
- Return type:
This function validates the input number to be non-negative, and converts it into an unsigned integer.
This is a
Infinoted.ParameterConvertFunc
function that can be used for any non-negative numbers.
- Infinoted.parameter_convert_port(in_)¶
- Parameters:
- Raises:
- Returns:
True
on success, orFalse
otherwise.- out:
The pointer to the output
int
.
- Return type:
This function validates the input number to be in the valid range for TCP or UDP ports between 1 and 65535, and converts it to an unsigned integer.
This is a
Infinoted.ParameterConvertFunc
function that can be used for TCP or UDP port numbers.
- Infinoted.parameter_convert_positive(in_)¶
- Parameters:
- Raises:
- Returns:
True
on success, orFalse
otherwise.- out:
The pointer to the output
int
.
- Return type:
This function validates the input number to be positve, i.e. greater than zero, and converts it into an unsigned integer.
This is a
Infinoted.ParameterConvertFunc
function that can be used for any non-negative numbers.
- Infinoted.parameter_convert_security_policy(in_)¶
- Parameters:
in (
str
) – The pointer to the input string location.- Raises:
- Returns:
True
on success, orFalse
otherwise.- out:
The pointer to the output
Infinity.XmppConnectionSecurityPolicy
.
- Return type:
Converts the string that in points to to an
Infinity.XmppConnectionSecurityPolicy
value, by requiring that it is either “no-tls”, “allow-tls” or “require-tls”. If the string is none of these three the function fails and error is set.This is a
Infinoted.ParameterConvertFunc
function that can be used for fields of typeInfinity.XmppConnectionSecurityPolicy
.
- Infinoted.parameter_convert_string(in_)¶
- Parameters:
in (
str
) – A pointer to the input string location.- Raises:
- Returns:
This function always returns
True
.- out:
The pointer to the output string location.
- Return type:
This is basically a no-op, moving the string from the in location to the out location. In case in points to the empty string, it is freed and the output string is set to be
None
.This is a
Infinoted.ParameterConvertFunc
function that can be used for strings that should not be processed further or validated.
- Infinoted.parameter_convert_string_list(in_)¶
- Parameters:
in ([
str
]) – The pointer to the input string list.- Raises:
- Returns:
This function always returns
True
.- out:
The pointer to the output string list.
- Return type:
This is basically a no-op, moving the string list from the in location to the out location. In case in points to an empty string list, or to a string list with only one entry which is the empty string, then the string list is freed and the output string list is set to be
None
.This is a
Infinoted.ParameterConvertFunc
function that can be used for string lists that should not be processed further or validated.
- Infinoted.parameter_error_quark()¶
- Returns:
The error domain for the InfinotedParameter module.
- Return type:
Returns the #GQuark for errors from the InfinotedParameter module.
- Infinoted.parameter_load_from_key_file(infos, key_file, group, base)¶
- Parameters:
infos ([
Infinoted.ParameterInfo
]) – A 0-terminated array ofInfinoted.ParameterInfo
objects.key_file (
GLib.KeyFile
) – TheGLib.KeyFile
to load parameter values from.group (
str
) – The keyfile group to load the values from.base (
object
orNone
) – The instance into which to write the read parameters.
- Raises:
- Returns:
- Return type:
Attempts to read each parameter in infos from key_file and store them in a user-specified structure base. The offset field of
Infinoted.ParameterInfo
specifies where inside base the read parameter value will be written, and the convert field specifies a function which converts the parameter type (integer, string or string list) into the type of the field in the target structure.If the key file does not have an entry for one of the entries in infos, then the current value in the base structure is untouched. This allows setting default values prior to calling this function.
If the function fails, for example because the conversion into the target type failed (which, in turn, might be due to invalid user input),
False
is returned and error is set.
- Infinoted.parameter_typed_value_free(data)¶
- Parameters:
data (
object
orNone
) – TheInfinoted.ParameterTypedValue
to free.
Frees an instance of
Infinoted.ParameterTypedValue
. Formally the argument is kept as a generic pointer so that this function can be used as aGLib.DestroyNotify
callback.Note that the
Infinoted.ParameterTypedValue
needs to be correctly initialized, i.e. its type must be set, before it can be freed.
- Infinoted.util_create_dirname(path)¶
- Parameters:
path (
str
) – The filename to create a path to.- Raises:
- Returns:
True
on success, orFalse
on error in which case error is set.- Return type:
Creates directories leading to the given path. Does not create a directory for the last component of the path, assuming that it is a filename that you are going to write into that directory later.
- Infinoted.util_daemon_pid_file_kill(sig)¶
- Parameters:
sig (
int
) – The signal to send to the daemon process.- Returns:
0 if the signal was sent or nonzero otherwise.
- Return type:
This is a thin wrapper for daemon_pid_file_kill() which uses daemon_pid_file_kill_wait() if available with a timeout of 5 seconds.
- Infinoted.util_daemon_set_global_pid_file_proc()¶
When attempting to read or write the PID file use the global file.
- Infinoted.util_daemon_set_local_pid_file_proc()¶
When attempting to read or write the PID file use the local file which is in the owner’s home directory.
- Infinoted.util_set_errno_error(error, save_errno, prefix)¶
- Parameters:
error (
GLib.Error
) – A pointer to aGLib.Error
pointer, orNone
.save_errno (
int
) – An errno variable.
Sets error to save_errno with domain ERRNO_ERROR. If prefix is non-
None
, prefix is prefixed to error's message, obtained by strerror().