@@ -291,10 +291,16 @@ int InitialConnectionContext::processBlob(bsl::ostream& errorDescription,
291291 }
292292 else if (bsl::holds_alternative<bmqp_ctrlmsg::AuthenticationMessage>(
293293 message)) {
294- handleEvent (rc, bsl::string (), Event::e_AUTHN_REQUEST, message);
294+ handleEvent (rc,
295+ bsl::string (),
296+ InitialConnectionEvent::e_AUTHN_REQUEST,
297+ message);
295298 }
296299 else {
297- handleEvent (rc, bsl::string (), Event::e_NEGOTIATION_MESSAGE, message);
300+ handleEvent (rc,
301+ bsl::string (),
302+ InitialConnectionEvent::e_NEGOTIATION_MESSAGE,
303+ message);
298304 }
299305
300306 return rc_SUCCESS;
@@ -468,15 +474,17 @@ void InitialConnectionContext::readCallback(const bmqio::Status& status,
468474
469475 if (!status) {
470476 errStream << " Read error: " << status;
471- handleEvent (rc_READ_BLOB_ERROR, errStream.str (), Event::e_ERROR);
477+ handleEvent (rc_READ_BLOB_ERROR,
478+ errStream.str (),
479+ InitialConnectionEvent::e_ERROR);
472480 return ; // RETURN
473481 }
474482
475483 rc = readBlob (errStream, &outPacket, &isFullBlob, numNeeded, blob);
476484 if (rc != rc_SUCCESS) {
477485 handleEvent ((rc * 10 ) + rc_READ_BLOB_ERROR,
478486 errStream.str (),
479- Event ::e_ERROR);
487+ InitialConnectionEvent ::e_ERROR);
480488 return ; // RETURN
481489 }
482490
@@ -488,7 +496,7 @@ void InitialConnectionContext::readCallback(const bmqio::Status& status,
488496 if (rc != rc_SUCCESS) {
489497 handleEvent ((rc * 10 ) + rc_PROCESS_BLOB_ERROR,
490498 errStream.str (),
491- Event ::e_ERROR);
499+ InitialConnectionEvent ::e_ERROR);
492500 return ; // RETURN
493501 }
494502}
@@ -530,23 +538,21 @@ void InitialConnectionContext::handleInitialConnection()
530538 // `negotiateOutbound`.
531539 handleEvent (0 ,
532540 bsl::string (),
533- mqbnet:: InitialConnectionEvent::e_OUTBOUND_NEGOTATION);
541+ InitialConnectionEvent::e_OUTBOUND_NEGOTATION);
534542 }
535543 else {
536544 bmqu::MemOutStream errStream;
537545 const int rc = scheduleRead (errStream);
538546 if (rc != 0 ) {
539- handleEvent (rc,
540- errStream.str (),
541- mqbnet::InitialConnectionEvent::e_ERROR);
547+ handleEvent (rc, errStream.str (), InitialConnectionEvent::e_ERROR);
542548 }
543549 }
544550}
545551
546552void InitialConnectionContext::handleEvent (
547553 int statusCode,
548554 const bsl::string& errorDescription,
549- Event input,
555+ InitialConnectionEvent::Enum input,
550556 const bsl::variant<bsl::monostate,
551557 bmqp_ctrlmsg::AuthenticationMessage,
552558 bmqp_ctrlmsg::NegotiationMessage>& message)
@@ -571,12 +577,12 @@ void InitialConnectionContext::handleEvent(
571577 << " ; peerUri = " << d_channelSp->peerUri ()
572578 << " ; context address = " << this ;
573579
574- State oldState = d_state;
580+ InitialConnectionState::Enum oldState = d_state;
575581
576582 switch (input) {
577- case Event ::e_OUTBOUND_NEGOTATION: {
578- if (oldState == State ::e_INITIAL) {
579- setState (State ::e_NEGOTIATING_OUTBOUND);
583+ case InitialConnectionEvent ::e_OUTBOUND_NEGOTATION: {
584+ if (oldState == InitialConnectionState ::e_INITIAL) {
585+ setState (InitialConnectionState ::e_NEGOTIATING_OUTBOUND);
580586
581587 createNegotiationContext ();
582588
@@ -591,7 +597,7 @@ void InitialConnectionContext::handleEvent(
591597 }
592598 break ;
593599 }
594- case Event ::e_AUTHN_REQUEST: {
600+ case InitialConnectionEvent ::e_AUTHN_REQUEST: {
595601 if (!bsl::holds_alternative<bmqp_ctrlmsg::AuthenticationMessage>(
596602 message)) {
597603 errStream << " Expecting AuthenticationMessage for event " << input
@@ -601,8 +607,8 @@ void InitialConnectionContext::handleEvent(
601607 const bmqp_ctrlmsg::AuthenticationMessage& authenticationMsg =
602608 bsl::get<bmqp_ctrlmsg::AuthenticationMessage>(message);
603609
604- if (oldState == State ::e_INITIAL) {
605- setState (State ::e_AUTHENTICATING);
610+ if (oldState == InitialConnectionState ::e_INITIAL) {
611+ setState (InitialConnectionState ::e_AUTHENTICATING);
606612
607613 rc = d_authenticator_p->handleAuthentication (errStream,
608614 self,
@@ -614,7 +620,7 @@ void InitialConnectionContext::handleEvent(
614620 }
615621 break ;
616622 }
617- case Event ::e_NEGOTIATION_MESSAGE: {
623+ case InitialConnectionEvent ::e_NEGOTIATION_MESSAGE: {
618624 if (!bsl::holds_alternative<bmqp_ctrlmsg::NegotiationMessage>(
619625 message)) {
620626 errStream << " Expecting NegotiationMessage for event " << input
@@ -624,27 +630,27 @@ void InitialConnectionContext::handleEvent(
624630 const bmqp_ctrlmsg::NegotiationMessage& negotiationMsg =
625631 bsl::get<bmqp_ctrlmsg::NegotiationMessage>(message);
626632
627- if (oldState == State ::e_INITIAL &&
633+ if (oldState == InitialConnectionState ::e_INITIAL &&
628634 negotiationMsg.isClientIdentityValue ()) {
629- setState (State ::e_ANON_AUTHENTICATING);
635+ setState (InitialConnectionState ::e_ANON_AUTHENTICATING);
630636
631637 createNegotiationContext ();
632638 negotiationContext ()->setNegotiationMessage (negotiationMsg);
633639
634640 rc = handleAnonAuthentication (errStream);
635641 }
636- else if (oldState == State ::e_AUTHENTICATED &&
642+ else if (oldState == InitialConnectionState ::e_AUTHENTICATED &&
637643 negotiationMsg.isClientIdentityValue ()) {
638- setState (State ::e_NEGOTIATED);
644+ setState (InitialConnectionState ::e_NEGOTIATED);
639645
640646 createNegotiationContext ();
641647 negotiationContext ()->setNegotiationMessage (negotiationMsg);
642648
643649 rc = rc_SUCCESS;
644650 }
645- else if (oldState == State ::e_NEGOTIATING_OUTBOUND &&
651+ else if (oldState == InitialConnectionState ::e_NEGOTIATING_OUTBOUND &&
646652 negotiationMsg.isBrokerResponseValue ()) {
647- setState (State ::e_NEGOTIATED);
653+ setState (InitialConnectionState ::e_NEGOTIATED);
648654
649655 BSLS_ASSERT_SAFE (negotiationContext ());
650656 negotiationContext ()->setNegotiationMessage (negotiationMsg);
@@ -658,15 +664,15 @@ void InitialConnectionContext::handleEvent(
658664 }
659665 break ;
660666 }
661- case Event ::e_AUTHN_SUCCESS: {
662- if (oldState == State ::e_AUTHENTICATING) {
663- setState (State ::e_AUTHENTICATED);
667+ case InitialConnectionEvent ::e_AUTHN_SUCCESS: {
668+ if (oldState == InitialConnectionState ::e_AUTHENTICATING) {
669+ setState (InitialConnectionState ::e_AUTHENTICATED);
664670
665671 // Now read Negotiation message
666672 rc = scheduleRead (errStream);
667673 }
668- else if (oldState == State ::e_ANON_AUTHENTICATING) {
669- setState (State ::e_NEGOTIATED);
674+ else if (oldState == InitialConnectionState ::e_ANON_AUTHENTICATING) {
675+ setState (InitialConnectionState ::e_NEGOTIATED);
670676
671677 BSLS_ASSERT_SAFE (negotiationContext ());
672678 BSLS_ASSERT_SAFE (negotiationContext ()
@@ -681,11 +687,11 @@ void InitialConnectionContext::handleEvent(
681687 }
682688 break ;
683689 }
684- case Event ::e_ERROR: {
690+ case InitialConnectionEvent ::e_ERROR: {
685691 rc = statusCode;
686692 errStream << errorDescription;
687693 } break ;
688- case Event ::e_NONE: {
694+ case InitialConnectionEvent ::e_NONE: {
689695 // NOT IMPLEMENTED
690696 BSLS_ASSERT_SAFE (!" Unexpected event received: " + input);
691697 break ;
@@ -700,12 +706,12 @@ void InitialConnectionContext::handleEvent(
700706
701707 bsl::shared_ptr<mqbnet::Session> session;
702708
703- if (rc == rc_SUCCESS && d_state == State ::e_NEGOTIATED) {
709+ if (rc == rc_SUCCESS && d_state == InitialConnectionState ::e_NEGOTIATED) {
704710 rc = d_negotiator_p->createSessionOnMsgType (errStream, &session, this );
705711 BALL_LOG_INFO << " Created a session with " << channel ()->peerUri ();
706712 }
707713
708- if (rc != rc_SUCCESS || d_state == State ::e_NEGOTIATED) {
714+ if (rc != rc_SUCCESS || d_state == InitialConnectionState ::e_NEGOTIATED) {
709715 BALL_LOG_INFO << " Finished initial connection with rc = " << rc
710716 << " , error = '" << errStream.str () << " '" ;
711717 guard.release ()->unlock ();
0 commit comments