call-signaling.pb.swift 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. import Foundation
  21. import SwiftProtobuf
  22. // If the compiler emits an error on this type, it is because this file
  23. // was generated by a version of the `protoc` Swift plug-in that is
  24. // incompatible with the version of SwiftProtobuf to which you are linking.
  25. // Please ensure that you are building against the same version of the API
  26. // that was used to generate this file.
  27. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  28. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  29. typealias Version = _2
  30. }
  31. /// Root signaling message
  32. struct Callsignaling_Envelope {
  33. // SwiftProtobuf.Message conformance is added in an extension below. See the
  34. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  35. // methods supported on all messages.
  36. /// Random amount of padding (0-255 bytes), ignored by the receiver
  37. var padding: Data = SwiftProtobuf.Internal.emptyData
  38. var content: Callsignaling_Envelope.OneOf_Content? = nil
  39. var videoQualityProfile: Callsignaling_VideoQualityProfile {
  40. get {
  41. if case .videoQualityProfile(let v)? = content {return v}
  42. return Callsignaling_VideoQualityProfile()
  43. }
  44. set {content = .videoQualityProfile(newValue)}
  45. }
  46. var captureStateChange: Callsignaling_CaptureState {
  47. get {
  48. if case .captureStateChange(let v)? = content {return v}
  49. return Callsignaling_CaptureState()
  50. }
  51. set {content = .captureStateChange(newValue)}
  52. }
  53. var unknownFields = SwiftProtobuf.UnknownStorage()
  54. enum OneOf_Content: Equatable {
  55. case videoQualityProfile(Callsignaling_VideoQualityProfile)
  56. case captureStateChange(Callsignaling_CaptureState)
  57. #if !swift(>=4.1)
  58. static func ==(lhs: Callsignaling_Envelope.OneOf_Content, rhs: Callsignaling_Envelope.OneOf_Content) -> Bool {
  59. switch (lhs, rhs) {
  60. case (.videoQualityProfile(let l), .videoQualityProfile(let r)): return l == r
  61. case (.captureStateChange(let l), .captureStateChange(let r)): return l == r
  62. default: return false
  63. }
  64. }
  65. #endif
  66. }
  67. init() {}
  68. }
  69. /// Generic 2D resolution
  70. struct Callsignaling_Resolution {
  71. // SwiftProtobuf.Message conformance is added in an extension below. See the
  72. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  73. // methods supported on all messages.
  74. var width: UInt32 = 0
  75. var height: UInt32 = 0
  76. var unknownFields = SwiftProtobuf.UnknownStorage()
  77. init() {}
  78. }
  79. /// The app switched to a new video quality profile
  80. ///
  81. /// In order to be forwards-compatible, the raw configuration of the profile
  82. /// (bitrate, resolution, etc) should also be included in this message. This
  83. /// way, if an unknown enum value is received, the receiver can simply use the
  84. /// raw values instead.
  85. struct Callsignaling_VideoQualityProfile {
  86. // SwiftProtobuf.Message conformance is added in an extension below. See the
  87. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  88. // methods supported on all messages.
  89. var profile: Callsignaling_VideoQualityProfile.QualityProfile = .max
  90. /// The max bitrate in kbps
  91. var maxBitrateKbps: UInt32 = 0
  92. /// The max resolution (in landscape orientation)
  93. var maxResolution: Callsignaling_Resolution {
  94. get {return _maxResolution ?? Callsignaling_Resolution()}
  95. set {_maxResolution = newValue}
  96. }
  97. /// Returns true if `maxResolution` has been explicitly set.
  98. var hasMaxResolution: Bool {return self._maxResolution != nil}
  99. /// Clears the value of `maxResolution`. Subsequent reads from it will return its default value.
  100. mutating func clearMaxResolution() {self._maxResolution = nil}
  101. /// The max framerate
  102. var maxFps: UInt32 = 0
  103. var unknownFields = SwiftProtobuf.UnknownStorage()
  104. /// The quality profile
  105. enum QualityProfile: SwiftProtobuf.Enum {
  106. typealias RawValue = Int
  107. /// Very high quality, used only when explicitly selected by the user
  108. case max // = 0
  109. /// High quality, used by default in non-metered networks
  110. case high // = 1
  111. /// Low quality, optimize for bandwidth, used by default in metered networks
  112. case low // = 2
  113. case UNRECOGNIZED(Int)
  114. init() {
  115. self = .max
  116. }
  117. init?(rawValue: Int) {
  118. switch rawValue {
  119. case 0: self = .max
  120. case 1: self = .high
  121. case 2: self = .low
  122. default: self = .UNRECOGNIZED(rawValue)
  123. }
  124. }
  125. var rawValue: Int {
  126. switch self {
  127. case .max: return 0
  128. case .high: return 1
  129. case .low: return 2
  130. case .UNRECOGNIZED(let i): return i
  131. }
  132. }
  133. }
  134. init() {}
  135. fileprivate var _maxResolution: Callsignaling_Resolution? = nil
  136. }
  137. #if swift(>=4.2)
  138. extension Callsignaling_VideoQualityProfile.QualityProfile: CaseIterable {
  139. // The compiler won't synthesize support with the UNRECOGNIZED case.
  140. static var allCases: [Callsignaling_VideoQualityProfile.QualityProfile] = [
  141. .max,
  142. .high,
  143. .low,
  144. ]
  145. }
  146. #endif // swift(>=4.2)
  147. /// Signal changes in the capturing state (e.g. video camera enabled or disabled)
  148. struct Callsignaling_CaptureState {
  149. // SwiftProtobuf.Message conformance is added in an extension below. See the
  150. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  151. // methods supported on all messages.
  152. var state: Callsignaling_CaptureState.Mode = .off
  153. var device: Callsignaling_CaptureState.CaptureDevice = .camera
  154. var unknownFields = SwiftProtobuf.UnknownStorage()
  155. /// The capture state of a capturing device
  156. enum Mode: SwiftProtobuf.Enum {
  157. typealias RawValue = Int
  158. /// Off, not sending any data
  159. case off // = 0
  160. /// On, sending data
  161. case on // = 1
  162. case UNRECOGNIZED(Int)
  163. init() {
  164. self = .off
  165. }
  166. init?(rawValue: Int) {
  167. switch rawValue {
  168. case 0: self = .off
  169. case 1: self = .on
  170. default: self = .UNRECOGNIZED(rawValue)
  171. }
  172. }
  173. var rawValue: Int {
  174. switch self {
  175. case .off: return 0
  176. case .on: return 1
  177. case .UNRECOGNIZED(let i): return i
  178. }
  179. }
  180. }
  181. /// The capture device type
  182. enum CaptureDevice: SwiftProtobuf.Enum {
  183. typealias RawValue = Int
  184. /// Capturing from a camera
  185. case camera // = 0
  186. /// Capturing from screen sharing
  187. case screenSharing // = 1
  188. /// Capturing from a microphone
  189. case microphone // = 2
  190. case UNRECOGNIZED(Int)
  191. init() {
  192. self = .camera
  193. }
  194. init?(rawValue: Int) {
  195. switch rawValue {
  196. case 0: self = .camera
  197. case 1: self = .screenSharing
  198. case 2: self = .microphone
  199. default: self = .UNRECOGNIZED(rawValue)
  200. }
  201. }
  202. var rawValue: Int {
  203. switch self {
  204. case .camera: return 0
  205. case .screenSharing: return 1
  206. case .microphone: return 2
  207. case .UNRECOGNIZED(let i): return i
  208. }
  209. }
  210. }
  211. init() {}
  212. }
  213. #if swift(>=4.2)
  214. extension Callsignaling_CaptureState.Mode: CaseIterable {
  215. // The compiler won't synthesize support with the UNRECOGNIZED case.
  216. static var allCases: [Callsignaling_CaptureState.Mode] = [
  217. .off,
  218. .on,
  219. ]
  220. }
  221. extension Callsignaling_CaptureState.CaptureDevice: CaseIterable {
  222. // The compiler won't synthesize support with the UNRECOGNIZED case.
  223. static var allCases: [Callsignaling_CaptureState.CaptureDevice] = [
  224. .camera,
  225. .screenSharing,
  226. .microphone,
  227. ]
  228. }
  229. #endif // swift(>=4.2)
  230. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  231. fileprivate let _protobuf_package = "callsignaling"
  232. extension Callsignaling_Envelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  233. static let protoMessageName: String = _protobuf_package + ".Envelope"
  234. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  235. 1: .same(proto: "padding"),
  236. 2: .standard(proto: "video_quality_profile"),
  237. 3: .standard(proto: "capture_state_change"),
  238. ]
  239. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  240. while let fieldNumber = try decoder.nextFieldNumber() {
  241. switch fieldNumber {
  242. case 1: try decoder.decodeSingularBytesField(value: &self.padding)
  243. case 2:
  244. var v: Callsignaling_VideoQualityProfile?
  245. if let current = self.content {
  246. try decoder.handleConflictingOneOf()
  247. if case .videoQualityProfile(let m) = current {v = m}
  248. }
  249. try decoder.decodeSingularMessageField(value: &v)
  250. if let v = v {self.content = .videoQualityProfile(v)}
  251. case 3:
  252. var v: Callsignaling_CaptureState?
  253. if let current = self.content {
  254. try decoder.handleConflictingOneOf()
  255. if case .captureStateChange(let m) = current {v = m}
  256. }
  257. try decoder.decodeSingularMessageField(value: &v)
  258. if let v = v {self.content = .captureStateChange(v)}
  259. default: break
  260. }
  261. }
  262. }
  263. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  264. if !self.padding.isEmpty {
  265. try visitor.visitSingularBytesField(value: self.padding, fieldNumber: 1)
  266. }
  267. switch self.content {
  268. case .videoQualityProfile(let v)?:
  269. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  270. case .captureStateChange(let v)?:
  271. try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
  272. case nil: break
  273. }
  274. try unknownFields.traverse(visitor: &visitor)
  275. }
  276. static func ==(lhs: Callsignaling_Envelope, rhs: Callsignaling_Envelope) -> Bool {
  277. if lhs.padding != rhs.padding {return false}
  278. if lhs.content != rhs.content {return false}
  279. if lhs.unknownFields != rhs.unknownFields {return false}
  280. return true
  281. }
  282. }
  283. extension Callsignaling_Resolution: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  284. static let protoMessageName: String = _protobuf_package + ".Resolution"
  285. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  286. 1: .same(proto: "width"),
  287. 2: .same(proto: "height"),
  288. ]
  289. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  290. while let fieldNumber = try decoder.nextFieldNumber() {
  291. switch fieldNumber {
  292. case 1: try decoder.decodeSingularUInt32Field(value: &self.width)
  293. case 2: try decoder.decodeSingularUInt32Field(value: &self.height)
  294. default: break
  295. }
  296. }
  297. }
  298. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  299. if self.width != 0 {
  300. try visitor.visitSingularUInt32Field(value: self.width, fieldNumber: 1)
  301. }
  302. if self.height != 0 {
  303. try visitor.visitSingularUInt32Field(value: self.height, fieldNumber: 2)
  304. }
  305. try unknownFields.traverse(visitor: &visitor)
  306. }
  307. static func ==(lhs: Callsignaling_Resolution, rhs: Callsignaling_Resolution) -> Bool {
  308. if lhs.width != rhs.width {return false}
  309. if lhs.height != rhs.height {return false}
  310. if lhs.unknownFields != rhs.unknownFields {return false}
  311. return true
  312. }
  313. }
  314. extension Callsignaling_VideoQualityProfile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  315. static let protoMessageName: String = _protobuf_package + ".VideoQualityProfile"
  316. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  317. 1: .same(proto: "profile"),
  318. 2: .standard(proto: "max_bitrate_kbps"),
  319. 3: .standard(proto: "max_resolution"),
  320. 4: .standard(proto: "max_fps"),
  321. ]
  322. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  323. while let fieldNumber = try decoder.nextFieldNumber() {
  324. switch fieldNumber {
  325. case 1: try decoder.decodeSingularEnumField(value: &self.profile)
  326. case 2: try decoder.decodeSingularUInt32Field(value: &self.maxBitrateKbps)
  327. case 3: try decoder.decodeSingularMessageField(value: &self._maxResolution)
  328. case 4: try decoder.decodeSingularUInt32Field(value: &self.maxFps)
  329. default: break
  330. }
  331. }
  332. }
  333. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  334. if self.profile != .max {
  335. try visitor.visitSingularEnumField(value: self.profile, fieldNumber: 1)
  336. }
  337. if self.maxBitrateKbps != 0 {
  338. try visitor.visitSingularUInt32Field(value: self.maxBitrateKbps, fieldNumber: 2)
  339. }
  340. if let v = self._maxResolution {
  341. try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
  342. }
  343. if self.maxFps != 0 {
  344. try visitor.visitSingularUInt32Field(value: self.maxFps, fieldNumber: 4)
  345. }
  346. try unknownFields.traverse(visitor: &visitor)
  347. }
  348. static func ==(lhs: Callsignaling_VideoQualityProfile, rhs: Callsignaling_VideoQualityProfile) -> Bool {
  349. if lhs.profile != rhs.profile {return false}
  350. if lhs.maxBitrateKbps != rhs.maxBitrateKbps {return false}
  351. if lhs._maxResolution != rhs._maxResolution {return false}
  352. if lhs.maxFps != rhs.maxFps {return false}
  353. if lhs.unknownFields != rhs.unknownFields {return false}
  354. return true
  355. }
  356. }
  357. extension Callsignaling_VideoQualityProfile.QualityProfile: SwiftProtobuf._ProtoNameProviding {
  358. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  359. 0: .same(proto: "MAX"),
  360. 1: .same(proto: "HIGH"),
  361. 2: .same(proto: "LOW"),
  362. ]
  363. }
  364. extension Callsignaling_CaptureState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  365. static let protoMessageName: String = _protobuf_package + ".CaptureState"
  366. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  367. 1: .same(proto: "state"),
  368. 2: .same(proto: "device"),
  369. ]
  370. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  371. while let fieldNumber = try decoder.nextFieldNumber() {
  372. switch fieldNumber {
  373. case 1: try decoder.decodeSingularEnumField(value: &self.state)
  374. case 2: try decoder.decodeSingularEnumField(value: &self.device)
  375. default: break
  376. }
  377. }
  378. }
  379. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  380. if self.state != .off {
  381. try visitor.visitSingularEnumField(value: self.state, fieldNumber: 1)
  382. }
  383. if self.device != .camera {
  384. try visitor.visitSingularEnumField(value: self.device, fieldNumber: 2)
  385. }
  386. try unknownFields.traverse(visitor: &visitor)
  387. }
  388. static func ==(lhs: Callsignaling_CaptureState, rhs: Callsignaling_CaptureState) -> Bool {
  389. if lhs.state != rhs.state {return false}
  390. if lhs.device != rhs.device {return false}
  391. if lhs.unknownFields != rhs.unknownFields {return false}
  392. return true
  393. }
  394. }
  395. extension Callsignaling_CaptureState.Mode: SwiftProtobuf._ProtoNameProviding {
  396. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  397. 0: .same(proto: "OFF"),
  398. 1: .same(proto: "ON"),
  399. ]
  400. }
  401. extension Callsignaling_CaptureState.CaptureDevice: SwiftProtobuf._ProtoNameProviding {
  402. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  403. 0: .same(proto: "CAMERA"),
  404. 1: .same(proto: "SCREEN_SHARING"),
  405. 2: .same(proto: "MICROPHONE"),
  406. ]
  407. }