Functions

parameter_convert_boolean (in_)

parameter_convert_filename (in_)

parameter_convert_flags (in_, values)

parameter_convert_ip_address (in_)

parameter_convert_nonnegative (in_)

parameter_convert_port (in_)

parameter_convert_positive (in_)

parameter_convert_security_policy (in_)

parameter_convert_string (in_)

parameter_convert_string_list (in_)

parameter_error_quark ()

parameter_load_from_key_file (infos, key_file, group, base)

parameter_typed_value_free (data)

util_create_dirname (path)

util_daemon_pid_file_kill (sig)

util_daemon_set_global_pid_file_proc ()

util_daemon_set_local_pid_file_proc ()

util_set_errno_error (error, save_errno, prefix)

Details

Infinoted.parameter_convert_boolean(in_)
Parameters:

in (bool) – The pointer to the input bool.

Raises:

GLib.Error

Returns:

This function always returns True.

out:

The pointer to the output bool.

Return type:

(bool, out: bool)

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:

GLib.Error

Returns:

True on success, or False otherwise.

out:

The pointer to the output string location.

Return type:

(bool, out: str)

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:

GLib.Error

Returns:

True on success, or False otherwise.

out:

The pointer to the output flags (a int).

Return type:

(bool, out: int)

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:

GLib.Error

Returns:

True on success, or False 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 type Infinity.IpAddress.

Infinoted.parameter_convert_nonnegative(in_)
Parameters:

in (int) – The pointer to the input int.

Raises:

GLib.Error

Returns:

True on success, or False otherwise.

out:

The pointer to the output int.

Return type:

(bool, out: int)

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:

in (int) – The pointer to the input int.

Raises:

GLib.Error

Returns:

True on success, or False otherwise.

out:

The pointer to the output int.

Return type:

(bool, out: int)

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:

in (int) – The pointer to the input int.

Raises:

GLib.Error

Returns:

True on success, or False otherwise.

out:

The pointer to the output int.

Return type:

(bool, out: int)

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:

GLib.Error

Returns:

True on success, or False otherwise.

out:

The pointer to the output Infinity.XmppConnectionSecurityPolicy.

Return type:

(bool, out: Infinity.XmppConnectionSecurityPolicy)

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 type Infinity.XmppConnectionSecurityPolicy.

Infinoted.parameter_convert_string(in_)
Parameters:

in (str) – A pointer to the input string location.

Raises:

GLib.Error

Returns:

This function always returns True.

out:

The pointer to the output string location.

Return type:

(bool, out: str)

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:

GLib.Error

Returns:

This function always returns True.

out:

The pointer to the output string list.

Return type:

(bool, out: str)

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:

int

Returns the #GQuark for errors from the InfinotedParameter module.

Infinoted.parameter_load_from_key_file(infos, key_file, group, base)
Parameters:
Raises:

GLib.Error

Returns:

True on success, otherwise False.

Return type:

bool

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 or None) – The Infinoted.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 a GLib.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:

GLib.Error

Returns:

True on success, or False on error in which case error is set.

Return type:

bool

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:

int

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:

Sets error to save_errno with domain ERRNO_ERROR. If prefix is non-None, prefix is prefixed to error's message, obtained by strerror().