Function
| Description
|
make_one_line
| This function takes a given string and replace all series of spaces by one space and all
series of new lines by one new line.
|
s_split
| Split a string. After you call s_split() you must call free_fields(). If you split
"A;;;B;" using the character ";" as delimitor, then you get 2 and only
2 fields ("A" and "B").
|
s_split_exact
| Split a string. After you call s_split() you must call free_fields(). If you split
"A;;;B;" using the character ";" as delimitor, then you get 4 fields
(with 2 empty fields).
|
free_fields
| Free all memory that has been allocated within s_split().
|
get_end_of_string
| Extract everything between the character '=' and the end of a string.
|
IP2hex
| Convert a IP address into its hexadecimal representation.
|
post_chop
| Delete spaces (or tabulations) at the end of a string.
|
pre_chop
| Delete spaces (or tabulations) at the begining of a string.
|
chop
| Delete spaces (or tabulations) at the begining and at the end of a string.
|
add_comment
| Replace all charater 'new line' (that is '\n'), by the sequence '\n#'.
|
get_config_value
| Extract a field's value from a configuration file (you specify a field delimitor such as ':').
|
replace_tag_by_integer
| Replace a tag by an integer (you specify the tag to replace).
|
string2unsigned_int
| Convert a string of characters into an 'unsigned int'.
|
string2int
| Convert a string of characters into an 'int'.
|
is_integer
| Test if a string of characters represents an interger.
|
is_ip_address
| Test if a string of characters represents an IP address.
|
is_hexa
| Test if a string of characters represents an hexadecimal value;
|
ip_address_to_num
| Convert an IPV4 address into its numerical representation (for example 123.45.67.8 becomes four integers:
123, 45, 67 and 8).
|
Function
| Description
|
set_local_TZ_to_GMT
| This function sets the local time zone to UTC. You should call this function before using any of the
following library's functions.
|
load_timezones
| Load time zones configuration file. You must do that before you can use the library.
|
tzcmp
| Compare 2 timezone structures. You should not have to use this function.
|
tzfound
| Find a time zone data structure in the time zone configuration file.
You should not have to use this function.
|
get_day
| Returns the index of the day (starting at 0, so the returned value is between 0 and 6).
The first day (index 0) is 'Sunday'.
You should not have to use this function.
|
get_month
| Returns the index of the month (starting at 0, so the returned value is between 0 and 11).
The first month (index 0) is 'january'.
You should not have to use this function.
|
date2timestamp
| Calculate the timestamp of a date (The number of seconds since the first of January 1970).
The date must look something like "Tue Aug 28 01:02:24 MET DST 2001". The time zone
and daylight saving tags must appear in the time zones configuration file.
|
test_tz_conf
| Check that the configuration found in the time zones configuration file is correct. To do that
you specify an external configuration file that contains well know couples (date, timestamps). The
functions will calculate the timestamp associated with each date and it will compare it with the
well known timestamps. If the time zones configuration appears to be wrong, this function can
find the correct configuration.
|
print_tz_conf
| Returns a zero terminated string of characters that represents that time zone configuration loaded
from the time zone configuration file.
|
get_utc_timestamp
| Returns the number of seconds since 00:00:00 UTC, January 1, 1970. Please note that this is equivalent to the
C function "time", but the name is better.
|
dater()
| Return the current date as Apache's standard (for example "2002-09-12 20:20:18").
|
get_tsm_date()
| Return a TSM formated date from a given timestamp. For example:
Timestamp = 1032256652 => "Tue Sep 17 11:57:32 MET 2002"
|
Function
| Description
|
create_cyclic_buffer
| Create a cyclic buffer.
|
destroy_cyclic_buffer
| Destroy a cyclic buffer.
|
cyclic_buffer_add_element
| Add a new element to a cyclic buffer.
|
rewind_cyclic_buffer
| Reset the buffer's read pointer.
|
cyclic_buffer_get_element
| Returns a pointer to the current element. You should call rewind_cyclic_buffer() before calling this
function.
|
cyclic_buffer_get_start
| Return the index of the first element in the cyclic buffer.
|
cyclic_buffer_get_stop
| Return the index of the last element in the cyclic buffer..
|
cyclic_buffer_get_current_size
| Return the current number of elements in the cyclic buffer..
|
Function
| Description
|
change_shm_access_permission
| By default, all newly created SHM will grant all access rights (Read/Write/Execute) to the process' user.
Any other user has no rights at all. This is equivalent to chmod a-wxr file_name; chmod u+wxr file_name
for a file. This function allows you to change this setting. Please note that you should call this
function before you create the SHM. That is, before you call create_shared_memory_segment().
|
create_shared_memory_segment()
| Create a SHM. You specify a well known IPC key if you've got one. Otherwise you can ask the kernel to
find the first available key. Please note that if you plan to share the SHM between process (no fork)
than you may use well known IPC keys.
|
get_shared_memory_segment_sys_id()
| Get a previously created shared memory segment (created by another process).
|
set_auto_destroy()
| The process that creates the SHM should call this function. This will set the SHM into auto destroy mode.
The SHM will remain in memory until the last process detach it, then it will be destroyed by the system.
Please note that when a process ends, all SHM are detached. You must call this function after
attache_shared_memory_segment().
Note: When the process that created the SHM calls this function, no more process can get the SHM.
The system considers that the SHM is ready to be destroyed (it will be destroyed on the last detachment)
... So no more process is allowed to get the SHM.
|
get_shared_memory_segment_id()
| Return the system identifier of the shared memory segment.
|
get_shm_address()
| Return the address used by the proccess to access the SHM. Please note that you should use this function
after attache_shared_memory_segment().
|
attache_shared_memory_segment()
| Attache the shared memory segment to the process' memory space.
|
get_shm_info()
| Return a structure "struct shmid_ds" that contains information about the shared memory segment.
Please look at the man page for the function "shmctl" for more details.
|
detache_shm()
| Detach a previously attached (using attache_shared_memory_segment()) shared memory segment.
|
Function
| Description
|
create_semaphore_set()
| Create a set of semaphores.
- Please note that the semaphores are initialized with the value +1 (you can change that later
using the functions set_semaphore_value() or set_semaphore_values()).
- Please note that the semaphores' are created with the persmission 700. In other words, the
process' (UNIX) owner has all rights, and everybody else has no rigts. You can change the
semaphores' permissions with the function change_sem_access_permission().
|
change_sem_access_permission()
| Change the semaphores' permissions.
|
get_semaphore_set()
| Get a previously create set of semaphores (using public IPC key).
|
set_semaphore_values()
| Set the values of all the semaphores (you can however set distinct values for each semaphores).
|
set_semaphore_value()
| Set the value of one semaphore (and only one, the other semaphores remain untouched).
|
take_sem()
| Take a semaphore. This decremente the semaphore's value by 1. Please note that if the process exists
(for any reasons - including segmentation fault or "kill"), then the operation is canceled. This
means that the semaphore will be released.
|
release_sem()
| Release a semaphore. This increments the semaphore's value by +1.
|
destroy_semaphore_set()
| Destroy all the semaphores in the set of semaphores.
|
Function
| Description
|
list_init()
| Inatialize a linked list. This must be the first function called. The user must provide specific functions to:
- Delete the data structure stored in an element of the linked list.
- Compare two data structure.
|
list_destroy()
| Free all memory allocated for the linked list.
|
list_ins_next()
| Insert an element into the linked list (the insertion is done AFTER a given element).
|
list_rem_next()
| Remove an element from the linked list (the destruction is done AFTER a given element).
|
list_find()
| Finf an element into the linked list (given a data struture). The search can be done:
- From the beginning of the linked list.
- From a given element.
|
list_size()
| This macro returns the number of elements in a linked list.
|
list_head()
| This macro returns a pointer to the first element of a list.
|
list_tail()
| This macro returns a pointer to the last element of a list.
|
list_is_head()
| This macro returns tests if an element is the first element in a linked list. If the element is the first in the
linked list, the macro returns 1. Otherwise it returns 0.
|
list_is_tail()
| This macro returns tests if an element is the last element in a linked list. If the element is the last in the
linked list, the macro returns 1. Otherwise it returns 0.
|
list_data()
| This macro returns a pointer to the data section of a linked list.
|
list_next()
| Given a element, this macro returns a pointer to the next element in the list.
|
list_prev() -- Double linked list ONLY
| Given a element, this macro returns a pointer to the previous element in the list.
|
Function
| Description
|
chtbl_init()
| Initialize the hash table. This should be the first function called. The user must provide:
- The number of linked list.
- The function used to hash the input key.
- The function used to compare two data stored into the hash table.
- The function used to free the memory associated with the user's data.
|
chtbl_destroy()
| Free all memory associated with the hash table (including user's data).
|
chtbl_insert()
| Insert an element into the hash table. Please note that the elmement is NOT copied into the hash table.
The hash table contains a pointer to the user's data.
|
chtbl_remove()
| Remove an entry from the hash table. Please note that this is the user's responsability to free the memory allocated
for the user' data.
|
chtbl_lookup()
| Lookup the hash table for a given entry.
|
chtbl_find()
| Lookup ALL the hash table to find one element. You can use this function if the
element you are searching is not defined by the hash table's key.
|
chtbl_next()
| This function allows you to walk through a hash table. Each time you call it, the function
returns a pointer to the next element in the hash.
|
Function
| Description
|
stack_init()
| Initialize the stack. This should ne the first function called. The user must provide:
- Delete the data structure stored in an element of the linked list.
- Compare two data structure. This function is not used, but it is required because the stack is implemented
on top of a linked list.
|
stack_push()
| Put an element on top of the stack. Please note that the element's data is NOT copied into the stack (the
stack's element only contains a pointer to the user's data).
|
stack_pop()
| Extract the element on top of the stack. Please note that it is the user's responsability to free the memory
allocated with the element's data.
|
stack_destroy()
| Free all memory allocated for the stack (including element's datas).
|
stack_peek()
| Return the data on top of the stack (but do not extract it).
|
stack_size()
| This macro returns the number of elements in the stack.
|
Function
| Description
|
array_init()
| This function initializes the array's plugin. The user must provide the following function (depending on the type of
data stored into the array):
- copy_data: function used to copy the user's data. Please note that this function MUST take care of memory
management (if necessary).
- remove_data: function used to free all memory (if necessary) and re-initialize (if necessary) user's data.
This function could be set to NULL if no special operation is needed.
- compare: function used to compare 2 user's data.
- index: function used to calculate the address of an element in an array.
- init_data: function used to initialize data (if necessary). It is called whenever an element is allocated.
This function should be called first.
|
array_free()
| Free all memory allocated for an array structure (this does NOT include the user's data).
|
array_schedule_for_rem()
| Schedule an element (designed by its index) for removing.
|
array_rem_all()
| Remove all previously scheduled (for removing) elements.
|
array_init_element()
| Initialize all elements in the array.
|
array_add()
| Add an element to the array (at the end of the array).
|
array_rem()
| Remove an element from the array.
|
array_insert()
| Insert an element in the array.
|
array_find()
| Search for an element of the array.
|