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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 // After this method is called, the port allocator should consider loopback | 461 // After this method is called, the port allocator should consider loopback |
462 // network interfaces as well. | 462 // network interfaces as well. |
463 virtual void SetNetworkIgnoreMask(int network_ignore_mask) { | 463 virtual void SetNetworkIgnoreMask(int network_ignore_mask) { |
464 } | 464 } |
465 | 465 |
466 protected: | 466 protected: |
467 PortAllocatorFactoryInterface() {} | 467 PortAllocatorFactoryInterface() {} |
468 ~PortAllocatorFactoryInterface() {} | 468 ~PortAllocatorFactoryInterface() {} |
469 }; | 469 }; |
470 | 470 |
471 // TODO(hbos): Remove once cr/1176383004 lands. | |
472 class DTLSIdentityServiceInterface { | |
473 public: | |
474 // Asynchronously request a DTLS identity, including a self-signed certificate | |
475 // and the private key used to sign the certificate, from the identity store | |
476 // for the given identity name. | |
477 // DTLSIdentityRequestObserver::OnSuccess will be called with the identity if | |
478 // the request succeeded; DTLSIdentityRequestObserver::OnFailure will be | |
479 // called with an error code if the request failed. | |
480 // | |
481 // Only one request can be made at a time. If a second request is called | |
482 // before the first one completes, RequestIdentity will abort and return | |
483 // false. | |
484 // | |
485 // |identity_name| is an internal name selected by the client to identify an | |
486 // identity within an origin. E.g. an web site may cache the certificates used | |
487 // to communicate with differnent peers under different identity names. | |
488 // | |
489 // |common_name| is the common name used to generate the certificate. If the | |
490 // certificate already exists in the store, |common_name| is ignored. | |
491 // | |
492 // |observer| is the object to receive success or failure callbacks. | |
493 // | |
494 // Returns true if either OnFailure or OnSuccess will be called. | |
495 virtual bool RequestIdentity( | |
496 const std::string& identity_name, | |
497 const std::string& common_name, | |
498 DTLSIdentityRequestObserver* observer) = 0; | |
499 | |
500 virtual ~DTLSIdentityServiceInterface() {} | |
501 }; | |
502 | |
503 // PeerConnectionFactoryInterface is the factory interface use for creating | 471 // PeerConnectionFactoryInterface is the factory interface use for creating |
504 // PeerConnection, MediaStream and media tracks. | 472 // PeerConnection, MediaStream and media tracks. |
505 // PeerConnectionFactoryInterface will create required libjingle threads, | 473 // PeerConnectionFactoryInterface will create required libjingle threads, |
506 // socket and network manager factory classes for networking. | 474 // socket and network manager factory classes for networking. |
507 // If an application decides to provide its own threads and network | 475 // If an application decides to provide its own threads and network |
508 // implementation of these classes it should use the alternate | 476 // implementation of these classes it should use the alternate |
509 // CreatePeerConnectionFactory method which accepts threads as input and use the | 477 // CreatePeerConnectionFactory method which accepts threads as input and use the |
510 // CreatePeerConnection version that takes a PortAllocatorFactoryInterface as | 478 // CreatePeerConnection version that takes a PortAllocatorFactoryInterface as |
511 // argument. | 479 // argument. |
512 class PeerConnectionFactoryInterface : public rtc::RefCountInterface { | 480 class PeerConnectionFactoryInterface : public rtc::RefCountInterface { |
(...skipping 15 matching lines...) Expand all Loading... |
528 int network_ignore_mask; | 496 int network_ignore_mask; |
529 | 497 |
530 // Sets the maximum supported protocol version. The highest version | 498 // Sets the maximum supported protocol version. The highest version |
531 // supported by both ends will be used for the connection, i.e. if one | 499 // supported by both ends will be used for the connection, i.e. if one |
532 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. | 500 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. |
533 rtc::SSLProtocolVersion ssl_max_version; | 501 rtc::SSLProtocolVersion ssl_max_version; |
534 }; | 502 }; |
535 | 503 |
536 virtual void SetOptions(const Options& options) = 0; | 504 virtual void SetOptions(const Options& options) = 0; |
537 | 505 |
538 // TODO(hbos): Temporary CreatePeerConnection function while we transition | |
539 // from DTLSIdentityServiceInterface to DtlsIdentityStoreInterface. | |
540 // This method takes the ownership of |dtls_identity_service|. | |
541 rtc::scoped_refptr<PeerConnectionInterface> | |
542 CreatePeerConnection( | |
543 const PeerConnectionInterface::RTCConfiguration& configuration, | |
544 const MediaConstraintsInterface* constraints, | |
545 PortAllocatorFactoryInterface* allocator_factory, | |
546 DTLSIdentityServiceInterface* dtls_identity_service, | |
547 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, | |
548 PeerConnectionObserver* observer) { | |
549 if (dtls_identity_service) { | |
550 // Store used instead of service, our ownership responsibility to delete. | |
551 delete dtls_identity_service; | |
552 } | |
553 return CreatePeerConnection(configuration, constraints, allocator_factory, | |
554 dtls_identity_store.Pass(), observer); | |
555 } | |
556 | |
557 virtual rtc::scoped_refptr<PeerConnectionInterface> | 506 virtual rtc::scoped_refptr<PeerConnectionInterface> |
558 CreatePeerConnection( | 507 CreatePeerConnection( |
559 const PeerConnectionInterface::RTCConfiguration& configuration, | 508 const PeerConnectionInterface::RTCConfiguration& configuration, |
560 const MediaConstraintsInterface* constraints, | 509 const MediaConstraintsInterface* constraints, |
561 PortAllocatorFactoryInterface* allocator_factory, | 510 PortAllocatorFactoryInterface* allocator_factory, |
562 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, | 511 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
563 PeerConnectionObserver* observer) = 0; | 512 PeerConnectionObserver* observer) = 0; |
564 | 513 |
565 // TODO(hbos): Remove below version after clients are updated to above method. | 514 // TODO(hbos): Remove below version after clients are updated to above method. |
566 // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration, | 515 // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 CreatePeerConnectionFactory( | 580 CreatePeerConnectionFactory( |
632 rtc::Thread* worker_thread, | 581 rtc::Thread* worker_thread, |
633 rtc::Thread* signaling_thread, | 582 rtc::Thread* signaling_thread, |
634 AudioDeviceModule* default_adm, | 583 AudioDeviceModule* default_adm, |
635 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 584 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
636 cricket::WebRtcVideoDecoderFactory* decoder_factory); | 585 cricket::WebRtcVideoDecoderFactory* decoder_factory); |
637 | 586 |
638 } // namespace webrtc | 587 } // namespace webrtc |
639 | 588 |
640 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ | 589 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ |
OLD | NEW |