示例#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;
}
示例#2
0
int
ACE_Remote_Name_Space::unbind (const ACE_NS_WString &name)
{
  ACE_TRACE ("ACE_Remote_Name_Space::unbind");
  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::UNBIND,
                            name_urep.get (),
                            name_len,
                            0, 0, 0, 0);
  return this->ns_proxy_.request_reply (request);
}
示例#3
0
int
ACE_Remote_Name_Space::rebind (const ACE_NS_WString &name,
                               const ACE_NS_WString &value,
                               const char *type)
{
  ACE_TRACE ("ACE_Remote_Name_Space::rebind");
  ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> name_urep (name.rep ());
  ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> value_urep (value.rep ());
  ACE_UINT32 name_len =
    static_cast<ACE_UINT32> (name.length () * sizeof (ACE_WCHAR_T));
  ACE_UINT32 value_len =
    static_cast<ACE_UINT32> (value.length () * sizeof (ACE_WCHAR_T));
  ACE_UINT32 type_len =
    static_cast<ACE_UINT32> (ACE_OS::strlen (type));
  ACE_Name_Request request (ACE_Name_Request::REBIND,
                            name_urep.get (),
                            name_len,
                            value_urep.get (),
                            value_len,
                            type,
                            type_len);
  return this->ns_proxy_.request_reply (request);
}
示例#4
0
int
ACE_Name_Handler::lists_entries (void)
{
  ACE_TRACE (ACE_TEXT ("ACE_Name_Handler::lists_entries"));
  ACE_BINDING_SET set;
  ACE_NS_WString pattern (this->name_request_.name (),
                          this->name_request_.name_len () / sizeof (ACE_WCHAR_T));

  int result = -1;

  const ACE_Name_Request::Constants msg_type =
    static_cast<ACE_Name_Request::Constants> (this->name_request_.msg_type ());

  // NOTE:  This multi-branch conditional statement used to be
  // (and should be) a switch statement.  However, it caused
  // Internal compiler error 980331 with egcs 1.1 (2.91.57).
  // So, the pointer-to-member-function temporary has been removed.
  if (msg_type == ACE_Name_Request::LIST_NAME_ENTRIES)
    {
#if 0
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("request for LIST_NAME_ENTRIES\n")));
#endif /* 0 */
      result = this->naming_context ()->
        ACE_Naming_Context::list_name_entries (set, pattern);
    }
  else if (msg_type == ACE_Name_Request::LIST_VALUE_ENTRIES)
    {
#if 0
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("request for LIST_VALUE_ENTRIES\n")));
#endif /* 0 */
      result = this->naming_context ()->
        ACE_Naming_Context::list_value_entries (set, pattern);
    }
  else if (msg_type == ACE_Name_Request::LIST_TYPE_ENTRIES)
    {
#if 0
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("request for LIST_TYPE_ENTRIES\n")));
#endif /* 0 */
      result = this->naming_context ()->
        ACE_Naming_Context::list_type_entries (set, pattern);
    }
  else
    return -1;

  if (result == 0)
    {
      ACE_Name_Binding *one_entry = 0;

      for (ACE_Unbounded_Set_Iterator<ACE_Name_Binding> set_iterator (set);
           set_iterator.next (one_entry) !=0;
           set_iterator.advance())
        {
           ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T>
             name_urep (one_entry->name_.rep ());
           ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T>
             value_urep (one_entry->value_.rep ());
           ACE_Name_Request mynrq (this->name_request_.msg_type (),
                                  name_urep.get (),
                                  one_entry->name_.length () * sizeof (ACE_WCHAR_T),
                                  value_urep.get (),
                                  one_entry->value_.length () * sizeof (ACE_WCHAR_T),
                                  one_entry->type_,
                                  ACE_OS::strlen (one_entry->type_));

          if (this->send_request (mynrq) == -1)
            return -1;
        }

      // send last message indicator
      ACE_Name_Request nrq (ACE_Name_Request::MAX_ENUM, 0, 0, 0, 0, 0, 0);

      if (this->send_request (nrq) == -1)
        return -1;
    }
  else
    {
      // None found so send blank request back.
      ACE_Name_Request end_rq (ACE_Name_Request::MAX_ENUM, 0, 0, 0, 0, 0, 0);

      if (this->send_request (end_rq) == -1)
        return -1;
    }

  return 0;
}