MCPcopy Create free account
hub / github.com/F-Stack/f-stack / regdomain_makechannels

Function regdomain_makechannels

tools/ifconfig/ifieee80211.c:2317–2453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2315}
2316
2317static void
2318regdomain_makechannels(
2319 struct ieee80211_regdomain_req *req,
2320 const struct ieee80211_devcaps_req *dc)
2321{
2322 struct regdata *rdp = getregdata();
2323 const struct country *cc;
2324 const struct ieee80211_regdomain *reg = &req->rd;
2325 struct ieee80211req_chaninfo *ci = &req->chaninfo;
2326 const struct regdomain *rd;
2327
2328 /*
2329 * Locate construction table for new channel list. We treat
2330 * the regdomain/SKU as definitive so a country can be in
2331 * multiple with different properties (e.g. US in FCC+FCC3).
2332 * If no regdomain is specified then we fallback on the country
2333 * code to find the associated regdomain since countries always
2334 * belong to at least one regdomain.
2335 */
2336 if (reg->regdomain == 0) {
2337 cc = lib80211_country_findbycc(rdp, reg->country);
2338 if (cc == NULL)
2339 errx(1, "internal error, country %d not found",
2340 reg->country);
2341 rd = cc->rd;
2342 } else
2343 rd = lib80211_regdomain_findbysku(rdp, reg->regdomain);
2344 if (rd == NULL)
2345 errx(1, "internal error, regdomain %d not found",
2346 reg->regdomain);
2347 if (rd->sku != SKU_DEBUG) {
2348 /*
2349 * regdomain_addchans incrememnts the channel count for
2350 * each channel it adds so initialize ic_nchans to zero.
2351 * Note that we know we have enough space to hold all possible
2352 * channels because the devcaps list size was used to
2353 * allocate our request.
2354 */
2355 ci->ic_nchans = 0;
2356 if (!LIST_EMPTY(&rd->bands_11b))
2357 regdomain_addchans(ci, &rd->bands_11b, reg,
2358 IEEE80211_CHAN_B, &dc->dc_chaninfo);
2359 if (!LIST_EMPTY(&rd->bands_11g))
2360 regdomain_addchans(ci, &rd->bands_11g, reg,
2361 IEEE80211_CHAN_G, &dc->dc_chaninfo);
2362 if (!LIST_EMPTY(&rd->bands_11a))
2363 regdomain_addchans(ci, &rd->bands_11a, reg,
2364 IEEE80211_CHAN_A, &dc->dc_chaninfo);
2365 if (!LIST_EMPTY(&rd->bands_11na) && dc->dc_htcaps != 0) {
2366 regdomain_addchans(ci, &rd->bands_11na, reg,
2367 IEEE80211_CHAN_A | IEEE80211_CHAN_HT20,
2368 &dc->dc_chaninfo);
2369 if (dc->dc_htcaps & IEEE80211_HTCAP_CHWIDTH40) {
2370 regdomain_addchans(ci, &rd->bands_11na, reg,
2371 IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U,
2372 &dc->dc_chaninfo);
2373 regdomain_addchans(ci, &rd->bands_11na, reg,
2374 IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D,

Callers 1

setregdomain_cbFunction · 0.85

Calls 4

getregdataFunction · 0.85
regdomain_addchansFunction · 0.85
qsortFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected