- few merges from pcap analyzer project
This commit is contained in:
parent
011919f846
commit
6b6f4147db
|
|
@ -8,6 +8,10 @@
|
||||||
# include <Windows.h>
|
# include <Windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(TARGET_LINUX)
|
||||||
|
# include <arpa/inet.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "HL_Rtp.h"
|
#include "HL_Rtp.h"
|
||||||
#include "HL_Exception.h"
|
#include "HL_Exception.h"
|
||||||
#include "HL_String.h"
|
#include "HL_String.h"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright(C) 2007-2017 VoIPobjects (voipobjects.com)
|
/* Copyright(C) 2007-2025 VoIPobjects (voipobjects.com)
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
@ -10,11 +10,8 @@
|
||||||
# include "jrtplib/src/rtppacket.h"
|
# include "jrtplib/src/rtppacket.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "HL_Uuid.h"
|
#include <cstdint>
|
||||||
#include "HL_InternetAddress.h"
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
// Class to carry rtp/rtcp socket pair
|
// Class to carry rtp/rtcp socket pair
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,11 @@ int strx::toInt(const char *s, int defaultValue, bool* isOk)
|
||||||
uint64_t strx::toUint64(const char* s, uint64_t def, bool *isOk)
|
uint64_t strx::toUint64(const char* s, uint64_t def, bool *isOk)
|
||||||
{
|
{
|
||||||
uint64_t result = def;
|
uint64_t result = def;
|
||||||
if (sscanf(s, "%" SCNu64, &result) != 1)
|
#if defined(TARGET_WIN)
|
||||||
|
if (sscanf(s, "%I64d", &result) != 1)
|
||||||
|
#else
|
||||||
|
if (sscanf(s, "%llu", &result) != 1)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (isOk)
|
if (isOk)
|
||||||
*isOk = false;
|
*isOk = false;
|
||||||
|
|
|
||||||
|
|
@ -9,40 +9,40 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdint.h>
|
#include <cstdint>
|
||||||
#include "HL_Types.h"
|
#include "HL_Types.h"
|
||||||
|
|
||||||
#ifdef TARGET_OSX
|
#ifdef TARGET_OSX
|
||||||
#define stricmp strcasecmp
|
#define stricmp strcasecmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
class strx
|
class strx
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::string makeUtf8(const std::tstring& arg);
|
static std::string extractFilename(const std::string& path);
|
||||||
static std::string toUtf8(const std::tstring& arg);
|
static std::string appendPath(const std::string& s1, const std::string& s2);
|
||||||
|
|
||||||
|
static std::string makeUtf8(const std::tstring& arg);
|
||||||
|
static std::string toUtf8(const std::tstring& arg);
|
||||||
static std::tstring makeTstring(const std::string& arg);
|
static std::tstring makeTstring(const std::string& arg);
|
||||||
|
|
||||||
static int toInt(const char* s, int defaultValue, bool* isOk = nullptr);
|
static int toInt(const char* s, int defaultValue, bool* isOk = nullptr);
|
||||||
static uint64_t toUint64(const char* s, uint64_t def, bool *isOk = nullptr);
|
static uint64_t toUint64(const char* s, uint64_t def, bool *isOk = nullptr);
|
||||||
static std::string toHex(unsigned int value);
|
static std::string toHex(unsigned int value);
|
||||||
static std::string toHex(const void* ptr);
|
static std::string toHex(const void* ptr);
|
||||||
static std::string toHex(const uint8_t* input, size_t inputLength);
|
static std::string toHex(const uint8_t* input, size_t inputLength);
|
||||||
static std::string intToString(int value);
|
static std::string intToString(int value);
|
||||||
static std::string doubleToString(double value, int precision);
|
static std::string prefixLines(const std::string& source, const std::string& prefix);
|
||||||
static int fromHex2Int(const std::string& s);
|
static std::string doubleToString(double value, int precision);
|
||||||
static std::string fromHex2String(const std::string& s);
|
static int fromHex2Int(const std::string& s);
|
||||||
static float toFloat(const std::string& s, float defaultValue = 0.0, bool* isOk = nullptr);
|
static std::string fromHex2String(const std::string& s);
|
||||||
|
static float toFloat(const std::string& s, float defaultValue = 0.0, bool* isOk = nullptr);
|
||||||
|
|
||||||
static std::string extractFilename(const std::string& path);
|
|
||||||
static std::string appendPath(const std::string& s1, const std::string& s2);
|
|
||||||
|
|
||||||
static std::string prefixLines(const std::string& source, const std::string& prefix);
|
|
||||||
static const char* findSubstring(const char* buffer, const char* substring, size_t bufferLength);
|
static const char* findSubstring(const char* buffer, const char* substring, size_t bufferLength);
|
||||||
|
|
||||||
static void split(const std::string& src, std::vector<std::string>& dst, const std::string& delims);
|
static void split(const std::string& src, std::vector<std::string>& dst, const std::string& delims);
|
||||||
static std::vector<std::string> split(const std::string& src, const std::string& delims = "\n");
|
static std::vector<std::string> split(const std::string& src, const std::string& delims = "\n");
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
@ -51,7 +51,7 @@ public:
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
for (const auto& i : v)
|
for (const auto& i : v)
|
||||||
{
|
{
|
||||||
if (&i != &v[0])
|
if (&i != &v.front())
|
||||||
s << delimiter;
|
s << delimiter;
|
||||||
s << i;
|
s << i;
|
||||||
}
|
}
|
||||||
|
|
@ -60,19 +60,19 @@ public:
|
||||||
|
|
||||||
static std::pair<std::string, int> parseHost(const std::string& host, int defaultPort);
|
static std::pair<std::string, int> parseHost(const std::string& host, int defaultPort);
|
||||||
static std::pair<std::string, std::string> parseAssignment(const std::string& s, bool trimQuotes = true);
|
static std::pair<std::string, std::string> parseAssignment(const std::string& s, bool trimQuotes = true);
|
||||||
static std::string trim(const std::string& s);
|
static std::string trim(const std::string& s);
|
||||||
static std::string timeToString(time_t t);
|
static std::string timeToString(time_t t);
|
||||||
static std::string millisecondsToString(uint64_t t);
|
static std::string millisecondsToString(uint64_t t);
|
||||||
static std::string replace(const std::string& s, char f, char r);
|
static std::string replace(const std::string& s, char f, char r);
|
||||||
static std::string replace(const std::string& s, const std::string& tmpl, const std::string& n);
|
static std::string replace(const std::string& s, const std::string& tmpl, const std::string& n);
|
||||||
static std::string decodeUri(const std::string& s);
|
static std::string decodeUri(const std::string& s);
|
||||||
static bool startsWith(const std::string& s, const std::string& prefix);
|
static bool startsWith(const std::string& s, const std::string& prefix);
|
||||||
static bool endsWith(const std::string& s, const std::string& suffix);
|
static bool endsWith(const std::string& s, const std::string& suffix);
|
||||||
static int stringToDuration(const std::string& s);
|
static int stringToDuration(const std::string& s);
|
||||||
static std::string uppercase(const std::string& s);
|
|
||||||
|
static std::string uppercase(const std::string& s);
|
||||||
static std::string lowercase(const std::string& s);
|
static std::string lowercase(const std::string& s);
|
||||||
static std::string removeQuotes(const std::string& s);
|
static std::string removeQuotes(const std::string& s);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class XcapHelper
|
class XcapHelper
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue