Пример #1
0
void sub_proc_query() {
    /// Add a new query to the list
    query               = (dc_querytmpl*)sub_add_template(sizeof(dc_querytmpl));
    query->last         = dashcom.query;
    dashcom.query->next = query;
    dashcom.query       = query;
    
    /// If query is sequential and ANDing, update the last query window by 
    /// setting to 0 and moving old value to this value.
    query->window       = query->last->window;
    query->last->window = 0;

    /// If query is sequential and ORing, update the last query window by
    /// dividing by two, and set this window to the same amount
    query->last->window >>= 1;
    query->window       = query->last->window;
    
    /// Copy Comparison type
    ot_u8 comp1, comp0;
    comp1           = *alp->inq->getcursor++;
    comp0           = *alp->inq->getcursor++;
    comp0           = (comp0 == '=');
    query->length   = *alp->inq->getcursor++;
    ccode           = b00100000;
    
    if (comp1 == 'n') {
        ccode = 0;  
    }
    else if (comp1 == 's') {
        comp0 = query->length - comp0;    // comp0 reset to correlation tolerance
        ccode = b0100000 | (comp0 & b00011111);
    }
    else if (comp1 == '=')  ccode = b00100001;
    else if (comp1 == '<')  ccode = b00100010 + comp0;
    else if (comp1 == '>')  ccode = b00100100 + comp0;

    /// Load Token
    if (query->length != 0) {
        query->token = (ot_u8*)sub_add_template(query->length);
        q_readstring(alp->inq, query->token, query->length);
    }
    
    /// Load Mask
    mask_length     = *alp->inq->getcursor++;
    query->mask     = NULL;
    if (mask_length != 0) {
        query->mask = (ot_u8*)sub_add_template(query->length);
        q_readstring(alp->inq, query->mask, mask_length);
        while(mask_length < query_length) {
            query->mask[mask_length] = 0xff;
            mask_length++;
        }
        ccode |= b10000000;
    }
}
Пример #2
0
OT_WEAK void alp_breakdown_session_tmpl(ot_queue* in_q, void* data_type) {
    q_readstring(in_q, (ot_u8*)data_type, 6);
    //((session_tmpl*)data_type)->reserved    = q_readbyte(in_q);
    //((session_tmpl*)data_type)->channel     = q_readbyte(in_q);
    //((session_tmpl*)data_type)->subnet      = q_readbyte(in_q);
    //((session_tmpl*)data_type)->subnetmask  = q_readbyte(in_q);
    //((session_tmpl*)data_type)->flags       = q_readbyte(in_q);
    //((session_tmpl*)data_type)->flagmask    = q_readbyte(in_q);
}
Пример #3
0
OT_WEAK void alp_breakdown_command_tmpl(ot_queue* in_q, void* data_type) {
    q_readstring(in_q, (ot_u8*)data_type, 3);
    //((command_tmpl*)data_type)->type        = q_readbyte(in_q);
    //((command_tmpl*)data_type)->opcode      = q_readbyte(in_q);
    //((command_tmpl*)data_type)->extension   = q_readbyte(in_q);
}
Пример #4
0
OT_WEAK void alp_breakdown_advert_tmpl(ot_queue* in_q, void* data_type) {
    q_readstring(in_q, (ot_u8*)data_type, 4);
    ((advert_tmpl*)data_type)->duration     = q_readshort(in_q);
}