|
1 /** @file |
|
2 * Copyright (c) 2005-2006 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 #include "upnphttpserversession.h" |
|
20 #include "upnphttpserverruntime.h" |
|
21 #include "upnphttpserver.h" |
|
22 |
|
23 // ----------------------------------------------------------------------------- |
|
24 // CUpnpHttpServerSession::CUpnpHttpServerSession |
|
25 // ----------------------------------------------------------------------------- |
|
26 // |
|
27 CUpnpHttpServerSession::CUpnpHttpServerSession() |
|
28 { |
|
29 // No implementation required |
|
30 } |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CUpnpHttpServerSession::~CUpnpHttpServerSession |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 CUpnpHttpServerSession::~CUpnpHttpServerSession() |
|
37 { |
|
38 delete iServerRuntime; |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CUpnpHttpServerSession::NewLC |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 CUpnpHttpServerSession* CUpnpHttpServerSession::NewLC( |
|
46 TUint aUnusedIapId, MUpnpHttpServerObserver& aObserver ) |
|
47 { |
|
48 CUpnpHttpServerSession* self = new (ELeave) CUpnpHttpServerSession(); |
|
49 CleanupStack::PushL( self ); |
|
50 self->ConstructL( aUnusedIapId, aObserver ); |
|
51 return self; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CUpnpHttpServerSession::NewL |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 EXPORT_C CUpnpHttpServerSession* CUpnpHttpServerSession::NewL( |
|
59 TUint aUnusedIapId, MUpnpHttpServerObserver& aObserver ) |
|
60 { |
|
61 CUpnpHttpServerSession* self = CUpnpHttpServerSession::NewLC( aUnusedIapId, aObserver ); |
|
62 CleanupStack::Pop( self ); |
|
63 return self; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CUpnpHttpServerSession::ConstructL |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 void CUpnpHttpServerSession::ConstructL( |
|
71 TUint aUnusedIapId, MUpnpHttpServerObserver& aObserver ) |
|
72 { |
|
73 iServerRuntime = CUpnpHttpServerRuntime::NewL( aUnusedIapId, aObserver ); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CUpnpHttpServerSession::StartL |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 EXPORT_C void CUpnpHttpServerSession::StartL( const TInt aPort ) |
|
81 { |
|
82 iServerRuntime->StartServerL( aPort ) ; |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CUpnpHttpServerSession::Stop |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 EXPORT_C void CUpnpHttpServerSession::Stop() |
|
90 { |
|
91 iServerRuntime->DeleteServer(); |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // CUpnpHttpServerSession::GetAddress |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 EXPORT_C void CUpnpHttpServerSession::GetAddress( TInetAddr& aAddr ) |
|
99 { |
|
100 iServerRuntime->HttpServer().ServerAddress( aAddr ); |
|
101 aAddr.SetPort( iServerRuntime->HttpServer().ServerPort() ); |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CUpnpHttpServerSession::DefaultRuntime |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 EXPORT_C CUpnpHttpServerRuntime& CUpnpHttpServerSession::DefaultRuntime() |
|
109 { |
|
110 return *iServerRuntime; |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CUpnpHttpServerSession::SendMessageL |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 EXPORT_C TInt CUpnpHttpServerSession::SendMessageL( CUpnpHttpMessage* aMessage ) |
|
118 { |
|
119 return iServerRuntime->HttpServer().SendMessageL( aMessage ); |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // CUpnpHttpServerSession::HWAddressL |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 EXPORT_C TSockAddr* CUpnpHttpServerSession::HWAddressL() |
|
127 { |
|
128 return iServerRuntime->HttpServer().HWAddressL(); |
|
129 } |
|
130 |