Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: talk/app/webrtc/peerconnectioninterface.h

Issue 1176383004: DtlsIdentityStore[Interface/Impl] updated, DtlsIdentityService to be removed (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merge with master Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // function OnIceCandidate. Send these candidates to the remote peer. 66 // function OnIceCandidate. Send these candidates to the remote peer.
67 67
68 #ifndef TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ 68 #ifndef TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_
69 #define TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ 69 #define TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_
70 70
71 #include <string> 71 #include <string>
72 #include <vector> 72 #include <vector>
73 73
74 #include "talk/app/webrtc/datachannelinterface.h" 74 #include "talk/app/webrtc/datachannelinterface.h"
75 #include "talk/app/webrtc/dtmfsenderinterface.h" 75 #include "talk/app/webrtc/dtmfsenderinterface.h"
76 #include "talk/app/webrtc/dtlsidentitystore.h"
76 #include "talk/app/webrtc/jsep.h" 77 #include "talk/app/webrtc/jsep.h"
77 #include "talk/app/webrtc/mediastreaminterface.h" 78 #include "talk/app/webrtc/mediastreaminterface.h"
78 #include "talk/app/webrtc/statstypes.h" 79 #include "talk/app/webrtc/statstypes.h"
79 #include "talk/app/webrtc/umametrics.h" 80 #include "talk/app/webrtc/umametrics.h"
80 #include "webrtc/base/fileutils.h" 81 #include "webrtc/base/fileutils.h"
81 #include "webrtc/base/network.h" 82 #include "webrtc/base/network.h"
82 #include "webrtc/base/sslstreamadapter.h" 83 #include "webrtc/base/sslstreamadapter.h"
83 #include "webrtc/base/socketaddress.h" 84 #include "webrtc/base/socketaddress.h"
84 85
85 namespace rtc { 86 namespace rtc {
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // After this method is called, the port allocator should consider loopback 460 // After this method is called, the port allocator should consider loopback
460 // network interfaces as well. 461 // network interfaces as well.
461 virtual void SetNetworkIgnoreMask(int network_ignore_mask) { 462 virtual void SetNetworkIgnoreMask(int network_ignore_mask) {
462 } 463 }
463 464
464 protected: 465 protected:
465 PortAllocatorFactoryInterface() {} 466 PortAllocatorFactoryInterface() {}
466 ~PortAllocatorFactoryInterface() {} 467 ~PortAllocatorFactoryInterface() {}
467 }; 468 };
468 469
469 // Used to receive callbacks of DTLS identity requests.
470 class DTLSIdentityRequestObserver : public rtc::RefCountInterface {
471 public:
472 virtual void OnFailure(int error) = 0;
473 // TODO(jiayl): Unify the OnSuccess method once Chrome code is updated.
474 virtual void OnSuccess(const std::string& der_cert,
475 const std::string& der_private_key) = 0;
476 // |identity| is a scoped_ptr because rtc::SSLIdentity is not copyable and the
477 // client has to get the ownership of the object to make use of it.
478 virtual void OnSuccessWithIdentityObj(
479 rtc::scoped_ptr<rtc::SSLIdentity> identity) = 0;
480
481 protected:
482 virtual ~DTLSIdentityRequestObserver() {}
483 };
484
485 class DTLSIdentityServiceInterface {
486 public:
487 // Asynchronously request a DTLS identity, including a self-signed certificate
488 // and the private key used to sign the certificate, from the identity store
489 // for the given identity name.
490 // DTLSIdentityRequestObserver::OnSuccess will be called with the identity if
491 // the request succeeded; DTLSIdentityRequestObserver::OnFailure will be
492 // called with an error code if the request failed.
493 //
494 // Only one request can be made at a time. If a second request is called
495 // before the first one completes, RequestIdentity will abort and return
496 // false.
497 //
498 // |identity_name| is an internal name selected by the client to identify an
499 // identity within an origin. E.g. an web site may cache the certificates used
500 // to communicate with differnent peers under different identity names.
501 //
502 // |common_name| is the common name used to generate the certificate. If the
503 // certificate already exists in the store, |common_name| is ignored.
504 //
505 // |observer| is the object to receive success or failure callbacks.
506 //
507 // Returns true if either OnFailure or OnSuccess will be called.
508 virtual bool RequestIdentity(
509 const std::string& identity_name,
510 const std::string& common_name,
511 DTLSIdentityRequestObserver* observer) = 0;
512
513 virtual ~DTLSIdentityServiceInterface() {}
514 };
515
516 // PeerConnectionFactoryInterface is the factory interface use for creating 470 // PeerConnectionFactoryInterface is the factory interface use for creating
517 // PeerConnection, MediaStream and media tracks. 471 // PeerConnection, MediaStream and media tracks.
518 // PeerConnectionFactoryInterface will create required libjingle threads, 472 // PeerConnectionFactoryInterface will create required libjingle threads,
519 // socket and network manager factory classes for networking. 473 // socket and network manager factory classes for networking.
520 // If an application decides to provide its own threads and network 474 // If an application decides to provide its own threads and network
521 // implementation of these classes it should use the alternate 475 // implementation of these classes it should use the alternate
522 // CreatePeerConnectionFactory method which accepts threads as input and use the 476 // CreatePeerConnectionFactory method which accepts threads as input and use the
523 // CreatePeerConnection version that takes a PortAllocatorFactoryInterface as 477 // CreatePeerConnection version that takes a PortAllocatorFactoryInterface as
524 // argument. 478 // argument.
525 class PeerConnectionFactoryInterface : public rtc::RefCountInterface { 479 class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
(...skipping 15 matching lines...) Expand all
541 int network_ignore_mask; 495 int network_ignore_mask;
542 496
543 // Sets the maximum supported protocol version. The highest version 497 // Sets the maximum supported protocol version. The highest version
544 // supported by both ends will be used for the connection, i.e. if one 498 // supported by both ends will be used for the connection, i.e. if one
545 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. 499 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used.
546 rtc::SSLProtocolVersion ssl_max_version; 500 rtc::SSLProtocolVersion ssl_max_version;
547 }; 501 };
548 502
549 virtual void SetOptions(const Options& options) = 0; 503 virtual void SetOptions(const Options& options) = 0;
550 504
551 // This method takes the ownership of |dtls_identity_service|.
552 virtual rtc::scoped_refptr<PeerConnectionInterface> 505 virtual rtc::scoped_refptr<PeerConnectionInterface>
553 CreatePeerConnection( 506 CreatePeerConnection(
554 const PeerConnectionInterface::RTCConfiguration& configuration, 507 const PeerConnectionInterface::RTCConfiguration& configuration,
555 const MediaConstraintsInterface* constraints, 508 const MediaConstraintsInterface* constraints,
556 PortAllocatorFactoryInterface* allocator_factory, 509 PortAllocatorFactoryInterface* allocator_factory,
557 DTLSIdentityServiceInterface* dtls_identity_service, 510 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
558 PeerConnectionObserver* observer) = 0; 511 PeerConnectionObserver* observer) = 0;
559 512
560 // TODO(mallinath) : Remove below versions after clients are updated 513 // TODO(hbos): Remove below version after clients are updated to above method.
561 // to above method.
562 // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration, 514 // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration,
563 // and not IceServers. RTCConfiguration is made up of ice servers and 515 // and not IceServers. RTCConfiguration is made up of ice servers and
564 // ice transport type. 516 // ice transport type.
565 // http://dev.w3.org/2011/webrtc/editor/webrtc.html 517 // http://dev.w3.org/2011/webrtc/editor/webrtc.html
566 inline rtc::scoped_refptr<PeerConnectionInterface> 518 inline rtc::scoped_refptr<PeerConnectionInterface>
567 CreatePeerConnection( 519 CreatePeerConnection(
568 const PeerConnectionInterface::IceServers& servers, 520 const PeerConnectionInterface::IceServers& servers,
569 const MediaConstraintsInterface* constraints, 521 const MediaConstraintsInterface* constraints,
570 PortAllocatorFactoryInterface* allocator_factory, 522 PortAllocatorFactoryInterface* allocator_factory,
571 DTLSIdentityServiceInterface* dtls_identity_service, 523 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
572 PeerConnectionObserver* observer) { 524 PeerConnectionObserver* observer) {
573 PeerConnectionInterface::RTCConfiguration rtc_config; 525 PeerConnectionInterface::RTCConfiguration rtc_config;
574 rtc_config.servers = servers; 526 rtc_config.servers = servers;
575 return CreatePeerConnection(rtc_config, constraints, allocator_factory, 527 return CreatePeerConnection(rtc_config, constraints, allocator_factory,
576 dtls_identity_service, observer); 528 dtls_identity_store.Pass(), observer);
577 } 529 }
578 530
579 virtual rtc::scoped_refptr<MediaStreamInterface> 531 virtual rtc::scoped_refptr<MediaStreamInterface>
580 CreateLocalMediaStream(const std::string& label) = 0; 532 CreateLocalMediaStream(const std::string& label) = 0;
581 533
582 // Creates a AudioSourceInterface. 534 // Creates a AudioSourceInterface.
583 // |constraints| decides audio processing settings but can be NULL. 535 // |constraints| decides audio processing settings but can be NULL.
584 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( 536 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
585 const MediaConstraintsInterface* constraints) = 0; 537 const MediaConstraintsInterface* constraints) = 0;
586 538
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 CreatePeerConnectionFactory( 579 CreatePeerConnectionFactory(
628 rtc::Thread* worker_thread, 580 rtc::Thread* worker_thread,
629 rtc::Thread* signaling_thread, 581 rtc::Thread* signaling_thread,
630 AudioDeviceModule* default_adm, 582 AudioDeviceModule* default_adm,
631 cricket::WebRtcVideoEncoderFactory* encoder_factory, 583 cricket::WebRtcVideoEncoderFactory* encoder_factory,
632 cricket::WebRtcVideoDecoderFactory* decoder_factory); 584 cricket::WebRtcVideoDecoderFactory* decoder_factory);
633 585
634 } // namespace webrtc 586 } // namespace webrtc
635 587
636 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ 588 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698