37#if defined(__arch64__) || defined(__x86_64__) \
38 || defined(__amd64__) || defined(__ia64__) \
39 || defined(__alpha__) || defined(__sparcv9) || defined(__mips64)
47#if defined(WIN32) || defined(_WIN32)
61typedef signed __int8 int8_t;
62typedef unsigned __int8 u_int8_t;
63typedef unsigned __int8 uint8_t;
64typedef signed __int16 int16_t;
65typedef unsigned __int16 u_int16_t;
66typedef unsigned __int16 uint16_t;
67typedef signed __int32 int32_t;
68typedef unsigned __int32 u_int32_t;
69typedef unsigned __int32 uint32_t;
70typedef signed __int64 int64_t;
71typedef unsigned __int64 u_int64_t;
72typedef unsigned __int64 uint64_t;
76typedef unsigned long in_addr_t;
79#define strcasecmp _stricmp
83#define strncasecmp _strnicmp
86#define vsnprintf _vsnprintf
87#define snprintf _snprintf
89#define strtoll _strtoi64
90#define strtoull _strtoui64
98#define mkdir(p,m) _mkdir(p)
102#define O_RDWR _O_RDWR
103#define O_RDONLY _O_RDONLY
104#define O_WRONLY _O_WRONLY
105#define O_APPEND _O_APPEND
106#define O_BINARY _O_BINARY
107#define O_EXCL _O_EXCL
108#define O_CREAT _O_CREAT
109#define O_TRUNC _O_TRUNC
112#define S_IRUSR _S_IREAD
113#define S_IWUSR _S_IWRITE
115#define S_IRWXU (_S_IREAD|_S_IWRITE)
117#ifdef LIBYATE_EXPORTS
118#define YATE_API __declspec(dllexport)
120#ifndef LIBYATE_STATIC
121#define YATE_API __declspec(dllimport)
126#define FMT64U "%I64u"
131#include <sys/socket.h>
133#if defined(__FreeBSD__)
134#include <netinet/in_systm.h>
137#include <netinet/in.h>
138#include <netinet/ip.h>
139#include <netinet/tcp.h>
140#include <arpa/inet.h>
157#if _WORDSIZE == 64 && !defined(__APPLE__)
169#define LLONG_MAX _I64_MAX
171#define LLONG_MAX 9223372036854775807LL
177#define LLONG_MIN _I64_MIN
179#define LLONG_MIN (-LLONG_MAX - 1LL)
185#define ULLONG_MAX _UI64_MAX
187#define ULLONG_MAX 18446744073709551615ULL
195#ifndef IPTOS_LOWDELAY
196#define IPTOS_LOWDELAY 0x10
197#define IPTOS_THROUGHPUT 0x08
198#define IPTOS_RELIABILITY 0x04
201#define IPTOS_MINCOST 0x02
204#define IPPROTO_SCTP 132
213#define RAND_MAX 2147483647
221#ifdef HAVE_GCC_FORMAT_CHECK
222#define FORMAT_CHECK(f) __attribute__((format(printf,(f),(f)+1)))
224#define FORMAT_CHECK(f)
227#define YIGNORE(v) while (v) { break; }
229#ifdef HAVE_BLOCK_RETURN
230#define YSTRING(s) (*({static const String str("" s);&str;}))
231#define YATOM(s) (*({static const String* str(0);str ? str : String::atom(str,"" s);}))
233#define YSTRING(s) ("" s)
234#define YATOM(s) ("" s)
237#define YSTRING_INIT_HASH ((unsigned) -1)
243YATE_API
void abortOnBug();
249YATE_API
bool abortOnBug(
bool doAbort);
260 DebugGoOn = DebugCrit,
275YATE_API
int debugLevel();
282YATE_API
int debugLevel(
int level);
289YATE_API
bool debugAt(
int level);
297YATE_API
const char* debugColor(
int level);
304YATE_API
const char* debugLevelName(
int level);
319 inline DebugEnabler(
int level = TelEngine::debugLevel(),
bool enabled =
true)
320 : m_level(DebugFail), m_enabled(enabled), m_chain(0), m_name(0)
321 { debugLevel(level); }
324 { m_name = 0; m_chain = 0; }
331 {
return m_chain ? m_chain->debugLevel() : m_level; }
345 {
return m_chain ? m_chain->debugEnabled() : m_enabled; }
352 { m_enabled = enable; m_chain = 0; }
373 {
return m_chain != 0; }
380 { m_chain = (chain !=
this) ? chain : 0; }
409void DDebug(
int level,
const char* format, ...);
416void DDebug(
const char* facility,
int level,
const char* format, ...);
423void DDebug(
const DebugEnabler* local,
int level,
const char* format, ...);
430void XDebug(
int level,
const char* format, ...);
437void XDebug(
const char* facility,
int level,
const char* format, ...);
444void XDebug(
const DebugEnabler* local,
int level,
const char* format, ...);
451void NDebug(
int level,
const char* format, ...);
458void NDebug(
const char* facility,
int level,
const char* format, ...);
465void NDebug(
const DebugEnabler* local,
int level,
const char* format, ...);
468#if defined(_DEBUG) || defined(DEBUG) || defined(XDEBUG)
477#define DDebug do { break; } while
479#define DDebug(arg...)
487#define XDebug do { break; } while
489#define XDebug(arg...)
497#define NDebug do { break; } while
499#define NDebug(arg...)
508YATE_API
void Debug(
int level,
const char* format, ...) FORMAT_CHECK(2);
516YATE_API
void Debug(const
char* facility,
int level, const
char* format, ...) FORMAT_CHECK(3);
524YATE_API
void Debug(const
DebugEnabler* local,
int level, const
char* format, ...) FORMAT_CHECK(3);
532YATE_API
void Alarm(const
char* component,
int level, const
char* format, ...) FORMAT_CHECK(3);
540YATE_API
void Alarm(const
DebugEnabler* component,
int level, const
char* format, ...) FORMAT_CHECK(3);
549YATE_API
void Alarm(const
char* component, const
char* info,
int level, const
char* format, ...) FORMAT_CHECK(4);
558YATE_API
void Alarm(const
DebugEnabler* component, const
char* info,
int level, const
char* format, ...) FORMAT_CHECK(4);
564YATE_API
void Output(const
char* format, ...) FORMAT_CHECK(1);
572YATE_API
void TraceDebug(const
char* traceId,
int level, const
char* format, ...) FORMAT_CHECK(3);
581YATE_API
void TraceDebug(const
char* traceId, const
char* facility,
int level,
582 const
char* format, ...) FORMAT_CHECK(4);
591YATE_API
void TraceDebug(const
char* traceId, const
DebugEnabler* local,
int level,
592 const
char* format, ...) FORMAT_CHECK(4);
602void TraceDebugObj(
GenObject* obj,
int level,
const char* format, ...);
611void TraceDebugObj(
GenObject* obj,
const char* facility,
int level,
const char* format, ...);
628void Trace(
GenObject* obj,
int level,
const char* format, ...);
637void Trace(
GenObject* obj,
const char* facility,
int level,
const char* format, ...);
654void TraceObj(
GenObject* obj,
int level,
const char* format, ...);
663void TraceObj(
GenObject* obj,
const char* facility,
int level,
const char* format, ...);
676#define TraceDebugObj(pGenObj,...) \
677TraceDebug((!!(pGenObj)) ? (pGenObj)->traceId() : "",##__VA_ARGS__)
679#define Trace(traceId,...) \
680do { if (!TelEngine::null(traceId)) TraceDebug(traceId,##__VA_ARGS__); } while(false)
682#define TraceObj(pGenObj,...) \
683do { if (!!(pGenObj) && (pGenObj)->traceId()) TraceDebug((pGenObj)->traceId(),##__VA_ARGS__); } while (false)
694YATE_API
void TraceAlarm(
const char* traceId,
const char* component,
int level,
695 const char* format, ...) FORMAT_CHECK(4);
704YATE_API
void TraceAlarm(const
char* traceId, const
DebugEnabler* component,
705 int level, const
char* format, ...) FORMAT_CHECK(4);
715YATE_API
void TraceAlarm(const
char* traceId, const
char* component, const
char* info,
716 int level, const
char* format, ...) FORMAT_CHECK(5);
726YATE_API
void TraceAlarm(const
char* traceId, const
DebugEnabler* component,
727 const
char* info,
int level, const
char* format, ...) FORMAT_CHECK(5);
756 explicit Debugger(
const char* name,
const char* format = 0, ...);
764 Debugger(
int level,
const char* name,
const char* format = 0, ...);
775 static void setOutput(
void (*outFunc)(
const char*,
int) = 0);
781 static void setIntOut(
void (*outFunc)(
const char*,
int) = 0);
787 static void setAlarmHook(
void (*alarmFunc)(
const char*,
int,
const char*,
const char*) = 0);
793 static void setRelayHook(
void (*relayFunc)(
int,
const char*,
const char*,
const char*) = 0);
837 static void relayOutput(
int level,
char* buffer,
const char* component = 0,
const char* info = 0);
888void YIGNORE(primitive value);
895constant YSTRING(
const char*
string);
902constant YATOM(
const char*
string);
909void YCLASS(
class type,
class base);
917void YCLASS2(
class type,
class base1,
class base2);
926void YCLASS3(
class type,
class base1,
class base2,
class base3);
933void YCLASSIMP(
class type,
class base);
941void YCLASSIMP2(
class type,
class base1,
class base2);
950void YCLASSIMP3(
class type,
class base1,
class base2,
class base3);
958class* YOBJECT(
class type,
GenObject* pntr);
964void YNOCOPY(
class type);
967#define YCLASS(type,base) \
968public: virtual void* getObject(const String& name) const \
969{ return (name == YATOM(#type)) ? const_cast<type*>(this) : base::getObject(name); }
971#define YCLASS2(type,base1,base2) \
972public: virtual void* getObject(const String& name) const \
973{ if (name == YATOM(#type)) return const_cast<type*>(this); \
974 void* tmp = base1::getObject(name); \
975 return tmp ? tmp : base2::getObject(name); }
977#define YCLASS3(type,base1,base2,base3) \
978public: virtual void* getObject(const String& name) const \
979{ if (name == YATOM(#type)) return const_cast<type*>(this); \
980 void* tmp = base1::getObject(name); \
981 if (tmp) return tmp; \
982 tmp = base2::getObject(name); \
983 return tmp ? tmp : base3::getObject(name); }
985#define YCLASSIMP(type,base) \
986void* type::getObject(const String& name) const \
987{ return (name == YATOM(#type)) ? const_cast<type*>(this) : base::getObject(name); }
989#define YCLASSIMP2(type,base1,base2) \
990void* type::getObject(const String& name) const \
991{ if (name == YATOM(#type)) return const_cast<type*>(this); \
992 void* tmp = base1::getObject(name); \
993 return tmp ? tmp : base2::getObject(name); }
995#define YCLASSIMP3(type,base1,base2,base3) \
996void* type::getObject(const String& name) const \
997{ if (name == YATOM(#type)) return const_cast<type*>(this); \
998 void* tmp = base1::getObject(name); \
999 if (tmp) return tmp; \
1000 tmp = base2::getObject(name); \
1001 return tmp ? tmp : base3::getObject(name); }
1003#define YOBJECT(type,pntr) (static_cast<type*>(GenObject::getObject(YATOM(#type),pntr)))
1005#define YNOCOPY(type) private: \
1007void operator=(const type&)
1015YATE_API
inline uint32_t hashInt64(uint64_t val)
1017 return (uint32_t)(((val ^ (val >> 48)) ^ (val >> 32)) ^ (val >> 16));
1025YATE_API
inline uint32_t hashInt32(uint32_t val)
1027 return (uint32_t)((val ^ (val >> 16)) ^ (val << 16));
1035YATE_API
inline uint32_t hashPtr(
const void* ptr)
1037#if (_WORDSIZE == 64)
1038 return hashInt64((uintptr_t)ptr);
1040 return hashInt32((uintptr_t)ptr);
1103 {
return obj ? obj->
getObject(name) : 0; }
1110 {
return s_counting; }
1117 { s_counting = enable; }
1124 {
return m_counter; }
1149 static bool s_counting;
1166template <
class Obj>
void destruct(Obj*& obj)
1167 {
if (obj) { obj->destruct(); obj = 0; } }
1224 {
return m_refcount; }
1238 {
return obj && (obj->
refcount() > 0); }
1313 {
return static_cast<Obj*
>(m_pointer); }
1354 { assign(value.
pointer());
return *
this; }
1360 { assign(
object);
return *
this; }
1366 inline operator Obj*()
const
1367 {
return pointer(); }
1373 {
return pointer(); }
1379 {
return *pointer(); }
1421 { m_pointer = value;
return *
this; }
1427 { m_pointer = object;
return *
this; }
1433 inline operator Obj*()
const
1434 {
return m_pointer; }
1440 {
return m_pointer; }
1446 {
return *m_pointer; }
1546 {
return at(index); }
1554 {
return at(index); }
1653 {
return m_delete; }
1660 { m_delete = autodelete; }
1700 : m_length(0), m_objects(0), m_delete(autodelete)
1736 {
return m_length; }
1756 {
return (index >= 0 && index < (
int)m_length) ? m_objects[index] : 0; }
1764 {
return at(index); }
1772 {
return at(index); }
1822 {
return m_delete; }
1829 { m_delete = autodelete; }
1832 unsigned int m_length;
1853 explicit Array(
int columns = 0,
int rows = 0);
1934 {
return m_columns; }
1944 if (column >= 0 || column < m_columns)
1945 return static_cast<ObjList*
>(m_obj[column]);
1956class StringMatchPrivate;
1974 inline explicit UChar(uint32_t code = 0)
1983 : m_chr((code < 0) ? 0 : code)
1991 : m_chr((unsigned char)code)
1998 inline explicit UChar(
unsigned char code)
2008 { m_chr = code; encode();
return *
this; }
2016 { m_chr = (
unsigned char)code; encode();
return *
this; }
2036 inline operator const char*()
const
2046 bool decode(
const char*& str, uint32_t maxChar = 0x10ffff,
bool overlong =
false);
2056 bool decode(uint16_t*& buff,
unsigned int& len, Endianness order, uint32_t maxChar = 0x10ffff);
2074 bool encode(uint16_t*& buff,
unsigned int& len, Endianness order);
2094 static bool decode(
String& out, uint16_t*& buff,
unsigned int& len, Endianness order,
bool checkBOM =
false, uint32_t maxChar = 0x10ffff);
2104 static bool encode(
DataBlock& out,
const char*& str, Endianness order,
bool addBOM =
false);
2115 static bool encode(uint16_t*& buff,
unsigned int& len,
const char*& str, Endianness order,
bool addBOM =
false);
2156 explicit String(
char value,
unsigned int repeat = 1);
2230 {
return value ?
"true" :
"false"; }
2237 {
return m_string; }
2244 {
return m_string ? m_string :
""; }
2251 inline const char*
safe(
const char* defStr)
const
2252 {
return m_string ? m_string : (defStr ? defStr :
""); }
2259 {
return m_length; }
2266 {
return !m_string; }
2275 static int lenUtf8(
const char* value, uint32_t maxChar = 0x10ffff,
bool overlong =
false);
2283 inline int lenUtf8(uint32_t maxChar = 0x10ffff,
bool overlong =
false)
const
2284 {
return lenUtf8(m_string,maxChar,overlong); }
2294 int fixUtf8(
const char* replace = 0, uint32_t maxChar = 0x10ffff,
bool overlong =
false);
2333 {
return str && (str[0] ==
'\357') && (str[1] ==
'\273') && (str[2] ==
'\277'); }
2340 {
return checkBOM(c_str()); }
2348 {
return checkBOM(str) && (str += 3); }
2356 {
return checkBOM(str) && (str += 3); }
2363 {
return checkBOM(c_str()) && &(*
this = c_str() + 3); }
2371 if (m_hash == YSTRING_INIT_HASH)
2372 m_hash = hash(m_string);
2382 static unsigned int hash(
const char* value,
unsigned int h = 0);
2394 char at(
int index)
const;
2431 int toInteger(
int defvalue = 0,
int base = 0,
int minvalue = INT_MIN,
2432 int maxvalue = INT_MAX,
bool clamp =
true)
const;
2453 long int toLong(
long int defvalue = 0,
int base = 0,
long int minvalue = LONG_MIN,
2454 long int maxvalue = LONG_MAX,
bool clamp =
true)
const;
2466 int64_t
toInt64(int64_t defvalue = 0,
int base = 0, int64_t minvalue = LLONG_MIN,
2467 int64_t maxvalue = LLONG_MAX,
bool clamp =
true)
const;
2479 uint64_t
toUInt64(uint64_t defvalue = 0,
int base = 0, uint64_t minvalue = 0,
2480 uint64_t maxvalue = ULLONG_MAX,
bool clamp =
true)
const;
2520 {
return at(index); }
2528 {
return at(index); }
2534 inline operator const char*()
const
2535 {
return m_string; };
2561 String&
hexify(
void* data,
unsigned int len,
char sep = 0,
bool upCase =
false);
2568 {
return operator=(value.
c_str()); }
2576 {
return operator=(value ? value->
c_str() :
""); }
2620 {
return operator=(boolText(value)); }
2634 {
return append(value,-1); }
2671 {
return operator+=(boolText(value)); }
2693 {
return (
this == &value) || ((hash() == value.
hash()) &&
operator==(value.
c_str())); }
2699 {
return (
this != &value) && ((hash() != value.
hash()) ||
operator!=(value.
c_str())); }
2715 {
return operator+=(value); }
2721 {
return operator+=(value); }
2727 {
return operator+=(value); }
2733 {
return operator+=(value); }
2739 {
return operator+=(value); }
2745 {
return operator+=(value); }
2751 {
return operator+=(value); }
2757 {
return operator+=(value); }
2804 String&
append(
const char* value,
const char* separator = 0,
bool force =
false);
2821 {
return append(&list,separator,force); }
2842 String& printf(
unsigned int length, const
char* format, ...) FORMAT_CHECK(3);
2852 String& appendFixed(
unsigned int fixedLength, const
char* str,
unsigned int len = -1,
char fill = ' ',
int align = Left);
2861 inline
String& appendFixed(
unsigned int fixedLength, const
String& str,
char fill = ' ',
int align = Left)
2862 {
return appendFixed(fixedLength,str.c_str(),str.length(),fill,align); }
2870 int find(
char what,
unsigned int offs = 0)
const;
2878 int find(
const char* what,
unsigned int offs = 0)
const;
2901 bool startsWith(
const char* what,
bool wordBreak =
false,
bool caseInsensitive =
false)
const;
2910 bool endsWith(
const char* what,
bool wordBreak =
false,
bool caseInsensitive =
false)
const;
2923 bool startSkip(
const char* what,
bool wordBreak =
true,
bool caseInsensitive =
false);
2974 {
return operator==(value); }
3003 {
return substr(matchOffset(index),matchLength(index)); }
3048 {
return msgEscape(c_str(),extraEsc); }
3066 {
return msgUnescape(c_str(),errptr,extraEsc); }
3082 {
return sqlEscape(c_str(),extraEsc); }
3109 {
return uriEscape(c_str(),extraEsc,noEsc); }
3125 {
return uriUnescape(c_str(),errptr); }
3142 void clearMatches();
3144 unsigned int m_length;
3146 mutable unsigned int m_hash;
3147 StringMatchPrivate* m_matches;
3155inline const char* c_str(
const String* str)
3156 {
return str ? str->
c_str() : (
const char*)0; }
3163inline const char* c_safe(
const char* str)
3164 {
return str ? str :
""; }
3171inline const char* c_safe(
const String* str)
3172 {
return str ? str->
safe() :
""; }
3179inline bool null(
const char* str)
3180 {
return !(str && *str); }
3187inline bool null(
const String* str)
3188 {
return !str || str->
null(); }
3209inline const char *strcpy(
String& dest,
const char* src)
3210 { dest = src;
return dest.
c_str(); }
3216inline const char *strcat(
String& dest,
const char* src)
3217 { dest += src;
return dest.
c_str(); }
3227YATE_API
int lookup(
const char* str,
const TokenDict* tokens,
int defvalue = 0,
int base = 0);
3235YATE_API
const char* lookup(
int value,
const TokenDict* tokens,
const char* defvalue = 0);
3245YATE_API int64_t lookup(
const char* str,
const TokenDict64* tokens, int64_t defvalue = 0,
int base = 0);
3253YATE_API
const char* lookup(int64_t value,
const TokenDict64* tokens,
const char* defvalue = 0);
3264YATE_API
bool controlReturn(
NamedList* params,
bool ret,
const char* retVal = 0);
3286 explicit Regexp(
const char* value,
bool extended =
false,
bool insensitive =
false);
3310 {
return m_regexp || (m_compile && doCompile()); }
3360 bool matches(
const char* value, StringMatchPrivate* matchlist)
const;
3361 mutable void* m_regexp;
3362 mutable bool m_compile;
3377 inline explicit Atom(
const char* value)
3405 friend class Engine;
3414 :
String(text), m_level(level)
3422 :
String(original), m_level(original.level())
3438 {
return s_capturing; }
3445 {
return s_events; }
3452 inline static void append(
int level,
const char* text)
3453 {
if (text && *text) s_events.append(
new CapturedEvent(level,text)); }
3461 {
return s_events; }
3468 { s_capturing = capture; }
3473 static bool s_capturing;
3571 {
return m_data ? m_data->getObject(name) : 0; }
3616 {
return m_enabled; }
3623 { m_enabled = val; }
3699 {
return (index < m_size) ? m_lists[index] : 0; }
3707 {
return getList(hash % m_size); }
3715 {
return getHashList(str.
hash()); }
3780 return n ? n->
remove(delobj) : 0;
3793 return n ? n->
remove(delobj) : 0;
3817 unsigned int m_size;
3857 {
return m_length; }
3905 {
return m_current >= m_length; }
3917 unsigned int* m_hashes;
3918 unsigned int m_length;
3919 unsigned int m_current;
3948 inline explicit Time(
const struct timeval* tv)
3949 : m_time(fromTimeval(tv))
3956 inline explicit Time(
const struct timeval& tv)
3957 : m_time(fromTimeval(tv))
3972 {
return (u_int32_t)((m_time+500000) / 1000000); }
3979 {
return (m_time+500) / 1000; }
3991 inline operator u_int64_t()
const
3998 { m_time = usec;
return *
this; }
4004 { m_time += delta;
return *
this; }
4010 { m_time -= delta;
return *
this; }
4017 { toTimeval(tv, m_time); }
4039 {
return fromTimeval(&tv); }
4072 static unsigned int toEpoch(
int year,
unsigned int month,
unsigned int day,
4073 unsigned int hour,
unsigned int minute,
unsigned int sec,
int offset = 0);
4087 static bool toDateTime(
unsigned int epochTimeSec,
int& year,
unsigned int& month,
4088 unsigned int& day,
unsigned int& hour,
unsigned int& minute,
unsigned int& sec,
4089 unsigned int* wDay = 0);
4098 static uint32_t
toNtp(uint32_t sec, uint32_t* over = 0,
bool rfc2030 =
true);
4106 inline uint32_t
toNtp(uint32_t* over = 0,
bool rfc2030 =
true)
4107 {
return toNtp(sec(),over,rfc2030); }
4117 static uint32_t
fromNtp(uint32_t val, uint32_t* under = 0,
bool rfc2030 =
true);
4130 static unsigned int toString(
char* buf, uint64_t time,
int frac = 0);
4145 unsigned int n = toString(tmp,time,frac);
4160 static uint64_t
toEpoch(
const char* buf,
unsigned int len,
int frac = 0);
4168 {
return (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)); }
4201 {
return m_random; }
4207 inline void set(u_int32_t seed)
4208 { m_random = seed; }
4266 DataBlock(
void* value,
unsigned int len,
bool copyData =
true,
unsigned int overAlloc = 0);
4298 inline unsigned char*
data(
unsigned int offs,
unsigned int len = 1)
const
4299 {
return (offs + len <= m_length) ? (
static_cast<unsigned char*
>(m_data) + offs) : 0; }
4307 inline int at(
unsigned int offs,
int defvalue = -1)
const
4308 {
return (offs < m_length) ?
static_cast<unsigned char*
>(m_data)[offs] : defvalue; }
4322 {
return m_length; }
4329 {
return m_overAlloc; }
4336 { m_overAlloc = bytes; }
4351 DataBlock&
assign(
void* value,
unsigned int len,
bool copyData =
true,
unsigned int allocated = 0);
4358 inline void append(
void* value,
unsigned int len) {
4387 if (len != length())
4409 {
return at(index); }
4417 {
return at(index); }
4428 { append(value);
return *
this; }
4434 { append(value);
return *
this; }
4445 const String& dFormat,
unsigned maxlen = 0);
4457 bool unHexify(
const char* data,
unsigned int len,
char sep);
4487 unsigned int allocLen(
unsigned int len)
const;
4489 unsigned int m_length;
4490 unsigned int m_allocated;
4491 unsigned int m_overAlloc;
4530 { finalize();
return m_hex; }
4538 inline bool update(
const void* buf,
unsigned int len)
4539 {
return updateInternal(buf,len); }
4547 {
return updateInternal(data.
data(), data.
length()); }
4555 {
return updateInternal(str.
c_str(), str.
length()); }
4562 { update(value);
return *
this; }
4569 { update(data);
return *
this; }
4593 {
return hmacStart(opad,key.
data(),key.
length()); }
4602 {
return hmacStart(opad,key.
c_str(),key.
length()); }
4619 bool hmac(
const void* key,
unsigned int keyLen,
const void* msg,
unsigned int msgLen);
4694 MD5(
const void* buf,
unsigned int len);
4755 unsigned char m_bin[16];
4781 SHA1(
const void* buf,
unsigned int len);
4852 unsigned char m_bin[20];
4939 unsigned char m_bin[32];
4962 inline Base64(
void* src,
unsigned int len,
bool copyData =
true)
4975 void encode(
String& dest,
unsigned int lineLen = 0,
bool lineAtEnd =
false);
4994 { append(value);
return *
this; }
5000 { append(data);
return *
this; }
5006 {
return operator<<(
String(value)); }
5058 {
return m_params.length(); }
5065 {
return m_params.count(); }
5071 { m_params.clear(); }
5097 m_params.setUnique(param);
5168 bool skipPrefix =
true,
bool replace =
false);
5231 int maxvalue = INT_MAX,
bool clamp =
true)
const;
5253 int64_t maxvalue = LLONG_MAX,
bool clamp =
true)
const;
5266 uint64_t maxvalue = ULLONG_MAX,
bool clamp =
true)
const;
5301 void dump(
String& str,
const char* separator,
char quote = 0,
bool force =
false)
const;
5314 {
return &m_params; }
5321 {
return &m_params; }
5341 : m_list(&list), m_item(list.m_params.skipNull())
5349 : m_list(original.m_list), m_item(original.m_item)
5357 { m_list = &list; m_item = list.m_params.
skipNull();
return *
this; }
5364 { m_list = original.m_list; m_item = original.m_item;
return *
this; }
5382 { m_item = m_list->m_params.skipNull(); }
5419 explicit URI(
const char* uri);
5429 URI(
const char* proto,
const char* user,
const char* host,
int port = 0,
const char* desc = 0);
5462 { parse();
return m_desc; }
5469 { parse();
return m_proto; }
5476 { parse();
return m_user; }
5483 { parse();
return m_host; }
5490 { parse();
return m_port; }
5497 { parse();
return m_extra; }
5506 mutable bool m_parsed;
5516class SemaphorePrivate;
5536 virtual bool lock(
long maxwait = -1) = 0;
5571 static void wait(
unsigned long maxwait);
5608 friend class MutexPrivate;
5616 explicit Mutex(
bool recursive =
false,
const char* name = 0);
5640 virtual bool lock(
long maxwait = -1);
5686 MutexPrivate* privDataCopy()
const;
5687 MutexPrivate* m_private;
5709 MutexPool(
unsigned int len = 13,
bool recursive =
false,
const char* name = 0);
5723 inline unsigned int index(
void* ptr)
const
5724 {
return ((
unsigned int)(
unsigned long)ptr) % m_length; }
5734 {
return m_data[index(ptr)]; }
5742 {
return m_data[idx % m_length]; }
5747 unsigned int m_length;
5756 friend class SemaphorePrivate;
5764 explicit Semaphore(
unsigned int maxcount = 1,
const char* name = 0,
5765 unsigned int initialCount = 1);
5789 virtual bool lock(
long maxwait = -1);
5823 SemaphorePrivate* privDataCopy()
const;
5824 SemaphorePrivate* m_private;
5842 { m_lock = lck.
lock(maxwait) ? &lck : 0; }
5850 { m_lock = (lck && lck->
lock(maxwait)) ? lck : 0; }
5856 {
if (m_lock) m_lock->unlock(); }
5869 {
if (m_lock) m_lock->unlock(); m_lock = 0; }
5878 {
return (lck && (lck == m_lock)) ||
5879 (drop(),(lck && (m_lock = lck->
lock(maxwait) ? lck : 0))); }
5888 {
return acquire(&lck,maxwait); }
5894 inline void*
operator new(size_t);
5897 inline void*
operator new[](size_t);
5917 : m_mx1(0), m_mx2(0)
5918 { lock(mx1,mx2,maxwait); }
5927 : m_mx1(0), m_mx2(0)
5928 { lock(&mx1,&mx2,maxwait); }
5941 {
return m_mx1 != 0; }
5960 {
return lock(&mx1,&mx2,maxwait); }
5972 inline void*
operator new(size_t);
5975 inline void*
operator new[](size_t);
6006 friend class ThreadPrivate;
6007 friend class MutexPrivate;
6008 friend class SemaphorePrivate;
6082 {
return m_locking || m_locks; }
6152 static void yield(
bool exitCheck =
false);
6159 static void idle(
bool exitCheck =
false);
6166 static void sleep(
unsigned int sec,
bool exitCheck =
false);
6173 static void msleep(
unsigned long msec,
bool exitCheck =
false);
6181 static void usleep(
unsigned long usec,
bool exitCheck =
false);
6237 {
return current() ==
this; }
6307 {
return errorString(buffer,lastError()); }
6342 ThreadPrivate* m_private;
6361 : m_saved(0), m_enabled(enable)
6370 : m_saved(0), m_enabled(enable && obj)
6379 : m_saved(0), m_enabled(enable)
6407 Unknown = AF_UNSPEC,
6410 AfUnsupported = AfMax,
6414 IPv6 = AfUnsupported + 1,
6419 Unix = AfUnsupported + 2,
6427 : m_address(0), m_length(0)
6436 m_address(0), m_length(0)
6478 {
return !operator==(other); }
6497 void assign(
const struct sockaddr* addr, socklen_t len = 0);
6518 {
return m_length && m_address; }
6525 {
return !(m_length && m_address); }
6532 {
return m_address ? m_address->sa_family : 0; }
6539 {
return lookupFamily(family()); }
6546 {
return scopeId(address()); }
6554 {
return scopeId(address(),val); }
6599 {
return m_address; }
6606 {
return m_length; }
6613 {
return isNullAddr(m_host,family()); }
6653 int family = Unknown) {
6655 return sa.
host(host) ? copyAddr(buf,sa.
address()) : Unknown;
6665 static int copyAddr(uint8_t* buf,
struct sockaddr* addr);
6672 static inline unsigned int scopeId(
struct sockaddr* addr) {
6674 if (addr && addr->sa_family == AF_INET6)
6675 return ((
struct sockaddr_in6*)addr)->sin6_scope_id;
6686 static inline bool scopeId(
struct sockaddr* addr,
unsigned int val) {
6688 if (addr && addr->sa_family == AF_INET6) {
6689 ((
struct sockaddr_in6*)addr)->sin6_scope_id = val;
6714 int family = Unknown) {
6715 appendAddr(buf,addr,family) <<
":" << port;
6728 appendTo(buf,addr,port,family);
6769 {
return lookup(family,s_familyName); }
6800 struct sockaddr* m_address;
6850 virtual bool received(
void* buffer,
int length,
int flags,
const struct sockaddr* addr, socklen_t adrlen) = 0;
6857 {
return m_socket; }
6957 {
return writeData(buf.
data(), buf.
length()); }
6986 inline int64_t
seek(int64_t offset)
6987 {
return seek(SeekBegin,offset); }
7054 : m_data(data), m_offset(0)
7098 {
return m_data.length(); }
7156 virtual bool openPath(
const char* name,
bool canWrite =
false,
bool canRead =
true,
7157 bool create =
false,
bool append =
false,
bool binary =
false,
7158 bool pubReadable =
false,
bool pubWritable =
false);
7183 {
return m_handle; }
7262 static bool setFileTime(
const char* name,
unsigned int secEpoch,
int* error = 0);
7271 static bool getFileTime(
const char* name,
unsigned int& secEpoch,
int* error = 0);
7279 static bool exists(
const char* name,
int* error = 0);
7288 static bool rename(
const char* oldFile,
const char* newFile,
int* error = 0);
7296 static bool remove(
const char* name,
int* error = 0);
7305 static bool md5(
const char* name,
String& buffer,
int* error = 0);
7314 static bool mkDir(
const char* path,
int* error = 0,
int mode = -1);
7322 static bool rmDir(
const char* path,
int* error = 0);
7369 LowDelay = IPTOS_LOWDELAY,
7370 MaxThroughput = IPTOS_THROUGHPUT,
7371 MaxReliability = IPTOS_RELIABILITY,
7372 MinCost = IPTOS_MINCOST,
7403 ExpeditedFwd = 0xb8,
7424 Socket(
int domain,
int type,
int protocol = 0);
7438 virtual bool create(
int domain,
int type,
int protocol = 0);
7463 {
return m_handle; }
7509 virtual bool setOption(
int level,
int name,
const void* value = 0, socklen_t length = 0);
7520#if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
7521 int value = on ? 1 : 0;
7522 return setOption(IPPROTO_IPV6,IPV6_V6ONLY,&value,
sizeof(value));
7536 virtual bool getOption(
int level,
int name,
void* buffer, socklen_t* length);
7567 inline bool setTOS(
const char* tos,
int defTos = Normal)
7568 {
return setTOS(lookup(tos,tosValues(),defTos)); }
7590 virtual bool setReuse(
bool reuse =
true,
bool exclusive =
false);
7606 virtual bool bind(
struct sockaddr* addr, socklen_t addrlen);
7621 virtual bool listen(
unsigned int backlog = 0);
7680 virtual bool connect(
struct sockaddr* addr, socklen_t addrlen);
7699 virtual bool connectAsync(
struct sockaddr* addr, socklen_t addrlen,
unsigned int toutUs,
7712 {
return connectAsync(addr.
address(),addr.
length(),toutUs,timeout); }
7720 virtual bool shutdown(
bool stopReads,
bool stopWrites);
7761 virtual int sendTo(
const void* buffer,
int length,
const struct sockaddr* addr, socklen_t adrlen,
int flags = 0);
7772 {
return sendTo(buffer, length, addr.
address(), addr.
length(), flags); }
7781 virtual int send(
const void* buffer,
int length,
int flags = 0);
7800 virtual int recvFrom(
void* buffer,
int length,
struct sockaddr* addr = 0, socklen_t* adrlen = 0,
int flags = 0);
7819 virtual int recv(
void* buffer,
int length,
int flags = 0);
7837 virtual bool select(
bool* readok,
bool* writeok,
bool* except,
struct timeval* timeout = 0);
7847 bool select(
bool* readok,
bool* writeok,
bool* except, int64_t timeout);
7909 bool applyFilters(
void* buffer,
int length,
int flags,
const struct sockaddr* addr = 0, socklen_t adrlen = 0);
7983 virtual int sendMsg(
const void* buf,
int length,
int stream,
int& flags) = 0;
8079 : m_ttl(ttl), m_order(order), m_pref(pref)
8086 : m_order(0), m_pref(0)
8195 inline SrvRecord(
int ttl,
int prio,
int weight,
const char* addr,
int port)
8196 :
DnsRecord(ttl,prio,weight), m_address(addr), m_port(port)
8204 {
return m_address; }
8254 NaptrRecord(
int ttl,
int ord,
int pref,
const char* flags,
const char* serv,
8255 const char* regexp,
const char* next);
8284 {
return m_service; }
8291 {
return m_regmatch; }
8298 {
return m_template; }
8351 static bool init(
int timeout = -1,
int retries = -1);
8435 {
return s_directions; }
8444 {
return (
Direction)TelEngine::lookup(name,s_directions,defdir); }
8507 {
return setKey(key.
data(),key.
length(),dir); }
8525 {
return initVector(vect.
data(),vect.
length(),dir); }
8534 virtual bool encrypt(
void* outData,
unsigned int len,
const void* inpData = 0) = 0;
8542 {
return encrypt(data.
data(),data.
length()); }
8551 virtual bool decrypt(
void* outData,
unsigned int len,
const void* inpData = 0) = 0;
8559 {
return decrypt(data.
data(),data.
length()); }
8581 :
String(name), m_format(format)
8595 {
return m_format; }
8604 virtual bool init(
bool comp =
true,
bool decomp =
true,
8645 virtual int writeComp(
const void* buf,
unsigned int len,
bool flush) = 0;
8656 {
return writeComp(data.
data(),data.
length(),flush); }
8667 {
return writeComp(data.
c_str(),data.
length(),flush); }
8685 virtual int writeDecomp(
const void* buf,
unsigned int len,
bool flush) = 0;
8695 {
return writeDecomp(data.
data(),data.
length(),flush); }
8705 {
return writeDecomp(data.
c_str(),data.
length(),flush); }
A list based Array.
Definition yateclass.h:1846
virtual void * getObject(const String &name) const
GenObject * take(int column, int row)
ObjList * getColumn(int column) const
Definition yateclass.h:1943
int getColumns() const
Definition yateclass.h:1933
bool set(GenObject *obj, int column, int row)
bool delColumn(int index)
Array(int columns=0, int rows=0)
bool addRow(ObjList *row=0, int index=-1)
int getRows() const
Definition yateclass.h:1926
bool addColumn(ObjList *column=0, int index=-1)
GenObject * get(int column, int row) const
Atom string holder.
Definition yateclass.h:3371
const String * operator->() const
Definition yateclass.h:3392
Atom(const char *value)
Definition yateclass.h:3377
Base64 encoder/decoder class.
Definition yateclass.h:4947
Base64 & operator<<(const char *value)
Definition yateclass.h:5005
Base64(void *src, unsigned int len, bool copyData=true)
Definition yateclass.h:4962
bool decode(DataBlock &dest, bool liberal=true)
Base64()
Definition yateclass.h:4953
Base64 & operator<<(const DataBlock &data)
Definition yateclass.h:4999
void encode(String &dest, unsigned int lineLen=0, bool lineAtEnd=false)
Base64 & operator<<(const String &value)
Definition yateclass.h:4993
A captured event string with a debug level.
Definition yateclass.h:3404
int level() const
Definition yateclass.h:3429
static void append(int level, const char *text)
Definition yateclass.h:3452
CapturedEvent(const CapturedEvent &original)
Definition yateclass.h:3421
static ObjList & eventsRw()
Definition yateclass.h:3460
static bool capturing()
Definition yateclass.h:3437
static const ObjList & events()
Definition yateclass.h:3444
static void capturing(bool capture)
Definition yateclass.h:3467
CapturedEvent(int level, const char *text)
Definition yateclass.h:3413
An abstract cipher.
Definition yateclass.h:8419
bool initVector(const DataBlock &vect, Direction dir=Bidir)
Definition yateclass.h:8524
virtual void * getObject(const String &name) const
Direction
Definition yateclass.h:8424
unsigned int bufferSize(unsigned int len) const
virtual bool valid(Direction dir=Bidir) const
virtual bool encrypt(void *outData, unsigned int len, const void *inpData=0)=0
bool bufferFull(unsigned int len) const
bool decrypt(DataBlock &data)
Definition yateclass.h:8558
virtual bool setKey(const void *key, unsigned int len, Direction dir=Bidir)=0
bool encrypt(DataBlock &data)
Definition yateclass.h:8541
virtual bool decrypt(void *outData, unsigned int len, const void *inpData=0)=0
static Direction direction(const char *name, Direction defdir=Bidir)
Definition yateclass.h:8443
virtual bool initVector(const void *vect, unsigned int len, Direction dir=Bidir)
virtual unsigned int blockSize() const =0
static const TokenDict * directions()
Definition yateclass.h:8434
virtual unsigned int initVectorSize() const
bool setKey(const DataBlock &key, Direction dir=Bidir)
Definition yateclass.h:8506
An abstract data (de)compressor.
Definition yateclass.h:8571
virtual int compress(const void *buf, unsigned int len, DataBlock &dest)
Compressor(const char *format, const char *name=0)
Definition yateclass.h:8580
virtual int writeDecomp(const void *buf, unsigned int len, bool flush)=0
virtual bool init(bool comp=true, bool decomp=true, const NamedList ¶ms=NamedList::empty())
Definition yateclass.h:8604
virtual int readComp(DataBlock &buf, bool flush)=0
int writeComp(const DataBlock &data, bool flush)
Definition yateclass.h:8655
virtual ~Compressor()
Definition yateclass.h:8587
virtual void finalize(bool comp)
Definition yateclass.h:8612
virtual int writeComp(const void *buf, unsigned int len, bool flush)=0
int writeDecomp(const String &data, bool flush)
Definition yateclass.h:8704
int writeDecomp(const DataBlock &data, bool flush)
Definition yateclass.h:8694
virtual int readDecomp(DataBlock &buf, bool flush)=0
int writeComp(const String &data, bool flush)
Definition yateclass.h:8666
const String & format() const
Definition yateclass.h:8594
virtual int decompress(const void *buf, unsigned int len, DataBlock &dest)
A class that holds just a block of raw data.
Definition yateclass.h:4237
static const DataBlock & empty()
int at(unsigned int offs, int defvalue=-1) const
Definition yateclass.h:4307
void overAlloc(unsigned int bytes)
Definition yateclass.h:4335
virtual void * getObject(const String &name) const
DataBlock & operator+=(const DataBlock &value)
Definition yateclass.h:4427
DataBlock(const DataBlock &value, unsigned int overAlloc)
void append(const DataBlock &value)
DataBlock & operator+=(const String &value)
Definition yateclass.h:4433
DataBlock(const DataBlock &value)
bool convert(const DataBlock &src, const String &sFormat, const String &dFormat, unsigned maxlen=0)
void truncate(unsigned int len)
bool null() const
Definition yateclass.h:4314
unsigned char * data(unsigned int offs, unsigned int len=1) const
Definition yateclass.h:4298
int operator[](unsigned int index) const
Definition yateclass.h:4416
void clear(bool deleteData=true)
bool unHexify(const String &data)
Definition yateclass.h:4476
String sqlEscape(char extraEsc) const
void append(const String &value)
void append(void *value, unsigned int len)
Definition yateclass.h:4358
void * data() const
Definition yateclass.h:4289
DataBlock & operator=(const DataBlock &value)
int operator[](signed int index) const
Definition yateclass.h:4408
DataBlock(void *value, unsigned int len, bool copyData=true, unsigned int overAlloc=0)
void insert(const DataBlock &value)
void resize(unsigned int len)
Definition yateclass.h:4386
bool unHexify(const char *data, unsigned int len, char sep)
unsigned int overAlloc() const
Definition yateclass.h:4328
unsigned int length() const
Definition yateclass.h:4321
DataBlock & assign(void *value, unsigned int len, bool copyData=true, unsigned int allocated=0)
bool unHexify(const char *data, unsigned int len)
DataBlock(unsigned int overAlloc=0)
A holder for a debug level.
Definition yateclass.h:312
void debugChain(const DebugEnabler *chain=0)
Definition yateclass.h:379
void debugName(const char *name)
Definition yateclass.h:393
void debugEnabled(bool enable)
Definition yateclass.h:351
DebugEnabler(int level=TelEngine::debugLevel(), bool enabled=true)
Definition yateclass.h:319
void debugCopy(const DebugEnabler *original=0)
bool debugEnabled() const
Definition yateclass.h:344
bool debugAt(int level) const
bool debugChained() const
Definition yateclass.h:372
int debugLevel() const
Definition yateclass.h:330
int debugLevel(int level)
const char * debugName() const
Definition yateclass.h:358
An object that logs messages on creation and destruction.
Definition yateclass.h:736
Formatting
Definition yateclass.h:741
static void setRelayHook(void(*relayFunc)(int, const char *, const char *, const char *)=0)
static void setIntOut(void(*outFunc)(const char *, int)=0)
Debugger(int level, const char *name, const char *format=0,...)
Debugger(const char *name, const char *format=0,...)
static Formatting getFormatting()
static unsigned int formatTime(char *buf, Formatting format=getFormatting())
static void setAlarmHook(void(*alarmFunc)(const char *, int, const char *, const char *)=0)
static void relayOutput(int level, char *buffer, const char *component=0, const char *info=0)
static uint32_t getStartTimeSec()
static void setOutput(void(*outFunc)(const char *, int)=0)
static void setFormatting(Formatting format, uint32_t startTimeSec=0)
static void enableOutput(bool enable=true, bool colorize=false)
A DNS record.
Definition yateclass.h:8068
DnsRecord(int ttl, int order, int pref)
Definition yateclass.h:8078
virtual void dump(String &buf, const char *sep=" ")
DnsRecord()
Definition yateclass.h:8085
static bool insert(ObjList &list, DnsRecord *rec, bool ascPref)
int ttl() const
Definition yateclass.h:8093
int order() const
Definition yateclass.h:8100
int pref() const
Definition yateclass.h:8107
A stream file class.
Definition yateclass.h:7125
static bool exists(const char *name, int *error=0)
static bool getFileTime(const char *name, unsigned int &secEpoch, int *error=0)
static bool listDirectory(const char *path, ObjList *dirs, ObjList *files, int *error=0)
HANDLE handle() const
Definition yateclass.h:7182
virtual bool valid() const
static bool rename(const char *oldFile, const char *newFile, int *error=0)
virtual int readData(void *buffer, int length)
void attach(HANDLE handle)
bool getFileTime(unsigned int &secEpoch)
static bool remove(const char *name, int *error=0)
static bool setFileTime(const char *name, unsigned int secEpoch, int *error=0)
virtual int writeData(const void *buffer, int length)
virtual bool canRetry() const
virtual int64_t seek(SeekPos pos, int64_t offset=0)
static bool mkDir(const char *path, int *error=0, int mode=-1)
virtual bool md5(String &buffer)
static bool rmDir(const char *path, int *error=0)
virtual bool setBlocking(bool block=true)
static HANDLE invalidHandle()
virtual bool openPath(const char *name, bool canWrite=false, bool canRead=true, bool create=false, bool append=false, bool binary=false, bool pubReadable=false, bool pubWritable=false)
static bool createPipe(File &reader, File &writer)
static bool md5(const char *name, String &buffer, int *error=0)
Definition yateclass.h:1049
virtual void * getObject(const String &name) const
static void setObjCounting(bool enable)
Definition yateclass.h:1116
virtual ~GenObject()
Definition yateclass.h:1060
static ObjList & getObjCounters()
virtual bool alive() const
virtual const String & toString() const
NamedCounter * setObjCounter(NamedCounter *counter)
static bool getObjCounting()
Definition yateclass.h:1109
virtual const String & traceId() const
static void * getObject(const String &name, const GenObject *obj)
Definition yateclass.h:1102
static NamedCounter * getObjCounter(const String &name, bool create=true)
NamedCounter * getObjCounter() const
Definition yateclass.h:1123
Templated pointer that can be inserted in a list.
Definition yateclass.h:1386
GenPointer< Obj > & operator=(const GenPointer< Obj > &value)
Definition yateclass.h:1420
Obj & operator*() const
Definition yateclass.h:1445
GenPointer()
Definition yateclass.h:1397
GenPointer(const GenPointer< Obj > &value)
Definition yateclass.h:1405
GenPointer(Obj *object)
Definition yateclass.h:1413
GenPointer< Obj > & operator=(Obj *object)
Definition yateclass.h:1426
Obj * operator->() const
Definition yateclass.h:1439
A hashed object list class.
Definition yateclass.h:3658
ObjList * getHashList(const String &str) const
Definition yateclass.h:3714
virtual void * getObject(const String &name) const
GenObject * remove(GenObject *obj, unsigned int hash, bool delobj=true)
Definition yateclass.h:3790
ObjList * find(const GenObject *obj) const
ObjList * append(const GenObject *obj)
ObjList * getList(unsigned int index) const
Definition yateclass.h:3698
ObjList * find(const GenObject *obj, unsigned int hash) const
HashList(unsigned int size=17)
GenObject * remove(const String &str, bool delobj=true)
Definition yateclass.h:3777
ObjList * append(const GenObject *obj, unsigned int hash)
ObjList * getHashList(unsigned int hash) const
Definition yateclass.h:3706
GenObject * operator[](const String &str) const
unsigned int count() const
GenObject * remove(GenObject *obj, bool delobj=true, bool useHash=false)
unsigned int length() const
Definition yateclass.h:3683
ObjList * find(const String &str) const
bool resync(GenObject *obj)
An abstract hashing class.
Definition yateclass.h:4499
bool update(const DataBlock &data)
Definition yateclass.h:4546
virtual unsigned int hmacBlockSize() const
bool hmacStart(DataBlock &opad, const String &key)
Definition yateclass.h:4601
bool update(const void *buf, unsigned int len)
Definition yateclass.h:4538
virtual void finalize()=0
Hasher()
Definition yateclass.h:4655
virtual unsigned int hashLength() const =0
virtual const unsigned char * rawDigest()=0
bool hmac(const DataBlock &key, const DataBlock &msg)
Definition yateclass.h:4627
bool update(const String &str)
Definition yateclass.h:4554
bool hmacFinal(const DataBlock &opad)
const String & hexDigest()
Definition yateclass.h:4529
bool hmac(const String &key, const String &msg)
Definition yateclass.h:4636
bool hmacStart(DataBlock &opad, const void *key, unsigned int keyLen)
Hasher & operator<<(const DataBlock &data)
Definition yateclass.h:4568
Hasher & operator<<(const String &value)
Definition yateclass.h:4561
virtual bool updateInternal(const void *buf, unsigned int len)=0
bool hmac(const void *key, unsigned int keyLen, const void *msg, unsigned int msgLen)
bool hmacStart(DataBlock &opad, const DataBlock &key)
Definition yateclass.h:4592
Hasher & operator<<(const char *value)
Class used to iterate the items of a list.
Definition yateclass.h:3828
ListIterator(ObjList &list, int offset=0)
void assign(HashList &list, int offset=0)
void reset()
Definition yateclass.h:3910
unsigned int length() const
Definition yateclass.h:3856
void assign(ObjList &list, int offset=0)
ListIterator(HashList &list, int offset=0)
bool eof() const
Definition yateclass.h:3904
GenObject * get(unsigned int index) const
Ephemeral double mutex locking object.
Definition yateclass.h:5907
bool lock(Mutex *mx1, Mutex *mx2, long maxwait=-1)
~Lock2()
Definition yateclass.h:5933
bool locked() const
Definition yateclass.h:5940
bool lock(Mutex &mx1, Mutex &mx2, long maxwait=-1)
Definition yateclass.h:5959
Lock2(Mutex &mx1, Mutex &mx2, long maxwait=-1)
Definition yateclass.h:5926
Lock2(Mutex *mx1, Mutex *mx2, long maxwait=-1)
Definition yateclass.h:5916
Ephemeral mutex or semaphore locking object.
Definition yateclass.h:5833
void drop()
Definition yateclass.h:5868
Lock(Lockable &lck, long maxwait=-1)
Definition yateclass.h:5841
~Lock()
Definition yateclass.h:5855
Lockable * locked() const
Definition yateclass.h:5862
Lock(Lockable *lck, long maxwait=-1)
Definition yateclass.h:5849
bool acquire(Lockable &lck, long maxwait=-1)
Definition yateclass.h:5887
bool acquire(Lockable *lck, long maxwait=-1)
Definition yateclass.h:5877
Abstract interface for lockable objects.
Definition yateclass.h:5524
virtual bool locked() const =0
virtual bool lock(long maxwait=-1)=0
static unsigned long wait()
static void wait(unsigned long maxwait)
static void enableSafety(bool safe=true)
virtual bool check(long maxwait=-1)
static void startUsingNow()
A standard MD5 digest calculator.
Definition yateclass.h:4676
MD5 & operator=(const MD5 &original)
static unsigned int rawLength()
Definition yateclass.h:4740
MD5(const DataBlock &data)
virtual const unsigned char * rawDigest()
MD5(const void *buf, unsigned int len)
bool updateInternal(const void *buf, unsigned int len)
virtual unsigned int hashLength() const
Definition yateclass.h:4747
A Stream that operates on DataBlocks in memory.
Definition yateclass.h:7039
virtual bool terminate()
Definition yateclass.h:7068
MemoryStream()
Definition yateclass.h:7045
virtual bool valid() const
Definition yateclass.h:7074
virtual int64_t length()
Definition yateclass.h:7097
virtual int writeData(const void *buffer, int len)
virtual int64_t seek(SeekPos pos, int64_t offset=0)
const DataBlock & data() const
Definition yateclass.h:7061
int64_t m_offset
Definition yateclass.h:7117
DataBlock m_data
Definition yateclass.h:7112
virtual int readData(void *buffer, int len)
MemoryStream(const DataBlock &data)
Definition yateclass.h:7053
A Mutex pool.
Definition yateclass.h:5697
unsigned int index(void *ptr) const
Definition yateclass.h:5723
MutexPool(unsigned int len=13, bool recursive=false, const char *name=0)
Mutex * mutex(void *ptr) const
Definition yateclass.h:5733
Mutex * mutex(unsigned int idx) const
Definition yateclass.h:5741
Mutex support.
Definition yateclass.h:5607
virtual bool locked() const
Mutex & operator=(const Mutex &original)
Mutex(const Mutex &original)
static bool efficientTimedLock()
Mutex(bool recursive=false, const char *name=0)
const char * owner() const
virtual bool lock(long maxwait=-1)
Atomic counter with name.
Definition yateclass.h:3602
NamedCounter(const String &name)
int count() const
Definition yateclass.h:3641
void enable(bool val)
Definition yateclass.h:3622
bool enabled() const
Definition yateclass.h:3615
NamedList parameters iterator.
Definition yateclass.h:5334
NamedIterator & operator=(const NamedIterator &original)
Definition yateclass.h:5363
NamedIterator & operator=(const NamedList &list)
Definition yateclass.h:5356
const NamedString * get()
NamedIterator(const NamedIterator &original)
Definition yateclass.h:5348
void reset()
Definition yateclass.h:5381
NamedIterator(const NamedList &list)
Definition yateclass.h:5340
bool eof() const
Definition yateclass.h:5375
A named string container class.
Definition yateclass.h:5016
virtual void * getObject(const String &name) const
int getIndex(const NamedString *param) const
void clearParams()
Definition yateclass.h:5070
void dump(String &str, const char *separator, char quote=0, bool force=false) const
NamedList & copyParams(const NamedList &original, ObjList *list, char childSep=0)
static const NamedList & empty()
NamedList(const char *name)
NamedList & setParam(const String &name, const char *value)
NamedList & clearParam(NamedString *param, bool delParam=true)
NamedString * getParam(const String &name) const
NamedList & operator=(const NamedList &value)
const ObjList * paramList() const
Definition yateclass.h:5320
NamedList & copyParam(const NamedList &original, const String &name, char childSep=0)
NamedList & setParam(NamedString *param)
Definition yateclass.h:5094
NamedList(const NamedList &original)
int64_t getInt64Value(const String &name, int64_t defvalue=0, int64_t minvalue=LLONG_MIN, int64_t maxvalue=LLONG_MAX, bool clamp=true) const
int getIntValue(const String &name, int defvalue=0, int minvalue=INT_MIN, int maxvalue=INT_MAX, bool clamp=true) const
const char * getValue(const String &name, const char *defvalue=0) const
NamedList & copyParams(const NamedList &original, const String &list, char childSep=0)
int getIndex(const String &name) const
bool getBoolValue(const String &name, bool defvalue=false) const
double getDoubleValue(const String &name, double defvalue=0.0) const
NamedList & copyParams(const NamedList &original)
NamedList & addParam(NamedString *param)
int replaceParams(String &str, bool sqlEsc=false, char extraEsc=0) const
int getIntValue(const String &name, const TokenDict *tokens, int defvalue=0) const
ObjList * paramList()
Definition yateclass.h:5313
bool hasSubParams(const char *prefix) const
NamedList & addParam(const char *name, const char *value, bool emptyOK=true)
NamedList & copySubParams(const NamedList &original, const String &prefix, bool skipPrefix=true, bool replace=false)
const String & operator[](const String &name) const
unsigned int count() const
Definition yateclass.h:5064
unsigned int length() const
Definition yateclass.h:5057
NamedList(const char *name, const NamedList &original, const String &prefix)
uint64_t getUInt64Value(const String &name, uint64_t defvalue=0, uint64_t minvalue=0, uint64_t maxvalue=ULLONG_MAX, bool clamp=true) const
NamedString * getParam(unsigned int index) const
NamedList & clearParam(const String &name, char childSep=0)
A named pointer class.
Definition yateclass.h:3529
void userData(GenObject *data)
virtual void * getObject(const String &name) const
GenObject * userData() const
Definition yateclass.h:3548
NamedPointer(const char *name, GenObject *data=0, const char *value=0)
void * userObject(const String &name) const
Definition yateclass.h:3570
NamedPointer & operator=(const char *value)
Definition yateclass.h:3576
A named string class.
Definition yateclass.h:3481
virtual void * getObject(const String &name) const
NamedString & operator=(const char *value)
Definition yateclass.h:3514
NamedString(const char *name, const char *value=0)
virtual const String & toString() const
const String & name() const
Definition yateclass.h:3495
A NAPTR record.
Definition yateclass.h:8240
const String & serv() const
Definition yateclass.h:8283
bool replace(String &str) const
virtual void dump(String &buf, const char *sep=" ")
const Regexp & regexp() const
Definition yateclass.h:8290
const String & nextName() const
Definition yateclass.h:8304
const String & repTemplate() const
Definition yateclass.h:8297
NaptrRecord(int ttl, int ord, int pref, const char *flags, const char *serv, const char *regexp, const char *next)
const String & flags() const
Definition yateclass.h:8276
An object list class.
Definition yateclass.h:1454
virtual void * getObject(const String &name) const
ObjList * next() const
Definition yateclass.h:1505
void sort(int(*callbackCompare)(GenObject *obj1, GenObject *obj2, void *context), void *context=0)
ObjList * find(const GenObject *obj) const
ObjList * setUnique(const GenObject *obj, bool compact=true)
ObjList * append(const GenObject *obj, bool compact=true)
GenObject * set(const GenObject *obj, bool delold=true)
GenObject * at(int index) const
int index(const String &str) const
GenObject * remove(GenObject *obj, bool delobj=true)
ObjList * skipNull() const
void setDelete(bool autodelete)
Definition yateclass.h:1659
GenObject * operator[](signed int index) const
Definition yateclass.h:1545
GenObject * remove(const String &str, bool delobj=true)
ObjList * skipNext() const
GenObject * operator[](unsigned int index) const
Definition yateclass.h:1553
bool autoDelete()
Definition yateclass.h:1652
ObjList * operator+(int index) const
GenObject * operator[](const String &str) const
GenObject * get() const
Definition yateclass.h:1490
static const ObjList & empty()
unsigned int count() const
int index(const GenObject *obj) const
ObjList * insert(const GenObject *obj, bool compact=true)
unsigned int length() const
ObjList * find(const String &str) const
GenObject * remove(bool delobj=true)
A vector holding GenObjects.
Definition yateclass.h:1692
virtual void * getObject(const String &name) const
ObjVector(bool autodelete=true)
Definition yateclass.h:1699
ObjVector(ObjList &list, bool move=true, unsigned int maxLen=0, bool autodelete=true)
GenObject * at(int index) const
Definition yateclass.h:1755
int index(const String &str) const
void setDelete(bool autodelete)
Definition yateclass.h:1828
ObjVector(unsigned int maxLen, bool autodelete=true)
GenObject * operator[](signed int index) const
Definition yateclass.h:1763
GenObject * operator[](unsigned int index) const
Definition yateclass.h:1771
bool autoDelete()
Definition yateclass.h:1821
bool set(GenObject *obj, unsigned int index)
GenObject * take(unsigned int index)
unsigned int count() const
int index(const GenObject *obj) const
unsigned int length() const
Definition yateclass.h:1735
unsigned int assign(ObjList &list, bool move=true, unsigned int maxLen=0)
Pseudo random number generator.
Definition yateclass.h:4186
u_int32_t get() const
Definition yateclass.h:4200
void set(u_int32_t seed)
Definition yateclass.h:4207
Random(u_int32_t seed=Time::now() &0xffffffff)
Definition yateclass.h:4192
static void srandom(unsigned int seed)
Definition yateclass.h:1174
static bool efficientIncDec()
static bool alive(const RefObject *obj)
Definition yateclass.h:1237
virtual void * getObject(const String &name) const
virtual bool alive() const
int refcount() const
Definition yateclass.h:1223
Internal helper class.
Definition yateclass.h:1280
RefPointerBase()
Definition yateclass.h:1285
void * m_pointer
Definition yateclass.h:1299
void assign(RefObject *oldptr, RefObject *newptr, void *pointer)
Templated smart pointer class.
Definition yateclass.h:1306
RefPointer< Obj > & operator=(Obj *object)
Definition yateclass.h:1359
RefPointer< Obj > & operator=(const RefPointer< Obj > &value)
Definition yateclass.h:1353
Obj & operator*() const
Definition yateclass.h:1378
Obj * pointer() const
Definition yateclass.h:1312
void assign(Obj *object=0)
Definition yateclass.h:1319
~RefPointer()
Definition yateclass.h:1347
RefPointer()
Definition yateclass.h:1326
Obj * operator->() const
Definition yateclass.h:1372
RefPointer(const RefPointer< Obj > &value)
Definition yateclass.h:1333
RefPointer(Obj *object)
Definition yateclass.h:1341
A regexp matching class.
Definition yateclass.h:3271
bool isCaseInsensitive() const
Regexp(const char *value, bool extended=false, bool insensitive=false)
bool compile() const
Definition yateclass.h:3309
void setFlags(bool extended, bool insensitive)
Regexp(const Regexp &value)
Regexp & operator=(const char *value)
Definition yateclass.h:3302
bool matches(const char *value) const
virtual bool matches(const String &value) const
Definition yateclass.h:3324
DNS services.
Definition yateclass.h:8323
static bool init(int timeout=-1, int retries=-1)
static int naptrQuery(const char *dname, ObjList &result, String *error=0)
Type
Definition yateclass.h:8328
static int query(Type type, const char *dname, ObjList &result, String *error=0)
static bool available(Type type=Unknown)
static int a6Query(const char *dname, ObjList &result, String *error=0)
static int srvQuery(const char *dname, ObjList &result, String *error=0)
static int a4Query(const char *dname, ObjList &result, String *error=0)
static int txtQuery(const char *dname, ObjList &result, String *error=0)
Encapsulates a runnable task.
Definition yateclass.h:5984
A standard SHA1 digest calculator.
Definition yateclass.h:4763
SHA1 & operator=(const SHA1 &original)
SHA1(const void *buf, unsigned int len)
static unsigned int rawLength()
Definition yateclass.h:4827
SHA1(const SHA1 &original)
virtual const unsigned char * rawDigest()
static bool fips186prf(DataBlock &out, const DataBlock &seed, unsigned int len)
SHA1(const DataBlock &data)
bool updateInternal(const void *buf, unsigned int len)
virtual unsigned int hashLength() const
Definition yateclass.h:4834
A standard SHA256 digest calculator.
Definition yateclass.h:4860
static unsigned int rawLength()
Definition yateclass.h:4924
SHA256(const void *buf, unsigned int len)
SHA256(const DataBlock &data)
virtual const unsigned char * rawDigest()
SHA256(const SHA256 &original)
SHA256(const String &str)
SHA256 & operator=(const SHA256 &original)
bool updateInternal(const void *buf, unsigned int len)
virtual unsigned int hashLength() const
Definition yateclass.h:4931
Abstract SCTP Socket.
Definition yateclass.h:7920
virtual bool subscribeEvents()=0
virtual bool connectx(ObjList &addresses)=0
virtual int recvMsg(void *buf, int length, SocketAddr &addr, int &stream, int &flags)=0
virtual bool getStreams(int &inbound, int &outbound)=0
SctpSocket()
Definition yateclass.h:7926
virtual int sendTo(void *buffer, int length, int stream, SocketAddr &addr, int flags)=0
virtual int sendMsg(const void *buf, int length, int stream, int &flags)=0
virtual bool setPayload(u_int32_t payload)=0
virtual bool setStreams(int inbound, int outbound)=0
virtual Socket * accept(SocketAddr &addr)
Definition yateclass.h:7972
SctpSocket(SOCKET fd)
Definition yateclass.h:7933
virtual bool bindx(ObjList &addresses)=0
Semaphore implementation.
Definition yateclass.h:5755
virtual bool locked() const
Semaphore(const Semaphore &original)
static bool efficientTimedLock()
Semaphore & operator=(const Semaphore &original)
virtual bool lock(long maxwait=-1)
Semaphore(unsigned int maxcount=1, const char *name=0, unsigned int initialCount=1)
A socket address holder.
Definition yateclass.h:6400
static unsigned int scopeId(struct sockaddr *addr)
Definition yateclass.h:6672
static String appendTo(const String &addr, int port, int family=Unknown)
Definition yateclass.h:6726
static const char * lookupFamily(int family)
Definition yateclass.h:6768
int copyAddr(DataBlock &addr) const
static String & appendTo(String &buf, const String &addr, int port, int family=Unknown)
Definition yateclass.h:6713
static bool scopeId(struct sockaddr *addr, unsigned int val)
Definition yateclass.h:6686
bool operator!=(const SocketAddr &other) const
Definition yateclass.h:6477
SocketAddr(int family, const void *raw=0)
bool valid() const
Definition yateclass.h:6517
socklen_t length() const
Definition yateclass.h:6605
static bool isNullAddr(const String &addr, int family=Unknown)
struct sockaddr * address() const
Definition yateclass.h:6598
static bool stringify(String &buf, struct sockaddr *addr)
static int unStringify(uint8_t *buf, const String &host, int family=Unknown)
Definition yateclass.h:6652
bool operator==(const SocketAddr &other) const
SocketAddr & operator=(const SocketAddr &value)
Definition yateclass.h:6462
int family() const
Definition yateclass.h:6531
bool null() const
Definition yateclass.h:6524
bool assign(const DataBlock &addr)
Family
Definition yateclass.h:6406
unsigned int scopeId() const
Definition yateclass.h:6545
static String & appendAddr(String &buf, const String &addr, int family=Unknown)
SocketAddr(const SocketAddr &value)
Definition yateclass.h:6434
const char * familyName() const
Definition yateclass.h:6538
static int family(const String &addr)
const String & host() const
Definition yateclass.h:6560
bool scopeId(unsigned int val)
Definition yateclass.h:6553
static void splitIface(const String &buf, String &addr, String *iface=0)
static const TokenDict * dictFamilyName()
static void split(const String &buf, String &addr, int &port, bool portPresent=false)
SocketAddr(const struct sockaddr *addr, socklen_t len=0)
static int copyAddr(uint8_t *buf, struct sockaddr *addr)
static bool supports(int family)
void assign(const struct sockaddr *addr, socklen_t len=0)
virtual bool host(const String &name)
const String & addr() const
Definition yateclass.h:6567
static const String & ipv4NullAddr()
bool local(const SocketAddr &remote)
static const String & ipv6NullAddr()
SocketAddr()
Definition yateclass.h:6426
virtual void updateAddr() const
bool isNullAddr() const
Definition yateclass.h:6612
A filter for received socket data.
Definition yateclass.h:6814
virtual void * getObject(const String &name) const
virtual bool received(void *buffer, int length, int flags, const struct sockaddr *addr, socklen_t adrlen)=0
Socket * socket() const
Definition yateclass.h:6856
virtual void timerTick(const Time &when)
RefObject holding a Socket pointer.
Definition yateclass.h:8032
virtual void * getObject(const String &name) const
Definition yateclass.h:8055
SocketRef(Socket *&socket)
Definition yateclass.h:8046
SocketRef(Socket **socket)
Definition yateclass.h:8038
A generic socket class.
Definition yateclass.h:7361
virtual bool connectAsync(struct sockaddr *addr, socklen_t addrlen, unsigned int toutUs, bool *timeout=0)
static const TokenDict * tosValues()
virtual bool setReuse(bool reuse=true, bool exclusive=false)
bool connectAsync(const SocketAddr &addr, unsigned int toutUs, bool *timeout=0)
Definition yateclass.h:7710
bool installFilter(SocketFilter *filter)
void attach(SOCKET handle)
virtual bool connect(struct sockaddr *addr, socklen_t addrlen)
virtual int send(const void *buffer, int length, int flags=0)
bool getPeerName(SocketAddr &addr)
virtual bool valid() const
DSCP
Definition yateclass.h:7378
virtual bool getOption(int level, int name, void *buffer, socklen_t *length)
virtual int readData(void *buffer, int length)
static bool createPair(Socket &sock1, Socket &sock2, int domain=AF_UNIX)
virtual bool getPeerName(struct sockaddr *addr, socklen_t *addrlen)
static bool efficientSelect()
bool bind(const SocketAddr &addr)
Definition yateclass.h:7613
bool getSockName(SocketAddr &addr)
virtual bool inProgress() const
Socket * accept(SocketAddr &addr)
virtual bool shutdown(bool stopReads, bool stopWrites)
SOCKET handle() const
Definition yateclass.h:7462
int sendTo(const void *buffer, int length, const SocketAddr &addr, int flags=0)
Definition yateclass.h:7771
bool setIpv6OnlyOption(bool on)
Definition yateclass.h:7519
virtual bool canSelect() const
bool checkError(int retcode, bool strict=false)
virtual Socket * accept(struct sockaddr *addr=0, socklen_t *addrlen=0)
virtual bool create(int domain, int type, int protocol=0)
virtual int recv(void *buffer, int length, int flags=0)
virtual bool getSockName(struct sockaddr *addr, socklen_t *addrlen)
virtual int sendTo(const void *buffer, int length, const struct sockaddr *addr, socklen_t adrlen, int flags=0)
virtual int writeData(const void *buffer, int length)
bool applyFilters(void *buffer, int length, int flags, const struct sockaddr *addr=0, socklen_t adrlen=0)
virtual bool canRetry() const
virtual bool getParams(const String ¶ms, NamedList &result)
Definition yateclass.h:7551
virtual bool setTOS(int tos)
virtual bool setOption(int level, int name, const void *value=0, socklen_t length=0)
virtual bool setParams(const NamedList ¶ms)
Definition yateclass.h:7542
virtual void timerTick(const Time &when)
virtual bool setBlocking(bool block=true)
virtual bool bind(struct sockaddr *addr, socklen_t addrlen)
virtual int recvFrom(void *buffer, int length, struct sockaddr *addr=0, socklen_t *adrlen=0, int flags=0)
void removeFilter(SocketFilter *filter, bool delobj=false)
Socket(int domain, int type, int protocol=0)
virtual bool listen(unsigned int backlog=0)
static SOCKET invalidHandle()
SOCKET acceptHandle(struct sockaddr *addr=0, socklen_t *addrlen=0)
static bool canSelect(SOCKET handle)
TOS
Definition yateclass.h:7367
virtual bool setLinger(int seconds=-1)
bool setTOS(const char *tos, int defTos=Normal)
Definition yateclass.h:7567
bool connect(const SocketAddr &addr)
Definition yateclass.h:7687
bool select(bool *readok, bool *writeok, bool *except, int64_t timeout)
virtual bool select(bool *readok, bool *writeok, bool *except, struct timeval *timeout=0)
int recvFrom(void *buffer, int length, SocketAddr &addr, int flags=0)
A SRV record.
Definition yateclass.h:8183
SrvRecord(int ttl, int prio, int weight, const char *addr, int port)
Definition yateclass.h:8195
int port() const
Definition yateclass.h:8210
static void copy(ObjList &dest, const ObjList &src)
virtual void dump(String &buf, const char *sep=" ")
const String & address() const
Definition yateclass.h:8203
An abstract stream class capable of reading and writing.
Definition yateclass.h:6874
int writeData(const DataBlock &buf)
Definition yateclass.h:6956
static bool allocPipe(Stream *&reader, Stream *&writer)
virtual int readData(void *buffer, int length)=0
int error() const
Definition yateclass.h:6894
SeekPos
Definition yateclass.h:6879
virtual bool inProgress() const
Stream()
Definition yateclass.h:7021
static bool supportsPipes()
virtual bool terminate()=0
virtual int writeData(const void *buffer, int length)=0
void clearError()
Definition yateclass.h:7028
int writeData(const String &str)
Definition yateclass.h:6948
static bool supportsPairs()
int writeData(const char *str)
virtual bool canRetry() const
virtual int64_t seek(SeekPos pos, int64_t offset=0)
static bool allocPair(Stream *&str1, Stream *&str2)
virtual bool setBlocking(bool block=true)
virtual bool valid() const =0
int64_t seek(int64_t offset)
Definition yateclass.h:6986
A C-style string handling class.
Definition yateclass.h:2131
const char * c_str() const
Definition yateclass.h:2236
String & printf(unsigned int length, const char *format,...)
double toDouble(double defvalue=0.0) const
String & appendFixed(unsigned int fixedLength, const String &str, char fill=' ', int align=Left)
Definition yateclass.h:2861
bool checkBOM() const
Definition yateclass.h:2339
int find(const char *what, unsigned int offs=0) const
String & operator=(bool value)
Definition yateclass.h:2619
String & append(double value, unsigned int decimals=3)
virtual void * getObject(const String &name) const
static String msgUnescape(const char *str, int *errptr=0, char extraEsc=0)
static String msgEscape(const char *str, char extraEsc=0)
String & operator>>(int &store)
static bool stripBOM(char *&str)
Definition yateclass.h:2355
bool startSkip(const char *what, bool wordBreak=true, bool caseInsensitive=false)
int find(char what, unsigned int offs=0) const
char operator[](unsigned int index) const
Definition yateclass.h:2527
bool operator|=(const char *value) const
int64_t toInt64(int64_t defvalue=0, int base=0, int64_t minvalue=LLONG_MIN, int64_t maxvalue=LLONG_MAX, bool clamp=true) const
String & extractTo(const char *sep, int &store, int base=0)
String & hexify(void *data, unsigned int len, char sep=0, bool upCase=false)
String & operator+=(int64_t value)
static String sqlEscape(const char *str, char extraEsc=0)
ObjList * split(char separator, bool emptyOK=true) const
static String uriEscape(const char *str, char extraEsc=0, const char *noEsc=0)
static String uriEscape(const char *str, const char *extraEsc, const char *noEsc=0)
bool operator==(const char *value) const
static bool checkBOM(const char *str)
Definition yateclass.h:2332
String replaceMatches(const String &templ) const
bool endsWith(const char *what, bool wordBreak=false, bool caseInsensitive=false) const
String & operator>>(bool &store)
uint64_t encodeFlags(const TokenDict64 *tokens) const
String & extractTo(const char *sep, double &store)
String uriUnescape(int *errptr=0) const
Definition yateclass.h:3124
int rfind(const char *what) const
String & operator+=(const char *value)
Definition yateclass.h:2633
String & extractTo(const char *sep, String &store)
String & append(const ObjList &list, const char *separator=0, bool force=false)
Definition yateclass.h:2820
String & operator<<(const char *value)
Definition yateclass.h:2714
ObjList * split(const Regexp ®, bool emptyOK=true) const
String matchString(int index=0) const
Definition yateclass.h:3002
String & operator<<(int32_t value)
Definition yateclass.h:2726
String & operator=(int64_t value)
bool null() const
Definition yateclass.h:2265
String & operator+=(uint64_t value)
const String & decodeFlags(unsigned int flags, const TokenDict *tokens, bool unknownflag=true)
String & operator=(uint32_t value)
const char * safe() const
Definition yateclass.h:2243
int lenUtf8(uint32_t maxChar=0x10ffff, bool overlong=false) const
Definition yateclass.h:2283
static int lenUtf8(const char *value, uint32_t maxChar=0x10ffff, bool overlong=false)
int fixUtf8(const char *replace=0, uint32_t maxChar=0x10ffff, bool overlong=false)
String & operator>>(const char *skip)
String & append(const ObjList *list, const char *separator=0, bool force=false)
int rfind(char what) const
String & extractTo(const char *sep, int &store, const TokenDict *tokens, int base=0)
String & operator+=(int32_t value)
String sqlEscape(char extraEsc=0) const
Definition yateclass.h:3081
String & operator=(const char *value)
bool operator==(const String &value) const
Definition yateclass.h:2692
String & extractTo(const char *sep, bool &store)
String(const String *value)
String & operator+=(uint32_t value)
bool operator!=(const String &value) const
Definition yateclass.h:2698
virtual const String & toString() const
bool stripBOM()
Definition yateclass.h:2362
String & operator>>(unsigned int &store)
String & assign(char value, unsigned int repeat=1)
String & assign(const char *value, int len=-1)
bool operator&=(const char *value) const
static const String * atom(const String *&str, const char *val)
String & appendFixed(unsigned int fixedLength, const char *str, unsigned int len=-1, char fill=' ', int align=Left)
String(const char *value, int len=-1)
String & operator<<(uint32_t value)
Definition yateclass.h:2732
uint64_t toUInt64(uint64_t defvalue=0, int base=0, uint64_t minvalue=0, uint64_t maxvalue=ULLONG_MAX, bool clamp=true) const
String & operator<<(uint64_t value)
Definition yateclass.h:2744
String & operator<<(double value)
Definition yateclass.h:2756
static String uriUnescape(const char *str, int *errptr=0)
String(char value, unsigned int repeat=1)
String & append(const char *value, int len)
String & operator>>(char &store)
static const char * boolText(bool value)
Definition yateclass.h:2229
static unsigned int hash(const char *value, unsigned int h=0)
bool toBoolean(bool defvalue=false) const
static bool stripBOM(const char *&str)
Definition yateclass.h:2347
String & operator=(char value)
int toInteger(const TokenDict *tokens, int defvalue=0, int base=0) const
unsigned int hash() const
Definition yateclass.h:2369
String uriEscape(char extraEsc=0, const char *noEsc=0) const
Definition yateclass.h:3108
String & operator=(const String &value)
Definition yateclass.h:2567
long int toLong(long int defvalue=0, int base=0, long int minvalue=LONG_MIN, long int maxvalue=LONG_MAX, bool clamp=true) const
int toInteger(int defvalue=0, int base=0, int minvalue=INT_MIN, int maxvalue=INT_MAX, bool clamp=true) const
String & operator=(uint64_t value)
String & operator+=(char value)
String & operator<<(bool value)
Definition yateclass.h:2750
bool startsWith(const char *what, bool wordBreak=false, bool caseInsensitive=false) const
String & operator>>(UChar &store)
int matchLength(int index=0) const
static const String & empty()
const char * safe(const char *defStr) const
Definition yateclass.h:2251
char operator[](signed int index) const
Definition yateclass.h:2519
String(const String &value)
int matchOffset(int index=0) const
String & operator=(int32_t value)
String & operator+=(double value)
String & append(const char *value, const char *separator=0, bool force=false)
unsigned int encodeFlags(const TokenDict *tokens) const
unsigned int length() const
Definition yateclass.h:2258
String & operator+=(bool value)
Definition yateclass.h:2670
bool operator!=(const char *value) const
String & operator<<(char value)
Definition yateclass.h:2720
String msgEscape(char extraEsc=0) const
Definition yateclass.h:3047
const String & decodeFlags(uint64_t flags, const TokenDict64 *tokens, bool unknownflag=true)
String & operator=(double value)
bool matches(const Regexp &rexp)
String & operator<<(int64_t value)
Definition yateclass.h:2738
String msgUnescape(int *errptr=0, char extraEsc=0) const
Definition yateclass.h:3065
String & printf(const char *format,...)
virtual bool matches(const String &value) const
Definition yateclass.h:2973
String & operator=(const String *value)
Definition yateclass.h:2575
String substr(int offs, int len=-1) const
A class exposing system resources usage.
Definition yateclass.h:8725
static u_int64_t usecRunTime(Type type=WallTime)
Type
Definition yateclass.h:8730
static u_int64_t startTime()
static double runTime(Type type=WallTime)
static u_int64_t msecRunTime(Type type=WallTime)
static u_int32_t secRunTime(Type type=WallTime)
Ephemeral object counter changer.
Definition yateclass.h:6352
TempObjectCounter(const GenObject *obj, bool enable=GenObject::getObjCounting())
Definition yateclass.h:6369
TempObjectCounter(const GenObject &obj, bool enable=GenObject::getObjCounting())
Definition yateclass.h:6378
TempObjectCounter(NamedCounter *counter, bool enable=GenObject::getObjCounting())
Definition yateclass.h:6360
~TempObjectCounter()
Definition yateclass.h:6385
Thread support class.
Definition yateclass.h:6005
static int setCurrentAffinity(const DataBlock &mask)
static void sleep(unsigned int sec, bool exitCheck=false)
static int setCurrentAffinity(const String &cpus)
static bool check(bool exitNow=true)
Priority
Definition yateclass.h:6014
int setAffinity(const DataBlock &mask)
static void usleep(unsigned long usec, bool exitCheck=false)
static unsigned long idleMsec()
static void idleMsec(unsigned long msec)
static bool errorString(String &buffer)
Definition yateclass.h:6306
Thread(const char *name, const char *prio)
static NamedCounter * getCurrentObjCounter(bool always=false)
static void yield(bool exitCheck=false)
static bool errorString(String &buffer, int code)
static void printCPUMask(const DataBlock &mask, String &str, bool hexa=true)
int locks() const
Definition yateclass.h:6074
int getAffinity(DataBlock &outCpuMask)
const char * name() const
bool locked() const
Definition yateclass.h:6081
static Thread * current()
static unsigned long idleUsec()
static int getCurrentAffinity(DataBlock &outCpuMask)
static const char * priority(Priority prio)
static void msleep(unsigned long msec, bool exitCheck=false)
static int getCurrentAffinity(String &outCpus, bool hex=false)
static NamedCounter * setCurrentObjCounter(NamedCounter *counter)
NamedCounter * setObjCounter(NamedCounter *counter)
static bool parseCPUMask(const String &cpus, DataBlock &mask)
bool isCurrent() const
Definition yateclass.h:6236
int setAffinity(const String &cpus)
static const char * currentName()
static void idle(bool exitCheck=false)
static Priority priority(const char *name, Priority defvalue=Normal)
void cancel(bool hard=false)
Thread(const char *name=0, Priority prio=Normal)
NamedCounter * getObjCounter() const
A time holding class.
Definition yateclass.h:3927
static void toTimeval(struct timeval *tv, u_int64_t usec)
static unsigned int toString(char *buf, uint64_t time, int frac=0)
static uint64_t toEpoch(const char *buf, unsigned int len, int frac=0)
Time & operator-=(int64_t delta)
Definition yateclass.h:4009
Time()
Definition yateclass.h:3932
static int timeZone(u_int32_t when=secNow())
static uint32_t toNtp(uint32_t sec, uint32_t *over=0, bool rfc2030=true)
void toTimeval(struct timeval *tv) const
Definition yateclass.h:4016
static unsigned int appendTo(String &buf, uint64_t time, int frac=0)
Definition yateclass.h:4143
Time & operator=(u_int64_t usec)
Definition yateclass.h:3997
Time(u_int64_t usec)
Definition yateclass.h:3940
static uint32_t fromNtp(uint32_t val, uint32_t *under=0, bool rfc2030=true)
static unsigned int toEpoch(int year, unsigned int month, unsigned int day, unsigned int hour, unsigned int minute, unsigned int sec, int offset=0)
u_int64_t msec() const
Definition yateclass.h:3978
static u_int64_t fromTimeval(const struct timeval &tv)
Definition yateclass.h:4038
static bool toDateTime(unsigned int epochTimeSec, int &year, unsigned int &month, unsigned int &day, unsigned int &hour, unsigned int &minute, unsigned int &sec, unsigned int *wDay=0)
Time(const struct timeval &tv)
Definition yateclass.h:3956
u_int64_t usec() const
Definition yateclass.h:3985
Time(const struct timeval *tv)
Definition yateclass.h:3948
Time & operator+=(int64_t delta)
Definition yateclass.h:4003
uint32_t toNtp(uint32_t *over=0, bool rfc2030=true)
Definition yateclass.h:4106
static u_int64_t fromTimeval(const struct timeval *tv)
u_int32_t sec() const
Definition yateclass.h:3971
static u_int32_t secNow()
static bool isLeap(unsigned int year)
Definition yateclass.h:4167
~Time()
Definition yateclass.h:3964
static u_int64_t msecNow()
A text based DNS record.
Definition yateclass.h:8137
TxtRecord(int ttl, const char *text)
Definition yateclass.h:8146
static void copy(ObjList &dest, const ObjList &src)
virtual void dump(String &buf, const char *sep=" ")
const String & text() const
Definition yateclass.h:8154
A single Unicode character.
Definition yateclass.h:1963
const char * c_str() const
Definition yateclass.h:2029
static bool encode(uint16_t *&buff, unsigned int &len, const char *&str, Endianness order, bool addBOM=false)
bool encode(uint16_t *&buff, unsigned int &len, Endianness order)
bool decode(uint16_t *&buff, unsigned int &len, Endianness order, uint32_t maxChar=0x10ffff)
UChar & operator=(char code)
Definition yateclass.h:2015
UChar(uint32_t code=0)
Definition yateclass.h:1974
UChar(int32_t code)
Definition yateclass.h:1982
UChar & operator=(uint32_t code)
Definition yateclass.h:2007
bool decode(const char *&str, uint32_t maxChar=0x10ffff, bool overlong=false)
static bool decode(String &out, uint16_t *&buff, unsigned int &len, Endianness order, bool checkBOM=false, uint32_t maxChar=0x10ffff)
static bool encode(DataBlock &out, const char *&str, Endianness order, bool addBOM=false)
UChar(unsigned char code)
Definition yateclass.h:1998
bool decode(DataBlock &buff, Endianness order, uint32_t maxChar=0x10ffff)
bool encode(DataBlock &buff, Endianness order)
uint32_t code() const
Definition yateclass.h:2022
UChar(signed char code)
Definition yateclass.h:1990
Encapsulation for an URI.
Definition yateclass.h:5396
const String & getUser() const
Definition yateclass.h:5475
URI(const char *proto, const char *user, const char *host, int port=0, const char *desc=0)
const String & getExtra() const
Definition yateclass.h:5496
URI & operator=(const String &value)
Definition yateclass.h:5447
const String & getDescription() const
Definition yateclass.h:5461
URI & operator=(const URI &value)
Definition yateclass.h:5440
URI & operator=(const char *value)
Definition yateclass.h:5454
int getPort() const
Definition yateclass.h:5489
const String & getProtocol() const
Definition yateclass.h:5468
const String & getHost() const
Definition yateclass.h:5482
Complex operator+(const Complex &c1, const Complex &c2)
Definition yatemath.h:1567
Definition yateclass.h:865
const char * token
Definition yateclass.h:869
int64_t value
Definition yateclass.h:874
Definition yateclass.h:848
const char * token
Definition yateclass.h:852
int value
Definition yateclass.h:857