Exemplo n.º 1
0
    bool
    ClientRequestHandler::parse_address (const ACE_CString& str, ACE_INET_Addr& addr)
      {
        static const int eof_ = std::char_traits<char>::eof ();

        ACE::IOS::CString_OStream sos_host;
        u_short port_hi = 0, port_lo = 0;

        ACE::IOS::CString_IStream sis (str);
        sis.ignore (str.length (), '(');
        int ch = sis.get ();
        if (ACE_OS::ace_isdigit (ch))
          {
            for (int i=0; i<4 ;++i)
              {
                if (ch == ',')
                  {
                    sos_host.put ('.');
                    ch = sis.get ();
                  }
                while (ch != eof_ && ACE_OS::ace_isdigit (ch))
                  {
                    sos_host.put (ch);
                    ch = sis.get ();
                  }
              }
            if (ch == ',')
              {
                sis >> port_hi;
                ch = sis.get ();
                if (ch == ',')
                  {
                    sis >> port_lo;

                    u_short port = port_hi*256 + port_lo;
                    addr.set (port, sos_host.str ().c_str ());
                    return true;
                  }
              }
Exemplo n.º 2
0
void Request::arguments (ACE_Array<ACE_CString> & args) const
{
    ACE::IOS::CString_IStream sis (this->args_);

    int ch = sis.get ();
    while (ch != eof_)
    {
        // skip whitespace
        while (ACE_OS::ace_isspace (ch))  ch = sis.get ();
        if (ch != eof_)
        {
            // get arg
            ACE_Array<ACE_CString>::size_type n =
                args.size ();
            args.size (n + 1);
            ACE_CString& arg = args[n];
            while (ch != eof_ && !ACE_OS::ace_isspace (ch))
            {
                arg += ch;
                ch = sis.get ();
            }
        }
    }
}