本文整理汇总了C++中Url::getHostPort方法的典型用法代码示例。如果您正苦于以下问题:C++ Url::getHostPort方法的具体用法?C++ Url::getHostPort怎么用?C++ Url::getHostPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url::getHostPort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sprintf
bool
SipRegistrar::isValidDomain(const Url& uri) const
{
bool isValid = false;
UtlString domain;
uri.getHostAddress(domain);
domain.toLower();
int port = uri.getHostPort();
if (port == PORT_NONE)
{
port = SIP_PORT;
}
char portNum[15];
sprintf(portNum,"%d",port);
domain.append(":");
domain.append(portNum);
if ( mValidDomains.contains(&domain) )
{
isValid = true;
Os::Logger::instance().log(FAC_AUTH, PRI_DEBUG,
"SipRegistrar::isValidDomain(%s) VALID",
domain.data()) ;
}
return isValid;
}
示例2: getPersistentUriKey
void HttpConnectionMap::getPersistentUriKey(const Url& url, UtlString& key)
{
UtlString urlType;
UtlString httpHost;
UtlString httpPort;
url.getUrlType(urlType);
url.getHostAddress(httpHost);
int tempPort = url.getHostPort();
UtlString httpType = (url.getScheme() == Url::HttpsUrlScheme) ? "https" : "http";
if (tempPort == PORT_NONE)
{
if (httpType == "https")
{
httpPort = "443";
}
else
{
httpPort = "80";
}
}
else
{
char t[10];
sprintf(t, "%d", tempPort);
httpPort = t;
}
key = httpType + ":" + httpHost + ":" + httpPort;
key.toLower();
}
示例3: parseRouteMatchContainer
OsStatus ForwardRules::parseRouteMatchContainer(const Url& requestUri,
const SipMessage& request,
UtlString& routeToString,
UtlString& mappingType,
bool& authRequired,
TiXmlNode* routesNode,
TiXmlNode* previousRouteMatchNode)
{
UtlString testHost;
requestUri.getHostAddress(testHost);
int testPort = requestUri.getHostPort();
if(testPort == SIP_PORT)
{
testPort = PORT_NONE;
}
UtlBoolean routeMatchFound = false;
OsStatus methodMatchFound = OS_FAILED;
TiXmlElement* routesElement = routesNode->ToElement();
TiXmlNode* routeMatchNode = previousRouteMatchNode;
// Iterate through routes container children looking for
// route tags
while ( (routeMatchNode = routesElement->IterateChildren(routeMatchNode))
&& methodMatchFound != OS_SUCCESS)
{
// Skip non-elements
if(routeMatchNode && routeMatchNode->Type() != TiXmlNode::ELEMENT)
{
continue;
}
// Skip non-route elements
TiXmlElement* routeMatchElement = routeMatchNode->ToElement();
UtlString tagValue = routeMatchElement->Value();
if(tagValue.compareTo(XML_TAG_ROUTEMATCH) != 0 )
{
continue;
}
mappingType.remove(0);
routeToString.remove(0);
const char* mappingTypePtr =
routeMatchElement->Attribute(XML_ATT_MAPPINGTYPE);
//get the mapping Type attribute
mappingType.append(mappingTypePtr ? mappingTypePtr : "");
// Iterate through the route container's children looking
// for routeFrom, routeIPv4subnet, or routeDnsWildcard elements
TiXmlNode* routeFromPatternNode = NULL;
for( routeFromPatternNode = routeMatchElement->FirstChildElement();
routeFromPatternNode;
routeFromPatternNode = routeFromPatternNode->NextSiblingElement() )
{
// Skip elements that aren't of the "domainMatches" family
enum {ret_from, ret_ip, ret_dns} routeElementType ;
const char *name = routeFromPatternNode->Value() ;
if (strcmp(name, XML_TAG_ROUTEFROM) == 0)
{
routeElementType = ret_from;
}
else if (strcmp(name, XML_TAG_ROUTEIPV4SUBNET) == 0)
{
routeElementType = ret_ip;
}
else if (strcmp(name, XML_TAG_ROUTEDNSWILDCARD) == 0)
{
routeElementType = ret_dns;
}
else
{
continue ;
}
//found "domainMatches" pattern tag
TiXmlElement* routeFromPatternElement = routeFromPatternNode->ToElement();
//get the text value from it
TiXmlNode* routeFromPatternText = routeFromPatternElement->FirstChild();
if(routeFromPatternText && routeFromPatternText->Type() == TiXmlNode::TEXT)
{
TiXmlText* Xmlpattern = routeFromPatternText->ToText();
if (Xmlpattern)
{
UtlString pattern = Xmlpattern->Value();
switch(routeElementType)
{
case ret_from: // a routeFrom element matches host and port
{
Url xmlUrl(pattern.data());
UtlString xmlHost;
xmlUrl.getHostAddress(xmlHost);
int xmlPort = xmlUrl.getHostPort();
// See if the host and port of the routeFrom elelment
// match that of the URI
//.........这里部分代码省略.........