ifieee80211.c (187843) | ifieee80211.c (187844) |
---|---|
1/* 2 * Copyright 2001 The Aerospace Corporation. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/* 2 * Copyright 2001 The Aerospace Corporation. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/sbin/ifconfig/ifieee80211.c 187843 2009-01-28 19:20:12Z sam $ | 27 * $FreeBSD: head/sbin/ifconfig/ifieee80211.c 187844 2009-01-28 19:23:12Z sam $ |
28 */ 29 30/*- 31 * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc. 32 * All rights reserved. 33 * 34 * This code is derived from software contributed to The NetBSD Foundation 35 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, --- 3115 unchanged lines hidden (view full) --- 3151 char buf[14]; 3152 3153 printf("Channel %3u : %u%c Mhz%-14.14s", 3154 ieee80211_mhz2ieee(c->ic_freq, c->ic_flags), c->ic_freq, 3155 IEEE80211_IS_CHAN_PASSIVE(c) ? '*' : ' ', 3156 get_chaninfo(c, verb, buf, sizeof(buf))); 3157} 3158 | 28 */ 29 30/*- 31 * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc. 32 * All rights reserved. 33 * 34 * This code is derived from software contributed to The NetBSD Foundation 35 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, --- 3115 unchanged lines hidden (view full) --- 3151 char buf[14]; 3152 3153 printf("Channel %3u : %u%c Mhz%-14.14s", 3154 ieee80211_mhz2ieee(c->ic_freq, c->ic_flags), c->ic_freq, 3155 IEEE80211_IS_CHAN_PASSIVE(c) ? '*' : ' ', 3156 get_chaninfo(c, verb, buf, sizeof(buf))); 3157} 3158 |
3159static int 3160chanpref(const struct ieee80211_channel *c) 3161{ 3162 if (IEEE80211_IS_CHAN_HT40(c)) 3163 return 40; 3164 if (IEEE80211_IS_CHAN_HT20(c)) 3165 return 30; 3166 if (IEEE80211_IS_CHAN_HALF(c)) 3167 return 10; 3168 if (IEEE80211_IS_CHAN_QUARTER(c)) 3169 return 5; 3170 if (IEEE80211_IS_CHAN_TURBO(c)) 3171 return 25; 3172 if (IEEE80211_IS_CHAN_A(c)) 3173 return 20; 3174 if (IEEE80211_IS_CHAN_G(c)) 3175 return 20; 3176 if (IEEE80211_IS_CHAN_B(c)) 3177 return 15; 3178 if (IEEE80211_IS_CHAN_PUREG(c)) 3179 return 15; 3180 return 0; 3181} 3182 |
|
3159static void 3160print_channels(int s, const struct ieee80211req_chaninfo *chans, 3161 int allchans, int verb) 3162{ 3163 struct ieee80211req_chaninfo *achans; 3164 uint8_t reported[IEEE80211_CHAN_BYTES]; 3165 const struct ieee80211_channel *c; 3166 int i, half; --- 27 unchanged lines hidden (view full) --- 3194 } 3195 } 3196 } else { 3197 for (i = 0; i < chans->ic_nchans; i++) { 3198 c = &chans->ic_chans[i]; 3199 /* suppress duplicates as above */ 3200 if (isset(reported, c->ic_ieee) && !verb) { 3201 /* XXX we assume duplicates are adjacent */ | 3183static void 3184print_channels(int s, const struct ieee80211req_chaninfo *chans, 3185 int allchans, int verb) 3186{ 3187 struct ieee80211req_chaninfo *achans; 3188 uint8_t reported[IEEE80211_CHAN_BYTES]; 3189 const struct ieee80211_channel *c; 3190 int i, half; --- 27 unchanged lines hidden (view full) --- 3218 } 3219 } 3220 } else { 3221 for (i = 0; i < chans->ic_nchans; i++) { 3222 c = &chans->ic_chans[i]; 3223 /* suppress duplicates as above */ 3224 if (isset(reported, c->ic_ieee) && !verb) { 3225 /* XXX we assume duplicates are adjacent */ |
3202 achans->ic_chans[achans->ic_nchans-1] = *c; | 3226 struct ieee80211_channel *a = 3227 &achans->ic_chans[achans->ic_nchans-1]; 3228 if (chanpref(c) > chanpref(a)) 3229 *a = *c; |
3203 } else { 3204 achans->ic_chans[achans->ic_nchans++] = *c; 3205 setbit(reported, c->ic_ieee); 3206 } 3207 } 3208 } 3209 half = achans->ic_nchans / 2; 3210 if (achans->ic_nchans % 2) --- 1616 unchanged lines hidden --- | 3230 } else { 3231 achans->ic_chans[achans->ic_nchans++] = *c; 3232 setbit(reported, c->ic_ieee); 3233 } 3234 } 3235 } 3236 half = achans->ic_nchans / 2; 3237 if (achans->ic_nchans % 2) --- 1616 unchanged lines hidden --- |