Esempio n. 1
0
int
ACE_Remote_Name_Space::resolve (const ACE_NS_WString &name,
                                ACE_NS_WString &value,
                                char *&type)
{
  ACE_TRACE ("ACE_Remote_Name_Space::resolve");
  ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> name_urep (name.rep ());
  ACE_UINT32 name_len =
    static_cast<ACE_UINT32> (name.length () * sizeof (ACE_WCHAR_T));
  ACE_Name_Request request (ACE_Name_Request::RESOLVE,
                            name_urep.get (),
                            name_len,
                            0, 0, 0, 0);

  if (this->ns_proxy_.send_request (request) == -1)
    return -1;

  ACE_Name_Request reply;

  if (this->ns_proxy_.recv_reply (reply) == -1)
    return -1;

  ACE_NS_WString temp (reply.value (), reply.value_len () / sizeof (ACE_WCHAR_T));
  value = temp;
  ACE_NEW_RETURN (type,
                  char[reply.type_len () + 1],
                  -1);
  ACE_OS::strcpy (type, reply.type ());
  return 0;
}
Esempio n. 2
0
int
ACE_Remote_Name_Space::list_values (ACE_WSTRING_SET &set,
                                    const ACE_NS_WString &pattern)
{
  ACE_TRACE ("ACE_Remote_Name_Space::list_values");
  ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> pattern_urep (pattern.rep ());
  ACE_UINT32 pattern_len =
    static_cast<ACE_UINT32> (pattern.length () * sizeof (ACE_WCHAR_T));
  ACE_Name_Request request (ACE_Name_Request::LIST_VALUES,
                            pattern_urep.get (),
                            pattern_len,
                            0, 0, 0, 0);
  if (this->ns_proxy_.send_request (request) == -1)
    return -1;

  ACE_Name_Request reply (0, 0, 0, 0, 0, 0, 0, 0);

  while (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
    {
      if (this->ns_proxy_.recv_reply (reply) == -1)
        ACE_ERROR_RETURN ((LM_ERROR,
                           ACE_TEXT ("%p\n"),
                           ACE_TEXT ("ACE_Remote_Name_Space::list_values")),
                           -1);
      if (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
        {
          ACE_NS_WString value (reply.value (),
                                reply.value_len () / sizeof (ACE_WCHAR_T));
          set.insert (value);
        }
    }

  return 0;
}