当前位置: 首页>>代码示例>>C++>>正文


C++ Url::getHostPort方法代码示例

本文整理汇总了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;
}
开发者ID:ClydeFroq,项目名称:sipxecs,代码行数:29,代码来源:SipRegistrar.cpp

示例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();
}
开发者ID:Konnekt,项目名称:lib-sipx,代码行数:32,代码来源:HttpConnectionMap.cpp

示例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
//.........这里部分代码省略.........
开发者ID:ClydeFroq,项目名称:sipxecs,代码行数:101,代码来源:ForwardRules.cpp


注:本文中的Url::getHostPort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。