|
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: Produces SSDP messages |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "upnpssdpmessagefactory.h" |
|
21 #include "upnpcons.h" |
|
22 |
|
23 // ============================ MEMBER FUNCTIONS =============================== |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // RUpnpSsdpMessageFactory::AdvertiseAliveL |
|
27 // |
|
28 // (other items were commented in a header). |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 EXPORT_C CSsdpAdvertise* RUpnpSsdpMessageFactory::AdvertiseAliveL( TDesC8& aLoc, |
|
32 TDesC8& aNt, |
|
33 TDesC8& aUsn, |
|
34 TDesC8& aServerDesc ) |
|
35 { |
|
36 CUpnpSsdpMessage* msg = CUpnpSsdpMessage::NewL( CUpnpSsdpMessage::ERequestNotify ); |
|
37 CleanupStack::PushL(msg); |
|
38 |
|
39 msg->AddHostL( (TDesC8&) UpnpSSDP::KDefaultHost); |
|
40 msg->AddCacheControlL( (TDesC8&) UpnpSSDP::KDefaultMaxAge); |
|
41 msg->AddLocationL(aLoc); |
|
42 msg->AddNotificationTypeL(aNt); |
|
43 msg->AddServerL(aServerDesc); |
|
44 msg->AddUsnL(aUsn); |
|
45 |
|
46 CleanupStack::Pop(); // msg |
|
47 |
|
48 return msg; |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // RUpnpSsdpMessageFactory::AdvertiseByebyeL |
|
53 // |
|
54 // (other items were commented in a header). |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C CSsdpAdvertise* RUpnpSsdpMessageFactory::AdvertiseByebyeL( TDesC8& aNt, |
|
58 TDesC8& aUsn ) |
|
59 { |
|
60 |
|
61 CUpnpSsdpMessage* msg = CUpnpSsdpMessage::NewL(CUpnpSsdpMessage::ERequestByeBye); |
|
62 CleanupStack::PushL(msg); |
|
63 |
|
64 msg->AddNotificationTypeL(aNt); |
|
65 msg->AddHostL( (TDesC8&) UpnpSSDP::KDefaultHost); |
|
66 msg->AddUsnL(aUsn); |
|
67 |
|
68 CleanupStack::Pop(); // msg |
|
69 |
|
70 return msg; |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // RUpnpSsdpMessageFactory::SearchL |
|
75 // |
|
76 // (other items were commented in a header). |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C CSsdpSearch* RUpnpSsdpMessageFactory::SearchL( TDesC8& aTarget ) |
|
80 { |
|
81 CUpnpSsdpMessage* msg = CUpnpSsdpMessage::NewL(CUpnpSsdpMessage::ERequestUndefined); |
|
82 CleanupStack::PushL(msg); |
|
83 |
|
84 msg->AddPairL(UpnpSSDP::KMethodMSearch(), KNullDesC8()); |
|
85 msg->AddPairL(UpnpSSDP::KHdrMx(), UpnpSSDP::KDefaultResponseDelay()); |
|
86 msg->AddPairL(UpnpSSDP::KHdrSt(), aTarget); |
|
87 msg->AddPairL(UpnpSSDP::KHdrHost(), (TDesC8&) UpnpSSDP::KDefaultHost); |
|
88 msg->AddPairL(UpnpSSDP::KHdrMan(), UpnpSSDP::KNotificationDiscover()); |
|
89 CleanupStack::Pop(); // msg |
|
90 |
|
91 return msg; |
|
92 |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // RUpnpSsdpMessageFactory::SearchL |
|
97 // |
|
98 // (other items were commented in a header). |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 EXPORT_C CSsdpSearch* RUpnpSsdpMessageFactory::SearchL( TDesC8& aTarget, |
|
102 TDesC8& aMaximumWaitTime) |
|
103 { |
|
104 CUpnpSsdpMessage* msg = CUpnpSsdpMessage::NewL(CUpnpSsdpMessage::ERequestSearch); |
|
105 CleanupStack::PushL(msg); |
|
106 |
|
107 msg->AddMxL(aMaximumWaitTime); |
|
108 msg->AddSearchTargetStringL(aTarget); |
|
109 msg->AddHostL((TDesC8&) UpnpSSDP::KDefaultHost()); |
|
110 |
|
111 CleanupStack::Pop(); // msg |
|
112 return msg; |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // RUpnpSsdpMessageFactory::ResponseL |
|
117 // |
|
118 // (other items were commented in a header). |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 EXPORT_C CSsdpSearchResponse* RUpnpSsdpMessageFactory::ResponseL( TDesC8& aSt, |
|
122 TDesC8& aUsn, |
|
123 TDesC8& aLoc, |
|
124 TDesC8& aServerDesc ) |
|
125 { |
|
126 |
|
127 CUpnpSsdpMessage* msg = CUpnpSsdpMessage::NewL(CUpnpSsdpMessage::ERequestSearchResponse); |
|
128 CleanupStack::PushL(msg); |
|
129 |
|
130 msg->AddCacheControlL( (TDesC8&) UpnpSSDP::KDefaultMaxAge); |
|
131 // Date and EXT-header will be generated automatically. |
|
132 msg->AddLocationL(aLoc); |
|
133 msg->AddServerL(aServerDesc); |
|
134 msg->AddSearchTargetStringL(aSt); |
|
135 msg->AddUsnL(aUsn); |
|
136 |
|
137 CleanupStack::Pop(); // msg |
|
138 |
|
139 return msg; |
|
140 |
|
141 } |
|
142 |
|
143 // End of File |