various general purpose/helper functions. More...
#include "comp_defs.h"#include <sys/types.h>#include <sys/select.h>#include <sys/time.h>#include <limits.h>#include <time.h>#include <unistd.h>#include <ctype.h>#include <string.h>#include <strings.h>#include "compiler_opt.h"#include "config.h"#include "dprint.h"#include "str.h"#include "mem/mem.h"#include "mem/shm_mem.h"#include "config.h"

Go to the source code of this file.
Definition in file ut.h.
This function returns the full pathname of a file in parameter. If the file pathname does not start with / then it will be converted into an absolute pathname. The function gets the absolute directory pathname from base and appends file to it. The first parameter can be NULL, in this case the function will use the location of the main SER configuration file as reference.
| base | filename to be used as reference when file is relative. It must be absolute. The location of the SER configuration file will be used as reference if you set the value of this parameter to NULL. | |
| file | A pathname to be converted to absolute. |
Converts relative pathnames to absolute pathnames.
| base | - base file, used to extract the absolute path prefix. Might be NULL, in which case the path of the ser.cfg is used. | |
| file | - file path to be transformed. If it's already absolute (starts with '/') is left alone. If not the result will be `dirname base`/file. |
Definition at line 218 of file ut.c.
References _str::len, _str::s, and STR_FMT.
Referenced by cfg_parser_init(), fix_initial_pathname(), fix_rel_pathname(), and fix_shm_pathname().

| static char* int2str | ( | unsigned long | l, | |
| int * | len | |||
| ) | [inline, static] |
This version uses a static buffer (shared with sint2str()). WARNING: other function calls might overwrite the static buffer, so either always save the result immediately or use int2strbuf(...).
| l | - unsigned long to be converted/printed. | |
| *len | - will be filled with the final length (without the terminating 0). |
Definition at line 335 of file ut.h.
References int2strbuf().
Referenced by build_contact(), build_fault_reply(), create_via(), db_postgres_new_connection(), gen_cmd_name(), get_marker(), get_str_fparam(), http_xmlrpc2sip(), internal_mi_print_dlg(), mi_add_aor_node(), mi_get_profile(), mi_usrloc_dump(), print_value(), pv_get_dlg_lifetime(), pv_get_dlg_status(), pv_get_uintval(), pv_set_mcd_value(), sst_dialog_mi_context_CB(), tls_domain_str(), tr_eval_line(), tr_eval_nameaddr(), tr_eval_paramlist(), and tr_eval_string().


| static char* int2strbuf | ( | unsigned long | l, | |
| char * | r, | |||
| int | r_size, | |||
| int * | len | |||
| ) | [inline, static] |
Converts/prints an unsigned long to a string. The result buffer must be provided and its length must be at least INT2STR_MAX_LEN.
| l | - unsigned long to be converted | |
| r | - pointer to result buffer | |
| r_size | - result buffer size, must be at least INT2STR_MAX_LEN. | |
| *len | - length of the written string, _without_ the terminating 0. |
Definition at line 302 of file ut.h.
Referenced by int2str(), and sint2strbuf().

| dst | destination | |
| src | source |
Definition at line 718 of file ut.h.
References _str::len, and _str::s.
Referenced by pv_get_mcd_value().

| static char* sint2str | ( | long | l, | |
| int * | len | |||
| ) | [inline, static] |
This version uses a static buffer, shared with int2str(). WARNING: other function calls might overwrite the static buffer, so either always save the result immediately or use sint2strbuf(...).
| l | - long to be converted/printed. | |
| *len | - will be filled with the final length (without the terminating 0). |
Definition at line 385 of file ut.h.
References sint2strbuf().
Referenced by get_string(), print_value(), and pv_get_sintval().


| static char* sint2strbuf | ( | long | l, | |
| char * | r, | |||
| int | r_size, | |||
| int * | len | |||
| ) | [inline, static] |
Converts a long to a signed string. The result buffer must be provided and its length must be at least INT2STR_MAX_LEN.
| l | - long to be converted | |
| r | - pointer to result buffer | |
| r_size | - result buffer size, must be at least INT2STR_MAX_LEN. | |
| *len | - length of the written string, _without_ the terminating 0. |
Definition at line 354 of file ut.h.
References int2strbuf().
Referenced by rval_get_tmp_str(), and sint2str().


| str1 | first str | |
| str2 | second str |
Definition at line 760 of file ut.h.
References _str::len, and _str::s.
Referenced by get_fifo_opts(), and load_config().

| str1 | first str | |
| str2 | second str |
Definition at line 738 of file ut.h.
References _str::len, and _str::s.
Referenced by map_name2id(), and set_next_domain_on_rule().

1.7.1