全面支持ipv6

This commit is contained in:
ziyue
2022-05-08 16:33:33 +08:00
parent a95bf960e0
commit a44334acaf
11 changed files with 125 additions and 114 deletions

View File

@@ -17,7 +17,10 @@
namespace mediakit {
//从字符串中提取子字符串
std::string FindField(const char *buf, const char *start, const char *end, size_t bufSize = 0);
//把url解析为主机地址和端口号,兼容ipv4/ipv6/dns
void splitUrl(const std::string &url, std::string &host, uint16_t& port);
struct StrCaseCompare {
bool operator()(const std::string &__x, const std::string &__y) const {
@@ -57,8 +60,8 @@ public:
//rtsp/http/sip解析类
class Parser {
public:
Parser();
~Parser();
Parser() = default;
~Parser() = default;
//解析信令
void Parse(const char *buf);
@@ -113,6 +116,25 @@ private:
mutable StrCaseMap _mapUrlArgs;
};
//解析rtsp url的工具类
class RtspUrl{
public:
bool _is_ssl;
uint16_t _port;
std::string _url;
std::string _user;
std::string _passwd;
std::string _host;
public:
RtspUrl() = default;
~RtspUrl() = default;
void parse(const std::string &url);
private:
void setup(bool,const std::string &, const std::string &, const std::string &);
};
}//namespace mediakit
#endif //ZLMEDIAKIT_PARSER_H