Beispiel #1
0
/**
 * Generate a unique string to be used for interprocess communications for this userid.
 *
 * @return A unique identifier used to create the named
 *         AF_UNIX services.
 */
const char *SysServerLocalSocketConnectionManager::generateServiceName()
{
    // if we've already generated this, we're done
    if (userServiceName != NULL)
    {
        return userServiceName;
    }

    // a buffer for generating the name
    char pipeNameBuffer[PATH_MAX + 100];
    // the location of the bound file
    char pipePath[PATH_MAX];
    // determine the best place to put this
    getServiceLocation(pipePath, sizeof(pipePath));
    snprintf(pipeNameBuffer, sizeof(pipeNameBuffer), "%s.service", pipePath);

    userServiceName = strdup(pipeNameBuffer);
    return userServiceName;
}
Beispiel #2
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
boost::uint64_t
AccountService::authenticate(pEndpoint_type _pDestinationEndpoint,
                             pResourceLocation_type _pDestLocation,
                             const std::string& _name,
                             const std::string& _password)
{
    // Create a login request using pAccount as the payload.
    Zen::Enterprise::AppServer::create_request<Zen::Enterprise::Account::Protocol::I_AuthenticateRequest, void*>
        request(_pDestinationEndpoint, NULL, getServiceLocation(), _pDestLocation);

    request->setUserId(_name);
    request->setPassword(_password);

    send<Zen::Enterprise::Account::Protocol::I_AuthenticateRequest, void*>(
        request, 
        boost::bind(&AccountService::handleAuthenticateResponse, this, _1, _2, _3),
        boost::bind(&AccountService::handleAuthenticateTimeout, this, _1, _2)
    );

    return request->getMessageId();
}