corewlan-sys 0.1.1

FFI Bindings to MacOS's CoreWLAN framework.
Documentation
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
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
/*
 * Many of the bindings and interfaces in this file are autogenerated using
 * [bindgen](https://github.com/rust-lang/rust-bindgen). Only minor modifications were done by hand.
 */

use std::ptr::null;

use objc::{sel, class, msg_send, sel_impl};

#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
pub type instancetype = id;

#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct CWWiFiClient(pub id);
impl std::ops::Deref for CWWiFiClient {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for CWWiFiClient {}
impl CWWiFiClient {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(CWWiFiClient), alloc) })
    }
}

impl ICWWiFiClient for CWWiFiClient {}
pub trait ICWWiFiClient: Sized + std::ops::Deref {
    unsafe fn init(&self) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, init)
    }
    unsafe fn interface(&self) -> CWInterface
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, interface)
    }
    unsafe fn interfaceWithName_(&self, interfaceName: NSString) -> CWInterface
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, interfaceWithName: interfaceName)
    }
    unsafe fn interfaces(&self) -> NSArray
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, interfaces)
    }
    unsafe fn startMonitoringEventWithType_error_(
        &self,
        type_: CWEventType,
        error: *mut NSError,
    ) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , startMonitoringEventWithType : type_ error : error)
    }
    unsafe fn stopMonitoringEventWithType_error_(
        &self,
        type_: CWEventType,
        error: *mut NSError,
    ) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , stopMonitoringEventWithType : type_ error : error)
    }
    unsafe fn stopMonitoringAllEventsAndReturnError_(&self, error: *mut NSError) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, stopMonitoringAllEventsAndReturnError: error)
    }
    unsafe fn delegate(&self) -> id
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, delegate)
    }
    unsafe fn setDelegate_(&self, delegate: id)
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, setDelegate: delegate)
    }
    unsafe fn sharedWiFiClient() -> CWWiFiClient
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(class!(CWWiFiClient), sharedWiFiClient)
    }
    unsafe fn interfaceNames() -> NSArray
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(class!(CWWiFiClient), interfaceNames)
    }
}

#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct CWInterface(pub id);
impl std::ops::Deref for CWInterface {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for CWInterface {}
impl CWInterface {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(CWInterface), alloc) })
    }
}

impl ICWInterface for CWInterface {}
pub trait ICWInterface: Sized + std::ops::Deref {
    unsafe fn powerOn(&self) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, powerOn)
    }
    unsafe fn supportedWLANChannels(&self) -> NSSet
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, supportedWLANChannels)
    }
    unsafe fn wlanChannel(&self) -> CWChannel
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, wlanChannel)
    }
    unsafe fn activePHYMode(&self) -> CWPHYMode
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, activePHYMode)
    }
    unsafe fn ssid(&self) -> NSString
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, ssid)
    }
    unsafe fn ssidData(&self) -> NSData
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, ssidData)
    }
    unsafe fn bssid(&self) -> NSString
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, bssid)
    }
    unsafe fn rssiValue(&self) -> NSInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, rssiValue)
    }
    unsafe fn noiseMeasurement(&self) -> NSInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, noiseMeasurement)
    }
    unsafe fn security(&self) -> CWSecurity
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, security)
    }
    unsafe fn transmitRate(&self) -> f64
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, transmitRate)
    }
    unsafe fn countryCode(&self) -> NSString
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, countryCode)
    }
    unsafe fn interfaceMode(&self) -> CWInterfaceMode
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, interfaceMode)
    }
    unsafe fn transmitPower(&self) -> NSInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, transmitPower)
    }
    unsafe fn hardwareAddress(&self) -> NSString
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, hardwareAddress)
    }
    unsafe fn serviceActive(&self) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, serviceActive)
    }
    unsafe fn cachedScanResults(&self) -> NSSet
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, cachedScanResults)
    }
    unsafe fn configuration(&self) -> CWConfiguration
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, configuration)
    }
    unsafe fn initWithInterfaceName_(&self, name: NSString) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, initWithInterfaceName: name)
    }
    unsafe fn setPower_error_(&self, power: bool, error: *mut NSError) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , setPower : power error : error)
    }
    unsafe fn setWLANChannel_error_(&self, channel: CWChannel, error: *mut NSError) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , setWLANChannel : channel error : error)
    }
    unsafe fn setPairwiseMasterKey_error_(&self, key: NSData, error: *mut NSError) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , setPairwiseMasterKey : key error : error)
    }
    unsafe fn setWEPKey_flags_index_error_(
        &self,
        key: NSData,
        flags: CWCipherKeyFlags,
        index: NSInteger,
        error: *mut NSError,
    ) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , setWEPKey : key flags : flags index : index error : error)
    }
    unsafe fn scanForNetworksWithSSID_error_(&self, ssid: NSData, error: *mut NSError) -> NSSet
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , scanForNetworksWithSSID : ssid error : error)
    }
    unsafe fn scanForNetworksWithSSID_includeHidden_error_(
        &self,
        ssid: NSData,
        includeHidden: bool,
        error: *mut NSError,
    ) -> NSSet
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , scanForNetworksWithSSID : ssid includeHidden : includeHidden error : error)
    }
    unsafe fn scanForNetworksWithName_error_(
        &self,
        networkName: NSString,
        error: *mut NSError,
    ) -> NSSet
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , scanForNetworksWithName : networkName error : error)
    }
    unsafe fn scanForNetworks_error_(
        &self,
        error: *mut NSError,
    ) -> NSSet
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , scanForNetworksWithName : null::<NSString>() error : error)
    }
    unsafe fn scanForNetworksWithName_includeHidden_error_(
        &self,
        networkName: NSString,
        includeHidden: bool,
        error: *mut NSError,
    ) -> NSSet
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , scanForNetworksWithName : networkName includeHidden : includeHidden error : error)
    }
    unsafe fn associateToNetwork_password_error_(
        &self,
        network: CWNetwork,
        password: NSString,
        error: *mut NSError,
    ) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , associateToNetwork : network password : password error : error)
    }
    unsafe fn disassociate(&self)
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, disassociate)
    }
    unsafe fn associateToEnterpriseNetwork_identity_username_password_error_(
        &self,
        network: CWNetwork,
        identity: SecIdentityRef,
        username: NSString,
        password: NSString,
        error: *mut NSError,
    ) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , associateToEnterpriseNetwork : network identity : identity username : username password : password error : error)
    }
    unsafe fn startIBSSModeWithSSID_security_channel_password_error_(
        &self,
        ssidData: NSData,
        security: CWIBSSModeSecurity,
        channel: NSUInteger,
        password: NSString,
        error: *mut NSError,
    ) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , startIBSSModeWithSSID : ssidData security : security channel : channel password : password error : error)
    }
    unsafe fn commitConfiguration_authorization_error_(
        &self,
        configuration: CWConfiguration,
        authorization: SFAuthorization,
        error: *mut NSError,
    ) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , commitConfiguration : configuration authorization : authorization error : error)
    }
    unsafe fn interfaceName(&self) -> NSString
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, interfaceName)
    }
    unsafe fn interfaceNames() -> NSSet
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(class!(CWInterface), interfaceNames)
    }
    unsafe fn interface() -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(class!(CWInterface), interface)
    }
    unsafe fn interfaceWithName_(name: NSString) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(class!(CWInterface), interfaceWithName: name)
    }
}

#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct NSString(pub id);
impl std::ops::Deref for NSString {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for NSString {}
impl NSString {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(NSString), alloc) })
    }
}

pub type NSInteger = std::os::raw::c_long;
pub type NSUInteger = std::os::raw::c_ulong;
pub type Unichar = std::os::raw::c_ushort;

impl INSString for NSString {}
pub trait INSString: Sized + std::ops::Deref {
    unsafe fn characterAtIndex_(&self, index: NSUInteger) -> Unichar
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, characterAtIndex: index)
    }
    unsafe fn init(&self) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, init)
    }
    unsafe fn initWithCoder_(&self, coder: NSCoder) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, initWithCoder: coder)
    }
    unsafe fn length(&self) -> NSUInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, length)
    }
    // TODO: This needs verification to be stable
    unsafe fn stringWithUTF8String(string: *const [u8]) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(class!(NSString), stringWithUTF8String: string)
    } 
    // TODO: might work?
    unsafe fn UTF8String(&self) -> *const std::ffi::c_char
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, UTF8String)
    }
}

#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct NSCoder(pub id);
impl std::ops::Deref for NSCoder {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for NSCoder {}
impl NSCoder {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(NSCoder), alloc) })
    }
}
impl INSCoder for NSCoder {}
pub trait INSCoder: Sized + std::ops::Deref {
    unsafe fn encodeValueOfObjCType_at_(
        &self,
        type_: *const ::std::os::raw::c_char,
        addr: *const ::std::os::raw::c_void,
    ) where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , encodeValueOfObjCType : type_ at : addr)
    }
    unsafe fn encodeDataObject_(&self, data: NSData)
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, encodeDataObject: data)
    }
    unsafe fn decodeDataObject(&self) -> NSData
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, decodeDataObject)
    }
    unsafe fn decodeValueOfObjCType_at_size_(
        &self,
        type_: *const ::std::os::raw::c_char,
        data: *mut ::std::os::raw::c_void,
        size: NSUInteger,
    ) where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , decodeValueOfObjCType : type_ at : data size : size)
    }
    unsafe fn versionForClassName_(&self, className: NSString) -> NSInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, versionForClassName: className)
    }
}

#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct NSData(pub id);
impl std::ops::Deref for NSData {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for NSData {}
impl NSData {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(NSData), alloc) })
    }
}
impl INSData for NSData {}
pub trait INSData: Sized + std::ops::Deref {
    unsafe fn length(&self) -> NSUInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, length)
    }
    unsafe fn bytes(&self) -> *const ::std::os::raw::c_void
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, bytes)
    }
}

pub const CWEventType_CWEventTypeNone: CWEventType = 0;
pub const CWEventType_CWEventTypePowerDidChange: CWEventType = 1;
pub const CWEventType_CWEventTypeSSIDDidChange: CWEventType = 2;
pub const CWEventType_CWEventTypeBSSIDDidChange: CWEventType = 3;
pub const CWEventType_CWEventTypeCountryCodeDidChange: CWEventType = 4;
pub const CWEventType_CWEventTypeLinkDidChange: CWEventType = 5;
pub const CWEventType_CWEventTypeLinkQualityDidChange: CWEventType = 6;
pub const CWEventType_CWEventTypeModeDidChange: CWEventType = 7;
pub const CWEventType_CWEventTypeScanCacheUpdated: CWEventType = 8;
pub const CWEventType_CWEventTypeUnknown: CWEventType = 9223372036854775807;
pub type CWEventType = NSInteger;

#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct NSError(pub id);
impl std::ops::Deref for NSError {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for NSError {}
impl NSError {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(NSError), alloc) })
    }
}

impl INSError for NSError {}
pub trait INSError: Sized + std::ops::Deref {
    unsafe fn initWithDomain_code_userInfo_(
        &self,
        domain: NSString,
        code: NSInteger,
        dict: NSDictionary,
    ) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , initWithDomain : domain code : code userInfo : dict)
    }
    unsafe fn domain(&self) -> NSErrorDomain
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, domain)
    }
    unsafe fn code(&self) -> NSInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, code)
    }
    unsafe fn userInfo(&self) -> NSDictionary
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, userInfo)
    }
    unsafe fn localizedDescription(&self) -> NSString
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, localizedDescription)
    }
    unsafe fn localizedFailureReason(&self) -> NSString
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, localizedFailureReason)
    }
    unsafe fn localizedRecoverySuggestion(&self) -> NSString
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, localizedRecoverySuggestion)
    }
    unsafe fn localizedRecoveryOptions(&self) -> NSArray
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, localizedRecoveryOptions)
    }
    unsafe fn recoveryAttempter(&self) -> id
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, recoveryAttempter)
    }
    unsafe fn helpAnchor(&self) -> NSString
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, helpAnchor)
    }
    unsafe fn underlyingErrors(&self) -> NSArray
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, underlyingErrors)
    }
    unsafe fn errorWithDomain_code_userInfo_(
        domain: NSString,
        code: NSInteger,
        dict: NSDictionary,
    ) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (class ! (NSError) , errorWithDomain : domain code : code userInfo : dict)
    }
    unsafe fn setUserInfoValueProviderForDomain_provider_(
        errorDomain: NSString,
        provider: *mut ::std::os::raw::c_void,
    ) where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (class ! (NSError) , setUserInfoValueProviderForDomain : errorDomain provider : provider)
    }
    unsafe fn userInfoValueProviderForDomain_(errorDomain: NSString) -> *mut ::std::os::raw::c_void
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(class!(NSError), userInfoValueProviderForDomain: errorDomain)
    }
}

#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct NSArray(pub id);
impl std::ops::Deref for NSArray {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for NSArray {}
impl NSArray {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(NSArray), alloc) })
    }
}
impl<ObjectType: 'static> INSArray<ObjectType> for NSArray {}
pub trait INSArray<ObjectType: 'static>: Sized + std::ops::Deref {
    unsafe fn objectAtIndex_(&self, index: NSUInteger) -> id
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, objectAtIndex: index)
    }
    unsafe fn init(&self) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, init)
    }
    unsafe fn initWithObjects_count_(
        &self,
        objects: *const *mut u64,
        cnt: NSUInteger,
    ) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , initWithObjects : objects count : cnt)
    }
    unsafe fn initWithCoder_(&self, coder: NSCoder) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, initWithCoder: coder)
    }
    unsafe fn count(&self) -> NSUInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, count)
    }
}

#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct NSDictionary(pub id);
impl std::ops::Deref for NSDictionary {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for NSDictionary {}
impl NSDictionary {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(NSDictionary), alloc) })
    }
}
impl<KeyType: 'static, ObjectType: 'static> INSDictionary<KeyType, ObjectType> for NSDictionary {}
pub trait INSDictionary<KeyType: 'static, ObjectType: 'static>: Sized + std::ops::Deref {
    unsafe fn objectForKey_(&self, aKey: id) -> id
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, objectForKey: aKey)
    }
    unsafe fn keyEnumerator(&self) -> NSEnumerator
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, keyEnumerator)
    }
    unsafe fn init(&self) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, init)
    }
    unsafe fn initWithObjects_forKeys_count_(
        &self,
        objects: *const *mut u64,
        keys: *const *mut u64,
        cnt: NSUInteger,
    ) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , initWithObjects : objects forKeys : keys count : cnt)
    }
    unsafe fn initWithCoder_(&self, coder: NSCoder) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, initWithCoder: coder)
    }
    unsafe fn count(&self) -> NSUInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, count)
    }
}

#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct NSSet(pub id);
impl std::ops::Deref for NSSet {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for NSSet {}
impl NSSet {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(NSSet), alloc) })
    }
}

impl<ObjectType: 'static> INSSet<ObjectType> for NSSet {}
pub trait INSSet<ObjectType: 'static>: Sized + std::ops::Deref {
    unsafe fn member_(&self, object: id) -> id
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, member: object)
    }
    unsafe fn allObjects(&self) -> NSArray
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, allObjects)
    }
    unsafe fn objectEnumerator(&self) -> NSEnumerator
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, objectEnumerator)
    }
    unsafe fn init(&self) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, init)
    }
    unsafe fn initWithObjects_count_(
        &self,
        objects: *const *mut u64,
        cnt: NSUInteger,
    ) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , initWithObjects : objects count : cnt)
    }
    unsafe fn initWithCoder_(&self, coder: NSCoder) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, initWithCoder: coder)
    }
    unsafe fn count(&self) -> NSUInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, count)
    }
}

#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct NSEnumerator(pub id);
impl std::ops::Deref for NSEnumerator {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for NSEnumerator {}
impl NSEnumerator {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(NSEnumerator), alloc) })
    }
}
impl<ObjectType: 'static> INSEnumerator<ObjectType> for NSEnumerator {}
pub trait INSEnumerator<ObjectType: 'static>: Sized + std::ops::Deref {
    unsafe fn nextObject(&self) -> id
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, nextObject)
    }
}

pub type NSErrorDomain = NSString;

#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct CWChannel(pub id);
impl std::ops::Deref for CWChannel {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for CWChannel {}
impl CWChannel {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(CWChannel), alloc) })
    }
}
impl ICWChannel for CWChannel {}
pub trait ICWChannel: Sized + std::ops::Deref {
    unsafe fn isEqualToChannel_(&self, channel: CWChannel) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, isEqualToChannel: channel)
    }
    unsafe fn channelNumber(&self) -> NSInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, channelNumber)
    }
    unsafe fn channelWidth(&self) -> CWChannelWidth
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, channelWidth)
    }
    unsafe fn channelBand(&self) -> CWChannelBand
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, channelBand)
    }
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct CWConfiguration(pub id);
impl std::ops::Deref for CWConfiguration {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for CWConfiguration {}
impl CWConfiguration {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(CWConfiguration), alloc) })
    }
}
impl ICWConfiguration for CWConfiguration {}
pub trait ICWConfiguration: Sized + std::ops::Deref {
    unsafe fn init(&self) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, init)
    }
    unsafe fn initWithConfiguration_(&self, configuration: CWConfiguration) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, initWithConfiguration: configuration)
    }
    unsafe fn isEqualToConfiguration_(&self, configuration: CWConfiguration) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, isEqualToConfiguration: configuration)
    }
    unsafe fn networkProfiles(&self) -> NSOrderedSet
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, networkProfiles)
    }
    unsafe fn requireAdministratorForAssociation(&self) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, requireAdministratorForAssociation)
    }
    unsafe fn requireAdministratorForPower(&self) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, requireAdministratorForPower)
    }
    unsafe fn requireAdministratorForIBSSMode(&self) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, requireAdministratorForIBSSMode)
    }
    unsafe fn rememberJoinedNetworks(&self) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, rememberJoinedNetworks)
    }
    unsafe fn configuration() -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(class!(CWConfiguration), configuration)
    }
    unsafe fn configurationWithConfiguration_(configuration: CWConfiguration) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(
            class!(CWConfiguration),
            configurationWithConfiguration: configuration
        )
    }
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct NSOrderedSet(pub id);
impl std::ops::Deref for NSOrderedSet {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for NSOrderedSet {}
impl NSOrderedSet {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(NSOrderedSet), alloc) })
    }
}
impl<ObjectType: 'static> INSOrderedSet<ObjectType> for NSOrderedSet {}
pub trait INSOrderedSet<ObjectType: 'static>: Sized + std::ops::Deref {
    unsafe fn objectAtIndex_(&self, idx: NSUInteger) -> id
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, objectAtIndex: idx)
    }
    unsafe fn indexOfObject_(&self, object: id) -> NSUInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, indexOfObject: object)
    }
    unsafe fn init(&self) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, init)
    }
    unsafe fn initWithObjects_count_(
        &self,
        objects: *const *mut u64,
        cnt: NSUInteger,
    ) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send ! (* self , initWithObjects : objects count : cnt)
    }
    unsafe fn initWithCoder_(&self, coder: NSCoder) -> instancetype
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, initWithCoder: coder)
    }
    unsafe fn count(&self) -> NSUInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, count)
    }
}

#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct CWNetwork(pub id);
impl std::ops::Deref for CWNetwork {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for CWNetwork {}
impl CWNetwork {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(CWNetwork), alloc) })
    }
}
impl ICWNetwork for CWNetwork {}
pub trait ICWNetwork: Sized + std::ops::Deref {
    unsafe fn isEqualToNetwork_(&self, network: CWNetwork) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, isEqualToNetwork: network)
    }
    unsafe fn supportsSecurity_(&self, security: CWSecurity) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, supportsSecurity: security)
    }
    unsafe fn supportsPHYMode_(&self, phyMode: CWPHYMode) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, supportsPHYMode: phyMode)
    }
    unsafe fn ssid(&self) -> NSString
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, ssid)
    }
    unsafe fn ssidData(&self) -> NSData
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, ssidData)
    }
    unsafe fn bssid(&self) -> NSString
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, bssid)
    }
    unsafe fn wlanChannel(&self) -> CWChannel
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, wlanChannel)
    }
    unsafe fn rssiValue(&self) -> NSInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, rssiValue)
    }
    unsafe fn noiseMeasurement(&self) -> NSInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, noiseMeasurement)
    }
    unsafe fn informationElementData(&self) -> NSData
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, informationElementData)
    }
    unsafe fn countryCode(&self) -> NSString
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, countryCode)
    }
    unsafe fn beaconInterval(&self) -> NSInteger
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, beaconInterval)
    }
    unsafe fn ibss(&self) -> bool
    where
        <Self as std::ops::Deref>::Target: objc::Message + Sized,
    {
        msg_send!(*self, ibss)
    }
}

#[repr(transparent)]
#[derive(Debug, Copy, Clone)]
pub struct SFAuthorization(pub id);
impl std::ops::Deref for SFAuthorization {
    type Target = objc::runtime::Object;
    fn deref(&self) -> &Self::Target {
        unsafe { &*self.0 }
    }
}
unsafe impl objc::Message for SFAuthorization {}
impl SFAuthorization {
    pub fn alloc() -> Self {
        Self(unsafe { msg_send!(class!(SFAuthorization), alloc) })
    }
}
impl ISFAuthorization for SFAuthorization {}
pub trait ISFAuthorization: Sized + std::ops::Deref {}

pub type CWChannelWidth = NSInteger;
pub type CWChannelBand = NSInteger;
pub type CWPHYMode = NSInteger;
pub type CWSecurity = NSInteger;
pub const CWInterfaceMode_kCWInterfaceModeNone: CWInterfaceMode = 0;
pub const CWInterfaceMode_kCWInterfaceModeStation: CWInterfaceMode = 1;
pub const CWInterfaceMode_kCWInterfaceModeIBSS: CWInterfaceMode = 2;
pub const CWInterfaceMode_kCWInterfaceModeHostAP: CWInterfaceMode = 3;
pub type CWInterfaceMode = NSInteger;
pub const CWCipherKeyFlags_kCWCipherKeyFlagsNone: CWCipherKeyFlags = 0;
pub const CWCipherKeyFlags_kCWCipherKeyFlagsUnicast: CWCipherKeyFlags = 2;
pub const CWCipherKeyFlags_kCWCipherKeyFlagsMulticast: CWCipherKeyFlags = 4;
pub const CWCipherKeyFlags_kCWCipherKeyFlagsTx: CWCipherKeyFlags = 8;
pub const CWCipherKeyFlags_kCWCipherKeyFlagsRx: CWCipherKeyFlags = 16;
pub type CWCipherKeyFlags = NSUInteger;
pub const CWIBSSModeSecurity_kCWIBSSModeSecurityNone: CWIBSSModeSecurity = 0;
pub const CWIBSSModeSecurity_kCWIBSSModeSecurityWEP40: CWIBSSModeSecurity = 1;
pub const CWIBSSModeSecurity_kCWIBSSModeSecurityWEP104: CWIBSSModeSecurity = 2;
pub type CWIBSSModeSecurity = NSInteger;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __SecIdentity {
    _unused: [u8; 0],
}
pub type SecIdentityRef = *mut __SecIdentity;