|
1 /* |
|
2 * Copyright (c) 2008 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @PublishedAll |
|
22 */ |
|
23 |
|
24 #ifndef __MDNSCLIENT_H__ |
|
25 #define __MDNSCLIENT_H__ |
|
26 |
|
27 #include <e32base.h> |
|
28 #include <pnp/pnpparameterbundle.h> |
|
29 #include <mdns/cmdnsquerypublishnotifier.h> |
|
30 #include <mdns/cmdnsregisternotifier.h> |
|
31 #include "mdnsdebug.h" |
|
32 class RMdns : public RSessionBase |
|
33 { |
|
34 public: |
|
35 //These are the helper class which help in notifying the application observer |
|
36 //when the query and notify messages are served. |
|
37 friend class CMdnsQueryPublishNotifier; |
|
38 friend class CMdnsRegisterNotifier; |
|
39 /** |
|
40 * Opens a new session with the multicast DNS server. Must be called before |
|
41 * any other function may be used. |
|
42 * |
|
43 * @param aConnectionHandle Handle to the RConnection Object |
|
44 * @param aSocketServerHandle Handle to the RSocketServ Object |
|
45 * @param aObserver The callback function where the return values are commnunicated back |
|
46 * along with the error codes. |
|
47 * @return A CService object comprising a complete description of the service parameters. |
|
48 * @brief Opens a new session with the zeroconf server. |
|
49 */ |
|
50 |
|
51 IMPORT_C TInt Open(TInt aConnectionHandle); |
|
52 |
|
53 |
|
54 /** |
|
55 * ASynchronously lists all the available servicves of the type specified. |
|
56 * |
|
57 * @param aServiceType A unicode descriptor containing the type of the service you wish to resolve, including leading underscore (e.g. '_http'.) |
|
58 * @param aProtocol The protocol the service runs over, one of TCP or UDP. |
|
59 * @brief Asynchronously resolves a network service. |
|
60 */ |
|
61 |
|
62 IMPORT_C void QueryL( const RPnPParameterBundle& aQueryParams ); |
|
63 |
|
64 |
|
65 /** |
|
66 * ASynchronously resolves a network service. The results are returned using the Observer callback |
|
67 * |
|
68 * @param aServiceName A unicode descriptor containing the name of the service you wish to resolve. |
|
69 * @param aServiceType A unicode descriptor containing the type of the service you wish to resolve, including leading underscore (e.g. '_http'.) |
|
70 * @param aProtocol The protocol the service runs over, one of TCP or UDP. |
|
71 * @brief Asynchronously resolves a network service. |
|
72 */ |
|
73 |
|
74 IMPORT_C void ResolveL( const RPnPParameterBundle& aResolveParams ); |
|
75 |
|
76 |
|
77 |
|
78 /** |
|
79 * Registers a service on the local device and will send out presence announcement on the local link |
|
80 * |
|
81 * @param aServiceName A unicode descriptor containing the name of the service you wish to register. |
|
82 * @param aServiceType A unicode descriptor containing the type of the service you wish to register, including leading underscore (e.g. '_http'.) |
|
83 * @param aProtocol The protocol the service runs over, one of TCP or UDP. |
|
84 * @return Service registration id is returned |
|
85 * @brief |
|
86 */ |
|
87 |
|
88 IMPORT_C void RegisterServiceL( const RPnPParameterBundle& aPublishParams ,TBool aIsUpdate = EFalse); |
|
89 |
|
90 |
|
91 |
|
92 /** |
|
93 * Register receiving notification on the desired service instance names or types |
|
94 * |
|
95 * @param aServiceName A unicode descriptor containing the name of the service you wish to register for notification. |
|
96 * @param aServiceType A unicode descriptor containing the type of the service you wish to register for notification, |
|
97 * @param aProtocol The protocol the service runs over, one of TCP or UDP. |
|
98 * @return Service registration id is returned |
|
99 * @brief |
|
100 */ |
|
101 |
|
102 IMPORT_C void WaitForNotificationL( const RPnPParameterBundle& aNotifyParams ); |
|
103 |
|
104 |
|
105 /** |
|
106 * Cancel the ongoing request. |
|
107 * |
|
108 * @param aRequestType A enum specifying the type of request to be canceled. |
|
109 * @param aServiceName A unicode descriptor containing the name of the service . |
|
110 * @param aServiceType A unicode descriptor containing the type of the service , |
|
111 * @param aProtocol The protocol the service runs over, one of TCP or UDP. |
|
112 * @return |
|
113 * @brief |
|
114 */ |
|
115 |
|
116 IMPORT_C TInt Cancel( const RPnPParameterBundle& aCancelParams ); |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 /** |
|
122 * |
|
123 * De-register the service from the device and send out absence announcement on the local-link |
|
124 * |
|
125 * @param aServiceRegId A integer id that uniquely identifies a registered service. |
|
126 * @return Success or failure of the close request. |
|
127 * @brief |
|
128 */ |
|
129 |
|
130 IMPORT_C TInt Close(); |
|
131 |
|
132 /** |
|
133 Default Constructor |
|
134 */ |
|
135 IMPORT_C RMdns::RMdns(); |
|
136 |
|
137 |
|
138 private: |
|
139 /* |
|
140 * Based on the buffer size set by the query request Recieve Message is called |
|
141 * which return the set of records got from the query. |
|
142 * @param aData reference to a buffer to which the records should be set. |
|
143 */ |
|
144 void RecieveMessage(TDes8& aData); |
|
145 /* |
|
146 * These is an asynchroonous request called internally by the WaitForNotification request. |
|
147 * @param aData contains the list of new ptr records recieved on WaitForNotification request. |
|
148 * @param aStatus used to complete asynchronous request. |
|
149 */ |
|
150 void RecieveNotifyMessageL(TDes8& aData,TRequestStatus& aStatus); |
|
151 private: |
|
152 /* |
|
153 * Query and publish request will be notifies to this object. |
|
154 */ |
|
155 CMdnsQueryPublishNotifier* iEventNotifier; |
|
156 /* |
|
157 * Register for a paritcular record will be notified to this object. |
|
158 */ |
|
159 CMdnsRegisterNotifier* iRegisterNotifier; |
|
160 /* |
|
161 *Buffer used to store the data in the RPnPParameter bundle and send it across to |
|
162 *the server. |
|
163 */ |
|
164 HBufC8* iBuffer; |
|
165 /* |
|
166 * Keeps the count of entries requested for notification. |
|
167 */ |
|
168 TInt iNotifierCount; |
|
169 /* |
|
170 * Pointer to the descriptor iBuffer. |
|
171 */ |
|
172 TPtr8 iBufPointer; |
|
173 /** |
|
174 FLOGGER debug trace member variable. |
|
175 */ |
|
176 __FLOG_DECLARATION_MEMBER_MUTABLE; |
|
177 }; |
|
178 |
|
179 |
|
180 #endif /* __MDNSCLIENT_H__ */ |