Пример #1
0
/*
 * Inicializa la estructura que se usa para relacionar el tmp_data
 * de cada nodo con los datos que se sacaran por pantalla cuando
 * se accede al demonio de red.
 * Teoricamente como esta funcion solo se llama desde term_add_node()
 * la cual, a su vez, solo es llamada al tener el mutex bloqueado por
 * lo que no veo necesario que sea reentrante. (Fredy). 
 */
int8_t
dot1x_init_comms_struct(struct term_node *node)
{
    struct dot1x_data *dot1x_data;
    void **comm_param;
 
    comm_param = (void *)calloc(1,sizeof(void *)*SIZE_ARRAY(dot1x_comm_params));
    
    if (comm_param == NULL)
    {
       thread_error("dot1x_init_commands_struct calloc error",errno);
       return -1;
    }

    dot1x_data = node->protocol[PROTO_DOT1X].tmp_data;
    
    node->protocol[PROTO_DOT1X].commands_param = comm_param;
    
    comm_param[DOT1X_SMAC]     = &dot1x_data->mac_source;
    comm_param[DOT1X_DMAC]     = &dot1x_data->mac_dest;
    comm_param[DOT1X_VER]      = &dot1x_data->version; 
    comm_param[DOT1X_TYPE]     = &dot1x_data->type; 
    comm_param[DOT1X_EAP_CODE] = &dot1x_data->eap_code;
    comm_param[DOT1X_EAP_ID]   = &dot1x_data->eap_id; 
    comm_param[DOT1X_EAP_TYPE] = &dot1x_data->eap_type; 
    comm_param[DOT1X_EAP_INFO] = &dot1x_data->eap_info; 
    comm_param[8] = NULL; 
    comm_param[9] = NULL; 
    
    return 0;
}
Пример #2
0
/*
 * Inicializa la estructura que se usa para relacionar el tmp_data
 * de cada nodo con los datos que se sacaran por pantalla cuando
 * se accede al demonio de red.
 * Teoricamente esta funcion solo se llama desde term_add_node()
 * la cual, a su vez, solo es llamada al tener el mutex bloqueado por
 * lo que no veo necesario que sea reentrante. (Fredy). 
 */
int8_t
dtp_init_comms_struct(struct term_node *node)
{
    struct dtp_data *dtp_data;
    void **comm_param;
 
    comm_param = (void *)calloc(1,sizeof(void *)*SIZE_ARRAY(dtp_comm_params));
    
    if (comm_param == NULL)
    {
       thread_error("dtp_init_commands_struct calloc error",errno);
       return -1;
    }

    dtp_data = node->protocol[PROTO_DTP].tmp_data;
    
    node->protocol[PROTO_DTP].commands_param = comm_param;
    
    comm_param[DTP_SMAC]    = &dtp_data->mac_source; 
    comm_param[DTP_DMAC]    = &dtp_data->mac_dest; 
    comm_param[DTP_VERSION] = &dtp_data->version; 
    comm_param[DTP_NEIGH]   = &dtp_data->neighbor; 
    comm_param[DTP_STATUS]  = &dtp_data->status; 
    comm_param[DTP_TYPE]    = &dtp_data->type; 
    comm_param[DTP_DOMAIN]  = &dtp_data->domain; 
    comm_param[7] = NULL; 
    comm_param[8] = NULL; 

    return 0;
}
Пример #3
0
void
vtp_register(void)
{
   protocol_register(PROTO_VTP, "VTP", "VLAN Trunking Protocol", "vtp",
         sizeof(struct vtp_data), vtp_init_attribs, vtp_learn_packet,
         vtp_get_printable_packet, vtp_get_printable_store, vtp_load_values,
         vtp_attack, vtp_update_field, vtp_features, 
         vtp_comm_params, SIZE_ARRAY(vtp_comm_params), NULL, 0, NULL,
         vtp_init_comms_struct, PROTO_VISIBLE, vtp_end);
}
Пример #4
0
void
mpls_register(void)
{
   protocol_register(PROTO_MPLS, "MPLS", "MultiProtocol Label Switching", "mpls", 
         sizeof(struct mpls_data), mpls_init_attribs, mpls_learn_packet,
         mpls_get_printable_packet, mpls_get_printable_store,
         mpls_load_values, mpls_attack, mpls_update_field,
         mpls_features, mpls_comm_params, SIZE_ARRAY(mpls_comm_params), 
         NULL, 0, NULL, mpls_init_comms_struct, PROTO_VISIBLE, mpls_end);
}
Пример #5
0
void
dtp_register(void)
{
   protocol_register(PROTO_DTP, "DTP", "Dynamic Trunking Protocol", "dtp",
         sizeof(struct dtp_data), dtp_init_attribs, 
         dtp_learn_packet, dtp_get_printable_packet, 
         dtp_get_printable_store, dtp_load_values, 
         dtp_attack, dtp_update_field,
         dtp_features, dtp_comm_params, SIZE_ARRAY(dtp_comm_params),
         NULL, 0, NULL, dtp_init_comms_struct, PROTO_VISIBLE, dtp_end);
}
Пример #6
0
void father(char **seq, int bg, struct jobs_ls** jobs, pid_t pid)
{
    int status;

    if (bg) {
        struct jobs_ls *bg = malloc(sizeof(*bg));
        strncpy(bg->name, seq[0], SIZE_ARRAY(bg->name));
        bg->name[SIZE_ARRAY(bg) - 1] = '\0';
        bg->pid  = pid;
        if (*jobs) {
            bg->next = (*jobs)->next;
            (*jobs)->next = bg;
        } else {
            *jobs = bg;
        }
    } else {
        // wait end of command
        waitpid(pid, &status, 0);
    }
}
Пример #7
0
void
dot1x_register(void)
{
   protocol_register(PROTO_DOT1X, "802.1X", "IEEE 802.1X", "dot1x", 
         sizeof(struct dot1x_data), dot1x_init_attribs, dot1x_learn_packet,
         dot1x_get_printable_packet, dot1x_get_printable_store,
         dot1x_load_values, dot1x_attack,
         dot1x_update_field, 
         dot1x_features, dot1x_comm_params, SIZE_ARRAY(dot1x_comm_params), 
         NULL, 0, NULL, dot1x_init_comms_struct, PROTO_VISIBLE, dot1x_end);
}
Пример #8
0
void
hsrp_register(void)
{
   protocol_register(PROTO_HSRP, "HSRP", "Hot Standby Router Protocol", 
         "hsrp", sizeof(struct hsrp_data), hsrp_init_attribs, NULL,
         hsrp_get_printable_packet, hsrp_get_printable_store,
         hsrp_load_values, hsrp_attack, 
         hsrp_update_field, 
         hsrp_features, hsrp_comm_params, SIZE_ARRAY(hsrp_comm_params), 
         NULL, 0, NULL, hsrp_init_comms_struct, PROTO_VISIBLE, hsrp_end);
}
Пример #9
0
/**
 * print_pcm_bits - Print the supported PCM fmt bits to the string buffer
 * @pcm: PCM caps bits
 */
QString ELD::print_pcm_bits(int pcm)
{
    unsigned int bits[] = { 16, 20, 24 };
    unsigned int i;
    QString result = QString();

    for (i = 0; i < SIZE_ARRAY(bits); i++)
    {
        if ((pcm & (1 << i)) != 0)
        {
            result += QString(" %1").arg(bits[i]);
        }
    }
    return result;
}
Пример #10
0
QString ELD::codecs_desc()
{
    QString result = QString();
    bool found_one = false;
    for (unsigned int i = 0; i < SIZE_ARRAY(audiotype_names); i++)
    {
        if ((m_e.formats & (1 << i)) != 0)
        {
            if (found_one)
                result += ", ";
            result += audiotype_names[i];
            found_one = true;
        }
    }
    return result;
}
Пример #11
0
/**
 * SNDRV_PCM_RATE_* and AC_PAR_PCM values don't match, print correct rates with
 * hdmi-specific routine.
 */
QString ELD::print_pcm_rates(int pcm)
{
    unsigned int rates[] = {
        5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200,
        96000, 176400, 192000 };
    QString result = QString();

    for (unsigned int i = 0; i < SIZE_ARRAY(rates); i++)
    {
        if ((pcm & (1 << i)) != 0)
        {
            result += QString(" %1").arg(rates[i]);
        }
    }
    return result;
}
Пример #12
0
/*
 * Inicializa la estructura que se usa para relacionar el tmp_data
 * de cada nodo con los datos que se sacaran por pantalla cuando
 * se accede al demonio de red.
 * Teoricamente como esta funcion solo se llama desde term_add_node()
 * la cual, a su vez, solo es llamada al tener el mutex bloqueado por
 * lo que no veo necesario que sea reentrante. (Fredy). 
 */
int8_t
hsrp_init_comms_struct(struct term_node *node)
{
    struct hsrp_data *hsrp_data;
    void **comm_param;
 
    comm_param = (void *)calloc(1,sizeof(void *)*SIZE_ARRAY(hsrp_comm_params));
    
    if (comm_param == NULL)
    {
       thread_error("hsrp_init_commands_struct calloc error",errno);
       return -1;
    }

    hsrp_data = node->protocol[PROTO_HSRP].tmp_data;
    
    node->protocol[PROTO_HSRP].commands_param = comm_param;

    comm_param[HSRP_SMAC] = &hsrp_data->mac_source;
    comm_param[HSRP_DMAC] = &hsrp_data->mac_dest; 
    comm_param[HSRP_SIP] = &hsrp_data->sip;
    comm_param[HSRP_DIP] = &hsrp_data->dip;
    comm_param[HSRP_SPORT] = &hsrp_data->sport;
    comm_param[HSRP_DPORT] = &hsrp_data->dport;
    comm_param[HSRP_VER] = &hsrp_data->version;
    comm_param[HSRP_OPCODE] = &hsrp_data->opcode;
    comm_param[HSRP_STATE] = &hsrp_data->state;
    comm_param[HSRP_HELLO_TIME] = &hsrp_data->hello_time;
    comm_param[HSRP_HOLD_TIME] = &hsrp_data->hold_time;
    comm_param[HSRP_PRIORITY] = &hsrp_data->priority;
    comm_param[HSRP_GROUP] = &hsrp_data->group;
    comm_param[HSRP_RESERVED] = &hsrp_data->reserved;
    comm_param[HSRP_AUTHDATA] = &hsrp_data->authdata;
    comm_param[HSRP_VIRTUALIP] = &hsrp_data->virtual_ip;
    comm_param[16] = NULL; 
    comm_param[17] = NULL; 

    return 0;
}
Пример #13
0
int8_t
mpls_init_comms_struct(struct term_node *node)
{
    struct mpls_data *mpls_data;
    void **comm_param;
 
    comm_param = (void *)calloc(1,sizeof(void *)*SIZE_ARRAY(mpls_comm_params));
    
    if (comm_param == NULL)
    {
       thread_error("mpls_init_comms_struct calloc error",errno);
       return -1;
    }

    mpls_data = node->protocol[PROTO_MPLS].tmp_data;
    
    node->protocol[PROTO_MPLS].commands_param = comm_param;
    
    comm_param[MPLS_SMAC]    =  &mpls_data->mac_source; 
    comm_param[MPLS_DMAC]    =  &mpls_data->mac_dest;
    comm_param[MPLS_LABEL1]  =  &mpls_data->label1; 
    comm_param[MPLS_EXP1]    =  &mpls_data->exp1;
    comm_param[MPLS_BOTTOM1] =  &mpls_data->bottom1; 
    comm_param[MPLS_TTL1]    =  &mpls_data->ttl1; 
    comm_param[MPLS_LABEL2]  =  &mpls_data->label2; 
    comm_param[MPLS_EXP2]    =  &mpls_data->exp2;
    comm_param[MPLS_BOTTOM2] =  &mpls_data->bottom2;
    comm_param[MPLS_TTL2]    =  &mpls_data->ttl2;
    comm_param[MPLS_SRC_IP]   = &mpls_data->src_ip;  
    comm_param[MPLS_SRC_PORT] = &mpls_data->src_port;  
    comm_param[MPLS_DST_IP]   = &mpls_data->dst_ip; 
    comm_param[MPLS_DST_PORT] = &mpls_data->dst_port;  
    comm_param[MPLS_PAYLOAD]  = &mpls_data->ip_payload;
    comm_param[15] = NULL; 
    comm_param[16] = NULL; 

    return 0;
}
Пример #14
0
/*
 * Inicializa la estructura que se usa para relacionar el tmp_data
 * de cada nodo con los datos que se sacaran por pantalla cuando
 * se accede al demonio de red.
 * Teoricamente como esta funcion solo se llama desde term_add_node()
 * la cual, a su vez, solo es llamada al tener el mutex bloqueado por
 * lo que no veo necesario que sea reentrante. (Fredy). 
 */
int8_t
vtp_init_comms_struct(struct term_node *node)
{
    struct vtp_data *vtp_data;
    void **comm_param;
 
    comm_param = (void *)calloc(1,sizeof(void *)*SIZE_ARRAY(vtp_comm_params));
    
    if (comm_param == NULL)
    {
       thread_error("vtp_init_commands_struct calloc error",errno);
       return -1;
    }

    vtp_data = node->protocol[PROTO_VTP].tmp_data;
    
    node->protocol[PROTO_VTP].commands_param = comm_param;
    
    comm_param[VTP_SMAC]      = &vtp_data->mac_source; 
    comm_param[VTP_DMAC]      = &vtp_data->mac_dest;
    comm_param[VTP_VERSION]   = &vtp_data->version;
    comm_param[VTP_CODE]      = &vtp_data->code;  
    comm_param[VTP_DOMAIN]    = &vtp_data->domain; 
    comm_param[VTP_MD5]       = &vtp_data->md5; 
    comm_param[VTP_UPDATER]   = &vtp_data->updater; 
    comm_param[VTP_REVISION]  = &vtp_data->revision; 
    comm_param[VTP_TIMESTAMP] = &vtp_data->timestamp; 
    comm_param[VTP_STARTVAL]  = &vtp_data->start_val;
    comm_param[VTP_FOLLOWERS] = &vtp_data->followers; 
    comm_param[VTP_SEQ]       = &vtp_data->seq;
    comm_param[12]            = NULL; 
    comm_param[13]            = NULL;
    comm_param[VTP_VLAN]      = &vtp_data->options;

    return 0;
}