/** * The naming service shall provide a command line utility to remove a specified * object group from the naming service. * Removes the specified object group from the naming service. */ int NS_group_svc::group_remove (const ACE_TCHAR* group_name) { if (group_name == 0) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("group_remove args not provided\n")), -2); } try { this->naming_manager_->delete_object_group ( ACE_TEXT_ALWAYS_CHAR (group_name)); } catch (const PortableGroup::ObjectGroupNotFound&) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("\nUnable to find group %s\n"), group_name), -1); } catch (const CORBA::Exception&) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("\nUnable to remove group %s\n"), group_name), -1); } return 0; }
int TAO_ECG_UDP_EH::open (const ACE_INET_Addr& ipaddr, int reuse_addr) { // Check that we haven't been closed already. if (!this->receiver_) return -1; if (this->dgram_.open (ipaddr, PF_INET, 0, reuse_addr) == -1) ORBSVCS_ERROR_RETURN ((LM_ERROR, "Unable to open udp handler: " "error opening receiving dgram.\n"), -1); if (!this->reactor () || 0 != this->reactor ()->register_handler (this->dgram_.get_handle (), this, ACE_Event_Handler::READ_MASK)) { this->dgram_.close (); ORBSVCS_ERROR_RETURN ((LM_ERROR, "Cannot register handler with reactor.\n"), -1); } return 0; }
int TAO::SSLIOP::Acceptor::parse_options_i (int &argc, ACE_CString ** argv) { //first, do the base class parser, then parse the leftovers. int result = this->IIOP_SSL_Acceptor::parse_options_i(argc,argv); if (result == -1) return result; // then parse out our own options. int i = 0; while (i < argc) { // since the base class has already iterated over the list once, // it has vound any ill-formed options. Therefore we don't need // to do that again here. int slot = argv[i]->find ("="); ACE_CString name = argv[i]->substring (0, slot); ACE_CString value = argv[i]->substring (slot + 1); if (name == "priority") { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) Invalid SSLIOP endpoint format: ") ACE_TEXT ("endpoint priorities no longer supported.\n"), value.c_str ()), -1); } else if (ACE_OS::strcmp (name.c_str (), "ssl_port") == 0) { int ssl_port = ACE_OS::atoi (value.c_str ()); if (ssl_port >= 0 && ssl_port < 65536) this->ssl_component_.port = ssl_port; else ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) Invalid ") ACE_TEXT ("IIOP/SSL endpoint ") ACE_TEXT ("port: <%s>\n"), value.c_str ()), -1); } else { // the name is not known, skip to the next option i++; continue; } // at the end, we've consumed this argument. Shift the list and // put this one on the end. This technique has the effect of // putting them in reverse order, but that doesn't matter, since // these arguments are only whole strings. argc--; ACE_CString *temp = argv[i]; for (int j = i; j <= argc-1; j++) argv[j] = argv[j+1]; argv[argc] = temp; } return 0; }
int TAO_Naming_Server::write_ior_to_file (const char* ior_string, const char* file_name) { if ((file_name != 0) && (ior_string != 0)) { FILE *iorf = ACE_OS::fopen (file_name, ACE_TEXT("w")); if (iorf == 0) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT("Unable to open %s for writing:(%u) %p\n"), file_name, ACE_ERRNO_GET, ACE_TEXT("Naming_Server::write_ior_to_file")), -1); } ACE_OS::fprintf (iorf, "%s\n", ior_string); ACE_OS::fclose (iorf); } else { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Invalid file name or IOR string provided") ACE_TEXT ("to TAO_Naming_Server::write_ior_to_file\n")), -1); } return 0; }
int TAO_AV_UDP_QoS_Session_Helper::activate_qos_handler (ACE_QoS_Session *qos_session, TAO_AV_UDP_QoS_Flow_Handler *handler) { ACE_QoS_Decorator* qos_decorator; // Decorate the above handler with QoS functionality. ACE_NEW_RETURN (qos_decorator, ACE_QoS_Decorator (handler, qos_session, handler->av_core ()->reactor ()), -1); // Initialize the Decorator. if (qos_decorator->init () != 0) ORBSVCS_ERROR_RETURN ((LM_ERROR, "QoS Decorator init () failed (%N|%l)\n"), -1); // Register the decorated Event Handler with the Reactor. int result = handler->av_core ()->reactor ()->register_handler (qos_decorator, ACE_Event_Handler::QOS_MASK | ACE_Event_Handler::READ_MASK); if (result == -1) ORBSVCS_ERROR_RETURN ((LM_ERROR, "Error in registering the Decorator with the Reactor (%N|%l)\n"), -1); return 0; }
int FT_EventService::report_factory(CORBA::ORB_ptr orb, FtRtecEventChannelAdmin::EventChannel_ptr ec) { try{ char* addr = ACE_OS::getenv("EventChannelFactoryAddr"); if (addr != 0) { // instaniated by object factory, report my ior back to the factory ACE_INET_Addr factory_addr(addr); ACE_SOCK_Connector connector; ACE_SOCK_Stream stream; ORBSVCS_DEBUG((LM_DEBUG,"connecting to %s\n",addr)); if (connector.connect(stream, factory_addr) == -1) ORBSVCS_ERROR_RETURN((LM_ERROR, "(%P|%t) Invalid Factory Address\n"), -1); ORBSVCS_DEBUG((LM_DEBUG,"Factory connected\n")); CORBA::String_var my_ior_string = orb->object_to_string(ec); int len = ACE_OS::strlen(my_ior_string.in()) ; if (stream.send_n(my_ior_string.in(), len) != len) ORBSVCS_ERROR_RETURN((LM_ERROR, "(%P|%t) IOR Transmission Error\n"), -1); stream.close(); } } catch (...){ return -1; } return 0; }
int TAO_Notify_Service_Driver::resolve_naming_service (void) { try { CORBA::Object_var naming_obj = this->orb_->resolve_initial_references ("NameService"); // Need to check return value for errors. if (CORBA::is_nil (naming_obj.in ())) ORBSVCS_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to resolve the Naming Service.\n"), -1); this->naming_ = CosNaming::NamingContextExt::_narrow (naming_obj.in ()); } catch (const CORBA::Exception &) { ORBSVCS_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to resolve the Naming Service.\n"), -1); } catch (...) { ORBSVCS_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to resolve the Naming Service.\n"), -1); } return 0; }
int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { Notify_Logging_Service service; Logging_Svc_Shutdown killer (service); Service_Shutdown kill_contractor (killer); try { int rc; rc = service.init (argc, argv); if (rc == -1) ORBSVCS_ERROR_RETURN ((LM_ERROR, "Failed to initialize the Telecom Log Service.\n"), 1); rc = service.run (); if (rc == -1) ORBSVCS_ERROR_RETURN ((LM_ERROR, "Failed to start the Telecom Log Service.\n"), 1); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Failed to start the Telecom Log Service.\n"); return 1; } return 0; }
/** * The naming service shall provide a command line utility to display an object * reference from a specified object group. * Displays the object reference that cooresponds to the specified member of an * object group. */ int NS_group_svc::member_show ( const ACE_TCHAR* group_name, const ACE_TCHAR* location) { if (group_name == 0 || location == 0) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("member_show args not provided\n")), -2); } //Get and display IOR for the member location try { PortableGroup::Location location_name (1); location_name.length (1); location_name[0].id = CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (location)); PortableGroup::ObjectGroup_var group_var = this->naming_manager_->get_object_group_ref_from_name ( ACE_TEXT_ALWAYS_CHAR (group_name)); CORBA::Object_var ior_var = this->naming_manager_->get_member_ref (group_var.in(), location_name); CORBA::String_var ior_string = this->orb_->object_to_string (ior_var.in()); ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("%C\n"), ior_string.in())); } catch (const PortableGroup::ObjectGroupNotFound&) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("\nUnable to find group %s\n"), group_name), -1); } catch (const PortableGroup::MemberNotFound&) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("\nUnable to find member location %s\n"), location), -1); } catch (const CORBA::Exception&) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("\nUnable to show member location %s\n"), location), -1); } return 0; }
/** * The naming service shall provide a command line utility for removing object * references from an object group. * Removes the specified member object from the specified object group. */ int NS_group_svc::member_remove ( const ACE_TCHAR* group_name, const ACE_TCHAR* location) { if (group_name == 0 || location == 0) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("member_remove args not provided\n")), -2); } /** * Remove an object at a specific location from the given * ObjectGroup. Deletion of application created objects must be * deleted by the application. Objects created by the * infrastructure (load balancer) will be deleted by the * infrastructure. */ try { PortableGroup::Location location_name; location_name.length (1); location_name[0].id = CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (location)); PortableGroup::ObjectGroup_var group_var = this->naming_manager_->get_object_group_ref_from_name ( ACE_TEXT_ALWAYS_CHAR (group_name)); group_var = this->naming_manager_->remove_member (group_var.in(), location_name); } catch (const PortableGroup::ObjectGroupNotFound&) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("\nUnable to find group %s\n"), group_name), -1); } catch (const PortableGroup::MemberNotFound&) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("\nUnable to find member %s\n"), location), -1); } catch (const CORBA::Exception&) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("\nUnable to remove member %s\n"), location), -1); } return 0; }
int TAO_AV_TCP_Flow_Handler::open (void * /*arg*/) { #if defined (TCP_NODELAY) int nodelay = 1; if (this->peer ().set_option (IPPROTO_TCP, TCP_NODELAY, (void *) &nodelay, sizeof (nodelay)) == -1) ORBSVCS_ERROR_RETURN ((LM_ERROR, "NODELAY failed\n"), -1); #endif /* TCP_NODELAY */ int buf_size = BUFSIZ; int s = sizeof (buf_size); if (this->peer ().get_option (SOL_SOCKET, /*IPPROTO_TCP,*/ SO_RCVBUF, (void *) &buf_size, &s) == -1) buf_size = BUFSIZ; ((TAO_AV_TCP_Object*)(this->protocol_object_))->frame_.size (buf_size); // Called by the <Strategy_Acceptor> when the handler is completely // connected. ACE_INET_Addr addr; if (this->peer ().get_remote_addr (addr) == -1) return -1; ACE_TCHAR server[MAXHOSTNAMELEN + 16]; (void) addr.addr_to_string (server, sizeof (server)); if (TAO_debug_level > 0) if (TAO_debug_level > 0) ORBSVCS_DEBUG ((LM_DEBUG, "(%P|%t) connection to server <%s> on %d\n", server, this->peer ().get_handle ())); this->peer ().enable (ACE_NONBLOCK); // Register the handler with the reactor. if (this->reactor () && this->reactor ()->register_handler (this, ACE_Event_Handler::READ_MASK) == -1) ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("unable to register client handler")), -1); return 0; }
int TAO_AV_UDP_QoS_Session_Helper::set_qos (ACE_Flow_Spec &ace_flow_spec, TAO_AV_UDP_QoS_Flow_Handler *handler) { ACE_QoS* ace_qos = 0; ACE_NEW_RETURN (ace_qos, ACE_QoS, -1); Fill_ACE_QoS fill_ace_qos; if (handler->flowspec_entry ()->role () == TAO_FlowSpec_Entry::TAO_AV_PRODUCER) { if (fill_ace_qos.fill_simplex_sender_qos (*ace_qos, &ace_flow_spec) !=0) ORBSVCS_ERROR_RETURN ((LM_ERROR, "Unable to fill simplex sender qos (%N|%l)\n"), -1); else if (TAO_debug_level > 0) ORBSVCS_DEBUG ((LM_DEBUG, "Filled up the Sender QoS parameters\n")); } else if (handler->flowspec_entry ()->role () == TAO_FlowSpec_Entry::TAO_AV_CONSUMER) { if (fill_ace_qos.fill_simplex_receiver_qos (*ace_qos, &ace_flow_spec) !=0) ORBSVCS_ERROR_RETURN ((LM_ERROR, "Unable to fill simplex receiver qos (%N|%l)\n"), -1); else if (TAO_debug_level > 0) ORBSVCS_DEBUG ((LM_DEBUG, "Filled up the Receiver QoS parameters\n")); } ACE_QoS_Manager qos_manager = handler->get_socket ()->qos_manager (); // Set the QoS for the session. Replaces the ioctl () call that // was being made previously. if (handler->qos_session ()->qos (handler->get_socket (), &qos_manager, *ace_qos) == -1) ORBSVCS_ERROR_RETURN ((LM_ERROR, "Unable to set QoS (%N|%l)\n"), -1); else ORBSVCS_DEBUG ((LM_DEBUG, "Setting QOS succeeds\n")); return 0; }
int ifr_removing_visitor::visit_root (AST_Root *node) { try { CORBA::Container_var new_scope = CORBA::Container::_narrow (be_global->repository ()); if (be_global->ifr_scopes ().push (new_scope.in ()) != 0) { ORBSVCS_ERROR_RETURN (( LM_ERROR, ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -") ACE_TEXT (" scope push failed\n") ), -1 ); } if (this->visit_scope (node) == -1) { ORBSVCS_ERROR_RETURN (( LM_ERROR, ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -") ACE_TEXT (" visit_scope failed\n") ), -1 ); } CORBA::Container_ptr tmp = CORBA::Container::_nil (); if (be_global->ifr_scopes ().pop (tmp) != 0) { ORBSVCS_ERROR_RETURN (( LM_ERROR, ACE_TEXT ("(%N:%l) ifr_removing_visitor::visit_root -") ACE_TEXT (" scope pop failed\n") ), -1 ); } } catch (const CORBA::Exception& ex) { ex._tao_print_exception (ACE_TEXT ("visit_root")); return -1; } return 0; }
int TAO_AV_SCTP_SEQ_Object::handle_input (void) { int n = this->transport_->recv (this->frame_.rd_ptr (), this->frame_.size ()); if (n == -1) ORBSVCS_ERROR_RETURN ((LM_ERROR,"TAO_AV_SCTP_SEQ_Flow_Handler::handle_input recv failed\n"),-1); if (n == 0) ORBSVCS_ERROR_RETURN ((LM_ERROR,"TAO_AV_SCTP_SEQ_Flow_Handler::handle_input connection closed\n"),-1); this->frame_.wr_ptr (this->frame_.rd_ptr () + n); return this->callback_->receive_frame (&this->frame_); }
int TAO_AV_RTP_Object::handle_input (void) { TAO_AV_frame_info frame_info; if (TAO_debug_level > 1) ORBSVCS_DEBUG ((LM_DEBUG, "\nTAO_AV_RTP_Object::handle_input\n")); // Handles the incoming RTP packet input. this->frame_.rd_ptr (this->frame_.base ()); int n = this->transport_->recv (this->frame_.rd_ptr (), this->frame_.size ()); if (n == 0) ORBSVCS_ERROR_RETURN ( (LM_ERROR,"TAO_AV_RTP::handle_input:connection closed\n"),-1); if (n < 0) { if ((errno == EADDRNOTAVAIL) || (errno == ECONNRESET)) { this->connection_gone_ = 1; return -1; } else ORBSVCS_ERROR_RETURN ( (LM_ERROR,"TAO_AV_RTP::handle_input:recv error\n"),-1); } this->frame_.wr_ptr (this->frame_.rd_ptr () + n); ACE_Addr *addr = this->transport_->get_peer_addr (); if(this->control_object_) this->control_object_->handle_control_input (&this->frame_, *addr); // Get payload that has been converted to host byte order char *data_ptr; ACE_UINT16 length; RTP_Packet rtp_packet(this->frame_.rd_ptr (), static_cast<int> (this->frame_.length ())); rtp_packet.get_frame_info (&frame_info); rtp_packet.get_payload(&data_ptr, length); this->frame_.rd_ptr (this->frame_.base ()); ACE_OS::memcpy (this->frame_.rd_ptr (), data_ptr, length); this->frame_.wr_ptr (this->frame_.rd_ptr() + length); this->callback_->receive_frame (&this->frame_, &frame_info, *addr); return 0; }
int NS_group_svc::display_load_policy_group( FT_Naming::LoadBalancingStrategyValue strategy, const ACE_TCHAR *display_label) { if( display_label == 0 ) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("display_load_policy_group args ") ACE_TEXT ("not provided\n")), -2); } try { FT_Naming::GroupNames_var list = this->naming_manager_->groups (strategy); ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("\n%s Load Balancing Groups\n"), display_label)); if ( list->length () > 0 ) { for (unsigned int i = 0; i < list->length (); ++i) { CORBA::String_var s = CORBA::string_dup (list[i]); ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT (" %C\n"), s.in ())); } } else { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("No %s Load Balancing Groups Registered\n"), display_label)); } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception in group_list"); ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Unable to get %s group list\n"), display_label), -1); } return 0; }
int TAO_LB_Signal_Handler::perform_cleanup (int signum) { try { // Shutdown the POA. // // Shutting down the POA will cause servants "owned" by the POA // to be destroyed. Servants will then have the opportunity to // clean up all resources they are responsible for. this->poa_->destroy (1, 1); // Now shutdown the ORB. this->orb_->shutdown (1); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Caught exception"); ORBSVCS_ERROR_RETURN ((LM_ERROR, "Problem during cleanup initiated by signal %d.\n", signum), -1); } return 0; }
int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { TAO_Naming_Service naming_service; // Stuff to insure that we're gracefully shut down... Naming_Svc_Shutdown killer (naming_service); Service_Shutdown kill_contractor(killer); if (naming_service.init (argc, argv) == -1) ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT("Failed to start the Naming Service.\n")), 1); try { naming_service.run (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("NamingService"); return 1; } naming_service.fini (); return 0; }
bool NS_group_svc::group_exist ( const ACE_TCHAR* group_name ) { if (group_name == 0 ) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("group_exist args not provided\n")), false); } try { PortableGroup::ObjectGroup_var group_var = this->naming_manager_->get_object_group_ref_from_name ( ACE_TEXT_ALWAYS_CHAR (group_name)); } catch (const PortableGroup::ObjectGroupNotFound&) { return false; } return true; }
// Get ourselves a Naming service reference int TAO_AV_Endpoint_Process_Strategy::bind_to_naming_service (void) { try { if (CORBA::is_nil (this->naming_context_.in ()) == 0) return 0; CORBA::Object_var naming_obj = TAO_ORB_Core_instance ()->orb ()->resolve_initial_references ("NameService"); if (CORBA::is_nil (naming_obj.in ())) ORBSVCS_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to resolve the Name Service.\n"), -1); this->naming_context_ = CosNaming::NamingContext::_narrow (naming_obj.in ()); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ( "TAO_AV_Endpoint_Process_Strategy::bind_to_naming_service"); return -1; } return 0; }
TAO_AV_Protocol_Object* TAO_AV_TCP_Flow_Factory::make_protocol_object (TAO_FlowSpec_Entry *entry, TAO_Base_StreamEndPoint *endpoint, TAO_AV_Flow_Handler *handler, TAO_AV_Transport *transport) { TAO_AV_Callback *callback = 0; if (endpoint->get_callback (entry->flowname (), callback)) { ORBSVCS_ERROR_RETURN ((LM_ERROR, "(%N,%l) Invalid callback\n"), 0); } TAO_AV_TCP_Object *object = 0; ACE_NEW_RETURN (object, TAO_AV_TCP_Object (callback, transport), 0); callback->open (object, handler); endpoint->set_protocol_object (entry->flowname (), object); endpoint->protocol_object_set (); return object; }
int TAO_EC_Gateway_IIOP::init_i (RtecEventChannelAdmin::EventChannel_ptr supplier_ec, RtecEventChannelAdmin::EventChannel_ptr consumer_ec) { if (CORBA::is_nil (this->supplier_ec_.in ()) && CORBA::is_nil (this->consumer_ec_.in ())) { this->supplier_ec_ = RtecEventChannelAdmin::EventChannel::_duplicate (supplier_ec); this->consumer_ec_ = RtecEventChannelAdmin::EventChannel::_duplicate (consumer_ec); if (ec_control_ == 0) { ec_control_ = factory_->create_consumerec_control(this); ec_control_->activate(); } return 0; } else ORBSVCS_ERROR_RETURN ((LM_ERROR, "TAO_EC_Gateway_IIOP - init_i " "Supplier and consumer event channel reference " "should be nil.\n"), -1); }
int TAO_Notify_Service_Driver::init_ORB (int& argc, ACE_TCHAR *argv []) { this->orb_ = CORBA::ORB_init (argc, argv); ACE_LOG_MSG->open (argv[0], ACE_Log_Msg::SYSLOG, ACE_TEXT ("TAO Notify")); this->apply_timeout (this->orb_.in ()); CORBA::Object_var object = this->orb_->resolve_initial_references("RootPOA"); if (CORBA::is_nil (object.in ())) ORBSVCS_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to resolve the RootPOA.\n"), -1); this->poa_ = PortableServer::POA::_narrow (object.in ()); PortableServer::POAManager_var poa_manager = this->poa_->the_POAManager (); poa_manager->activate (); return 0; }
int Notify_Logging_Service::init_ORB (int& argc, ACE_TCHAR *argv []) { this->orb_ = CORBA::ORB_init (argc, argv); this->notify_service_ = TAO_Notify_Service::load_default (); if (this->notify_service_ == 0) { ORBSVCS_DEBUG ((LM_DEBUG, "Notify Service not found! check conf. file\n")); return -1; } CORBA::Object_var poa_object = this->orb_->resolve_initial_references("RootPOA"); if (CORBA::is_nil (poa_object.in ())) ORBSVCS_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to resolve the RootPOA.\n"), -1); this->poa_ = PortableServer::POA::_narrow (poa_object.in ()); PortableServer::POAManager_var poa_manager = this->poa_->the_POAManager (); poa_manager->activate (); return 0; }
int TAO_Hash_LogRecordStore::log (const DsLogAdmin::LogRecord &const_rec) { // Get log record size... size_t record_size = log_record_size (const_rec); // Check if we are allowed to write... if (max_size_ !=0 && ((current_size_ + record_size) >= max_size_)) return 1; // return code for log rec. full // Copy record... DsLogAdmin::LogRecord rec = const_rec; // Initialize a couple of fields first... // ACE emulation of U Long Long (for platforms that don't have one) // does not define postfix operators rec.id = ++maxid_; rec.time = ORBSVCS_Time::to_Absolute_TimeT (ACE_OS::gettimeofday ()); // First, bind the id to the LogRecord in the hash_map if (this->rec_map_.bind (rec.id, rec) != 0) { ORBSVCS_ERROR_RETURN ((LM_ERROR, "LogRecordStore (%P|%t):Failed to bind %Q in the hash map\n", rec.id), -1); } // Increment the number of records in the log ++this->num_records_; this->current_size_ += record_size; this->gauge_ += record_size; return 0; }
int TAO_IFR_Server::init_with_orb (int argc, ACE_TCHAR *argv [], CORBA::ORB_ptr orb, int use_multicast_server) { try { // Get the POA from the ORB. CORBA::Object_var poa_object = orb->resolve_initial_references ("RootPOA"); if (CORBA::is_nil (poa_object.in ())) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) IFR_Service::init_with_orb ") ACE_TEXT ("Unable to initialize the POA.\n")), -1); } PortableServer::POA_var rp = PortableServer::POA::_narrow (poa_object.in ()); return this->init_with_poa (argc, argv, orb, rp.in(), use_multicast_server); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("IFR_Service::init_with_orb"); throw; } return 0; }
int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) { Trading_Service trader; try { int check = trader.init (argc, argv); if (check != -1) { trader.run (); } else ORBSVCS_ERROR_RETURN ((LM_ERROR, "Failed to initialize the trader.\n"), 1); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Trading Service"); return 1; } return 0; }
/** * The naming service shall provide a command line utility for displaying all * members (object references) for a specified object group. * Lists the members of the specified object group. */ int NS_group_svc::member_list (const ACE_TCHAR* group_name) { if (group_name == 0) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("member_list args not provided\n")), -2); } try { PortableGroup::ObjectGroup_var group_var = this->naming_manager_->get_object_group_ref_from_name ( ACE_TEXT_ALWAYS_CHAR (group_name)); PortableGroup::Locations_var locations = this->naming_manager_->locations_of_members (group_var.in()); for (unsigned int i = 0; i < locations->length(); ++i) { const PortableGroup::Location & loc = locations[i]; if (loc.length() > 0) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("%C\n"), loc[0].id.in())); } } } catch (const PortableGroup::ObjectGroupNotFound&) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("\nUnable to find group %s\n"), group_name), -1); } catch (const CORBA::Exception&) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("\nUnable to list members for group %s\n"), group_name), -1); } return 0; }
// The base class defines the "failure" case, so that unless the // subclasses override this, the call will fail. This is done so that // subclasses need only define the calls that they want to support, // and the remaining calls will fail automagically int TAO_AV_Endpoint_Strategy::create_B (AVStreams::StreamEndPoint_B_ptr & /* stream_endpoint */, AVStreams::VDev_ptr & /*vdev */) { ORBSVCS_ERROR_RETURN ((LM_ERROR, "(%P|%t) Error creating B endpoint\n"), -1); }
/** * The naming service shall provide a command line utility to modify the load * balancing strategy for a specified object group. * Changes the selection algorithm for the specified object group. An object * group's selection algorithm determines how the naming service directs client * requests to object group members. */ int NS_group_svc::group_modify ( const ACE_TCHAR* group_name, const ACE_TCHAR* policy) { if (group_name == 0 || policy == 0) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("group_modify args not provided\n")), -2); } /// Validate load balancing strategy policy string FT_Naming::LoadBalancingStrategyValue strategy; if (false == determine_policy_string (policy, strategy)) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%s is not a valid policy.\n"), policy), -2); } try { this->naming_manager_->set_load_balancing_strategy ( ACE_TEXT_ALWAYS_CHAR (group_name), strategy ); } catch (const PortableGroup::ObjectGroupNotFound&) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("\nUnable to find group %s\n"), group_name), -1); } catch (const CORBA::Exception&) { ORBSVCS_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("\nUnable to modify group %s\n"), group_name), -1); } return 0; }