24
|
1 |
// Copyright (c) 1997-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 |
//
|
|
15 |
|
|
16 |
#include "es_ver.h"
|
|
17 |
#include "es_prot.h"
|
|
18 |
#include "es_wsms.h"
|
|
19 |
#include "ws_main.h"
|
|
20 |
#include <es_prot_internal.h>
|
|
21 |
|
|
22 |
extern "C"
|
|
23 |
IMPORT_C CProtocolFamilyBase* InstallWAPSMS(void);
|
|
24 |
|
|
25 |
//
|
|
26 |
// Constructor
|
|
27 |
//
|
|
28 |
CWapSmsProtocolFamily::CWapSmsProtocolFamily()
|
|
29 |
{
|
|
30 |
|
|
31 |
__DECLARE_NAME(_S("CWapSmsProtocolFamily"));
|
|
32 |
} // CWapSmsProtocolFamily::CWapSmsProtocolFamily
|
|
33 |
|
|
34 |
|
|
35 |
//
|
|
36 |
// Factory
|
|
37 |
//
|
|
38 |
CWapSmsProtocolFamily * CWapSmsProtocolFamily::NewL()
|
|
39 |
{
|
|
40 |
LOGWAPPROT1("CWapSmsProtocolFamily::NewL()");
|
|
41 |
|
|
42 |
return new (ELeave)CWapSmsProtocolFamily;
|
|
43 |
} // CWapSmsProtocolFamily::NewL
|
|
44 |
|
|
45 |
|
|
46 |
//
|
|
47 |
// Nothing to be done
|
|
48 |
//
|
|
49 |
TInt CWapSmsProtocolFamily::Install()
|
|
50 |
{
|
|
51 |
LOGWAPPROT1("CWapSmsProtocolFamily::Install()");
|
|
52 |
|
|
53 |
return KErrNone;
|
|
54 |
} // CWapSmsProtocolFamily::Install
|
|
55 |
|
|
56 |
|
|
57 |
//
|
|
58 |
// Nothing to be done
|
|
59 |
//
|
|
60 |
TInt CWapSmsProtocolFamily::Remove()
|
|
61 |
{
|
|
62 |
LOGWAPPROT1("CWapSmsProtocolFamily::Remove()");
|
|
63 |
|
|
64 |
return KErrNone;
|
|
65 |
} // CWapSmsProtocolFamily::Remove
|
|
66 |
|
|
67 |
|
|
68 |
//
|
|
69 |
// Return a new CWapSmsProtocol
|
|
70 |
//
|
|
71 |
CProtocolBase * CWapSmsProtocolFamily::NewProtocolL(TUint aSockType,TUint /*aProtocol*/)
|
|
72 |
{
|
|
73 |
LOGWAPPROT1("CWapSmsProtocolFamily::NewProtocolL()");
|
|
74 |
|
|
75 |
if (aSockType!=KSockDatagram)
|
|
76 |
return NULL;
|
|
77 |
|
|
78 |
return CWapSmsProtocol::NewL();
|
|
79 |
} // CWapSmsProtocolFamily::NewProtocolL
|
|
80 |
|
|
81 |
|
|
82 |
//
|
|
83 |
// Create a description of the WapSms protocol
|
|
84 |
//
|
|
85 |
TUint CWapSmsProtocolFamily::ProtocolList(TServerProtocolDesc *& aProtocolList)
|
|
86 |
{
|
|
87 |
LOGWAPPROT1("CWapSmsProtocolFamily::ProtocolList()");
|
|
88 |
|
|
89 |
TRAPD(ret, (aProtocolList=new(ELeave) TServerProtocolDesc[1]) );
|
|
90 |
if(ret!=KErrNone)
|
|
91 |
return 0;
|
|
92 |
|
|
93 |
// Datagram protocol
|
|
94 |
aProtocolList[0].iName=KWAPSMSProtocolId;
|
|
95 |
aProtocolList[0].iAddrFamily=KWAPSMSAddrFamily;
|
|
96 |
aProtocolList[0].iSockType=KSockDatagram;
|
|
97 |
aProtocolList[0].iProtocol=KWAPSMSDatagramProtocol;
|
|
98 |
|
|
99 |
aProtocolList[0].iVersion=TVersion(KWapSmsMajorVersionNumber,KWapSmsMinorVersionNumber,KWapSmsBuildVersionNumber);
|
|
100 |
aProtocolList[0].iByteOrder=ELittleEndian;
|
|
101 |
aProtocolList[0].iServiceInfo=KWAPSMSDatagramServiceInfo;
|
|
102 |
aProtocolList[0].iNamingServices=0;
|
|
103 |
aProtocolList[0].iSecurity=KSocketNoSecurity;
|
|
104 |
aProtocolList[0].iMessageSize=KWAPSMSMaxDatagramSize;
|
|
105 |
aProtocolList[0].iServiceTypeInfo=ESocketSupport;
|
|
106 |
aProtocolList[0].iNumSockets=KWAPSMSNumberSockets;
|
|
107 |
return 1;
|
|
108 |
} // CWapSmsProtocolFamily::ProtocolList
|
|
109 |
|
|
110 |
|
|
111 |
//
|
|
112 |
// Create a new protocol family
|
|
113 |
//
|
|
114 |
EXPORT_C CProtocolFamilyBase * InstallWAPSMS(void)
|
|
115 |
{
|
|
116 |
LOGWAPPROT4("InstallWAPSMS [version %d.%d.%d]",
|
|
117 |
KWapSmsMajorVersionNumber,
|
|
118 |
KWapSmsMinorVersionNumber,
|
|
119 |
KWapSmsBuildVersionNumber
|
|
120 |
);
|
|
121 |
|
|
122 |
CWapSmsProtocolFamily* wapProt=NULL;
|
|
123 |
TRAPD(ret, (wapProt=CWapSmsProtocolFamily::NewL()) );
|
|
124 |
if (ret==KErrNone)
|
|
125 |
return wapProt;
|
|
126 |
return NULL;
|
|
127 |
} // CWapSmsProtocolFamily::ProtocolList
|