|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CUpnpHttpServerSession is class that is used to handle single |
|
15 * connections to HttpServer |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef UPNPHTTPSERVERSESSION_H |
|
20 #define UPNPHTTPSERVERSESSION_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <es_sock.h> |
|
26 #include <in_sock.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CUpnpHttpServerRuntime; |
|
30 class MUpnpHttpServerObserver; |
|
31 class CUpnpHttpMessage; |
|
32 |
|
33 const TInt KUpnpHttpServerRandomPort = 0; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 /** |
|
37 * CUpnpHttpServerSession is used for starting and stopping http server |
|
38 * instance on random or predefined port. |
|
39 * It contains only one default runtime which handles all incoming request URLs. |
|
40 * @lib dlnawebserver.lib |
|
41 * @since S60 5.1 |
|
42 */ |
|
43 NONSHARABLE_CLASS( CUpnpHttpServerSession ) : public CBase |
|
44 { |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 * @param aUnusedIapId internet access point id (unused in current implementation) |
|
50 * @param aObserver observer to be notified about httpEvents |
|
51 */ |
|
52 IMPORT_C static CUpnpHttpServerSession* NewL( TUint aUnusedIapId, |
|
53 MUpnpHttpServerObserver& aObserver ); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 ~CUpnpHttpServerSession(); |
|
59 |
|
60 /** |
|
61 * Starts http server owned by this session. |
|
62 * |
|
63 * @since S60 5.1 |
|
64 * @param aPort port on which server starts, default value: KRandomPort |
|
65 */ |
|
66 IMPORT_C void StartL( const TInt aPort = KUpnpHttpServerRandomPort ); |
|
67 |
|
68 /** |
|
69 * Stops http server owned by this session. |
|
70 * |
|
71 * @since S60 5.1 |
|
72 */ |
|
73 IMPORT_C void Stop(); |
|
74 |
|
75 /** |
|
76 * Gets http server address (including port). |
|
77 * |
|
78 * @since S60 5.1 |
|
79 * @param aAddr used to return server address |
|
80 */ |
|
81 IMPORT_C void GetAddress( TInetAddr& aAddr ); |
|
82 |
|
83 /** |
|
84 * Gets default runtime. |
|
85 * |
|
86 * @since S60 5.1 |
|
87 * @return reference to http server runtime |
|
88 */ |
|
89 IMPORT_C CUpnpHttpServerRuntime& DefaultRuntime(); |
|
90 |
|
91 //For internal usage only. |
|
92 static CUpnpHttpServerSession* NewLC( TUint aUnusedIapId, |
|
93 MUpnpHttpServerObserver& aObserver ); |
|
94 IMPORT_C TSockAddr* HWAddressL(); |
|
95 IMPORT_C TInt SendMessageL( CUpnpHttpMessage* aMessage ); |
|
96 |
|
97 private: |
|
98 |
|
99 /** |
|
100 * Constructor for performing 1st stage construction. |
|
101 */ |
|
102 CUpnpHttpServerSession(); |
|
103 |
|
104 /** |
|
105 * EPOC default constructor for performing 2nd stage construction |
|
106 */ |
|
107 void ConstructL( TUint aUnusedIapId, MUpnpHttpServerObserver& aObserver ); |
|
108 |
|
109 private: // data |
|
110 |
|
111 // Pointer to server runtime, owned |
|
112 CUpnpHttpServerRuntime* iServerRuntime; |
|
113 }; |
|
114 |
|
115 #endif // UPNPHTTPSERVERSESSION_H |