Exemple #1
0
void Logstalgia::addBall(LogEntry* le, float start_offset) {

    gHighscore++;

    std::string hostname = le->hostname;
    std::string pageurl  = le->path;

    //find appropriate summarizer for url
    int nogroups = summGroups.size();
    Summarizer* pageSummarizer= 0;

    for(int i=0;i<nogroups;i++) {
        if(summGroups[i]->supportedString(pageurl)) {
            pageSummarizer = summGroups[i];
            break;
        }
    }

    if(pageSummarizer==0) return;

    Paddle* entry_paddle = 0;

    if(gPaddleMode > PADDLE_SINGLE) {

        std::string paddle_token = (gPaddleMode == PADDLE_VHOST) ? le->vhost : le->pid;

        entry_paddle = paddles[paddle_token];

        if(entry_paddle == 0) {
            vec2f paddle_pos = vec2f(display.width-(display.width/3), rand() % display.height);
            Paddle* paddle = new Paddle(paddle_pos, paddle_colour, paddle_token);
            entry_paddle = paddles[paddle_token] = paddle;
        }

    } else {
        entry_paddle = paddles[""];
    }

    if(gHideURLPrefix) pageurl = filterURLHostname(pageurl);

    float dest_y = pageSummarizer->getMiddlePosY(pageurl);
    float pos_y  = ipSummarizer->getMiddlePosY(hostname);
    
    float start_x = -(entry_paddle->getX()/ 5.0f);
    
    vec2f ball_start = vec2f(start_x, pos_y);
    vec2f ball_dest  = vec2f(entry_paddle->getX(), dest_y);

    const std::string& match = ipSummarizer->getBestMatchStr(hostname);
    
    vec3f colour = pageSummarizer->isColoured() ? pageSummarizer->getColour() : colourHash(match);
    
    RequestBall* ball = new RequestBall(le, &fontMedium, balltex, colour, ball_start, ball_dest, simu_speed);

    ball->setElapsed( start_offset );
    
    balls.push_back(ball);
}
void Logstalgia::addStrings(LogEntry* le) {

    Summarizer* groupSummarizer = getGroupSummarizer(le);

    if(!groupSummarizer) return;

    std::string hostname = le->hostname;
    std::string pageurl  = le->path;

    if(settings.hide_url_prefix) pageurl = filterURLHostname(pageurl);

    groupSummarizer->addString(pageurl);
    ipSummarizer->addString(hostname);
}
void Logstalgia::addBall(LogEntry* le, float start_offset) {

    //find appropriate summarizer for url
    Summarizer* groupSummarizer = getGroupSummarizer(le);

    if(!groupSummarizer) return;

    Paddle* entry_paddle = 0;

    if(settings.paddle_mode > PADDLE_SINGLE) {

        std::string paddle_token = (settings.paddle_mode == PADDLE_VHOST) ? le->vhost : le->pid;

        entry_paddle = paddles[paddle_token];

        if(entry_paddle == 0) {
            vec2 paddle_pos = vec2(paddle_x - 20, rand() % display.height);
            Paddle* paddle = new Paddle(paddle_pos, paddle_colour, paddle_token, fontSmall);
            entry_paddle = paddles[paddle_token] = paddle;
        }

    } else {
        entry_paddle = paddles[""];
    }

    std::string hostname = le->hostname;
    std::string pageurl  = le->path;

    if(settings.hide_url_prefix) pageurl = filterURLHostname(pageurl);

    float dest_y = groupSummarizer->getMiddlePosY(pageurl);
    float pos_y  = ipSummarizer->getMiddlePosY(hostname);

    float start_x = -(entry_paddle->getX() * settings.pitch_speed * start_offset);

    //debugLog("start_offset %.2f : start_x = %.2f (paddle_x %.2f, pitch_speed %.2f)", start_offset, start_x, entry_paddle->getX(), settings.pitch_speed);
    
    vec2 ball_start = vec2(start_x, pos_y);
    vec2 ball_dest  = vec2(entry_paddle->getX(), dest_y);

    const std::string& match = ipSummarizer->getBestMatchStr(hostname);

    vec3 colour = groupSummarizer->isColoured() ? groupSummarizer->getColour() : colourHash(match);

    RequestBall* ball = new RequestBall(le, &fontMedium, balltex, colour, ball_start, ball_dest);

    balls.push_back(ball);
}
void Logstalgia::removeBall(RequestBall* ball) {

    std::string url  = ball->le->path;
    std::string host = ball->le->hostname;

    for(Summarizer* s: summarizers) {
        if(s->supportedString(url)) {

            if(settings.hide_url_prefix) url = filterURLHostname(url);
            s->removeString(url);
            break;
        }
    }

    ipSummarizer->removeString(host);

    delete ball;
}
Exemple #5
0
void Logstalgia::removeBall(RequestBall* ball) {
    std::string url  = ball->le->path;
    std::string host = ball->le->hostname;

    int nogroups = summGroups.size();

    for(int i=0;i<nogroups;i++) {
        if(summGroups[i]->supportedString(url)) {

            if(gHideURLPrefix) url = filterURLHostname(url);

            summGroups[i]->removeString(url);
            break;
        }
    }

    ipSummarizer->removeString(host);

    delete ball;
}
Exemple #6
0
void Logstalgia::addStrings(LogEntry* le) {

    std::string hostname = le->hostname;
    std::string pageurl  = le->path;

    int nogroups = summGroups.size();
    Summarizer* pageSummarizer= 0;

    for(int i=0;i<nogroups;i++) {
        if(summGroups[i]->supportedString(pageurl)) {
            pageSummarizer = summGroups[i];
            break;
        }
    }

    if(pageSummarizer==0) return;

    if(gHideURLPrefix) pageurl = filterURLHostname(pageurl);

    pageSummarizer->addString(pageurl);
    ipSummarizer->addString(hostname);
}