26 #error C++ is required
30 #include <sys/types.h>
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)
61 typedef signed __int8 int8_t;
62 typedef unsigned __int8 u_int8_t;
63 typedef unsigned __int8 uint8_t;
64 typedef signed __int16 int16_t;
65 typedef unsigned __int16 u_int16_t;
66 typedef unsigned __int16 uint16_t;
67 typedef signed __int32 int32_t;
68 typedef unsigned __int32 u_int32_t;
69 typedef unsigned __int32 uint32_t;
70 typedef signed __int64 int64_t;
71 typedef unsigned __int64 u_int64_t;
72 typedef unsigned __int64 uint64_t;
75 typedef int socklen_t;
76 typedef unsigned long in_addr_t;
79 #define strcasecmp _stricmp
83 #define strncasecmp _strnicmp
86 #define vsnprintf _vsnprintf
87 #define snprintf _snprintf
88 #define strdup _strdup
89 #define strtoll _strtoi64
90 #define strtoull _strtoui64
96 #define getpid _getpid
98 #define mkdir(p,m) _mkdir(p)
99 #define unlink _unlink
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)
125 #define FMT64 "%I64d"
126 #define FMT64U "%I64u"
130 #include <sys/time.h>
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__)
162 #define FMT64U "%llu"
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
192 #define O_LARGEFILE 0
195 #ifndef IPTOS_LOWDELAY
196 #define IPTOS_LOWDELAY 0x10
197 #define IPTOS_THROUGHPUT 0x08
198 #define IPTOS_RELIABILITY 0x04
200 #ifndef IPTOS_MINCOST
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)
260 DebugGoOn = DebugCrit,
289 YATE_API
bool debugAt(
int level);
320 : m_level(DebugFail), m_enabled(enabled), m_chain(0), m_name(0)
324 { m_name = 0; m_chain = 0; }
331 {
return m_chain ? m_chain->debugLevel() : m_level; }
345 {
return m_chain ? m_chain->debugEnabled() : m_enabled; }
352 { m_enabled = enable; m_chain = 0; }
373 {
return m_chain != 0; }
380 { m_chain = (chain !=
this) ? chain : 0; }
409 void DDebug(
int level,
const char* format, ...);
416 void DDebug(
const char* facility,
int level,
const char* format, ...);
423 void DDebug(
const DebugEnabler* local,
int level,
const char* format, ...);
430 void XDebug(
int level,
const char* format, ...);
437 void XDebug(
const char* facility,
int level,
const char* format, ...);
444 void XDebug(
const DebugEnabler* local,
int level,
const char* format, ...);
451 void NDebug(
int level,
const char* format, ...);
458 void NDebug(
const char* facility,
int level,
const char* format, ...);
465 void NDebug(
const DebugEnabler* local,
int level,
const char* format, ...);
468 #if defined(_DEBUG) || defined(DEBUG) || defined(XDEBUG)
477 #define DDebug do { break; } while
479 #define DDebug(arg...)
487 #define XDebug do { break; } while
489 #define XDebug(arg...)
497 #define NDebug do { break; } while
499 #define NDebug(arg...)
508 YATE_API
void Debug(
int level,
const char* format, ...) FORMAT_CHECK(2);
516 YATE_API
void Debug(const
char* facility,
int level, const
char* format, ...) FORMAT_CHECK(3);
524 YATE_API
void Debug(const DebugEnabler* local,
int level, const
char* format, ...) FORMAT_CHECK(3);
532 YATE_API
void Alarm(const
char* component,
int level, const
char* format, ...) FORMAT_CHECK(3);
540 YATE_API
void Alarm(const DebugEnabler* component,
int level, const
char* format, ...) FORMAT_CHECK(3);
549 YATE_API
void Alarm(const
char* component, const
char* info,
int level, const
char* format, ...) FORMAT_CHECK(4);
558 YATE_API
void Alarm(const DebugEnabler* component, const
char* info,
int level, const
char* format, ...) FORMAT_CHECK(4);
564 YATE_API
void Output(const
char* format, ...) FORMAT_CHECK(1);
572 YATE_API
void TraceDebug(const
char* traceId,
int level, const
char* format, ...) FORMAT_CHECK(3);
581 YATE_API
void TraceDebug(const
char* traceId, const
char* facility,
int level,
582 const
char* format, ...) FORMAT_CHECK(4);
591 YATE_API
void TraceDebug(const
char* traceId, const DebugEnabler* local,
int level,
592 const
char* format, ...) FORMAT_CHECK(4);
602 void TraceDebugObj(GenObject* obj,
int level,
const char* format, ...);
611 void TraceDebugObj(GenObject* obj,
const char* facility,
int level,
const char* format, ...);
620 void TraceDebugObj(GenObject* obj,
const DebugEnabler* local,
int level,
const char* format, ...);
628 void Trace(GenObject* obj,
int level,
const char* format, ...);
637 void Trace(GenObject* obj,
const char* facility,
int level,
const char* format, ...);
646 void Trace(GenObject* obj,
const DebugEnabler* local,
int level,
const char* format, ...);
654 void TraceObj(GenObject* obj,
int level,
const char* format, ...);
663 void TraceObj(GenObject* obj,
const char* facility,
int level,
const char* format, ...);
672 void TraceObj(GenObject* obj,
const DebugEnabler* local,
int level,
const char* format, ...);
676 #define TraceDebugObj(pGenObj,...) \
677 TraceDebug((!!(pGenObj)) ? (pGenObj)->traceId() : "",##__VA_ARGS__)
679 #define Trace(traceId,...) \
680 do { if (!TelEngine::null(traceId)) TraceDebug(traceId,##__VA_ARGS__); } while(false)
682 #define TraceObj(pGenObj,...) \
683 do { if (!!(pGenObj) && (pGenObj)->traceId()) TraceDebug((pGenObj)->traceId(),##__VA_ARGS__); } while (false)
694 YATE_API
void TraceAlarm(
const char* traceId,
const char* component,
int level,
695 const char* format, ...) FORMAT_CHECK(4);
704 YATE_API
void TraceAlarm(const
char* traceId, const DebugEnabler* component,
705 int level, const
char* format, ...) FORMAT_CHECK(4);
715 YATE_API
void TraceAlarm(const
char* traceId, const
char* component, const
char* info,
716 int level, const
char* format, ...) FORMAT_CHECK(5);
726 YATE_API
void TraceAlarm(const
char* traceId, const DebugEnabler* component,
727 const
char* info,
int level, const
char* format, ...) FORMAT_CHECK(5);
756 explicit Debugger(
const char* name,
const char* format = 0, ...);
764 Debugger(
int level,
const char* name,
const char* format = 0, ...);
775 static void setOutput(
void (*outFunc)(
const char*,
int) = 0);
781 static void setIntOut(
void (*outFunc)(
const char*,
int) = 0);
787 static void setAlarmHook(
void (*alarmFunc)(
const char*,
int,
const char*,
const char*) = 0);
793 static void setRelayHook(
void (*relayFunc)(
int,
const char*,
const char*,
const char*) = 0);
800 static void enableOutput(
bool enable =
true,
bool colorize =
false);
806 static uint32_t getStartTimeSec();
812 static Formatting getFormatting();
819 static void setFormatting(Formatting format, uint32_t startTimeSec = 0);
827 static unsigned int formatTime(
char* buf, Formatting format = getFormatting());
837 static void relayOutput(
int level,
char* buffer,
const char* component = 0,
const char* info = 0);
895 constant
YSTRING(
const char*
string);
902 constant
YATOM(
const char*
string);
909 void YCLASS(
class type,
class base);
917 void YCLASS2(
class type,
class base1,
class base2);
926 void YCLASS3(
class type,
class base1,
class base2,
class base3);
941 void YCLASSIMP2(
class type,
class base1,
class base2);
950 void YCLASSIMP3(
class type,
class base1,
class base2,
class base3);
967 #define YCLASS(type,base) \
968 public: virtual void* getObject(const String& name) const \
969 { return (name == YATOM(#type)) ? const_cast<type*>(this) : base::getObject(name); }
971 #define YCLASS2(type,base1,base2) \
972 public: virtual void* getObject(const String& name) const \
973 { if (name == YATOM(#type)) return const_cast<type*>(this); \
974 void* tmp = base1::getObject(name); \
975 return tmp ? tmp : base2::getObject(name); }
977 #define YCLASS3(type,base1,base2,base3) \
978 public: virtual void* getObject(const String& name) const \
979 { if (name == YATOM(#type)) return const_cast<type*>(this); \
980 void* tmp = base1::getObject(name); \
981 if (tmp) return tmp; \
982 tmp = base2::getObject(name); \
983 return tmp ? tmp : base3::getObject(name); }
985 #define YCLASSIMP(type,base) \
986 void* type::getObject(const String& name) const \
987 { return (name == YATOM(#type)) ? const_cast<type*>(this) : base::getObject(name); }
989 #define YCLASSIMP2(type,base1,base2) \
990 void* type::getObject(const String& name) const \
991 { if (name == YATOM(#type)) return const_cast<type*>(this); \
992 void* tmp = base1::getObject(name); \
993 return tmp ? tmp : base2::getObject(name); }
995 #define YCLASSIMP3(type,base1,base2,base3) \
996 void* type::getObject(const String& name) const \
997 { if (name == YATOM(#type)) return const_cast<type*>(this); \
998 void* tmp = base1::getObject(name); \
999 if (tmp) return tmp; \
1000 tmp = base2::getObject(name); \
1001 return tmp ? tmp : base3::getObject(name); }
1003 #define YOBJECT(type,pntr) (static_cast<type*>(GenObject::getObject(YATOM(#type),pntr)))
1005 #define YNOCOPY(type) private: \
1006 type(const type&); \
1007 void operator=(const type&)
1017 return (uint32_t)(((val ^ (val >> 48)) ^ (val >> 32)) ^ (val >> 16));
1027 return (uint32_t)((val ^ (val >> 16)) ^ (val << 16));
1037 #if (_WORDSIZE == 64)
1068 virtual bool alive()
const;
1081 virtual const String& toString()
const;
1087 virtual const String& traceId()
const;
1094 virtual void* getObject(
const String& name)
const;
1103 {
return obj ? obj->
getObject(name) : 0; }
1110 {
return s_counting; }
1117 { s_counting = enable; }
1124 {
return m_counter; }
1145 static ObjList& getObjCounters();
1149 static bool s_counting;
1167 {
if (obj) { obj->destruct(); obj = 0; } }
1193 virtual void* getObject(
const String& name)
const;
1201 virtual bool alive()
const;
1224 {
return m_refcount; }
1238 {
return obj && (obj->
refcount() > 0); }
1245 static bool efficientIncDec();
1253 virtual void zeroRefs();
1267 virtual void destroyed();
1313 {
return static_cast<Obj*
>(
m_pointer); }
1360 {
assign(
object);
return *
this; }
1366 inline operator Obj*()
const
1421 { m_pointer = value;
return *
this; }
1427 { m_pointer = object;
return *
this; }
1433 inline operator Obj*()
const
1434 {
return m_pointer; }
1440 {
return m_pointer; }
1446 {
return *m_pointer; }
1472 virtual void* getObject(
const String& name)
const;
1478 unsigned int length()
const;
1484 unsigned int count()
const;
1546 {
return at(index); }
1554 {
return at(index); }
1589 int index(
const String& str)
const;
1653 {
return m_delete; }
1660 { m_delete = autodelete; }
1666 static const ObjList& empty();
1680 void sort(
int (*callbackCompare)(
GenObject* obj1,
GenObject* obj2,
void* context),
void* context = 0);
1700 : m_length(0), m_objects(0), m_delete(autodelete)
1708 ObjVector(
unsigned int maxLen,
bool autodelete =
true);
1717 ObjVector(
ObjList& list,
bool move =
true,
unsigned int maxLen = 0,
bool autodelete =
true);
1729 virtual void* getObject(
const String& name)
const;
1736 {
return m_length; }
1742 unsigned int count()
const;
1756 {
return (index >= 0 && index < (
int)m_length) ? m_objects[index] : 0; }
1764 {
return at(index); }
1772 {
return at(index); }
1781 unsigned int assign(
ObjList& list,
bool move =
true,
unsigned int maxLen = 0);
1796 bool set(
GenObject* obj,
unsigned int index);
1810 int index(
const String& str)
const;
1822 {
return m_delete; }
1829 { m_delete = autodelete; }
1832 unsigned int m_length;
1853 explicit Array(
int columns = 0,
int rows = 0);
1865 virtual void* getObject(
const String& name)
const;
1873 bool addRow(
ObjList* row = 0,
int index = -1);
1881 bool addColumn(
ObjList* column = 0,
int index = -1);
1888 bool delRow(
int index);
1895 bool delColumn(
int index);
1903 GenObject*
get(
int column,
int row)
const;
1920 bool set(
GenObject* obj,
int column,
int row);
1934 {
return m_columns; }
1944 if (column >= 0 || column < m_columns)
1945 return static_cast<ObjList*
>(m_obj[column]);
1956 class StringMatchPrivate;
1974 inline explicit UChar(uint32_t code = 0)
1983 : m_chr((code < 0) ? 0 : code)
1991 : m_chr((unsigned char)code)
1998 inline explicit UChar(
unsigned char code)
2008 { m_chr = code; encode();
return *
this; }
2016 { m_chr = (
unsigned char)code; encode();
return *
this; }
2036 inline operator const char*()
const
2046 bool decode(
const char*& str, uint32_t maxChar = 0x10ffff,
bool overlong =
false);
2056 bool decode(uint16_t*& buff,
unsigned int& len, Endianness order, uint32_t maxChar = 0x10ffff);
2065 bool decode(
DataBlock& buff, Endianness order, uint32_t maxChar = 0x10ffff);
2074 bool encode(uint16_t*& buff,
unsigned int& len, Endianness order);
2082 bool encode(
DataBlock& buff, Endianness order);
2094 static bool decode(
String& out, uint16_t*& buff,
unsigned int& len, Endianness order,
bool checkBOM =
false, uint32_t maxChar = 0x10ffff);
2104 static bool encode(
DataBlock& out,
const char*& str, Endianness order,
bool addBOM =
false);
2115 static bool encode(uint16_t*& buff,
unsigned int& len,
const char*& str, Endianness order,
bool addBOM =
false);
2149 String(
const char* value,
int len = -1);
2156 explicit String(
char value,
unsigned int repeat = 1);
2162 explicit String(int32_t value);
2168 explicit String(uint32_t value);
2174 explicit String(int64_t value);
2180 explicit String(uint64_t value);
2186 explicit String(
bool value);
2192 explicit String(
double value);
2216 virtual void* getObject(
const String& name)
const;
2222 static const String& empty();
2230 {
return value ?
"true" :
"false"; }
2237 {
return m_string; }
2244 {
return m_string ? m_string :
""; }
2251 inline const char*
safe(
const char* defStr)
const
2252 {
return m_string ? m_string : (defStr ? defStr :
""); }
2259 {
return m_length; }
2266 {
return !m_string; }
2275 static int lenUtf8(
const char* value, uint32_t maxChar = 0x10ffff,
bool overlong =
false);
2283 inline int lenUtf8(uint32_t maxChar = 0x10ffff,
bool overlong =
false)
const
2284 {
return lenUtf8(m_string,maxChar,overlong); }
2294 int fixUtf8(
const char* replace = 0, uint32_t maxChar = 0x10ffff,
bool overlong =
false);
2301 unsigned int encodeFlags(
const TokenDict* tokens)
const;
2308 uint64_t encodeFlags(
const TokenDict64* tokens)
const;
2317 const String& decodeFlags(
unsigned int flags,
const TokenDict* tokens,
bool unknownflag =
true);
2326 const String& decodeFlags(uint64_t flags,
const TokenDict64* tokens,
bool unknownflag =
true);
2333 {
return str && (str[0] ==
'\357') && (str[1] ==
'\273') && (str[2] ==
'\277'); }
2340 {
return checkBOM(
c_str()); }
2348 {
return checkBOM(str) && (str += 3); }
2356 {
return checkBOM(str) && (str += 3); }
2363 {
return checkBOM(
c_str()) && &(*
this =
c_str() + 3); }
2371 if (m_hash == YSTRING_INIT_HASH)
2372 m_hash = hash(m_string);
2382 static unsigned int hash(
const char* value,
unsigned int h = 0);
2394 char at(
int index)
const;
2402 String substr(
int offs,
int len = -1)
const;
2419 virtual const String& toString()
const;
2431 int toInteger(
int defvalue = 0,
int base = 0,
int minvalue = INT_MIN,
2432 int maxvalue = INT_MAX,
bool clamp =
true)
const;
2441 int toInteger(
const TokenDict* tokens,
int defvalue = 0,
int base = 0)
const;
2453 long int toLong(
long int defvalue = 0,
int base = 0,
long int minvalue = LONG_MIN,
2454 long int maxvalue = LONG_MAX,
bool clamp =
true)
const;
2466 int64_t toInt64(int64_t defvalue = 0,
int base = 0, int64_t minvalue = LLONG_MIN,
2467 int64_t maxvalue = LLONG_MAX,
bool clamp =
true)
const;
2479 uint64_t toUInt64(uint64_t defvalue = 0,
int base = 0, uint64_t minvalue = 0,
2480 uint64_t maxvalue = ULLONG_MAX,
bool clamp =
true)
const;
2487 double toDouble(
double defvalue = 0.0)
const;
2494 bool toBoolean(
bool defvalue =
false)
const;
2500 bool isBoolean()
const;
2520 {
return at(index); }
2528 {
return at(index); }
2534 inline operator const char*()
const
2535 {
return m_string; };
2543 String& assign(
const char* value,
int len = -1);
2551 String& assign(
char value,
unsigned int repeat = 1);
2561 String& hexify(
void* data,
unsigned int len,
char sep = 0,
bool upCase =
false);
2568 {
return operator=(value.
c_str()); }
2576 {
return operator=(value ? value->
c_str() :
""); }
2583 String& operator=(
const char* value);
2589 String& operator=(
char value);
2595 String& operator=(int32_t value);
2601 String& operator=(uint32_t value);
2607 String& operator=(int64_t value);
2613 String& operator=(uint64_t value);
2620 {
return operator=(boolText(value)); }
2626 String& operator=(
double value);
2634 {
return append(value,-1); }
2640 String& operator+=(
char value);
2646 String& operator+=(int32_t value);
2652 String& operator+=(uint32_t value);
2658 String& operator+=(int64_t value);
2664 String& operator+=(uint64_t value);
2671 {
return operator+=(boolText(value)); }
2677 String& operator+=(
double value);
2682 bool operator==(
const char* value)
const;
2687 bool operator!=(
const char* value)
const;
2693 {
return (
this == &value) || ((hash() == value.
hash()) &&
operator==(value.
c_str())); }
2699 {
return (
this != &value) && ((hash() != value.
hash()) ||
operator!=(value.
c_str())); }
2704 bool operator&=(
const char* value)
const;
2709 bool operator|=(
const char* value)
const;
2715 {
return operator+=(value); }
2721 {
return operator+=(value); }
2727 {
return operator+=(value); }
2733 {
return operator+=(value); }
2739 {
return operator+=(value); }
2745 {
return operator+=(value); }
2751 {
return operator+=(value); }
2757 {
return operator+=(value); }
2763 String& operator>>(
const char* skip);
2768 String& operator>>(
char& store);
2778 String& operator>>(
int& store);
2783 String& operator>>(
unsigned int& store);
2788 String& operator>>(
bool& store);
2796 String& append(
const char* value,
int len);
2804 String& append(
const char* value,
const char* separator = 0,
bool force =
false);
2812 String& append(
const ObjList* list,
const char* separator = 0,
bool force =
false);
2821 {
return append(&list,separator,force); }
2828 String& append(
double value,
unsigned int decimals = 3);
2835 String& printf(
const char* format, ...) FORMAT_CHECK(2);
2842 String& printf(
unsigned int length, const
char* format, ...) FORMAT_CHECK(3);
2852 String& appendFixed(
unsigned int fixedLength, const
char* str,
unsigned int len = -1,
char fill = ' ',
int align = Left);
2861 inline
String& appendFixed(
unsigned int fixedLength, const
String& str,
char fill = ' ',
int align = Left)
2862 {
return appendFixed(fixedLength,str.c_str(),str.length(),fill,align); }
2870 int find(
char what,
unsigned int offs = 0)
const;
2878 int find(
const char* what,
unsigned int offs = 0)
const;
2885 int rfind(
char what)
const;
2892 int rfind(
const char* what)
const;
2901 bool startsWith(
const char* what,
bool wordBreak =
false,
bool caseInsensitive =
false)
const;
2910 bool endsWith(
const char* what,
bool wordBreak =
false,
bool caseInsensitive =
false)
const;
2923 bool startSkip(
const char* what,
bool wordBreak =
true,
bool caseInsensitive =
false);
2939 String& extractTo(
const char* sep,
bool& store);
2948 String& extractTo(
const char* sep,
int& store,
int base = 0);
2958 String& extractTo(
const char* sep,
int& store,
const TokenDict* tokens,
int base = 0);
2966 String& extractTo(
const char* sep,
double& store);
2974 {
return operator==(value); }
2981 bool matches(
const Regexp& rexp);
2988 int matchOffset(
int index = 0)
const;
2995 int matchLength(
int index = 0)
const;
3003 {
return substr(matchOffset(index),matchLength(index)); }
3016 int matchCount()
const;
3024 ObjList* split(
char separator,
bool emptyOK =
true)
const;
3032 ObjList* split(
const Regexp& reg,
bool emptyOK =
true)
const;
3040 static String msgEscape(
const char* str,
char extraEsc = 0);
3048 {
return msgEscape(
c_str(),extraEsc); }
3057 static String msgUnescape(
const char* str,
int* errptr = 0,
char extraEsc = 0);
3066 {
return msgUnescape(
c_str(),errptr,extraEsc); }
3074 static String sqlEscape(
const char* str,
char extraEsc = 0);
3082 {
return sqlEscape(
c_str(),extraEsc); }
3091 static String uriEscape(
const char* str,
char extraEsc = 0,
const char* noEsc = 0);
3100 static String uriEscape(
const char* str,
const char* extraEsc,
const char* noEsc = 0);
3109 {
return uriEscape(
c_str(),extraEsc,noEsc); }
3117 static String uriUnescape(
const char* str,
int* errptr = 0);
3125 {
return uriUnescape(
c_str(),errptr); }
3133 static const String* atom(
const String*& str,
const char* val);
3139 virtual void changed();
3142 void clearMatches();
3144 unsigned int m_length;
3146 mutable unsigned int m_hash;
3147 StringMatchPrivate* m_matches;
3156 {
return str ? str->
c_str() : (
const char*)0; }
3164 {
return str ? str :
""; }
3172 {
return str ? str->
safe() :
""; }
3180 {
return !(str && *str); }
3188 {
return !str || str->
null(); }
3193 YATE_API String
operator+(
const String& s1,
const String& s2);
3198 YATE_API String
operator+(
const String& s1,
const char* s2);
3203 YATE_API String
operator+(
const char* s1,
const String& s2);
3210 { dest = src;
return dest.
c_str(); }
3217 { dest += src;
return dest.
c_str(); }
3227 YATE_API
int lookup(
const char* str,
const TokenDict* tokens,
int defvalue = 0,
int base = 0);
3235 YATE_API
const char*
lookup(
int value,
const TokenDict* tokens,
const char* defvalue = 0);
3245 YATE_API int64_t
lookup(
const char* str,
const TokenDict64* tokens, int64_t defvalue = 0,
int base = 0);
3253 YATE_API
const char*
lookup(int64_t value,
const TokenDict64* tokens,
const char* defvalue = 0);
3264 YATE_API
bool controlReturn(NamedList* params,
bool ret,
const char* retVal = 0);
3286 explicit Regexp(
const char* value,
bool extended =
false,
bool insensitive =
false);
3310 {
return m_regexp || (m_compile && doCompile()); }
3317 bool matches(
const char* value)
const;
3332 void setFlags(
bool extended,
bool insensitive);
3338 bool isExtended()
const;
3344 bool isCaseInsensitive()
const;
3350 virtual void changed();
3356 bool doCompile()
const;
3360 bool matches(
const char* value, StringMatchPrivate* matchlist)
const;
3361 mutable void* m_regexp;
3362 mutable bool m_compile;
3377 inline explicit Atom(
const char* value)
3414 :
String(text), m_level(level)
3422 :
String(original), m_level(original.level())
3438 {
return s_capturing; }
3445 {
return s_events; }
3452 inline static void append(
int level,
const char* text)
3453 {
if (text && *text) s_events.append(
new CapturedEvent(level,text)); }
3461 {
return s_events; }
3468 { s_capturing = capture; }
3473 static bool s_capturing;
3489 explicit NamedString(
const char* name,
const char* value = 0);
3502 virtual const String& toString()
const;
3509 virtual void* getObject(
const String& name)
const;
3571 {
return m_data ? m_data->getObject(name) : 0; }
3584 virtual void* getObject(
const String& name)
const;
3590 virtual void changed();
3616 {
return m_enabled; }
3623 { m_enabled = val; }
3665 explicit HashList(
unsigned int size = 17);
3677 virtual void* getObject(
const String& name)
const;
3690 unsigned int count()
const;
3699 {
return (index < m_size) ? m_lists[index] : 0; }
3707 {
return getList(hash % m_size); }
3715 {
return getHashList(str.
hash()); }
3780 return n ? n->
remove(delobj) : 0;
3793 return n ? n->
remove(delobj) : 0;
3817 unsigned int m_size;
3857 {
return m_length; }
3869 void assign(
ObjList& list,
int offset = 0);
3876 void assign(
HashList& list,
int offset = 0);
3884 GenObject*
get(
unsigned int index)
const;
3905 {
return m_current >= m_length; }
3917 unsigned int* m_hashes;
3918 unsigned int m_length;
3919 unsigned int m_current;
3948 inline explicit Time(
const struct timeval* tv)
3949 : m_time(fromTimeval(tv))
3956 inline explicit Time(
const struct timeval& tv)
3957 : m_time(fromTimeval(tv))
3972 {
return (u_int32_t)((m_time+500000) / 1000000); }
3979 {
return (m_time+500) / 1000; }
3991 inline operator u_int64_t()
const
3998 { m_time = usec;
return *
this; }
4004 { m_time += delta;
return *
this; }
4010 { m_time -= delta;
return *
this; }
4017 { toTimeval(tv, m_time); }
4024 static void toTimeval(
struct timeval* tv, u_int64_t usec);
4031 static u_int64_t fromTimeval(
const struct timeval* tv);
4039 {
return fromTimeval(&tv); }
4045 static u_int64_t now();
4051 static u_int64_t msecNow();
4057 static u_int32_t secNow();
4072 static unsigned int toEpoch(
int year,
unsigned int month,
unsigned int day,
4073 unsigned int hour,
unsigned int minute,
unsigned int sec,
int offset = 0);
4087 static bool toDateTime(
unsigned int epochTimeSec,
int& year,
unsigned int& month,
4088 unsigned int& day,
unsigned int& hour,
unsigned int& minute,
unsigned int& sec,
4089 unsigned int* wDay = 0);
4098 static uint32_t toNtp(uint32_t sec, uint32_t* over = 0,
bool rfc2030 =
true);
4106 inline uint32_t
toNtp(uint32_t* over = 0,
bool rfc2030 =
true)
4107 {
return toNtp(sec(),over,rfc2030); }
4117 static uint32_t fromNtp(uint32_t val, uint32_t* under = 0,
bool rfc2030 =
true);
4130 static unsigned int toString(
char* buf, uint64_t time,
int frac = 0);
4145 unsigned int n = toString(tmp,time,frac);
4160 static uint64_t toEpoch(
const char* buf,
unsigned int len,
int frac = 0);
4168 {
return (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)); }
4175 static int timeZone(u_int32_t when = secNow());
4200 inline u_int32_t
get()
const
4201 {
return m_random; }
4207 inline void set(u_int32_t seed)
4208 { m_random = seed; }
4220 static long int random();
4226 static void srandom(
unsigned int seed);
4266 DataBlock(
void* value,
unsigned int len,
bool copyData =
true,
unsigned int overAlloc = 0);
4278 virtual void* getObject(
const String& name)
const;
4298 inline unsigned char*
data(
unsigned int offs,
unsigned int len = 1)
const
4299 {
return (offs + len <= m_length) ? (
static_cast<unsigned char*
>(m_data) + offs) : 0; }
4307 inline int at(
unsigned int offs,
int defvalue = -1)
const
4308 {
return (offs < m_length) ?
static_cast<unsigned char*
>(m_data)[offs] : defvalue; }
4322 {
return m_length; }
4329 {
return m_overAlloc; }
4336 { m_overAlloc = bytes; }
4342 void clear(
bool deleteData =
true);
4351 DataBlock& assign(
void* value,
unsigned int len,
bool copyData =
true,
unsigned int allocated = 0);
4358 inline void append(
void* value,
unsigned int len) {
4374 void append(
const String& value);
4387 if (len != length())
4395 void truncate(
unsigned int len);
4409 {
return at(index); }
4417 {
return at(index); }
4428 { append(value);
return *
this; }
4434 { append(value);
return *
this; }
4445 const String& dFormat,
unsigned maxlen = 0);
4457 bool unHexify(
const char* data,
unsigned int len,
char sep);
4468 bool unHexify(
const char* data,
unsigned int len);
4484 String sqlEscape(
char extraEsc)
const;
4487 unsigned int allocLen(
unsigned int len)
const;
4489 unsigned int m_length;
4490 unsigned int m_allocated;
4491 unsigned int m_overAlloc;
4509 virtual void clear() = 0;
4515 virtual void finalize() = 0;
4522 virtual const unsigned char* rawDigest() = 0;
4530 { finalize();
return m_hex; }
4538 inline bool update(
const void* buf,
unsigned int len)
4539 {
return updateInternal(buf,len); }
4547 {
return updateInternal(data.
data(), data.
length()); }
4555 {
return updateInternal(str.
c_str(), str.
length()); }
4562 { update(value);
return *
this; }
4569 { update(data);
return *
this; }
4584 bool hmacStart(
DataBlock& opad,
const void* key,
unsigned int keyLen);
4593 {
return hmacStart(opad,key.
data(),key.
length()); }
4602 {
return hmacStart(opad,key.
c_str(),key.
length()); }
4619 bool hmac(
const void* key,
unsigned int keyLen,
const void* msg,
unsigned int msgLen);
4643 virtual unsigned int hashLength()
const = 0;
4649 virtual unsigned int hmacBlockSize()
const;
4665 virtual bool updateInternal(
const void* buf,
unsigned int len) = 0;
4687 MD5(
const MD5& original);
4694 MD5(
const void* buf,
unsigned int len);
4711 MD5& operator=(
const MD5& original);
4721 virtual void clear();
4727 virtual void finalize();
4734 virtual const unsigned char* rawDigest();
4751 bool updateInternal(
const void* buf,
unsigned int len);
4755 unsigned char m_bin[16];
4781 SHA1(
const void* buf,
unsigned int len);
4798 SHA1& operator=(
const SHA1& original);
4808 virtual void clear();
4814 virtual void finalize();
4821 virtual const unsigned char* rawDigest();
4848 bool updateInternal(
const void* buf,
unsigned int len);
4852 unsigned char m_bin[20];
4878 SHA256(
const void* buf,
unsigned int len);
4905 virtual void clear();
4911 virtual void finalize();
4918 virtual const unsigned char* rawDigest();
4935 bool updateInternal(
const void* buf,
unsigned int len);
4939 unsigned char m_bin[32];
4962 inline Base64(
void* src,
unsigned int len,
bool copyData =
true)
4975 void encode(
String& dest,
unsigned int lineLen = 0,
bool lineAtEnd =
false);
4988 bool decode(
DataBlock& dest,
bool liberal =
true);
4994 { append(value);
return *
this; }
5000 { append(data);
return *
this; }
5009 class NamedIterator;
5051 virtual void* getObject(
const String& name)
const;
5058 {
return m_params.length(); }
5065 {
return m_params.count(); }
5071 { m_params.clear(); }
5087 NamedList& addParam(
const char* name,
const char* value,
bool emptyOK =
true);
5097 m_params.setUnique(param);
5168 bool skipPrefix =
true,
bool replace =
false);
5175 bool hasSubParams(
const char* prefix)
const;
5189 int getIndex(
const String& name)
const;
5218 const char* getValue(
const String& name,
const char* defvalue = 0)
const;
5230 int getIntValue(
const String& name,
int defvalue = 0,
int minvalue = INT_MIN,
5231 int maxvalue = INT_MAX,
bool clamp =
true)
const;
5240 int getIntValue(
const String& name,
const TokenDict* tokens,
int defvalue = 0)
const;
5252 int64_t getInt64Value(
const String& name, int64_t defvalue = 0, int64_t minvalue = LLONG_MIN,
5253 int64_t maxvalue = LLONG_MAX,
bool clamp =
true)
const;
5265 uint64_t getUInt64Value(
const String& name, uint64_t defvalue = 0, uint64_t minvalue = 0,
5266 uint64_t maxvalue = ULLONG_MAX,
bool clamp =
true)
const;
5274 double getDoubleValue(
const String& name,
double defvalue = 0.0)
const;
5282 bool getBoolValue(
const String& name,
bool defvalue =
false)
const;
5291 int replaceParams(
String& str,
bool sqlEsc =
false,
char extraEsc = 0)
const;
5301 void dump(
String& str,
const char* separator,
char quote = 0,
bool force =
false)
const;
5314 {
return &m_params; }
5321 {
return &m_params; }
5341 : m_list(&list), m_item(list.m_params.skipNull())
5349 : m_list(original.m_list), m_item(original.m_item)
5357 { m_list = &list; m_item = list.m_params.
skipNull();
return *
this; }
5364 { m_list = original.m_list; m_item = original.m_item;
return *
this; }
5382 { m_item = m_list->m_params.skipNull(); }
5419 explicit URI(
const char* uri);
5429 URI(
const char* proto,
const char* user,
const char* host,
int port = 0,
const char* desc = 0);
5462 { parse();
return m_desc; }
5469 { parse();
return m_proto; }
5476 { parse();
return m_user; }
5483 { parse();
return m_host; }
5490 { parse();
return m_port; }
5497 { parse();
return m_extra; }
5505 virtual void changed();
5506 mutable bool m_parsed;
5516 class SemaphorePrivate;
5517 class ThreadPrivate;
5536 virtual bool lock(
long maxwait = -1) = 0;
5542 virtual bool unlock() = 0;
5549 virtual bool locked()
const = 0;
5556 virtual bool check(
long maxwait = -1);
5564 virtual bool unlockAll();
5571 static void wait(
unsigned long maxwait);
5577 static unsigned long wait();
5585 static void startUsingNow();
5593 static void enableSafety(
bool safe =
true);
5599 static bool safety();
5608 friend class MutexPrivate;
5616 explicit Mutex(
bool recursive =
false,
const char* name = 0);
5640 virtual bool lock(
long maxwait = -1);
5646 virtual bool unlock();
5653 virtual bool locked()
const;
5659 const char* owner()
const;
5665 bool recursive()
const;
5683 static bool efficientTimedLock();
5686 MutexPrivate* privDataCopy()
const;
5687 MutexPrivate* m_private;
5709 MutexPool(
unsigned int len = 13,
bool recursive =
false,
const char* name = 0);
5723 inline unsigned int index(
void* ptr)
const
5724 {
return ((
unsigned int)(
unsigned long)ptr) % m_length; }
5734 {
return m_data[index(ptr)]; }
5742 {
return m_data[idx % m_length]; }
5747 unsigned int m_length;
5756 friend class SemaphorePrivate;
5764 explicit Semaphore(
unsigned int maxcount = 1,
const char* name = 0,
5765 unsigned int initialCount = 1);
5789 virtual bool lock(
long maxwait = -1);
5795 virtual bool unlock();
5802 virtual bool locked()
const;
5820 static bool efficientTimedLock();
5823 SemaphorePrivate* privDataCopy()
const;
5824 SemaphorePrivate* m_private;
5842 { m_lock = lck.
lock(maxwait) ? &lck : 0; }
5850 { m_lock = (lck && lck->
lock(maxwait)) ? lck : 0; }
5856 {
if (m_lock) m_lock->unlock(); }
5869 {
if (m_lock) m_lock->unlock(); m_lock = 0; }
5878 {
return (lck && (lck == m_lock)) ||
5879 (drop(),(lck && (m_lock = lck->
lock(maxwait) ? lck : 0))); }
5888 {
return acquire(&lck,maxwait); }
5894 inline void*
operator new(size_t);
5897 inline void*
operator new[](size_t);
5917 : m_mx1(0), m_mx2(0)
5918 { lock(mx1,mx2,maxwait); }
5927 : m_mx1(0), m_mx2(0)
5928 { lock(&mx1,&mx2,maxwait); }
5941 {
return m_mx1 != 0; }
5950 bool lock(
Mutex* mx1,
Mutex* mx2,
long maxwait = -1);
5960 {
return lock(&mx1,&mx2,maxwait); }
5972 inline void*
operator new(size_t);
5975 inline void*
operator new[](size_t);
5990 virtual void run() = 0;
6006 friend class ThreadPrivate;
6007 friend class MutexPrivate;
6008 friend class SemaphorePrivate;
6025 virtual void cleanup();
6043 bool running()
const;
6060 int setAffinity(
const String& cpus);
6082 {
return m_locking || m_locks; }
6088 const char* name()
const;
6094 static const char* currentName();
6102 static int getCurrentAffinity(
DataBlock& outCpuMask);
6110 static int getCurrentAffinity(
String& outCpus,
bool hex =
false);
6119 static int setCurrentAffinity(
const String& cpus);
6127 static int setCurrentAffinity(
const DataBlock& mask);
6145 static void printCPUMask(
const DataBlock& mask,
String& str,
bool hexa =
true);
6152 static void yield(
bool exitCheck =
false);
6159 static void idle(
bool exitCheck =
false);
6166 static void sleep(
unsigned int sec,
bool exitCheck =
false);
6173 static void msleep(
unsigned long msec,
bool exitCheck =
false);
6181 static void usleep(
unsigned long usec,
bool exitCheck =
false);
6187 static unsigned long idleUsec();
6193 static unsigned long idleMsec();
6199 static void idleMsec(
unsigned long msec);
6206 static Thread* current();
6219 static bool check(
bool exitNow =
true);
6230 void cancel(
bool hard =
false);
6237 {
return current() ==
this; }
6257 static NamedCounter* getCurrentObjCounter(
bool always =
false);
6272 static Priority priority(
const char* name, Priority defvalue = Normal);
6279 static const char* priority(Priority prio);
6285 static void killall();
6291 static void preExec();
6298 static int lastError();
6307 {
return errorString(buffer,lastError()); }
6319 static bool errorString(
String& buffer,
int code);
6327 Thread(
const char *name = 0, Priority prio = Normal);
6334 Thread(
const char *name,
const char* prio);
6342 ThreadPrivate* m_private;
6361 : m_saved(0), m_enabled(enable)
6370 : m_saved(0), m_enabled(enable && obj)
6379 : m_saved(0), m_enabled(enable)
6407 Unknown = AF_UNSPEC,
6410 AfUnsupported = AfMax,
6414 IPv6 = AfUnsupported + 1,
6419 Unix = AfUnsupported + 2,
6427 : m_address(0), m_length(0)
6436 m_address(0), m_length(0)
6444 explicit SocketAddr(
int family,
const void* raw = 0);
6451 SocketAddr(
const struct sockaddr* addr, socklen_t len = 0);
6470 bool operator==(
const SocketAddr& other)
const;
6478 {
return !operator==(other); }
6490 bool assign(
int family);
6497 void assign(
const struct sockaddr* addr, socklen_t len = 0);
6518 {
return m_length && m_address; }
6525 {
return !(m_length && m_address); }
6532 {
return m_address ? m_address->sa_family : 0; }
6539 {
return lookupFamily(family()); }
6546 {
return scopeId(address()); }
6554 {
return scopeId(address(),val); }
6579 virtual bool host(
const String& name);
6592 bool port(
int newport);
6599 {
return m_address; }
6606 {
return m_length; }
6613 {
return isNullAddr(m_host,family()); }
6627 static bool supports(
int family);
6634 static int family(
const String& addr);
6642 static bool stringify(
String& buf,
struct sockaddr* addr);
6653 int family = Unknown) {
6655 return sa.
host(host) ? copyAddr(buf,sa.
address()) : Unknown;
6665 static int copyAddr(uint8_t* buf,
struct sockaddr* addr);
6672 static inline unsigned int scopeId(
struct sockaddr* addr) {
6674 if (addr && addr->sa_family == AF_INET6)
6675 return ((
struct sockaddr_in6*)addr)->sin6_scope_id;
6686 static inline bool scopeId(
struct sockaddr* addr,
unsigned int val) {
6688 if (addr && addr->sa_family == AF_INET6) {
6689 ((
struct sockaddr_in6*)addr)->sin6_scope_id = val;
6714 int family = Unknown) {
6715 appendAddr(buf,addr,family) <<
":" << port;
6728 appendTo(buf,addr,port,family);
6738 static bool isNullAddr(
const String& addr,
int family = Unknown);
6761 static void split(
const String& buf,
String& addr,
int& port,
bool portPresent =
false);
6769 {
return lookup(family,s_familyName); }
6775 static const String& ipv4NullAddr();
6781 static const String& ipv6NullAddr();
6787 static const TokenDict* dictFamilyName();
6793 virtual void stringify();
6798 virtual void updateAddr()
const;
6800 struct sockaddr* m_address;
6833 virtual void* getObject(
const String& name)
const;
6839 virtual void timerTick(
const Time& when);
6850 virtual bool received(
void* buffer,
int length,
int flags,
const struct sockaddr* addr, socklen_t adrlen) = 0;
6857 {
return m_socket; }
6901 virtual bool terminate() = 0;
6907 virtual bool canRetry()
const;
6913 virtual bool inProgress()
const;
6919 virtual bool valid()
const = 0;
6926 virtual bool setBlocking(
bool block =
true);
6934 virtual int writeData(
const void* buffer,
int length) = 0;
6941 int writeData(
const char* str);
6957 {
return writeData(buf.
data(), buf.
length()); }
6965 virtual int readData(
void* buffer,
int length) = 0;
6971 virtual int64_t length();
6979 virtual int64_t seek(SeekPos pos, int64_t offset = 0);
6986 inline int64_t
seek(int64_t offset)
6987 {
return seek(SeekBegin,offset); }
6995 static bool allocPipe(
Stream*& reader,
Stream*& writer);
7009 static bool supportsPipes();
7015 static bool supportsPairs();
7054 : m_data(data), m_offset(0)
7083 virtual int writeData(
const void* buffer,
int len);
7091 virtual int readData(
void* buffer,
int len);
7098 {
return m_data.length(); }
7106 virtual int64_t seek(SeekPos pos, int64_t offset = 0);
7137 explicit File(HANDLE handle);
7156 virtual bool openPath(
const char* name,
bool canWrite =
false,
bool canRead =
true,
7157 bool create =
false,
bool append =
false,
bool binary =
false,
7158 bool pubReadable =
false,
bool pubWritable =
false);
7164 virtual bool terminate();
7170 void attach(HANDLE handle);
7183 {
return m_handle; }
7189 virtual bool canRetry()
const;
7195 virtual bool valid()
const;
7201 static HANDLE invalidHandle();
7208 virtual bool setBlocking(
bool block =
true);
7214 virtual int64_t length();
7222 virtual int64_t seek(SeekPos pos, int64_t offset = 0);
7230 virtual int writeData(
const void* buffer,
int length);
7238 virtual int readData(
void* buffer,
int length);
7245 bool getFileTime(
unsigned int& secEpoch);
7253 virtual bool md5(
String& buffer);
7262 static bool setFileTime(
const char* name,
unsigned int secEpoch,
int* error = 0);
7271 static bool getFileTime(
const char* name,
unsigned int& secEpoch,
int* error = 0);
7279 static bool exists(
const char* name,
int* error = 0);
7288 static bool rename(
const char* oldFile,
const char* newFile,
int* error = 0);
7296 static bool remove(
const char* name,
int* error = 0);
7305 static bool md5(
const char* name,
String& buffer,
int* error = 0);
7314 static bool mkDir(
const char* path,
int* error = 0,
int mode = -1);
7322 static bool rmDir(
const char* path,
int* error = 0);
7335 static bool listDirectory(
const char* path,
ObjList* dirs,
ObjList* files,
7344 static bool createPipe(
File& reader,
File& writer);
7369 LowDelay = IPTOS_LOWDELAY,
7370 MaxThroughput = IPTOS_THROUGHPUT,
7371 MaxReliability = IPTOS_RELIABILITY,
7372 MinCost = IPTOS_MINCOST,
7403 ExpeditedFwd = 0xb8,
7416 explicit Socket(SOCKET handle);
7424 Socket(
int domain,
int type,
int protocol = 0);
7438 virtual bool create(
int domain,
int type,
int protocol = 0);
7444 virtual bool terminate();
7450 void attach(SOCKET handle);
7463 {
return m_handle; }
7469 virtual bool canRetry()
const;
7475 virtual bool inProgress()
const;
7481 virtual bool valid()
const;
7487 static SOCKET invalidHandle();
7493 static int socketError();
7509 virtual bool setOption(
int level,
int name,
const void* value = 0, socklen_t length = 0);
7520 #if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
7521 int value = on ? 1 : 0;
7522 return setOption(IPPROTO_IPV6,IPV6_V6ONLY,&value,
sizeof(value));
7536 virtual bool getOption(
int level,
int name,
void* buffer, socklen_t* length);
7559 virtual bool setTOS(
int tos);
7567 inline bool setTOS(
const char* tos,
int defTos = Normal)
7568 {
return setTOS(
lookup(tos,tosValues(),defTos)); }
7574 virtual int getTOS();
7581 virtual bool setBlocking(
bool block =
true);
7590 virtual bool setReuse(
bool reuse =
true,
bool exclusive =
false);
7598 virtual bool setLinger(
int seconds = -1);
7606 virtual bool bind(
struct sockaddr* addr, socklen_t addrlen);
7621 virtual bool listen(
unsigned int backlog = 0);
7629 virtual Socket* accept(
struct sockaddr* addr = 0, socklen_t* addrlen = 0);
7644 SOCKET acceptHandle(
struct sockaddr* addr = 0, socklen_t* addrlen = 0);
7659 static bool efficientSelect();
7666 static bool canSelect(SOCKET handle);
7672 virtual bool canSelect()
const;
7680 virtual bool connect(
struct sockaddr* addr, socklen_t addrlen);
7699 virtual bool connectAsync(
struct sockaddr* addr, socklen_t addrlen,
unsigned int toutUs,
7712 {
return connectAsync(addr.
address(),addr.
length(),toutUs,timeout); }
7720 virtual bool shutdown(
bool stopReads,
bool stopWrites);
7728 virtual bool getSockName(
struct sockaddr* addr, socklen_t* addrlen);
7743 virtual bool getPeerName(
struct sockaddr* addr, socklen_t* addrlen);
7761 virtual int sendTo(
const void* buffer,
int length,
const struct sockaddr* addr, socklen_t adrlen,
int flags = 0);
7772 {
return sendTo(buffer, length, addr.
address(), addr.
length(), flags); }
7781 virtual int send(
const void* buffer,
int length,
int flags = 0);
7789 virtual int writeData(
const void* buffer,
int length);
7800 virtual int recvFrom(
void* buffer,
int length,
struct sockaddr* addr = 0, socklen_t* adrlen = 0,
int flags = 0);
7810 int recvFrom(
void* buffer,
int length,
SocketAddr& addr,
int flags = 0);
7819 virtual int recv(
void* buffer,
int length,
int flags = 0);
7827 virtual int readData(
void* buffer,
int length);
7837 virtual bool select(
bool* readok,
bool* writeok,
bool* except,
struct timeval* timeout = 0);
7847 bool select(
bool* readok,
bool* writeok,
bool* except, int64_t timeout);
7861 void removeFilter(
SocketFilter* filter,
bool delobj =
false);
7866 void clearFilters();
7874 virtual void timerTick(
const Time& when);
7883 static bool createPair(
Socket& sock1,
Socket& sock2,
int domain = AF_UNIX);
7898 bool checkError(
int retcode,
bool strict =
false);
7909 bool applyFilters(
void* buffer,
int length,
int flags,
const struct sockaddr* addr = 0, socklen_t adrlen = 0);
7947 virtual bool bindx(
ObjList& addresses) = 0;
7954 virtual bool connectx(
ObjList& addresses) = 0;
7965 virtual int sendTo(
void* buffer,
int length,
int stream,
SocketAddr& addr,
int flags) = 0;
7983 virtual int sendMsg(
const void* buf,
int length,
int stream,
int& flags) = 0;
7994 virtual int recvMsg(
void* buf,
int length,
SocketAddr& addr,
int& stream,
int& flags) = 0;
8002 virtual bool setStreams(
int inbound,
int outbound) = 0;
8009 virtual bool subscribeEvents() = 0;
8017 virtual bool getStreams(
int& inbound,
int& outbound) = 0;
8024 virtual bool setPayload(u_int32_t payload) = 0;
8079 : m_ttl(ttl), m_order(order), m_pref(pref)
8086 : m_order(0), m_pref(0)
8115 virtual void dump(
String& buf,
const char* sep =
" ");
8162 virtual void dump(
String& buf,
const char* sep =
" ");
8195 inline SrvRecord(
int ttl,
int prio,
int weight,
const char* addr,
int port)
8196 :
DnsRecord(ttl,prio,weight), m_address(addr), m_port(port)
8204 {
return m_address; }
8218 virtual void dump(
String& buf,
const char* sep =
" ");
8254 NaptrRecord(
int ttl,
int ord,
int pref,
const char* flags,
const char* serv,
8255 const char* regexp,
const char* next);
8263 bool replace(
String& str)
const;
8270 virtual void dump(
String& buf,
const char* sep =
" ");
8284 {
return m_service; }
8291 {
return m_regmatch; }
8298 {
return m_template; }
8343 static bool available(Type type = Unknown);
8351 static bool init(
int timeout = -1,
int retries = -1);
8361 static int query(Type type,
const char* dname,
ObjList& result,
String* error = 0);
8370 static int srvQuery(
const char* dname,
ObjList& result,
String* error = 0);
8379 static int naptrQuery(
const char* dname,
ObjList& result,
String* error = 0);
8388 static int a4Query(
const char* dname,
ObjList& result,
String* error = 0);
8397 static int a6Query(
const char* dname,
ObjList& result,
String* error = 0);
8406 static int txtQuery(
const char* dname,
ObjList& result,
String* error = 0);
8435 {
return s_directions; }
8456 virtual void* getObject(
const String& name)
const;
8463 virtual bool valid(Direction dir = Bidir)
const;
8469 virtual unsigned int blockSize()
const = 0;
8475 virtual unsigned int initVectorSize()
const;
8482 unsigned int bufferSize(
unsigned int len)
const;
8489 bool bufferFull(
unsigned int len)
const;
8498 virtual bool setKey(
const void* key,
unsigned int len, Direction dir = Bidir) = 0;
8507 {
return setKey(key.
data(),key.
length(),dir); }
8516 virtual bool initVector(
const void* vect,
unsigned int len, Direction dir = Bidir);
8525 {
return initVector(vect.
data(),vect.
length(),dir); }
8534 virtual bool encrypt(
void* outData,
unsigned int len,
const void* inpData = 0) = 0;
8542 {
return encrypt(data.
data(),data.
length()); }
8551 virtual bool decrypt(
void* outData,
unsigned int len,
const void* inpData = 0) = 0;
8559 {
return decrypt(data.
data(),data.
length()); }
8581 :
String(name), m_format(format)
8595 {
return m_format; }
8604 virtual bool init(
bool comp =
true,
bool decomp =
true,
8623 virtual int compress(
const void* buf,
unsigned int len,
DataBlock& dest);
8633 virtual int decompress(
const void* buf,
unsigned int len,
DataBlock& dest);
8645 virtual int writeComp(
const void* buf,
unsigned int len,
bool flush) = 0;
8656 {
return writeComp(data.
data(),data.
length(),flush); }
8667 {
return writeComp(data.
c_str(),data.
length(),flush); }
8675 virtual int readComp(
DataBlock& buf,
bool flush) = 0;
8685 virtual int writeDecomp(
const void* buf,
unsigned int len,
bool flush) = 0;
8695 {
return writeDecomp(data.
data(),data.
length(),flush); }
8705 {
return writeDecomp(data.
c_str(),data.
length(),flush); }
8713 virtual int readDecomp(
DataBlock& buf,
bool flush) = 0;
8745 static u_int64_t startTime();
8752 static u_int64_t usecRunTime(Type type = WallTime);
8759 static u_int64_t msecRunTime(Type type = WallTime);
8766 static u_int32_t secRunTime(Type type = WallTime);
8773 static double runTime(Type type = WallTime);
const char * token
Definition: yateclass.h:869
A Mutex pool.
Definition: yateclass.h:5696
int sendTo(const void *buffer, int length, const SocketAddr &addr, int flags=0)
Definition: yateclass.h:7771
Time & operator=(u_int64_t usec)
Definition: yateclass.h:3997
String & operator+=(bool value)
Definition: yateclass.h:2670
A DNS record.
Definition: yateclass.h:8067
Internal helper class.
Definition: yateclass.h:1279
const char * c_safe(const char *str)
Definition: yateclass.h:3163
int count() const
Definition: yateclass.h:3641
bool null() const
Definition: yateclass.h:2265
Abstract interface for lockable objects.
Definition: yateclass.h:5523
int writeData(const DataBlock &buf)
Definition: yateclass.h:6956
RefPointer(const RefPointer< Obj > &value)
Definition: yateclass.h:1333
const char * debugColor(int level)
Compressor(const char *format, const char *name=0)
Definition: yateclass.h:8580
GenPointer()
Definition: yateclass.h:1397
DataBlock & operator+=(const DataBlock &value)
Definition: yateclass.h:4427
int locks() const
Definition: yateclass.h:6074
GenObject * operator[](unsigned int index) const
Definition: yateclass.h:1771
static bool alive(const RefObject *obj)
Definition: yateclass.h:1237
UChar & operator=(char code)
Definition: yateclass.h:2015
unsigned int index(void *ptr) const
Definition: yateclass.h:5723
void setDelete(bool autodelete)
Definition: yateclass.h:1828
bool hmacStart(DataBlock &opad, const DataBlock &key)
Definition: yateclass.h:4592
const char * c_str() const
Definition: yateclass.h:2236
GenObject * operator[](signed int index) const
Definition: yateclass.h:1763
A class that holds just a block of raw data.
Definition: yateclass.h:4236
ObjList * getList(unsigned int index) const
Definition: yateclass.h:3698
String sqlEscape(char extraEsc=0) const
Definition: yateclass.h:3081
int debugLevel() const
Definition: yateclass.h:330
ObjList * next() const
Definition: yateclass.h:1505
const String & getUser() const
Definition: yateclass.h:5475
u_int32_t sec() const
Definition: yateclass.h:3971
bool isNullAddr() const
Definition: yateclass.h:6612
UChar(uint32_t code=0)
Definition: yateclass.h:1974
Definition: yateclass.h:1173
int value
Definition: yateclass.h:857
A regexp matching class.
Definition: yateclass.h:3270
NamedIterator(const NamedList &list)
Definition: yateclass.h:5340
static void setObjCounting(bool enable)
Definition: yateclass.h:1116
void Debug(int level, const char *format,...)
static const char * lookupFamily(int family)
Definition: yateclass.h:6768
SOCKET handle() const
Definition: yateclass.h:7462
static unsigned int scopeId(struct sockaddr *addr)
Definition: yateclass.h:6672
A captured event string with a debug level.
Definition: yateclass.h:3403
const char * safe(const char *defStr) const
Definition: yateclass.h:2251
Regexp & operator=(const char *value)
Definition: yateclass.h:3302
String matchString(int index=0) const
Definition: yateclass.h:3002
Mutex * mutex(void *ptr) const
Definition: yateclass.h:5733
GenPointer< Obj > & operator=(Obj *object)
Definition: yateclass.h:1426
RefPointer()
Definition: yateclass.h:1326
String & operator<<(int64_t value)
Definition: yateclass.h:2738
SocketAddr & operator=(const SocketAddr &value)
Definition: yateclass.h:6462
void TraceDebug(const char *traceId, int level, const char *format,...)
~Lock2()
Definition: yateclass.h:5933
GenObject * operator[](unsigned int index) const
Definition: yateclass.h:1553
GenPointer< Obj > & operator=(const GenPointer< Obj > &value)
Definition: yateclass.h:1420
ObjList * skipNull() const
A NAPTR record.
Definition: yateclass.h:8239
void toTimeval(struct timeval *tv) const
Definition: yateclass.h:4016
bool eof() const
Definition: yateclass.h:3904
static bool capturing()
Definition: yateclass.h:3437
MemoryStream()
Definition: yateclass.h:7045
bool decrypt(DataBlock &data)
Definition: yateclass.h:8558
uint32_t code() const
Definition: yateclass.h:2022
virtual bool init(bool comp=true, bool decomp=true, const NamedList ¶ms=NamedList::empty())
Definition: yateclass.h:8604
bool connectAsync(const SocketAddr &addr, unsigned int toutUs, bool *timeout=0)
Definition: yateclass.h:7710
A filter for received socket data.
Definition: yateclass.h:6813
const String & hexDigest()
Definition: yateclass.h:4529
const char * strcat(String &dest, const char *src)
Definition: yateclass.h:3216
const String & format() const
Definition: yateclass.h:8594
NamedIterator & operator=(const NamedList &list)
Definition: yateclass.h:5356
const String & address() const
Definition: yateclass.h:8203
bool autoDelete()
Definition: yateclass.h:1652
UChar(int32_t code)
Definition: yateclass.h:1982
Formatting
Definition: yateclass.h:741
virtual ~GenObject()
Definition: yateclass.h:1060
static void append(int level, const char *text)
Definition: yateclass.h:3452
Thread support class.
Definition: yateclass.h:6004
bool update(const String &str)
Definition: yateclass.h:4554
bool locked() const
Definition: yateclass.h:6081
const String & getExtra() const
Definition: yateclass.h:5496
~Lock()
Definition: yateclass.h:5855
int writeDecomp(const String &data, bool flush)
Definition: yateclass.h:8704
SeekPos
Definition: yateclass.h:6879
constant YSTRING(const char *string)
A stream file class.
Definition: yateclass.h:7124
bool hmac(const String &key, const String &msg)
Definition: yateclass.h:4636
static int unStringify(uint8_t *buf, const String &host, int family=Unknown)
Definition: yateclass.h:6652
const Regexp & regexp() const
Definition: yateclass.h:8290
RefPointer< Obj > & operator=(const RefPointer< Obj > &value)
Definition: yateclass.h:1353
static const char * boolText(bool value)
Definition: yateclass.h:2229
bool lock(Mutex &mx1, Mutex &mx2, long maxwait=-1)
Definition: yateclass.h:5959
static unsigned int appendTo(String &buf, uint64_t time, int frac=0)
Definition: yateclass.h:4143
Stream()
Definition: yateclass.h:7021
unsigned int length() const
Definition: yateclass.h:5057
static bool getObjCounting()
Definition: yateclass.h:1109
bool null() const
Definition: yateclass.h:6524
void enable(bool val)
Definition: yateclass.h:3622
String uriEscape(char extraEsc=0, const char *noEsc=0) const
Definition: yateclass.h:3108
bool compile() const
Definition: yateclass.h:3309
bool checkBOM() const
Definition: yateclass.h:2339
bool hmac(const DataBlock &key, const DataBlock &msg)
Definition: yateclass.h:4627
const String & flags() const
Definition: yateclass.h:8276
Socket * socket() const
Definition: yateclass.h:6856
virtual unsigned int hashLength() const
Definition: yateclass.h:4931
Lock(Lockable &lck, long maxwait=-1)
Definition: yateclass.h:5841
An abstract cipher.
Definition: yateclass.h:8418
virtual unsigned int hashLength() const
Definition: yateclass.h:4834
~RefPointer()
Definition: yateclass.h:1347
unsigned int length() const
Definition: yateclass.h:3683
u_int64_t msec() const
Definition: yateclass.h:3978
ObjList * getColumn(int column) const
Definition: yateclass.h:1943
Time()
Definition: yateclass.h:3932
SocketRef(Socket *&socket)
Definition: yateclass.h:8046
unsigned char * data(unsigned int offs, unsigned int len=1) const
Definition: yateclass.h:4298
void XDebug(int level, const char *format,...)
static unsigned int rawLength()
Definition: yateclass.h:4827
Base64(void *src, unsigned int len, bool copyData=true)
Definition: yateclass.h:4962
String & operator<<(const char *value)
Definition: yateclass.h:2714
bool connect(const SocketAddr &addr)
Definition: yateclass.h:7687
int port() const
Definition: yateclass.h:8210
Obj * pointer() const
Definition: yateclass.h:1312
String uriUnescape(int *errptr=0) const
Definition: yateclass.h:3124
~Time()
Definition: yateclass.h:3964
A socket address holder.
Definition: yateclass.h:6399
ObjVector(bool autodelete=true)
Definition: yateclass.h:1699
static u_int64_t fromTimeval(const struct timeval &tv)
Definition: yateclass.h:4038
bool debugChained() const
Definition: yateclass.h:372
void resize(unsigned int len)
Definition: yateclass.h:4386
int order() const
Definition: yateclass.h:8100
URI & operator=(const char *value)
Definition: yateclass.h:5454
const String & name() const
Definition: yateclass.h:3495
SocketRef(Socket **socket)
Definition: yateclass.h:8038
static const String * atom(const String *&str, const char *val)
String & operator<<(uint64_t value)
Definition: yateclass.h:2744
const char * debugName() const
Definition: yateclass.h:358
virtual int64_t length()
Definition: yateclass.h:7097
virtual ~Compressor()
Definition: yateclass.h:8587
String & operator<<(double value)
Definition: yateclass.h:2756
A list based Array.
Definition: yateclass.h:1845
MemoryStream(const DataBlock &data)
Definition: yateclass.h:7053
bool bind(const SocketAddr &addr)
Definition: yateclass.h:7613
unsigned int length() const
Definition: yateclass.h:3856
virtual void * getObject(const String &name) const
SrvRecord(int ttl, int prio, int weight, const char *addr, int port)
Definition: yateclass.h:8195
NamedIterator & operator=(const NamedIterator &original)
Definition: yateclass.h:5363
void set(u_int32_t seed)
Definition: yateclass.h:4207
GenObject * remove(bool delobj=true)
void * userObject(const String &name) const
Definition: yateclass.h:3570
const String & nextName() const
Definition: yateclass.h:8304
void debugName(const char *name)
Definition: yateclass.h:393
Hasher()
Definition: yateclass.h:4655
RefPointer< Obj > & operator=(Obj *object)
Definition: yateclass.h:1359
uint32_t hashInt64(uint64_t val)
Definition: yateclass.h:1015
GenObject * at(int index) const
Definition: yateclass.h:1755
NamedList & setParam(NamedString *param)
Definition: yateclass.h:5094
Ephemeral object counter changer.
Definition: yateclass.h:6351
static bool stripBOM(const char *&str)
Definition: yateclass.h:2347
uint32_t hashPtr(const void *ptr)
Definition: yateclass.h:1035
bool acquire(Lockable &lck, long maxwait=-1)
Definition: yateclass.h:5887
virtual bool getParams(const String ¶ms, NamedList &result)
Definition: yateclass.h:7551
static ObjList & eventsRw()
Definition: yateclass.h:3460
Type
Definition: yateclass.h:8328
Encapsulates a runnable task.
Definition: yateclass.h:5983
virtual bool valid() const
Definition: yateclass.h:7074
CapturedEvent(int level, const char *text)
Definition: yateclass.h:3413
int writeComp(const String &data, bool flush)
Definition: yateclass.h:8666
Base64 & operator<<(const DataBlock &data)
Definition: yateclass.h:4999
Abstract SCTP Socket.
Definition: yateclass.h:7919
struct sockaddr * address() const
Definition: yateclass.h:6598
A standard SHA1 digest calculator.
Definition: yateclass.h:4762
GenPointer(Obj *object)
Definition: yateclass.h:1413
uint32_t toNtp(uint32_t *over=0, bool rfc2030=true)
Definition: yateclass.h:4106
Time(const struct timeval *tv)
Definition: yateclass.h:3948
Encapsulation for an URI.
Definition: yateclass.h:5395
int family() const
Definition: yateclass.h:6531
unsigned int count() const
Definition: yateclass.h:5064
void overAlloc(unsigned int bytes)
Definition: yateclass.h:4335
Time & operator-=(int64_t delta)
Definition: yateclass.h:4009
Hasher & operator<<(const String &value)
Definition: yateclass.h:4561
String & operator=(const String &value)
Definition: yateclass.h:2567
String & operator=(bool value)
Definition: yateclass.h:2619
static bool checkBOM(const char *str)
Definition: yateclass.h:2332
URI & operator=(const URI &value)
Definition: yateclass.h:5440
int operator[](signed int index) const
Definition: yateclass.h:4408
A class exposing system resources usage.
Definition: yateclass.h:8724
static void capturing(bool capture)
Definition: yateclass.h:3467
const char * token
Definition: yateclass.h:852
int lookup(const char *str, const TokenDict *tokens, int defvalue=0, int base=0)
int operator[](unsigned int index) const
Definition: yateclass.h:4416
CapturedEvent(const CapturedEvent &original)
Definition: yateclass.h:3421
bool eof() const
Definition: yateclass.h:5375
GenObject * operator[](signed int index) const
Definition: yateclass.h:1545
virtual void * getObject(const String &name) const
Definition: yateclass.h:8055
Base64 & operator<<(const String &value)
Definition: yateclass.h:4993
void destruct(GenObject *obj)
Definition: yateclass.h:1157
bool initVector(const DataBlock &vect, Direction dir=Bidir)
Definition: yateclass.h:8524
static unsigned int rawLength()
Definition: yateclass.h:4740
const String & host() const
Definition: yateclass.h:6560
bool scopeId(unsigned int val)
Definition: yateclass.h:6553
URI & operator=(const String &value)
Definition: yateclass.h:5447
char operator[](signed int index) const
Definition: yateclass.h:2519
void assign(RefObject *oldptr, RefObject *newptr, void *pointer)
int64_t seek(int64_t offset)
Definition: yateclass.h:6986
ObjList * paramList()
Definition: yateclass.h:5313
UChar(unsigned char code)
Definition: yateclass.h:1998
UChar & operator=(uint32_t code)
Definition: yateclass.h:2007
static String & appendTo(String &buf, const String &addr, int port, int family=Unknown)
Definition: yateclass.h:6713
Obj & operator*() const
Definition: yateclass.h:1378
TxtRecord(int ttl, const char *text)
Definition: yateclass.h:8146
RefPointer(Obj *object)
Definition: yateclass.h:1341
DSCP
Definition: yateclass.h:7378
GenObject * userData() const
Definition: yateclass.h:3548
A single Unicode character.
Definition: yateclass.h:1962
void append(void *value, unsigned int len)
Definition: yateclass.h:4358
bool unHexify(const String &data)
Definition: yateclass.h:4476
static String appendTo(const String &addr, int port, int family=Unknown)
Definition: yateclass.h:6726
void TraceDebugObj(GenObject *obj, int level, const char *format,...)
A time holding class.
Definition: yateclass.h:3926
Time & operator+=(int64_t delta)
Definition: yateclass.h:4003
static bool isLeap(unsigned int year)
Definition: yateclass.h:4167
SocketAddr(const SocketAddr &value)
Definition: yateclass.h:6434
const String & text() const
Definition: yateclass.h:8154
const String * operator->() const
Definition: yateclass.h:3392
virtual bool lock(long maxwait=-1)=0
Obj & operator*() const
Definition: yateclass.h:1445
Direction
Definition: yateclass.h:8424
A holder for a debug level.
Definition: yateclass.h:311
Lock2(Mutex *mx1, Mutex *mx2, long maxwait=-1)
Definition: yateclass.h:5916
RefObject holding a Socket pointer.
Definition: yateclass.h:8031
A generic socket class.
Definition: yateclass.h:7360
DataBlock m_data
Definition: yateclass.h:7112
virtual unsigned int hashLength() const
Definition: yateclass.h:4747
int error() const
Definition: yateclass.h:6894
void * data() const
Definition: yateclass.h:4289
bool acquire(Lockable *lck, long maxwait=-1)
Definition: yateclass.h:5877
An abstract hashing class.
Definition: yateclass.h:4498
DebugLevel
Definition: yateclass.h:256
TempObjectCounter(NamedCounter *counter, bool enable=GenObject::getObjCounting())
Definition: yateclass.h:6360
static const NamedList & empty()
void reset()
Definition: yateclass.h:3910
String msgUnescape(int *errptr=0, char extraEsc=0) const
Definition: yateclass.h:3065
int lenUtf8(uint32_t maxChar=0x10ffff, bool overlong=false) const
Definition: yateclass.h:2283
String & operator<<(char value)
Definition: yateclass.h:2720
An object that logs messages on creation and destruction.
Definition: yateclass.h:735
int getPort() const
Definition: yateclass.h:5489
void reset()
Definition: yateclass.h:5381
Atom string holder.
Definition: yateclass.h:3370
String & operator<<(int32_t value)
Definition: yateclass.h:2726
void debugChain(const DebugEnabler *chain=0)
Definition: yateclass.h:379
A named pointer class.
Definition: yateclass.h:3528
bool enabled() const
Definition: yateclass.h:3615
class * YOBJECT(class type, GenObject *pntr)
const char * familyName() const
Definition: yateclass.h:6538
socklen_t length() const
Definition: yateclass.h:6605
constant YATOM(const char *string)
String & operator<<(bool value)
Definition: yateclass.h:2750
bool setKey(const DataBlock &key, Direction dir=Bidir)
Definition: yateclass.h:8506
String & append(const char *value, int len)
void DDebug(int level, const char *format,...)
const String & getDescription() const
Definition: yateclass.h:5461
Obj * operator->() const
Definition: yateclass.h:1439
int64_t m_offset
Definition: yateclass.h:7117
A named string class.
Definition: yateclass.h:3480
virtual void finalize(bool comp)
Definition: yateclass.h:8612
A standard SHA256 digest calculator.
Definition: yateclass.h:4859
bool setTOS(const char *tos, int defTos=Normal)
Definition: yateclass.h:7567
String msgEscape(char extraEsc=0) const
Definition: yateclass.h:3047
bool operator!=(const String &value) const
Definition: yateclass.h:2698
static unsigned int rawLength()
Definition: yateclass.h:4924
void drop()
Definition: yateclass.h:5868
bool operator==(const String &value) const
Definition: yateclass.h:2692
DNS services.
Definition: yateclass.h:8322
int getColumns() const
Definition: yateclass.h:1933
const char * c_str(const String *str)
Definition: yateclass.h:3155
DebugEnabler(int level=TelEngine::debugLevel(), bool enabled=true)
Definition: yateclass.h:319
bool null(const char *str)
Definition: yateclass.h:3179
void NDebug(int level, const char *format,...)
int pref() const
Definition: yateclass.h:8107
static void * getObject(const String &name, const GenObject *obj)
Definition: yateclass.h:1102
const String & getHost() const
Definition: yateclass.h:5482
NamedCounter * getObjCounter() const
Definition: yateclass.h:1123
Base64 encoder/decoder class.
Definition: yateclass.h:4946
void YCLASSIMP3(class type, class base1, class base2, class base3)
A hashed object list class.
Definition: yateclass.h:3657
SctpSocket()
Definition: yateclass.h:7926
void clear(bool deleteData=true)
bool stripBOM()
Definition: yateclass.h:2362
const String & addr() const
Definition: yateclass.h:6567
int refcount() const
Definition: yateclass.h:1223
void YCLASSIMP(class type, class base)
Base64 & operator<<(const char *value)
Definition: yateclass.h:5005
A named string container class.
Definition: yateclass.h:5015
String operator+(const String &s1, const String &s2)
void * m_pointer
Definition: yateclass.h:1299
DataBlock & operator+=(const String &value)
Definition: yateclass.h:4433
const String & getProtocol() const
Definition: yateclass.h:5468
char operator[](unsigned int index) const
Definition: yateclass.h:2527
virtual bool matches(const String &value) const
Definition: yateclass.h:3324
Templated smart pointer class.
Definition: yateclass.h:1305
Ephemeral mutex or semaphore locking object.
Definition: yateclass.h:5832
Lock2(Mutex &mx1, Mutex &mx2, long maxwait=-1)
Definition: yateclass.h:5926
virtual Socket * accept(SocketAddr &addr)
Definition: yateclass.h:7972
bool hmacStart(DataBlock &opad, const String &key)
Definition: yateclass.h:4601
void YCLASS3(class type, class base1, class base2, class base3)
Pseudo random number generator.
Definition: yateclass.h:4185
void Trace(GenObject *obj, int level, const char *format,...)
String & operator<<(String &str, const Complex &c)
Definition: yatemath.h:1685
GenPointer(const GenPointer< Obj > &value)
Definition: yateclass.h:1405
bool update(const void *buf, unsigned int len)
Definition: yateclass.h:4538
Hasher & operator<<(const DataBlock &data)
Definition: yateclass.h:4568
Semaphore implementation.
Definition: yateclass.h:5754
An abstract stream class capable of reading and writing.
Definition: yateclass.h:6873
void YCLASSIMP2(class type, class base1, class base2)
void clearError()
Definition: yateclass.h:7028
Base64()
Definition: yateclass.h:4953
String & append(const ObjList &list, const char *separator=0, bool force=false)
Definition: yateclass.h:2820
TempObjectCounter(const GenObject *obj, bool enable=GenObject::getObjCounting())
Definition: yateclass.h:6369
A Stream that operates on DataBlocks in memory.
Definition: yateclass.h:7038
Templated pointer that can be inserted in a list.
Definition: yateclass.h:1385
bool encrypt(DataBlock &data)
Definition: yateclass.h:8541
virtual bool matches(const String &value) const
Definition: yateclass.h:2973
static bool errorString(String &buffer)
Definition: yateclass.h:6306
virtual void * getObject(const String &name) const
Time(const struct timeval &tv)
Definition: yateclass.h:3956
Ephemeral double mutex locking object.
Definition: yateclass.h:5906
bool valid() const
Definition: yateclass.h:6517
unsigned int length() const
Definition: yateclass.h:1735
int writeDecomp(const DataBlock &data, bool flush)
Definition: yateclass.h:8694
int level() const
Definition: yateclass.h:3429
SctpSocket(SOCKET fd)
Definition: yateclass.h:7933
ObjList * getHashList(const String &str) const
Definition: yateclass.h:3714
bool isCurrent() const
Definition: yateclass.h:6236
static NamedCounter * setCurrentObjCounter(NamedCounter *counter)
HANDLE handle() const
Definition: yateclass.h:7182
static const ObjList & events()
Definition: yateclass.h:3444
A text based DNS record.
Definition: yateclass.h:8136
Definition: yateclass.h:219
int writeData(const String &str)
Definition: yateclass.h:6948
int ttl() const
Definition: yateclass.h:8093
const DataBlock & data() const
Definition: yateclass.h:7061
TOS
Definition: yateclass.h:7367
NamedPointer & operator=(const char *value)
Definition: yateclass.h:3576
NamedString & operator=(const char *value)
Definition: yateclass.h:3514
const ObjList * paramList() const
Definition: yateclass.h:5320
bool operator!=(const SocketAddr &other) const
Definition: yateclass.h:6477
A C-style string handling class.
Definition: yateclass.h:2130
Atom(const char *value)
Definition: yateclass.h:3377
void assign(Obj *object=0)
Definition: yateclass.h:1319
bool locked() const
Definition: yateclass.h:5940
const char * strcpy(String &dest, const char *src)
Definition: yateclass.h:3209
Class used to iterate the items of a list.
Definition: yateclass.h:3827
Definition: yateclass.h:848
static const TokenDict * directions()
Definition: yateclass.h:8434
Priority
Definition: yateclass.h:6014
const char * c_str() const
Definition: yateclass.h:2029
bool setIpv6OnlyOption(bool on)
Definition: yateclass.h:7519
Time(u_int64_t usec)
Definition: yateclass.h:3940
bool autoDelete()
Definition: yateclass.h:1821
TempObjectCounter(const GenObject &obj, bool enable=GenObject::getObjCounting())
Definition: yateclass.h:6378
const char * debugLevelName(int level)
DnsRecord(int ttl, int order, int pref)
Definition: yateclass.h:8078
virtual bool setParams(const NamedList ¶ms)
Definition: yateclass.h:7542
u_int64_t usec() const
Definition: yateclass.h:3985
const char * safe() const
Definition: yateclass.h:2243
int writeComp(const DataBlock &data, bool flush)
Definition: yateclass.h:8655
static bool scopeId(struct sockaddr *addr, unsigned int val)
Definition: yateclass.h:6686
void Output(const char *format,...)
const String & serv() const
Definition: yateclass.h:8283
int64_t value
Definition: yateclass.h:874
An object list class.
Definition: yateclass.h:1453
unsigned int length() const
Definition: yateclass.h:4321
unsigned int length() const
Definition: yateclass.h:2258
void TraceObj(GenObject *obj, int level, const char *format,...)
uint32_t hashInt32(uint32_t val)
Definition: yateclass.h:1025
void TraceAlarm(const char *traceId, const char *component, int level, const char *format,...)
void Alarm(const char *component, int level, const char *format,...)
Lock(Lockable *lck, long maxwait=-1)
Definition: yateclass.h:5849
bool null() const
Definition: yateclass.h:4314
void clearParams()
Definition: yateclass.h:5070
const String & repTemplate() const
Definition: yateclass.h:8297
void YCLASS(class type, class base)
NamedIterator(const NamedIterator &original)
Definition: yateclass.h:5348
unsigned int scopeId() const
Definition: yateclass.h:6545
void setDelete(bool autodelete)
Definition: yateclass.h:1659
~TempObjectCounter()
Definition: yateclass.h:6385
static bool stripBOM(char *&str)
Definition: yateclass.h:2355
bool debugEnabled() const
Definition: yateclass.h:344
int at(unsigned int offs, int defvalue=-1) const
Definition: yateclass.h:4307
bool update(const DataBlock &data)
Definition: yateclass.h:4546
Type
Definition: yateclass.h:8730
ObjList * getHashList(unsigned int hash) const
Definition: yateclass.h:3706
DnsRecord()
Definition: yateclass.h:8085
NamedList parameters iterator.
Definition: yateclass.h:5333
A vector holding GenObjects.
Definition: yateclass.h:1691
virtual bool terminate()
Definition: yateclass.h:7068
A SRV record.
Definition: yateclass.h:8182
Random(u_int32_t seed=Time::now()&0xffffffff)
Definition: yateclass.h:4192
Obj * operator->() const
Definition: yateclass.h:1372
Definition: yateclass.h:865
Lockable * locked() const
Definition: yateclass.h:5862
Mutex * mutex(unsigned int idx) const
Definition: yateclass.h:5741
void YIGNORE(primitive value)
bool matches(const char *value) const
UChar(signed char code)
Definition: yateclass.h:1990
Family
Definition: yateclass.h:6406
Mutex support.
Definition: yateclass.h:5606
unsigned int hash() const
Definition: yateclass.h:2369
A standard MD5 digest calculator.
Definition: yateclass.h:4675
RefPointerBase()
Definition: yateclass.h:1285
An abstract data (de)compressor.
Definition: yateclass.h:8570
String & operator=(const String *value)
Definition: yateclass.h:2575
Engine globals.
Definition: yatengine.h:1189
Definition: yateclass.h:1048
SocketAddr()
Definition: yateclass.h:6426
void debugEnabled(bool enable)
Definition: yateclass.h:351
unsigned int overAlloc() const
Definition: yateclass.h:4328
String & operator<<(uint32_t value)
Definition: yateclass.h:2732
int getRows() const
Definition: yateclass.h:1926
bool controlReturn(NamedList *params, bool ret, const char *retVal=0)
static Direction direction(const char *name, Direction defdir=Bidir)
Definition: yateclass.h:8443
String & operator+=(const char *value)
Definition: yateclass.h:2633
Atomic counter with name.
Definition: yateclass.h:3601
void YCLASS2(class type, class base1, class base2)