content_description.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef REMOTING_PROTOCOL_CONTENT_DESCRIPTION_H_
  5. #define REMOTING_PROTOCOL_CONTENT_DESCRIPTION_H_
  6. #include <memory>
  7. #include <string>
  8. #include "base/memory/ref_counted.h"
  9. #include "remoting/protocol/session_config.h"
  10. namespace jingle_xmpp {
  11. class XmlElement;
  12. } // namespace jingle_xmpp
  13. namespace remoting {
  14. namespace protocol {
  15. // ContentDescription used for chromoting sessions. It contains the information
  16. // from the content description stanza in the session initialization handshake.
  17. //
  18. // This class also provides a type abstraction so that the Chromotocol Session
  19. // interface does not need to depend on libjingle.
  20. class ContentDescription {
  21. public:
  22. static const char kChromotingContentName[];
  23. ContentDescription(std::unique_ptr<CandidateSessionConfig> config,
  24. std::unique_ptr<jingle_xmpp::XmlElement> authenticator_message);
  25. ~ContentDescription();
  26. const CandidateSessionConfig* config() const {
  27. return candidate_config_.get();
  28. }
  29. const jingle_xmpp::XmlElement* authenticator_message() const {
  30. return authenticator_message_.get();
  31. }
  32. jingle_xmpp::XmlElement* ToXml() const;
  33. static std::unique_ptr<ContentDescription> ParseXml(
  34. const jingle_xmpp::XmlElement* element,
  35. bool webrtc_transport);
  36. private:
  37. std::unique_ptr<const CandidateSessionConfig> candidate_config_;
  38. std::unique_ptr<const jingle_xmpp::XmlElement> authenticator_message_;
  39. static bool ParseChannelConfigs(const jingle_xmpp::XmlElement* const element,
  40. const char tag_name[],
  41. bool codec_required,
  42. bool optional,
  43. std::list<ChannelConfig>* const configs);
  44. };
  45. } // namespace protocol
  46. } // namespace remoting
  47. #endif // REMOTING_PROTOCOL_CONTENT_DESCRIPTION_H_