Crate stumpless_sys

Crate stumpless_sys 

Source
Expand description

FFI bindings for the Stumpless logging library.

These wrappings are intended to be the bare minimum to use Stumpless from a Rust application.

§Create Features

Stumpless provides a number of build configuration options that can be used to enable or disable different functionality. This crate exposes these options as the following features.

§Target Features

  • journald - Enables targets that can send logs to a systemd journald daemon.
  • network - Enables targets that can send logs to a server over a network connection.
  • socket - Enables targets that can send logs to Unix sockets.
  • wel - Enables targets that can send logs to the Windows Event Log.

Structs§

_IO_FILE
_IO_codecvt
_IO_marker
_IO_wide_data
stumpless_element
An element of structured data.
stumpless_entry
A log entry.
stumpless_error
Information describing an error encountered by the library.
stumpless_param
A parameter within a structured data element.
stumpless_target
A target that log entries can be sent to.
stumpless_version
A description of a library version. This project follows semantic versioning.

Constants§

stumpless_error_id_STUMPLESS_ADDRESS_FAILURE
stumpless_error_id_STUMPLESS_ARGUMENT_EMPTY
stumpless_error_id_STUMPLESS_ARGUMENT_TOO_BIG
stumpless_error_id_STUMPLESS_DUPLICATE_ELEMENT
stumpless_error_id_STUMPLESS_ELEMENT_NOT_FOUND
stumpless_error_id_STUMPLESS_FILE_OPEN_FAILURE
stumpless_error_id_STUMPLESS_FILE_WRITE_FAILURE
stumpless_error_id_STUMPLESS_FUNCTION_TARGET_FAILURE
stumpless_error_id_STUMPLESS_GETHOSTNAME_FAILURE
stumpless_error_id_STUMPLESS_INDEX_OUT_OF_BOUNDS
stumpless_error_id_STUMPLESS_INVALID_ENCODING
stumpless_error_id_STUMPLESS_INVALID_FACILITY
stumpless_error_id_STUMPLESS_INVALID_ID
stumpless_error_id_STUMPLESS_INVALID_PARAM_STRING
stumpless_error_id_STUMPLESS_INVALID_SEVERITY
stumpless_error_id_STUMPLESS_JOURNALD_FAILURE
stumpless_error_id_STUMPLESS_MEMORY_ALLOCATION_FAILURE
stumpless_error_id_STUMPLESS_NETWORK_CLOSED
stumpless_error_id_STUMPLESS_NETWORK_PROTOCOL_UNSUPPORTED
stumpless_error_id_STUMPLESS_PARAM_NOT_FOUND
stumpless_error_id_STUMPLESS_SOCKET_BIND_FAILURE
stumpless_error_id_STUMPLESS_SOCKET_CONNECT_FAILURE
stumpless_error_id_STUMPLESS_SOCKET_FAILURE
stumpless_error_id_STUMPLESS_SOCKET_SEND_FAILURE
stumpless_error_id_STUMPLESS_SQLITE3_BUSY
stumpless_error_id_STUMPLESS_SQLITE3_CALLBACK_FAILURE
stumpless_error_id_STUMPLESS_SQLITE3_FAILURE
stumpless_error_id_STUMPLESS_STREAM_WRITE_FAILURE
stumpless_error_id_STUMPLESS_TARGET_INCOMPATIBLE
stumpless_error_id_STUMPLESS_TARGET_UNSUPPORTED
stumpless_error_id_STUMPLESS_TRANSPORT_PROTOCOL_UNSUPPORTED
stumpless_error_id_STUMPLESS_WINDOWS_EVENT_LOG_CLOSE_FAILURE
stumpless_error_id_STUMPLESS_WINDOWS_EVENT_LOG_OPEN_FAILURE
stumpless_error_id_STUMPLESS_WINDOWS_FAILURE
stumpless_facility_STUMPLESS_FACILITY_ALERT
stumpless_facility_STUMPLESS_FACILITY_AUDIT
stumpless_facility_STUMPLESS_FACILITY_AUTH
stumpless_facility_STUMPLESS_FACILITY_AUTH2
stumpless_facility_STUMPLESS_FACILITY_CRON
stumpless_facility_STUMPLESS_FACILITY_CRON2
stumpless_facility_STUMPLESS_FACILITY_DAEMON
stumpless_facility_STUMPLESS_FACILITY_FTP
stumpless_facility_STUMPLESS_FACILITY_KERN
stumpless_facility_STUMPLESS_FACILITY_LOCAL0
stumpless_facility_STUMPLESS_FACILITY_LOCAL1
stumpless_facility_STUMPLESS_FACILITY_LOCAL2
stumpless_facility_STUMPLESS_FACILITY_LOCAL3
stumpless_facility_STUMPLESS_FACILITY_LOCAL4
stumpless_facility_STUMPLESS_FACILITY_LOCAL5
stumpless_facility_STUMPLESS_FACILITY_LOCAL6
stumpless_facility_STUMPLESS_FACILITY_LOCAL7
stumpless_facility_STUMPLESS_FACILITY_LPR
stumpless_facility_STUMPLESS_FACILITY_MAIL
stumpless_facility_STUMPLESS_FACILITY_NEWS
stumpless_facility_STUMPLESS_FACILITY_NTP
stumpless_facility_STUMPLESS_FACILITY_SYSLOG
stumpless_facility_STUMPLESS_FACILITY_USER
stumpless_facility_STUMPLESS_FACILITY_UUCP
stumpless_network_protocol_STUMPLESS_IPV4_NETWORK_PROTOCOL
< Internet Protocol version 4, RFC 791
stumpless_network_protocol_STUMPLESS_IPV6_NETWORK_PROTOCOL
< Internet Protocl version 6, RFC 8200
stumpless_severity_STUMPLESS_SEVERITY_ALERT
stumpless_severity_STUMPLESS_SEVERITY_CRIT
stumpless_severity_STUMPLESS_SEVERITY_DEBUG
stumpless_severity_STUMPLESS_SEVERITY_EMERG
stumpless_severity_STUMPLESS_SEVERITY_ERR
stumpless_severity_STUMPLESS_SEVERITY_INFO
stumpless_severity_STUMPLESS_SEVERITY_NOTICE
stumpless_severity_STUMPLESS_SEVERITY_WARNING
stumpless_target_type_STUMPLESS_BUFFER_TARGET
stumpless_target_type_STUMPLESS_CHAIN_TARGET
stumpless_target_type_STUMPLESS_FILE_TARGET
stumpless_target_type_STUMPLESS_FUNCTION_TARGET
stumpless_target_type_STUMPLESS_JOURNALD_TARGET
stumpless_target_type_STUMPLESS_NETWORK_TARGET
stumpless_target_type_STUMPLESS_SOCKET_TARGET
stumpless_target_type_STUMPLESS_SQLITE3_TARGET
stumpless_target_type_STUMPLESS_STREAM_TARGET
stumpless_target_type_STUMPLESS_WINDOWS_EVENT_LOG_TARGET
stumpless_transport_protocol_STUMPLESS_TCP_TRANSPORT_PROTOCOL
< TCP, RFC 793
stumpless_transport_protocol_STUMPLESS_UDP_TRANSPORT_PROTOCOL
< UDP, RFC 768

Functions§

stump
Logs a message to the default target.
stump_str
Logs a message to the default target.
stump_trace
Logs a message to the default target, along with the file, line, and function information specified in a structured data element.
stump_trace_str
Logs a message to the default target, along with the file, line, and function information specified in a structured data element.
stumpless_add_element
Adds an element to an entry. The element is appended to the end of the list of elements in this entry.
stumpless_add_entry
Adds an entry into a given target. This is the primary logging function of stumpless; all other logging functions call this one after performing any setup specific to themselves.
stumpless_add_log
Adds a log message with a priority to a given target.
stumpless_add_log_str
Adds a log message with a priority to a given target.
stumpless_add_message
Adds a message to a given target.
stumpless_add_message_str
Adds a string message to a given target.
stumpless_add_new_element
Creates a new element with the given name and adds it to this entry.
stumpless_add_new_param
Creates a new param and adds it to the given element.
stumpless_add_new_param_to_entry
Creates a new param and adds it to the given element in the given entry. If an element with the given name does not exist in the given entry, then one will be created with the new param added to it.
stumpless_add_param
Adds a param to an element.
stumpless_add_target_to_chain
Adds a target to an existing chain target.
stumpless_close_buffer_target
Closes a buffer target.
stumpless_close_chain_and_contents
Closes a chain of targets.
stumpless_close_chain_only
Closes a chain target.
stumpless_close_file_target
Closes a file target.
stumpless_close_function_target
Closes a function target.
stumpless_close_network_target
Closes a network target.
stumpless_close_sqlite3_target_and_db
Closes a SQLite3 target and its database handle.
stumpless_close_sqlite3_target_only
Closes a SQLite3 target, but does not touch the database handle.
stumpless_close_stream_target
Closes a stream target.
stumpless_close_target
Closes a target.
stumpless_copy_element
Creates a copy of an element.
stumpless_copy_entry
Creates a copy of an entry.
stumpless_copy_param
Creates a copy of a param.
stumpless_create_default_sqlite3_table
Creates a table in the target’s database for use with the default SQLite3 insertion behavior. The schema of this table is described below. Note that the value of \c STUMPLESS_DEFAULT_SQLITE3_TABLE_NAME_STRING is configurable and set at build time for the library.
stumpless_destroy_element
An alias for stumpless_destroy_element_and_contents.
stumpless_destroy_element_and_contents
Destroys an element as well as all params that it contains, freeing any allocated memory.
stumpless_destroy_element_only
Destroys an element, freeing any allocated memory. Associated params are left untouched, and must be destroyed separately.
stumpless_destroy_entry
An alias for stumpless_destroy_entry_and_contents.
stumpless_destroy_entry_and_contents
Destroys an entry as well as all elements and params that it contains, freeing any allocated memory.
stumpless_destroy_entry_only
Destroys an entry, freeing any allocated memory. Associated elements and params are left untouched, and must be destroyed separately.
stumpless_destroy_param
Destroys a param, freeing any allocated memory.
stumpless_element_has_param
True if the given element has a param with the given name, false otherwise.
stumpless_element_to_string
Returns name and params from element as a formatted string. The character buffer should be freed when no longer is needed by the caller.
stumpless_entry_has_element
True if the given entry has an element with the given name, false otherwise.
stumpless_free_all
Closes the default target if it has been opened, frees all memory allocated internally, and performs any other necessary cleanup.
stumpless_free_thread
Frees all memory allocated internally to the calling thread, and performs any other thread-specific cleanup.
stumpless_get_chain_length
Gets the number of targets currently in a chain.
stumpless_get_cons_stream
stumpless_get_current_target
Gets the current target.
stumpless_get_default_facility
Gets the default facility of a target.
stumpless_get_default_target
Gets the default target.
stumpless_get_destination
Gets the destination of a network target. The character buffer returned must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_element_by_index
Returns the element at the given index in this Entry.
stumpless_get_element_by_name
Returns the element with the given name in this entry, if it is found.
stumpless_get_element_count
Returns the number of elements in the given entry.
stumpless_get_element_index
Returns the index of the element with the given name in this entry, if it is found.
stumpless_get_element_name
Returns the name of the given element. The character buffer must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_entry_app_name
Returns the app name of the given entry. The character buffer returned must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_entry_facility
Returns the facility code of the given entry.
stumpless_get_entry_hostname
Returns the hostname of a given entry. If hostname is not set it will return the machine hostname. The result character buffer must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_entry_message
Returns the message of the given entry. The character buffer returned must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_entry_msgid
Returns the msgid of the given entry. The character buffer returned must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_entry_param_by_index
Gets the param from the element at the given index in an entry.
stumpless_get_entry_param_by_name
Gets the first param from the element with the given name in an entry.
stumpless_get_entry_param_value_by_index
Gets the value of the param from the element at the given index in an entry. The result character buffer must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_entry_param_value_by_name
Gets the value of the first param from the element with the given name in an entry. The result character buffer must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_entry_prival
Returns the prival of the given entry, as defined in RFC 5424.
stumpless_get_entry_procid
Returns the procid of a given entry. If procid is not set it will return the ProcessID. The result character buffer must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_entry_severity
Returns the severity code of the given entry.
stumpless_get_error
Retrieves the error encountered by the last library call.
stumpless_get_error_id
Gets the error id of the given error.
stumpless_get_error_id_string
Gets the error string of the given error id.
stumpless_get_error_stream
Gets the current stream that errors are written to.
stumpless_get_facility_enum
Gets the enum value corresponding to the given facility string.
stumpless_get_facility_enum_from_buffer
Gets the enum value corresponding to the given facility string.
stumpless_get_facility_string
Gets the string representation of the given facility.
stumpless_get_network_protocol
Gets the network protocol of a network target.
stumpless_get_option
Gets a given option of a target.
stumpless_get_param_by_index
Returns the param in the given element at the specified index.
stumpless_get_param_by_name
Returns the first occurrence of a param with the given name in element, if it is found.
stumpless_get_param_count
Returns the number of params in the given element.
stumpless_get_param_index
Gives the index of the first occurrence of a param with the given name in the given element.
stumpless_get_param_name
Returns the name of the given param. The character buffer must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_param_name_by_index
Gets the name of the param with the given index in this element. The result character buffer must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_param_name_count
Gives the number of params with the given name found in the given element.
stumpless_get_param_value
Returns the value of the given param. The character buffer must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_param_value_by_index
Returns the value of the param at the given index in the given element. The result character buffer must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_param_value_by_name
Returns the value of the first param with the given name in the given element. The result character buffer must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_prival_string
Gets the string representation of the given prival.
stumpless_get_severity_enum
Gets the enum value corresponding to the given severity string.
stumpless_get_severity_enum_from_buffer
Gets the enum value corresponding to the given severity string in a buffer.
stumpless_get_severity_string
Gets the string representation of the given severity.
stumpless_get_sqlite3_db
Gets the SQLite3 database handle used by the target.
stumpless_get_sqlite3_insert_sql
Gets the SQL statement used to insert entries into the database. See \ref stumpless_set_sqlite3_insert_sql to change this statement.
stumpless_get_sqlite3_prepare
Gets the preparation function and data pointer used to prepare statements for insertion into the database. See \ref stumpless_set_sqlite3_prepare to change this function.
stumpless_get_target_default_app_name
Returns the default app name of the given target. The character buffer must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_target_default_msgid
Returns the default msgid of the given target. The character buffer must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_target_filter
Returns the current filter used by the given target to determine if entries should be allowed through it.
stumpless_get_target_mask
Gets the log mask of a target.
stumpless_get_target_name
Returns the name of the given target. The character buffer must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_target_type_string
Gets the string representation of the given target_type.
stumpless_get_transport_port
Gets the transport port number of a network target. The character buffer returned must be freed by the caller when it is no longer needed to avoid memory leaks.
stumpless_get_transport_protocol
Gets the transport protocol of a network target.
stumpless_get_udp_max_message_size
Gets the current maximum message size of a UDP network target.
stumpless_get_version
Gets the version of code the library was built with. This version must be freed by the caller when it is no longer needed to avoid a memory leak.
stumpless_has_error
True if the last call to a stumpless function encountered an error. To get the error itself, use the stumpless_get_error function.
stumpless_load_element
Loads a provided element with the given name.
stumpless_load_entry
Loads an entry struct with the given characteristics.
stumpless_load_entry_str
Creates a new entry with the given characteristics.
stumpless_load_param
Loads a provided param with the given values.
stumpless_mask_filter
Compares the severity of the entry to the current mask of the target, and only passes the entry if the mask bit corresponding to the severity is set.
stumpless_new_chain
Creates a new target chain.
stumpless_new_element
Creates a new element with the given name.
stumpless_new_entry
Creates a new entry with the given characteristics.
stumpless_new_entry_str
Creates a new entry with the given characteristics.
stumpless_new_network_target
Creates a network target, but does not open it.
stumpless_new_param
Creates a new param with the given name and value.
stumpless_new_param_from_string
Creates a new param given a string by parsing the string and calling stumpless_new_param.
stumpless_new_tcp4_target
Creates a network target for logging over IPv4 and TCP, but does not open it.
stumpless_new_tcp6_target
Creates a network target for logging over IPv6 and TCP, but does not open it.
stumpless_new_udp4_target
Creates a network target for logging over IPv4 and UDP, but does not open it.
stumpless_new_udp6_target
Creates a network target for logging over IPv6 and UDP, but does not open it.
stumpless_open_buffer_target
Creates a buffer target for the given buffer.
stumpless_open_file_target
Opens a file target.
stumpless_open_function_target
Opens a function target.
stumpless_open_network_target
Opens a network target.
stumpless_open_sqlite3_target
Opens a SQLite3 target.
stumpless_open_sqlite3_target_from_db
Opens a SQLite3 target with an already-open database handle.
stumpless_open_sqlite3_target_with_options
Opens a SQLite3 target with the provided options. The three parameters are passed directly to sqlite3_open_v2.
stumpless_open_stderr_target
Opens a stream target for the stderr stream.
stumpless_open_stdout_target
Opens a stream target for the stdout stream.
stumpless_open_stream_target
Opens a stream target for the given stream.
stumpless_open_target
Opens a target that has already been created and configured.
stumpless_open_tcp4_target
Opens a network target for remote logging over IPv4 and TCP.
stumpless_open_tcp6_target
Opens a network target for remote logging over IPv6 and TCP.
stumpless_open_udp4_target
Opens a network target for remote logging over IPv4 and UDP.
stumpless_open_udp6_target
Opens a network target for remote logging over IPv6 and UDP.
stumpless_param_to_string
Returns the name and the value from param as a formatted string. The character buffer should be freed when no longer is needed by the caller.
stumpless_perror
Prints information about the current error to the error stream.
stumpless_prival_from_string
Extract PRIVAL number (Facility and Severity) from the given string with the direct number or with two names divided with a period in the order: facility first, then severity (“<facility_descr>.<severity_descr>”).
stumpless_read_buffer
Reads the next message from the provided buffer target and writes it into the given buffer.
stumpless_set_cons_stream
Sets the console stream to write logs to.
stumpless_set_current_target
Sets the target used when one is not provided.
stumpless_set_default_facility
Sets the default facility of a target.
stumpless_set_destination
Sets the destination of a network target.
stumpless_set_element
Puts the element at the given index in the given entry.
stumpless_set_element_name
Sets the name of the given element.
stumpless_set_entry_app_name
Sets the app name for an entry.
stumpless_set_entry_facility
Sets the facility of an entry.
stumpless_set_entry_hostname
Sets the hostname of a given entry. If hostname is NULL it will set hostname to be the Machine hostname.
stumpless_set_entry_message
Sets the message of a given entry.
stumpless_set_entry_message_str
Sets the message of a given entry.
stumpless_set_entry_message_str_w
Sets the message of a given entry.
stumpless_set_entry_msgid
Sets the msgid for an entry.
stumpless_set_entry_param_by_index
Puts the param in the element at the given index of an entry.
stumpless_set_entry_param_value_by_index
Sets the value of the param in the element at the given index of an entry.
stumpless_set_entry_param_value_by_name
Sets the value of the first param in the named element an entry.
stumpless_set_entry_priority
Sets the facility and severity of an entry.
stumpless_set_entry_prival
Sets the prival of an entry, as defined in RFC 5424.
stumpless_set_entry_procid
Sets the procid of a given entry. If procid is NULL it will set procid to be the ProcessID.
stumpless_set_entry_severity
Sets the severity of an entry.
stumpless_set_error_stream
Sets the stream to write errors to.
stumpless_set_free
Sets the function used by the library to free memory.
stumpless_set_malloc
Sets the function used by the library to allocate memory.
stumpless_set_option
Sets an option on a target.
stumpless_set_param
Puts the param at the given index in the given element.
stumpless_set_param_name
Sets the name of the given param.
stumpless_set_param_value
Sets the value of the given param.
stumpless_set_param_value_by_index
Sets the value of the param at the given index in the given element.
stumpless_set_param_value_by_name
Sets the value of the first param with the given name in the given element.
stumpless_set_realloc
Sets the function used by the library to reallocate memory.
stumpless_set_sqlite3_insert_sql
Sets the SQL statement used to insert entries into the database.
stumpless_set_sqlite3_prepare
Set the function used to prepare statements for entries to this target.
stumpless_set_target_default_app_name
Sets the default app name for a given target.
stumpless_set_target_default_msgid
Sets the default msgid for a given target.
stumpless_set_target_filter
Sets the filter used to determine whether entries should be logged by a given target.
stumpless_set_target_mask
Sets the log mask of a target.
stumpless_set_transport_port
Sets the transport port number of a network target.
stumpless_set_udp_max_message_size
Sets the maximum message size of a UDP network target.
stumpless_sqlite3_prepare
The default prepare function used for SQLite3 targets.
stumpless_target_is_open
Checks to see if the given target is open.
stumpless_trace_entry
Adds an entry into a given target. The entry has a structured data element added to it with the file, line, and function information specified.
stumpless_trace_log
Adds a log message with a priority to a given target, along with the file, line, and function information specified in a structured data element.
stumpless_trace_log_str
Adds a log message with a priority to a given target, along with the file, line, and function information specified in a structured data element.
stumpless_trace_message
Adds a message to a given target, along with the file, line, and function information specified in a structured data element.
stumpless_trace_message_str
Adds a message to a given target, along with the file, line, and function information specified in a structured data element.
stumpless_unload_element_and_contents
Unloads an element as well as all params that it contains.
stumpless_unload_element_only
Unloads an element, freeing any allocated memory. Associated params are left untouched, and must be unloaded separately.
stumpless_unload_entry_and_contents
Unloads an entry as well as all elements that it contains.
stumpless_unload_entry_only
Unloads an entry, freeing any allocated memory. Associated elements are left untouched, and must be unloaded separately.
stumpless_unload_param
Unloads a param.
stumpless_unset_option
Unsets an option on a target.
stumpless_version_cmp
Compares the version of two given stumpless_version struct.
stumpless_version_to_string
Creates a string representation of the given version.
stumplog
Logs a message to the current target with the given priority.
stumplog_set_mask
Sets the log mask of the current target.
stumplog_str
Logs a message to the current target with the given priority.
stumplog_trace
Logs a message to the default target with the given priority, along with the file, line, and function information specified in a structured data element.
stumplog_trace_str
Logs a message to the default target with the given priority, along with the file, line, and function information specified in a structured data element.

Type Aliases§

FILE
_IO_lock_t
__off64_t
__off_t
stumpless_error_id
An (enum) identifier of the types of errors that might be encountered.
stumpless_facility
All possible facility codes available to log entries.
stumpless_filter_func_t
A function that determines whether a given entry should be sent to a given target.
stumpless_id_t
stumpless_log_func_t
A handler for entries sent to a function target.
stumpless_network_protocol
Network protocols used by a network target.
stumpless_severity
All possible severity codes available to log entries.
stumpless_sqlite3_prepare_func_t
A function for generating SQLite3 prepared statements for a given entry. See \ref stumpless_set_sqlite3_prepare for the semantics of writing and using a prepare function with SQLite3 targets.
stumpless_target_type
Types of targets that may be created.
stumpless_transport_protocol
Transport protocols used by a network target.
wchar_t