// DO NOT EDIT. // swift-format-ignore-file // // Generated by the Swift generator plugin for the protocol buffer compiler. // Source: mqtt.proto // // For information on using the generated types, please see the documentation: // https://github.com/apple/swift-protobuf/ import Foundation import SwiftProtobuf // If the compiler emits an error on this type, it is because this file // was generated by a version of the `protoc` Swift plug-in that is // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } /// /// This message wraps a MeshPacket with extra metadata about the sender and how it arrived. struct ServiceEnvelope { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// /// The (probably encrypted) packet var packet: MeshPacket { get {return _packet ?? MeshPacket()} set {_packet = newValue} } /// Returns true if `packet` has been explicitly set. var hasPacket: Bool {return self._packet != nil} /// Clears the value of `packet`. Subsequent reads from it will return its default value. mutating func clearPacket() {self._packet = nil} /// /// The global channel ID it was sent on var channelID: String = String() /// /// The sending gateway node ID. Can we use this to authenticate/prevent fake /// nodeid impersonation for senders? - i.e. use gateway/mesh id (which is authenticated) + local node id as /// the globally trusted nodenum var gatewayID: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} fileprivate var _packet: MeshPacket? = nil } #if swift(>=5.5) && canImport(_Concurrency) extension ServiceEnvelope: @unchecked Sendable {} #endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. extension ServiceEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = "ServiceEnvelope" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "packet"), 2: .standard(proto: "channel_id"), 3: .standard(proto: "gateway_id"), ] mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularMessageField(value: &self._packet) }() case 2: try { try decoder.decodeSingularStringField(value: &self.channelID) }() case 3: try { try decoder.decodeSingularStringField(value: &self.gatewayID) }() default: break } } } func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 try { if let v = self._packet { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) } }() if !self.channelID.isEmpty { try visitor.visitSingularStringField(value: self.channelID, fieldNumber: 2) } if !self.gatewayID.isEmpty { try visitor.visitSingularStringField(value: self.gatewayID, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: ServiceEnvelope, rhs: ServiceEnvelope) -> Bool { if lhs._packet != rhs._packet {return false} if lhs.channelID != rhs.channelID {return false} if lhs.gatewayID != rhs.gatewayID {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } }