summaryrefslogtreecommitdiffstats
path: root/sys/dev/ray/if_raymib.h
blob: 77297869b9e2721c52af2d40d39dc871805b23f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
/*
 * Copyright (C) 2000
 * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk.
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the author nor the names of any co-contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY DUNCAN BARCLAY AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL DUNCAN BARCLAY OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD$
 *
 */

/*
 * Bit mask definitions for firmware versioning
 */
#define RAY_V4	0x1
#define RAY_V5	0x2

/*
 * MIB stuctures
 */
struct ray_mib_common_head {			/*Offset*/	/*Size*/
    u_int8_t	mib_net_type;			/*00*/ 
    u_int8_t	mib_ap_status;			/*01*/
    u_int8_t	mib_ssid[IEEE80211_NWID_LEN];	/*02*/		/*20*/
    u_int8_t	mib_scan_mode;			/*22*/
    u_int8_t	mib_apm_mode;			/*23*/
    u_int8_t	mib_mac_addr[ETHER_ADDR_LEN];	/*24*/		/*06*/
    u_int8_t	mib_frag_thresh[2];		/*2a*/		/*02*/
    u_int8_t	mib_dwell_time[2];		/*2c*/		/*02*/
    u_int8_t	mib_beacon_period[2];		/*2e*/		/*02*/
    u_int8_t	mib_dtim_interval;		/*30*/
    u_int8_t	mib_max_retry;			/*31*/
    u_int8_t	mib_ack_timo;			/*32*/
    u_int8_t	mib_sifs;			/*33*/
    u_int8_t	mib_difs;			/*34*/
    u_int8_t	mib_pifs;			/*35*/
    u_int8_t	mib_rts_thresh[2];		/*36*/		/*02*/
    u_int8_t	mib_scan_dwell[2];		/*38*/		/*02*/
    u_int8_t	mib_scan_max_dwell[2];		/*3a*/		/*02*/
    u_int8_t	mib_assoc_timo;			/*3c*/
    u_int8_t	mib_adhoc_scan_cycle;		/*3d*/
    u_int8_t	mib_infra_scan_cycle;		/*3e*/
    u_int8_t	mib_infra_super_scan_cycle;	/*3f*/
    u_int8_t	mib_promisc;			/*40*/
    u_int8_t	mib_uniq_word[2];		/*41*/		/*02*/
    u_int8_t	mib_slot_time;			/*43*/
    u_int8_t	mib_roam_low_snr_thresh;	/*44*/
    u_int8_t	mib_low_snr_count;		/*45*/
    u_int8_t	mib_infra_missed_beacon_count;	/*46*/
    u_int8_t	mib_adhoc_missed_beacon_count;	/*47*/
    u_int8_t	mib_country_code;		/*48*/
    u_int8_t	mib_hop_seq;			/*49*/
    u_int8_t	mib_hop_seq_len;		/*4a*/
} __attribute__((__packed__));

struct ray_mib_common_tail {
    u_int8_t	mib_noise_filter_gain;		/*00*/
    u_int8_t	mib_noise_limit_offset;		/*01*/
    u_int8_t	mib_rssi_thresh_offset;		/*02*/
    u_int8_t	mib_busy_thresh_offset;		/*03*/
    u_int8_t	mib_sync_thresh;		/*04*/
    u_int8_t	mib_test_mode;			/*05*/
    u_int8_t	mib_test_min_chan;		/*06*/
    u_int8_t	mib_test_max_chan;		/*07*/
} __attribute__((__packed__));

struct ray_mib_4 {
    struct ray_mib_common_head	mib_head;	/*00*/
    u_int8_t			mib_cw_max;	/*4b*/
    u_int8_t			mib_cw_min;	/*4c*/
    struct ray_mib_common_tail	mib_tail;	/*4d*/
} __attribute__((__packed__));

struct ray_mib_5 {
    struct ray_mib_common_head	mib_head;		/*00*/
    u_int8_t			mib_cw_max[2];		/*4b*/		/*02*/
    u_int8_t			mib_cw_min[2];		/*4d*/		/*02*/
    struct ray_mib_common_tail	mib_tail;		/*4f*/
    u_int8_t			mib_allow_probe_resp;	/*57*/
    u_int8_t			mib_privacy_must_start;	/*58*/
    u_int8_t			mib_privacy_can_join;	/*59*/
    u_int8_t			mib_basic_rate_set[8];	/*5a*/		/*08*/
} __attribute__((__packed__));

#define mib_net_type		mib_head.mib_net_type
#define mib_ap_status		mib_head.mib_ap_status
#define mib_ssid		mib_head.mib_ssid
#define mib_scan_mode		mib_head.mib_scan_mode
#define mib_apm_mode		mib_head.mib_apm_mode
#define mib_mac_addr		mib_head.mib_mac_addr
#define mib_frag_thresh		mib_head.mib_frag_thresh
#define mib_dwell_time		mib_head.mib_dwell_time
#define mib_beacon_period	mib_head.mib_beacon_period
#define mib_dtim_interval	mib_head.mib_dtim_interval
#define mib_max_retry		mib_head.mib_max_retry
#define mib_ack_timo		mib_head.mib_ack_timo
#define mib_sifs		mib_head.mib_sifs
#define mib_difs		mib_head.mib_difs
#define mib_pifs		mib_head.mib_pifs
#define mib_rts_thresh		mib_head.mib_rts_thresh
#define mib_scan_dwell		mib_head.mib_scan_dwell
#define mib_scan_max_dwell	mib_head.mib_scan_max_dwell
#define mib_assoc_timo		mib_head.mib_assoc_timo
#define mib_adhoc_scan_cycle	mib_head.mib_adhoc_scan_cycle
#define mib_infra_scan_cycle	mib_head.mib_infra_scan_cycle
#define mib_infra_super_scan_cycle \
				mib_head.mib_infra_super_scan_cycle
#define mib_promisc		mib_head.mib_promisc
#define mib_uniq_word		mib_head.mib_uniq_word
#define mib_slot_time		mib_head.mib_slot_time
#define mib_roam_low_snr_thresh	mib_head.mib_roam_low_snr_thresh
#define mib_low_snr_count	mib_head.mib_low_snr_count
#define mib_infra_missed_beacon_count \
				mib_head.mib_infra_missed_beacon_count
#define mib_adhoc_missed_beacon_count \
				mib_head.mib_adhoc_missed_beacon_count
#define mib_country_code	mib_head.mib_country_code
#define mib_hop_seq		mib_head.mib_hop_seq
#define mib_hop_seq_len		mib_head.mib_hop_seq_len

#define mib_noise_filter_gain	mib_tail.mib_noise_filter_gain
#define mib_noise_limit_offset	mib_tail.mib_noise_limit_offset
#define mib_rssi_thresh_offset	mib_tail.mib_rssi_thresh_offset
#define mib_busy_thresh_offset	mib_tail.mib_busy_thresh_offset
#define mib_sync_thresh		mib_tail.mib_sync_thresh
#define mib_test_mode		mib_tail.mib_test_mode
#define mib_test_min_chan	mib_tail.mib_test_min_chan
#define mib_test_max_chan	mib_tail.mib_test_max_chan

/*
 * MIB IDs for the update/report param commands
 */
#define	RAY_MIB_NET_TYPE			0
#define	RAY_MIB_AP_STATUS			1
#define	RAY_MIB_SSID				2
#define RAY_MIB_SCAN_MODE			3
#define	RAY_MIB_APM_MODE			4
#define	RAY_MIB_MAC_ADDR			5
#define	RAY_MIB_FRAG_THRESH			6
#define	RAY_MIB_DWELL_TIME			7
#define	RAY_MIB_BEACON_PERIOD			8
#define	RAY_MIB_DTIM_INTERVAL			9
#define	RAY_MIB_MAX_RETRY			10
#define	RAY_MIB_ACK_TIMO			11
#define	RAY_MIB_SIFS				12
#define	RAY_MIB_DIFS				13
#define	RAY_MIB_PIFS				14
#define	RAY_MIB_RTS_THRESH			15
#define	RAY_MIB_SCAN_DWELL			16
#define	RAY_MIB_SCAN_MAX_DWELL			17
#define	RAY_MIB_ASSOC_TIMO			18
#define	RAY_MIB_ADHOC_SCAN_CYCLE		19
#define	RAY_MIB_INFRA_SCAN_CYCLE		20
#define	RAY_MIB_INFRA_SUPER_SCAN_CYCLE		21
#define	RAY_MIB_PROMISC				22
#define	RAY_MIB_UNIQ_WORD			23
#define	RAY_MIB_SLOT_TIME			24
#define	RAY_MIB_ROAM_LOW_SNR_THRESH		25
#define	RAY_MIB_LOW_SNR_COUNT			26
#define	RAY_MIB_INFRA_MISSED_BEACON_COUNT	27
#define	RAY_MIB_ADHOC_MISSED_BEACON_COUNT	28
#define	RAY_MIB_COUNTRY_CODE			29
#define	RAY_MIB_HOP_SEQ				30
#define	RAY_MIB_HOP_SEQ_LEN			31
#define	RAY_MIB_CW_MAX				32
#define	RAY_MIB_CW_MIN				33
#define	RAY_MIB_NOISE_FILTER_GAIN		34
#define	RAY_MIB_NOISE_LIMIT_OFFSET		35
#define	RAY_MIB_RSSI_THRESH_OFFSET		36
#define	RAY_MIB_BUSY_THRESH_OFFSET		37
#define	RAY_MIB_SYNC_THRESH			38
#define	RAY_MIB_TEST_MODE			39
#define	RAY_MIB_TEST_MIN_CHAN			40
#define	RAY_MIB_TEST_MAX_CHAN			41
#define	RAY_MIB_ALLOW_PROBE_RESP		42
#define	RAY_MIB_PRIVACY_MUST_START		43
#define	RAY_MIB_PRIVACY_CAN_JOIN		44
#define	RAY_MIB_BASIC_RATE_SET			45
#define RAY_MIB_VERSION				46
#define RAY_MIB_CUR_BSSID			47
#define RAY_MIB_CUR_INITED			48
#define RAY_MIB_CUR_DEF_TXRATE			49
#define RAY_MIB_CUR_ENCRYPT			50
#define RAY_MIB_CUR_NET_TYPE			51
#define RAY_MIB_CUR_SSID			52
#define RAY_MIB_CUR_PRIV_START			53
#define RAY_MIB_CUR_PRIV_JOIN			54
#define RAY_MIB_DES_BSSID			55
#define RAY_MIB_DES_INITED			56
#define RAY_MIB_DES_DEF_TXRATE			57
#define RAY_MIB_DES_ENCRYPT			58
#define RAY_MIB_DES_NET_TYPE			59
#define RAY_MIB_DES_SSID			60
#define RAY_MIB_DES_PRIV_START			61
#define RAY_MIB_DES_PRIV_JOIN			62
#define RAY_MIB_CUR_AP_STATUS			63
#define RAY_MIB_CUR_PROMISC			64
#define RAY_MIB_DES_AP_STATUS			65
#define RAY_MIB_DES_PROMISC			66

#define	RAY_MIB_LASTUSER			45
#define	RAY_MIB_MAX				66

/*
 * Strings for the MIB
 */
#define RAY_MIB_STRINGS {		\
	"Network type",			\
	"AP status",			\
	"SSID",				\
	"Scan mode",			\
	"APM mode",			\
	"MAC address",			\
	"Fragmentation threshold",	\
	"Dwell time",			\
	"Beacon period",		\
	"DTIM_INTERVAL",		\
	"MAX_RETRY",			\
	"ACK_TIMO",			\
	"SIFS",				\
	"DIFS",				\
	"PIFS",				\
	"RTS_THRESH",			\
	"SCAN_DWELL",			\
	"SCAN_MAX_DWELL",		\
	"ASSOC_TIMO",			\
	"ADHOC_SCAN_CYCLE",		\
	"INFRA_SCAN_CYCLE",		\
	"INFRA_SUPER_SCAN_CYCLE",	\
	"PROMISC",			\
	"UNIQ_WORD",			\
	"SLOT_TIME",			\
	"ROAM_LOW_SNR_THRESH",		\
	"LOW_SNR_COUNT",		\
	"INFRA_MISSED_BEACON_COUNT",	\
	"ADHOC_MISSED_BEACON_COUNT",	\
	"COUNTRY_CODE",			\
	"HOP_SEQ",			\
	"HOP_SEQ_LEN",			\
	"CW_MAX",			\
	"CW_MIN",			\
	"NOISE_FILTER_GAIN",		\
	"NOISE_LIMIT_OFFSET",		\
	"RSSI_THRESH_OFFSET",		\
	"BUSY_THRESH_OFFSET",		\
	"SYNC_THRESH",			\
	"TEST_MODE",			\
	"TEST_MIN_CHAN",		\
	"TEST_MAX_CHAN",		\
	"ALLOW_PROBE_RESP",		\
	"PRIVACY_MUST_START",		\
	"PRIVACY_CAN_JOIN",		\
	"BASIC_RATE_SET",		\
	"Firmware version",		\
	"Current BSS Id",		\
	"Current INITED",		\
	"Current DEF_TXRATE",		\
	"Current ENCRYPT",		\
	"Current NET_TYPE",		\
	"Current SSID",			\
	"Current PRIV_START",		\
	"Current PRIV_JOIN",		\
	"Desired BSSID",		\
	"Desired INITED",		\
	"Desired DEF_TXRATE",		\
	"Desired ENCRYPT",		\
	"Desired NET_TYPE",		\
	"Desired SSID",			\
	"Desired PRIV_START",		\
	"Desired PRIV_JOIN",		\
	"Current AP_STATUS",		\
	"Current PROMISC",		\
	"Desired AP_STATUS",		\
	"Desired PROMISC"		\
}

#define RAY_MIB_HELP_STRINGS {			\
	"0 Ad hoc, 1 Infrastructure",		\
	"0 Station, 1 Access Point",		\
	"",					\
	"0 Passive, 1 Active",			\
	"0 Off, 1 On",				\
	"",					\
	"Bytes",				\
	"DWELL_TIME",				\
	"BEACON_PERIOD",			\
	"DTIM_INTERVAL",			\
	"MAX_RETRY",				\
	"ACK_TIMO",				\
	"SIFS",					\
	"DIFS",					\
	"PIFS",					\
	"RTS_THRESH",				\
	"SCAN_DWELL",				\
	"SCAN_MAX_DWELL",			\
	"ASSOC_TIMO",				\
	"ADHOC_SCAN_CYCLE",			\
	"INFRA_SCAN_CYCLE",			\
	"INFRA_SUPER_SCAN_CYCLE",		\
	"PROMISC",				\
	"UNIQ_WORD",				\
	"SLOT_TIME",				\
	"ROAM_LOW_SNR_THRESH",			\
	"LOW_SNR_COUNT",			\
	"INFRA_MISSED_BEACON_COUNT",		\
	"ADHOC_MISSED_BEACON_COUNT",		\
	"COUNTRY_CODE",				\
	"HOP_SEQ",				\
	"HOP_SEQ_LEN",				\
	"CW_MAX",				\
	"CW_MIN",				\
	"NOISE_FILTER_GAIN",			\
	"NOISE_LIMIT_OFFSET",			\
	"RSSI_THRESH_OFFSET",			\
	"BUSY_THRESH_OFFSET",			\
	"SYNC_THRESH",				\
	"TEST_MODE",				\
	"TEST_MIN_CHAN",			\
	"TEST_MAX_CHAN",			\
	"ALLOW_PROBE_RESP",			\
	"PRIVACY_MUST_START",			\
	"PRIVACY_CAN_JOIN",			\
	"BASIC_RATE_SET",			\
	"",					\
	"",					\
	"0 Joined a net, 1 Created a net",	\
	"Current DEF_TXRATE",			\
	"Current ENCRYPT",			\
	"Current NET_TYPE",			\
	"",					\
	"Current PRIV_START",			\
	"Current PRIV_JOIN",			\
	"",					\
	"N/A",					\
	"Desired DEF_TXRATE",			\
	"Desired ENCRYPT",			\
	"Desired NET_TYPE",			\
	"",					\
	"Desired PRIV_START",			\
	"Desired PRIV_JOIN",			\
	"Current AP_STATUS",			\
	"Current PROMISC",			\
	"Desired AP_STATUS",			\
	"Desired PROMISC"			\
}

/*
 * Applicable versions and work size for each MIB element
 */
#define RAY_MIB_INFO_SIZ4 1
#define RAY_MIB_INFO_SIZ5 2
#define RAY_MIB_SIZE(info, mib, version) \
	info[(mib)][(version & RAY_V4)?RAY_MIB_INFO_SIZ4:RAY_MIB_INFO_SIZ5]
#define RAY_MIB_INFO {							\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_NET_TYPE */			\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_AP_STATUS */			\
{RAY_V4|RAY_V5,	IEEE80211_NWID_LEN, 					\
			IEEE80211_NWID_LEN},/* RAY_MIB_SSID */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_SCAN_MODE */			\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_APM_MODE */			\
{RAY_V4|RAY_V5,	ETHER_ADDR_LEN,						\
			ETHER_ADDR_LEN},/* RAY_MIB_MAC_ADDR */		\
{RAY_V4|RAY_V5,	2,	2},	/* RAY_MIB_FRAG_THRESH */		\
{RAY_V4|RAY_V5,	2,	2},	/* RAY_MIB_DWELL_TIME */		\
{RAY_V4|RAY_V5,	2,	2},	/* RAY_MIB_BEACON_PERIOD */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_DTIM_INTERVAL */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_MAX_RETRY */			\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_ACK_TIMO */			\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_SIFS */			\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_DIFS */			\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_PIFS */			\
{RAY_V4|RAY_V5,	2,	2},	/* RAY_MIB_RTS_THRESH */		\
{RAY_V4|RAY_V5,	2,	2},	/* RAY_MIB_SCAN_DWELL */		\
{RAY_V4|RAY_V5,	2,	2},	/* RAY_MIB_SCAN_MAX_DWELL */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_ASSOC_TIMO */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_ADHOC_SCAN_CYCLE */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_INFRA_SCAN_CYCLE */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_INFRA_SUPER_SCAN_CYCLE */	\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_PROMISC */			\
{RAY_V4|RAY_V5,	2,	2},	/* RAY_MIB_UNIQ_WORD */			\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_SLOT_TIME */			\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_ROAM_LOW_SNR_THRESH */	\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_LOW_SNR_COUNT */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_INFRA_MISSED_BEACON_COUNT */	\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_ADHOC_MISSED_BEACON_COUNT */	\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_COUNTRY_CODE */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_HOP_SEQ */			\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_HOP_SEQ_LEN */		\
{RAY_V4|RAY_V5,	1,	2},	/* RAY_MIB_CW_MAX */			\
{RAY_V4|RAY_V5,	1,	2},	/* RAY_MIB_CW_MIN */			\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_NOISE_FILTER_GAIN */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_NOISE_LIMIT_OFFSET */	\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_RSSI_THRESH_OFFSET */	\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_BUSY_THRESH_OFFSET */	\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_SYNC_THRESH */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_TEST_MODE */			\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_TEST_MIN_CHAN */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_TEST_MAX_CHAN */		\
{       RAY_V5,	0,	1},	/* RAY_MIB_ALLOW_PROBE_RESP */		\
{       RAY_V5,	0,	1},	/* RAY_MIB_PRIVACY_MUST_START */	\
{       RAY_V5,	0,	1},	/* RAY_MIB_PRIVACY_CAN_JOIN */		\
{       RAY_V5,	0,	8},	/* RAY_MIB_BASIC_RATE_SET */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_VERSION */			\
{RAY_V4|RAY_V5,	ETHER_ADDR_LEN,						\
			ETHER_ADDR_LEN},/* RAY_MIB_CUR_BSSID */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_CUR_INITED */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_CUR_DEF_TXRATE */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_CUR_ENCRYPT */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_CUR_NET_TYPE */		\
{RAY_V4|RAY_V5,	IEEE80211_NWID_LEN,					\
			IEEE80211_NWID_LEN}, /* RAY_MIB_CUR_SSID */	\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_CUR_PRIV_START */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_CUR_PRIV_JOIN */		\
{RAY_V4|RAY_V5,	ETHER_ADDR_LEN,						\
			ETHER_ADDR_LEN},/* RAY_MIB_DES_BSSID */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_DES_INITED */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_DES_DEF_TXRATE */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_DES_ENCRYPT */		\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_DES_NET_TYPE */		\
{RAY_V4|RAY_V5,	IEEE80211_NWID_LEN, 					\
			IEEE80211_NWID_LEN}, /* RAY_MIB_DES_SSID */	\
{RAY_V4|RAY_V5,	1,	1},	/* RAY_MIB_DES_PRIV_START */		\
{RAY_V4|RAY_V5,	1, 	1}, 	/* RAY_MIB_DES_PRIV_JOIN */		\
{RAY_V4|RAY_V5,	1, 	1}, 	/* RAY_MIB_CUR_AP_STATUS */		\
{RAY_V4|RAY_V5,	1, 	1}, 	/* RAY_MIB_CUR_PROMISC */		\
{RAY_V4|RAY_V5,	1, 	1}, 	/* RAY_MIB_DES_AP_STATUS */		\
{RAY_V4|RAY_V5,	1, 	1} 	/* RAY_MIB_DES_PROMISC */		\
}

/*
 * MIB values
 *
 * I've included comments as to where the numbers have originated
 * from.
 *
 * Linux refers to ray_cs.c and rayctl.h from version 167 of the
 * Linux Raylink driver.
 *
 * NetBSD refers to if_ray.c from version 1.12 of the NetBSD Raylink
 * driver.
 *
 * Symb refers to numbers cleaned from the 802.11 specification,
 * discussion with 802.11 knowledgable people at Symbionics or
 * stuff needed by me (i.e. me, * aps, ifo, hjl).
 *
 * V4 and V5 refer to settings for version 4 and version 5 of
 * the firmware.
 *
 * DOC refers to the
 *	Combined Interface Requirements Specification
 *	and Interface Design Document (IRS/IDD)
 *	for the
 *	WLAN System Interfaces Between the
 *	HOST COMPUTER and the
 *	PCMCIA WLAN INTERFACE CARD
 *	Revision ECF 5.00
 *	17 June, 1998
 */

/* XXX Obtained by raycontrol _before_ downloading
 * # /sys/dev/ray/raycontrol/raycontrol -i ray0
 * Firmware version                4
 * Network type                    0x01    0 Ad hoc, 1 Infrastructure
 * AP status                       0x00    0 Station, 1 Access Point
 * SSID                                                            
 * Scan mode                       0x01    0 Passive, 1 Active
 * APM mode                        0x00    0 Off, 1 On
 * MAC address                     00:00:8f:48:e4:44
 * Fragmentation threshold         0x0200  FRAG_THRESH
 * Dwell tIME                      0x01    DWELL_TIME
 * Beacon period                   0x01    BEACON_PERIOD
 * DTIM_INTERVAL                   0x05    DTIM_INTERVAL
 * MAX_RETRY                       0x03    MAX_RETRY
 * ACK_TIMO                        0x8c    ACK_TIMO
 * SIFS                            0x1e    SIFS
 * DIFS                            0x82    DIFS
 * PIFS                            0xce    PIFS
 * RTS_THRESH                      0x0100  RTS_THRESH
 * SCAN_DWELL                      0xfc18  SCAN_DWELL
 * SCAN_MAX_DWELL                  0xc180  SCAN_MAX_DWELL
 * ASSOC_TIMO                      0x05    ASSOC_TIMO
 * ADHOC_SCAN_CYCLE                0x04    ADHOC_SCAN_CYCLE
 * INFRA_SCAN_CYCLE                0x02    INFRA_SCAN_CYCLE
 * INFRA_SUPER_SCAN_CYCLE          0x04    INFRA_SUPER_SCAN_CYCLE
 * PROMISC                         0x00    PROMISC
 * UNIQ_WORD                       0x0cbd  UNIQ_WORD
 * SLOT_TIME                       0x4e    SLOT_TIME
 * ROAM_LOW_SNR_THRESH             0x20    ROAM_LOW_SNR_THRESH
 * LOW_SNR_COUNT                   0x04    LOW_SNR_COUNT
 * INFRA_MISSED_BEACON_COUNT       0x04    INFRA_MISSED_BEACON_COUNT
 * ADHOC_MISSED_BEACON_COUNT       0x04    ADHOC_MISSED_BEACON_COUNT
 * COUNTRY_CODE                    0x01    COUNTRY_CODE
 * HOP_SEQ                         0x07    HOP_SEQ
 * HOP_SEQ_LEN                     0x4e    HOP_SEQ_LEN
 * CW_MAX                          0x3f    CW_MAX
 * CW_MIN                          0x0f    CW_MIN
 * NOISE_FILTER_GAIN               0x00    NOISE_FILTER_GAIN
 * NOISE_LIMIT_OFFSET              0x00    NOISE_LIMIT_OFFSET
 * RSSI_THRESH_OFFSET              0x70    RSSI_THRESH_OFFSET
 * BUSY_THRESH_OFFSET              0x70    BUSY_THRESH_OFFSET
 * SYNC_THRESH                     0x07    SYNC_THRESH
 * TEST_MODE                       0x00    TEST_MODE
 * TEST_MIN_CHAN                   0x02    TEST_MIN_CHAN
 * TEST_MAX_CHAN                   0x02    TEST_MAX_CHAN
*/

/*
 * mib_net_type
 *
 * DOC		0x01	- Defines network type for Start and Join
 *			- Network commands.
 *
 * Symb		0x00	- Adhoc is safer and I ain't got an AP
 */
#define	RAY_MIB_NET_TYPE_ADHOC			0x00
#define	RAY_MIB_NET_TYPE_INFRA			0x01
#define	RAY_MIB_NET_TYPE_DEFAULT		RAY_MIB_NET_TYPE_ADHOC

/*
 * mib_ap_status
 *
 * DOC		0x00	- Applicable only when Network Type is
 *			- Infrastructure.
 */
#define	RAY_MIB_AP_STATUS_TERMINAL		0x00
#define	RAY_MIB_AP_STATUS_AP			0x01
#define	RAY_MIB_AP_STATUS_DEFAULT		RAY_MIB_AP_STATUS_TERMINAL

/*
 * mib_ssid
 *
 * DOC		ESSID1	- Service Set ID. Can be any ASCII string
 *			- up to 32 bytes in length. If the string is
 *			- less than 32 bytes long, it must be
 *			- followed by a byte of 00h.
 *
 * Symb			- windows setting comes from the Aviator software v1.1
 */
#define RAY_MIB_SSID_WINDOWS			"NETWORK_NAME"
#define RAY_MIB_SSID_NOT_WINDOWS		"WIRELESS_NETWORK"
#define RAY_MIB_SSID_DEFAULT			RAY_MIB_SSID_WINDOWS

/*
 * mib_scan_mode
 *
 * DOC		0x01	- Defines acquisition approach for
 *			- terminals operating in either Ad Hoc or
 *			- Infrastructure Networks. N/A for APs. 
 */
#define	RAY_MIB_SCAN_MODE_PASSIVE		0x00
#define	RAY_MIB_SCAN_MODE_ACTIVE		0x01
#define	RAY_MIB_SCAN_MODE_DEFAULT		RAY_MIB_SCAN_MODE_ACTIVE

/*
 * mib_apm_mode
 *
 * DOC		0x00	- Defines power management mode for
 *			- stations operating in either Ad Hoc or
 *			- Infrastructure Networks. Must always
 *			- be 0 for APs.
 */
#define	RAY_MIB_APM_MODE_NONE			0x00
#define	RAY_MIB_APM_MODE_POWERSAVE		0x01
#define	RAY_MIB_APM_MODE_DEFAULT		RAY_MIB_APM_MODE_NONE

/*
 * mib_mac_addr
 *
 * DOC			- MAC Address to be used by WIC (For
 *			- format see Figure 3.2.4.1.2-1, MAC
 *			- Address Format). Host may echo card
 *			- supplied address or use locally
 *			- administered address.
 */

/*
 * mib_frag_thresh
 *
 * DOC		0x7fff	- Maximum over-the-air packet size (in
 *			- bytes)
 *
 * Symb		0xXXXX	- you really should fragment when in low signal
 *			- conditions but getting it wrong
 *			  crucifies the performance
 */
#define RAY_MIB_FRAG_THRESH_MINIMUM		0
#define RAY_MIB_FRAG_THRESH_MAXIMUM		2346
#define RAY_MIB_FRAG_THRESH_DISABLE		0x7fff
#define RAY_MIB_FRAG_THRESH_DEFAULT		RAY_MIB_FRAG_THRESH_DISABLE

/*
 * mib_dwell_time
 *
 * DOC		0x0080	- Defines hop dwell time in Kusec.
 *			- Required only of stations which intend
 *			- to issue a Start Network command.
 *			- Forward Compatible Firmware (Build
 *			- 5) requires that the dwell time be one of
 *			- the set 16, 32, 64, 128, and 256.
 *
 * Linux.h		- 16k * 2**n, n=0-4 in Kus
 * Linux.c-V4	0x0200
 * Linux.c-V5	0x0080	- 128 Kus
 * NetBSD-V4	0x0200	- from Linux
 * NetBSD-V4	0x0400	- "divined"
 * NetBSD-V5	0x0080
 * Symb-V4	0xXXXX	- 802.11 dwell time is XXX Kus
 * Symb-V5	0xXXXX	- 802.11 dwell time is XXX Kus
 *
 * XXX confirm that 1024Kus is okay for windows driver - how? and see
 * XXX how it is over the maximum
 */
#define RAY_MIB_DWELL_TIME_MINIMUM		1
#define RAY_MIB_DWELL_TIME_MAXIMUM		390
#define	RAY_MIB_DWELL_TIME_V4			0x0400
#define	RAY_MIB_DWELL_TIME_V5			0x0080

/*
 * mib_beacon_period
 *
 * DOC		0x0100	- Defines time between target beacon
 *			- transmit times (TBTT) in Kusec.
 *			- Forward Compatible Firmware (Build
 *			- 5) requires that the Beacon Period be an
 *			- integral multiple of the Dwell Time (not
 *			- exceeding 255 hops).
 *			- Required only of stations which intend
 *			- to issue a Start Network command.
 *
 * Linux.h		- n * a_hop_time  in Kus
 * Linux.c-V4	0x0001
 * Linux.c-V5	0x0100	- 256 Kus
 * NetBSD-V4	0x0001	- from Linux
 * NetBSD-V4	0x0000	- "divined"
 * NetBSD-V5	0x0100
 * Symb-V4	0x0001	- best performance is one beacon each dwell XXX
 * Symb-V5	0x0080	- best performance is one beacon each dwell XXX
 *
 * XXX V4 should probably set this to dwell_time
 */
#define	RAY_MIB_BEACON_PERIOD_MINIMUM		1
#define	RAY_MIB_BEACON_PERIOD_MAXIMUM		0xffff
#define	RAY_MIB_BEACON_PERIOD_V4		0x0001
#define	RAY_MIB_BEACON_PERIOD_V5		RAY_MIB_DWELL_TIME_V5

/*
 * mib_dtim_interval
 *
 * DOC		0x01	- Number of beacons per DTIM period.
 *			- Only APs will use this parameter, to set
 *			- the DTIM period.
 *
 * Linux.h		- in beacons
 * Linux.c	0x01
 * NetBSD	0x01
 * Symb		0xXX	- need to find out what DTIM is
 */
#define	RAY_MIB_DTIM_INTERVAL_MINIMUM		1
#define	RAY_MIB_DTIM_INTERVAL_MAXIMUM		255
#define	RAY_MIB_DTIM_INTERVAL_DEFAULT		0x01

/*
 * mib_max_retry
 *
 * DOC		31	- Number of times WIC will attempt to
 *			- retransmit a failed packet.
 *
 * Linux.c	0x07
 * NetBSD	0x01	- "documented default for 5/6"
 * NetBSD	0x07	- from Linux
 * NetBSD	0x03	- "divined"
 * Symb		0xXX	- 7 retries seems okay but check with APS
 */
#define	RAY_MIB_MAX_RETRY_MINIMUM		0
#define	RAY_MIB_MAX_RETRY_MAXIMUM		255
#define	RAY_MIB_MAX_RETRY_DEFAULT		0x07

/*
 * mib_ack_timo
 *
 * DOC		0x86	- Time WIC will wait after completion of
 *			- a transmit before timing out anticipated
 *			- ACK (2 usec steps). Should equal
 *			- SIFS + constant.
 *
 * Linux.c	0xa3
 * NetBSD	0x86	- documented default for 5/6
 * NetBSD	0xa3	- from Linux
 * NetBSD	0xa3	- "divined"
 * Symb		0xXX	- this must be a 802.11 defined setting?
 */
#define	RAY_MIB_ACK_TIMO_MINIMUM		0
#define	RAY_MIB_ACK_TIMO_MAXIMUM		255
#define	RAY_MIB_ACK_TIMO_DEFAULT		0xa3

/*
 * mib_sifs
 *
 * DOC		0x1c	- SIFS time in usec.
 *
 * Linux.c	0x1d
 * NetBSD	0x1c	- documented default for 5/6
 * NetBSD	0x1d	- from Linux
 * NetBSD	0x1d	- "divined"
 * Symb		0xXX	- default SIFS for 802.11
 */
#define	RAY_MIB_SIFS_MINIMUM			28
#define	RAY_MIB_SIFS_MAXIMUM			62
#define	RAY_MIB_SIFS_DEFAULT			0x1d

/*
 * mib_difs
 *
 * DOC		0x82	- DIFS time in usec.
 */
#define	RAY_MIB_DIFS_MINIMUM			130
#define	RAY_MIB_DIFS_MAXIMUM			255
#define	RAY_MIB_DIFS_DEFAULT			0x82

/*
 * mib_pifs
 *
 * DOC		78	- PIFS time in usec. (Not currently
 *			- implemented.
 */
#define	RAY_MIB_PIFS_MINIMUM			78
#define	RAY_MIB_PIFS_MAXIMUM			255
#define	RAY_MIB_PIFS_V4				0xce
#define	RAY_MIB_PIFS_V5				0x4e

/*
 * mib_rts_thresh
 *
 * DOC		0x7ffff	- Threshold size in bytes below which
 *			- messages will not require use of RTS
 *			- Protocol.
 *
 * Linux.c	0x7fff
 * NetBSD	0x7fff	- disabled
 * Symb		0xXXXX	- need to set this realistically to get CTS/RTS mode
 *			  working right
 */
#define	RAY_MIB_RTS_THRESH_MINIMUM		0
#define	RAY_MIB_RTS_THRESH_MAXIMUM		2346
#define	RAY_MIB_RTS_THRESH_DISABLE		0x7fff
#define	RAY_MIB_RTS_THRESH_DEFAULT		RAY_MIB_RTS_THRESH_DISABLE

/*
 * mib_scan_dwell
 *
 * DOC		0x04e2	- Time channel remains clear after probe
 *			- transmission prior to hopping to next
 *			- channel. (in 2 msec steps).
 *
 * Linux.c-V4	0xfb1e	- 128572us
 * Linix.c-V5	0x04e2	-   2500us
 * NetBSD-V4	0xfb1e
 * NetBSD-V5	0x04e2
 * Symb		0xXXXX	- Check that v4 h/w can do 2.5ms and default it
 */
#define	RAY_MIB_SCAN_DWELL_MINIMUM		1
#define	RAY_MIB_SCAN_DWELL_MAXIMUM		65535
#define	RAY_MIB_SCAN_DWELL_V4			0xfb1e
#define	RAY_MIB_SCAN_DWELL_V5			0x04e2

/*
 * mib_scan_max_dwell
 *
 * DOC		0x38a4	- Time to remain on a frequency channel
 *			- if CCA is detected after probe
 *			- transmission. (in 2 usec steps).
 *
 * Linux.c-V4	0xc75c	- 102072us
 * Linix.c-V5	0x38a4	-  29000us
 * NetBSD-V4	0xc75c
 * NetBSD-V5	0x38a4
 * Symb		0xXXXX	- see above - this may be total time before giving up
 */
#define	RAY_MIB_SCAN_MAX_DWELL_MINIMUM		1
#define	RAY_MIB_SCAN_MAX_DWELL_MAXIMUM		65535
#define	RAY_MIB_SCAN_MAX_DWELL_V4		0xc75c
#define	RAY_MIB_SCAN_MAX_DWELL_V5		0x38a4

/*
 * mib_assoc_timo
 *
 * DOC		0x05	- Time (in hops) a station waits after
 *			- transmitting an Association Request
 *			- Message before association attempt is
 *			- considered failed. N/A for Ad Hoc
 *			- Networks and for APs in Infrastructure
 */
#define	RAY_MIB_ASSOC_TIMO_MINIMUM		0
#define	RAY_MIB_ASSOC_TIMO_MAXIMUM		255
#define	RAY_MIB_ASSOC_TIMO_DEFAULT		0x05

/*
 * mib_adhoc_scan_cycle
 *
 * DOC		0x08	- Maximum number of times to cycle
 *			- through frequency hopping pattern as
 *			- part of scanning during Ad Hoc
 *			- Acquisition.
 */
#define	RAY_MIB_ADHOC_SCAN_CYCLE_MINIMUM	1
#define	RAY_MIB_ADHOC_SCAN_CYCLE_MAXIMUM	255
#define	RAY_MIB_ADHOC_SCAN_CYCLE_DEFAULT	0x08

/*
 * mib_infra_scan_cycle
 *
 * DOC		0x02	- Number of times to cycle through
 *			- frequency hopping pattern as part of
 *			- scanning during Infrastructure Network
 *			- Acquisition.
 */
#define	RAY_MIB_INFRA_SCAN_CYCLE_MINIMUM	1
#define	RAY_MIB_INFRA_SCAN_CYCLE_MAXIMUM	255
#define	RAY_MIB_INFRA_SCAN_CYCLE_DEFAULT	0x02

/*
 * mib_infra_super_scan_cycle
 *
 * DOC		0x08	- Number of times to repeat an
 *			- Infrastructure scan cycle if no APs are
 *			- found before indicating a failure.
 */
#define	RAY_MIB_INFRA_SUPER_SCAN_CYCLE_MINIMUM	1
#define	RAY_MIB_INFRA_SUPER_SCAN_CYCLE_MAXIMUM	255
#define	RAY_MIB_INFRA_SUPER_SCAN_CYCLE_DEFAULT	0x08

/*
 * mib_promisc
 *
 * DOC		0x00	- Controls operation of WIC in
 *			- promiscuous mode.
 */
#define	RAY_MIB_PROMISC_DISABLED		0
#define	RAY_MIB_PROMISC_ENABLED			1
#define	RAY_MIB_PROMISC_DEFAULT			0x00

/*
 * mib_uniq_word
 *
 * DOC		0x0cdb	- Unique word pattern (Transmitted as
 *			- 0CBDh per 802.11)
 */
#define	RAY_MIB_UNIQ_WORD_MINIMUM		0
#define	RAY_MIB_UNIQ_WORD_MAXIMUM		0xffff
#define	RAY_MIB_UNIQ_WORD_DEFAULT		0x0cbd

/*
 * mib_slot_time
 *
 * DOC		0x32	- Slot time in usec
 *
 * Linux.c-V4	0x4e
 * Linix.c-V5	0x32
 * NetBSD-V4	0x4e	- Linux
 * NetBSD-V4	0x18	- "divined"
 * NetBSD-V5	0x32	- mentions spec. is 50us i.e. 0x32
 * Symb		0xXX	- wtf 0x4e = 78
 */
#define	RAY_MIB_SLOT_TIME_MINIMUM		1
#define	RAY_MIB_SLOT_TIME_MAXIMUM		128
#define	RAY_MIB_SLOT_TIME_V4			0x4e
#define	RAY_MIB_SLOT_TIME_V5			0x32

/*
 * mib_roam_low_snr_thresh
 *
 * DOC		0xff	- SNR Threshold for use by roaming
 *			- algorithm. [Low power count is
 *			- incremented when Beacon is received at
 *			- SNR lower than Roaming Low SNR
 *			- Threshold.] To disable, set to FFh.
 *
 * Linux.c	0xff
 * NetBSD-V4	0xff	- Linux
 * NetBSD-V4	0x30	- "divined"
 * NetBSD-V5	0xff	- disabled
 * NetBSD.h		- if below this inc count
 * Symb		0xXX	- hmm is 0xff really disabled? need this to work
 */
#define	RAY_MIB_ROAM_LOW_SNR_THRESH_MINIMUM	0
#define	RAY_MIB_ROAM_LOW_SNR_THRESH_MAXIMUM	255
#define	RAY_MIB_ROAM_LOW_SNR_THRESH_DISABLED	0xff
#define	RAY_MIB_ROAM_LOW_SNR_THRESH_DEFAULT	RAY_MIB_ROAM_LOW_SNR_THRESH_DISABLED	

/*
 * mib_low_snr_count
 *
 * DOC		0xff	- Threshold that number of consecutive
 *			- beacons received at SNR < Roaming
 *			- Low SNR Threshold must exceed
 *			- before roaming processing begins. To
 *			- disable, set to FFh.
 *
 * Linux.c	0xff
 * NetBSD	0x07	- "divined - check" and marked as disabled
 * NetBSD	0xff	- disabled
 * NetBSD.h		- roam after cnt below thrsh
 * Symb		0xXX	- hmm is 0xff really disabled? need
 *			- this to work in infrastructure mode with mutliple APs
 */
#define	RAY_MIB_LOW_SNR_COUNT_MINIMUM		0
#define	RAY_MIB_LOW_SNR_COUNT_MAXIMUM		255
#define	RAY_MIB_LOW_SNR_COUNT_DISABLED		0xff
#define	RAY_MIB_LOW_SNR_COUNT_DEFAULT		RAY_MIB_LOW_SNR_COUNT_DISABLED

/*
 * mib_infra_missed_beacon_count
 *
 * DOC		0x02	- Threshold that number of consecutive
 *			- beacons not received must exceed
 *			- before roaming processing begins in an
 *			- infrastructure network. To disable, set
 *			- to FFh.
 * Linux.c	0x05
 * NetBSD	0x02	- documented default for 5/6
 * NetBSD	0x05	- Linux
 * NetBSD	0x07	- "divined - check, looks fishy"
 * Symb		0xXX	- 5 missed beacons is probably okay
 */
#define	RAY_MIB_INFRA_MISSED_BEACON_COUNT_MINIMUM	0
#define	RAY_MIB_INFRA_MISSED_BEACON_COUNT_MAXIMUM	255
#define	RAY_MIB_INFRA_MISSED_BEACON_COUNT_DEFAULT	0x05

/*
 * mib_adhoc_missed_beacon_count
 *
 * DOC		0xff	- Threshold that number of consecutive
 *			- beacons transmitted by a terminal must
 *			- exceed before reacquisition processing
 *			- begins in Ad Hoc Network.
 */
#define	RAY_MIB_ADHOC_MISSED_BEACON_COUNT_MINIMUM	0
#define	RAY_MIB_ADHOC_MISSED_BEACON_COUNT_MAXIMUM	255
#define	RAY_MIB_ADHOC_MISSED_BEACON_COUNT_DISABLED	0xff
#define	RAY_MIB_ADHOC_MISSED_BEACON_COUNT_DEFAULT	RAY_MIB_ADHOC_MISSED_BEACON_COUNT_DISABLED

/*
 * mib_country_code
 *
 * DOC		0x01	- Country set of hopping patterns
 *			- (element value in beacon)
 *			- Note: Japan Test is for a special test
 *			- mode required by the Japanese
 *			- regulatory authorities.
 */
#define	RAY_MIB_COUNTRY_CODE_MIMIMUM		0x01
#define	RAY_MIB_COUNTRY_CODE_MAXIMUM		0x09
#define	RAY_MIB_COUNTRY_CODE_USA		0x01
#define	RAY_MIB_COUNTRY_CODE_EUROPE		0x02
#define	RAY_MIB_COUNTRY_CODE_JAPAN		0x03
#define	RAY_MIB_COUNTRY_CODE_KOREA		0x04
#define	RAY_MIB_COUNTRY_CODE_SPAIN		0x05
#define	RAY_MIB_COUNTRY_CODE_FRANCE		0x06
#define	RAY_MIB_COUNTRY_CODE_ISRAEL		0x07
#define	RAY_MIB_COUNTRY_CODE_AUSTRALIA		0x08
#define	RAY_MIB_COUNTRY_CODE_JAPAN_TEST		0x09
#define	RAY_MIB_COUNTRY_CODE_DEFAULT		RAY_MIB_COUNTRY_CODE_USA

/*
 * mib_hop_seq
 *
 * DOC		0x0b	- Hop Pattern to use. (Currently 66
 *			- US/Europe plus 12 Japanese).
 *
 * NetBSD.h		- no longer supported
 */
#define	RAY_MIB_HOP_SEQ_MINIMUM			6
#define	RAY_MIB_HOP_SEQ_MAXIMUM			72
#define	RAY_MIB_HOP_SEQ_DEFAULT			0x0b

/*
 * mib_hop_seq_len
 *
 * DOC		0x4f	- Number of frequency channels in
 *			- hopping pattern is now set to the value
 *			- defined in IEEE802.11 for the selected
 *			- Current Country Code.
 */
#define	RAY_MIB_HOP_SEQ_LEN_MINIMUM		1
#define	RAY_MIB_HOP_SEQ_LEN_MAXIMUM		79
#define	RAY_MIB_HOP_SEQ_LEN_V4			0x4e
#define	RAY_MIB_HOP_SEQ_LEN_V5			0x4f

/* XXX need to update these to the spec. XXX */

/*
 * All from here down are the same in Linux/NetBSD and seem to be sane.
 */
#define	RAY_MIB_CW_MAX_V4			0x3f
#define	RAY_MIB_CW_MAX_V5			0x003f

#define	RAY_MIB_CW_MIN_V4			0x0f
#define	RAY_MIB_CW_MIN_V5			0x000f

/*
 * Symb		0xXX	- these parameters will affect the clear channel
 *			  assesment false triggering
 *
 */
#define	RAY_MIB_NOISE_FILTER_GAIN_DEFAULT	0x04
#define	RAY_MIB_NOISE_LIMIT_OFFSET_DEFAULT	0x08
#define RAY_MIB_RSSI_THRESH_OFFSET_DEFAULT	0x28
#define RAY_MIB_BUSY_THRESH_OFFSET_DEFAULT	0x28
#define RAY_MIB_SYNC_THRESH_DEFAULT		0x07

#define	RAY_MIB_TEST_MODE_NORMAL		0x0
#define	RAY_MIB_TEST_MODE_ANT_1			0x1
#define	RAY_MIB_TEST_MODE_ATN_2			0x2
#define	RAY_MIB_TEST_MODE_ATN_BOTH		0x3
#define RAY_MIB_TEST_MODE_DEFAULT		RAY_MIB_TEST_MODE_NORMAL

#define RAY_MIB_TEST_MIN_CHAN_DEFAULT		0x02
#define RAY_MIB_TEST_MAX_CHAN_DEFAULT		0x02

#define	RAY_MIB_ALLOW_PROBE_RESP_DISALLOW	0x0
#define	RAY_MIB_ALLOW_PROBE_RESP_ALLOW		0x1
#define	RAY_MIB_ALLOW_PROBE_RESP_DEFAULT	RAY_MIB_ALLOW_PROBE_RESP_DISALLOW

#define	RAY_MIB_PRIVACY_MUST_START_NOWEP	0x0
#define	RAY_MIB_PRIVACY_MUST_START_WEP		0x1
#define	RAY_MIB_PRIVACY_MUST_START_DEFAULT	RAY_MIB_PRIVACY_MUST_START_NOWEP

#define	RAY_MIB_PRIVACY_CAN_JOIN_NOWEP		0x0
#define	RAY_MIB_PRIVACY_CAN_JOIN_WEP		0x1
#define	RAY_MIB_PRIVACY_CAN_JOIN_DONT_CARE	0x2
#define	RAY_MIB_PRIVACY_CAN_JOIN_DEFAULT	RAY_MIB_PRIVACY_CAN_JOIN_NOWEP

#define	RAY_MIB_BASIC_RATE_SET_MINIMUM		1
#define	RAY_MIB_BASIC_RATE_SET_MAXIMUM		4
#define	RAY_MIB_BASIC_RATE_SET_500K		1
#define	RAY_MIB_BASIC_RATE_SET_1000K		2
#define	RAY_MIB_BASIC_RATE_SET_1500K		3
#define	RAY_MIB_BASIC_RATE_SET_2000K		4
#define	RAY_MIB_BASIC_RATE_SET_DEFAULT		RAY_MIB_BASIC_RATE_SET_2000K

/*
 * IOCTL support
 */
struct ray_param_req {
	int		r_failcause;
	u_int8_t	r_paramid;
	u_int8_t	r_len;
	u_int8_t	r_data[256];
};
struct ray_stats_req {
	u_int64_t	rxoverflow;	/* Number of rx overflows	*/
	u_int64_t	rxcksum;	/* Number of checksum errors	*/
	u_int64_t	rxhcksum;	/* Number of header checksum errors */
	u_int8_t	rxnoise;	/* Average receiver level	*/
};
#define	RAY_FAILCAUSE_EIDRANGE	1
#define	RAY_FAILCAUSE_ELENGTH	2
/* device can possibly return up to 255 */
#define	RAY_FAILCAUSE_EDEVSTOP	256

/* Get a param the data is a ray_param_req structure */
#define	SIOCSRAYPARAM	SIOCSIFGENERIC
#define	SIOCGRAYPARAM	SIOCGIFGENERIC
/* Get the error counters the data is a ray_stats_req structure */
#define	SIOCGRAYSTATS	_IOWR('i', 201, struct ifreq)
#define SIOCGRAYSIGLEV  _IOWR('i', 202, struct ifreq)

#define RAY_NSIGLEVRECS 8
#define RAY_NSIGLEV 8
#define RAY_NANTENNA 8

struct ray_siglev {
	u_int8_t	rsl_host[ETHER_ADDR_LEN]; /* MAC address */
	u_int8_t	rsl_siglevs[RAY_NSIGLEV]; /* levels, newest in [0] */
	u_int8_t	rsl_antennas[RAY_NANTENNA]; /* best antenna */
	struct timeval	rsl_time; 		  /* time of last packet */
};
OpenPOWER on IntegriCloud