OLD | NEW |
---|---|
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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/jsep.h" | 76 #include "talk/app/webrtc/jsep.h" |
77 #include "talk/app/webrtc/mediastreaminterface.h" | 77 #include "talk/app/webrtc/mediastreaminterface.h" |
78 #include "talk/app/webrtc/statstypes.h" | 78 #include "talk/app/webrtc/statstypes.h" |
79 #include "talk/app/webrtc/umametrics.h" | 79 #include "talk/app/webrtc/umametrics.h" |
80 #include "webrtc/base/fileutils.h" | 80 #include "webrtc/base/fileutils.h" |
81 #include "webrtc/base/network.h" | 81 #include "webrtc/base/network.h" |
82 #include "webrtc/base/sslidentity.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 { |
86 class SSLIdentity; | 87 class SSLIdentity; |
87 class Thread; | 88 class Thread; |
88 } | 89 } |
89 | 90 |
90 namespace cricket { | 91 namespace cricket { |
91 class PortAllocator; | 92 class PortAllocator; |
92 class WebRtcVideoDecoderFactory; | 93 class WebRtcVideoDecoderFactory; |
93 class WebRtcVideoEncoderFactory; | 94 class WebRtcVideoEncoderFactory; |
94 } | 95 } |
95 | 96 |
96 namespace webrtc { | 97 namespace webrtc { |
97 class AudioDeviceModule; | 98 class AudioDeviceModule; |
99 class DtlsIdentityStoreInterface; | |
98 class MediaConstraintsInterface; | 100 class MediaConstraintsInterface; |
99 | 101 |
100 // MediaStream container interface. | 102 // MediaStream container interface. |
101 class StreamCollectionInterface : public rtc::RefCountInterface { | 103 class StreamCollectionInterface : public rtc::RefCountInterface { |
102 public: | 104 public: |
103 // TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find. | 105 // TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find. |
104 virtual size_t count() = 0; | 106 virtual size_t count() = 0; |
105 virtual MediaStreamInterface* at(size_t index) = 0; | 107 virtual MediaStreamInterface* at(size_t index) = 0; |
106 virtual MediaStreamInterface* find(const std::string& label) = 0; | 108 virtual MediaStreamInterface* find(const std::string& label) = 0; |
107 virtual MediaStreamTrackInterface* FindAudioTrack( | 109 virtual MediaStreamTrackInterface* FindAudioTrack( |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 // After this method is called, the port allocator should consider loopback | 453 // After this method is called, the port allocator should consider loopback |
452 // network interfaces as well. | 454 // network interfaces as well. |
453 virtual void SetNetworkIgnoreMask(int network_ignore_mask) { | 455 virtual void SetNetworkIgnoreMask(int network_ignore_mask) { |
454 } | 456 } |
455 | 457 |
456 protected: | 458 protected: |
457 PortAllocatorFactoryInterface() {} | 459 PortAllocatorFactoryInterface() {} |
458 ~PortAllocatorFactoryInterface() {} | 460 ~PortAllocatorFactoryInterface() {} |
459 }; | 461 }; |
460 | 462 |
461 // Used to receive callbacks of DTLS identity requests. | |
462 class DTLSIdentityRequestObserver : public rtc::RefCountInterface { | |
hbos
2015/06/12 12:46:55
Moved to dtlsidentitystore.h (and renamed DTLS ->
| |
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 { | |
hbos
2015/06/12 12:46:55
Nuked.
| |
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 | 463 // PeerConnectionFactoryInterface is the factory interface use for creating |
509 // PeerConnection, MediaStream and media tracks. | 464 // PeerConnection, MediaStream and media tracks. |
510 // PeerConnectionFactoryInterface will create required libjingle threads, | 465 // PeerConnectionFactoryInterface will create required libjingle threads, |
511 // socket and network manager factory classes for networking. | 466 // socket and network manager factory classes for networking. |
512 // If an application decides to provide its own threads and network | 467 // If an application decides to provide its own threads and network |
513 // implementation of these classes it should use the alternate | 468 // implementation of these classes it should use the alternate |
514 // CreatePeerConnectionFactory method which accepts threads as input and use the | 469 // CreatePeerConnectionFactory method which accepts threads as input and use the |
515 // CreatePeerConnection version that takes a PortAllocatorFactoryInterface as | 470 // CreatePeerConnection version that takes a PortAllocatorFactoryInterface as |
516 // argument. | 471 // argument. |
517 class PeerConnectionFactoryInterface : public rtc::RefCountInterface { | 472 class PeerConnectionFactoryInterface : public rtc::RefCountInterface { |
(...skipping 21 matching lines...) Expand all Loading... | |
539 }; | 494 }; |
540 | 495 |
541 virtual void SetOptions(const Options& options) = 0; | 496 virtual void SetOptions(const Options& options) = 0; |
542 | 497 |
543 // This method takes the ownership of |dtls_identity_service|. | 498 // This method takes the ownership of |dtls_identity_service|. |
544 virtual rtc::scoped_refptr<PeerConnectionInterface> | 499 virtual rtc::scoped_refptr<PeerConnectionInterface> |
545 CreatePeerConnection( | 500 CreatePeerConnection( |
546 const PeerConnectionInterface::RTCConfiguration& configuration, | 501 const PeerConnectionInterface::RTCConfiguration& configuration, |
547 const MediaConstraintsInterface* constraints, | 502 const MediaConstraintsInterface* constraints, |
548 PortAllocatorFactoryInterface* allocator_factory, | 503 PortAllocatorFactoryInterface* allocator_factory, |
549 DTLSIdentityServiceInterface* dtls_identity_service, | 504 PeerConnectionObserver* observer, |
550 PeerConnectionObserver* observer) = 0; | 505 DtlsIdentityStoreInterface* dtls_identity_store, |
506 rtc::KeyType key_type = rtc::KT_DEFAULT) = 0; | |
551 | 507 |
552 // TODO(mallinath) : Remove below versions after clients are updated | 508 // TODO(mallinath) : Remove below versions after clients are updated |
553 // to above method. | 509 // to above method. |
554 // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration, | 510 // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration, |
555 // and not IceServers. RTCConfiguration is made up of ice servers and | 511 // and not IceServers. RTCConfiguration is made up of ice servers and |
556 // ice transport type. | 512 // ice transport type. |
557 // http://dev.w3.org/2011/webrtc/editor/webrtc.html | 513 // http://dev.w3.org/2011/webrtc/editor/webrtc.html |
558 inline rtc::scoped_refptr<PeerConnectionInterface> | 514 inline rtc::scoped_refptr<PeerConnectionInterface> |
559 CreatePeerConnection( | 515 CreatePeerConnection( |
560 const PeerConnectionInterface::IceServers& servers, | 516 const PeerConnectionInterface::IceServers& servers, |
561 const MediaConstraintsInterface* constraints, | 517 const MediaConstraintsInterface* constraints, |
562 PortAllocatorFactoryInterface* allocator_factory, | 518 PortAllocatorFactoryInterface* allocator_factory, |
563 DTLSIdentityServiceInterface* dtls_identity_service, | 519 PeerConnectionObserver* observer, |
564 PeerConnectionObserver* observer) { | 520 DtlsIdentityStoreInterface* dtls_identity_store, |
521 rtc::KeyType key_type = rtc::KT_DEFAULT) { | |
565 PeerConnectionInterface::RTCConfiguration rtc_config; | 522 PeerConnectionInterface::RTCConfiguration rtc_config; |
566 rtc_config.servers = servers; | 523 rtc_config.servers = servers; |
567 return CreatePeerConnection(rtc_config, constraints, allocator_factory, | 524 return CreatePeerConnection(rtc_config, constraints, allocator_factory, |
568 dtls_identity_service, observer); | 525 observer, dtls_identity_store, key_type); |
569 } | 526 } |
570 | 527 |
571 virtual rtc::scoped_refptr<MediaStreamInterface> | 528 virtual rtc::scoped_refptr<MediaStreamInterface> |
572 CreateLocalMediaStream(const std::string& label) = 0; | 529 CreateLocalMediaStream(const std::string& label) = 0; |
573 | 530 |
574 // Creates a AudioSourceInterface. | 531 // Creates a AudioSourceInterface. |
575 // |constraints| decides audio processing settings but can be NULL. | 532 // |constraints| decides audio processing settings but can be NULL. |
576 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( | 533 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( |
577 const MediaConstraintsInterface* constraints) = 0; | 534 const MediaConstraintsInterface* constraints) = 0; |
578 | 535 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
619 CreatePeerConnectionFactory( | 576 CreatePeerConnectionFactory( |
620 rtc::Thread* worker_thread, | 577 rtc::Thread* worker_thread, |
621 rtc::Thread* signaling_thread, | 578 rtc::Thread* signaling_thread, |
622 AudioDeviceModule* default_adm, | 579 AudioDeviceModule* default_adm, |
623 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 580 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
624 cricket::WebRtcVideoDecoderFactory* decoder_factory); | 581 cricket::WebRtcVideoDecoderFactory* decoder_factory); |
625 | 582 |
626 } // namespace webrtc | 583 } // namespace webrtc |
627 | 584 |
628 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ | 585 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ |
OLD | NEW |