zeroconf/client/src/mdnsparamsextfactory.cpp
changeset 14 da856f45b798
equal deleted inserted replaced
12:78fbd574edf4 14:da856f45b798
       
     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 // ecom_impl.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <e32base.h>
       
    19 #include <comms-infras/metabuffer.h>
       
    20 #include "mdnsparamsextfactory.h"
       
    21 #include "mdnsparamset.h"
       
    22 
       
    23 
       
    24 START_ATTRIBUTE_TABLE(CMDnsQueryRequestParamSet, KMDnsParamsFactoryUid, EMDnsDiscoverRequestParamSet)
       
    25 	REGISTER_ATTRIBUTE(CMDnsQueryRequestParamSet, iInstanceName, TMetaBuf8)
       
    26 	REGISTER_ATTRIBUTE(CMDnsQueryRequestParamSet, iQueryType, TMetaNumber)
       
    27 	REGISTER_ATTRIBUTE(CMDnsQueryRequestParamSet, iProtocol, TMetaNumber)
       
    28 	REGISTER_ATTRIBUTE(CMDnsQueryRequestParamSet, iServiceType, TMetaBuf8)
       
    29 END_ATTRIBUTE_TABLE()
       
    30 
       
    31 
       
    32 START_ATTRIBUTE_TABLE(CMDnsPtrParamSet, KMDnsParamsFactoryUid, EMdnsPtrParamset)
       
    33 	REGISTER_ATTRIBUTE(CMDnsPtrParamSet, iInstanceName, TMetaBuf8)
       
    34 	REGISTER_ATTRIBUTE(CMDnsPtrParamSet, iDomainName, TMetaBuf8)
       
    35 	REGISTER_ATTRIBUTE(CMDnsPtrParamSet, iTtl, TMetaNumber)
       
    36 	END_ATTRIBUTE_TABLE()
       
    37 
       
    38 START_ATTRIBUTE_TABLE(CMDnsSrvParamSet, KMDnsParamsFactoryUid, EMdnsSrvParamset)
       
    39 	REGISTER_ATTRIBUTE(CMDnsSrvParamSet, iDomainName, TMetaBuf8)
       
    40 	REGISTER_ATTRIBUTE(CMDnsSrvParamSet, iTarget, TMetaBuf8)
       
    41 	REGISTER_ATTRIBUTE(CMDnsSrvParamSet, iPrio, TMetaNumber)
       
    42 	REGISTER_ATTRIBUTE(CMDnsSrvParamSet, iWeight, TMetaNumber)
       
    43 	REGISTER_ATTRIBUTE(CMDnsSrvParamSet, iPort, TMetaNumber)
       
    44 END_ATTRIBUTE_TABLE()
       
    45 
       
    46 START_ATTRIBUTE_TABLE(CMDnsAddrParamSet, KMDnsParamsFactoryUid, EMdnsAddrParamset)
       
    47 	REGISTER_ATTRIBUTE(CMDnsAddrParamSet, iDomainName, TMetaBuf8)
       
    48 	REGISTER_ATTRIBUTE(CMDnsAddrParamSet, iAddr, TMeta<TInetAddr>)
       
    49 END_ATTRIBUTE_TABLE()
       
    50 
       
    51 START_ATTRIBUTE_TABLE(CMDnsTxtParamSet, KMDnsParamsFactoryUid, EMdnsTxtParamset)
       
    52 	REGISTER_ATTRIBUTE(CMDnsTxtParamSet, iDomainName, TMetaBuf8)
       
    53 	REGISTER_ATTRIBUTE(CMDnsTxtParamSet, iTxtData, TMetaBuf8)
       
    54 END_ATTRIBUTE_TABLE()
       
    55 
       
    56 START_ATTRIBUTE_TABLE(CMDnsPublishResponseParamSet, KMDnsParamsFactoryUid, EMdnsPublishResponseParamset)
       
    57     REGISTER_ATTRIBUTE(CMDnsPublishResponseParamSet, iDomainName, TMetaBuf8)
       
    58     REGISTER_ATTRIBUTE(CMDnsPublishResponseParamSet, iError, TMetaNumber)
       
    59 END_ATTRIBUTE_TABLE()
       
    60 
       
    61 START_ATTRIBUTE_TABLE(CMDnsRegisterNotifyParamSet, KMDnsParamsFactoryUid, EMdnsRegisterNotifyParamset)
       
    62     REGISTER_ATTRIBUTE(CMDnsRegisterNotifyParamSet, iInstanceName, TMetaBuf8)
       
    63 END_ATTRIBUTE_TABLE()
       
    64 
       
    65 START_ATTRIBUTE_TABLE(CMDnsPublishParamSet, KMDnsParamsFactoryUid, EMdnsPublishParamset)
       
    66     REGISTER_ATTRIBUTE(CMDnsPublishParamSet, isPublish, TMetaNumber)
       
    67 END_ATTRIBUTE_TABLE()
       
    68 CMDnsParamSetBase* CMDnsParamsExtFactory::NewL ( TAny* aConstructionParams )
       
    69 	{
       
    70 	const TInt32 familyType = reinterpret_cast<TInt32>(aConstructionParams);
       
    71 	CMDnsParamSetBase* myMDnsParamBase = NULL;
       
    72 	switch ( familyType )
       
    73 		{
       
    74 		case EMDnsDiscoverRequestParamSet:		
       
    75 			myMDnsParamBase = new (ELeave) CMDnsQueryRequestParamSet;
       
    76 		break;
       
    77 		
       
    78 		case EMdnsPtrParamset:
       
    79 			myMDnsParamBase = new (ELeave) CMDnsPtrParamSet;
       
    80 		break;
       
    81 		
       
    82 		case EMdnsSrvParamset :
       
    83 			myMDnsParamBase = new (ELeave) CMDnsSrvParamSet;
       
    84 		break;
       
    85 			
       
    86 		case EMdnsAddrParamset :
       
    87 			myMDnsParamBase = new (ELeave) CMDnsAddrParamSet;
       
    88 		break;
       
    89 		
       
    90 		case EMdnsTxtParamset :
       
    91 		 	myMDnsParamBase = new (ELeave) CMDnsTxtParamSet;
       
    92 		break;
       
    93 		
       
    94 		case EMdnsPublishResponseParamset:
       
    95 		    myMDnsParamBase = new (ELeave) CMDnsPublishResponseParamSet;
       
    96 		break;
       
    97 		
       
    98 		case EMdnsRegisterNotifyParamset:
       
    99 		    myMDnsParamBase = new (ELeave) CMDnsRegisterNotifyParamSet;
       
   100 		break;
       
   101 		
       
   102 		case EMdnsPublishParamset:
       
   103 		myMDnsParamBase = new (ELeave) CMDnsPublishParamSet;
       
   104 		break;
       
   105 				
       
   106 		default:
       
   107 			ASSERT(0);
       
   108 		break;
       
   109 		}
       
   110 	return myMDnsParamBase;
       
   111 	}
       
   112