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) 
  251class SemaphorePrivate;
 
  260YATE_API 
void abortOnBug();
 
  266YATE_API 
bool abortOnBug(
bool doAbort);
 
  277    DebugGoOn = DebugCrit,
 
  292YATE_API 
int debugLevel();
 
  299YATE_API 
int debugLevel(
int level);
 
  306YATE_API 
bool debugAt(
int level);
 
  314YATE_API 
const char* debugColor(
int level);
 
  321YATE_API 
const char* debugLevelName(
int level);
 
  336    inline DebugEnabler(
int level = TelEngine::debugLevel(), 
bool enabled = 
true)
 
  337        : m_level(DebugFail), m_enabled(enabled), m_chain(0), m_name(0)
 
  338        { debugLevel(level); }
 
 
  341        { m_name = 0; m_chain = 0; }
 
  348        { 
return m_chain ? m_chain->debugLevel() : m_level; }
 
 
  362        { 
return m_chain ? m_chain->debugEnabled() : m_enabled; }
 
 
  369        { m_enabled = enable; m_chain = 0; }
 
 
  390        { 
return m_chain != 0; }
 
 
  397        { m_chain = (chain != 
this) ? chain : 0; }
 
 
 
  432void DDebug(
int level, 
const char* format, ...);
 
  439void DDebug(
const char* facility, 
int level, 
const char* format, ...);
 
  446void DDebug(
const DebugEnabler* local, 
int level, 
const char* format, ...);
 
  453void XDebug(
int level, 
const char* format, ...);
 
  460void XDebug(
const char* facility, 
int level, 
const char* format, ...);
 
  467void XDebug(
const DebugEnabler* local, 
int level, 
const char* format, ...);
 
  474void NDebug(
int level, 
const char* format, ...);
 
  481void NDebug(
const char* facility, 
int level, 
const char* format, ...);
 
  488void NDebug(
const DebugEnabler* local, 
int level, 
const char* format, ...);
 
  491#if defined(_DEBUG) || defined(DEBUG) || defined(XDEBUG) 
  500#define DDebug do { break; } while 
  502#define DDebug(arg...) 
  510#define XDebug do { break; } while 
  512#define XDebug(arg...) 
  520#define NDebug do { break; } while 
  522#define NDebug(arg...) 
  531YATE_API 
void Debug(
int level, 
const char* format, ...) FORMAT_CHECK(2);
 
  539YATE_API 
void Debug(const 
char* facility, 
int level, const 
char* format, ...) FORMAT_CHECK(3);
 
  547YATE_API 
void Debug(const 
DebugEnabler* local, 
int level, const 
char* format, ...) FORMAT_CHECK(3);
 
  555YATE_API 
void Alarm(const 
char* component, 
int level, const 
char* format, ...) FORMAT_CHECK(3);
 
  563YATE_API 
void Alarm(const 
DebugEnabler* component, 
int level, const 
char* format, ...) FORMAT_CHECK(3);
 
  572YATE_API 
void Alarm(const 
char* component, const 
char* info, 
int level, const 
char* format, ...) FORMAT_CHECK(4);
 
  581YATE_API 
void Alarm(const 
DebugEnabler* component, const 
char* info, 
int level, const 
char* format, ...) FORMAT_CHECK(4);
 
  587YATE_API 
void Output(const 
char* format, ...) FORMAT_CHECK(1);
 
  595YATE_API 
void TraceDebug(const 
char* traceId, 
int level, const 
char* format, ...) FORMAT_CHECK(3);
 
  604YATE_API 
void TraceDebug(const 
char* traceId, const 
char* facility, 
int level,
 
  605            const 
char* format, ...) FORMAT_CHECK(4);
 
  614YATE_API 
void TraceDebug(const 
char* traceId, const 
DebugEnabler* local, 
int level,
 
  615            const 
char* format, ...) FORMAT_CHECK(4);
 
  625void TraceDebugObj(
GenObject* obj, 
int level, 
const char* format, ...);
 
  634void TraceDebugObj(
GenObject* obj, 
const char* facility, 
int level, 
const char* format, ...);
 
  651void Trace(
GenObject* obj, 
int level, 
const char* format, ...);
 
  660void Trace(
GenObject* obj, 
const char* facility, 
int level, 
const char* format, ...);
 
  677void TraceObj(
GenObject* obj, 
int level, 
const char* format, ...);
 
  686void TraceObj(
GenObject* obj, 
const char* facility, 
int level, 
const char* format, ...);
 
  699#define TraceDebugObj(pGenObj,...) \ 
  700TraceDebug((!!(pGenObj)) ? (pGenObj)->traceId() : "",##__VA_ARGS__) 
  702#define Trace(traceId,...) \ 
  703do { if (!TelEngine::null(traceId)) TraceDebug(traceId,##__VA_ARGS__); } while(false) 
  705#define TraceObj(pGenObj,...) \ 
  706do { if (!!(pGenObj) && (pGenObj)->traceId()) TraceDebug((pGenObj)->traceId(),##__VA_ARGS__); } while (false) 
  716YATE_API 
void TraceAlarm(
const char* traceId, 
const char* component, 
int level,
 
  717            const char* format, ...) FORMAT_CHECK(4);
 
  726YATE_API 
void TraceAlarm(const 
char* traceId, const 
DebugEnabler* component,
 
  727            int level, const 
char* format, ...) FORMAT_CHECK(4);
 
  737YATE_API 
void TraceAlarm(const 
char* traceId, const 
char* component, const 
char* info,
 
  738            int level, const 
char* format, ...) FORMAT_CHECK(5);
 
  748YATE_API 
void TraceAlarm(const 
char* traceId, const 
DebugEnabler* component,
 
  749            const 
char* info, 
int level, const 
char* format, ...) FORMAT_CHECK(5);
 
  778    explicit Debugger(
const char* name, 
const char* format = 0, ...);
 
  786    Debugger(
int level, 
const char* name, 
const char* format = 0, ...);
 
  806    static void setOutput(
void (*outFunc)(
const char*,
int) = 0);
 
  812    static void setIntOut(
void (*outFunc)(
const char*,
int) = 0);
 
  818    static void setAlarmHook(
void (*alarmFunc)(
const char*,
int,
const char*,
const char*) = 0);
 
  824    static void setRelayHook(
void (*relayFunc)(
int,
const char*,
const char*,
const char*) = 0);
 
  868    static void relayOutput(
int level, 
char* buffer, 
const char* component = 0, 
const char* info = 0);
 
 
  926void YIGNORE(primitive value);
 
  933constant YSTRING(
const char* 
string);
 
  940constant YATOM(
const char* 
string);
 
  947void YCLASS(
class type,
class base);
 
  955void YCLASS2(
class type,
class base1,
class base2);
 
  964void YCLASS3(
class type,
class base1,
class base2,
class base3);
 
  973void YCLASS_DATA(var dataPtr,
class type,
class base);
 
  983void YCLASS2_DATA(var dataPtr,
class type,
class base1,
class base2);
 
  994void YCLASS3_DATA(var dataPtr,
class type,
class base1,
class base2,
class base3);
 
 1001void YCLASSIMP(
class type,
class base);
 
 1009void YCLASSIMP2(
class type,
class base1,
class base2);
 
 1018void YCLASSIMP3(
class type,
class base1,
class base2,
class base3);
 
 1026class* YOBJECT(
class type,
GenObject* pntr);
 
 1032void YNOCOPY(
class type);
 
 1035#define YCLASS(type,base) \ 
 1036public: virtual void* getObject(const String& name) const \ 
 1037{ return (name == YATOM(#type)) ? const_cast<type*>(this) : base::getObject(name); } 
 1039#define YCLASS2(type,base1,base2) \ 
 1040public: virtual void* getObject(const String& name) const \ 
 1041{ if (name == YATOM(#type)) return const_cast<type*>(this); \ 
 1042  void* tmp = base1::getObject(name); \ 
 1043  return tmp ? tmp : base2::getObject(name); } 
 1045#define YCLASS3(type,base1,base2,base3) \ 
 1046public: virtual void* getObject(const String& name) const \ 
 1047{ if (name == YATOM(#type)) return const_cast<type*>(this); \ 
 1048  void* tmp = base1::getObject(name); \ 
 1049  if (tmp) return tmp; \ 
 1050  tmp = base2::getObject(name); \ 
 1051  return tmp ? tmp : base3::getObject(name); } 
 1053#define YCLASS_CALL(res) { void* tmp = res; if (tmp) return tmp; } 
 1054#define YCLASS_CALL_LAST(base1,base2) { void* tmp = base1::getObject(name); return tmp ? tmp : base2::getObject(name); } 
 1055#define YCLASS_DATA_CHECK_PTR(dataPtr,type) { \ 
 1056    if (dataPtr) YCLASS_CALL((dataPtr)->getObject(name)) \ 
 1057    if (name == YATOM(#type)) return const_cast<type*>(this); \ 
 1060#define YCLASS_DATA(dataPtr,type,base) \ 
 1061public: virtual void* getObject(const String& name) const { \ 
 1062    YCLASS_DATA_CHECK_PTR(dataPtr,type) \ 
 1063    return base::getObject(name); \ 
 1066#define YCLASS2_DATA(dataPtr,type,base1,base2) \ 
 1067public: virtual void* getObject(const String& name) const { \ 
 1068    YCLASS_DATA_CHECK_PTR(dataPtr,type) \ 
 1069    YCLASS_CALL_LAST(base,base2) \ 
 1072#define YCLASS3_DATA(dataPtr,type,base1,base2,base3) \ 
 1073public: virtual void* getObject(const String& name) const { \ 
 1074    YCLASS_DATA_CHECK_PTR(dataPtr,type) \ 
 1075    YCLASS_CALL(base1::getObject(name)) \ 
 1076    YCLASS_CALL_LAST(base2,base3) \ 
 1079#define YCLASSIMP(type,base) \ 
 1080void* type::getObject(const String& name) const \ 
 1081{ return (name == YATOM(#type)) ? const_cast<type*>(this) : base::getObject(name); } 
 1083#define YCLASSIMP2(type,base1,base2) \ 
 1084void* type::getObject(const String& name) const \ 
 1085{ if (name == YATOM(#type)) return const_cast<type*>(this); \ 
 1086  void* tmp = base1::getObject(name); \ 
 1087  return tmp ? tmp : base2::getObject(name); } 
 1089#define YCLASSIMP3(type,base1,base2,base3) \ 
 1090void* type::getObject(const String& name) const \ 
 1091{ if (name == YATOM(#type)) return const_cast<type*>(this); \ 
 1092  void* tmp = base1::getObject(name); \ 
 1093  if (tmp) return tmp; \ 
 1094  tmp = base2::getObject(name); \ 
 1095  return tmp ? tmp : base3::getObject(name); } 
 1097#define YOBJECT(type,pntr) (static_cast<type*>(GenObject::getObject(YATOM(#type),pntr))) 
 1099#define YNOCOPY(type) private: \ 
 1101void operator=(const type&) 
 1109YATE_API 
inline uint32_t hashInt64(uint64_t val)
 
 1111    return (uint32_t)(((val ^ (val >> 48)) ^ (val >> 32)) ^ (val >> 16));
 
 1119YATE_API 
inline uint32_t hashInt32(uint32_t val)
 
 1121    return (uint32_t)((val ^ (val >> 16)) ^ (val << 16));
 
 1129YATE_API 
inline uint32_t hashPtr(
const void* ptr)
 
 1131#if (_WORDSIZE == 64) 
 1132    return hashInt64((uintptr_t)ptr);
 
 1134    return hashInt32((uintptr_t)ptr);
 
 1154template <
class Obj> 
void yateSort(Obj* buf, 
unsigned int len,
 
 1155    int (*callbackCompare)(Obj& obj1, Obj& obj2, 
void* context),
 
 1161        unsigned int n = len;
 
 1163        for (
unsigned int i = 1; i < n; ++i) {
 
 1164            if (callbackCompare(buf[i - 1],buf[i],context) <= 0)
 
 1166            Obj tmp = buf[i - 1];
 
 1167            buf[i - 1] = buf[i];
 
 1175#undef YATOMIC_BUILTIN 
 1179        #define YATOMIC_BUILTIN 
 1184    #define YATOMIC_OP_LOCK_WRITE WLock lck(m_lock) 
 1185    #define YATOMIC_OP_LOCK_READ RLock lck(m_lock) 
 1187    #define YATOMIC_OP_LOCK_WRITE {} 
 1188    #define YATOMIC_OP_LOCK_READ {} 
 1250        : m_value(val.valueAtomic())
 
 
 1279#ifdef YATOMIC_BUILTIN 
 1280            return __sync_add_and_fetch(&m_value,0);
 
 1282            YATOMIC_OP_LOCK_READ;
 
 
 1292#ifdef YATOMIC_BUILTIN 
 1293            return __sync_add_and_fetch(&m_value,0);
 
 1295            YATOMIC_OP_LOCK_READ;
 
 
 1306#ifdef YATOMIC_BUILTIN 
 1307            return __sync_val_compare_and_swap(&m_value,valueAtomic(),val);
 
 1309            YATOMIC_OP_LOCK_WRITE;
 
 
 1321#ifdef YATOMIC_BUILTIN 
 1322            return __sync_add_and_fetch(&m_value,1);
 
 1324            YATOMIC_OP_LOCK_WRITE;
 
 
 1334#ifdef YATOMIC_BUILTIN 
 1335            return __sync_sub_and_fetch(&m_value,1);
 
 1337            YATOMIC_OP_LOCK_WRITE;
 
 
 1348#ifdef YATOMIC_BUILTIN 
 1349            return __sync_add_and_fetch(&m_value,val);
 
 1351            YATOMIC_OP_LOCK_WRITE;
 
 
 1363#ifdef YATOMIC_BUILTIN 
 1364            return __sync_sub_and_fetch(&m_value,val);
 
 1366            YATOMIC_OP_LOCK_WRITE;
 
 
 1378#ifdef YATOMIC_BUILTIN 
 1379            return __sync_and_and_fetch(&m_value,val);
 
 1381            YATOMIC_OP_LOCK_WRITE;
 
 
 1393#ifdef YATOMIC_BUILTIN 
 1394            return __sync_or_and_fetch(&m_value,val);
 
 1396            YATOMIC_OP_LOCK_WRITE;
 
 
 1408#ifdef YATOMIC_BUILTIN 
 1409            return __sync_xor_and_fetch(&m_value,val);
 
 1411            YATOMIC_OP_LOCK_WRITE;
 
 
 1422#ifdef YATOMIC_BUILTIN 
 1423            return __sync_fetch_and_add(&m_value,1);
 
 1425            YATOMIC_OP_LOCK_WRITE;
 
 1426            int old = m_value++;
 
 
 1436#ifdef YATOMIC_BUILTIN 
 1437            return __sync_fetch_and_sub(&m_value,1);
 
 1439            YATOMIC_OP_LOCK_WRITE;
 
 1440            int old = m_value--;
 
 
 1451#ifdef YATOMIC_BUILTIN 
 1452            return __sync_fetch_and_add(&m_value,val);
 
 1454            YATOMIC_OP_LOCK_WRITE;
 
 
 1467#ifdef YATOMIC_BUILTIN 
 1468            return __sync_fetch_and_sub(&m_value,val);
 
 1470            YATOMIC_OP_LOCK_WRITE;
 
 
 1483#ifdef YATOMIC_BUILTIN 
 1484            return __sync_fetch_and_and(&m_value,val);
 
 1486            YATOMIC_OP_LOCK_WRITE;
 
 
 1499#ifdef YATOMIC_BUILTIN 
 1500            return __sync_fetch_and_or(&m_value,val);
 
 1502            YATOMIC_OP_LOCK_WRITE;
 
 
 1515#ifdef YATOMIC_BUILTIN 
 1516            return __sync_fetch_and_xor(&m_value,val);
 
 1518            YATOMIC_OP_LOCK_WRITE;
 
 
 1529    inline operator Type()
 
 1530        { 
return valueAtomic(); }
 
 
 1536    inline operator Type()
 const 
 1537        { 
return valueAtomic(); }
 
 
 1544        { set(val); 
return *
this; }
 
 
 1551        { set((Type)val); 
return *
this; }
 
 
 1558        { 
return add(val); }
 
 
 1576        { 
return preInc(); }
 
 
 1582        { 
return preDec(); }
 
 
 1589        { 
return sub(val); }
 
 
 1596        { 
return bitAnd(val); }
 
 
 1603        { 
return bitOr(val); }
 
 
 1610        { 
return bitXor(val); }
 
 
 1613    mutable Type m_value;
 
 
 1681        { 
return obj ? obj->
getObject(name) : 0; }
 
 
 1688        { 
return s_counting; }
 
 
 1695        { s_counting = enable; }
 
 
 1702        { 
return m_counter; }
 
 
 1727    static bool s_counting;
 
 
 1744template <
class Obj> 
void destruct(Obj*& obj)
 
 1745    { 
if (obj) { obj->destruct(); obj = 0; } }
 
 1802        { 
return m_refcount; }
 
 
 1816        { 
return obj && (obj->
refcount() > 0); }
 
 
 
 1891        { 
return static_cast<Obj*
>(m_pointer); }
 
 
 1932        { assign(value.
pointer()); 
return *
this; }
 
 
 1938        { assign(
object); 
return *
this; }
 
 
 1944    inline operator Obj*() 
const 
 1945        { 
return pointer(); }
 
 
 1951        { 
return pointer(); }
 
 
 1957        { 
return *pointer(); }
 
 
 
 1999        { m_pointer = value; 
return *
this; }
 
 
 2005        { m_pointer = object; 
return *
this; }
 
 
 2011    inline operator Obj*() 
const 
 2012        { 
return m_pointer; }
 
 
 2018        { 
return m_pointer; }
 
 
 2024        { 
return *m_pointer; }
 
 
 
 2124        { 
return at(index); }
 
 
 2132        { 
return at(index); }
 
 
 2141            return o ? o->
get() : 0;
 
 
 2158            return o ? o->
get() : 0;
 
 
 2244        { 
return m_delete; }
 
 
 2251        { m_delete = autodelete; }
 
 
 2285        long maxwait = -1, 
bool compact = 
true);
 
 2297        long maxwait = -1, 
bool compact = 
true);
 
 2309        long maxwait = -1, 
bool compact = 
true);
 
 
 2411    inline explicit ObjVector(
bool autodelete = 
true, 
unsigned int allocChunk = 0)
 
 2412        : m_length(0), m_objects(0), m_delete(autodelete), m_size(0), m_allocChunk(allocChunk)
 
 
 2421    ObjVector(
unsigned int maxLen, 
bool autodelete = 
true, 
unsigned int allocChunk = 0);
 
 2432        unsigned int allocChunk = 0);
 
 2451        { 
return m_length; }
 
 
 2458        { 
return m_objects; }
 
 
 2467        { 
return (offs + len <= m_length) ? m_objects + offs : 0; }
 
 
 2474        { 
return (
const GenObject**)m_objects; }
 
 
 2483        { 
return (offs + len <= m_length) ? (
const GenObject**)m_objects + offs : 0; }
 
 
 2503        { 
return index < m_length ? m_objects[index] : 0; }
 
 
 2520    unsigned int insert(
unsigned int pos, 
unsigned int items);
 
 2529    unsigned int cut(
unsigned int pos, 
unsigned int items, 
bool reAlloc = 
true);
 
 2537    inline unsigned int cut(
int items, 
bool reAlloc = 
true) {
 
 2541                return cut(0,-items,reAlloc);
 
 2542            if ((
unsigned int)items < m_length)
 
 2543                return cut(m_length - items,items,reAlloc);
 
 2544            return cut(0,m_length,reAlloc);
 
 
 2555    inline unsigned int resize(
unsigned int len, 
bool keepData = 
false, 
bool reAlloc = 
true) {
 
 2562            return (len == length()) ? length(): (len > length() ?
 
 2563                insert(length(),len - length()) : cut(len,length() - len,reAlloc));
 
 
 2571    inline unsigned int compact(
bool resizeToCount = 
false) {
 
 2572            unsigned int n = compact(0,m_length);
 
 
 2594                m_objects[index] = 0;
 
 
 2612            unsigned int idx = length();
 
 2613            return idx < resize(length() + 1,
true) && (!obj || set(obj,idx));
 
 
 2625            int idx = indexFree(fromStart,beforeNonNull);
 
 2627                return appendObj(obj);
 
 
 2639            if (pos >= length())
 
 2640                return appendObj(obj);
 
 2641            unsigned int n = length();
 
 2642            return (n < insert(pos,1)) && set(obj,pos);
 
 
 2666    int indexFree(
bool fromStart, 
bool beforeNonNull = 
false) 
const;
 
 2682        { 
return idx < 0 ? 0 : at(idx); }
 
 
 2690            int idx = index(str);
 
 2691            return idx >= 0 ? m_objects[idx] : 0;
 
 
 2704    void reset(
unsigned int pos = 0, 
int len = -1);
 
 2711        { 
return m_delete; }
 
 
 2718        { m_delete = autodelete; }
 
 
 2725        { 
return m_allocChunk; }
 
 
 2732        { m_allocChunk = count; }
 
 
 2744    inline unsigned int allocLen(
unsigned int len) {
 
 2745            if (!len || m_allocChunk < 2)
 
 2748            unsigned int rest = len % m_allocChunk;
 
 2750                len += m_allocChunk - rest;
 
 2751            return m_length <= len && len <= m_size ? 0 : len;
 
 2754    unsigned int m_length;
 
 2757    unsigned int m_size;
 
 2758    unsigned int m_allocChunk;
 
 
 2777    explicit Array(
int columns = 0, 
int rows = 0);
 
 2858        { 
return m_columns; }
 
 
 2868            if (column >= 0 || column < m_columns)
 
 2869                return static_cast<ObjList*
>(m_obj[column]);
 
 
 
 2880class StringMatchPrivate;
 
 2898    inline explicit UChar(uint32_t code = 0)
 
 
 2907        : m_chr((code < 0) ? 0 : code)
 
 
 2915        : m_chr((unsigned char)code)
 
 
 2922    inline explicit UChar(
unsigned char code)
 
 
 2932        { m_chr = code; encode(); 
return *
this; }
 
 
 2940        { m_chr = (
unsigned char)code; encode(); 
return *
this; }
 
 
 2960    inline operator const char*() 
const 
 
 2970    bool decode(
const char*& str, uint32_t maxChar = 0x10ffff, 
bool overlong = 
false);
 
 2980    bool decode(uint16_t*& buff, 
unsigned int& len, Endianness order, uint32_t maxChar = 0x10ffff);
 
 2998    bool encode(uint16_t*& buff, 
unsigned int& len, Endianness order);
 
 3018    static bool decode(
String& out, uint16_t*& buff, 
unsigned int& len, Endianness order, 
bool checkBOM = 
false, uint32_t maxChar = 0x10ffff);
 
 3028    static bool encode(
DataBlock& out, 
const char*& str, Endianness order, 
bool addBOM = 
false);
 
 3039    static bool encode(uint16_t*& buff, 
unsigned int& len, 
const char*& str, Endianness order, 
bool addBOM = 
false);
 
 
 3080    explicit String(
char value, 
unsigned int repeat = 1);
 
 3154        { 
return value ? 
"true" : 
"false"; }
 
 
 3161        { 
return m_string; }
 
 
 3168        { 
return m_string ? m_string : 
""; }
 
 
 3175    inline const char* 
safe(
const char* defStr)
 const 
 3176        { 
return m_string ? m_string : (defStr ? defStr : 
""); }
 
 
 3183        { 
return m_length; }
 
 
 3190        { 
return !m_string; }
 
 
 3199    static int lenUtf8(
const char* value, uint32_t maxChar = 0x10ffff, 
bool overlong = 
false);
 
 3207    inline int lenUtf8(uint32_t maxChar = 0x10ffff, 
bool overlong = 
false)
 const 
 3208        { 
return lenUtf8(m_string,maxChar,overlong); }
 
 
 3217    int fixUtf8(
const char* replace = 0, uint32_t maxChar = 0x10ffff, 
bool overlong = 
false);
 
 3257        { 
return str && (str[0] == 
'\357') && (str[1] == 
'\273') && (str[2] == 
'\277'); }
 
 
 3264        { 
return checkBOM(c_str()); }
 
 
 3272        { 
return checkBOM(str) && (str += 3); }
 
 
 3280        { 
return checkBOM(str) && (str += 3); }
 
 
 3287        { 
return checkBOM(c_str()) && &(*
this = c_str() + 3); }
 
 
 3295            if (m_hash == YSTRING_INIT_HASH)
 
 3296                m_hash = hash(m_string);
 
 
 3306    static unsigned int hash(
const char* value, 
unsigned int h = 0);
 
 3318    char at(
int index) 
const;
 
 3355    int toInteger(
int defvalue = 0, 
int base = 0, 
int minvalue = INT_MIN,
 
 3356        int maxvalue = INT_MAX, 
bool clamp = 
true) 
const;
 
 3386    long int toLong(
long int defvalue = 0, 
int base = 0, 
long int minvalue = LONG_MIN,
 
 3387        long int maxvalue = LONG_MAX, 
bool clamp = 
true) 
const;
 
 3399    int64_t 
toInt64(int64_t defvalue = 0, 
int base = 0, int64_t minvalue = LLONG_MIN,
 
 3400        int64_t maxvalue = LLONG_MAX, 
bool clamp = 
true) 
const;
 
 3430    uint64_t 
toUInt64(uint64_t defvalue = 0, 
int base = 0, uint64_t minvalue = 0,
 
 3431        uint64_t maxvalue = ULLONG_MAX, 
bool clamp = 
true) 
const;
 
 3471        { 
return at(index); }
 
 
 3479        { 
return at(index); }
 
 
 3485    inline operator const char*() 
const 
 3486        { 
return m_string; };
 
 
 3512    String& 
hexify(
const void* data, 
unsigned int len, 
char sep = 0, 
bool upCase = 
false);
 
 3519        { 
return operator=(value.
c_str()); }
 
 
 3527        { 
return operator=(value ? value->
c_str() : 
""); }
 
 
 3571        { 
return operator=(boolText(value)); }
 
 
 3585        { 
return append(value,-1); }
 
 
 3622        { 
return operator+=(boolText(value)); }
 
 
 3644        { 
return (
this == &value) || ((hash() == value.
hash()) && 
operator==(value.
c_str())); }
 
 
 3650        { 
return (
this != &value) && ((hash() != value.
hash()) || 
operator!=(value.
c_str())); }
 
 
 3666        { 
return operator+=(value); }
 
 
 3672        { 
return operator+=(value); }
 
 
 3678        { 
return operator+=(value); }
 
 
 3684        { 
return operator+=(value); }
 
 
 3690        { 
return operator+=(value); }
 
 
 3696        { 
return operator+=(value); }
 
 
 3702        { 
return operator+=(value); }
 
 
 3708        { 
return operator+=(value); }
 
 
 3755    String& 
append(
const char* value, 
const char* separator = 0, 
bool force = 
false);
 
 3772        { 
return append(&list,separator,force); }
 
 
 3781        { 
return insert(length(),value,len); }
 
 
 3820    String& printf(
unsigned int length, const 
char* format,  ...) FORMAT_CHECK(3);
 
 3827    String& printfAppend(const 
char* format, ...) FORMAT_CHECK(2);
 
 3834    String& printfAppend(
unsigned int length, const 
char* format,  ...) FORMAT_CHECK(3);
 
 3844    String& appendFixed(
unsigned int fixedLength, const 
char* str, 
unsigned int len = -1, 
char fill = ' ', 
int align = Left);
 
 3853    inline 
String& appendFixed(
unsigned int fixedLength, const 
String& str, 
char fill = ' ', 
int align = Left)
 
 3854        { 
return appendFixed(fixedLength,str.c_str(),str.length(),fill,align); }
 
 
 3862    int find(
char what, 
unsigned int offs = 0) 
const;
 
 3870    int find(
const char* what, 
unsigned int offs = 0) 
const;
 
 3893    bool startsWith(
const char* what, 
bool wordBreak = 
false, 
bool caseInsensitive = 
false) 
const;
 
 3902    bool endsWith(
const char* what, 
bool wordBreak = 
false, 
bool caseInsensitive = 
false) 
const;
 
 3915    bool startSkip(
const char* what, 
bool wordBreak = 
true, 
bool caseInsensitive = 
false);
 
 3933        int wLen = -1, 
int rLen = -1, 
bool* chg = 0);
 
 3944        { 
return replaceChars(what,0,
false,wLen,-1,chg); }
 
 
 3995        { 
return operator==(value); }
 
 
 4024        { 
return substr(matchOffset(index),matchLength(index)); }
 
 
 4065            split(*lst,separator,emptyOK);
 
 
 4077            split(*lst,reg,emptyOK);
 
 
 4095        { 
return msgEscape(c_str(),extraEsc); }
 
 
 4113        { 
return msgUnescape(c_str(),errptr,extraEsc); }
 
 
 4129        { 
return sqlEscape(c_str(),extraEsc); }
 
 
 4140        const char* noEsc = 0);
 
 4151        const char* noEsc = 0);
 
 4161        { 
return uriEscapeTo(buf,c_str(),extraEsc,noEsc); }
 
 
 4170    static inline String uriEscape(
const char* str, 
char extraEsc = 0, 
const char* noEsc = 0) {
 
 4172            return uriEscapeTo(tmp,str,extraEsc,noEsc);
 
 
 4182    static inline String uriEscape(
const char* str, 
const char* extraEsc, 
const char* noEsc = 0) {
 
 4184            return uriEscapeTo(tmp,str,extraEsc,noEsc);
 
 
 4194        { 
return uriEscape(c_str(),extraEsc,noEsc); }
 
 
 4216        { 
return uriUnescapeTo(buf,c_str(),setPartial,errptr); }
 
 
 4225        { 
return uriUnescapeTo(*
this,c_str(),setPartial,errptr); }
 
 
 4236            return uriUnescapeTo(tmp,str,setPartial,errptr);
 
 
 4246        { 
return uriUnescape(c_str(),errptr,setPartial); }
 
 
 4265    static unsigned int c_starts_with(
const char* str, 
const char* what, 
int lenStr = -1,
 
 4266        int lenWhat = -1, 
bool caseInsensitive = 
false);
 
 4277    static unsigned int c_ends_with(
const char* str, 
const char* what, 
int lenStr = -1,
 
 4278        int lenWhat = -1, 
bool caseInsensitive = 
false);
 
 4289    static inline unsigned int c_skip(
const char*& str, 
const char* what, 
int lenStr = -1,
 
 4290        int lenWhat = -1, 
bool caseInsensitive = 
false) {
 
 4291            unsigned int n = c_starts_with(str,what,lenStr,lenWhat,caseInsensitive);
 
 
 4305        int len = -1, 
bool skipFound = 
true);
 
 4326        bool inPlace = 
false, 
int wLen = -1, 
int rLen = -1, 
bool* chg = 0);
 
 4335    String& changeStringData(
char* data, 
unsigned int len);
 
 4336    void clearMatches();
 
 4338    unsigned int m_length;
 
 4340    mutable unsigned int m_hash;
 
 4341    StringMatchPrivate* m_matches;
 
 
 4361        : 
String(name), m_pointer(gen), m_owned(owned)
 
 
 4375        { 
return m_pointer; }
 
 
 4393            if (m_pointer == gen)
 
 4398                TelEngine::destruct(tmp);
 
 
 4407        { set(gen); 
return *
this; }
 
 
 4414        { 
return m_pointer; }
 
 
 4420        { 
return m_pointer; }
 
 
 4426        { 
return *m_pointer; }
 
 
 
 4450        : m_data(0), m_length(0), m_size(0), m_overAlloc(overAlloc), m_name(name)
 
 
 4460    inline GenericVector(
const Obj* items, 
unsigned int count, 
unsigned int overAlloc = 0,
 
 4461        const char* name = 0)
 
 4462        : m_data(0), m_length(0), m_size(0), m_overAlloc(overAlloc), m_name(name)
 
 4463        { assign(count,items); }
 
 
 4472        const char* name = 0)
 
 4473        : m_data(0), m_length(0), m_size(0), m_overAlloc(overAlloc), m_name(name)
 
 
 4481        : m_data(0), m_length(0), m_size(0), m_overAlloc(other.overAlloc()),
 
 4482        m_name(other.name())
 
 
 4496        { 
return m_length; }
 
 
 4510        { 
return m_overAlloc; }
 
 
 4517        { m_overAlloc = count; }
 
 
 4532    inline Obj* 
data(
unsigned int offs = 0, 
unsigned int count = 0)
 
 4533        { 
return dataAvail(offs,count); }
 
 
 4541    inline const Obj* 
data(
unsigned int offs = 0, 
unsigned int count = 0)
 const 
 4542        { 
return dataAvail(offs,count); }
 
 
 4563        { 
return length() ? m_data + length() - 1 : 0; }
 
 
 4570        { 
return length() ? m_data + length() - 1 : 0; }
 
 
 4580    inline int indexOf(
const String& name, 
unsigned int offs = 0, Obj** found = 0)
 const {
 
 4581            const Obj* d = data(offs);
 
 4582            for (; offs < length(); ++offs, ++d)
 
 
 4598    inline Obj* 
find(
const String& name, 
unsigned int offs = 0)
 const {
 
 4600            indexOf(name,offs,&d);
 
 
 4612    inline int indexOfValue(
const Obj& val, 
unsigned int offs = 0, Obj** found = 0)
 const {
 
 4613            for (
const Obj* d = data(offs); offs < length(); ++offs, ++d)
 
 
 4629    inline Obj* 
findValue(
const Obj& val, 
unsigned int offs = 0)
 const {
 
 4631            indexOfValue(val,offs,&d);
 
 
 4643            m_length = m_size = 0;
 
 
 4653    inline bool assign(
unsigned int len, 
const Obj* items = 0, 
unsigned int count = 0) {
 
 4656            unsigned int sz = len + m_overAlloc;
 
 4657            Obj* tmp = 
new Obj[sz];
 
 4659                Debug(
"YateVector",DebugFail,
"Failed to allocate %u item(s) bytes=%u",
 
 4660                    sz,(
unsigned int)(sz * 
sizeof(Obj)));
 
 4664                copy(tmp,items,!count ? len : (count <= len ? count : len));
 
 
 4683            if (!len || len == length())
 
 4686                return assign(len,m_data,length());
 
 4687            if (length() > len) {
 
 4688                if ((size() - len) > m_overAlloc)
 
 4689                    return assign(len,m_data,length());
 
 4690                fill(len,length() - len);
 
 
 4704            if (count < length())
 
 4705                return resize(length() - count);
 
 
 4717    inline unsigned int fill(
unsigned int offs = 0, 
int count = -1, 
const Obj* value = 0) {
 
 4720            unsigned int n = numItems(offs,count < 0 ? length() : (
unsigned int)count);
 
 4724                fillArray(*value,m_data + offs,n);
 
 4727                fillArray(item,m_data + offs,n);
 
 
 4739    inline unsigned int fillObj(
const Obj& value, 
unsigned int offs = 0, 
int count = -1)
 
 4740        { 
return fill(offs,count,&value); }
 
 
 4749    inline unsigned int fillObj(
const Obj* items, 
unsigned int count, 
unsigned int offs = 0) {
 
 4750            if (!(items && count))
 
 4752            unsigned int n = numItems(offs,count);
 
 4754                copy(m_data + offs,items,n);
 
 
 4764            if (!resize(length() + 1))
 
 4766            m_data[length() - 1] = item;
 
 
 4776    inline unsigned int append(
const Obj* items, 
unsigned int count) {
 
 4777            if (!(items && count && resize(length() + count)))
 
 4779            copy(m_data + length() - count,items,count);
 
 
 4789            unsigned int n = list.
count();
 
 4790            if (!(n && resize(length() + n)))
 
 4792            copy(m_data + length() - n,list);
 
 
 4802            unsigned int n = list.
count();
 
 4803            if (!(n && resize(n)))
 
 
 4814    inline Obj* 
set(
const Obj& item) {
 
 4815            int idx = indexOf(item);
 
 4817                return append(item);
 
 
 4857                unsigned int n = length();
 
 4859                fillObj(data(),n,n);
 
 
 4873    inline Obj* dataAvail(
unsigned int offs, 
unsigned int count)
 const {
 
 4874            if (offs >= length() || !m_data)
 
 4876            return (count <= (length() - offs)) ? (m_data + offs) : 0;
 
 4879    inline unsigned int numItems(
unsigned int offs, 
unsigned int count)
 const {
 
 4880            if (offs >= length())
 
 4882            offs = length() - offs;
 
 4883            return (count <= offs) ? count : offs;
 
 4885    static inline void fillArray(
const Obj& value, Obj* dest, 
unsigned int n)
 
 4886        { 
while (n) { *dest++ = value; --n; } }
 
 4887    static inline void copy(Obj* dest, 
const ObjList& src) {
 
 4889                *dest++ = *
static_cast<Obj*
>(o->get());
 
 4891    static inline void copy(Obj* dest, 
const Obj* src, 
unsigned int n)
 
 4892        { 
while (n) { *dest++ = *src++; --n; } }
 
 4895    unsigned int m_length;
 
 4896    unsigned int m_size;
 
 4897    unsigned int m_overAlloc;
 
 
 4908inline const char* c_str(
const String* str)
 
 4909    { 
return str ? str->
c_str() : (
const char*)0; }
 
 4916inline const char* c_safe(
const char* str)
 
 4917    { 
return str ? str : 
""; }
 
 4924inline const char* c_safe(
const String* str)
 
 4925    { 
return str ? str->
safe() : 
""; }
 
 4932inline bool null(
const char* str)
 
 4933    { 
return !(str && *str); }
 
 4940inline bool null(
const String* str)
 
 4941    { 
return !str || str->
null(); }
 
 4962inline const char *strcpy(
String& dest, 
const char* src)
 
 4963    { dest = src; 
return dest.
c_str(); }
 
 4969inline const char *strcat(
String& dest, 
const char* src)
 
 4970    { dest += src; 
return dest.
c_str(); }
 
 4980YATE_API 
int lookup(
const char* str, 
const TokenDict* tokens, 
int defvalue = 0, 
int base = 0);
 
 4988YATE_API 
const char* lookup(
int value, 
const TokenDict* tokens, 
const char* defvalue = 0);
 
 4998YATE_API int64_t lookup(
const char* str, 
const TokenDict64* tokens, int64_t defvalue = 0, 
int base = 0);
 
 5006YATE_API 
const char* lookup(int64_t value, 
const TokenDict64* tokens, 
const char* defvalue = 0);
 
 5049YATE_API 
int lookup(
const String& str, 
const TokenDictStr* tokens, 
int defvalue = 0, 
int base = 0);
 
 5067YATE_API int64_t lookup(
const String& str, 
const TokenDictStr64* tokens, int64_t defvalue = 0, 
int base = 0);
 
 5087YATE_API 
bool controlReturn(
NamedList* params, 
bool ret, 
const char* retVal = 0);
 
 5109    explicit Regexp(
const char* value, 
bool extended = 
false, 
bool insensitive = 
false);
 
 5133        { 
return m_regexp || (m_compile && doCompile()); }
 
 
 5183    bool matches(
const char* value, StringMatchPrivate* matchlist) 
const;
 
 5184    mutable void* m_regexp;
 
 5185    mutable bool m_compile;
 
 
 5200    inline explicit Atom(
const char* value)
 
 
 
 5228    friend class Engine;
 
 5237        : 
String(text), m_level(level)
 
 
 5245        : 
String(original), m_level(original.level())
 
 
 5261        { 
return s_capturing; }
 
 
 5268        { 
return s_events; }
 
 
 5275    inline static void append(
int level, 
const char* text)
 
 5276        { 
if (text && *text) s_events.append(
new CapturedEvent(level,text)); }
 
 
 5284        { 
return s_events; }
 
 
 5291        { s_capturing = capture; }
 
 
 5296    static bool s_capturing;
 
 
 5313    explicit NamedString(
const char* name, 
const char* value = 0, 
int len = -1);
 
 
 5397        { 
return m_data ? m_data->getObject(name) : 0; }
 
 
 
 5444        { 
return m_enabled; }
 
 
 5451        { m_enabled = val; }
 
 
 5458        { 
return m_count.inc(); }
 
 
 5465        { 
return m_count.dec(); }
 
 
 5473        { 
return m_count.add(val); }
 
 
 
 5536        { 
return (index < m_size) ? m_lists[index] : 0; }
 
 
 5544        { 
return getList(hash % m_size); }
 
 
 5552        { 
return getHashList(str.
hash()); }
 
 
 5617        return n ? n->
remove(delobj) : 0;
 
 
 5630        return n ? n->
remove(delobj) : 0;
 
 
 5654    unsigned int m_size;
 
 
 5694        { 
return m_length; }
 
 
 5742        { 
return m_current >= m_length; }
 
 
 5754    unsigned int* m_hashes;
 
 5755    unsigned int m_length;
 
 5756    unsigned int m_current;
 
 
 5785    inline explicit Time(
const struct timeval* tv)
 
 5786        : m_time(fromTimeval(tv))
 
 
 5793    inline explicit Time(
const struct timeval& tv)
 
 5794        : m_time(fromTimeval(tv))
 
 
 5809        { 
return (u_int32_t)((m_time+500000) / 1000000); }
 
 
 5816        { 
return (m_time+500) / 1000; }
 
 
 5828    inline operator u_int64_t()
 const 
 
 5835        { m_time = usec; 
return *
this; }
 
 
 5841        { m_time += delta; 
return *
this; }
 
 
 5847        { m_time -= delta; 
return *
this; }
 
 
 5854        { toTimeval(tv, m_time); }
 
 
 5876        { 
return fromTimeval(&tv); }
 
 
 5909    static unsigned int toEpoch(
int year, 
unsigned int month, 
unsigned int day,
 
 5910        unsigned int hour, 
unsigned int minute, 
unsigned int sec, 
int offset = 0);
 
 5924    static bool toDateTime(
unsigned int epochTimeSec, 
int& year, 
unsigned int& month,
 
 5925        unsigned int& day, 
unsigned int& hour, 
unsigned int& minute, 
unsigned int& sec,
 
 5926        unsigned int* wDay = 0);
 
 5935    static uint32_t 
toNtp(uint32_t sec, uint32_t* over = 0, 
bool rfc2030 = 
true);
 
 5943    inline uint32_t 
toNtp(uint32_t* over = 0, 
bool rfc2030 = 
true)
 
 5944        { 
return toNtp(sec(),over,rfc2030); }
 
 
 5954    static uint32_t 
fromNtp(uint32_t val, uint32_t* under = 0, 
bool rfc2030 = 
true);
 
 5967    static unsigned int toString(
char* buf, uint64_t time, 
int frac = 0);
 
 5982            unsigned int n = toString(tmp,time,frac);
 
 
 5997    static uint64_t 
toEpoch(
const char* buf, 
unsigned int len, 
int frac = 0);
 
 6005        { 
return (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)); }
 
 
 
 6038        { 
return m_random; }
 
 
 6044    inline void set(u_int32_t seed)
 
 6045        { m_random = seed; }
 
 
 
 6103    DataBlock(
void* value, 
unsigned int len, 
bool copyData = 
true, 
unsigned int overAlloc = 0);
 
 6128    inline unsigned char* 
data(
unsigned int offs, 
unsigned int len = 1)
 const 
 6129        { 
return (offs + len <= m_length) ? (
static_cast<unsigned char*
>(m_data) + offs) : 0; }
 
 
 6137    inline int at(
unsigned int offs, 
int defvalue = -1)
 const 
 6138        { 
return (offs < m_length) ? 
static_cast<unsigned char*
>(m_data)[offs] : defvalue; }
 
 
 6152        { 
return m_length; }
 
 
 6159        { 
return m_allocated; }
 
 
 6166        { 
return m_overAlloc; }
 
 
 6173        { m_overAlloc = bytes; }
 
 
 6188    DataBlock& 
assign(
void* value, 
unsigned int len, 
bool copyData = 
true, 
unsigned int allocated = 0);
 
 6200    bool change(
unsigned int pos, 
const void* buf, 
unsigned int bufLen,
 
 6201        unsigned int extra = 0, 
int extraVal = 0, 
bool mayOverlap = 
true);
 
 6211                return change(pos,0,0,8);
 
 6214            return change(pos,buf,8,0,0,
false);
 
 
 6225                return change(pos,0,0,4);
 
 6228            return change(pos,buf,4,0,0,
false);
 
 
 6239                return change(pos,0,0,3);
 
 6242            return change(pos,buf,3,0,0,
false);
 
 
 6254            return change(pos,buf,2,0,0,
false);
 
 
 6264    inline bool changeHton(
unsigned int pos, uint64_t value, uint8_t bytes) {
 
 6270                return change(pos,0,0,bytes);
 
 6272            hton(buf,value,bytes);
 
 6273            return change(pos,buf,bytes,0,0,
false);
 
 
 6283    inline bool changeLsb(
unsigned int pos, uint64_t value, uint8_t bytes = 8) {
 
 6285                return bytes ? change(pos,0,0,bytes <= 8 ? bytes : 8) : 
true;
 
 6288                lsbSet(buf,value,8);
 
 6289                return change(pos,buf,8,0,0,
false);
 
 6293            lsbSet(buf,value,bytes);
 
 6294            return change(pos,buf,bytes,0,0,
false);
 
 
 6303    inline void append(
const void* value, 
unsigned int len, 
bool mayOverlap = 
true) {
 
 6305                change(length(),value,len,0,0,mayOverlap);
 
 
 6315                change(length(),value.
data(),value.
length(),0,0,mayOverlap);
 
 
 6324                change(length(),value.
c_str(),value.
length(),0,0,
false);
 
 
 6333        { insertBytes(count,length(),val); }
 
 
 6340        { change8hton(length(),value); }
 
 
 6347        { change4hton(length(),value); }
 
 
 6354        { change3hton(length(),value); }
 
 
 6361        { change2hton(length(),value); }
 
 
 6369        { changeHton(length(),value,bytes); }
 
 
 6377        { changeLsb(length(),value,bytes); }
 
 
 6384        { append((
const void*)&value,1,
false); }
 
 
 6393    inline void insert(
const void* buf, 
unsigned int bufLen, 
unsigned int pos = 0,
 
 6394        bool mayOverlap = 
true)
 
 6395        { change(pos,buf,bufLen,0,0,mayOverlap); }
 
 
 6404        { insert(value.
data(),value.
length(),pos,mayOverlap); }
 
 
 6412    inline void insertBytes(
unsigned int count, 
unsigned int pos = 0, uint8_t val = 0) {
 
 6414                change(pos,0,0,count,val,
false);
 
 
 6423        { change8hton(pos,value); }
 
 
 6431        { change4hton(pos,value); }
 
 
 6439        { change3hton(pos,value); }
 
 
 6447        { change2hton(pos,value); }
 
 
 6455    inline void insertHton(uint64_t value, uint8_t bytes = 8, 
unsigned int pos = 0)
 
 6456        { changeHton(pos,value,bytes); }
 
 
 6464    inline void insertLsb(uint64_t value, uint8_t bytes = 8, 
unsigned int pos = 0)
 
 6465        { changeLsb(pos,value,bytes); }
 
 
 6472    inline void insert1(uint8_t value, 
unsigned int pos = 0)
 
 6473        { insert((
const void*)&value,1,pos,
false); }
 
 
 6483    void resize(
unsigned int len, 
bool keepData = 
false, 
bool reAlloc = 
true);
 
 6491    inline void truncate(
unsigned int len, 
bool reAlloc = 
true) {
 
 6494            else if (len < length())
 
 6495                cut(len,length() - len,reAlloc);
 
 
 6505    void cut(
unsigned int pos, 
unsigned int len, 
bool reAlloc = 
true);
 
 6514            else if ((
unsigned int)len < length())
 
 6515                cut(length() - len,len);
 
 
 6526        { 
return at(index); }
 
 
 6534        { 
return at(index); }
 
 
 6540        { assign(value.
data(),value.
length()); 
return *
this; }
 
 
 6546        { append(value); 
return *
this; }
 
 
 6552        { append(value); 
return *
this; }
 
 
 6563        const String& dFormat, 
unsigned maxlen = 0);
 
 6580    bool changeHex(
unsigned int pos, 
const char* data, 
unsigned int len, 
char sep = 0,
 
 6581        bool guessSep = 
true, 
bool emptyOk = 
true, 
int* res = 0);
 
 6597    inline bool changeHex(
unsigned int pos, 
const String& data, 
char sep = 0, 
bool guessSep = 
true,
 
 6598        bool emptyOk = 
true, 
int* res = 0)
 
 6599        { 
return changeHex(pos,data.
c_str(),data.
length(),sep,guessSep,emptyOk,res); }
 
 
 6615        bool emptyOk = 
true, 
int* res = 0)
 
 6616        { 
return changeHex(length(),data,sep,guessSep,emptyOk,res); }
 
 
 6628    inline bool unHexify(
const char* data, 
unsigned int len, 
char sep) {
 
 6630            return changeHex(length(),data,len,sep,
false);
 
 
 6642    inline bool unHexify(
const char* data, 
unsigned int len) {
 
 6644            return changeHex(length(),data,len);
 
 
 6664        { 
return sqlEscape(str,data(),length(),extraEsc); }
 
 
 6673            return sqlEscape(tmp,extraEsc);
 
 
 6697    static void moveData(
void* buf, 
unsigned int bufLen, 
unsigned int len,
 
 6698        unsigned int dPos, 
unsigned int sPos, 
int fill = -1);
 
 6712        unsigned int pos, 
unsigned int space, 
int fill = -1);
 
 6726        unsigned int pos, 
unsigned int space, 
int fillAfter = -1);
 
 6735            uint64_t val = ((uint64_t)*buf++) << 56;
 
 6736            val |= ((uint64_t)*buf++) << 48;
 
 6737            val |= ((uint64_t)*buf++) << 40;
 
 6738            val |= ((uint64_t)*buf++) << 32;
 
 6739            val |= ((uint64_t)*buf++) << 24;
 
 6740            val |= ((uint64_t)*buf++) << 16;
 
 6741            val |= ((uint64_t)*buf++) << 8;
 
 6742            val |= (uint64_t)*buf++;
 
 
 6753    static inline uint64_t 
ntoh8advance(
const uint8_t*& buf, 
unsigned int& len) {
 
 6755            return ntoh8advance(buf);
 
 
 6763    static inline uint64_t 
ntoh8(
const uint8_t* buf)
 
 6764        { 
return ntoh8advance(buf); }
 
 
 6772            *buf++ = (uint8_t)(val >> 56);
 
 6773            *buf++ = (uint8_t)(val >> 48);
 
 6774            *buf++ = (uint8_t)(val >> 40);
 
 6775            *buf++ = (uint8_t)(val >> 32);
 
 6776            *buf++ = (uint8_t)(val >> 24);
 
 6777            *buf++ = (uint8_t)(val >> 16);
 
 6778            *buf++ = (uint8_t)(val >> 8);
 
 6779            *buf++ = (uint8_t)val;
 
 
 6789    static inline void hton8advance(uint8_t*& buf, uint64_t val, 
unsigned int& len) {
 
 6791            hton8advance(buf,val);
 
 
 6799    static inline void hton8(uint8_t* buf, uint64_t val)
 
 6800        { 
return hton8advance(buf,val); }
 
 
 6809            uint32_t val = (uint32_t)(*buf++) << 24;
 
 6810            val |= (uint32_t)(*buf++) << 16;
 
 6811            val |= (uint32_t)(*buf++) << 8;
 
 6812            val |= (uint32_t)(*buf++);
 
 
 6823    static inline uint32_t 
ntoh4advance(
const uint8_t*& buf, 
unsigned int& len) {
 
 6825            return ntoh4advance(buf);
 
 
 6833    static inline uint32_t 
ntoh4(
const uint8_t* buf)
 
 6834        { 
return ntoh4advance(buf); }
 
 
 6843            *buf++ = (uint8_t)(val >> 24);
 
 6844            *buf++ = (uint8_t)(val >> 16);
 
 6845            *buf++ = (uint8_t)(val >> 8);
 
 6846            *buf++ = (uint8_t)val;
 
 
 6856    static inline void hton4advance(uint8_t*& buf, uint32_t val, 
unsigned int& len) {
 
 6858            hton4advance(buf,val);
 
 
 6866    static inline void hton4(uint8_t* buf, uint32_t val)
 
 6867        { hton4advance(buf,val); }
 
 
 6876            uint32_t val = (uint32_t)(*buf++) << 16;
 
 6877            val |= (uint32_t)(*buf++) << 8;
 
 6878            val |= (uint32_t)(*buf++);
 
 
 6889    static inline uint32_t 
ntoh3advance(
const uint8_t*& buf, 
unsigned int& len) {
 
 6891            return ntoh3advance(buf);
 
 
 6899    static inline uint32_t 
ntoh3(
const uint8_t* buf)
 
 6900        { 
return ntoh3advance(buf); }
 
 
 6909            *buf++ = (uint8_t)(val >> 16);
 
 6910            *buf++ = (uint8_t)(val >> 8);
 
 6911            *buf++ = (uint8_t)val;
 
 
 6921    static inline void hton3advance(uint8_t*& buf, uint32_t val, 
unsigned int& len) {
 
 6923            hton3advance(buf,val);
 
 
 6931    static inline void hton3(uint8_t* buf, uint32_t val)
 
 6932        { hton3advance(buf,val); }
 
 
 6941            uint16_t val = (uint16_t)(*buf++) << 8;
 
 6942            val |= (uint16_t)(*buf++);
 
 
 6953    static inline uint16_t 
ntoh2advance(
const uint8_t*& buf, 
unsigned int& len) {
 
 6955            return ntoh2advance(buf);
 
 
 6963    static inline uint16_t 
ntoh2(
const uint8_t* buf)
 
 6964        { 
return ntoh2advance(buf); }
 
 
 6973            *buf++ = (uint8_t)(val >> 8);
 
 6974            *buf++ = (uint8_t)val;
 
 
 6984    static inline void hton2advance(uint8_t*& buf, uint16_t val, 
unsigned int& len) {
 
 6986            hton2advance(buf,val);
 
 
 6994    static inline void hton2(uint8_t* buf, uint16_t val)
 
 6995        { hton2advance(buf,val); }
 
 
 7004    static inline uint64_t 
ntohAdvance(
const uint8_t*& buf, uint8_t bytes) {
 
 7006                return ntoh8advance(buf);
 
 7008            for (
int n = 8 * ((
int)bytes - 1); n >= 0; n -= 8)
 
 7009                val |= ((uint64_t)*buf++) << n;
 
 
 7021    static inline uint64_t 
ntohAdvance(
const uint8_t*& buf, 
unsigned int& len, uint8_t bytes) {
 
 7025            return ntohAdvance(buf,bytes);
 
 
 7034    static inline uint64_t 
ntoh(
const uint8_t* buf, uint8_t bytes)
 
 7035        { 
return ntohAdvance(buf,bytes); }
 
 
 7044    static inline void htonAdvance(uint8_t*& buf, uint64_t val, uint8_t bytes) {
 
 7046                return hton8advance(buf,val);
 
 7047            for (
int n = 8 * ((
int)bytes - 1); n >= 0; n -= 8)
 
 7048                *buf++ = (uint8_t)(val >> n);
 
 
 7059    static inline void htonAdvance(uint8_t*& buf, uint64_t val, 
unsigned int& len, uint8_t bytes) {
 
 7063            htonAdvance(buf,val,bytes);
 
 
 7072    static inline void hton(uint8_t* buf, uint64_t val, uint8_t bytes)
 
 7073        { 
return htonAdvance(buf,val,bytes); }
 
 
 7082    static inline uint64_t 
lsbAdvance(
const uint8_t*& buf, uint8_t bytes) {
 
 7086            for (uint8_t i = 0; i < bytes; ++i)
 
 7087                val |= ((uint64_t)*buf++) << (i * 8);
 
 
 7099    static inline uint64_t 
lsbAdvance(
const uint8_t*& buf, 
unsigned int& len, uint8_t bytes) {
 
 7103            return lsbAdvance(buf,bytes);
 
 
 7112    static inline uint64_t 
lsb(
const uint8_t* buf, uint8_t bytes)
 
 7113        { 
return lsbAdvance(buf,bytes); }
 
 
 7125            for (uint8_t i = 0; i < bytes; ++i)
 
 7126                *buf++ = (uint8_t)(val >> (i * 8));
 
 
 7137    static inline void lsbSetAdvance(uint8_t*& buf, uint64_t val, 
unsigned int& len, uint8_t bytes) {
 
 7141            lsbSetAdvance(buf,val,bytes);
 
 
 7150    static inline void lsbSet(uint8_t* buf, uint64_t val, uint8_t bytes)
 
 7151        { 
return lsbSetAdvance(buf,val,bytes); }
 
 
 7154    inline unsigned int allocLen(
unsigned int len)
 const {
 
 7156            unsigned int over = (8 - (len & 7)) & 7;
 
 7157            if (over < m_overAlloc)
 
 7158                return (len + m_overAlloc + 7) & ~7;
 
 7163    unsigned int m_length;
 
 7164    unsigned int m_allocated;
 
 7165    unsigned int m_overAlloc;
 
 
 7204        { finalize(); 
return m_hex; }
 
 
 7212    inline bool update(
const void* buf, 
unsigned int len)
 
 7213        { 
return updateInternal(buf,len); }
 
 
 7221        { 
return updateInternal(data.
data(), data.
length()); }
 
 
 7229        { 
return updateInternal(str.
c_str(), str.
length()); }
 
 
 7236        { update(value); 
return *
this; }
 
 
 7243        { update(data); 
return *
this; }
 
 
 7267        { 
return hmacStart(opad,key.
data(),key.
length()); }
 
 
 7276        { 
return hmacStart(opad,key.
c_str(),key.
length()); }
 
 
 7293    bool hmac(
const void* key, 
unsigned int keyLen, 
const void* msg, 
unsigned int msgLen);
 
 
 7368    MD5(
const void* buf, 
unsigned int len);
 
 7429    unsigned char m_bin[16];
 
 
 7455    SHA1(
const void* buf, 
unsigned int len);
 
 7526    unsigned char m_bin[20];
 
 
 7613    unsigned char m_bin[32];
 
 
 7636    inline Base64(
void* src, 
unsigned int len, 
bool copyData = 
true)
 
 
 7649    void encode(
String& dest, 
unsigned int lineLen = 0, 
bool lineAtEnd = 
false);
 
 7668        { append(value); 
return *
this; }
 
 
 7674        { append(data); 
return *
this; }
 
 
 7680        { 
return operator<<(
String(value)); }
 
 
 
 7697        DumpAddSeparator = 0x0001,       
 
 7698        DumpForcePrefix = 0x0001,        
 
 7700        DumpQuoteName = 0x0004,          
 
 7701        DumpEmptyName = 0x0008,          
 
 7702        DumpQuoteParamName = 0x0010,     
 
 7703        DumpDontQuoteParamValue = 0x0020,
 
 
 7745        { 
return m_params.length(); }
 
 
 7752        { 
return m_params.count(); }
 
 
 7758        { m_params.clear(); }
 
 
 7784            *
static_cast<String*
>(ns) = value;
 
 7785            return addParam(ns);
 
 
 7796            *
static_cast<String*
>(ns) = value;
 
 7797            return addParam(ns);
 
 
 7808            *
static_cast<String*
>(ns) = value;
 
 7809            return addParam(ns);
 
 
 7820            *
static_cast<String*
>(ns) = value;
 
 7821            return addParam(ns);
 
 
 7832            *
static_cast<String*
>(ns) = value;
 
 7833            return addParam(ns);
 
 
 7854        bool unknownflag = 
true) {
 
 7857            return addParam(ns);
 
 
 7869        bool unknownflag = 
true) {
 
 7872            return addParam(ns);
 
 
 7884        unsigned int len, 
char sep = 0) {
 
 7887                ns->
hexify((
void*)buf,len,sep);
 
 7888            return addParam(ns);
 
 
 7964        bool unknownflag = 
true);
 
 7975        bool unknownflag = 
true);
 
 8028        { 
return copyParams(
true,original); }
 
 
 8057        bool skipPrefix = 
true, 
bool replace = 
false);
 
 8120        int maxvalue = INT_MAX, 
bool clamp = 
true) 
const;
 
 8152        int64_t maxvalue = LLONG_MAX, 
bool clamp = 
true) 
const;
 
 8183        uint64_t maxvalue = ULLONG_MAX, 
bool clamp = 
true) 
const;
 
 8218    void dump(
String& str, 
const char* separator, 
char quote = 0, 
bool force = 
false) 
const;
 
 8230    bool dump(
String& str, 
unsigned int flags, 
const char* separator,
 
 8231        const char* nameSep = 0, 
const char* prefix = 0, 
char quote = 0) 
const;
 
 8244        { 
return &m_params; }
 
 
 8251        { 
return &m_params; }
 
 
 
 8271        : m_list(&list), m_item(list.m_params.skipNull())
 
 
 8279        : m_list(original.m_list), m_item(original.m_item)
 
 
 8287        { m_list = &list; m_item = list.m_params.
skipNull(); 
return *
this; }
 
 
 8294        { m_list = original.m_list; m_item = original.m_item; 
return *
this; }
 
 
 8312        { m_item = m_list->m_params.skipNull(); }
 
 
 
 8349    explicit URI(
const char* uri);
 
 8359    URI(
const char* proto, 
const char* user, 
const char* host, 
int port = 0, 
const char* desc = 0);
 
 8392        { parse(); 
return m_desc; }
 
 
 8399        { parse(); 
return m_proto; }
 
 
 8406        { parse(); 
return m_user; }
 
 
 8413        { parse(); 
return m_host; }
 
 
 8420        { parse(); 
return m_port; }
 
 
 8427        { parse(); 
return m_extra; }
 
 
 8448    mutable bool m_parsed;
 
 
 8496        NoInitialListDesc = 0x00000001,  
 
 8497        DumpXmlStr        = 0x00000002,  
 
 
 8506        : 
String(name), m_flags(0), m_rexEnclose(
'/'), m_strEnclose(
'\''),
 
 8507        m_nameValueSep(
": "), m_negated(
'!'), m_caseInsentive(
'i'),
 
 8508        m_regexpBasic(0), m_regexpExtended(0)
 
 
 8531        unsigned int depth = 0) 
const;
 
 8544        unsigned int depth = 0) 
const;
 
 8567            return tmp.
dump(mi,buf,indent,origIndent);
 
 
 8581    unsigned int m_flags;                
 
 8586    char m_caseInsentive;                
 
 8588    char m_regexpExtended;               
 
 
 8603        RexBasic           = 0x00000001, 
 
 8604        RexDetect          = 0x00000002, 
 
 8606        RexDetectNegated   = 0x00000004, 
 
 8608        RexValidate        = 0x00000008, 
 
 8609        NameReqSimple      = 0x00000010, 
 
 8611        IgnoreFailed       = 0x00000020, 
 
 8612        ListAny            = 0x00000040, 
 
 8614        PrivateFlag        = 0x100000000,
 
 8615        DefaultFlags = RexDetect | RexDetectNegated | NameReqSimple,
 
 
 8622        ItemNegated         = 0x00000001,
 
 8623        ItemCaseInsensitive = 0x00000002,
 
 8624        ItemBasic           = 0x00000004,
 
 8625        ItemAny             = 0x00000008,
 
 8626        ItemPrivateFlag     = 0x00010000,
 
 
 8635        : 
String(name), m_flags(flags), m_ignore(0), m_allow(0), m_dbg(0)
 
 
 8648        const char* prefix = 0, 
const char* suffix = 0) 
const;
 
 8684    inline bool flagSet(uint64_t mask)
 const 
 8685        { 
return 0 != (m_flags & mask); }
 
 8686    inline int emptyNameAllow(
String* error)
 const {
 
 8687            if (!flagSet(NameReqSimple))
 
 8689            if (flagSet(IgnoreFailed))
 
 8692                error->
printf(
"empty parameter match name");
 
 8695    inline bool ignore(
const String& name)
 const 
 8696        { 
return (m_ignore && m_ignore->
find(name)) || (m_allow && !m_allow->
find(name)); }
 
 
 8715        : m_name(name), m_notNegated(!negated)
 
 
 8730        { 
return !m_notNegated; }
 
 
 8739        { 
return m_notNegated == runMatchString(str,params); }
 
 
 8748        { 
return m_notNegated == runMatchListParam(list,params); }
 
 
 8766        { 
return runMatchString(list[name()]); }
 
 
 8821        unsigned int depth = 0)
 const 
 
 8835        unsigned int depth = 0)
 const 
 
 
 8876        bool negated = 
false)
 
 8877        : 
MatchingItemBase(name,negated), m_value(value), m_caseMatch(!caseInsensitive)
 
 
 8892        { 
return !m_caseMatch; }
 
 
 8901        { 
return m_caseMatch ? (str == m_value) : (str &= m_value); }
 
 
 
 8966        { 
return m_value.matches(str); }
 
 
 8995        bool insensitive = 
false, 
bool extended = 
false, 
int fail = 1);
 
 
 9023        const char* name = 0)
 
 9027            else if (m_maxVal < 2) 
 
 9028                m_value = m_maxVal = 100;
 
 
 9043        { 
return m_maxVal; }
 
 
 9059        { 
return randomMatch(); }
 
 
 9068        { 
return (!name() || list.
getParam(name())) ? randomMatch() : 
false; }
 
 
 
 9113        { 
return m_matchAll; }
 
 
 9120        { 
return m_value.length(); }
 
 
 9127        { 
return m_value.count(); }
 
 
 9143        { 
return m_value.index(name); }
 
 
 9151            int idx = indexOf(name);
 
 9152            return idx >= 0 ? at(idx) : 0;
 
 
 9175        { 
return change(item,-1,
false,overAlloc); }
 
 
 9185            unsigned int count = first->
count();
 
 9187            while (0 != (first = first->
skipNull()))
 
 
 9201        { 
return change(item,pos,
false,overAlloc); }
 
 
 9212        { 
return change(item,pos,
true,overAlloc); }
 
 
 
 9311    virtual bool lock(
long maxwait = -1) = 0;
 
 9367    static void wait(
unsigned long maxwait);
 
 
 9404    friend class MutexPrivate;
 
 9412    explicit Mutex(
bool recursive = 
false, 
const char* name = 0);
 
 9436    virtual bool lock(
long maxwait = -1);
 
 9489    MutexPrivate* privDataCopy() 
const;
 
 9490    MutexPrivate* m_private;
 
 
 9512    MutexPool(
unsigned int len = 13, 
bool recursive = 
false, 
const char* name = 0);
 
 9526    inline unsigned int index(
void* ptr)
 const 
 9527        { 
return ((
unsigned int)(
unsigned long)ptr) % m_length; }
 
 
 9537        { 
return m_data[index(ptr)]; }
 
 
 9545        { 
return m_data[idx % m_length]; }
 
 
 9550    unsigned int m_length;               
 
 
 9559    friend class SemaphorePrivate;
 
 9567    explicit Semaphore(
unsigned int maxcount = 1, 
const char* name = 0,
 
 9568        unsigned int initialCount = 1);
 
 9592    virtual bool lock(
long maxwait = -1);
 
 9633    SemaphorePrivate* privDataCopy() 
const;
 
 9634    SemaphorePrivate* m_private;
 
 
 9654        : m_mx1(0), m_mx2(0)
 
 9655        { lock(mx1,mx2,maxwait); }
 
 
 9664        : m_mx1(0), m_mx2(0)
 
 9665        { lock(&mx1,&mx2,maxwait); }
 
 
 9678        { 
return m_mx1 != 0; }
 
 
 9697        { 
return lock(&mx1,&mx2,maxwait); }
 
 
 9709    inline void* 
operator new(size_t);
 
 9712    inline void* 
operator new[](size_t);
 
 
 9721    friend class RWLockPrivate;
 
 9765    virtual bool lock(
long maxWait = -1)
 
 9766        { 
return writeLock(maxWait); }
 
 
 9790    RWLockPrivate* privDataCopy() 
const;
 
 9791    RWLockPrivate* m_private;
 
 
 9807        { m_lock = lck.
readLock(maxWait) ? &lck : 0; }
 
 
 9815        { m_lock = (lck && lck->
readLock(maxwait)) ? lck : 0; }
 
 
 9821        { 
if (m_lock) m_lock->unlock(); }
 
 
 9834        { 
if (m_lock) m_lock->unlock(); m_lock = 0; }
 
 
 9843        { 
return (lck && (lck == m_lock)) ||
 
 9844            (drop(),(lck && (m_lock = lck->
readLock(maxwait) ? lck : 0))); }
 
 
 9853        { 
return acquire(&lck,maxwait); }
 
 
 9859    inline void* 
operator new(size_t);
 
 9862    inline void* 
operator new[](size_t);
 
 
 9878        { m_lock = lck.
writeLock(maxWait) ? &lck : 0; }
 
 
 9886        { m_lock = (lck && lck->
writeLock(maxWait)) ? lck : 0; }
 
 
 9892        { 
if (m_lock) m_lock->unlock(); }
 
 
 9905        { 
if (m_lock) m_lock->unlock(); m_lock = 0; }
 
 
 9914        { 
return (lck && (lck == m_lock)) ||
 
 9915            (drop(),(lck && (m_lock = lck->
writeLock(maxWait) ? lck : 0))); }
 
 
 9924        { 
return acquire(&lck,maxWait); }
 
 
 9930    inline void* 
operator new(size_t);
 
 9933    inline void* 
operator new[](size_t);
 
 
 9967    inline unsigned int index(
void* ptr)
 const 
 9968        { 
return ((
unsigned int)(
unsigned long)ptr) % m_length; }
 
 
 9978        { 
return m_data[index(ptr)]; }
 
 
 9986        { 
return m_data[idx % m_length]; }
 
 
 9991    unsigned int m_length;               
 
 
10011        { acquire(lck,maxwait,readLock); }
 
 
10021        { acquire(lck,maxwait,readLock); }
 
 
10040        { 
if (m_lock) m_lock->unlock(); m_lock = 0; }
 
 
10050            if (lck != m_lock) {
 
10054                    m_lock = (rd ? rd->
readLock(maxwait) : lck->
lock(maxwait)) ? lck : 0;
 
10057            return 0 != locked();
 
 
10068        { 
return acquire(&lck,maxwait,readLock); }
 
 
10074    inline void* 
operator new(size_t);
 
10077    inline void* 
operator new[](size_t);
 
 
10090    Lock lck(lock,maxwait,
true);
 
10107    Lock lck(lock,maxwait,
true);
 
10108    dest = 
static_cast<Obj*
>(list[name]);
 
10124    Lock lck(lock,maxwait,
true);
 
10125    dest = 
static_cast<Obj*
>(list.
findObj(gen));
 
10142    Lock lck(lock,maxwait,
true);
 
10143    dest = YOBJECT(Obj,list[name]);
 
10160    Lock lck(lock,maxwait,
true);
 
10161    dest = YOBJECT(Obj,list.
findObj(gen));
 
10193    friend class ThreadPrivate;
 
10194    friend class MutexPrivate;
 
10195    friend class SemaphorePrivate;
 
10196    friend class RWLockPrivate;
 
10263        { 
return m_locks; }
 
 
10270        { 
return m_locking || m_locks; }
 
 
10347    static void idle(
bool exitCheck = 
false);
 
10354    static void sleep(
unsigned int sec, 
bool exitCheck = 
false);
 
10361    static void msleep(
unsigned long msec, 
bool exitCheck = 
false);
 
10369    static void usleep(
unsigned long usec, 
bool exitCheck = 
false);
 
10425        { 
return current() == 
this; }
 
 
10495        { 
return errorString(buffer,lastError()); }
 
 
10530    ThreadPrivate* m_private;
 
 
10549        : m_saved(0), m_enabled(enable)
 
 
10558        : m_saved(0), m_enabled(enable && obj)
 
 
10567        : m_saved(0), m_enabled(enable)
 
 
 
10595        Unknown = AF_UNSPEC,
 
10598        AfUnsupported = AfMax,
 
10602        IPv6 = AfUnsupported + 1,
 
10607        Unix = AfUnsupported + 2,
 
 
10615        : m_address(0), m_length(0)
 
 
10624          m_address(0), m_length(0)
 
 
10666        { 
return !operator==(other); }
 
 
10685    void assign(
const struct sockaddr* addr, socklen_t len = 0);
 
10706        { 
return m_length && m_address; }
 
 
10713        { 
return !(m_length && m_address); }
 
 
10720        { 
return m_address ? m_address->sa_family : 0; }
 
 
10727        { 
return lookupFamily(family()); }
 
 
10734        { 
return scopeId(address()); }
 
 
10742        { 
return scopeId(address(),val); }
 
 
10757            const String& s = full ? m_addrFull : m_addr;
 
 
10768        { 
return m_iface; }
 
 
10776    inline bool iface(
const char* name, 
bool uriUnescape = 
false) {
 
10778            if (!m_iface || !uriUnescape)
 
10781            m_iface.uriUnescapeStr(
false,&e);
 
 
10811        { 
return m_address; }
 
 
10818        { 
return m_length; }
 
 
10825        { 
return isNullAddr(m_host,family()); }
 
 
10865        int family = Unknown) {
 
10867            return sa.
host(host) ? copyAddr(buf,sa.
address()) : Unknown;
 
 
10884    static inline unsigned int scopeId(
struct sockaddr* addr) {
 
10886            if (addr && addr->sa_family == AF_INET6)
 
10887                return ((
struct sockaddr_in6*)addr)->sin6_scope_id;
 
 
10898    static inline bool scopeId(
struct sockaddr* addr, 
unsigned int val) {
 
10900            if (addr && addr->sa_family == AF_INET6) {
 
10901                ((
struct sockaddr_in6*)addr)->sin6_scope_id = val;
 
 
10930            appendAddr(buf,addr,family,iface) << 
":" << port;
 
 
10945            return appendTo(buf,addr,port,family,iface);
 
 
10985        { 
return lookup(family,s_familyName); }
 
 
11010        { 
return s_ifaceNameExtraEscape; }
 
 
11034    struct sockaddr* m_address;
 
11035    socklen_t m_length;
 
11039    mutable String m_addrFull;
 
11043    static const char* s_ifaceNameExtraEscape;
 
 
11087    virtual bool received(
const void* buffer, 
int length, 
int flags, 
const struct sockaddr* addr, socklen_t adrlen) = 0;
 
11098    virtual bool sent(
const void* buffer, 
int length, 
int flags, 
const struct sockaddr* addr, socklen_t adrlen)
 
 
11106        { 
return m_socket; }
 
 
 
11144        { 
return m_error; }
 
 
11206        { 
return writeData(buf.
data(), buf.
length()); }
 
 
11236        { 
return seek(SeekBegin,offset); }
 
 
 
11303        : m_data(data), m_offset(0)
 
 
11347        { 
return m_data.length(); }
 
 
 
11405    virtual bool openPath(
const char* name, 
bool canWrite = 
false, 
bool canRead = 
true,
 
11406        bool create = 
false, 
bool append = 
false, 
bool binary = 
false,
 
11407        bool pubReadable = 
false, 
bool pubWritable = 
false);
 
11432        { 
return m_handle; }
 
 
11511    static bool setFileTime(
const char* name, 
unsigned int secEpoch, 
int* error = 0);
 
11520    static bool getFileTime(
const char* name, 
unsigned int& secEpoch, 
int* error = 0);
 
11528    static bool exists(
const char* name, 
int* error = 0);
 
11537    static bool rename(
const char* oldFile, 
const char* newFile, 
int* error = 0);
 
11545    static bool remove(
const char* name, 
int* error = 0);
 
11554    static bool md5(
const char* name, 
String& buffer, 
int* error = 0);
 
11563    static bool mkDir(
const char* path, 
int* error = 0, 
int mode = -1);
 
11571    static bool rmDir(
const char* path, 
int* error = 0);
 
 
11618        LowDelay       = IPTOS_LOWDELAY,
 
11619        MaxThroughput  = IPTOS_THROUGHPUT,
 
11620        MaxReliability = IPTOS_RELIABILITY,
 
11621        MinCost        = IPTOS_MINCOST,
 
 
11652        ExpeditedFwd   = 0xb8,
 
 
11660        FProtoIpv6           = 0x0001, 
 
11661        FIpv6Only            = 0x0002, 
 
11662        FBindToIface         = 0x0004, 
 
11663        FEfficientSelect     = 0x0008, 
 
11664        FExclusiveAddrUse    = 0x0010, 
 
11665        FReusePort           = 0x0020, 
 
 
11699    virtual bool create(
int domain, 
int type, 
int protocol = 0);
 
11724        { 
return m_handle; }
 
 
11770    virtual bool setOption(
int level, 
int name, 
const void* value = 0, socklen_t length = 0);
 
11781#if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY) 
11782            int value = on ? 1 : 0;
 
11783            return setOption(IPPROTO_IPV6,IPV6_V6ONLY,&value,
sizeof(value));
 
 
11797    virtual bool getOption(
int level, 
int name, 
void* buffer, socklen_t* length);
 
11828    inline bool setTOS(
const char* tos, 
int defTos = Normal)
 
11829        { 
return setTOS(lookup(tos,tosValues(),defTos)); }
 
 
11855    virtual bool setReuse(
bool reuse = 
true, 
bool exclusive = 
false, 
bool setPort = 
false);
 
11871    virtual bool bind(
struct sockaddr* addr, socklen_t addrlen);
 
11882    virtual bool bind(
struct sockaddr* addr, socklen_t addrlen,
 
11883        const char* iface, 
int ifLen = -1);
 
11902    virtual bool bindIface(
const char* iface, 
int ifLen = -1, 
int family = SocketAddr::Unknown);
 
11968    virtual bool connect(
struct sockaddr* addr, socklen_t addrlen);
 
11987    virtual bool connectAsync(
struct sockaddr* addr, socklen_t addrlen, 
unsigned int toutUs,
 
11988        bool* timeout = 0);
 
12000        { 
return connectAsync(addr.
address(),addr.
length(),toutUs,timeout); }
 
 
12056    virtual int sendTo(
const void* buffer, 
int length, 
const struct sockaddr* addr, socklen_t adrlen, 
int flags = 0);
 
12067        { 
return sendTo(buffer, length, addr.
address(), addr.
length(), flags); }
 
 
12076    virtual int send(
const void* buffer, 
int length, 
int flags = 0);
 
12095    virtual int recvFrom(
void* buffer, 
int length, 
struct sockaddr* addr = 0, socklen_t* adrlen = 0, 
int flags = 0);
 
12114    virtual int recv(
void* buffer, 
int length, 
int flags = 0);
 
12132    virtual bool select(
bool* readok, 
bool* writeok, 
bool* except, 
struct timeval* timeout = 0);
 
12142    bool select(
bool* readok, 
bool* writeok, 
bool* except, int64_t timeout);
 
12186        { 
return s_features; }
 
 
12213    bool applyFilters(
const void* buffer, 
int length, 
int flags, 
const struct sockaddr* addr = 0,
 
12214        socklen_t adrlen = 0, 
bool rx = 
true);
 
12220    static unsigned int s_features;
 
 
12291    virtual int sendMsg(
const void* buf, 
int length, 
int stream, 
int& flags) = 0;
 
 
12355        : m_socket(&socket)
 
 
 
12387        : m_ttl(ttl), m_order(order), m_pref(pref)
 
 
12394        : m_order(0), m_pref(0)
 
 
12409        { 
return m_order; }
 
 
 
12503    inline SrvRecord(
int ttl, 
int prio, 
int weight, 
const char* addr, 
int port)
 
12504        : 
DnsRecord(ttl,prio,weight), m_address(addr), m_port(port)
 
 
12512        { 
return m_address; }
 
 
 
12562    NaptrRecord(
int ttl, 
int ord, 
int pref, 
const char* flags, 
const char* serv,
 
12563        const char* regexp, 
const char* next);
 
12585        { 
return m_flags; }
 
 
12592        { 
return m_service; }
 
 
12599        { 
return m_regmatch; }
 
 
12606        { 
return m_template; }
 
 
 
12659    static bool init(
int timeout = -1, 
int retries = -1);
 
 
12743        { 
return s_directions; }
 
 
12752        { 
return (
Direction)TelEngine::lookup(name,s_directions,defdir); }
 
 
12815        { 
return setKey(key.
data(),key.
length(),dir); }
 
 
12833        { 
return initVector(vect.
data(),vect.
length(),dir); }
 
 
12842    virtual bool encrypt(
void* outData, 
unsigned int len, 
const void* inpData = 0) = 0;
 
12850        { 
return encrypt(data.
data(),data.
length()); }
 
 
12859    virtual bool decrypt(
void* outData, 
unsigned int len, 
const void* inpData = 0) = 0;
 
12867        { 
return decrypt(data.
data(),data.
length()); }
 
 
 
12889        : 
String(name), m_format(format)
 
 
12903        { 
return m_format; }
 
 
12912    virtual bool init(
bool comp = 
true, 
bool decomp = 
true,
 
 
12953    virtual int writeComp(
const void* buf, 
unsigned int len, 
bool flush) = 0;
 
12964        { 
return writeComp(data.
data(),data.
length(),flush); }
 
 
12975        { 
return writeComp(data.
c_str(),data.
length(),flush); }
 
 
12993    virtual int writeDecomp(
const void* buf, 
unsigned int len, 
bool flush) = 0;
 
13003        { 
return writeDecomp(data.
data(),data.
length(),flush); }
 
 
13013        { 
return writeDecomp(data.
c_str(),data.
length(),flush); }
 
 
 
13101        : m_ts(ts), m_srcAddr(srcAddr), m_dstAddr(dstAddr), m_extraInfo(extra)
 
 
13109        { 
return m_srcAddr; }
 
 
13116        { 
return m_dstAddr; }
 
 
13123        { 
return m_extraInfo; }
 
 
13137        { 
return srcAddr() ? srcAddr()->port() : 0; }
 
 
13144        { 
return dstAddr() ? dstAddr()->port() : 0; }
 
 
 
A list based Array.
Definition yateclass.h:2770
virtual void * getObject(const String &name) const
GenObject * take(int column, int row)
ObjList * getColumn(int column) const
Definition yateclass.h:2867
int getColumns() const
Definition yateclass.h:2857
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:2850
bool addColumn(ObjList *column=0, int index=-1)
GenObject * get(int column, int row) const
Atom string holder.
Definition yateclass.h:5194
const String * operator->() const
Definition yateclass.h:5215
Atom(const char *value)
Definition yateclass.h:5200
Base class for atomic operations.
Definition yateclass.h:1196
RWLock * lock() const
Definition yateclass.h:1207
RWLock * m_lock
Definition yateclass.h:1220
GenObject pointer holder.
Definition yateclass.h:4350
GenObject & operator*() const
Definition yateclass.h:4425
void set(GenObject *gen=0, bool owned=true)
Definition yateclass.h:4392
GenObject * operator->() const
Definition yateclass.h:4419
GenObject * take()
Definition yateclass.h:4381
AutoGenObject & operator=(GenObject *gen)
Definition yateclass.h:4406
~AutoGenObject()
Definition yateclass.h:4367
GenObject * data() const
Definition yateclass.h:4374
AutoGenObject(GenObject *gen=0, const char *name=0, bool owned=true)
Definition yateclass.h:4360
Base64 encoder/decoder class.
Definition yateclass.h:7621
Base64 & operator<<(const char *value)
Definition yateclass.h:7679
Base64(void *src, unsigned int len, bool copyData=true)
Definition yateclass.h:7636
bool decode(DataBlock &dest, bool liberal=true)
Base64()
Definition yateclass.h:7627
Base64 & operator<<(const DataBlock &data)
Definition yateclass.h:7673
void encode(String &dest, unsigned int lineLen=0, bool lineAtEnd=false)
Base64 & operator<<(const String &value)
Definition yateclass.h:7667
Data associated with a captured packet.
Definition yateclass.h:13090
CaptureInfo(uint64_t ts=Time::now(), SocketAddr *srcAddr=0, SocketAddr *dstAddr=0, const NamedList &extra=NamedList::empty())
Definition yateclass.h:13099
uint16_t srcPort() const
Definition yateclass.h:13136
const NamedList & extraInfo() const
Definition yateclass.h:13122
uint64_t ts() const
Definition yateclass.h:13129
uint16_t dstPort() const
Definition yateclass.h:13143
SocketAddr * dstAddr() const
Definition yateclass.h:13115
SocketAddr * srcAddr() const
Definition yateclass.h:13108
Packet capture class.
Definition yateclass.h:13158
Capture(const char *name)
Definition yateclass.h:13166
virtual bool initialize(const NamedList ¶ms)=0
virtual bool write(const uint8_t *data, unsigned int len, const CaptureInfo &info)=0
virtual const String & name() const
Definition yateclass.h:13196
virtual bool valid() const =0
A captured event string with a debug level.
Definition yateclass.h:5227
int level() const
Definition yateclass.h:5252
static void append(int level, const char *text)
Definition yateclass.h:5275
CapturedEvent(const CapturedEvent &original)
Definition yateclass.h:5244
static ObjList & eventsRw()
Definition yateclass.h:5283
static bool capturing()
Definition yateclass.h:5260
static const ObjList & events()
Definition yateclass.h:5267
static void capturing(bool capture)
Definition yateclass.h:5290
CapturedEvent(int level, const char *text)
Definition yateclass.h:5236
An abstract cipher.
Definition yateclass.h:12727
bool initVector(const DataBlock &vect, Direction dir=Bidir)
Definition yateclass.h:12832
virtual void * getObject(const String &name) const
Direction
Definition yateclass.h:12732
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:12866
virtual bool setKey(const void *key, unsigned int len, Direction dir=Bidir)=0
bool encrypt(DataBlock &data)
Definition yateclass.h:12849
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:12751
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:12742
virtual unsigned int initVectorSize() const
bool setKey(const DataBlock &key, Direction dir=Bidir)
Definition yateclass.h:12814
An abstract data (de)compressor.
Definition yateclass.h:12879
virtual int compress(const void *buf, unsigned int len, DataBlock &dest)
Compressor(const char *format, const char *name=0)
Definition yateclass.h:12888
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:12912
virtual int readComp(DataBlock &buf, bool flush)=0
int writeComp(const DataBlock &data, bool flush)
Definition yateclass.h:12963
virtual ~Compressor()
Definition yateclass.h:12895
virtual void finalize(bool comp)
Definition yateclass.h:12920
virtual int writeComp(const void *buf, unsigned int len, bool flush)=0
int writeDecomp(const String &data, bool flush)
Definition yateclass.h:13012
int writeDecomp(const DataBlock &data, bool flush)
Definition yateclass.h:13002
virtual int readDecomp(DataBlock &buf, bool flush)=0
int writeComp(const String &data, bool flush)
Definition yateclass.h:12974
const String & format() const
Definition yateclass.h:12902
virtual int decompress(const void *buf, unsigned int len, DataBlock &dest)
A class that holds just a block of raw data.
Definition yateclass.h:6074
static const DataBlock & empty()
void append(const DataBlock &value, bool mayOverlap=true)
Definition yateclass.h:6313
void cut(int len)
Definition yateclass.h:6511
int at(unsigned int offs, int defvalue=-1) const
Definition yateclass.h:6137
static void hton8advance(uint8_t *&buf, uint64_t val, unsigned int &len)
Definition yateclass.h:6789
void overAlloc(unsigned int bytes)
Definition yateclass.h:6172
void append2hton(uint16_t value)
Definition yateclass.h:6360
static uint16_t ntoh2(const uint8_t *buf)
Definition yateclass.h:6963
DataBlock & operator+=(const DataBlock &value)
Definition yateclass.h:6545
static void rebuildDataInsert(void *dest, unsigned int dLen, const void *src, unsigned int sLen, unsigned int pos, unsigned int space, int fill=-1)
void append8hton(uint64_t value)
Definition yateclass.h:6339
DataBlock(const DataBlock &value, unsigned int overAlloc)
static void hton2advance(uint8_t *&buf, uint16_t val, unsigned int &len)
Definition yateclass.h:6984
bool changeLsb(unsigned int pos, uint64_t value, uint8_t bytes=8)
Definition yateclass.h:6283
void appendBytes(unsigned int count, uint8_t val=0)
Definition yateclass.h:6332
void append(const void *value, unsigned int len, bool mayOverlap=true)
Definition yateclass.h:6303
DataBlock & operator+=(const String &value)
Definition yateclass.h:6551
void insertLsb(uint64_t value, uint8_t bytes=8, unsigned int pos=0)
Definition yateclass.h:6464
static uint32_t ntoh3advance(const uint8_t *&buf, unsigned int &len)
Definition yateclass.h:6889
static uint64_t ntoh(const uint8_t *buf, uint8_t bytes)
Definition yateclass.h:7034
static void hton(uint8_t *buf, uint64_t val, uint8_t bytes)
Definition yateclass.h:7072
void append8lsb(uint64_t value, uint8_t bytes=8)
Definition yateclass.h:6376
static void hton4advance(uint8_t *&buf, uint32_t val)
Definition yateclass.h:6842
static void rebuildDataRemove(void *dest, unsigned int dLen, const void *src, unsigned int sLen, unsigned int pos, unsigned int space, int fillAfter=-1)
static void lsbSet(uint8_t *buf, uint64_t val, uint8_t bytes)
Definition yateclass.h:7150
void insert(const void *buf, unsigned int bufLen, unsigned int pos=0, bool mayOverlap=true)
Definition yateclass.h:6393
DataBlock(const DataBlock &value)
bool changeHex(unsigned int pos, const String &data, char sep=0, bool guessSep=true, bool emptyOk=true, int *res=0)
Definition yateclass.h:6597
void resize(unsigned int len, bool keepData=false, bool reAlloc=true)
bool convert(const DataBlock &src, const String &sFormat, const String &dFormat, unsigned maxlen=0)
void insert(const DataBlock &value, unsigned int pos=0, bool mayOverlap=true)
Definition yateclass.h:6403
void insert8hton(uint64_t value, unsigned int pos=0)
Definition yateclass.h:6422
void append3hton(uint32_t value)
Definition yateclass.h:6353
static void moveData(void *buf, unsigned int bufLen, unsigned int len, unsigned int dPos, unsigned int sPos, int fill=-1)
bool change3hton(unsigned int pos, uint32_t value)
Definition yateclass.h:6237
bool null() const
Definition yateclass.h:6144
void insert3hton(uint32_t value, unsigned int pos=0)
Definition yateclass.h:6438
void insertHton(uint64_t value, uint8_t bytes=8, unsigned int pos=0)
Definition yateclass.h:6455
unsigned char * data(unsigned int offs, unsigned int len=1) const
Definition yateclass.h:6128
bool appendHex(const String &data, char sep=0, bool guessSep=true, bool emptyOk=true, int *res=0)
Definition yateclass.h:6614
void insert4hton(uint32_t value, unsigned int pos=0)
Definition yateclass.h:6430
unsigned int size() const
Definition yateclass.h:6158
bool change2hton(unsigned int pos, uint16_t value)
Definition yateclass.h:6251
void insertBytes(unsigned int count, unsigned int pos=0, uint8_t val=0)
Definition yateclass.h:6412
static void hton3advance(uint8_t *&buf, uint32_t val, unsigned int &len)
Definition yateclass.h:6921
static uint64_t lsbAdvance(const uint8_t *&buf, unsigned int &len, uint8_t bytes)
Definition yateclass.h:7099
static void hton3(uint8_t *buf, uint32_t val)
Definition yateclass.h:6931
int operator[](unsigned int index) const
Definition yateclass.h:6533
void appendHton(uint64_t value, uint8_t bytes)
Definition yateclass.h:6368
static uint64_t ntohAdvance(const uint8_t *&buf, unsigned int &len, uint8_t bytes)
Definition yateclass.h:7021
static uint64_t ntoh8advance(const uint8_t *&buf)
Definition yateclass.h:6734
static void hton2advance(uint8_t *&buf, uint16_t val)
Definition yateclass.h:6972
void clear(bool deleteData=true)
bool unHexify(const String &data)
Definition yateclass.h:6653
static uint64_t lsb(const uint8_t *buf, uint8_t bytes)
Definition yateclass.h:7112
static String & sqlEscape(String &str, const void *data, unsigned int len, char extraEsc=0)
static void hton8(uint8_t *buf, uint64_t val)
Definition yateclass.h:6799
String sqlEscape(char extraEsc) const
Definition yateclass.h:6671
static uint32_t ntoh3(const uint8_t *buf)
Definition yateclass.h:6899
bool change4hton(unsigned int pos, uint32_t value)
Definition yateclass.h:6223
void append(const String &value)
Definition yateclass.h:6322
void insert1(uint8_t value, unsigned int pos=0)
Definition yateclass.h:6472
static uint32_t ntoh4advance(const uint8_t *&buf, unsigned int &len)
Definition yateclass.h:6823
static uint32_t ntoh3advance(const uint8_t *&buf)
Definition yateclass.h:6875
void append1(uint8_t value)
Definition yateclass.h:6383
static uint64_t lsbAdvance(const uint8_t *&buf, uint8_t bytes)
Definition yateclass.h:7082
static void htonAdvance(uint8_t *&buf, uint64_t val, uint8_t bytes)
Definition yateclass.h:7044
static uint64_t ntoh8advance(const uint8_t *&buf, unsigned int &len)
Definition yateclass.h:6753
void * data() const
Definition yateclass.h:6119
void insert2hton(uint16_t value, unsigned int pos=0)
Definition yateclass.h:6446
static void hton8advance(uint8_t *&buf, uint64_t val)
Definition yateclass.h:6771
bool changeHton(unsigned int pos, uint64_t value, uint8_t bytes)
Definition yateclass.h:6264
static uint32_t ntoh4(const uint8_t *buf)
Definition yateclass.h:6833
static uint16_t ntoh2advance(const uint8_t *&buf, unsigned int &len)
Definition yateclass.h:6953
DataBlock & operator=(const DataBlock &value)
Definition yateclass.h:6539
bool changeHex(unsigned int pos, const char *data, unsigned int len, char sep=0, bool guessSep=true, bool emptyOk=true, int *res=0)
static void lsbSetAdvance(uint8_t *&buf, uint64_t val, uint8_t bytes)
Definition yateclass.h:7122
static void htonAdvance(uint8_t *&buf, uint64_t val, unsigned int &len, uint8_t bytes)
Definition yateclass.h:7059
static void hton4advance(uint8_t *&buf, uint32_t val, unsigned int &len)
Definition yateclass.h:6856
int operator[](signed int index) const
Definition yateclass.h:6525
DataBlock(void *value, unsigned int len, bool copyData=true, unsigned int overAlloc=0)
static void hton2(uint8_t *buf, uint16_t val)
Definition yateclass.h:6994
bool unHexify(const char *data, unsigned int len, char sep)
Definition yateclass.h:6628
static uint32_t ntoh4advance(const uint8_t *&buf)
Definition yateclass.h:6808
void append4hton(uint32_t value)
Definition yateclass.h:6346
void cut(unsigned int pos, unsigned int len, bool reAlloc=true)
bool change8hton(unsigned int pos, uint64_t value)
Definition yateclass.h:6209
static void lsbSetAdvance(uint8_t *&buf, uint64_t val, unsigned int &len, uint8_t bytes)
Definition yateclass.h:7137
static uint64_t ntoh8(const uint8_t *buf)
Definition yateclass.h:6763
unsigned int overAlloc() const
Definition yateclass.h:6165
unsigned int length() const
Definition yateclass.h:6151
DataBlock & assign(void *value, unsigned int len, bool copyData=true, unsigned int allocated=0)
static void hton3advance(uint8_t *&buf, uint32_t val)
Definition yateclass.h:6908
String & sqlEscape(String &str, char extraEsc=0) const
Definition yateclass.h:6663
static uint64_t ntohAdvance(const uint8_t *&buf, uint8_t bytes)
Definition yateclass.h:7004
void truncate(unsigned int len, bool reAlloc=true)
Definition yateclass.h:6491
static uint16_t ntoh2advance(const uint8_t *&buf)
Definition yateclass.h:6940
bool unHexify(const char *data, unsigned int len)
Definition yateclass.h:6642
static void hton4(uint8_t *buf, uint32_t val)
Definition yateclass.h:6866
bool change(unsigned int pos, const void *buf, unsigned int bufLen, unsigned int extra=0, int extraVal=0, bool mayOverlap=true)
DataBlock(unsigned int overAlloc=0)
A holder for a debug level.
Definition yateclass.h:329
void debugChain(const DebugEnabler *chain=0)
Definition yateclass.h:396
void debugName(const char *name)
Definition yateclass.h:416
void debugEnabled(bool enable)
Definition yateclass.h:368
DebugEnabler(int level=TelEngine::debugLevel(), bool enabled=true)
Definition yateclass.h:336
void debugCopy(const DebugEnabler *original=0)
bool debugEnabled() const
Definition yateclass.h:361
void debugSet(const char *desc)
bool debugAt(int level) const
bool debugChained() const
Definition yateclass.h:389
int debugLevel() const
Definition yateclass.h:347
int debugLevel(int level)
const char * debugName() const
Definition yateclass.h:375
An object that logs messages on creation and destruction.
Definition yateclass.h:758
Formatting
Definition yateclass.h:763
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 void outputTimestamp(bool on)
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)
Debugger(DebugEnabler *enabler, int level, const char *name, const char *format=0,...)
static bool outputTimestamp()
static void setFormatting(Formatting format, uint32_t startTimeSec=0)
static void enableOutput(bool enable=true, bool colorize=false)
A DNS record.
Definition yateclass.h:12376
DnsRecord(int ttl, int order, int pref)
Definition yateclass.h:12386
virtual void dump(String &buf, const char *sep=" ")
DnsRecord()
Definition yateclass.h:12393
static bool insert(ObjList &list, DnsRecord *rec, bool ascPref)
int ttl() const
Definition yateclass.h:12401
int order() const
Definition yateclass.h:12408
int pref() const
Definition yateclass.h:12415
A stream file class.
Definition yateclass.h:11374
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:11431
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:1627
virtual void * getObject(const String &name) const
static void setObjCounting(bool enable)
Definition yateclass.h:1694
virtual ~GenObject()
Definition yateclass.h:1638
static ObjList & getObjCounters()
virtual bool alive() const
virtual const String & toString() const
NamedCounter * setObjCounter(NamedCounter *counter)
static bool getObjCounting()
Definition yateclass.h:1687
virtual const String & traceId() const
static void * getObject(const String &name, const GenObject *obj)
Definition yateclass.h:1680
static NamedCounter * getObjCounter(const String &name, bool create=true)
NamedCounter * getObjCounter() const
Definition yateclass.h:1701
Templated pointer that can be inserted in a list.
Definition yateclass.h:1964
GenPointer< Obj > & operator=(const GenPointer< Obj > &value)
Definition yateclass.h:1998
Obj & operator*() const
Definition yateclass.h:2023
GenPointer()
Definition yateclass.h:1975
GenPointer(const GenPointer< Obj > &value)
Definition yateclass.h:1983
GenPointer(Obj *object)
Definition yateclass.h:1991
GenPointer< Obj > & operator=(Obj *object)
Definition yateclass.h:2004
Obj * operator->() const
Definition yateclass.h:2017
Template for generic object vector.
Definition yateclass.h:4442
unsigned int fillObj(const Obj *items, unsigned int count, unsigned int offs=0)
Definition yateclass.h:4749
Obj * find(const String &name, unsigned int offs=0) const
Definition yateclass.h:4598
Obj * last()
Definition yateclass.h:4562
GenericVector & operator+=(const GenericVector &other)
Definition yateclass.h:4853
Obj * findValue(const Obj &val, unsigned int offs=0) const
Definition yateclass.h:4629
bool assign(unsigned int len, const Obj *items=0, unsigned int count=0)
Definition yateclass.h:4653
void overAlloc(unsigned int count)
Definition yateclass.h:4516
Obj * append(const Obj &item)
Definition yateclass.h:4763
Obj * set(const Obj &item)
Definition yateclass.h:4814
unsigned int fill(unsigned int offs=0, int count=-1, const Obj *value=0)
Definition yateclass.h:4717
GenericVector(const ObjList &items, unsigned int overAlloc=0, const char *name=0)
Definition yateclass.h:4471
int indexOfValue(const Obj &val, unsigned int offs=0, Obj **found=0) const
Definition yateclass.h:4612
unsigned int append(const Obj *items, unsigned int count)
Definition yateclass.h:4776
Obj * first()
Definition yateclass.h:4548
int indexOf(const String &name, unsigned int offs=0, Obj **found=0) const
Definition yateclass.h:4580
bool removeLast(unsigned int count=1)
Definition yateclass.h:4701
unsigned int size() const
Definition yateclass.h:4502
unsigned int fillObj(const Obj &value, unsigned int offs=0, int count=-1)
Definition yateclass.h:4739
GenericVector(unsigned int overAlloc=0, const char *name=0)
Definition yateclass.h:4449
Obj * data(unsigned int offs=0, unsigned int count=0)
Definition yateclass.h:4532
virtual const String & toString() const
Definition yateclass.h:4868
GenericVector(const GenericVector &other)
Definition yateclass.h:4480
bool resize(unsigned int len)
Definition yateclass.h:4682
GenericVector & operator+=(const Obj &item)
Definition yateclass.h:4844
GenericVector & operator=(const GenericVector &other)
Definition yateclass.h:4826
virtual ~GenericVector()
Definition yateclass.h:4488
unsigned int append(const ObjList &list)
Definition yateclass.h:4788
const Obj * last() const
Definition yateclass.h:4569
const String & name() const
Definition yateclass.h:4523
GenericVector(const Obj *items, unsigned int count, unsigned int overAlloc=0, const char *name=0)
Definition yateclass.h:4460
void clear()
Definition yateclass.h:4638
unsigned int overAlloc() const
Definition yateclass.h:4509
unsigned int length() const
Definition yateclass.h:4495
const Obj * data(unsigned int offs=0, unsigned int count=0) const
Definition yateclass.h:4541
GenericVector & operator=(const Obj &item)
Definition yateclass.h:4835
const Obj * first() const
Definition yateclass.h:4555
unsigned int assign(const ObjList &list)
Definition yateclass.h:4801
A hashed object list class.
Definition yateclass.h:5495
ObjList * getHashList(const String &str) const
Definition yateclass.h:5551
virtual void * getObject(const String &name) const
GenObject * remove(GenObject *obj, unsigned int hash, bool delobj=true)
Definition yateclass.h:5627
ObjList * find(const GenObject *obj) const
ObjList * append(const GenObject *obj)
ObjList * getList(unsigned int index) const
Definition yateclass.h:5535
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:5614
ObjList * append(const GenObject *obj, unsigned int hash)
ObjList * getHashList(unsigned int hash) const
Definition yateclass.h:5543
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:5520
ObjList * find(const String &str) const
bool resync(GenObject *obj)
An abstract hashing class.
Definition yateclass.h:7173
bool update(const DataBlock &data)
Definition yateclass.h:7220
virtual unsigned int hmacBlockSize() const
bool hmacStart(DataBlock &opad, const String &key)
Definition yateclass.h:7275
bool update(const void *buf, unsigned int len)
Definition yateclass.h:7212
virtual void finalize()=0
Hasher()
Definition yateclass.h:7329
virtual unsigned int hashLength() const =0
virtual const unsigned char * rawDigest()=0
bool hmac(const DataBlock &key, const DataBlock &msg)
Definition yateclass.h:7301
bool update(const String &str)
Definition yateclass.h:7228
bool hmacFinal(const DataBlock &opad)
const String & hexDigest()
Definition yateclass.h:7203
bool hmac(const String &key, const String &msg)
Definition yateclass.h:7310
bool hmacStart(DataBlock &opad, const void *key, unsigned int keyLen)
Hasher & operator<<(const DataBlock &data)
Definition yateclass.h:7242
Hasher & operator<<(const String &value)
Definition yateclass.h:7235
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:7266
Hasher & operator<<(const char *value)
Class used to iterate the items of a list.
Definition yateclass.h:5665
ListIterator(ObjList &list, int offset=0)
void assign(HashList &list, int offset=0)
void reset()
Definition yateclass.h:5747
unsigned int length() const
Definition yateclass.h:5693
void assign(ObjList &list, int offset=0)
ListIterator(HashList &list, int offset=0)
bool eof() const
Definition yateclass.h:5741
GenObject * get(unsigned int index) const
Ephemeral double mutex locking object.
Definition yateclass.h:9644
bool lock(Mutex *mx1, Mutex *mx2, long maxwait=-1)
~Lock2()
Definition yateclass.h:9670
bool locked() const
Definition yateclass.h:9677
bool lock(Mutex &mx1, Mutex &mx2, long maxwait=-1)
Definition yateclass.h:9696
Lock2(Mutex &mx1, Mutex &mx2, long maxwait=-1)
Definition yateclass.h:9663
Lock2(Mutex *mx1, Mutex *mx2, long maxwait=-1)
Definition yateclass.h:9653
Ephemeral mutex, semaphore or rw-lock locking object.
Definition yateclass.h:10000
void drop()
Definition yateclass.h:10039
Lock(Lockable *lck, long maxwait=-1, bool readLock=false)
Definition yateclass.h:10019
bool acquire(Lockable *lck, long maxwait=-1, bool readLock=false)
Definition yateclass.h:10049
bool acquire(Lockable &lck, long maxwait=-1, bool readLock=false)
Definition yateclass.h:10067
~Lock()
Definition yateclass.h:10026
Lockable * locked() const
Definition yateclass.h:10033
Lock(Lockable &lck, long maxwait=-1, bool readLock=false)
Definition yateclass.h:10009
Abstract interface for lockable objects.
Definition yateclass.h:9299
virtual Mutex * lockableMutex()
Definition yateclass.h:9345
virtual bool locked() const =0
virtual RWLock * lockableRWLock()
Definition yateclass.h:9359
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)
virtual Semaphore * lockableSemaphore()
Definition yateclass.h:9352
static void startUsingNow()
A standard MD5 digest calculator.
Definition yateclass.h:7350
MD5 & operator=(const MD5 &original)
static unsigned int rawLength()
Definition yateclass.h:7414
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:7421
Matching item common interface.
Definition yateclass.h:8704
virtual const MatchingItemRegexp * itemRegexp() const
Definition yateclass.h:8786
virtual bool runMatchString(const String &str, MatchingParams *params=0) const
Definition yateclass.h:8756
bool matchListParam(const NamedList &list, MatchingParams *params=0) const
Definition yateclass.h:8747
virtual GenObject * dumpXml(const MatchingItemDump *dump=0, unsigned int depth=0) const
Definition yateclass.h:8844
MatchingItemBase(const char *name, bool negated=false)
Definition yateclass.h:8714
virtual const MatchingItemList * itemList() const
Definition yateclass.h:8800
virtual const MatchingItemRandom * itemRandom() const
Definition yateclass.h:8793
bool negated() const
Definition yateclass.h:8729
bool matchString(const String &str, MatchingParams *params=0) const
Definition yateclass.h:8738
virtual String & dumpValue(String &buf, const MatchingItemDump *dump=0, const String &indent=String::empty(), const String &origIndent=String::empty(), unsigned int depth=0) const
Definition yateclass.h:8833
virtual const String & toString() const
Definition yateclass.h:8851
virtual bool runMatchListParam(const NamedList &list, MatchingParams *params=0) const
Definition yateclass.h:8765
virtual const MatchingItemCustom * itemCustom() const
Definition yateclass.h:8807
virtual MatchingItemBase * copy() const
Definition yateclass.h:8772
const String & name() const
Definition yateclass.h:8722
virtual String & dump(String &buf, const MatchingItemDump *dump=0, const String &indent=String::empty(), const String &origIndent=String::empty(), unsigned int depth=0) const
Definition yateclass.h:8819
virtual const MatchingItemString * itemString() const
Definition yateclass.h:8779
Base class for custom matching.
Definition yateclass.h:9262
virtual const MatchingItemCustom * itemCustom() const
Definition yateclass.h:9287
const String & type() const
Definition yateclass.h:9280
MatchingItemCustom(const char *name, const char *type, bool negated=false)
Definition yateclass.h:9272
Matching item dump parameters.
Definition yateclass.h:8489
static String & dumpItem(const MatchingItemBase *mi, String &buf, const String &indent=String::empty(), const String &origIndent=String::empty(), const NamedList *params=0)
Definition yateclass.h:8563
virtual GenObject * dumpXml(const MatchingItemBase *mi, unsigned int depth=0) const
virtual String & dumpValue(const MatchingItemBase *mi, String &buf, const String &indent=String::empty(), const String &origIndent=String::empty(), unsigned int depth=0) const
DumpFlags
Definition yateclass.h:8495
MatchingItemDump(const NamedList *params=0, const char *name=0)
Definition yateclass.h:8505
virtual String & dump(const MatchingItemBase *mi, String &buf, const String &indent=String::empty(), const String &origIndent=String::empty(), unsigned int depth=0) const
virtual void init(const NamedList ¶ms)
static GenObject * dumpItemXml(const MatchingItemBase *mi, const NamedList *params=0)
Definition yateclass.h:8576
A list of matching items.
Definition yateclass.h:9094
MatchingItemList(const char *name, bool matchAll=true, bool negated=false)
Definition yateclass.h:9104
virtual bool runMatchString(const String &str, MatchingParams *params=0) const
bool change(MatchingItemBase *item, int pos=-1, bool ins=false, unsigned int overAlloc=1)
bool matchAll() const
Definition yateclass.h:9112
bool set(MatchingItemBase *item, unsigned int pos, unsigned int overAlloc=1)
Definition yateclass.h:9200
virtual const MatchingItemList * itemList() const
Definition yateclass.h:9240
bool append(MatchingItemBase *item, unsigned int overAlloc=1)
Definition yateclass.h:9174
bool insert(MatchingItemBase *item, unsigned int pos=0, unsigned int overAlloc=1)
Definition yateclass.h:9211
virtual bool runMatchListParam(const NamedList &list, MatchingParams *params=0) const
const MatchingItemBase * find(const String &name) const
Definition yateclass.h:9150
virtual MatchingItemBase * copy() const
int indexOf(const String &name) const
Definition yateclass.h:9142
const MatchingItemBase * at(unsigned int index) const
Definition yateclass.h:9134
void append(ObjList &list)
Definition yateclass.h:9181
unsigned int count() const
Definition yateclass.h:9126
static MatchingItemBase * optimize(MatchingItemList *list)
unsigned int length() const
Definition yateclass.h:9119
Matching item load parameters.
Definition yateclass.h:8596
static const TokenDict64 * loadFlags()
virtual MatchingItemBase * load(const NamedList ¶ms, String *error=0, const char *prefix=0, const char *suffix=0) const
LoadFlags
Definition yateclass.h:8602
static const TokenDict * itemFlags()
virtual MatchingItemBase * loadXml(const String &str, String *error=0) const
virtual MatchingItemBase * loadXml(const GenObject *gen, String *error=0) const
ItemFlags
Definition yateclass.h:8621
MatchingItemLoad(uint64_t flags=DefaultFlags, const char *name=0)
Definition yateclass.h:8634
Random number matching.
Definition yateclass.h:9010
virtual bool runMatchString(const String &str, MatchingParams *params=0) const
Definition yateclass.h:9058
virtual const MatchingItemRandom * itemRandom() const
Definition yateclass.h:9081
MatchingItemRandom(uint32_t val, uint32_t maxVal, bool negated=false, const char *name=0)
Definition yateclass.h:9022
virtual bool runMatchListParam(const NamedList &list, MatchingParams *params=0) const
Definition yateclass.h:9067
virtual MatchingItemBase * copy() const
Definition yateclass.h:9074
uint32_t maxValue() const
Definition yateclass.h:9042
uint32_t value() const
Definition yateclass.h:9035
bool randomMatch() const
Definition yateclass.h:9049
A matching item using a regular expression.
Definition yateclass.h:8927
virtual const MatchingItemRegexp * itemRegexp() const
Definition yateclass.h:8979
virtual bool runMatchString(const String &str, MatchingParams *params=0) const
Definition yateclass.h:8965
MatchingItemRegexp(const char *name, const char *value, bool negated=false)
Definition yateclass.h:8937
const Regexp & value() const
Definition yateclass.h:8956
static MatchingItemRegexp * build(const char *name, const String &str, int negated=0, bool insensitive=false, bool extended=false, int fail=1)
MatchingItemRegexp(const char *name, const Regexp &value, bool negated=false)
Definition yateclass.h:8948
virtual MatchingItemBase * copy() const
Definition yateclass.h:8972
String comparison matching item.
Definition yateclass.h:8864
virtual bool runMatchString(const String &str, MatchingParams *params=0) const
Definition yateclass.h:8900
MatchingItemString(const char *name, const char *value, bool caseInsensitive=false, bool negated=false)
Definition yateclass.h:8875
virtual MatchingItemBase * copy() const
Definition yateclass.h:8907
const String & value() const
Definition yateclass.h:8884
bool caseInsensitive() const
Definition yateclass.h:8891
virtual const MatchingItemString * itemString() const
Definition yateclass.h:8914
Matching item match parameters.
Definition yateclass.h:8469
MatchingParams(const char *name=0)
Definition yateclass.h:8476
A Stream that operates on DataBlocks in memory.
Definition yateclass.h:11288
virtual bool terminate()
Definition yateclass.h:11317
MemoryStream()
Definition yateclass.h:11294
virtual bool valid() const
Definition yateclass.h:11323
virtual int64_t length()
Definition yateclass.h:11346
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:11310
int64_t m_offset
Definition yateclass.h:11366
DataBlock m_data
Definition yateclass.h:11361
virtual int readData(void *buffer, int len)
MemoryStream(const DataBlock &data)
Definition yateclass.h:11302
A Mutex pool.
Definition yateclass.h:9500
unsigned int index(void *ptr) const
Definition yateclass.h:9526
MutexPool(unsigned int len=13, bool recursive=false, const char *name=0)
Mutex * mutex(void *ptr) const
Definition yateclass.h:9536
Mutex * mutex(unsigned int idx) const
Definition yateclass.h:9544
Mutex support.
Definition yateclass.h:9403
virtual bool locked() const
Mutex & operator=(const Mutex &original)
virtual Mutex * lockableMutex()
Definition yateclass.h:9467
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:5428
NamedCounter(const String &name)
Definition yateclass.h:5435
int count() const
Definition yateclass.h:5479
int dec()
Definition yateclass.h:5464
void enable(bool val)
Definition yateclass.h:5450
int add(int val)
Definition yateclass.h:5472
bool enabled() const
Definition yateclass.h:5443
int inc()
Definition yateclass.h:5457
NamedList parameters iterator.
Definition yateclass.h:8264
NamedIterator & operator=(const NamedIterator &original)
Definition yateclass.h:8293
NamedIterator & operator=(const NamedList &list)
Definition yateclass.h:8286
const NamedString * get()
NamedIterator(const NamedIterator &original)
Definition yateclass.h:8278
void reset()
Definition yateclass.h:8311
NamedIterator(const NamedList &list)
Definition yateclass.h:8270
bool eof() const
Definition yateclass.h:8305
A named string container class.
Definition yateclass.h:7690
NamedList & setParamHex(const String &name, const void *buf, unsigned int len, char sep=0)
NamedList & setParam(const String &name, double value)
bool dump(String &str, unsigned int flags, const char *separator, const char *nameSep=0, const char *prefix=0, char quote=0) const
int64_t getInt64ValueDict(const String &name, const TokenDictStr64 *tokens, int64_t defvalue=0) const
NamedList & setParam(const String &name, bool value)
Definition yateclass.h:7952
NamedList & addParam(const char *name, double value)
Definition yateclass.h:7830
int getIntValue(const String &name, const TokenDictStr *tokens, int defvalue=0) const
virtual void * getObject(const String &name) const
NamedList & setParam(const String &name, uint32_t value)
int getIndex(const NamedString *param) const
void clearParams()
Definition yateclass.h:7757
NamedList & setParam(const String &name, int32_t value)
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:8250
NamedList & copyParam(const NamedList &original, const String &name, char childSep=0)
DumpFlags
Definition yateclass.h:7696
int64_t getInt64ValueDict(const String &name, const TokenDict64 *tokens, int64_t defvalue=0) const
NamedList & setParam(NamedString *param)
NamedList(const NamedList &original)
NamedList & setParam(const String &name, int64_t value)
NamedList & setParam(const String &name, uint64_t value)
NamedList & addParam(const char *name, uint64_t flags, const TokenDict64 *tokens, bool unknownflag=true)
Definition yateclass.h:7868
NamedList & addParam(const char *name, unsigned int flags, const TokenDict *tokens, bool unknownflag=true)
Definition yateclass.h:7853
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
NamedList & setParam(const String &name, uint64_t flags, const TokenDict64 *tokens, bool unknownflag=true)
NamedList & addParam(const char *name, uint32_t value)
Definition yateclass.h:7818
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
NamedList & addParam(const char *name, int32_t value)
Definition yateclass.h:7806
NamedList & addParam(const char *name, int64_t value)
Definition yateclass.h:7782
NamedList & addParam(const char *name, bool value)
Definition yateclass.h:7842
bool getBoolValue(const String &name, bool defvalue=false) const
double getDoubleValue(const String &name, double defvalue=0.0) const
NamedList & copyParams(const NamedList &original)
Definition yateclass.h:8027
NamedList & clearParam(const String &name, char childSep=0, const String *value=0)
NamedList & addParam(const char *name, uint64_t value)
Definition yateclass.h:7794
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:8243
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:7751
NamedList & copyParams(bool replace, const NamedList &original, bool copyUserData=false)
NamedList & setParam(const String &name, unsigned int flags, const TokenDict *tokens, bool unknownflag=true)
unsigned int length() const
Definition yateclass.h:7744
NamedList & addParamHex(const char *name, const void *buf, unsigned int len, char sep=0)
Definition yateclass.h:7883
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
A named pointer class.
Definition yateclass.h:5353
void userData(GenObject *data)
virtual void * getObject(const String &name) const
NamedPointer(const char *name, GenObject *data=0, const char *value=0, int len=-1)
GenObject * userData() const
Definition yateclass.h:5374
void * userObject(const String &name) const
Definition yateclass.h:5396
NamedPointer & operator=(const char *value)
Definition yateclass.h:5402
A named string class.
Definition yateclass.h:5304
NamedString(const char *name, const char *value=0, int len=-1)
virtual void * getObject(const String &name) const
NamedString & operator=(const char *value)
Definition yateclass.h:5338
virtual const String & toString() const
const String & name() const
Definition yateclass.h:5319
A NAPTR record.
Definition yateclass.h:12548
const String & serv() const
Definition yateclass.h:12591
bool replace(String &str) const
virtual void dump(String &buf, const char *sep=" ")
const Regexp & regexp() const
Definition yateclass.h:12598
const String & nextName() const
Definition yateclass.h:12612
const String & repTemplate() const
Definition yateclass.h:12605
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:12584
An object list class.
Definition yateclass.h:2032
virtual void * getObject(const String &name) const
GenObject * remove(Lockable &lock, GenObject *obj, bool delobj=true, long maxwait=-1)
ObjList * next() const
Definition yateclass.h:2083
void compact(Lockable &lock, long maxwait=-1)
GenObject * remove(Lockable &lock, bool delobj=true, long maxwait=-1)
ObjList * setUnique(Lockable &lock, const GenObject *obj, bool autoDelete=true, long maxwait=-1, bool compact=true)
ObjList * move(ObjList *dest, Lockable *lock=0, long maxwait=-1)
ObjList * insert(Lockable &lock, const GenObject *obj, bool autoDelete=true, long maxwait=-1, bool compact=true)
void sort(int(*callbackCompare)(GenObject *obj1, GenObject *obj2, void *context), void *context=0)
ObjList * copy(ObjList *dest, Lockable *lock=0, long maxwait=-1) const
ObjList * find(const GenObject *obj) const
GenObject * find(Lockable &lock, const String &str, bool ref=false, long maxwait=-1) 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:2250
GenObject * findObj(const GenObject *obj) const
Definition yateclass.h:2156
GenObject * operator[](signed int index) const
Definition yateclass.h:2123
void clear(Lockable &lock, long maxwait=-1)
GenObject * remove(const String &str, bool delobj=true)
ObjList * skipNext() const
GenObject * operator[](unsigned int index) const
Definition yateclass.h:2131
bool autoDelete()
Definition yateclass.h:2243
ObjList * operator+(int index) const
ObjList * append(Lockable &lock, const GenObject *obj, bool autoDelete=true, long maxwait=-1, bool compact=true)
GenObject * operator[](const String &str) const
Definition yateclass.h:2139
GenObject * get() const
Definition yateclass.h:2068
static const ObjList & empty()
GenObject * remove(Lockable &lock, const String &str, bool delobj=true, long maxwait=-1)
unsigned int count() const
GenObject * find(Lockable &lock, const GenObject *obj, bool ref=false, long maxwait=-1) 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:2403
const GenObject ** data(unsigned int offs, unsigned int len=1) const
Definition yateclass.h:2482
unsigned int cut(int items, bool reAlloc=true)
Definition yateclass.h:2537
GenObject ** data()
Definition yateclass.h:2457
virtual void * getObject(const String &name) const
bool appendObj(GenObject *obj, bool fromStart, bool beforeNonNull=false)
Definition yateclass.h:2624
const GenObject ** data() const
Definition yateclass.h:2473
unsigned int compact(bool resizeToCount=false)
Definition yateclass.h:2571
unsigned int allocChunk() const
Definition yateclass.h:2724
ObjVector(ObjList &list, bool move=true, unsigned int maxLen=0, bool autodelete=true, unsigned int allocChunk=0)
void reset(unsigned int pos=0, int len=-1)
GenObject * operator[](unsigned int idx) const
Definition yateclass.h:2673
ObjVector(bool autodelete=true, unsigned int allocChunk=0)
Definition yateclass.h:2411
int index(const String &str) const
unsigned int size() const
Definition yateclass.h:2738
GenObject ** data(unsigned int offs, unsigned int len=1)
Definition yateclass.h:2466
unsigned int compact(unsigned int pos, int len)
void setDelete(bool autodelete)
Definition yateclass.h:2717
unsigned int cut(unsigned int pos, unsigned int items, bool reAlloc=true)
GenObject * operator[](signed int idx) const
Definition yateclass.h:2681
bool autoDelete()
Definition yateclass.h:2710
void allocChunk(unsigned int count)
Definition yateclass.h:2731
unsigned int insert(unsigned int pos, unsigned int items)
ObjVector(unsigned int maxLen, bool autodelete=true, unsigned int allocChunk=0)
GenObject * operator[](const String &str) const
Definition yateclass.h:2689
bool appendObj(GenObject *obj)
Definition yateclass.h:2611
int indexFree(bool fromStart, bool beforeNonNull=false) const
bool set(GenObject *obj, unsigned int index)
GenObject * take(unsigned int index)
Definition yateclass.h:2591
unsigned int count() const
bool insertObj(GenObject *obj, unsigned int pos)
Definition yateclass.h:2638
int index(const GenObject *obj) const
GenObject * at(unsigned int index) const
Definition yateclass.h:2502
unsigned int length() const
Definition yateclass.h:2450
unsigned int assign(ObjList &list, bool move=true, unsigned int maxLen=0)
unsigned int resize(unsigned int len, bool keepData=false, bool reAlloc=true)
Definition yateclass.h:2555
Definition yateclass.h:9799
void drop()
Definition yateclass.h:9833
bool acquire(RWLock *lck, long maxwait=-1)
Definition yateclass.h:9842
~RLock()
Definition yateclass.h:9820
RLock(RWLock *lck, long maxwait=-1)
Definition yateclass.h:9814
RLock(RWLock &lck, long maxWait=-1)
Definition yateclass.h:9806
RWLock * locked() const
Definition yateclass.h:9827
bool acquire(RWLock &lck, long maxwait=-1)
Definition yateclass.h:9852
A RWLock pool.
Definition yateclass.h:9943
unsigned int index(void *ptr) const
Definition yateclass.h:9967
RWLock * lock(unsigned int idx) const
Definition yateclass.h:9985
RWLockPool(unsigned int len=13, const char *name=0)
RWLock * lock(void *ptr) const
Definition yateclass.h:9977
Read/write lock support.
Definition yateclass.h:9720
virtual bool locked() const
static void disableRWLock(bool disable)
virtual RWLock * lockableRWLock()
Definition yateclass.h:9779
RWLock(const RWLock &original)
bool readLock(long maxWait=-1)
RWLock(const char *name=0)
virtual bool lock(long maxWait=-1)
Definition yateclass.h:9765
bool writeLock(long maxWait=-1)
Pseudo random number generator.
Definition yateclass.h:6023
u_int32_t get() const
Definition yateclass.h:6037
void set(u_int32_t seed)
Definition yateclass.h:6044
Random(u_int32_t seed=Time::now() &0xffffffff)
Definition yateclass.h:6029
static void srandom(unsigned int seed)
Definition yateclass.h:1752
static bool efficientIncDec()
static bool alive(const RefObject *obj)
Definition yateclass.h:1815
virtual void * getObject(const String &name) const
virtual bool alive() const
int refcount() const
Definition yateclass.h:1801
Internal helper class.
Definition yateclass.h:1858
RefPointerBase()
Definition yateclass.h:1863
void * m_pointer
Definition yateclass.h:1877
void assign(RefObject *oldptr, RefObject *newptr, void *pointer)
Templated smart pointer class.
Definition yateclass.h:1884
RefPointer< Obj > & operator=(Obj *object)
Definition yateclass.h:1937
RefPointer< Obj > & operator=(const RefPointer< Obj > &value)
Definition yateclass.h:1931
Obj & operator*() const
Definition yateclass.h:1956
Obj * pointer() const
Definition yateclass.h:1890
void assign(Obj *object=0)
Definition yateclass.h:1897
~RefPointer()
Definition yateclass.h:1925
RefPointer()
Definition yateclass.h:1904
Obj * operator->() const
Definition yateclass.h:1950
RefPointer(const RefPointer< Obj > &value)
Definition yateclass.h:1911
RefPointer(Obj *object)
Definition yateclass.h:1919
A regexp matching class.
Definition yateclass.h:5094
bool isCaseInsensitive() const
Regexp(const char *value, bool extended=false, bool insensitive=false)
bool compile() const
Definition yateclass.h:5132
void setFlags(bool extended, bool insensitive)
Regexp(const Regexp &value)
Regexp & operator=(const char *value)
Definition yateclass.h:5125
bool matches(const char *value) const
virtual bool matches(const String &value) const
Definition yateclass.h:5147
DNS services.
Definition yateclass.h:12631
static bool init(int timeout=-1, int retries=-1)
static int naptrQuery(const char *dname, ObjList &result, String *error=0)
Type
Definition yateclass.h:12636
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:10171
A standard SHA1 digest calculator.
Definition yateclass.h:7437
SHA1 & operator=(const SHA1 &original)
SHA1(const void *buf, unsigned int len)
static unsigned int rawLength()
Definition yateclass.h:7501
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:7508
A standard SHA256 digest calculator.
Definition yateclass.h:7534
static unsigned int rawLength()
Definition yateclass.h:7598
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:7605
Abstract SCTP Socket.
Definition yateclass.h:12228
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:12234
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:12280
SctpSocket(SOCKET fd)
Definition yateclass.h:12241
virtual bool bindx(ObjList &addresses)=0
Semaphore implementation.
Definition yateclass.h:9558
virtual bool locked() const
Semaphore(const Semaphore &original)
static bool efficientTimedLock()
Semaphore & operator=(const Semaphore &original)
virtual Semaphore * lockableSemaphore()
Definition yateclass.h:9611
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:10588
static unsigned int scopeId(struct sockaddr *addr)
Definition yateclass.h:10884
static const char * lookupFamily(int family)
Definition yateclass.h:10984
bool iface(const char *name, bool uriUnescape=false)
Definition yateclass.h:10776
int copyAddr(DataBlock &addr) const
static String & appendAddr(String &buf, const String &addr, int family=Unknown, const String &iface=String::empty())
static bool scopeId(struct sockaddr *addr, unsigned int val)
Definition yateclass.h:10898
bool operator!=(const SocketAddr &other) const
Definition yateclass.h:10665
SocketAddr(int family, const void *raw=0)
static String & appendTo(String &buf, const String &addr, int port, int family=Unknown, const String &iface=String::empty())
Definition yateclass.h:10928
bool valid() const
Definition yateclass.h:10705
socklen_t length() const
Definition yateclass.h:10817
virtual void updateAddr(bool full=false) const
static bool isNullAddr(const String &addr, int family=Unknown)
static String appendTo(const String &addr, int port, int family=Unknown, const String &iface=String::empty())
Definition yateclass.h:10942
struct sockaddr * address() const
Definition yateclass.h:10810
static bool stringify(String &buf, struct sockaddr *addr)
static int unStringify(uint8_t *buf, const String &host, int family=Unknown)
Definition yateclass.h:10864
bool operator==(const SocketAddr &other) const
SocketAddr & operator=(const SocketAddr &value)
Definition yateclass.h:10650
int family() const
Definition yateclass.h:10719
bool null() const
Definition yateclass.h:10712
bool assign(const DataBlock &addr)
Family
Definition yateclass.h:10594
const String & addr(bool full=false) const
Definition yateclass.h:10756
unsigned int scopeId() const
Definition yateclass.h:10733
SocketAddr(const SocketAddr &value)
Definition yateclass.h:10622
const char * familyName() const
Definition yateclass.h:10726
static int family(const String &addr)
const String & host() const
Definition yateclass.h:10748
bool scopeId(unsigned int val)
Definition yateclass.h:10741
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)
static const char * ifaceNameExtraEscape()
Definition yateclass.h:11009
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 & iface() const
Definition yateclass.h:10767
static const String & ipv4NullAddr()
bool local(const SocketAddr &remote)
static const String & ipv6NullAddr()
static String & escapeIface(String &buf, const char *name)
Definition yateclass.h:11018
SocketAddr()
Definition yateclass.h:10614
bool isNullAddr() const
Definition yateclass.h:10824
A filter for received socket data.
Definition yateclass.h:11051
virtual void * getObject(const String &name) const
virtual bool received(const void *buffer, int length, int flags, const struct sockaddr *addr, socklen_t adrlen)=0
virtual bool sent(const void *buffer, int length, int flags, const struct sockaddr *addr, socklen_t adrlen)
Definition yateclass.h:11098
Socket * socket() const
Definition yateclass.h:11105
virtual void timerTick(const Time &when)
RefObject holding a Socket pointer.
Definition yateclass.h:12340
virtual void * getObject(const String &name) const
Definition yateclass.h:12363
SocketRef(Socket *&socket)
Definition yateclass.h:12354
SocketRef(Socket **socket)
Definition yateclass.h:12346
A generic socket class.
Definition yateclass.h:11610
virtual bool connectAsync(struct sockaddr *addr, socklen_t addrlen, unsigned int toutUs, bool *timeout=0)
static const TokenDict * tosValues()
bool connectAsync(const SocketAddr &addr, unsigned int toutUs, bool *timeout=0)
Definition yateclass.h:11998
void clearFilters(bool del=true)
bool installFilter(SocketFilter *filter)
void attach(SOCKET handle)
virtual bool setReuse(bool reuse=true, bool exclusive=false, bool setPort=false)
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:11627
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:11891
Features
Definition yateclass.h:11659
virtual bool bindIface(const char *iface, int ifLen=-1, int family=SocketAddr::Unknown)
bool getSockName(SocketAddr &addr)
virtual bool inProgress() const
virtual bool shutdown(bool stopReads, bool stopWrites)
SOCKET handle() const
Definition yateclass.h:11723
int sendTo(const void *buffer, int length, const SocketAddr &addr, int flags=0)
Definition yateclass.h:12066
bool setIpv6OnlyOption(bool on)
Definition yateclass.h:11780
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 bind(struct sockaddr *addr, socklen_t addrlen, const char *iface, int ifLen=-1)
virtual bool getSockName(struct sockaddr *addr, socklen_t *addrlen)
static unsigned int features()
Definition yateclass.h:12185
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)
virtual bool canRetry() const
virtual bool getParams(const String ¶ms, NamedList &result)
Definition yateclass.h:11812
virtual bool setTOS(int tos)
virtual bool setOption(int level, int name, const void *value=0, socklen_t length=0)
bool applyFilters(const void *buffer, int length, int flags, const struct sockaddr *addr=0, socklen_t adrlen=0, bool rx=true)
virtual bool setParams(const NamedList ¶ms)
Definition yateclass.h:11803
virtual void timerTick(const Time &when)
virtual bool setBlocking(bool block=true)
virtual Socket * accept(SocketAddr &addr)
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:11616
virtual bool setLinger(int seconds=-1)
bool setTOS(const char *tos, int defTos=Normal)
Definition yateclass.h:11828
bool connect(const SocketAddr &addr)
Definition yateclass.h:11975
virtual bool getBoundIface(String &buf)
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:12491
SrvRecord(int ttl, int prio, int weight, const char *addr, int port)
Definition yateclass.h:12503
int port() const
Definition yateclass.h:12518
static void copy(ObjList &dest, const ObjList &src)
virtual void dump(String &buf, const char *sep=" ")
const String & address() const
Definition yateclass.h:12511
An abstract stream class capable of reading and writing.
Definition yateclass.h:11123
int writeData(const DataBlock &buf)
Definition yateclass.h:11205
static bool allocPipe(Stream *&reader, Stream *&writer)
virtual int readData(void *buffer, int length)=0
int error() const
Definition yateclass.h:11143
SeekPos
Definition yateclass.h:11128
virtual bool inProgress() const
Stream()
Definition yateclass.h:11270
static bool supportsPipes()
virtual bool terminate()=0
virtual int writeData(const void *buffer, int length)=0
void clearError()
Definition yateclass.h:11277
int writeData(const String &str)
Definition yateclass.h:11197
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:11235
A C-style string handling class.
Definition yateclass.h:3055
String & removeChars(const char *what, int wLen=-1, bool *chg=0)
Definition yateclass.h:3943
const char * c_str() const
Definition yateclass.h:3160
String & printf(unsigned int length, const char *format,...)
double toDouble(double defvalue=0.0) const
String & printfAppend(const char *format,...)
String & appendFixed(unsigned int fixedLength, const String &str, char fill=' ', int align=Left)
Definition yateclass.h:3853
bool checkBOM() const
Definition yateclass.h:3263
int find(const char *what, unsigned int offs=0) const
String & operator=(bool value)
Definition yateclass.h:3570
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 & replaceChars(const char *what, const char *repl, bool inPlace=false, int wLen=-1, int rLen=-1, bool *chg=0)
static unsigned int c_skip(const char *&str, const char *what, int lenStr=-1, int lenWhat=-1, bool caseInsensitive=false)
Definition yateclass.h:4289
String & operator>>(int &store)
static bool stripBOM(char *&str)
Definition yateclass.h:3279
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:3478
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 & operator+=(int64_t value)
static String sqlEscape(const char *str, char extraEsc=0)
ObjList * split(ObjList &list, const Regexp ®, bool emptyOK=true) const
ObjList * split(char separator, bool emptyOK=true) const
Definition yateclass.h:4063
static String uriEscape(const char *str, char extraEsc=0, const char *noEsc=0)
Definition yateclass.h:4170
static String uriEscape(const char *str, const char *extraEsc, const char *noEsc=0)
Definition yateclass.h:4182
bool operator==(const char *value) const
static bool checkBOM(const char *str)
Definition yateclass.h:3256
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
static unsigned int c_starts_with(const char *str, const char *what, int lenStr=-1, int lenWhat=-1, bool caseInsensitive=false)
String & extractTo(const char *sep, double &store)
int rfind(const char *what) const
String & operator+=(const char *value)
Definition yateclass.h:3584
String & extractTo(const char *sep, String &store)
String & append(const ObjList &list, const char *separator=0, bool force=false)
Definition yateclass.h:3771
String & operator<<(const char *value)
Definition yateclass.h:3665
String & insert(unsigned int pos, char value, unsigned int len=1)
ObjList * split(const Regexp ®, bool emptyOK=true) const
Definition yateclass.h:4075
String matchString(int index=0) const
Definition yateclass.h:4023
String & operator<<(int32_t value)
Definition yateclass.h:3677
String & operator=(int64_t value)
bool null() const
Definition yateclass.h:3189
String & operator+=(uint64_t value)
String & operator=(uint32_t value)
const char * safe() const
Definition yateclass.h:3167
int lenUtf8(uint32_t maxChar=0x10ffff, bool overlong=false) const
Definition yateclass.h:3207
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)
int64_t toInt64Dict(const TokenDictStr64 *tokens, int64_t defvalue=0, int base=0) const
static String & uriEscapeTo(String &buf, const char *str, const char *extraEsc, const char *noEsc=0)
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)
static char * c_replace_chars(const char *str, const char *what, const char *repl=0, bool inPlace=false, int wLen=-1, int rLen=-1, bool *chg=0)
String & hexify(const void *data, unsigned int len, char sep=0, bool upCase=false)
static String uriUnescape(const char *str, int *errptr=0, bool setPartial=true)
Definition yateclass.h:4234
String sqlEscape(char extraEsc=0) const
Definition yateclass.h:4128
String & operator=(const char *value)
bool operator==(const String &value) const
Definition yateclass.h:3643
String uriUnescape(int *errptr=0, bool setPartial=true) const
Definition yateclass.h:4245
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:3649
String & insert(unsigned int pos, const char *value, int len=-1)
virtual const String & toString() const
bool stripBOM()
Definition yateclass.h:3286
String & operator>>(unsigned int &store)
String & uriEscapeTo(String &buf, char extraEsc=0, const char *noEsc=0) const
Definition yateclass.h:4160
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)
int64_t toInt64Dict(const TokenDict64 *tokens, int64_t defvalue=0, int base=0) const
static unsigned int c_ends_with(const char *str, const char *what, int lenStr=-1, int lenWhat=-1, bool caseInsensitive=false)
String(const char *value, int len=-1)
String & operator<<(uint32_t value)
Definition yateclass.h:3683
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:3695
String & operator<<(double value)
Definition yateclass.h:3707
String & append(char value, unsigned int len=1)
Definition yateclass.h:3780
String(char value, unsigned int repeat=1)
int toInteger(const TokenDictStr *tokens, int defvalue=0, int base=0) const
String & append(const char *value, int len)
String & operator>>(char &store)
static const char * boolText(bool value)
Definition yateclass.h:3153
static unsigned int c_skip_chars(const char *&str, const char *what, int len=-1, bool skipFound=true)
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:3271
String & operator=(char value)
int toInteger(const TokenDict *tokens, int defvalue=0, int base=0) const
String & uriUnescapeStr(bool setPartial=false, int *errptr=0)
Definition yateclass.h:4224
unsigned int hash() const
Definition yateclass.h:3293
String uriEscape(char extraEsc=0, const char *noEsc=0) const
Definition yateclass.h:4193
String & operator=(const String &value)
Definition yateclass.h:3518
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 & decodeFlags(unsigned int flags, const TokenDict *tokens, bool unknownflag=true)
String & operator=(uint64_t value)
String & operator+=(char value)
String & operator<<(bool value)
Definition yateclass.h:3701
bool startsWith(const char *what, bool wordBreak=false, bool caseInsensitive=false) const
String & decodeFlags(uint64_t flags, const TokenDict64 *tokens, bool unknownflag=true)
String & operator>>(UChar &store)
int matchLength(int index=0) const
static const String & empty()
const char * safe(const char *defStr) const
Definition yateclass.h:3175
char operator[](signed int index) const
Definition yateclass.h:3470
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)
ObjList * split(ObjList &list, char separator, bool emptyOK=true) const
unsigned int encodeFlags(const TokenDict *tokens) const
unsigned int length() const
Definition yateclass.h:3182
String & printfAppend(unsigned int length, const char *format,...)
static String & uriEscapeTo(String &buf, const char *str, char extraEsc=0, const char *noEsc=0)
String & operator+=(bool value)
Definition yateclass.h:3621
bool operator!=(const char *value) const
String & operator<<(char value)
Definition yateclass.h:3671
String msgEscape(char extraEsc=0) const
Definition yateclass.h:4094
String & operator=(double value)
bool matches(const Regexp &rexp)
String & operator<<(int64_t value)
Definition yateclass.h:3689
String msgUnescape(int *errptr=0, char extraEsc=0) const
Definition yateclass.h:4112
String & printf(const char *format,...)
virtual bool matches(const String &value) const
Definition yateclass.h:3994
String & operator=(const String *value)
Definition yateclass.h:3526
String & uriUnescapeTo(String &buf, bool setPartial=false, int *errptr=0) const
Definition yateclass.h:4215
static String & uriUnescapeTo(String &buf, const char *str, bool setPartial=false, int *errptr=0)
String substr(int offs, int len=-1) const
A class exposing system resources usage.
Definition yateclass.h:13033
static u_int64_t usecRunTime(Type type=WallTime)
Type
Definition yateclass.h:13038
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:10540
TempObjectCounter(const GenObject *obj, bool enable=GenObject::getObjCounting())
Definition yateclass.h:10557
TempObjectCounter(const GenObject &obj, bool enable=GenObject::getObjCounting())
Definition yateclass.h:10566
TempObjectCounter(NamedCounter *counter, bool enable=GenObject::getObjCounting())
Definition yateclass.h:10548
~TempObjectCounter()
Definition yateclass.h:10573
Thread support class.
Definition yateclass.h:10192
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:10202
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:10494
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:10262
int getAffinity(DataBlock &outCpuMask)
const char * name() const
bool locked() const
Definition yateclass.h:10269
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:10424
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:5764
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:5846
Time()
Definition yateclass.h:5769
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:5853
static unsigned int appendTo(String &buf, uint64_t time, int frac=0)
Definition yateclass.h:5980
Time & operator=(u_int64_t usec)
Definition yateclass.h:5834
Time(u_int64_t usec)
Definition yateclass.h:5777
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:5815
static u_int64_t fromTimeval(const struct timeval &tv)
Definition yateclass.h:5875
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:5793
u_int64_t usec() const
Definition yateclass.h:5822
Time(const struct timeval *tv)
Definition yateclass.h:5785
Time & operator+=(int64_t delta)
Definition yateclass.h:5840
uint32_t toNtp(uint32_t *over=0, bool rfc2030=true)
Definition yateclass.h:5943
static u_int64_t fromTimeval(const struct timeval *tv)
u_int32_t sec() const
Definition yateclass.h:5808
static u_int32_t secNow()
static bool isLeap(unsigned int year)
Definition yateclass.h:6004
~Time()
Definition yateclass.h:5801
static u_int64_t msecNow()
A text based DNS record.
Definition yateclass.h:12445
TxtRecord(int ttl, const char *text)
Definition yateclass.h:12454
static void copy(ObjList &dest, const ObjList &src)
virtual void dump(String &buf, const char *sep=" ")
const String & text() const
Definition yateclass.h:12462
A single Unicode character.
Definition yateclass.h:2887
const char * c_str() const
Definition yateclass.h:2953
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:2939
UChar(uint32_t code=0)
Definition yateclass.h:2898
UChar(int32_t code)
Definition yateclass.h:2906
UChar & operator=(uint32_t code)
Definition yateclass.h:2931
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:2922
bool decode(DataBlock &buff, Endianness order, uint32_t maxChar=0x10ffff)
bool encode(DataBlock &buff, Endianness order)
uint32_t code() const
Definition yateclass.h:2946
UChar(signed char code)
Definition yateclass.h:2914
Encapsulation for an URI.
Definition yateclass.h:8326
static void setup(const NamedList ¶ms)
virtual void clearData() const
const String & getUser() const
Definition yateclass.h:8405
URI(const char *proto, const char *user, const char *host, int port=0, const char *desc=0)
const String & getExtra() const
Definition yateclass.h:8426
URI & operator=(const String &value)
Definition yateclass.h:8377
const String & getDescription() const
Definition yateclass.h:8391
URI & operator=(const URI &value)
Definition yateclass.h:8370
URI & operator=(const char *value)
Definition yateclass.h:8384
int getPort() const
Definition yateclass.h:8419
const String & getProtocol() const
Definition yateclass.h:8398
const String & getHost() const
Definition yateclass.h:8412
Definition yateclass.h:9870
void drop()
Definition yateclass.h:9904
bool acquire(RWLock *lck, long maxWait=-1)
Definition yateclass.h:9913
~WLock()
Definition yateclass.h:9891
RWLock * locked() const
Definition yateclass.h:9898
WLock(RWLock *lck, long maxWait=-1)
Definition yateclass.h:9885
WLock(RWLock &lck, long maxWait=-1)
Definition yateclass.h:9877
bool acquire(RWLock &lck, long maxWait=-1)
Definition yateclass.h:9923
An atomic number.
Definition yateclass.h:1228
YAtomicNumber(const YAtomicNumber &val)
Definition yateclass.h:1249
Type operator++()
Definition yateclass.h:1563
Type operator|=(Type val)
Definition yateclass.h:1602
Type operator&=(Type val)
Definition yateclass.h:1595
Type valueAtomic() const
Definition yateclass.h:1278
Type preAdd(Type val)
Definition yateclass.h:1450
YAtomicNumber & operator=(Type val)
Definition yateclass.h:1543
Type operator^=(Type val)
Definition yateclass.h:1609
Type operator-=(Type val)
Definition yateclass.h:1588
Type preBitAnd(Type val)
Definition yateclass.h:1482
Type dec()
Definition yateclass.h:1333
Type operator--(int)
Definition yateclass.h:1581
Type value() const
Definition yateclass.h:1257
Type bitOr(Type val)
Definition yateclass.h:1392
Type preSub(Type val)
Definition yateclass.h:1466
YAtomicNumber & operator=(const YAtomicNumber &val)
Definition yateclass.h:1550
YAtomicNumber(Type val)
Definition yateclass.h:1241
Type valueAtomic()
Definition yateclass.h:1291
Type preBitOr(Type val)
Definition yateclass.h:1498
Type operator--()
Definition yateclass.h:1569
Type add(Type val)
Definition yateclass.h:1347
YAtomicNumber()
Definition yateclass.h:1233
Type preBitXor(Type val)
Definition yateclass.h:1514
Type sub(Type val)
Definition yateclass.h:1362
Type preDec()
Definition yateclass.h:1435
Type operator++(int)
Definition yateclass.h:1575
Type value()
Definition yateclass.h:1264
Type operator+=(Type val)
Definition yateclass.h:1557
Type inc()
Definition yateclass.h:1320
Type & valueRef()
Definition yateclass.h:1271
Type set(Type val)
Definition yateclass.h:1305
Type bitXor(Type val)
Definition yateclass.h:1407
Type preInc()
Definition yateclass.h:1421
Type bitAnd(Type val)
Definition yateclass.h:1377
Complex operator+(const Complex &c1, const Complex &c2)
Definition yatemath.h:1567
Definition yateclass.h:908
const char * token
Definition yateclass.h:912
int64_t value
Definition yateclass.h:917
Definition yateclass.h:5029
String token
Definition yateclass.h:5033
int64_t value
Definition yateclass.h:5038
Definition yateclass.h:5012
String token
Definition yateclass.h:5016
int value
Definition yateclass.h:5021
Definition yateclass.h:891
const char * token
Definition yateclass.h:895
int value
Definition yateclass.h:900