#include "xroad_system.h"#include "xroad_node_types.h"#include <cache/xroad_objects_types.h>#include <cache/xroad_cache.h>#include <cache/xroad_storage_fwd.h>#include <common/xroad_xml.h>#include <common/xroad_string.h>#include <common/xroad_aux.h>#include <tracing/xroad_tracing_fwd.h>#include <reactor/xroad_reactor_types.h>#include <stdint.h>#include <stdbool.h>#include <sys/epoll.h>

Go to the source code of this file.
Classes | |
| struct | xroad_node_callback_t |
Macros | |
| #define | xroad_node_is_offline() |
| #define | xroad_node_trace_init_writer(_enabled, _trace_var, _trace_rec_struct, ...) |
| #define | xroad_node_trace_close(_trace_var) xroad_node_trace_close_ex(&_trace_var.stream) |
| Helper macro to close a trace writer by trace variable. | |
| #define | xroad_node_find_object(type, fun, ...) |
Typedefs | |
| typedef xroad_epoll_callback_t | xroad_node_epoll_callback_t |
| typedef xroad_reactor_timestamps_t | xroad_epoll_timestamps |
| Timestamps associated with epoll. | |
| typedef struct xroad_lock_by_pid_s | xroad_lock_by_pid_t |
| typedef struct xroad_cache_s | xroad_cache_t |
| Forward declaration of xroad_cache_t (from xroad_cache) | |
Functions | |
| xroad_errno_t | xroad_node_create (xroad_str_t node_name, uint16_t major_version, uint16_t minor_version, uint16_t patch_version, xroad_str_t git_hash, xroad_node_callback_t callback) |
| void | xroad_node_destroy (void) |
| xroad_errno_t | xroad_node_reconfig (void) |
| xroad_xml_doc_t * | xroad_node_get_config (void) |
| const xroad_epoll_timestamps * | xroad_node_get_epoll_timestamps (void) __attribute_const__ |
| int32_t | xroad_node_receive (void) |
| int32_t | xroad_node_receive_ex (int32_t timeout) |
| xroad_errno_t | xroad_node_add_epoll (uint32_t events, xroad_node_epoll_callback_t *cback) |
| xroad_errno_t | xroad_node_mod_epoll (uint32_t events, xroad_node_epoll_callback_t *cback) |
| xroad_errno_t | xroad_node_del_epoll (xroad_node_epoll_callback_t *cback) |
| int32_t | xroad_node_get_epoll_fd (void) |
| void * | xroad_node_create_object (xroad_object_type_t type) |
| void * | xroad_node_clone_object (const void *obj) |
| xroad_errno_t | xroad_node_send_object (void *obj, xroad_node_id_t id) |
| xroad_errno_t | xroad_node_route_object (void *obj,...) |
| xroad_errno_t | xroad_node_route_object_va (void *obj, va_list ap) |
| void * | xroad_node_get_fun (xroad_str_t fname) |
| void * | xroad_node_get_object (xroad_object_type_t type, xroad_object_id_t id) |
| xroad_lock_by_pid_t * | xroad_node_get_used_lock (void) |
| xroad_node_data_t * | xroad_node_get_data (void) __attribute_const__ |
| void | xroad_node_reset_statistic (void) |
| xroad_str_t | xroad_node_get_working_dir (void) |
| void | xroad_node_set_flags (uint32_t flags) |
| xroad_cursor_t * | xroad_node_create_cursor (xroad_object_type_t type) |
| void | xroad_node_destroy_cursor (xroad_cursor_t *cursor) |
| void * | xroad_node_cursor_get_next (xroad_cursor_t *cursor) |
| void * | xroad_node_cursor_get_prev (xroad_cursor_t *cursor) |
| void * | xroad_node_cursor_get_first (xroad_cursor_t *cursor) |
| void * | xroad_node_cursor_get_last (xroad_cursor_t *cursor) |
| void * | xroad_node_cursor_offset (xroad_cursor_t *cursor, int64_t offset) |
| void | xroad_node_cursor_refresh (xroad_cursor_t *cursor) |
| xroad_errno_t | xroad_node_clear_cache (xroad_object_type_t type, bool force) |
| xroad_cache_t * | xroad_node_get_cache () __attribute_const__ |
| size_t | xroad_node_get_object_count (xroad_object_type_t type) |
| const xroad_version_t * | xroad_node_get_version (void) __attribute_const__ |
| bool | xroad_node_is_initialized (void) |
| xroad_errno_t | xroad_node_subscribe (xroad_domain_t group, xroad_node_callback_t cback) |
| xroad_errno_t | xroad_node_unsubscribe (xroad_domain_t group, xroad_node_callback_t cback) |
| xroad_str_t | xroad_node_get_env_param (xroad_str_t param) |
| void | xroad_node_renamed () |
| void | xroad_node_enable_alarm () |
| void | xroad_node_disable_alarm () |
| bool | xroad_node_has_mtt (void) |
| Returns true if the node has maintenance thread. | |
| bool | xroad_node_is_busypolling (void) |
| Return true if the node is in busy-poll mode (wait_timeout == 0) | |
| xroad_tracing_t * | xroad_node_get_tracing (void) |
| Return a tracing subsystem instance (it could lazy constructed) | |
| xroad_errno_t | xroad_node_trace_init_writer_ex (bool enabled, const xroad_traces_ctl_param_t *params, xroad_trace_stream_t *writer) |
| xroad_errno_t | xroad_node_trace_close_ex (xroad_trace_stream_t *writer) |
| #define xroad_node_find_object | ( | type, | |
| fun, | |||
| ... | |||
| ) |
find object using functor
| [in] | type | - object type |
| [in] | fun | - functor like bool fun(....) @oaram[in] ... - functor params |
| #define xroad_node_is_offline | ( | ) |
| #define xroad_node_trace_init_writer | ( | _enabled, | |
| _trace_var, | |||
| _trace_rec_struct, | |||
| ... | |||
| ) |
Init trace writer shortcut without returning a control object
| enabled | - if tracing is not enabed, writer is initialized with a stub |
| _trace_var | - trace variable name (see xroad_traces_writer_decl macro) |
| ... | - xroad_traces_ctl_param_t fields (use designated initializers syntax). |
node epoll callback
| xroad_errno_t xroad_node_add_epoll | ( | uint32_t | events, |
| xroad_node_epoll_callback_t * | cback | ||
| ) |
add descriptor to epoll
| [in] | events | - fd events |
| [in] | cback | - pointer to epoll callback |
| xroad_errno_t xroad_node_clear_cache | ( | xroad_object_type_t | type, |
| bool | force | ||
| ) |
clear object cache
| [in] | type | - type of objects to clear |
| [in] | force | - force clear |
| void* xroad_node_clone_object | ( | const void * | obj | ) |
clone object
| [in] | obj | - object to clone |
| xroad_errno_t xroad_node_create | ( | xroad_str_t | node_name, |
| uint16_t | major_version, | ||
| uint16_t | minor_version, | ||
| uint16_t | patch_version, | ||
| xroad_str_t | git_hash, | ||
| xroad_node_callback_t | callback | ||
| ) |
create new node and registers in system
| [in] | node_name | - name of new node. Can be NULL. |
| [in] | major_version | - marjor version. Override value from xroad_version.c |
| [in] | minor_version | - minor version. Override value from xroad_version.c |
| [in] | patch_version | - patch version. Override value from xroad_version.c |
| [in] | git_hash | - git hash. Override value from xroad_version.c |
| [in] | callback | - callback method for objects |
| xroad_cursor_t* xroad_node_create_cursor | ( | xroad_object_type_t | type | ) |
create new cache cursor
| [in] | type | - type of cursor |
| void* xroad_node_create_object | ( | xroad_object_type_t | type | ) |
create new object
| [in] | type | - type of object to create |
| void* xroad_node_cursor_get_first | ( | xroad_cursor_t * | cursor | ) |
return first object from cache
| [in] | cursor | - cache cursor |
| void* xroad_node_cursor_get_last | ( | xroad_cursor_t * | cursor | ) |
return last object from cache
| [in] | cursor | - cache cursor |
| void* xroad_node_cursor_get_next | ( | xroad_cursor_t * | cursor | ) |
return next object from cache
| [in] | cursor | - cache cursor |
| void* xroad_node_cursor_get_prev | ( | xroad_cursor_t * | cursor | ) |
return previous object from cache
| [in] | cursor | - cache cursor |
| void* xroad_node_cursor_offset | ( | xroad_cursor_t * | cursor, |
| int64_t | offset | ||
| ) |
offset cursor
| [in] | cursor | - cache cursor |
| [in] | offset | - offset value. Can be negative for offset back |
| void xroad_node_cursor_refresh | ( | xroad_cursor_t * | cursor | ) |
extends cursor, if possible
| [in] | cursor | - cursor to extend |
| xroad_errno_t xroad_node_del_epoll | ( | xroad_node_epoll_callback_t * | cback | ) |
remove descriptor from epoll
| [in] | cback | - callback to remove |
| void xroad_node_destroy | ( | void | ) |
destroy node and free resources
| void xroad_node_destroy_cursor | ( | xroad_cursor_t * | cursor | ) |
destroy cursor
| [in] | cursor | - cursor to destroy |
| void xroad_node_disable_alarm | ( | ) |
disable alarm sending
| void xroad_node_enable_alarm | ( | ) |
enable alarm senging
| xroad_cache_t* xroad_node_get_cache | ( | ) | const |
returns pointer to cache
| xroad_xml_doc_t* xroad_node_get_config | ( | void | ) |
return pointer to configuration
| xroad_node_data_t* xroad_node_get_data | ( | void | ) | const |
| xroad_str_t xroad_node_get_env_param | ( | xroad_str_t | param | ) |
get node environment parameter
| [in] | param | - paramenter name |
| int32_t xroad_node_get_epoll_fd | ( | void | ) |
return epoll file descriptor
| const xroad_epoll_timestamps* xroad_node_get_epoll_timestamps | ( | void | ) | const |
Returns timestamps associated with epoll
| void* xroad_node_get_fun | ( | xroad_str_t | fname | ) |
get function from dll by name
| [in] | fname | - name of function |
| void* xroad_node_get_object | ( | xroad_object_type_t | type, |
| xroad_object_id_t | id | ||
| ) |
return object from cache
| [in] | type | - type of object |
| [in] | id | - id of object |
| size_t xroad_node_get_object_count | ( | xroad_object_type_t | type | ) |
return count of objects of desired type
| [in] | type | - type of objects to count |
| xroad_lock_by_pid_t* xroad_node_get_used_lock | ( | void | ) |
| const xroad_version_t* xroad_node_get_version | ( | void | ) | const |
return node version
| xroad_str_t xroad_node_get_working_dir | ( | void | ) |
get node home dir
| bool xroad_node_is_initialized | ( | void | ) |
check if node already created
| xroad_errno_t xroad_node_mod_epoll | ( | uint32_t | events, |
| xroad_node_epoll_callback_t * | cback | ||
| ) |
modify events of already added to epoll descriptor
| [in] | events | - new fd events |
| [in] | cback | - pointer to epoll callback |
| int32_t xroad_node_receive | ( | void | ) |
receive and dispatch events
| int32_t xroad_node_receive_ex | ( | int32_t | timeout | ) |
receive and dispatch events
| [in] | timeout | - wait millisec for received message |
| xroad_errno_t xroad_node_reconfig | ( | void | ) |
reconfigure node
| void xroad_node_renamed | ( | ) |
must be called when node is renamed
| void xroad_node_reset_statistic | ( | void | ) |
reset node statistic
| xroad_errno_t xroad_node_route_object | ( | void * | obj, |
| ... | |||
| ) |
route object
| [in] | obj | - object to send |
| xroad_errno_t xroad_node_route_object_va | ( | void * | obj, |
| va_list | ap | ||
| ) |
route object
| [in] | obj | - object to send |
| [in] | ap | - argument list |
| xroad_errno_t xroad_node_send_object | ( | void * | obj, |
| xroad_node_id_t | id | ||
| ) |
send object directly to node
| [in] | obj | - object to send |
| [in] | id | - id of destination node |
| void xroad_node_set_flags | ( | uint32_t | flags | ) |
set node flags
| [in] | flags | - new node flags |
| xroad_errno_t xroad_node_subscribe | ( | xroad_domain_t | group, |
| xroad_node_callback_t | cback | ||
| ) |
subscribe to objects of concrete group
| [in] | domain | - object domain to subscribe |
| [in] | cback | - callback |
| xroad_errno_t xroad_node_trace_close_ex | ( | xroad_trace_stream_t * | writer | ) |
Close a trace control by stream writer.
Unclosed trace streams are safely destroyed at node destruction. However they may still consume some CPU cycles for polling.
| writer | - writer structure to close. |
| xroad_errno_t xroad_node_trace_init_writer_ex | ( | bool | enabled, |
| const xroad_traces_ctl_param_t * | params, | ||
| xroad_trace_stream_t * | writer | ||
| ) |
Init trace writer shortcut without returning a control
The writer is initialized with a stub if tracing is disabled or any error happened
| [in] | name | - trace name (and file prefix). Empty means default node trace |
| [in] | enabled | - if tracing is not enabed, writer is initialized with a stub |
| [in] | corr_tag | - correlation tag |
| [in] | type_mask | - trace type mask. It must be a combination of xroad_trace_rec_flag_t |
| [out] | writer | - writer structure to initialize. |
| xroad_errno_t xroad_node_unsubscribe | ( | xroad_domain_t | group, |
| xroad_node_callback_t | cback | ||
| ) |
unsubscribe from group objects
| [in] | domain | - object domain to usubscribe |
| [in] | cback | - callback |