Esempio n. 1
0
uint32_t pnAuthClient::sendAcctLoginRequest(uint32_t serverChallenge,
                uint32_t clientChallenge, const plString& acctName,
                const plString& password, const plString& authToken,
                const plString& os)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_AcctLoginRequest);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fUint = clientChallenge;
    msg[2].fString = plwcsdup(acctName.wstr());
    pnSha1Hash hash;
    if (acctName.find('@') != -1 && acctName.find("@gametap") == -1
        && acctName.find("@magiquest") == -1) {
        hash = NCHashLoginInfo(acctName, password, serverChallenge, clientChallenge);
    } else {
        hash = pnSha1Hash::Sha1(password.cstr(), password.len());
        hash.swapBytes();   // Cyan uses a different byte order for this case
    }
    memcpy(msg[3].fData, &hash, sizeof(hash));
    msg[4].fString = plwcsdup(authToken.wstr());
    msg[5].fString = plwcsdup(os.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
Esempio n. 2
0
uint32_t pnAuthClient::sendFileListRequest(const plString& directory, const plString& ext)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_FileListRequest);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fString = plwcsdup(directory.wstr());
    msg[2].fString = plwcsdup(ext.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
Esempio n. 3
0
uint32_t pnAuthClient::sendFriendInviteRequest(const plUuid& invite, const plString& email,
                const plString& sendTo)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_SendFriendInviteRequest);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    invite.write(msg[1].fData);
    msg[2].fString = plwcsdup(email.wstr());
    msg[3].fString = plwcsdup(sendTo.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
Esempio n. 4
0
uint32_t pnAuthClient::sendPlayerCreateRequest(const plString& playerName,
                const plString& playerShape, const plString& friendInvite)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_PlayerCreateRequest);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fString = plwcsdup(playerName.wstr());
    msg[2].fString = plwcsdup(playerShape.wstr());
    msg[3].fString = plwcsdup(friendInvite.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
Esempio n. 5
0
void pnAuthClient::sendLogStackDump(const plString& stackdump)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_LogStackDump);
    msgparm_t* msg = NCAllocMessage(desc);
    msg[0].fString = plwcsdup(stackdump.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
}
Esempio n. 6
0
void pnAuthClient::sendLogPythonTraceback(const plString& traceback)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_LogPythonTraceback);
    msgparm_t* msg = NCAllocMessage(desc);
    msg[0].fString = plwcsdup(traceback.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
}
Esempio n. 7
0
static void writeString(const plString& v, unsigned char*& buffer, size_t& size) {
    plString::Wide ws = v.wstr();
    size_t len = (ws.len() + 1) * sizeof(pl_wchar_t);
    writeU32(len, buffer, size);
    memcpy(buffer, ws.data(), len);  // Includes the '\0'
    buffer += len;
    size -= len;
}
Esempio n. 8
0
uint32_t pnAuthClient::sendGetPublicAgeList(const plString& filename)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_GetPublicAgeList);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fString = plwcsdup(filename.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
Esempio n. 9
0
uint32_t pnAuthClient::sendAcctExistsRequest(const plString& acctName)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_AcctExistsRequest);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fString = plwcsdup(acctName.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
Esempio n. 10
0
uint32_t pnAuthClient::sendScoreGetScores(uint32_t owner, const plString& gameName)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_ScoreGetScores);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fUint = owner;
    msg[2].fString = plwcsdup(gameName.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
Esempio n. 11
0
uint32_t pnAuthClient::sendAgeRequestEx(const plString& ageName, const plUuid& ageUuid)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_AgeRequestEx);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fString = plwcsdup(ageName.wstr());
    ageUuid.write(msg[2].fData);
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
Esempio n. 12
0
uint32_t pnAuthClient::sendChangePlayerNameRequest(uint32_t playerId, const plString& name)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_ChangePlayerNameRequest);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fUint = playerId;
    msg[2].fString = plwcsdup(name.wstr());
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
Esempio n. 13
0
uint32_t pnAuthClient::sendVaultInitAgeRequest(const plUuid& ageUuid, const plString& filename,
                const plString& instanceName, const plString& userDefinedName,
                const plString& description, uint32_t sequence, uint32_t language,
                const plUuid& parentUuid)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_VaultInitAgeRequest);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    ageUuid.write(msg[1].fData);
    parentUuid.write(msg[2].fData);
    msg[3].fString = plwcsdup(filename.wstr());
    msg[4].fString = plwcsdup(instanceName.wstr());
    msg[5].fString = plwcsdup(userDefinedName.wstr());
    msg[6].fString = plwcsdup(description.wstr());
    msg[7].fUint = sequence;
    msg[8].fUint = language;
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
Esempio n. 14
0
uint32_t pnAuthClient::sendAcctChangePasswordRequest(const plString& acctName,
                const plString& password)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_AcctChangePasswordRequest);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fString = plwcsdup(acctName.wstr());
    pnSha1Hash hash = NCHashPassword(acctName, password);
    memcpy(msg[2].fData, &hash, sizeof(hash));
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
Esempio n. 15
0
uint32_t pnAuthClient::sendAcctCreateFromKeyRequest(const plString& acctName,
                const plString& password, const plUuid& key, uint32_t billingType)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_AcctCreateFromKeyRequest);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fString = plwcsdup(acctName.wstr());
    pnSha1Hash hash = NCHashPassword(acctName, password);
    memcpy(msg[2].fData, &hash, sizeof(hash));
    key.write(msg[3].fData);
    msg[4].fUint = billingType;
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}
Esempio n. 16
0
uint32_t pnFileClient::sendFileDownloadRequest(const plString& filename, uint32_t buildId)
{
    plString::Wide wfilename = filename.wstr();
    size_t len = wfilename.len() + 1;

    uint32_t transId = nextTransId();
    uint8_t msgbuf[536];
    *(uint32_t*)(msgbuf    ) = 536;                             // Msg size
    *(uint32_t*)(msgbuf + 4) = kCli2File_FileDownloadRequest;   // Msg ID
    *(uint32_t*)(msgbuf + 8) = transId;                         // Trans ID
    memcpy(msgbuf + 12, wfilename.data(), (len >= 260 ? 259 : len) * sizeof(pl_wchar_t));
    *(pl_wchar_t*)(msgbuf + 530) = 0;                           // Nul terminator
    *(uint32_t*)(msgbuf + 532) = buildId;                       // Build ID
    fSock->send(msgbuf, 536);
    return transId;
}
Esempio n. 17
0
uint32_t pnAuthClient::sendScoreGetRanks(uint32_t ownerId, uint32_t group, uint32_t parent,
                const plString& gameName, uint32_t timePeriod, uint32_t numResults,
                uint32_t pageNumber, uint32_t sortDesc)
{
    const pnNetMsg* desc = GET_Cli2Auth(kCli2Auth_ScoreGetRanks);
    msgparm_t* msg = NCAllocMessage(desc);
    uint32_t transId = nextTransId();
    msg[0].fUint = transId;
    msg[1].fUint = ownerId;
    msg[2].fUint = group;
    msg[3].fUint = parent;
    msg[4].fString = plwcsdup(gameName.wstr());
    msg[5].fUint = timePeriod;
    msg[6].fUint = numResults;
    msg[7].fUint = pageNumber;
    msg[8].fUint = sortDesc;
    fSock->sendMsg(msg, desc);
    NCFreeMessage(msg, desc);
    return transId;
}