当前位置: 首页>>代码示例>>C++>>正文


C++ LPDESC::DelayedDisconnect方法代码示例

本文整理汇总了C++中LPDESC::DelayedDisconnect方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDESC::DelayedDisconnect方法的具体用法?C++ LPDESC::DelayedDisconnect怎么用?C++ LPDESC::DelayedDisconnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDESC的用法示例。


在下文中一共展示了LPDESC::DelayedDisconnect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PasspodAnswer

void CInputAuth::PasspodAnswer(LPDESC d, const char * c_pData)
{

    if (!g_bAuthServer)
    {
        sys_err ("CInputAuth class is not for game server. IP %s might be a hacker.",
                 inet_ntoa(d->GetAddr().sin_addr));
        d->DelayedDisconnect(5);
        return;
    }

    TPacketCGPasspod * packet = (TPacketCGPasspod*)c_pData;

    RequestConfirmPasspod Confirm;

    memcpy(Confirm.passpod, packet->szAnswer, MAX_PASSPOD + 1);
    memcpy(Confirm.login, d->GetAccountTable().login, LOGIN_MAX_LEN + 1);


    if (!d->GetAccountTable().id)
    {
        sys_err("HEADER_CG_PASSPOD_ANSWER received to desc with no account table binded");
        return;
    }

    int ret_code = 1;
    sys_log(0, "Passpod start %s %s", d->GetAccountTable().login, packet->szAnswer);
    ret_code = CPasspod::instance().ConfirmPasspod(d->GetAccountTable().login, packet->szAnswer);

    if (ret_code != 0)
    {
        sys_log(0, "PASSPOD: wrong answer: %s ret_code %d", d->GetAccountTable().login, ret_code);

        LoginFailure(d, ERR_MESSAGE[ret_code]);

        if (!d->CheckMatrixTryCount())
        {
            LoginFailure(d, "QUIT");
            d->SetPhase(PHASE_CLOSE);
        }
    }
    else
    {
        sys_log(0, "PASSPOD: success: %s", d->GetAccountTable().login);
        DBManager::instance().SendAuthLogin(d);
    }
//	g_PasspodDesc->DBPacket(HEADER_GP_CONFIRM_PASSPOD,  0, &Confirm, sizeof(Confirm));

//	sys_log(0, "PASSPOD %s %d", Confirm.login, Confirm.passpod);
}
开发者ID:cCorax2,项目名称:Source_code,代码行数:50,代码来源:input_auth.cpp

示例2: Analyze

int CInputAuth::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
{

    if (!g_bAuthServer)
    {
        sys_err ("CInputAuth class is not for game server. IP %s might be a hacker.",
                 inet_ntoa(d->GetAddr().sin_addr));
        d->DelayedDisconnect(5);
        return 0;
    }

    int iExtraLen = 0;

    if (test_server)
        sys_log(0, " InputAuth Analyze Header[%d] ", bHeader);

    switch (bHeader)
    {
    case HEADER_CG_PONG:
        Pong(d);
        break;

    case HEADER_CG_LOGIN3:
        Login(d, c_pData);
        break;

    //2012.07.19 OpenID : 김용욱
    case HEADER_CG_LOGIN5_OPENID:
        if (openid_server)
            LoginOpenID(d, c_pData);
        else
            sys_err("HEADER_CG_LOGIN5_OPENID : wrong client access");
        break;

    case HEADER_CG_PASSPOD_ANSWER:
        PasspodAnswer(d, c_pData);
        break;

    case HEADER_CG_HANDSHAKE:
        break;

    default:
        sys_err("This phase does not handle this header %d (0x%x)(phase: AUTH)", bHeader, bHeader);
        break;
    }

    return iExtraLen;
}
开发者ID:cCorax2,项目名称:Source_code,代码行数:48,代码来源:input_auth.cpp

示例3: LoginOpenID

void CInputAuth::LoginOpenID(LPDESC d, const char * c_pData)
{
#ifdef ENABLE_LIMIT_TIME
#endif
    //OpenID test code.
    TPacketCGLogin5 *tempInfo1 = (TPacketCGLogin5 *)c_pData;

    //일본 웹 서버에 인증키 확인 요청을 보낸다.
    char* authKey = tempInfo1->authKey;
    char returnID[LOGIN_MAX_LEN + 1] = {0};

    int test_url_get_protocol = auth_OpenID(authKey, inet_ntoa(d->GetAddr().sin_addr), returnID);

    //인증 실패. 에러 처리
    if (0!=test_url_get_protocol)
    {
        LoginFailure(d, "OpenID Fail");
        return;
    }

    TPacketCGLogin3 tempInfo2;
    strncpy(tempInfo2.login, returnID, LOGIN_MAX_LEN);
    strncpy(tempInfo2.passwd, "0000", PASSWD_MAX_LEN);
    for(int i=0; i<4; i++)
        tempInfo2.adwClientKey[i] = tempInfo1->adwClientKey[i];
    TPacketCGLogin3 * pinfo = &tempInfo2;

    if (!g_bAuthServer)
    {
        sys_err ("CInputAuth class is not for game server. IP %s might be a hacker.",
                 inet_ntoa(d->GetAddr().sin_addr));
        d->DelayedDisconnect(5);
        return;
    }

    // string 무결성을 위해 복사
    char login[LOGIN_MAX_LEN + 1];
    trim_and_lower(pinfo->login, login, sizeof(login));

    char passwd[PASSWD_MAX_LEN + 1];
    strlcpy(passwd, pinfo->passwd, sizeof(passwd));

    sys_log(0, "InputAuth::Login : %s(%d) desc %p",
            login, strlen(login), get_pointer(d));

    // check login string
    if (false == FN_IS_VALID_LOGIN_STRING(login))
    {
        sys_log(0, "InputAuth::Login : IS_NOT_VALID_LOGIN_STRING(%s) desc %p",
                login, get_pointer(d));
        LoginFailure(d, "NOID");
        return;
    }

    if (g_bNoMoreClient)
    {
        TPacketGCLoginFailure failurePacket;

        failurePacket.header = HEADER_GC_LOGIN_FAILURE;
        strlcpy(failurePacket.szStatus, "SHUTDOWN", sizeof(failurePacket.szStatus));

        d->Packet(&failurePacket, sizeof(failurePacket));
        return;
    }

    if (DESC_MANAGER::instance().FindByLoginName(login))
    {
        LoginFailure(d, "ALREADY");
        return;
    }

    DWORD dwKey = DESC_MANAGER::instance().CreateLoginKey(d);
    DWORD dwPanamaKey = dwKey ^ pinfo->adwClientKey[0] ^ pinfo->adwClientKey[1] ^ pinfo->adwClientKey[2] ^ pinfo->adwClientKey[3];
    d->SetPanamaKey(dwPanamaKey);

    sys_log(0, "InputAuth::Login : key %u:0x%x login %s", dwKey, dwPanamaKey, login);

    // BRAZIL_AUTH
    if (LC_IsBrazil() && !test_server)
    {
        int result = auth_brazil(login, passwd);

        switch (result)
        {
        case AUTH_BRAZIL_SERVER_ERR:
        case AUTH_BRAZIL_NOID:
            LoginFailure(d, "NOID");
            return;
        case AUTH_BRAZIL_WRONGPWD:
            LoginFailure(d, "WRONGPWD");
            return;
        case AUTH_BRAZIL_FLASHUSER:
            LoginFailure(d, "FLASH");
            return;
        }
    }

    TPacketCGLogin3 * p = M2_NEW TPacketCGLogin3;
    thecore_memcpy(p, pinfo, sizeof(TPacketCGLogin3));

//.........这里部分代码省略.........
开发者ID:cCorax2,项目名称:Source_code,代码行数:101,代码来源:input_auth.cpp


注:本文中的LPDESC::DelayedDisconnect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。