Go to the source code of this file.
Data Structures | |
struct | flom_handle_s |
Typedefs | |
typedef enum flom_handle_state_e | flom_handle_state_t |
typedef struct flom_handle_s | flom_handle_t |
Enumerations | |
enum | flom_handle_state_e { FLOM_HANDLE_STATE_INIT = 22, FLOM_HANDLE_STATE_CONNECTED, FLOM_HANDLE_STATE_LOCKED, FLOM_HANDLE_STATE_DISCONNECTED, FLOM_HANDLE_STATE_CLEANED } |
typedef enum flom_handle_state_e flom_handle_state_t |
This scalar type is used to represent the state of an handle
typedef struct flom_handle_s flom_handle_t |
This object is used to save all the necessary context to interact with libflom library. Some fields use "void *" type to avoid useless internal details exposure (flom methods proxies the correct types)
enum flom_handle_state_e |
This scalar type is used to represent the state of an handle
Enumerator | |
---|---|
FLOM_HANDLE_STATE_INIT |
Initial state |
FLOM_HANDLE_STATE_CONNECTED |
The client is connected to the daemon and the resource is NOT locked |
FLOM_HANDLE_STATE_LOCKED |
The client is connected to the daemon and the resource is locked |
FLOM_HANDLE_STATE_DISCONNECTED |
The client is NOT connected to the daemon |
FLOM_HANDLE_STATE_CLEANED |
The handle memory was released and the handle itself can NOT be used without a call to flom_handle_init method |
Definition at line 36 of file flom_handle.h.
int flom_handle_clean | ( | flom_handle_t * | handle | ) |
Cleans an object handle; this function MUST be called before the handle will go out of scope of an handle; if this method is not called a memory leak will be generated. For every object initialized with flom_handle_init there must be a call to this method. If the handle is locked, it will be unlocked before proceeding with clean-up to avoid memory leaks.
handle | (Input/Output): a statically allocated object to clean |
void flom_handle_delete | ( | flom_handle_t * | handle | ) |
Cleans (using function flom_handle_clean) and deallocates an object allocated (created) with function flom_handle_new
handle | (Input): a dynamically allocated object to delete |
int flom_handle_get_discovery_attempts | ( | const flom_handle_t * | handle | ) |
Get the maximum number of attempts that will be tryed during auto-discovery phase using UDP/IP multicast (see flom_handle_get_multicast_address, flom_handle_get_multicast_port). The current value can be altered using function flom_handle_set_discovery_attempts
handle | (Input): a valid object handle |
int flom_handle_get_discovery_timeout | ( | const flom_handle_t * | handle | ) |
Get the number of milliseconds between two consecutive attempts that will be tryed during auto-discovery phase using UDP/IP multicast (see flom_handle_get_multicast_address, flom_handle_get_multicast_port). The current value can be altered using function flom_handle_set_discovery_timeout
handle | (Input): a valid object handle |
int flom_handle_get_discovery_ttl | ( | const flom_handle_t * | handle | ) |
Get the UDP/IP multicast TTL parameter used during auto-discovery phase; for a definition of the parameter, see http://www.tldp.org/HOWTO/Multicast-HOWTO-2.html . The current value can be altered using function flom_handle_set_discovery_ttl
handle | (Input): a valid object handle |
flom_lock_mode_t flom_handle_get_lock_mode | ( | const flom_handle_t * | handle | ) |
Get lock mode property: how a simple or hierarchical resource will be locked when function flom_handle_lock is called; FLoM supports the same lock mode semantic proposed by DLM, see http://en.wikipedia.org/wiki/Distributed_lock_manager#Lock_modes for a detailed explanation . The current value can be altered using function flom_handle_set_lock_mode
handle | (Input): a valid object handle |
const char* flom_handle_get_locked_element | ( | const flom_handle_t * | handle | ) |
Return the name of the locked element if the resource is of type set.
Note 1: this function can be used only after flom_handle_lock and before flom_handle_unlock Note 2: this function can be used only when locking a resource of type "resource set"
Note 3: the return string must copied as soon as possible to a different place because it's a dynamic string removed by flom_handle_unlock
handle | (Input): a valid object handle |
Definition at line 186 of file flom_handle.h.
References flom_handle_s::locked_element.
const char* flom_handle_get_multicast_address | ( | const flom_handle_t * | handle | ) |
Get the multicast address: the IP address (or a network name that the system can resolve) of the IP multicast group that must be contacted to reach FLoM daemon (server) using UDP/IP; see also flom_handle_get_multicast_port. The current value can be altered using function flom_handle_set_multicast_address.
handle | (Input): a valid object handle |
int flom_handle_get_multicast_port | ( | const flom_handle_t * | handle | ) |
Get the UDP/IP multicast port that must be used to contact the FLoM daemon (server) using UDP/IP; see also flom_handle_get_multicast_address. The current value can be altered using function flom_handle_set_multicast_port.
handle | (Input): a valid object handle |
const char* flom_handle_get_network_interface | ( | const flom_handle_t * | handle | ) |
Get the network interface that must be used for IPv6 link local addresses The current value can be altered using function flom_handle_set_network_interface.
handle | (Input): a valid object handle |
int flom_handle_get_resource_create | ( | const flom_handle_t * | handle | ) |
Get "resource create" boolean property: it specifies if function flom_handle_lock can create a new resource when the specified one is not defined; the default value is TRUE. The current value can be altered using function flom_handle_set_resource_create.
handle | (Input): a valid object handle |
int flom_handle_get_resource_idle_lifespan | ( | const flom_handle_t * | handle | ) |
Get "resource idle lifespan" property: it specifies how many milliseconds a resource will be kept after the last locker released it; the expiration is necessary to avoid useless resource allocation. The current value can be altered using function flom_handle_set_resource_idle_lifespan.
handle | (Input): a valid object handle |
const char* flom_handle_get_resource_name | ( | const flom_handle_t * | handle | ) |
Get the resource name: the name of the resource that can be locked and unlocked using flom_handle_lock and flom_handle_unlock functions. The current value can be altered using function flom_handle_set_resource_name.
handle | (Input): a valid object handle |
int flom_handle_get_resource_quantity | ( | const flom_handle_t * | handle | ) |
Get "resource quantity" property: the number of units that will be locked and unlocked using flom_handle_lock and flom_handle_unlock functions. The current value can be altered using function flom_handle_set_resource_quantity. NOTE: this property applies to "numeric resources" only.
handle | (Input): a valid object handle |
int flom_handle_get_resource_timeout | ( | const flom_handle_t * | handle | ) |
Get "resource timeout" property: how long a lock operation (see flom_handle_lock) will wait if the resource is locked by another requester. The current value can be altered using function flom_handle_set_resource_timeout.
handle | (Input): a valid object handle |
const char* flom_handle_get_socket_name | ( | const flom_handle_t * | handle | ) |
Get the socket name: the AF_LOCAL/AF_UNIX socket name that must be used to contact a local FLoM daemon (server). The current value can be altered using function flom_handle_set_socket_name.
handle | (Input): a valid object handle |
const char* flom_handle_get_tls_ca_certificate | ( | const flom_handle_t * | handle | ) |
Get the TLS private key file name. The current value can be altered using function flom_handle_set_tls_ca_certificate.
handle | (Input): a valid object handle |
const char* flom_handle_get_tls_certificate | ( | const flom_handle_t * | handle | ) |
Get the TLS certificate file name. The current value can be altered using function flom_handle_set_tls_certificate.
handle | (Input): a valid object handle |
int flom_handle_get_tls_check_peer_id | ( | const flom_handle_t * | handle | ) |
Get the TLS check peer id boolean flag The current value can be altered using function flom_handle_set_tls_check_peer_id.
handle | (Input): a valid object handle |
const char* flom_handle_get_tls_private_key | ( | const flom_handle_t * | handle | ) |
Get the TLS private key file name. The current value can be altered using function flom_handle_set_tls_private_key.
handle | (Input): a valid object handle |
const char* flom_handle_get_trace_filename | ( | const flom_handle_t * | handle | ) |
Get the trace filename: the name (absolute or relative path) used by libflom (FLoM client library) to record trace messages. The current value can be altered using function flom_handle_set_trace_filename.
handle | (Input): a valid object handle |
const char* flom_handle_get_unicast_address | ( | const flom_handle_t * | handle | ) |
Get the unicast address: the IP address (or a network name that the system can resolve) of the host that must be contacted to reach FLoM daemon (server) using TCP/IP; see also flom_handle_get_unicast_port. The current value can be altered using function flom_handle_set_unicast_address.
handle | (Input): a valid object handle |
int flom_handle_get_unicast_port | ( | const flom_handle_t * | handle | ) |
Get the TCP/IP unicast port that must be used to contact the FLoM daemon (server) using TCP/IP; see also flom_handle_get_unicast_address. The current value can be altered using function flom_handle_set_unicast_port.
handle | (Input): a valid object handle |
int flom_handle_init | ( | flom_handle_t * | handle | ) |
Initializes an object handle; this function MUST be called before the first usage of a new statically allocated handle or after an handle has been cleaned up with function flom_handle_clean
handle | (Input/Output): a statically allocated object to initialize |
int flom_handle_lock | ( | flom_handle_t * | handle | ) |
Locks the (logical) resource linked to an handle; the resource MUST be unlocked using function flom_handle_unlock when the lock condition is no more necessary
handle | (Input/Output): a valid object handle |
flom_handle_t* flom_handle_new | ( | void | ) |
Allocates and initializes (using function flom_handle_init) a new dynamically allocated object handle
int flom_handle_set_discovery_attempts | ( | flom_handle_t * | handle, |
int | value | ||
) |
Set the maximum number of attempts that will be tryed during auto-discovery phase using UDP/IP multicast (see flom_handle_set_multicast_address, flom_handle_set_multicast_port). The current value can be inspected using function flom_handle_get_discovery_attempts
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_discovery_timeout | ( | flom_handle_t * | handle, |
int | value | ||
) |
Set the number of milliseconds between two consecutive attempts that will be tryed during auto-discovery phase using UDP/IP multicast (see flom_handle_set_multicast_address, flom_handle_set_multicast_port). The current value can be inspected using function flom_handle_get_discovery_timeout.
handle | (Input): a valid object handle |
value | (Input): the new value |
int flom_handle_set_discovery_ttl | ( | flom_handle_t * | handle, |
int | value | ||
) |
Set the UDP/IP multicast TTL parameter used during auto-discovery phase; for a definition of the parameter, see http://www.tldp.org/HOWTO/Multicast-HOWTO-2.html . The current value can be inspected using function flom_handle_get_discovery_ttl.
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_lock_mode | ( | flom_handle_t * | handle, |
flom_lock_mode_t | value | ||
) |
Set lock mode property: how a simple or hierarchical resource will be locked when function flom_handle_lock is called; FLoM supports the same lock mode semantic proposed by DLM, see http://en.wikipedia.org/wiki/Distributed_lock_manager#Lock_modes for a detailed explanation . The current value can be inspected using function flom_handle_get_lock_mode
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_multicast_address | ( | flom_handle_t * | handle, |
const char * | value | ||
) |
Set the multicast address: the IP address (or a network name that the system can resolve) of the IP multicast group that must be contacted to reach FLoM daemon (server) using UDP/IP; see also flom_handle_set_multicast_port. The current value can be inspected using function flom_handle_get_multicast_address.
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_multicast_port | ( | flom_handle_t * | handle, |
int | value | ||
) |
Set the UDP/IP multicast port that must be used to contact the FLoM daemon (server) using UDP/IP; see also flom_handle_set_multicast_address. The current value can be inspected using function flom_handle_get_multicast_port.
handle | (Input): a valid object handle |
value | (Input): the new value |
int flom_handle_set_network_interface | ( | flom_handle_t * | handle, |
const char * | value | ||
) |
Set the network interface that must be used for IPv6 link local addresses The current value can be inspected using function flom_handle_get_network_interface.
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_resource_create | ( | flom_handle_t * | handle, |
int | value | ||
) |
Set "resource create" boolean property: it specifies if function flom_handle_lock can create a new resource when the specified one is not defined. The current value can be inspected using function flom_handle_get_resource_create.
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_resource_idle_lifespan | ( | flom_handle_t * | handle, |
int | value | ||
) |
Set "resource idle lifespan" property: it specifies how many milliseconds a resource will be kept after the last locker released it; the expiration is necessary to avoid useless resource allocation. The current value can be inspected using function flom_handle_get_resource_idle_lifespan.
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_resource_name | ( | flom_handle_t * | handle, |
const char * | value | ||
) |
Set the resource name: the name of the resource that can be locked and unlocked using flom_handle_lock and flom_handle_unlock functions. The current value can be inspected using function flom_handle_get_resource_name. NOTE: the resource type is determined by its name; take a look to flom command man page (-r, –resource-name option) for an explanation of the resource name grammar.
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_resource_quantity | ( | flom_handle_t * | handle, |
int | value | ||
) |
Set "resource quantity" property: the number of units that will be locked and unlocked using flom_handle_lock and flom_handle_unlock functions. The current value can be inspected using function flom_handle_get_resource_quantity. NOTE: this property applies to "numeric resources" only.
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_resource_timeout | ( | flom_handle_t * | handle, |
int | value | ||
) |
Set "resource timeout" property: how long a lock operation (see flom_handle_lock) will wait if the resource is locked by another requester. The current value can be inspected using function flom_handle_get_resource_timeout.
handle | (Input/Output): a valid object handle |
value | (Input): the new value: 0: no wait >0: maximum number of milliseconds to wait <0: unlimited wait |
int flom_handle_set_socket_name | ( | flom_handle_t * | handle, |
const char * | value | ||
) |
Set the socket name: the AF_LOCAL/AF_UNIX socket name that must be used to contact a local FLoM daemon (server). The current value can be inspected using function flom_handle_get_socket_name.
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_tls_ca_certificate | ( | flom_handle_t * | handle, |
const char * | value | ||
) |
Set the TLS private key file name. The current value can be inspected using function flom_handle_get_tls_ca_certificate.
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_tls_certificate | ( | flom_handle_t * | handle, |
const char * | value | ||
) |
Set the TLS certificate file name. The current value can be inspected using function flom_handle_get_tls_certificate.
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_tls_check_peer_id | ( | flom_handle_t * | handle, |
int | value | ||
) |
Set the TLS check peer id boolean flag The current value can be inspected using function flom_handle_get_tls_check_peer_id.
handle | (Input): a valid object handle |
value | (Input): the new (boolean) value |
int flom_handle_set_tls_private_key | ( | flom_handle_t * | handle, |
const char * | value | ||
) |
Set the TLS private key file name. The current value can be inspected using function flom_handle_get_tls_private_key.
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_trace_filename | ( | flom_handle_t * | handle, |
const char * | value | ||
) |
Set the trace filename: the name (absolute or relative path) used by libflom (FLoM client library) to record trace messages. The current value can be inspected using function flom_handle_get_trace_filename.
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_unicast_address | ( | flom_handle_t * | handle, |
const char * | value | ||
) |
Set the unicast address: the IP address (or a network name that the system can resolve) of the host that must be contacted to reach FLoM daemon (server) using TCP/IP; see also flom_handle_set_unicast_port. The current value can be inspected using function flom_handle_get_unicast_address.
handle | (Input/Output): a valid object handle |
value | (Input): the new value |
int flom_handle_set_unicast_port | ( | flom_handle_t * | handle, |
int | value | ||
) |
Set the TCP/IP unicast port that must be used to contact the FLoM daemon (server) using TCP/IP; see also flom_handle_set_unicast_address. The current value can be inspected using function flom_handle_get_unicast_port.
handle | (Input): a valid object handle |
value | (Input): the new value |
int flom_handle_unlock | ( | flom_handle_t * | handle | ) |
Unlocks the (logical) resource linked to an handle; the resource MUST be previously locked using function flom_handle_lock
handle | (Input/Output): a valid object handle |
int flom_handle_unlock_rollback | ( | flom_handle_t * | handle | ) |
Unlocks the (logical) resource linked to an handle and rollback the transactional resource state; the resource MUST be previously locked using function flom_handle_lock . This method should be used only with transactional resources, for example: transactional unique sequences
handle | (Input/Output): a valid object handle |