|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim: set sw=2 ts=8 et tw=80 : */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef RtspChannelParent_h |
|
8 #define RtspChannelParent_h |
|
9 |
|
10 #include "mozilla/net/PRtspChannelParent.h" |
|
11 #include "mozilla/net/NeckoParent.h" |
|
12 #include "nsBaseChannel.h" |
|
13 #include "nsIParentChannel.h" |
|
14 |
|
15 namespace mozilla { |
|
16 namespace net { |
|
17 |
|
18 //----------------------------------------------------------------------------- |
|
19 // Note: RtspChannel doesn't transport streams as normal channel does. |
|
20 // (See RtspChannelChild.h for detail). |
|
21 // The reason for the existence of RtspChannelParent is to support HTTP->RTSP |
|
22 // redirection. |
|
23 // When redirection happens, two instances of RtspChannelParent will be created: |
|
24 // - One will be created when HTTP creates the new channel for redirects, and |
|
25 // will be registered as an nsIChannel. |
|
26 // - The other will be created via IPDL by RtspChannelChild, and will be |
|
27 // registered as an nsIParentChannel. |
|
28 class RtspChannelParent : public PRtspChannelParent |
|
29 , public nsBaseChannel |
|
30 , public nsIParentChannel |
|
31 { |
|
32 public: |
|
33 NS_DECL_ISUPPORTS |
|
34 NS_DECL_NSIPARENTCHANNEL |
|
35 |
|
36 RtspChannelParent(nsIURI *aUri); |
|
37 ~RtspChannelParent(); |
|
38 |
|
39 // nsBaseChannel::nsIChannel |
|
40 NS_IMETHOD GetContentType(nsACString & aContentType) MOZ_OVERRIDE MOZ_FINAL; |
|
41 NS_IMETHOD AsyncOpen(nsIStreamListener *listener, |
|
42 nsISupports *aContext) MOZ_OVERRIDE MOZ_FINAL; |
|
43 |
|
44 // nsBaseChannel::nsIStreamListener::nsIRequestObserver |
|
45 NS_IMETHOD OnStartRequest(nsIRequest *aRequest, |
|
46 nsISupports *aContext) MOZ_OVERRIDE MOZ_FINAL; |
|
47 NS_IMETHOD OnStopRequest(nsIRequest *aRequest, |
|
48 nsISupports *aContext, |
|
49 nsresult aStatusCode) MOZ_OVERRIDE MOZ_FINAL; |
|
50 |
|
51 // nsBaseChannel::nsIStreamListener |
|
52 NS_IMETHOD OnDataAvailable(nsIRequest *aRequest, |
|
53 nsISupports *aContext, |
|
54 nsIInputStream *aInputStream, |
|
55 uint64_t aOffset, |
|
56 uint32_t aCount) MOZ_OVERRIDE MOZ_FINAL; |
|
57 |
|
58 // nsBaseChannel::nsIChannel::nsIRequest |
|
59 NS_IMETHOD Cancel(nsresult status) MOZ_OVERRIDE MOZ_FINAL; |
|
60 NS_IMETHOD Suspend() MOZ_OVERRIDE MOZ_FINAL; |
|
61 NS_IMETHOD Resume() MOZ_OVERRIDE MOZ_FINAL; |
|
62 |
|
63 // nsBaseChannel |
|
64 NS_IMETHOD OpenContentStream(bool aAsync, |
|
65 nsIInputStream **aStream, |
|
66 nsIChannel **aChannel) MOZ_OVERRIDE MOZ_FINAL; |
|
67 |
|
68 // RtspChannelParent |
|
69 bool Init(const RtspChannelConnectArgs& aArgs); |
|
70 |
|
71 protected: |
|
72 // Used to connect redirected-to channel in parent with just created |
|
73 // ChildChannel. Used during HTTP->RTSP redirection. |
|
74 bool ConnectChannel(const uint32_t& channelId); |
|
75 |
|
76 private: |
|
77 bool mIPCClosed; |
|
78 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; |
|
79 }; |
|
80 |
|
81 } // namespace net |
|
82 } // namespace mozilla |
|
83 |
|
84 #endif // RtspChannelParent_h |