⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aaa_session_auth_client_fsm.cxx

📁 Diameter协议栈
💻 CXX
📖 第 1 页 / 共 2 页
字号:
    diameter_unsigned32_t *acctAppId = acctAppIdAvp.GetAvp(AAA_AVPNAME_ACCTAPPID);    AAA_LOG(LM_INFO, "(%P|%t) *** Abort session request received ***\n");    Attributes().MsgIdRxMessage(msg);    AAA_SessionId sid;    sid.Get(msg);    sid.Dump();    if (host) {        AAA_LOG(LM_INFO, "(%P|%t) From Host: %s\n", host->data());    }    if (realm) {        AAA_LOG(LM_INFO, "(%P|%t) From Realm: %s\n", realm->data());    }    if (uname) {        AAA_LOG(LM_INFO, "(%P|%t) From User: %s\n", uname->data());    }    if (authAppId) {        AAA_LOG(LM_INFO, "(%P|%t) Auth Application Id: %d\n", *authAppId);    }    if (acctAppId) {        AAA_LOG(LM_INFO, "(%P|%t) Acct Application Id: %d\n", *acctAppId);    }}void AAA_AuthSessionClientStateMachine::RxSTA(AAAMessage &msg){    /*        8.4.2.  Session-Termination-Answer        The Session-Termination-Answer (STA), indicated by the Command-Code        set to 275 and the message flags' 'R' bit clear, is sent by the        Diameter Server to acknowledge the notification that the session has        been terminated.  The Result-Code AVP MUST be present, and MAY        contain an indication that an error occurred while servicing the STR.        Upon sending or receipt of the STA, the Diameter Server MUST release        all resources for the session indicated by the Session-Id AVP.  Any        intermediate server in the Proxy-Chain MAY also release any        resources, if necessary.        Message Format            <STA>  ::= < Diameter Header: 275, PXY >                        < Session-Id >                        { Result-Code }                        { Origin-Host }                        { Origin-Realm }                        [ User-Name ]                      * [ Class ]                        [ Error-Message ]                        [ Error-Reporting-Host ]                      * [ Failed-AVP ]                        [ Origin-State-Id ]                      * [ Redirect-Host ]                        [ Redirect-Host-Usage ]                                            ^                        [ Redirect-Max-Cache-Time ]                      * [ Proxy-Info ]                      * [ AVP ]     */    AAA_UInt32AvpContainerWidget rcodeAvp(msg.acl);    AAA_IdentityAvpContainerWidget oHostAvp(msg.acl);    AAA_IdentityAvpContainerWidget oRealmAvp(msg.acl);    AAA_Utf8AvpContainerWidget uNameAvp(msg.acl);    AAA_Utf8AvpContainerWidget errMsgAvp(msg.acl);    AAA_IdentityAvpContainerWidget errHostAvp(msg.acl);    diameter_unsigned32_t *rcode = rcodeAvp.GetAvp(AAA_AVPNAME_RESULTCODE);    diameter_identity_t *host = oHostAvp.GetAvp(AAA_AVPNAME_ORIGINHOST);    diameter_identity_t *realm = oRealmAvp.GetAvp(AAA_AVPNAME_ORIGINREALM);    diameter_utf8string_t *uname = uNameAvp.GetAvp(AAA_AVPNAME_USERNAME);    diameter_utf8string_t *errMsg = errMsgAvp.GetAvp(AAA_AVPNAME_ERRORMESSAGE);    diameter_identity_t *errHost = errHostAvp.GetAvp(AAA_AVPNAME_ERRORREPORTINGHOST);    AAA_LOG(LM_INFO, "(%P|%t) *** Session termination answer received ***\n");    Attributes().MsgIdRxMessage(msg);    AAA_SessionId sid;    sid.Get(msg);    sid.Dump();    if (host) {        AAA_LOG(LM_INFO, "(%P|%t) From Host: %s\n", host->data());    }    if (realm) {        AAA_LOG(LM_INFO, "(%P|%t) From Realm: %s\n", realm->data());    }    if (uname) {        AAA_LOG(LM_INFO, "(%P|%t) From User: %s\n", uname->data());    }    if (rcode) {        AAA_LOG(LM_INFO, "(%P|%t) Result-Code: %d\n", *rcode);    }    if (errMsg) {        if (errHost) {            AAA_LOG(LM_INFO, "(%P|%t) Message from [%s]: %s\n",                 errHost->data(), errMsg->data());        }        else {            AAA_LOG(LM_INFO, "(%P|%t) Message: %s\n",                 errMsg->data());        }    }}void AAA_AuthSessionClientStateMachine::TxRAA(diameter_unsigned32_t rcode){    /*      8.3.2.  Re-Auth-Answer      The Re-Auth-Answer (RAA), indicated by the Command-Code set to 258      and the message flags' 'R' bit clear, is sent in response to the RAR.      The Result-Code AVP MUST be present, and indicates the disposition of      the request.      A successful RAA message MUST be followed by an application-specific      authentication and/or authorization message.      Message Format      <RAA>  ::= < Diameter Header: 258, PXY >                 < Session-Id >                 { Result-Code }                 { Origin-Host }                 { Origin-Realm }                 [ User-Name ]                 [ Origin-State-Id ]                 [ Error-Message ]                 [ Error-Reporting-Host ]               * [ Failed-AVP ]               * [ Redirect-Host ]                 [ Redirect-Host-Usage ]                 [ Redirect-Host-Cache-Time ]               * [ Proxy-Info ]               * [ AVP ]     */   std::auto_ptr<AAAMessage> msg(new AAAMessage);   ACE_OS::memset(&msg->hdr, 0, sizeof(msg->hdr));   msg->hdr.ver = AAA_PROTOCOL_VERSION;   msg->hdr.length = 0;   msg->hdr.flags.r = AAA_FLG_CLR;   msg->hdr.flags.p = AAA_FLG_CLR;   msg->hdr.flags.e = AAA_FLG_CLR;   msg->hdr.code = AAA_MSGCODE_REAUTH;   msg->hdr.appId = AAA_BASE_APPLICATION_ID;   // required   Attributes().SessionId().Set(*msg);   AAA_UInt32AvpWidget rcodeAvp(AAA_AVPNAME_RESULTCODE);   AAA_IdentityAvpWidget orHostAvp(AAA_AVPNAME_ORIGINHOST);   AAA_IdentityAvpWidget orRealmAvp(AAA_AVPNAME_ORIGINREALM);   AAA_UInt32AvpWidget orStateId(AAA_AVPNAME_ORIGINSTATEID);   rcodeAvp.Get() = rcode;   orHostAvp.Get() = AAA_CFG_TRANSPORT()->identity;   orRealmAvp.Get() = AAA_CFG_TRANSPORT()->realm;   msg->acl.add(rcodeAvp());   msg->acl.add(orHostAvp());   msg->acl.add(orRealmAvp());   // optional avps   if (Attributes().Username().IsSet()) {       AAA_Utf8AvpWidget unameAvp(AAA_AVPNAME_USERNAME);       unameAvp.Get() = Attributes().Username()();       msg->acl.add(unameAvp());   }   orStateId.Get() = AAA_CFG_RUNTIME()->originStateId;   msg->acl.add(orStateId());   // TBD: Add more AVP's here if needed   m_Session.TxDelivery(msg);}void AAA_AuthSessionClientStateMachine::RxRAR(AAAMessage &msg){   /*      8.3.1.  Re-Auth-Request    The Re-Auth-Request (RAR), indicated by the Command-Code set to 258    and the message flags' 'R' bit set, may be sent by any server to the    access device that is providing session service, to request that the    user be re-authenticated and/or re-authorized.    Message Format       <RAR>  ::= < Diameter Header: 258, REQ, PXY >                  < Session-Id >                  { Origin-Host }                  { Origin-Realm }                  { Destination-Realm }                  { Destination-Host }                  { Auth-Application-Id }                  { Re-Auth-Request-Type }                  [ User-Name ]                  [ Origin-State-Id ]                * [ Proxy-Info ]                * [ Route-Record ]                * [ AVP ]    */    AAA_IdentityAvpContainerWidget oHostAvp(msg.acl);    AAA_IdentityAvpContainerWidget oRealmAvp(msg.acl);    AAA_UInt32AvpContainerWidget authAppIdAvp(msg.acl);    AAA_UInt32AvpContainerWidget reAuthTypeAvp(msg.acl);    AAA_Utf8AvpContainerWidget uNameAvp(msg.acl);    diameter_identity_t *host = oHostAvp.GetAvp(AAA_AVPNAME_ORIGINHOST);    diameter_identity_t *realm = oRealmAvp.GetAvp(AAA_AVPNAME_ORIGINREALM);    diameter_unsigned32_t *appId = authAppIdAvp.GetAvp(AAA_AVPNAME_AUTHAPPID);    diameter_unsigned32_t *reAuthType = reAuthTypeAvp.GetAvp(AAA_AVPNAME_REAUTHREQTYPE);    diameter_utf8string_t *uname = uNameAvp.GetAvp(AAA_AVPNAME_USERNAME);    AAA_LOG(LM_INFO, "(%P|%t) *** Re-Auth request received ***\n");    Attributes().MsgIdRxMessage(msg);    AAA_SessionId sid;    sid.Get(msg);    sid.Dump();    if (host) {        AAA_LOG(LM_INFO, "(%P|%t) From Host: %s\n", host->data());    }    if (realm) {        AAA_LOG(LM_INFO, "(%P|%t) From Realm: %s\n", realm->data());    }    if (uname) {        AAA_LOG(LM_INFO, "(%P|%t) From User: %s\n", uname->data());    }    if (appId) {        AAA_LOG(LM_INFO, "(%P|%t) Application Id: %d\n", *appId);    }    if (reAuthType) {        AAA_LOG(LM_INFO, "(%P|%t) Re-Auth Type: %d\n", *reAuthType);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -