// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: stream_out/chromecast/cast_channel.proto

#include "stream_out/chromecast/cast_channel.pb.h"

#include <algorithm>

#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>

PROTOBUF_PRAGMA_INIT_SEG

namespace _pb = ::PROTOBUF_NAMESPACE_ID;
namespace _pbi = _pb::internal;

namespace castchannel {
PROTOBUF_CONSTEXPR CastMessage::CastMessage(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_._has_bits_)*/{}
  , /*decltype(_impl_._cached_size_)*/{}
  , /*decltype(_impl_.source_id_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.destination_id_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.namespace__)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.payload_utf8_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.payload_binary_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.protocol_version_)*/0
  , /*decltype(_impl_.payload_type_)*/0} {}
struct CastMessageDefaultTypeInternal {
  PROTOBUF_CONSTEXPR CastMessageDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~CastMessageDefaultTypeInternal() {}
  union {
    CastMessage _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 CastMessageDefaultTypeInternal _CastMessage_default_instance_;
PROTOBUF_CONSTEXPR AuthChallenge::AuthChallenge(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_._cached_size_)*/{}} {}
struct AuthChallengeDefaultTypeInternal {
  PROTOBUF_CONSTEXPR AuthChallengeDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~AuthChallengeDefaultTypeInternal() {}
  union {
    AuthChallenge _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 AuthChallengeDefaultTypeInternal _AuthChallenge_default_instance_;
PROTOBUF_CONSTEXPR AuthResponse::AuthResponse(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_._has_bits_)*/{}
  , /*decltype(_impl_._cached_size_)*/{}
  , /*decltype(_impl_.signature_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.client_auth_certificate_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}} {}
struct AuthResponseDefaultTypeInternal {
  PROTOBUF_CONSTEXPR AuthResponseDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~AuthResponseDefaultTypeInternal() {}
  union {
    AuthResponse _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 AuthResponseDefaultTypeInternal _AuthResponse_default_instance_;
PROTOBUF_CONSTEXPR AuthError::AuthError(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_._has_bits_)*/{}
  , /*decltype(_impl_._cached_size_)*/{}
  , /*decltype(_impl_.error_type_)*/0} {}
struct AuthErrorDefaultTypeInternal {
  PROTOBUF_CONSTEXPR AuthErrorDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~AuthErrorDefaultTypeInternal() {}
  union {
    AuthError _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 AuthErrorDefaultTypeInternal _AuthError_default_instance_;
PROTOBUF_CONSTEXPR DeviceAuthMessage::DeviceAuthMessage(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_._has_bits_)*/{}
  , /*decltype(_impl_._cached_size_)*/{}
  , /*decltype(_impl_.challenge_)*/nullptr
  , /*decltype(_impl_.response_)*/nullptr
  , /*decltype(_impl_.error_)*/nullptr} {}
struct DeviceAuthMessageDefaultTypeInternal {
  PROTOBUF_CONSTEXPR DeviceAuthMessageDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~DeviceAuthMessageDefaultTypeInternal() {}
  union {
    DeviceAuthMessage _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 DeviceAuthMessageDefaultTypeInternal _DeviceAuthMessage_default_instance_;
}  // namespace castchannel
namespace castchannel {
bool CastMessage_ProtocolVersion_IsValid(int value) {
  switch (value) {
    case 0:
      return true;
    default:
      return false;
  }
}

static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> CastMessage_ProtocolVersion_strings[1] = {};

static const char CastMessage_ProtocolVersion_names[] =
  "CASTV2_1_0";

static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry CastMessage_ProtocolVersion_entries[] = {
  { {CastMessage_ProtocolVersion_names + 0, 10}, 0 },
};

static const int CastMessage_ProtocolVersion_entries_by_number[] = {
  0, // 0 -> CASTV2_1_0
};

const std::string& CastMessage_ProtocolVersion_Name(
    CastMessage_ProtocolVersion value) {
  static const bool dummy =
      ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
          CastMessage_ProtocolVersion_entries,
          CastMessage_ProtocolVersion_entries_by_number,
          1, CastMessage_ProtocolVersion_strings);
  (void) dummy;
  int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
      CastMessage_ProtocolVersion_entries,
      CastMessage_ProtocolVersion_entries_by_number,
      1, value);
  return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
                     CastMessage_ProtocolVersion_strings[idx].get();
}
bool CastMessage_ProtocolVersion_Parse(
    ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, CastMessage_ProtocolVersion* value) {
  int int_value;
  bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
      CastMessage_ProtocolVersion_entries, 1, name, &int_value);
  if (success) {
    *value = static_cast<CastMessage_ProtocolVersion>(int_value);
  }
  return success;
}
#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
constexpr CastMessage_ProtocolVersion CastMessage::CASTV2_1_0;
constexpr CastMessage_ProtocolVersion CastMessage::ProtocolVersion_MIN;
constexpr CastMessage_ProtocolVersion CastMessage::ProtocolVersion_MAX;
constexpr int CastMessage::ProtocolVersion_ARRAYSIZE;
#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
bool CastMessage_PayloadType_IsValid(int value) {
  switch (value) {
    case 0:
    case 1:
      return true;
    default:
      return false;
  }
}

static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> CastMessage_PayloadType_strings[2] = {};

static const char CastMessage_PayloadType_names[] =
  "BINARY"
  "STRING";

static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry CastMessage_PayloadType_entries[] = {
  { {CastMessage_PayloadType_names + 0, 6}, 1 },
  { {CastMessage_PayloadType_names + 6, 6}, 0 },
};

static const int CastMessage_PayloadType_entries_by_number[] = {
  1, // 0 -> STRING
  0, // 1 -> BINARY
};

const std::string& CastMessage_PayloadType_Name(
    CastMessage_PayloadType value) {
  static const bool dummy =
      ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
          CastMessage_PayloadType_entries,
          CastMessage_PayloadType_entries_by_number,
          2, CastMessage_PayloadType_strings);
  (void) dummy;
  int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
      CastMessage_PayloadType_entries,
      CastMessage_PayloadType_entries_by_number,
      2, value);
  return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
                     CastMessage_PayloadType_strings[idx].get();
}
bool CastMessage_PayloadType_Parse(
    ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, CastMessage_PayloadType* value) {
  int int_value;
  bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
      CastMessage_PayloadType_entries, 2, name, &int_value);
  if (success) {
    *value = static_cast<CastMessage_PayloadType>(int_value);
  }
  return success;
}
#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
constexpr CastMessage_PayloadType CastMessage::STRING;
constexpr CastMessage_PayloadType CastMessage::BINARY;
constexpr CastMessage_PayloadType CastMessage::PayloadType_MIN;
constexpr CastMessage_PayloadType CastMessage::PayloadType_MAX;
constexpr int CastMessage::PayloadType_ARRAYSIZE;
#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
bool AuthError_ErrorType_IsValid(int value) {
  switch (value) {
    case 0:
    case 1:
      return true;
    default:
      return false;
  }
}

static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> AuthError_ErrorType_strings[2] = {};

static const char AuthError_ErrorType_names[] =
  "INTERNAL_ERROR"
  "NO_TLS";

static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry AuthError_ErrorType_entries[] = {
  { {AuthError_ErrorType_names + 0, 14}, 0 },
  { {AuthError_ErrorType_names + 14, 6}, 1 },
};

static const int AuthError_ErrorType_entries_by_number[] = {
  0, // 0 -> INTERNAL_ERROR
  1, // 1 -> NO_TLS
};

const std::string& AuthError_ErrorType_Name(
    AuthError_ErrorType value) {
  static const bool dummy =
      ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
          AuthError_ErrorType_entries,
          AuthError_ErrorType_entries_by_number,
          2, AuthError_ErrorType_strings);
  (void) dummy;
  int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
      AuthError_ErrorType_entries,
      AuthError_ErrorType_entries_by_number,
      2, value);
  return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
                     AuthError_ErrorType_strings[idx].get();
}
bool AuthError_ErrorType_Parse(
    ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, AuthError_ErrorType* value) {
  int int_value;
  bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
      AuthError_ErrorType_entries, 2, name, &int_value);
  if (success) {
    *value = static_cast<AuthError_ErrorType>(int_value);
  }
  return success;
}
#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
constexpr AuthError_ErrorType AuthError::INTERNAL_ERROR;
constexpr AuthError_ErrorType AuthError::NO_TLS;
constexpr AuthError_ErrorType AuthError::ErrorType_MIN;
constexpr AuthError_ErrorType AuthError::ErrorType_MAX;
constexpr int AuthError::ErrorType_ARRAYSIZE;
#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))

// ===================================================================

class CastMessage::_Internal {
 public:
  using HasBits = decltype(std::declval<CastMessage>()._impl_._has_bits_);
  static void set_has_protocol_version(HasBits* has_bits) {
    (*has_bits)[0] |= 32u;
  }
  static void set_has_source_id(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_destination_id(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_namespace_(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static void set_has_payload_type(HasBits* has_bits) {
    (*has_bits)[0] |= 64u;
  }
  static void set_has_payload_utf8(HasBits* has_bits) {
    (*has_bits)[0] |= 8u;
  }
  static void set_has_payload_binary(HasBits* has_bits) {
    (*has_bits)[0] |= 16u;
  }
  static bool MissingRequiredFields(const HasBits& has_bits) {
    return ((has_bits[0] & 0x00000067) ^ 0x00000067) != 0;
  }
};

CastMessage::CastMessage(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor(arena, is_message_owned);
  // @@protoc_insertion_point(arena_constructor:castchannel.CastMessage)
}
CastMessage::CastMessage(const CastMessage& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  CastMessage* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){from._impl_._has_bits_}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.source_id_){}
    , decltype(_impl_.destination_id_){}
    , decltype(_impl_.namespace__){}
    , decltype(_impl_.payload_utf8_){}
    , decltype(_impl_.payload_binary_){}
    , decltype(_impl_.protocol_version_){}
    , decltype(_impl_.payload_type_){}};

  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  _impl_.source_id_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.source_id_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_source_id()) {
    _this->_impl_.source_id_.Set(from._internal_source_id(), 
      _this->GetArenaForAllocation());
  }
  _impl_.destination_id_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.destination_id_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_destination_id()) {
    _this->_impl_.destination_id_.Set(from._internal_destination_id(), 
      _this->GetArenaForAllocation());
  }
  _impl_.namespace__.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.namespace__.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_namespace_()) {
    _this->_impl_.namespace__.Set(from._internal_namespace_(), 
      _this->GetArenaForAllocation());
  }
  _impl_.payload_utf8_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.payload_utf8_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_payload_utf8()) {
    _this->_impl_.payload_utf8_.Set(from._internal_payload_utf8(), 
      _this->GetArenaForAllocation());
  }
  _impl_.payload_binary_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.payload_binary_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_payload_binary()) {
    _this->_impl_.payload_binary_.Set(from._internal_payload_binary(), 
      _this->GetArenaForAllocation());
  }
  ::memcpy(&_impl_.protocol_version_, &from._impl_.protocol_version_,
    static_cast<size_t>(reinterpret_cast<char*>(&_impl_.payload_type_) -
    reinterpret_cast<char*>(&_impl_.protocol_version_)) + sizeof(_impl_.payload_type_));
  // @@protoc_insertion_point(copy_constructor:castchannel.CastMessage)
}

inline void CastMessage::SharedCtor(
    ::_pb::Arena* arena, bool is_message_owned) {
  (void)arena;
  (void)is_message_owned;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.source_id_){}
    , decltype(_impl_.destination_id_){}
    , decltype(_impl_.namespace__){}
    , decltype(_impl_.payload_utf8_){}
    , decltype(_impl_.payload_binary_){}
    , decltype(_impl_.protocol_version_){0}
    , decltype(_impl_.payload_type_){0}
  };
  _impl_.source_id_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.source_id_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  _impl_.destination_id_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.destination_id_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  _impl_.namespace__.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.namespace__.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  _impl_.payload_utf8_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.payload_utf8_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  _impl_.payload_binary_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.payload_binary_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}

CastMessage::~CastMessage() {
  // @@protoc_insertion_point(destructor:castchannel.CastMessage)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void CastMessage::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  _impl_.source_id_.Destroy();
  _impl_.destination_id_.Destroy();
  _impl_.namespace__.Destroy();
  _impl_.payload_utf8_.Destroy();
  _impl_.payload_binary_.Destroy();
}

void CastMessage::SetCachedSize(int size) const {
  _impl_._cached_size_.Set(size);
}

void CastMessage::Clear() {
// @@protoc_insertion_point(message_clear_start:castchannel.CastMessage)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _impl_._has_bits_[0];
  if (cached_has_bits & 0x0000001fu) {
    if (cached_has_bits & 0x00000001u) {
      _impl_.source_id_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000002u) {
      _impl_.destination_id_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000004u) {
      _impl_.namespace__.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000008u) {
      _impl_.payload_utf8_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000010u) {
      _impl_.payload_binary_.ClearNonDefaultToEmpty();
    }
  }
  if (cached_has_bits & 0x00000060u) {
    ::memset(&_impl_.protocol_version_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&_impl_.payload_type_) -
        reinterpret_cast<char*>(&_impl_.protocol_version_)) + sizeof(_impl_.payload_type_));
  }
  _impl_._has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* CastMessage::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // required .castchannel.CastMessage.ProtocolVersion protocol_version = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
          if (PROTOBUF_PREDICT_TRUE(::castchannel::CastMessage_ProtocolVersion_IsValid(val))) {
            _internal_set_protocol_version(static_cast<::castchannel::CastMessage_ProtocolVersion>(val));
          } else {
            ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields());
          }
        } else
          goto handle_unusual;
        continue;
      // required string source_id = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          auto str = _internal_mutable_source_id();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // required string destination_id = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
          auto str = _internal_mutable_destination_id();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // required string namespace = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
          auto str = _internal_mutable_namespace_();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // required .castchannel.CastMessage.PayloadType payload_type = 5;
      case 5:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
          if (PROTOBUF_PREDICT_TRUE(::castchannel::CastMessage_PayloadType_IsValid(val))) {
            _internal_set_payload_type(static_cast<::castchannel::CastMessage_PayloadType>(val));
          } else {
            ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(5, val, mutable_unknown_fields());
          }
        } else
          goto handle_unusual;
        continue;
      // optional string payload_utf8 = 6;
      case 6:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
          auto str = _internal_mutable_payload_utf8();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bytes payload_binary = 7;
      case 7:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
          auto str = _internal_mutable_payload_binary();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _impl_._has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* CastMessage::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:castchannel.CastMessage)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _impl_._has_bits_[0];
  // required .castchannel.CastMessage.ProtocolVersion protocol_version = 1;
  if (cached_has_bits & 0x00000020u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteEnumToArray(
      1, this->_internal_protocol_version(), target);
  }

  // required string source_id = 2;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteStringMaybeAliased(
        2, this->_internal_source_id(), target);
  }

  // required string destination_id = 3;
  if (cached_has_bits & 0x00000002u) {
    target = stream->WriteStringMaybeAliased(
        3, this->_internal_destination_id(), target);
  }

  // required string namespace = 4;
  if (cached_has_bits & 0x00000004u) {
    target = stream->WriteStringMaybeAliased(
        4, this->_internal_namespace_(), target);
  }

  // required .castchannel.CastMessage.PayloadType payload_type = 5;
  if (cached_has_bits & 0x00000040u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteEnumToArray(
      5, this->_internal_payload_type(), target);
  }

  // optional string payload_utf8 = 6;
  if (cached_has_bits & 0x00000008u) {
    target = stream->WriteStringMaybeAliased(
        6, this->_internal_payload_utf8(), target);
  }

  // optional bytes payload_binary = 7;
  if (cached_has_bits & 0x00000010u) {
    target = stream->WriteBytesMaybeAliased(
        7, this->_internal_payload_binary(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:castchannel.CastMessage)
  return target;
}

size_t CastMessage::RequiredFieldsByteSizeFallback() const {
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:castchannel.CastMessage)
  size_t total_size = 0;

  if (_internal_has_source_id()) {
    // required string source_id = 2;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_source_id());
  }

  if (_internal_has_destination_id()) {
    // required string destination_id = 3;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_destination_id());
  }

  if (_internal_has_namespace_()) {
    // required string namespace = 4;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_namespace_());
  }

  if (_internal_has_protocol_version()) {
    // required .castchannel.CastMessage.ProtocolVersion protocol_version = 1;
    total_size += 1 +
      ::_pbi::WireFormatLite::EnumSize(this->_internal_protocol_version());
  }

  if (_internal_has_payload_type()) {
    // required .castchannel.CastMessage.PayloadType payload_type = 5;
    total_size += 1 +
      ::_pbi::WireFormatLite::EnumSize(this->_internal_payload_type());
  }

  return total_size;
}
size_t CastMessage::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:castchannel.CastMessage)
  size_t total_size = 0;

  if (((_impl_._has_bits_[0] & 0x00000067) ^ 0x00000067) == 0) {  // All required fields are present.
    // required string source_id = 2;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_source_id());

    // required string destination_id = 3;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_destination_id());

    // required string namespace = 4;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_namespace_());

    // required .castchannel.CastMessage.ProtocolVersion protocol_version = 1;
    total_size += 1 +
      ::_pbi::WireFormatLite::EnumSize(this->_internal_protocol_version());

    // required .castchannel.CastMessage.PayloadType payload_type = 5;
    total_size += 1 +
      ::_pbi::WireFormatLite::EnumSize(this->_internal_payload_type());

  } else {
    total_size += RequiredFieldsByteSizeFallback();
  }
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _impl_._has_bits_[0];
  if (cached_has_bits & 0x00000018u) {
    // optional string payload_utf8 = 6;
    if (cached_has_bits & 0x00000008u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_payload_utf8());
    }

    // optional bytes payload_binary = 7;
    if (cached_has_bits & 0x00000010u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
          this->_internal_payload_binary());
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void CastMessage::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::_pbi::DownCast<const CastMessage*>(
      &from));
}

void CastMessage::MergeFrom(const CastMessage& from) {
  CastMessage* const _this = this;
  // @@protoc_insertion_point(class_specific_merge_from_start:castchannel.CastMessage)
  GOOGLE_DCHECK_NE(&from, _this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._impl_._has_bits_[0];
  if (cached_has_bits & 0x0000007fu) {
    if (cached_has_bits & 0x00000001u) {
      _this->_internal_set_source_id(from._internal_source_id());
    }
    if (cached_has_bits & 0x00000002u) {
      _this->_internal_set_destination_id(from._internal_destination_id());
    }
    if (cached_has_bits & 0x00000004u) {
      _this->_internal_set_namespace_(from._internal_namespace_());
    }
    if (cached_has_bits & 0x00000008u) {
      _this->_internal_set_payload_utf8(from._internal_payload_utf8());
    }
    if (cached_has_bits & 0x00000010u) {
      _this->_internal_set_payload_binary(from._internal_payload_binary());
    }
    if (cached_has_bits & 0x00000020u) {
      _this->_impl_.protocol_version_ = from._impl_.protocol_version_;
    }
    if (cached_has_bits & 0x00000040u) {
      _this->_impl_.payload_type_ = from._impl_.payload_type_;
    }
    _this->_impl_._has_bits_[0] |= cached_has_bits;
  }
  _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void CastMessage::CopyFrom(const CastMessage& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:castchannel.CastMessage)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool CastMessage::IsInitialized() const {
  if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false;
  return true;
}

void CastMessage::InternalSwap(CastMessage* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.source_id_, lhs_arena,
      &other->_impl_.source_id_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.destination_id_, lhs_arena,
      &other->_impl_.destination_id_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.namespace__, lhs_arena,
      &other->_impl_.namespace__, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.payload_utf8_, lhs_arena,
      &other->_impl_.payload_utf8_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.payload_binary_, lhs_arena,
      &other->_impl_.payload_binary_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(CastMessage, _impl_.payload_type_)
      + sizeof(CastMessage::_impl_.payload_type_)
      - PROTOBUF_FIELD_OFFSET(CastMessage, _impl_.protocol_version_)>(
          reinterpret_cast<char*>(&_impl_.protocol_version_),
          reinterpret_cast<char*>(&other->_impl_.protocol_version_));
}

std::string CastMessage::GetTypeName() const {
  return "castchannel.CastMessage";
}


// ===================================================================

class AuthChallenge::_Internal {
 public:
};

AuthChallenge::AuthChallenge(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor(arena, is_message_owned);
  // @@protoc_insertion_point(arena_constructor:castchannel.AuthChallenge)
}
AuthChallenge::AuthChallenge(const AuthChallenge& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  AuthChallenge* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      /*decltype(_impl_._cached_size_)*/{}};

  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:castchannel.AuthChallenge)
}

inline void AuthChallenge::SharedCtor(
    ::_pb::Arena* arena, bool is_message_owned) {
  (void)arena;
  (void)is_message_owned;
  new (&_impl_) Impl_{
      /*decltype(_impl_._cached_size_)*/{}
  };
}

AuthChallenge::~AuthChallenge() {
  // @@protoc_insertion_point(destructor:castchannel.AuthChallenge)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void AuthChallenge::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}

void AuthChallenge::SetCachedSize(int size) const {
  _impl_._cached_size_.Set(size);
}

void AuthChallenge::Clear() {
// @@protoc_insertion_point(message_clear_start:castchannel.AuthChallenge)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  _internal_metadata_.Clear<std::string>();
}

const char* AuthChallenge::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* AuthChallenge::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:castchannel.AuthChallenge)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:castchannel.AuthChallenge)
  return target;
}

size_t AuthChallenge::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:castchannel.AuthChallenge)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void AuthChallenge::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::_pbi::DownCast<const AuthChallenge*>(
      &from));
}

void AuthChallenge::MergeFrom(const AuthChallenge& from) {
  AuthChallenge* const _this = this;
  // @@protoc_insertion_point(class_specific_merge_from_start:castchannel.AuthChallenge)
  GOOGLE_DCHECK_NE(&from, _this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void AuthChallenge::CopyFrom(const AuthChallenge& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:castchannel.AuthChallenge)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool AuthChallenge::IsInitialized() const {
  return true;
}

void AuthChallenge::InternalSwap(AuthChallenge* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
}

std::string AuthChallenge::GetTypeName() const {
  return "castchannel.AuthChallenge";
}


// ===================================================================

class AuthResponse::_Internal {
 public:
  using HasBits = decltype(std::declval<AuthResponse>()._impl_._has_bits_);
  static void set_has_signature(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_client_auth_certificate(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static bool MissingRequiredFields(const HasBits& has_bits) {
    return ((has_bits[0] & 0x00000003) ^ 0x00000003) != 0;
  }
};

AuthResponse::AuthResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor(arena, is_message_owned);
  // @@protoc_insertion_point(arena_constructor:castchannel.AuthResponse)
}
AuthResponse::AuthResponse(const AuthResponse& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  AuthResponse* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){from._impl_._has_bits_}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.signature_){}
    , decltype(_impl_.client_auth_certificate_){}};

  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  _impl_.signature_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.signature_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_signature()) {
    _this->_impl_.signature_.Set(from._internal_signature(), 
      _this->GetArenaForAllocation());
  }
  _impl_.client_auth_certificate_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.client_auth_certificate_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_client_auth_certificate()) {
    _this->_impl_.client_auth_certificate_.Set(from._internal_client_auth_certificate(), 
      _this->GetArenaForAllocation());
  }
  // @@protoc_insertion_point(copy_constructor:castchannel.AuthResponse)
}

inline void AuthResponse::SharedCtor(
    ::_pb::Arena* arena, bool is_message_owned) {
  (void)arena;
  (void)is_message_owned;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.signature_){}
    , decltype(_impl_.client_auth_certificate_){}
  };
  _impl_.signature_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.signature_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  _impl_.client_auth_certificate_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.client_auth_certificate_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}

AuthResponse::~AuthResponse() {
  // @@protoc_insertion_point(destructor:castchannel.AuthResponse)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void AuthResponse::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  _impl_.signature_.Destroy();
  _impl_.client_auth_certificate_.Destroy();
}

void AuthResponse::SetCachedSize(int size) const {
  _impl_._cached_size_.Set(size);
}

void AuthResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:castchannel.AuthResponse)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _impl_._has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      _impl_.signature_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000002u) {
      _impl_.client_auth_certificate_.ClearNonDefaultToEmpty();
    }
  }
  _impl_._has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* AuthResponse::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // required bytes signature = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          auto str = _internal_mutable_signature();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // required bytes client_auth_certificate = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          auto str = _internal_mutable_client_auth_certificate();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _impl_._has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* AuthResponse::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:castchannel.AuthResponse)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _impl_._has_bits_[0];
  // required bytes signature = 1;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteBytesMaybeAliased(
        1, this->_internal_signature(), target);
  }

  // required bytes client_auth_certificate = 2;
  if (cached_has_bits & 0x00000002u) {
    target = stream->WriteBytesMaybeAliased(
        2, this->_internal_client_auth_certificate(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:castchannel.AuthResponse)
  return target;
}

size_t AuthResponse::RequiredFieldsByteSizeFallback() const {
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:castchannel.AuthResponse)
  size_t total_size = 0;

  if (_internal_has_signature()) {
    // required bytes signature = 1;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
        this->_internal_signature());
  }

  if (_internal_has_client_auth_certificate()) {
    // required bytes client_auth_certificate = 2;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
        this->_internal_client_auth_certificate());
  }

  return total_size;
}
size_t AuthResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:castchannel.AuthResponse)
  size_t total_size = 0;

  if (((_impl_._has_bits_[0] & 0x00000003) ^ 0x00000003) == 0) {  // All required fields are present.
    // required bytes signature = 1;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
        this->_internal_signature());

    // required bytes client_auth_certificate = 2;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
        this->_internal_client_auth_certificate());

  } else {
    total_size += RequiredFieldsByteSizeFallback();
  }
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void AuthResponse::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::_pbi::DownCast<const AuthResponse*>(
      &from));
}

void AuthResponse::MergeFrom(const AuthResponse& from) {
  AuthResponse* const _this = this;
  // @@protoc_insertion_point(class_specific_merge_from_start:castchannel.AuthResponse)
  GOOGLE_DCHECK_NE(&from, _this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._impl_._has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      _this->_internal_set_signature(from._internal_signature());
    }
    if (cached_has_bits & 0x00000002u) {
      _this->_internal_set_client_auth_certificate(from._internal_client_auth_certificate());
    }
  }
  _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void AuthResponse::CopyFrom(const AuthResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:castchannel.AuthResponse)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool AuthResponse::IsInitialized() const {
  if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false;
  return true;
}

void AuthResponse::InternalSwap(AuthResponse* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.signature_, lhs_arena,
      &other->_impl_.signature_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.client_auth_certificate_, lhs_arena,
      &other->_impl_.client_auth_certificate_, rhs_arena
  );
}

std::string AuthResponse::GetTypeName() const {
  return "castchannel.AuthResponse";
}


// ===================================================================

class AuthError::_Internal {
 public:
  using HasBits = decltype(std::declval<AuthError>()._impl_._has_bits_);
  static void set_has_error_type(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static bool MissingRequiredFields(const HasBits& has_bits) {
    return ((has_bits[0] & 0x00000001) ^ 0x00000001) != 0;
  }
};

AuthError::AuthError(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor(arena, is_message_owned);
  // @@protoc_insertion_point(arena_constructor:castchannel.AuthError)
}
AuthError::AuthError(const AuthError& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  AuthError* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){from._impl_._has_bits_}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.error_type_){}};

  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  _this->_impl_.error_type_ = from._impl_.error_type_;
  // @@protoc_insertion_point(copy_constructor:castchannel.AuthError)
}

inline void AuthError::SharedCtor(
    ::_pb::Arena* arena, bool is_message_owned) {
  (void)arena;
  (void)is_message_owned;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.error_type_){0}
  };
}

AuthError::~AuthError() {
  // @@protoc_insertion_point(destructor:castchannel.AuthError)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void AuthError::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}

void AuthError::SetCachedSize(int size) const {
  _impl_._cached_size_.Set(size);
}

void AuthError::Clear() {
// @@protoc_insertion_point(message_clear_start:castchannel.AuthError)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  _impl_.error_type_ = 0;
  _impl_._has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* AuthError::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // required .castchannel.AuthError.ErrorType error_type = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
          if (PROTOBUF_PREDICT_TRUE(::castchannel::AuthError_ErrorType_IsValid(val))) {
            _internal_set_error_type(static_cast<::castchannel::AuthError_ErrorType>(val));
          } else {
            ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields());
          }
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _impl_._has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* AuthError::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:castchannel.AuthError)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _impl_._has_bits_[0];
  // required .castchannel.AuthError.ErrorType error_type = 1;
  if (cached_has_bits & 0x00000001u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteEnumToArray(
      1, this->_internal_error_type(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:castchannel.AuthError)
  return target;
}

size_t AuthError::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:castchannel.AuthError)
  size_t total_size = 0;

  // required .castchannel.AuthError.ErrorType error_type = 1;
  if (_internal_has_error_type()) {
    total_size += 1 +
      ::_pbi::WireFormatLite::EnumSize(this->_internal_error_type());
  }
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void AuthError::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::_pbi::DownCast<const AuthError*>(
      &from));
}

void AuthError::MergeFrom(const AuthError& from) {
  AuthError* const _this = this;
  // @@protoc_insertion_point(class_specific_merge_from_start:castchannel.AuthError)
  GOOGLE_DCHECK_NE(&from, _this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  if (from._internal_has_error_type()) {
    _this->_internal_set_error_type(from._internal_error_type());
  }
  _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void AuthError::CopyFrom(const AuthError& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:castchannel.AuthError)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool AuthError::IsInitialized() const {
  if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false;
  return true;
}

void AuthError::InternalSwap(AuthError* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
  swap(_impl_.error_type_, other->_impl_.error_type_);
}

std::string AuthError::GetTypeName() const {
  return "castchannel.AuthError";
}


// ===================================================================

class DeviceAuthMessage::_Internal {
 public:
  using HasBits = decltype(std::declval<DeviceAuthMessage>()._impl_._has_bits_);
  static const ::castchannel::AuthChallenge& challenge(const DeviceAuthMessage* msg);
  static void set_has_challenge(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static const ::castchannel::AuthResponse& response(const DeviceAuthMessage* msg);
  static void set_has_response(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static const ::castchannel::AuthError& error(const DeviceAuthMessage* msg);
  static void set_has_error(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
};

const ::castchannel::AuthChallenge&
DeviceAuthMessage::_Internal::challenge(const DeviceAuthMessage* msg) {
  return *msg->_impl_.challenge_;
}
const ::castchannel::AuthResponse&
DeviceAuthMessage::_Internal::response(const DeviceAuthMessage* msg) {
  return *msg->_impl_.response_;
}
const ::castchannel::AuthError&
DeviceAuthMessage::_Internal::error(const DeviceAuthMessage* msg) {
  return *msg->_impl_.error_;
}
DeviceAuthMessage::DeviceAuthMessage(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor(arena, is_message_owned);
  // @@protoc_insertion_point(arena_constructor:castchannel.DeviceAuthMessage)
}
DeviceAuthMessage::DeviceAuthMessage(const DeviceAuthMessage& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  DeviceAuthMessage* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){from._impl_._has_bits_}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.challenge_){nullptr}
    , decltype(_impl_.response_){nullptr}
    , decltype(_impl_.error_){nullptr}};

  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  if (from._internal_has_challenge()) {
    _this->_impl_.challenge_ = new ::castchannel::AuthChallenge(*from._impl_.challenge_);
  }
  if (from._internal_has_response()) {
    _this->_impl_.response_ = new ::castchannel::AuthResponse(*from._impl_.response_);
  }
  if (from._internal_has_error()) {
    _this->_impl_.error_ = new ::castchannel::AuthError(*from._impl_.error_);
  }
  // @@protoc_insertion_point(copy_constructor:castchannel.DeviceAuthMessage)
}

inline void DeviceAuthMessage::SharedCtor(
    ::_pb::Arena* arena, bool is_message_owned) {
  (void)arena;
  (void)is_message_owned;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.challenge_){nullptr}
    , decltype(_impl_.response_){nullptr}
    , decltype(_impl_.error_){nullptr}
  };
}

DeviceAuthMessage::~DeviceAuthMessage() {
  // @@protoc_insertion_point(destructor:castchannel.DeviceAuthMessage)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void DeviceAuthMessage::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  if (this != internal_default_instance()) delete _impl_.challenge_;
  if (this != internal_default_instance()) delete _impl_.response_;
  if (this != internal_default_instance()) delete _impl_.error_;
}

void DeviceAuthMessage::SetCachedSize(int size) const {
  _impl_._cached_size_.Set(size);
}

void DeviceAuthMessage::Clear() {
// @@protoc_insertion_point(message_clear_start:castchannel.DeviceAuthMessage)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _impl_._has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    if (cached_has_bits & 0x00000001u) {
      GOOGLE_DCHECK(_impl_.challenge_ != nullptr);
      _impl_.challenge_->Clear();
    }
    if (cached_has_bits & 0x00000002u) {
      GOOGLE_DCHECK(_impl_.response_ != nullptr);
      _impl_.response_->Clear();
    }
    if (cached_has_bits & 0x00000004u) {
      GOOGLE_DCHECK(_impl_.error_ != nullptr);
      _impl_.error_->Clear();
    }
  }
  _impl_._has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* DeviceAuthMessage::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional .castchannel.AuthChallenge challenge = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr = ctx->ParseMessage(_internal_mutable_challenge(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .castchannel.AuthResponse response = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_response(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .castchannel.AuthError error = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
          ptr = ctx->ParseMessage(_internal_mutable_error(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _impl_._has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* DeviceAuthMessage::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:castchannel.DeviceAuthMessage)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _impl_._has_bits_[0];
  // optional .castchannel.AuthChallenge challenge = 1;
  if (cached_has_bits & 0x00000001u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(1, _Internal::challenge(this),
        _Internal::challenge(this).GetCachedSize(), target, stream);
  }

  // optional .castchannel.AuthResponse response = 2;
  if (cached_has_bits & 0x00000002u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(2, _Internal::response(this),
        _Internal::response(this).GetCachedSize(), target, stream);
  }

  // optional .castchannel.AuthError error = 3;
  if (cached_has_bits & 0x00000004u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(3, _Internal::error(this),
        _Internal::error(this).GetCachedSize(), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:castchannel.DeviceAuthMessage)
  return target;
}

size_t DeviceAuthMessage::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:castchannel.DeviceAuthMessage)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _impl_._has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    // optional .castchannel.AuthChallenge challenge = 1;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *_impl_.challenge_);
    }

    // optional .castchannel.AuthResponse response = 2;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *_impl_.response_);
    }

    // optional .castchannel.AuthError error = 3;
    if (cached_has_bits & 0x00000004u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *_impl_.error_);
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void DeviceAuthMessage::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::_pbi::DownCast<const DeviceAuthMessage*>(
      &from));
}

void DeviceAuthMessage::MergeFrom(const DeviceAuthMessage& from) {
  DeviceAuthMessage* const _this = this;
  // @@protoc_insertion_point(class_specific_merge_from_start:castchannel.DeviceAuthMessage)
  GOOGLE_DCHECK_NE(&from, _this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._impl_._has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    if (cached_has_bits & 0x00000001u) {
      _this->_internal_mutable_challenge()->::castchannel::AuthChallenge::MergeFrom(
          from._internal_challenge());
    }
    if (cached_has_bits & 0x00000002u) {
      _this->_internal_mutable_response()->::castchannel::AuthResponse::MergeFrom(
          from._internal_response());
    }
    if (cached_has_bits & 0x00000004u) {
      _this->_internal_mutable_error()->::castchannel::AuthError::MergeFrom(
          from._internal_error());
    }
  }
  _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void DeviceAuthMessage::CopyFrom(const DeviceAuthMessage& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:castchannel.DeviceAuthMessage)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool DeviceAuthMessage::IsInitialized() const {
  if (_internal_has_response()) {
    if (!_impl_.response_->IsInitialized()) return false;
  }
  if (_internal_has_error()) {
    if (!_impl_.error_->IsInitialized()) return false;
  }
  return true;
}

void DeviceAuthMessage::InternalSwap(DeviceAuthMessage* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(DeviceAuthMessage, _impl_.error_)
      + sizeof(DeviceAuthMessage::_impl_.error_)
      - PROTOBUF_FIELD_OFFSET(DeviceAuthMessage, _impl_.challenge_)>(
          reinterpret_cast<char*>(&_impl_.challenge_),
          reinterpret_cast<char*>(&other->_impl_.challenge_));
}

std::string DeviceAuthMessage::GetTypeName() const {
  return "castchannel.DeviceAuthMessage";
}


// @@protoc_insertion_point(namespace_scope)
}  // namespace castchannel
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::castchannel::CastMessage*
Arena::CreateMaybeMessage< ::castchannel::CastMessage >(Arena* arena) {
  return Arena::CreateMessageInternal< ::castchannel::CastMessage >(arena);
}
template<> PROTOBUF_NOINLINE ::castchannel::AuthChallenge*
Arena::CreateMaybeMessage< ::castchannel::AuthChallenge >(Arena* arena) {
  return Arena::CreateMessageInternal< ::castchannel::AuthChallenge >(arena);
}
template<> PROTOBUF_NOINLINE ::castchannel::AuthResponse*
Arena::CreateMaybeMessage< ::castchannel::AuthResponse >(Arena* arena) {
  return Arena::CreateMessageInternal< ::castchannel::AuthResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::castchannel::AuthError*
Arena::CreateMaybeMessage< ::castchannel::AuthError >(Arena* arena) {
  return Arena::CreateMessageInternal< ::castchannel::AuthError >(arena);
}
template<> PROTOBUF_NOINLINE ::castchannel::DeviceAuthMessage*
Arena::CreateMaybeMessage< ::castchannel::DeviceAuthMessage >(Arena* arena) {
  return Arena::CreateMessageInternal< ::castchannel::DeviceAuthMessage >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
