blob: 83603f8799682048e827836453d46d6a645e92fa [file] [log] [blame]
Chris Simpsona9b6c702018-04-08 07:11:37 -04001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20
21import Foundation
22import CoreFoundation
23
24#if os(Linux)
25/// Extensions for Linux for incomplete Foundation API's.
26/// swift-corelibs-foundation is not yet 1:1 with OSX/iOS Foundation
Chris Simpsona9b6c702018-04-08 07:11:37 -040027
28extension UInt {
29 public static func &(lhs: UInt, rhs: Int) -> UInt {
30 let cast = unsafeBitCast(rhs, to: UInt.self)
31 return lhs & cast
32 }
33}
34
35#else
36extension CFStreamPropertyKey {
37 static let shouldCloseNativeSocket = CFStreamPropertyKey(kCFStreamPropertyShouldCloseNativeSocket)
38 // Exists as Stream.PropertyKey.socketSecuritylevelKey but doesn't work with CFReadStreamSetProperty
39 static let socketSecurityLevel = CFStreamPropertyKey(kCFStreamPropertySocketSecurityLevel)
40 static let SSLSettings = CFStreamPropertyKey(kCFStreamPropertySSLSettings)
41}
42#endif