-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathType.swift
30 lines (26 loc) · 1014 Bytes
/
Type.swift
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
//
// Type.swift
// SocketSwift
//
// Created by Orkhan Alikhanov on 7/7/17.
// Copyright © 2017 BiAtoms. All rights reserved.
//
import Foundation //Darwin or Glibc
#if os(Linux)
private let SOCK_STREAM = Int32(Glibc.SOCK_STREAM.rawValue)
private let SOCK_DGRAM = Int32(Glibc.SOCK_DGRAM.rawValue)
private let SOCK_RAW = Int32( Glibc.SOCK_RAW.rawValue)
private let SOCK_RDM = Int32(Glibc.SOCK_RDM.rawValue)
private let SOCK_SEQPACKET = Int32(Glibc.SOCK_SEQPACKET.rawValue)
#endif
extension Socket {
public struct `Type`: RawRepresentable {
public let rawValue: Int32
public init(rawValue: Int32) { self.rawValue = rawValue }
public static let stream = Type(rawValue: SOCK_STREAM)
public static let datagram = Type(rawValue: SOCK_DGRAM)
public static let raw = Type(rawValue: SOCK_RAW)
public static let reliablyDeliveredMessage = Type(rawValue: SOCK_RDM)
public static let sequencedPacketStream = Type(rawValue: SOCK_SEQPACKET)
}
}