|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // cinternalmessagequeue.h |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef CINTERNALMESSAGEQUEUE_H_ |
|
19 #define CINTERNALMESSAGEQUEUE_H_ |
|
20 |
|
21 //System Include |
|
22 #include <e32base.h> |
|
23 #include "mdnsdebug.h" |
|
24 class CMdnsServer; |
|
25 |
|
26 //Message type server handles as of now. |
|
27 enum TMessageType |
|
28 { |
|
29 EQueryMessage, |
|
30 EPublishMessage, |
|
31 ERegisterMessage |
|
32 }; |
|
33 /* |
|
34 * CInternalMessageQueue class is used to keep a refernce of all the services |
|
35 * requested by the client to the server. |
|
36 * There are two cases where this is used. |
|
37 * case1: |
|
38 * When the server is probing the hostname and it recieves a query or publish request. |
|
39 * case2: |
|
40 * When the server is adveritsing a packet and it reiceves one more request for advertizement. |
|
41 * |
|
42 * |
|
43 */ |
|
44 |
|
45 class CInternalMessageQueue : public CBase |
|
46 { |
|
47 public: |
|
48 static CInternalMessageQueue* NewL(CMdnsServer& aServer); |
|
49 ~CInternalMessageQueue(); |
|
50 void StartProcessing(); |
|
51 TInt Count(); |
|
52 void AppendMessageL(TMessageType aType, const RMessage2& aMessage,TInt aSessionId ); |
|
53 private: |
|
54 class TMessageObject |
|
55 { |
|
56 private: |
|
57 TMessageType iType; |
|
58 TInt iSessionId; |
|
59 RMessage2 iMessage; |
|
60 public: |
|
61 inline TMessageObject(TMessageType aType , const RMessage2& aMessage,TInt aSessionId):iType(aType), iMessage(aMessage),iSessionId(aSessionId){} |
|
62 inline const TMessageType Type()const{return iType;} |
|
63 inline const RMessage2& MessageObject()const {return iMessage;} |
|
64 inline const TInt SessionId()const{return iSessionId;} |
|
65 }; |
|
66 void ConstructL(); |
|
67 CInternalMessageQueue(CMdnsServer& aServer); |
|
68 |
|
69 private: |
|
70 TInt iQueueLength; |
|
71 RArray<TMessageObject> iMessageQueue; |
|
72 CMdnsServer& iServer; |
|
73 /** |
|
74 *FLOGGER debug trace member variable. |
|
75 */ |
|
76 __FLOG_DECLARATION_MEMBER_MUTABLE; |
|
77 |
|
78 }; |
|
79 |
|
80 |
|
81 #endif /* CINTERNALMESSAGEQUEUE_H_ */ |