Logo Search packages:      
Sourcecode: uaputl version File versions  Download package

void print_tlv ( u8 buf,
u16  len 
)

Show all the tlv in the buf.

Parameters:
bufPoniter to tlv buffer
lentlv buffer len

$return N/A

Definition at line 5107 of file uaputl.c.

References hexdump_data(), KEY_MGMT_PSK, MRVL_AKMP_TLV_ID, MRVL_ANTENNA_CTL_TLV_ID, MRVL_AP_MAC_ADDRESS_TLV_ID, MRVL_AUTH_TLV_ID, MRVL_BCAST_SSID_CTL_TLV_ID, MRVL_BEACON_PERIOD_TLV_ID, MRVL_BT_COEX_ACL_CFG_TLV_ID, MRVL_BT_COEX_COMMON_CFG_TLV_ID, MRVL_BT_COEX_SCO_CFG_TLV_ID, MRVL_BT_COEX_STATS_TLV_ID, MRVL_CHANNELCONFIG_TLV_ID, MRVL_CHANNELLIST_TLV_ID, MRVL_CIPHER_TLV_ID, MRVL_DTIM_PERIOD_TLV_ID, MRVL_FRAG_THRESHOLD_TLV_ID, MRVL_GRP_REKEY_TIME_TLV_ID, MRVL_MAX_STA_CNT_TLV_ID, MRVL_MCBC_DATA_RATE_TLV_ID, MRVL_MGMT_IE_LIST_TLV_ID, MRVL_PKT_FWD_CTL_TLV_ID, MRVL_PREAMBLE_CTL_TLV_ID, MRVL_PROTOCOL_TLV_ID, MRVL_RADIO_CTL_TLV_ID, MRVL_RATES_TLV_ID, MRVL_RETRY_LIMIT_TLV_ID, MRVL_RTS_THRESHOLD_TLV_ID, MRVL_SSID_TLV_ID, MRVL_STA_AGEOUT_TIMER_TLV_ID, MRVL_STA_MAC_ADDR_FILTER_TLV_ID, MRVL_TX_DATA_RATE_TLV_ID, MRVL_TX_POWER_TLV_ID, MRVL_WEP_KEY_TLV_ID, MRVL_WPA_PASSPHRASE_TLV_ID, print_auth(), print_cipher(), print_mac(), print_mac_filter(), print_protocol(), print_rate(), print_wep_key(), uap_le16_to_cpu, uap_le32_to_cpu, and uap_printf().

Referenced by apcmd_coex_config(), apcmd_sys_cfg_custom_ie(), apcmd_sys_cfg_protocol(), apcmd_sys_cfg_rates_ext(), apcmd_sys_cfg_wep_key(), and apcmd_sys_config().

{
    TLVBUF_HEADER *pCurrentTlv = (TLVBUF_HEADER *) buf;
    int tlvBufLeft = len;
    u16 tlvType;
    u16 tlvLen;
    u16 custom_ie_len;
    u8 ssid[33];
    int i = 0;
    TLVBUF_AP_MAC_ADDRESS *mac_tlv;
    TLVBUF_SSID *ssid_tlv;
    TLVBUF_BEACON_PERIOD *beacon_tlv;
    TLVBUF_DTIM_PERIOD *dtim_tlv;
    TLVBUF_RATES *rates_tlv;
    TLVBUF_TX_POWER *txpower_tlv;
    TLVBUF_BCAST_SSID_CTL *bcast_tlv;
    TLVBUF_PREAMBLE_CTL *preamble_tlv;
    TLVBUF_ANTENNA_CTL *antenna_tlv;
    TLVBUF_RTS_THRESHOLD *rts_tlv;
    TLVBUF_RADIO_CTL *radio_tlv;
    TLVBUF_TX_DATA_RATE *txrate_tlv;
    TLVBUF_MCBC_DATA_RATE *mcbcrate_tlv;
    TLVBUF_PKT_FWD_CTL *pkt_fwd_tlv;
    TLVBUF_STA_AGEOUT_TIMER *ageout_tlv;
    TLVBUF_AUTH_MODE *auth_tlv;
    TLVBUF_PROTOCOL *proto_tlv;
    TLVBUF_AKMP *akmp_tlv;
    TLVBUF_CIPHER *cipher_tlv;
    TLVBUF_GROUP_REKEY_TIMER *rekey_tlv;
    TLVBUF_WPA_PASSPHRASE *psk_tlv;
    TLVBUF_WEP_KEY *wep_tlv;
    TLVBUF_FRAG_THRESHOLD *frag_tlv;
    TLVBUF_STA_MAC_ADDR_FILTER *filter_tlv;
    TLVBUF_MAX_STA_NUM *max_sta_tlv;
    TLVBUF_RETRY_LIMIT *retry_limit_tlv;
    TLVBUF_CHANNEL_CONFIG *channel_tlv;
    TLVBUF_CHANNEL_LIST *chnlist_tlv;
    tlvbuf_custom_ie *custom_ie_tlv;
    custom_ie *custom_ie_ptr;
    tlvbuf_coex_common_cfg *coex_common_tlv;
    tlvbuf_coex_sco_cfg *coex_sco_tlv;
    tlvbuf_coex_acl_cfg *coex_acl_tlv;
    tlvbuf_coex_stats *coex_stats_tlv;
    CHANNEL_LIST *pChanList;
#ifdef DEBUG
    uap_printf(MSG_DEBUG, "tlv total len=%d\n", len);
#endif
    while (tlvBufLeft >= (int) sizeof(TLVBUF_HEADER)) {
        tlvType = uap_le16_to_cpu(pCurrentTlv->Type);
        tlvLen = uap_le16_to_cpu(pCurrentTlv->Len);
        if ((sizeof(TLVBUF_HEADER) + tlvLen) > tlvBufLeft) {
            printf("wrong tlv: tlvLen=%d, tlvBufLeft=%d\n", tlvLen, tlvBufLeft);
            break;
        }
        switch (tlvType) {
        case MRVL_AP_MAC_ADDRESS_TLV_ID:
            mac_tlv = (TLVBUF_AP_MAC_ADDRESS *) pCurrentTlv;
            printf("AP MAC address = ");
            print_mac(mac_tlv->ApMacAddr);
            printf("\n");
            break;
        case MRVL_SSID_TLV_ID:
            memset(ssid, 0, sizeof(ssid));
            ssid_tlv = (TLVBUF_SSID *) pCurrentTlv;
            memcpy(ssid, ssid_tlv->Ssid, ssid_tlv->Length);
            printf("SSID = %s\n", ssid);
            break;
        case MRVL_BEACON_PERIOD_TLV_ID:
            beacon_tlv = (TLVBUF_BEACON_PERIOD *) pCurrentTlv;
            beacon_tlv->BeaconPeriod_ms =
                uap_le16_to_cpu(beacon_tlv->BeaconPeriod_ms);
            printf("Beacon period = %d\n", beacon_tlv->BeaconPeriod_ms);
            break;
        case MRVL_DTIM_PERIOD_TLV_ID:
            dtim_tlv = (TLVBUF_DTIM_PERIOD *) pCurrentTlv;
            printf("DTIM period = %d\n", dtim_tlv->DtimPeriod);
            break;
        case MRVL_CHANNELCONFIG_TLV_ID:
            channel_tlv = (TLVBUF_CHANNEL_CONFIG *) pCurrentTlv;
            printf("Channel = %d\n", channel_tlv->ChanNumber);
            printf("Channel Select Mode = %s\n",
                   (channel_tlv->BandConfigType == 0) ? "Manual" : "ACS");
            break;
        case MRVL_CHANNELLIST_TLV_ID:
            chnlist_tlv = (TLVBUF_CHANNEL_LIST *) pCurrentTlv;
            printf("Channels List = ");
            pChanList = (CHANNEL_LIST *) & (chnlist_tlv->ChanList);
            if (chnlist_tlv->Length % sizeof(CHANNEL_LIST)) {
                break;
            }
            for (i = 0; i < (chnlist_tlv->Length / sizeof(CHANNEL_LIST)); i++) {
                printf("%d ", pChanList->ChanNumber);
                pChanList++;
            }
            printf("\n");
            break;
        case MRVL_RATES_TLV_ID:
            rates_tlv = (TLVBUF_RATES *) pCurrentTlv;
            print_rate(rates_tlv);
            break;
        case MRVL_TX_POWER_TLV_ID:
            txpower_tlv = (TLVBUF_TX_POWER *) pCurrentTlv;
            printf("Tx power = %d dBm\n", txpower_tlv->TxPower_dBm);
            break;
        case MRVL_BCAST_SSID_CTL_TLV_ID:
            bcast_tlv = (TLVBUF_BCAST_SSID_CTL *) pCurrentTlv;
            printf("SSID broadcast = %s\n",
                   (bcast_tlv->BcastSsidCtl == 1) ? "enabled" : "disabled");
            break;
        case MRVL_PREAMBLE_CTL_TLV_ID:
            preamble_tlv = (TLVBUF_PREAMBLE_CTL *) pCurrentTlv;
            printf("Preamble type = %s\n", (preamble_tlv->PreambleType == 0) ?
                   "auto" : ((preamble_tlv->PreambleType == 1) ? "short" :
                             "long"));
            break;
        case MRVL_ANTENNA_CTL_TLV_ID:
            antenna_tlv = (TLVBUF_ANTENNA_CTL *) pCurrentTlv;
            printf("%s antenna = %s\n", (antenna_tlv->WhichAntenna == 0) ?
                   "Rx" : "Tx", (antenna_tlv->AntennaMode == 0) ? "A" : "B");
            break;
        case MRVL_RTS_THRESHOLD_TLV_ID:
            rts_tlv = (TLVBUF_RTS_THRESHOLD *) pCurrentTlv;
            rts_tlv->RtsThreshold = uap_le16_to_cpu(rts_tlv->RtsThreshold);
            printf("RTS threshold = %d\n", rts_tlv->RtsThreshold);
            break;
        case MRVL_FRAG_THRESHOLD_TLV_ID:
            frag_tlv = (TLVBUF_FRAG_THRESHOLD *) pCurrentTlv;
            frag_tlv->FragThreshold = uap_le16_to_cpu(frag_tlv->FragThreshold);
            printf("Fragmentation threshold = %d\n", frag_tlv->FragThreshold);
            break;
        case MRVL_RADIO_CTL_TLV_ID:
            radio_tlv = (TLVBUF_RADIO_CTL *) pCurrentTlv;
            printf("Radio = %s\n", (radio_tlv->RadioCtl == 0) ? "on" : "off");
            break;
        case MRVL_TX_DATA_RATE_TLV_ID:
            txrate_tlv = (TLVBUF_TX_DATA_RATE *) pCurrentTlv;
            txrate_tlv->TxDataRate = uap_le16_to_cpu(txrate_tlv->TxDataRate);
            if (txrate_tlv->TxDataRate == 0)
                printf("Tx data rate = auto\n");
            else
                printf("Tx data rate = 0x%x\n", txrate_tlv->TxDataRate);
            break;
        case MRVL_MCBC_DATA_RATE_TLV_ID:
            mcbcrate_tlv = (TLVBUF_MCBC_DATA_RATE *) pCurrentTlv;
            mcbcrate_tlv->MCBCdatarate =
                uap_le16_to_cpu(mcbcrate_tlv->MCBCdatarate);
            if (mcbcrate_tlv->MCBCdatarate == 0)
                printf("MCBC data rate = auto\n");
            else
                printf("MCBC data rate = 0x%x\n", mcbcrate_tlv->MCBCdatarate);
            break;
        case MRVL_PKT_FWD_CTL_TLV_ID:
            pkt_fwd_tlv = (TLVBUF_PKT_FWD_CTL *) pCurrentTlv;
            printf("Firmware = %s\n", (pkt_fwd_tlv->PktFwdCtl == 0) ?
                   "forwards all packets to the host" :
                   "handles intra-BSS packets");
            break;
        case MRVL_STA_AGEOUT_TIMER_TLV_ID:
            ageout_tlv = (TLVBUF_STA_AGEOUT_TIMER *) pCurrentTlv;
            ageout_tlv->StaAgeoutTimer_ms =
                uap_le32_to_cpu(ageout_tlv->StaAgeoutTimer_ms);
            printf("STA ageout timer = %d\n",
                   (int) ageout_tlv->StaAgeoutTimer_ms);
            break;
        case MRVL_AUTH_TLV_ID:
            auth_tlv = (TLVBUF_AUTH_MODE *) pCurrentTlv;
            print_auth(auth_tlv);
            break;
        case MRVL_PROTOCOL_TLV_ID:
            proto_tlv = (TLVBUF_PROTOCOL *) pCurrentTlv;
            proto_tlv->Protocol = uap_le16_to_cpu(proto_tlv->Protocol);
            print_protocol(proto_tlv);
            break;
        case MRVL_AKMP_TLV_ID:
            akmp_tlv = (TLVBUF_AKMP *) pCurrentTlv;
            if (uap_le16_to_cpu(akmp_tlv->KeyMgmt) == KEY_MGMT_PSK)
                printf("KeyMgmt = PSK\n");
            else
                printf("KeyMgmt = NONE\n");
            break;
        case MRVL_CIPHER_TLV_ID:
            cipher_tlv = (TLVBUF_CIPHER *) pCurrentTlv;
            print_cipher(cipher_tlv);
            break;
        case MRVL_GRP_REKEY_TIME_TLV_ID:
            rekey_tlv = (TLVBUF_GROUP_REKEY_TIMER *) pCurrentTlv;
            if (rekey_tlv->GroupRekeyTime_sec == 0)
                printf("Group re-key time = disabled\n");
            else
                printf("Group re-key time = %ld second\n",
                       uap_le32_to_cpu(rekey_tlv->GroupRekeyTime_sec));
            break;
        case MRVL_WPA_PASSPHRASE_TLV_ID:
            psk_tlv = (TLVBUF_WPA_PASSPHRASE *) pCurrentTlv;
            if (psk_tlv->Length > 0) {
                printf("WPA passphrase = ");
                for (i = 0; i < psk_tlv->Length; i++)
                    printf("%c", psk_tlv->Passphrase[i]);
                printf("\n");
            } else
                printf("WPA passphrase = None\n");
            break;
        case MRVL_WEP_KEY_TLV_ID:
            wep_tlv = (TLVBUF_WEP_KEY *) pCurrentTlv;
            print_wep_key(wep_tlv);
            break;
        case MRVL_STA_MAC_ADDR_FILTER_TLV_ID:
            filter_tlv = (TLVBUF_STA_MAC_ADDR_FILTER *) pCurrentTlv;
            print_mac_filter(filter_tlv);
            break;
        case MRVL_MAX_STA_CNT_TLV_ID:
            max_sta_tlv = (TLVBUF_MAX_STA_NUM *) pCurrentTlv;
            printf("Max Station Number = %d\n", max_sta_tlv->Max_sta_num);
            break;
        case MRVL_RETRY_LIMIT_TLV_ID:
            retry_limit_tlv = (TLVBUF_RETRY_LIMIT *) pCurrentTlv;
            printf("Retry Limit = %d\n", retry_limit_tlv->retry_limit);
            break;
        case MRVL_MGMT_IE_LIST_TLV_ID:
            custom_ie_tlv = (tlvbuf_custom_ie *) pCurrentTlv;
            custom_ie_len = tlvLen;
            custom_ie_ptr = (custom_ie *) (custom_ie_tlv->ie_data);
            while (custom_ie_len >= sizeof(custom_ie)) {
                printf("Index [%d]\n",
                       uap_le16_to_cpu(custom_ie_ptr->ie_index));
                printf("Management Subtype Mask = 0x%02x\n",
                       uap_le16_to_cpu(custom_ie_ptr->mgmt_subtype_mask));
                hexdump_data("IE Buffer", (void *) custom_ie_ptr->ie_buffer,
                             uap_le16_to_cpu(custom_ie_ptr->ie_length), ' ');
                custom_ie_len -=
                    sizeof(custom_ie) +
                    uap_le16_to_cpu(custom_ie_ptr->ie_length);
                custom_ie_ptr =
                    (custom_ie *) ((u8 *) custom_ie_ptr + sizeof(custom_ie) +
                                   uap_le16_to_cpu(custom_ie_ptr->ie_length));
            }
            break;
        case MRVL_BT_COEX_COMMON_CFG_TLV_ID:
            printf("Coex common configuration:\n");
            coex_common_tlv = (tlvbuf_coex_common_cfg *) pCurrentTlv;
            printf("\tConfig Bitmap = 0x%02lx\n",
                   uap_le32_to_cpu(coex_common_tlv->config_bitmap));
            break;

        case MRVL_BT_COEX_SCO_CFG_TLV_ID:
            printf("Coex sco configuration:\n");
            coex_sco_tlv = (tlvbuf_coex_sco_cfg *) pCurrentTlv;
            for (i = 0; i < 4; i++)
                printf("\tQtime protection [%d] = %d usecs\n", i,
                       uap_le16_to_cpu(coex_sco_tlv->protection_qtime[i]));
            printf("\tProtection frame rate = %d\n",
                   uap_le16_to_cpu(coex_sco_tlv->protection_rate));
            printf("\tACL frequency = %d\n",
                   uap_le16_to_cpu(coex_sco_tlv->acl_frequency));
            break;

        case MRVL_BT_COEX_ACL_CFG_TLV_ID:
            printf("Coex acl configuration: ");
            coex_acl_tlv = (tlvbuf_coex_acl_cfg *) pCurrentTlv;
            coex_acl_tlv->enabled = uap_le16_to_cpu(coex_acl_tlv->enabled);
            printf("%s\n", (coex_acl_tlv->enabled) ? "enabled" : "disabled");
            if (coex_acl_tlv->enabled) {
                printf("\tBT time = %d usecs\n",
                       uap_le16_to_cpu(coex_acl_tlv->bt_time));
                printf("\tWLan time = %d usecs\n",
                       uap_le16_to_cpu(coex_acl_tlv->wlan_time));
                printf("\tProtection frame rate = %d\n",
                       uap_le16_to_cpu(coex_acl_tlv->protection_rate));
            }
            break;

        case MRVL_BT_COEX_STATS_TLV_ID:
            printf("Coex statistics: \n");
            coex_stats_tlv = (tlvbuf_coex_stats *) pCurrentTlv;
            printf("\tNull not sent = %ld\n",
                   uap_le32_to_cpu(coex_stats_tlv->null_not_sent));
            printf("\tNull queued = %ld\n",
                   uap_le32_to_cpu(coex_stats_tlv->null_queued));
            printf("\tNull not queued = %ld\n",
                   uap_le32_to_cpu(coex_stats_tlv->null_not_queued));
            printf("\tCF End queued = %ld\n",
                   uap_le32_to_cpu(coex_stats_tlv->cf_end_queued));
            printf("\tCF End not queued = %ld\n",
                   uap_le32_to_cpu(coex_stats_tlv->cf_end_not_queued));
            printf("\tNull allocation failures = %ld\n",
                   uap_le32_to_cpu(coex_stats_tlv->null_alloc_fail));
            printf("\tCF End allocation failures = %ld\n",
                   uap_le32_to_cpu(coex_stats_tlv->cf_end_alloc_fail));
            break;
        default:
            break;
        }
        tlvBufLeft -= (sizeof(TLVBUF_HEADER) + tlvLen);
        pCurrentTlv = (TLVBUF_HEADER *) (pCurrentTlv->Data + tlvLen);
    }
    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index