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

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: Del old requestobserver & service interface (forgot), made global common_name_ const char* Created 5 years, 6 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 namespace cricket { 90 namespace cricket {
91 class PortAllocator; 91 class PortAllocator;
92 class WebRtcVideoDecoderFactory; 92 class WebRtcVideoDecoderFactory;
93 class WebRtcVideoEncoderFactory; 93 class WebRtcVideoEncoderFactory;
94 } 94 }
95 95
96 namespace webrtc { 96 namespace webrtc {
97 class AudioDeviceModule; 97 class AudioDeviceModule;
98 class DtlsIdentityStoreInterface;
98 class MediaConstraintsInterface; 99 class MediaConstraintsInterface;
99 100
100 // MediaStream container interface. 101 // MediaStream container interface.
101 class StreamCollectionInterface : public rtc::RefCountInterface { 102 class StreamCollectionInterface : public rtc::RefCountInterface {
102 public: 103 public:
103 // TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find. 104 // TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find.
104 virtual size_t count() = 0; 105 virtual size_t count() = 0;
105 virtual MediaStreamInterface* at(size_t index) = 0; 106 virtual MediaStreamInterface* at(size_t index) = 0;
106 virtual MediaStreamInterface* find(const std::string& label) = 0; 107 virtual MediaStreamInterface* find(const std::string& label) = 0;
107 virtual MediaStreamTrackInterface* FindAudioTrack( 108 virtual MediaStreamTrackInterface* FindAudioTrack(
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // After this method is called, the port allocator should consider loopback 452 // After this method is called, the port allocator should consider loopback
452 // network interfaces as well. 453 // network interfaces as well.
453 virtual void SetNetworkIgnoreMask(int network_ignore_mask) { 454 virtual void SetNetworkIgnoreMask(int network_ignore_mask) {
454 } 455 }
455 456
456 protected: 457 protected:
457 PortAllocatorFactoryInterface() {} 458 PortAllocatorFactoryInterface() {}
458 ~PortAllocatorFactoryInterface() {} 459 ~PortAllocatorFactoryInterface() {}
459 }; 460 };
460 461
461 // Used to receive callbacks of DTLS identity requests.
462 class DTLSIdentityRequestObserver : public rtc::RefCountInterface {
463 public:
464 virtual void OnFailure(int error) = 0;
465 // TODO(jiayl): Unify the OnSuccess method once Chrome code is updated.
466 virtual void OnSuccess(const std::string& der_cert,
467 const std::string& der_private_key) = 0;
468 // |identity| is a scoped_ptr because rtc::SSLIdentity is not copyable and the
469 // client has to get the ownership of the object to make use of it.
470 virtual void OnSuccessWithIdentityObj(
471 rtc::scoped_ptr<rtc::SSLIdentity> identity) = 0;
472
473 protected:
474 virtual ~DTLSIdentityRequestObserver() {}
475 };
476
477 class DTLSIdentityServiceInterface {
478 public:
479 // Asynchronously request a DTLS identity, including a self-signed certificate
480 // and the private key used to sign the certificate, from the identity store
481 // for the given identity name.
482 // DTLSIdentityRequestObserver::OnSuccess will be called with the identity if
483 // the request succeeded; DTLSIdentityRequestObserver::OnFailure will be
484 // called with an error code if the request failed.
485 //
486 // Only one request can be made at a time. If a second request is called
487 // before the first one completes, RequestIdentity will abort and return
488 // false.
489 //
490 // |identity_name| is an internal name selected by the client to identify an
491 // identity within an origin. E.g. an web site may cache the certificates used
492 // to communicate with differnent peers under different identity names.
493 //
494 // |common_name| is the common name used to generate the certificate. If the
495 // certificate already exists in the store, |common_name| is ignored.
496 //
497 // |observer| is the object to receive success or failure callbacks.
498 //
499 // Returns true if either OnFailure or OnSuccess will be called.
500 virtual bool RequestIdentity(
501 const std::string& identity_name,
502 const std::string& common_name,
503 DTLSIdentityRequestObserver* observer) = 0;
504
505 virtual ~DTLSIdentityServiceInterface() {}
506 };
507
508 // PeerConnectionFactoryInterface is the factory interface use for creating 462 // PeerConnectionFactoryInterface is the factory interface use for creating
509 // PeerConnection, MediaStream and media tracks. 463 // PeerConnection, MediaStream and media tracks.
510 // PeerConnectionFactoryInterface will create required libjingle threads, 464 // PeerConnectionFactoryInterface will create required libjingle threads,
511 // socket and network manager factory classes for networking. 465 // socket and network manager factory classes for networking.
512 // If an application decides to provide its own threads and network 466 // If an application decides to provide its own threads and network
513 // implementation of these classes it should use the alternate 467 // implementation of these classes it should use the alternate
514 // CreatePeerConnectionFactory method which accepts threads as input and use the 468 // CreatePeerConnectionFactory method which accepts threads as input and use the
515 // CreatePeerConnection version that takes a PortAllocatorFactoryInterface as 469 // CreatePeerConnection version that takes a PortAllocatorFactoryInterface as
516 // argument. 470 // argument.
517 class PeerConnectionFactoryInterface : public rtc::RefCountInterface { 471 class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
(...skipping 15 matching lines...) Expand all
533 int network_ignore_mask; 487 int network_ignore_mask;
534 488
535 // Sets the maximum supported protocol version. The highest version 489 // Sets the maximum supported protocol version. The highest version
536 // supported by both ends will be used for the connection, i.e. if one 490 // supported by both ends will be used for the connection, i.e. if one
537 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. 491 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used.
538 rtc::SSLProtocolVersion ssl_max_version; 492 rtc::SSLProtocolVersion ssl_max_version;
539 }; 493 };
540 494
541 virtual void SetOptions(const Options& options) = 0; 495 virtual void SetOptions(const Options& options) = 0;
542 496
543 // This method takes the ownership of |dtls_identity_service|. 497 // This method takes the ownership of |dtls_identity_service|.
hbos 2015/06/16 07:26:24 Should say |dtls_identity_store| now. Also, this
hbos 2015/06/18 08:43:13 Taking ownership and making it explicit with use o
544 virtual rtc::scoped_refptr<PeerConnectionInterface> 498 virtual rtc::scoped_refptr<PeerConnectionInterface>
545 CreatePeerConnection( 499 CreatePeerConnection(
546 const PeerConnectionInterface::RTCConfiguration& configuration, 500 const PeerConnectionInterface::RTCConfiguration& configuration,
547 const MediaConstraintsInterface* constraints, 501 const MediaConstraintsInterface* constraints,
548 PortAllocatorFactoryInterface* allocator_factory, 502 PortAllocatorFactoryInterface* allocator_factory,
549 DTLSIdentityServiceInterface* dtls_identity_service, 503 DtlsIdentityStoreInterface* dtls_identity_store,
550 PeerConnectionObserver* observer) = 0; 504 PeerConnectionObserver* observer) = 0;
551 505
552 // TODO(mallinath) : Remove below versions after clients are updated 506 // TODO(mallinath) : Remove below versions after clients are updated
553 // to above method. 507 // to above method.
554 // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration, 508 // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration,
555 // and not IceServers. RTCConfiguration is made up of ice servers and 509 // and not IceServers. RTCConfiguration is made up of ice servers and
556 // ice transport type. 510 // ice transport type.
557 // http://dev.w3.org/2011/webrtc/editor/webrtc.html 511 // http://dev.w3.org/2011/webrtc/editor/webrtc.html
558 inline rtc::scoped_refptr<PeerConnectionInterface> 512 inline rtc::scoped_refptr<PeerConnectionInterface>
559 CreatePeerConnection( 513 CreatePeerConnection(
560 const PeerConnectionInterface::IceServers& servers, 514 const PeerConnectionInterface::IceServers& servers,
561 const MediaConstraintsInterface* constraints, 515 const MediaConstraintsInterface* constraints,
562 PortAllocatorFactoryInterface* allocator_factory, 516 PortAllocatorFactoryInterface* allocator_factory,
563 DTLSIdentityServiceInterface* dtls_identity_service, 517 DtlsIdentityStoreInterface* dtls_identity_store,
564 PeerConnectionObserver* observer) { 518 PeerConnectionObserver* observer) {
565 PeerConnectionInterface::RTCConfiguration rtc_config; 519 PeerConnectionInterface::RTCConfiguration rtc_config;
566 rtc_config.servers = servers; 520 rtc_config.servers = servers;
567 return CreatePeerConnection(rtc_config, constraints, allocator_factory, 521 return CreatePeerConnection(rtc_config, constraints, allocator_factory,
568 dtls_identity_service, observer); 522 dtls_identity_store, observer);
569 } 523 }
570 524
571 virtual rtc::scoped_refptr<MediaStreamInterface> 525 virtual rtc::scoped_refptr<MediaStreamInterface>
572 CreateLocalMediaStream(const std::string& label) = 0; 526 CreateLocalMediaStream(const std::string& label) = 0;
573 527
574 // Creates a AudioSourceInterface. 528 // Creates a AudioSourceInterface.
575 // |constraints| decides audio processing settings but can be NULL. 529 // |constraints| decides audio processing settings but can be NULL.
576 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( 530 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
577 const MediaConstraintsInterface* constraints) = 0; 531 const MediaConstraintsInterface* constraints) = 0;
578 532
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 CreatePeerConnectionFactory( 573 CreatePeerConnectionFactory(
620 rtc::Thread* worker_thread, 574 rtc::Thread* worker_thread,
621 rtc::Thread* signaling_thread, 575 rtc::Thread* signaling_thread,
622 AudioDeviceModule* default_adm, 576 AudioDeviceModule* default_adm,
623 cricket::WebRtcVideoEncoderFactory* encoder_factory, 577 cricket::WebRtcVideoEncoderFactory* encoder_factory,
624 cricket::WebRtcVideoDecoderFactory* decoder_factory); 578 cricket::WebRtcVideoDecoderFactory* decoder_factory);
625 579
626 } // namespace webrtc 580 } // namespace webrtc
627 581
628 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ 582 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698