+
+// ----------------- alarm support -----------------------------------------------
+/*
+ Allocate an alarm object.
+ Alarms must be allocated via the framework becasue we need a wormhole
+ id and to get one of those we need the mrc. We can easily send with
+ just a message, but to avoid having the user pass the framework
+ object in, we'll just supply a "factory" function.
+*/
+std::unique_ptr<xapp::Alarm> xapp::Messenger::Alloc_alarm( int prob_id, const std::string& meid ) {
+ std::shared_ptr<Message> m;
+ Alarm* a;
+
+ m = Alloc_msg( 4096 );
+ a = new Alarm( m, prob_id, meid );
+ a->Set_whid( Wormhole_open( a->Get_endpoint() ) );
+
+ return std::unique_ptr<Alarm>( a );
+}
+
+std::unique_ptr<xapp::Alarm> xapp::Messenger::Alloc_alarm( const std::string& meid ) {
+ return Alloc_alarm( -1, meid );
+}
+
+std::unique_ptr<xapp::Alarm> xapp::Messenger::Alloc_alarm( ) {
+ return Alloc_alarm( -1, "" );
+}
+
+
+// ------------------ metrics support --------------------------------------------------
+std::unique_ptr<xapp::Metrics> xapp::Messenger::Alloc_metrics( ) {
+ std::shared_ptr<Message> m;
+
+ m = Alloc_msg( 4096 );
+ return std::unique_ptr<xapp::Metrics>( new xapp::Metrics( m ) );
+}
+
+std::unique_ptr<xapp::Metrics> xapp::Messenger::Alloc_metrics( const std::string& source ) {
+ std::shared_ptr<Message> m;
+
+ m = Alloc_msg( 4096 );
+ return std::unique_ptr<xapp::Metrics>( new xapp::Metrics( m, source ) );
+}
+
+std::unique_ptr<xapp::Metrics> xapp::Messenger::Alloc_metrics( const std::string& reporter, const std::string& source ) {
+ std::shared_ptr<Message> m;
+
+ m = Alloc_msg( 4096 );
+ return std::unique_ptr<xapp::Metrics>( new xapp::Metrics( m, reporter, source ) );
+}
+
+// ------------------- listening support -----------------------------------------------
+
+/*
+ The Listen function waits for messages and drives the appropriate callback
+ function when one is received. This function will return to the caller
+ only when the ok to run flag in the object has been set to false (likely
+ never, or only at graceful termination). Callers should normally not
+ expect to have controll returned in the calling thread.
+
+ Concurrently executing listeners are allowed.
+*/
+void xapp::Messenger::Listen( ) {