channel_authenticator.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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_CHANNEL_AUTHENTICATOR_H_
  5. #define REMOTING_PROTOCOL_CHANNEL_AUTHENTICATOR_H_
  6. #include <string>
  7. #include "base/callback_forward.h"
  8. namespace remoting {
  9. namespace protocol {
  10. class P2PStreamSocket;
  11. // Interface for channel authentications that perform channel-level
  12. // authentication. Depending on implementation channel authenticators
  13. // may also establish SSL connection. Each instance of this interface
  14. // should be used only once for one channel.
  15. class ChannelAuthenticator {
  16. public:
  17. typedef base::OnceCallback<void(int error, std::unique_ptr<P2PStreamSocket>)>
  18. DoneCallback;
  19. virtual ~ChannelAuthenticator() {}
  20. // Start authentication of the given |socket|. |done_callback| is called when
  21. // authentication is finished. Callback may be invoked before this method
  22. // returns, and may delete the calling authenticator.
  23. virtual void SecureAndAuthenticate(std::unique_ptr<P2PStreamSocket> socket,
  24. DoneCallback done_callback) = 0;
  25. };
  26. } // namespace protocol
  27. } // namespace remoting
  28. #endif // REMOTING_PROTOCOL_CHANNEL_AUTHENTICATOR_H_