epoc32/include/btsdp.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
/**
williamr@2
    17
 @file
williamr@2
    18
 @publishedAll
williamr@2
    19
 @released
williamr@2
    20
*/
williamr@2
    21
#ifndef BTSDP_H
williamr@2
    22
#define BTSDP_H
williamr@2
    23
williamr@2
    24
#include <e32base.h>
williamr@2
    25
#include <bttypes.h>
williamr@2
    26
williamr@2
    27
williamr@2
    28
/** The UID of the SDP Server. 
williamr@2
    29
williamr@2
    30
@see TBTServiceSecurity */
williamr@2
    31
static const TUid KUidServiceSDP			= {0x100095FA};
williamr@2
    32
williamr@2
    33
/** Attribute ID. */
williamr@2
    34
typedef TUint16 TSdpAttributeID;
williamr@2
    35
williamr@2
    36
// Universal Attributes
williamr@2
    37
/** Service Record Handle. */
williamr@2
    38
static const TSdpAttributeID KSdpAttrIdServiceRecordHandle = 0x0000;
williamr@2
    39
/** Service ClassID List. */
williamr@2
    40
static const TSdpAttributeID KSdpAttrIdServiceClassIDList = 0x0001;
williamr@2
    41
/** Service Record State. */
williamr@2
    42
static const TSdpAttributeID KSdpAttrIdServiceRecordState = 0x0002;
williamr@2
    43
/** ServiceID. */
williamr@2
    44
static const TSdpAttributeID KSdpAttrIdServiceID = 0x0003;
williamr@2
    45
/** Protocol Descriptor List. */
williamr@2
    46
static const TSdpAttributeID KSdpAttrIdProtocolDescriptorList = 0x0004;
williamr@2
    47
/** Browse Group List. */
williamr@2
    48
static const TSdpAttributeID KSdpAttrIdBrowseGroupList = 0x0005;
williamr@2
    49
/** Language Base Attribute ID List. */
williamr@2
    50
static const TSdpAttributeID KSdpAttrIdLanguageBaseAttributeIDList = 0x0006;
williamr@2
    51
/** Service Info Time To Live. */
williamr@2
    52
static const TSdpAttributeID KSdpAttrIdServiceInfoTimeToLive = 0x0007;
williamr@2
    53
/** Service Availability. */
williamr@2
    54
static const TSdpAttributeID KSdpAttrIdServiceAvailability = 0x0008;
williamr@2
    55
/** Bluetooth Profile Descriptor List. */
williamr@2
    56
static const TSdpAttributeID KSdpAttrIdBluetoothProfileDescriptorList = 0x0009;
williamr@2
    57
/** Documentation URL. */
williamr@2
    58
static const TSdpAttributeID KSdpAttrIdDocumentationURL = 0x000A;
williamr@2
    59
/** Client Executable URL. */
williamr@2
    60
static const TSdpAttributeID KSdpAttrIdClientExecutableURL = 0x000B;
williamr@2
    61
/** Icon URL. */
williamr@2
    62
static const TSdpAttributeID KSdpAttrIdIconURL = 0x000C;
williamr@4
    63
/** Additional protocol descriptor list. */
williamr@4
    64
static const TSdpAttributeID KSdpAttrIdAdditionalProtocolDescriptorList = 0x000D;
williamr@2
    65
williamr@2
    66
williamr@2
    67
/** PAN Profile Security enforcement */
williamr@2
    68
static const TSdpAttributeID KSdpAttrIdSecurityDescription = 0x030a;
williamr@2
    69
williamr@2
    70
/** PAN Profile, NAP access type */
williamr@2
    71
static const TSdpAttributeID KSdpAttrIdNetAccessType = 0x030b;
williamr@2
    72
williamr@2
    73
/** PAN Profile, NAP maximum throughput of uplink network (octets/second) */
williamr@2
    74
static const TSdpAttributeID KSdpAttrIdMaxNetAccessRate = 0x030c;
williamr@2
    75
williamr@2
    76
/** PAN Profile, NAP IPv4 Subnet */
williamr@2
    77
static const TSdpAttributeID KSdpAttrIdIPv4Subnet = 0x030d;
williamr@2
    78
williamr@2
    79
/** PAN Profile, NAP IPv6 Subnet */
williamr@2
    80
static const TSdpAttributeID KSdpAttrIdIPv6Subnet = 0x030e;
williamr@2
    81
williamr@2
    82
/** SupportedCapabilities */
williamr@2
    83
static const TSdpAttributeID KSdpAttrIdSupportedCapabilities = 0x0310;
williamr@2
    84
/** SupportedFeatures */
williamr@2
    85
static const TSdpAttributeID KSdpAttrIdSupportedFeatures = 0x0311;
williamr@2
    86
/** SupportedFunctions */
williamr@2
    87
static const TSdpAttributeID KSdpAttrIdSupportedFunctions = 0x0312;
williamr@2
    88
williamr@2
    89
williamr@2
    90
// Language specific attributes
williamr@2
    91
williamr@2
    92
/** Primary Language. */
williamr@2
    93
static const TSdpAttributeID KSdpAttrIdBasePrimaryLanguage = 0x0100;
williamr@2
    94
static const TSdpAttributeID KSdpAttrIdCharacterEncodingUTF8 = 0x006a;
williamr@2
    95
williamr@2
    96
/** Service Name.
williamr@2
    97
williamr@2
    98
This is an offset that should be added to the attribute ID base (contained 
williamr@2
    99
in the LanguageBaseAttributeIDList attribute). */
williamr@2
   100
static const TInt KSdpAttrIdOffsetServiceName = 0x0000; // + Language offset
williamr@2
   101
williamr@2
   102
williamr@2
   103
/** Service Description.
williamr@2
   104
williamr@2
   105
This is an offset that should be added to the attribute ID base (contained 
williamr@2
   106
in the LanguageBaseAttributeIDList attribute). */
williamr@2
   107
static const TInt KSdpAttrIdOffsetServiceDescription = 0x0001; // + Language offset
williamr@2
   108
williamr@2
   109
williamr@2
   110
/** Provider Name.
williamr@2
   111
williamr@2
   112
This is an offset that should be added to the attribute ID base (contained 
williamr@2
   113
in the LanguageBaseAttributeIDList attribute). */
williamr@2
   114
static const TInt KSdpAttrIdOffsetProviderName = 0x0002; // + Language offset
williamr@2
   115
williamr@2
   116
williamr@2
   117
// SDP server specific attributes
williamr@2
   118
/** Version Number List. */
williamr@2
   119
static const TSdpAttributeID KSdpAttrIdSdpServerVersionNumberList = 0x0200;
williamr@2
   120
/** Service Database State. */
williamr@2
   121
static const TSdpAttributeID KSdpAttrIdSdpServerServiceDatabaseState = 0x0201;
williamr@2
   122
/** GroupID. */
williamr@2
   123
static const TSdpAttributeID KSdpAttrIdSdpServerGroupID = 0x0200;
williamr@2
   124
williamr@2
   125
williamr@2
   126
// Protocol UUIDs (add to these as necessary)
williamr@2
   127
static const TInt KL2CAPUUID = 0x0100;
williamr@2
   128
static const TInt KBnepUUID = 0x000f;
williamr@2
   129
static const TInt KAvctpUUID = 0x0017;
williamr@2
   130
static const TInt KAvdtpUUID = 0x0019;
williamr@2
   131
static const TInt KObexProtocolUUID = 0x0008;
williamr@2
   132
static const TInt KRFCommUUID = 0x0003;
williamr@2
   133
williamr@2
   134
// Service class UUIDs (add to these as necessary)
williamr@2
   135
/** L2CAP UUID used for continuation tests*/
williamr@2
   136
static const TUint32	KSdpContTestUUID = 0x100;
williamr@2
   137
/** Serial Port UUID */
williamr@2
   138
static const TInt KSerialPortUUID = 0x1101;
williamr@2
   139
/** Dial Networking UUID */
williamr@2
   140
static const TInt KDialUpNetworkingUUID = 0x1103;
williamr@2
   141
/** General Networking UUID */
williamr@2
   142
static const TInt KGenericNetworkingUUID = 0x1201;
williamr@2
   143
/** Fax UUID */
williamr@2
   144
static const TInt KFaxUUID = 0x1111;
williamr@2
   145
/** Generic Telaphony UUID */
williamr@2
   146
static const TInt KGenericTelephonyUUID = 0x1204;
williamr@2
   147
/** Obex UUID */
williamr@2
   148
static const TInt KObexUUID = 0x1105;
williamr@2
   149
/** Attribute number for the Protocol Descriptor List */
williamr@2
   150
static const TInt KProtocolDescriptorListUUID = 0x0004;
williamr@2
   151
/** Public Browse Group UUID */
williamr@2
   152
static const TInt KPublicBrowseGroupUUID = 0x1002;
williamr@2
   153
/** Browse Group Descriptor Service Class UUID */
williamr@2
   154
static const TInt KBrowseGroupDescriptorServiceClassUUID = 0x1001;
williamr@2
   155
/** Service Discovery Server Service Class UUID */
williamr@2
   156
static const TInt KServiceDiscoveryServerServiceClassUUID = 0x1000;
williamr@2
   157
/** PAN Service Class UUID */
williamr@2
   158
static const TInt KPanUUUID = 0x1115;
williamr@2
   159
/** PAN NAP Service Class UUID */
williamr@2
   160
static const TInt KPanNapUUID = 0x1116;
williamr@2
   161
/** PAN GN Service Class UUID */
williamr@2
   162
static const TInt KPanGnUUID = 0x1117;
williamr@2
   163
/** Audio Source (service class) UUID */
williamr@2
   164
static const TInt KAudioSourceUUID = 0x110a;
williamr@2
   165
/** Audio Sink (service class) UUID */
williamr@2
   166
static const TInt KAudioSinkUUID = 0x110b;
williamr@2
   167
/** Remote control target (service class) UUID */
williamr@2
   168
static const TInt KAVRemoteControlTargetUUID = 0x110c;
williamr@2
   169
/** Advanced audio distribution (A2DP) (profile descriptor) UUID */
williamr@2
   170
static const TInt KAdvancedAudioDistributionUUID = 0x110d;
williamr@2
   171
/** Remote control (service class) UUID */
williamr@2
   172
static const TInt KAVRemoteControlUUID = 0x110E;
williamr@4
   173
/** Remote control controller (service class) UUID */
williamr@4
   174
static const TInt KAVRemoteControlControllerUUID = 0x110F;
williamr@2
   175
/** PBAP PSE Service Class UUID */
williamr@2
   176
static const TInt KPbapPseUUID = 0x112F;
williamr@2
   177
  
williamr@2
   178
 
williamr@2
   179
// Language codes, as per "ISO 639:1988 (E/F)"
williamr@2
   180
/** Afar */
williamr@2
   181
static const TInt16 KLanguageAfar = 0x6161; // aa
williamr@2
   182
/** Abkhazian */
williamr@2
   183
static const TInt16 KLanguageAbkhazian = 0x6162; // ab
williamr@2
   184
/** Afrikaans */
williamr@2
   185
static const TInt16 KLanguageAfrikaans = 0x6166; // af
williamr@2
   186
/** Amharic */
williamr@2
   187
static const TInt16 KLanguageAmharic = 0x616D; // am
williamr@2
   188
/** Arabic */
williamr@2
   189
static const TInt16 KLanguageArabic = 0x6172; // ar
williamr@2
   190
/** Assamese */
williamr@2
   191
static const TInt16 KLanguageAssamese = 0x6173; // as
williamr@2
   192
/** Aymara */
williamr@2
   193
static const TInt16 KLanguageAymara = 0x6179; // ay
williamr@2
   194
/** Azerbaijani */
williamr@2
   195
static const TInt16 KLanguageAzerbaijani = 0x617A; // az
williamr@2
   196
/** Bashkir */
williamr@2
   197
static const TInt16 KLanguageBashkir = 0x6261; // ba
williamr@2
   198
/** Byelorussian */
williamr@2
   199
static const TInt16 KLanguageByelorussian = 0x6265; // be
williamr@2
   200
/** Bulgarian */
williamr@2
   201
static const TInt16 KLanguageBulgarian = 0x6267; // bg
williamr@2
   202
/** Bihari */
williamr@2
   203
static const TInt16 KLanguageBihari = 0x6268; // bh
williamr@2
   204
/** Bislama */
williamr@2
   205
static const TInt16 KLanguageBislama = 0x6269; // bi
williamr@2
   206
/** Bengali */
williamr@2
   207
static const TInt16 KLanguageBengali = 0x626E; // bn - also Bangala
williamr@2
   208
/** Tibetan */
williamr@2
   209
static const TInt16 KLanguageTibetan = 0x626F; // bo
williamr@2
   210
/** Breton */
williamr@2
   211
static const TInt16 KLanguageBreton = 0x6272; // br
williamr@2
   212
/** Catalan */
williamr@2
   213
static const TInt16 KLanguageCatalan = 0x6361; // ca
williamr@2
   214
/** Corsican */
williamr@2
   215
static const TInt16 KLanguageCorsican = 0x636F; // co
williamr@2
   216
/** Czech */
williamr@2
   217
static const TInt16 KLanguageCzech = 0x6373; // cs
williamr@2
   218
/** Welsh */
williamr@2
   219
static const TInt16 KLanguageWelsh = 0x6379; // cy
williamr@2
   220
/** Danish */
williamr@2
   221
static const TInt16 KLanguageDanish = 0x6461; // da
williamr@2
   222
/** German */
williamr@2
   223
static const TInt16 KLanguageGerman = 0x6465; // de
williamr@2
   224
/** Bhutani */
williamr@2
   225
static const TInt16 KLanguageBhutani = 0x647A; // dz
williamr@2
   226
/** Greek */
williamr@2
   227
static const TInt16 KLanguageGreek = 0x656C; // el
williamr@2
   228
/** English */
williamr@2
   229
static const TInt16 KLanguageEnglish = 0x656E; // en
williamr@2
   230
/** Esperanto */
williamr@2
   231
static const TInt16 KLanguageEsperanto = 0x656F; // eo
williamr@2
   232
/** Spanish */
williamr@2
   233
static const TInt16 KLanguageSpanish = 0x6573; // es
williamr@2
   234
/** Estonian */
williamr@2
   235
static const TInt16 KLanguageEstonian = 0x6574; // et
williamr@2
   236
/** Basque */
williamr@2
   237
static const TInt16 KLanguageBasque = 0x6575; // eu
williamr@2
   238
/** Persian */
williamr@2
   239
static const TInt16 KLanguagePersian = 0x6661; // fa
williamr@2
   240
/** Finnish */
williamr@2
   241
static const TInt16 KLanguageFinnish = 0x6669; // fi
williamr@2
   242
/** Fiji */
williamr@2
   243
static const TInt16 KLanguageFiji = 0x666A; // fj
williamr@2
   244
/** Faroese */
williamr@2
   245
static const TInt16 KLanguageFaroese = 0x666F; // fo
williamr@2
   246
/** French */
williamr@2
   247
static const TInt16 KLanguageFrench = 0x6672; // fr
williamr@2
   248
/** Frisian */
williamr@2
   249
static const TInt16 KLanguageFrisian = 0x6679; // fy
williamr@2
   250
/** Irish */
williamr@2
   251
static const TInt16 KLanguageIrish = 0x6761; // ga
williamr@2
   252
/** Scots Gaelic */
williamr@2
   253
static const TInt16 KLanguageScotsGaelic = 0x6764; // gd
williamr@2
   254
/** Galician */
williamr@2
   255
static const TInt16 KLanguageGalician = 0x676C; // gl
williamr@2
   256
/** Guarani */
williamr@2
   257
static const TInt16 KLanguageGuarani = 0x676E; // gn
williamr@2
   258
/** Gujarati */
williamr@2
   259
static const TInt16 KLanguageGujarati = 0x6775; // gu
williamr@2
   260
/** Hausa */
williamr@2
   261
static const TInt16 KLanguageHausa = 0x6861; // ha
williamr@2
   262
/** Hebrew */
williamr@2
   263
static const TInt16 KLanguageHebrew = 0x6865; // he - formerly iw
williamr@2
   264
/** Hindi */
williamr@2
   265
static const TInt16 KLanguageHindi = 0x6869; // hi
williamr@2
   266
/** Croatian */
williamr@2
   267
static const TInt16 KLanguageCroatian = 0x6872; // hr
williamr@2
   268
/** Hungarian */
williamr@2
   269
static const TInt16 KLanguageHungarian = 0x6875; // hu
williamr@2
   270
/** Armenian */
williamr@2
   271
static const TInt16 KLanguageArmenian = 0x6879; // hy
williamr@2
   272
/** Interlingua */
williamr@2
   273
static const TInt16 KLanguageInterlingua = 0x6961; // ia
williamr@2
   274
/** Indonesian */
williamr@2
   275
static const TInt16 KLanguageIndonesian = 0x6964; // id - formerly in
williamr@2
   276
/** Interlingue */
williamr@2
   277
static const TInt16 KLanguageInterlingue = 0x6965; // ie
williamr@2
   278
/** Inupiak */
williamr@2
   279
static const TInt16 KLanguageInupiak = 0x696B; // ik
williamr@2
   280
/** Icelandic */
williamr@2
   281
static const TInt16 KLanguageIcelandic = 0x6973; // is
williamr@2
   282
/** Italian */
williamr@2
   283
static const TInt16 KLanguageItalian = 0x6974; // it
williamr@2
   284
/** Inuktitut */
williamr@2
   285
static const TInt16 KLanguageInuktitut = 0x6975; // iu
williamr@2
   286
/** Japanese */
williamr@2
   287
static const TInt16 KLanguageJapanese = 0x6A61; // ja
williamr@2
   288
/** Javanese */
williamr@2
   289
static const TInt16 KLanguageJavanese = 0x6A77; // jw
williamr@2
   290
/** Georgian */
williamr@2
   291
static const TInt16 KLanguageGeorgian = 0x6B61; // ka
williamr@2
   292
/** Kazakh */
williamr@2
   293
static const TInt16 KLanguageKazakh = 0x6B6B; // kk
williamr@2
   294
/** Greenlandic */
williamr@2
   295
static const TInt16 KLanguageGreenlandic = 0x6B6C; // kl
williamr@2
   296
/** Cambodian */
williamr@2
   297
static const TInt16 KLanguageCambodian = 0x6B6D; // km
williamr@2
   298
/** Kannada */
williamr@2
   299
static const TInt16 KLanguageKannada = 0x6B6E; // kn
williamr@2
   300
/** Korean */
williamr@2
   301
static const TInt16 KLanguageKorean = 0x6B6F; // ko
williamr@2
   302
/** Kashmiri */
williamr@2
   303
static const TInt16 KLanguageKashmiri = 0x6B73; // ks
williamr@2
   304
/** Kurdish */
williamr@2
   305
static const TInt16 KLanguageKurdish = 0x6B75; // ku
williamr@2
   306
/** Kirghiz */
williamr@2
   307
static const TInt16 KLanguageKirghiz = 0x6B79; // ky
williamr@2
   308
/** Latin */
williamr@2
   309
static const TInt16 KLanguageLatin = 0x6C61; // la
williamr@2
   310
/** Lingala */
williamr@2
   311
static const TInt16 KLanguageLingala = 0x6C6E; // ln
williamr@2
   312
/** Laothian */
williamr@2
   313
static const TInt16 KLanguageLaothian = 0x6C6F; // lo
williamr@2
   314
/** Lithuanian */
williamr@2
   315
static const TInt16 KLanguageLithuanian = 0x6C74; // lt
williamr@2
   316
/** Latvian */
williamr@2
   317
static const TInt16 KLanguageLatvian = 0x6C76; // lv - also Lettish
williamr@2
   318
/** Malagasy */
williamr@2
   319
static const TInt16 KLanguageMalagasy = 0x6D67; // mg
williamr@2
   320
/** Maori */
williamr@2
   321
static const TInt16 KLanguageMaori = 0x6D69; // mi
williamr@2
   322
/** Macedonian */
williamr@2
   323
static const TInt16 KLanguageMacedonian = 0x6D6B; // mk
williamr@2
   324
/** Malayalam */
williamr@2
   325
static const TInt16 KLanguageMalayalam = 0x6D6C; // ml
williamr@2
   326
/** Mongolian */
williamr@2
   327
static const TInt16 KLanguageMongolian = 0x6D6E; // mn
williamr@2
   328
/** Moldavian */
williamr@2
   329
static const TInt16 KLanguageMoldavian = 0x6D6F; // mo
williamr@2
   330
/** Marathi */
williamr@2
   331
static const TInt16 KLanguageMarathi = 0x6D72; // mr
williamr@2
   332
/** Malay */
williamr@2
   333
static const TInt16 KLanguageMalay = 0x6D73; // ms
williamr@2
   334
/** Maltese */
williamr@2
   335
static const TInt16 KLanguageMaltese = 0x6D74; // mt
williamr@2
   336
/** Burmese */
williamr@2
   337
static const TInt16 KLanguageBurmese = 0x6D79; // my
williamr@2
   338
/** Nauru */
williamr@2
   339
static const TInt16 KLanguageNauru = 0x6E61; // na
williamr@2
   340
/** Nepali */
williamr@2
   341
static const TInt16 KLanguageNepali = 0x6E65; // ne
williamr@2
   342
/** Dutch */
williamr@2
   343
static const TInt16 KLanguageDutch = 0x6E6C; // nl
williamr@2
   344
/** Norwegian */
williamr@2
   345
static const TInt16 KLanguageNorwegian = 0x6E6F; // no
williamr@2
   346
/** Occitan */
williamr@2
   347
static const TInt16 KLanguageOccitan = 0x6F63; // oc
williamr@2
   348
/** Oromo */
williamr@2
   349
static const TInt16 KLanguageOromo = 0x6F6D; // om - (Afan)
williamr@2
   350
/** Oriya */
williamr@2
   351
static const TInt16 KLanguageOriya = 0x6F72; // or
williamr@2
   352
/** Punjabi */
williamr@2
   353
static const TInt16 KLanguagePunjabi = 0x7061; // pa
williamr@2
   354
/** Polish */
williamr@2
   355
static const TInt16 KLanguagePolish = 0x706C; // pl
williamr@2
   356
/** Pashto */
williamr@2
   357
static const TInt16 KLanguagePashto = 0x7073; // ps
williamr@2
   358
/** Portuguese */
williamr@2
   359
static const TInt16 KLanguagePortuguese = 0x7074; // pt
williamr@2
   360
/** Quechua */
williamr@2
   361
static const TInt16 KLanguageQuechua = 0x7175; // qu
williamr@2
   362
/** Rhaeto Romance */
williamr@2
   363
static const TInt16 KLanguageRhaetoRomance = 0x726D; // rm
williamr@2
   364
/** Kirundi */
williamr@2
   365
static const TInt16 KLanguageKirundi = 0x726E; // rn
williamr@2
   366
/** Romanian */
williamr@2
   367
static const TInt16 KLanguageRomanian = 0x726F; // ro
williamr@2
   368
/** Russian */
williamr@2
   369
static const TInt16 KLanguageRussian = 0x7275; // ru
williamr@2
   370
/** Kinyarwanda */
williamr@2
   371
static const TInt16 KLanguageKinyarwanda = 0x7277; // rw
williamr@2
   372
/** Sanskrit */
williamr@2
   373
static const TInt16 KLanguageSanskrit = 0x7361; // sa
williamr@2
   374
/** Sindhi */
williamr@2
   375
static const TInt16 KLanguageSindhi = 0x7364; // sd
williamr@2
   376
/** Sangho */
williamr@2
   377
static const TInt16 KLanguageSangho = 0x7367; // sg
williamr@2
   378
/** SerboCroatian */
williamr@2
   379
static const TInt16 KLanguageSerboCroatian = 0x7368; // sh
williamr@2
   380
/** Sinhalese */
williamr@2
   381
static const TInt16 KLanguageSinhalese = 0x7369; // si
williamr@2
   382
/** Slovak */
williamr@2
   383
static const TInt16 KLanguageSlovak = 0x736B; // sk
williamr@2
   384
/** Slovenian */
williamr@2
   385
static const TInt16 KLanguageSlovenian = 0x736C; // sl
williamr@2
   386
/** Samoan */
williamr@2
   387
static const TInt16 KLanguageSamoan = 0x736D; // sm
williamr@2
   388
/** Shona */
williamr@2
   389
static const TInt16 KLanguageShona = 0x736E; // sn
williamr@2
   390
/** Somali */
williamr@2
   391
static const TInt16 KLanguageSomali = 0x736F; // so
williamr@2
   392
/** Albanian */
williamr@2
   393
static const TInt16 KLanguageAlbanian = 0x7371; // sq
williamr@2
   394
/** Serbian */
williamr@2
   395
static const TInt16 KLanguageSerbian = 0x7372; // sr
williamr@2
   396
/** Siswati */
williamr@2
   397
static const TInt16 KLanguageSiswati = 0x7373; // ss
williamr@2
   398
/** Sesotho */
williamr@2
   399
static const TInt16 KLanguageSesotho = 0x7374; // st
williamr@2
   400
/** Sundanese */
williamr@2
   401
static const TInt16 KLanguageSundanese = 0x7375; // su
williamr@2
   402
/** Swedish */
williamr@2
   403
static const TInt16 KLanguageSwedish = 0x7376; // sv
williamr@2
   404
/** Swahili */
williamr@2
   405
static const TInt16 KLanguageSwahili = 0x7377; // sw
williamr@2
   406
/** Tamil */
williamr@2
   407
static const TInt16 KLanguageTamil = 0x7461; // ta
williamr@2
   408
/** Telugu */
williamr@2
   409
static const TInt16 KLanguageTelugu = 0x7465; // te
williamr@2
   410
/** Tajik */
williamr@2
   411
static const TInt16 KLanguageTajik = 0x7467; // tg
williamr@2
   412
/** Thai */
williamr@2
   413
static const TInt16 KLanguageThai = 0x7468; // th
williamr@2
   414
/** Tigrinya */
williamr@2
   415
static const TInt16 KLanguageTigrinya = 0x7469; // ti
williamr@2
   416
/** Turkmen */
williamr@2
   417
static const TInt16 KLanguageTurkmen = 0x746B; // tk
williamr@2
   418
/** Tagalog */
williamr@2
   419
static const TInt16 KLanguageTagalog = 0x746C; // tl
williamr@2
   420
/** Setswana */
williamr@2
   421
static const TInt16 KLanguageSetswana = 0x746E; // tn
williamr@2
   422
/** Tonga */
williamr@2
   423
static const TInt16 KLanguageTonga = 0x746F; // to
williamr@2
   424
/** Turkish */
williamr@2
   425
static const TInt16 KLanguageTurkish = 0x7472; // tr
williamr@2
   426
/** Tsonga */
williamr@2
   427
static const TInt16 KLanguageTsonga = 0x7473; // ts
williamr@2
   428
/** Tatar */
williamr@2
   429
static const TInt16 KLanguageTatar = 0x7474; // tt
williamr@2
   430
/** Twi */
williamr@2
   431
static const TInt16 KLanguageTwi = 0x7477; // tw
williamr@2
   432
/** Uighur */
williamr@2
   433
static const TInt16 KLanguageUighur = 0x7567; // ug
williamr@2
   434
/** Ukrainian */
williamr@2
   435
static const TInt16 KLanguageUkrainian = 0x756B; // uk
williamr@2
   436
/** Urdu */
williamr@2
   437
static const TInt16 KLanguageUrdu = 0x7572; // ur
williamr@2
   438
/** Uzbek */
williamr@2
   439
static const TInt16 KLanguageUzbek = 0x757A; // uz
williamr@2
   440
/** Vietnamese */
williamr@2
   441
static const TInt16 KLanguageVietnamese = 0x7669; // vi
williamr@2
   442
/** Volapuk */
williamr@2
   443
static const TInt16 KLanguageVolapuk = 0x766F; // vo
williamr@2
   444
/** Wolof */
williamr@2
   445
static const TInt16 KLanguageWolof = 0x776F; // wo
williamr@2
   446
/** Xhosa */
williamr@2
   447
static const TInt16 KLanguageXhosa = 0x7868; // xh
williamr@2
   448
/** Yiddish */
williamr@2
   449
static const TInt16 KLanguageYiddish = 0x7969; // yi - formerly ji
williamr@2
   450
/** Yoruba */
williamr@2
   451
static const TInt16 KLanguageYoruba = 0x796F; // yo
williamr@2
   452
/** Zhuang */
williamr@2
   453
static const TInt16 KLanguageZhuang = 0x7A61; // za
williamr@2
   454
/** Chinese */
williamr@2
   455
static const TInt16 KLanguageChinese = 0x7A68; // zh
williamr@2
   456
/** Zulu */
williamr@2
   457
static const TInt16 KLanguageZulu = 0x7A75; // zu
williamr@2
   458
williamr@2
   459
//***********************************************************************/
williamr@2
   460
//
williamr@2
   461
//   SDP database server API
williamr@2
   462
//
williamr@2
   463
//***********************************************************************/
williamr@2
   464
williamr@2
   465
/** Typedef for a TSdpAttributeID package buf */
williamr@2
   466
typedef TPckgBuf<TSdpAttributeID> TSdpAttributeIDPckgBuf;
williamr@2
   467
/** Handle to a service record. */
williamr@2
   468
typedef TUint32 TSdpServRecordHandle;
williamr@2
   469
/** Typedef for a TSdpServRecordHandle package buf */
williamr@2
   470
typedef TPckgBuf<TSdpServRecordHandle> TSdpServRecordHandlePckgBuf;
williamr@2
   471
williamr@2
   472
NONSHARABLE_CLASS(RSdp) : public RSessionBase
williamr@2
   473
/** Provides a session to the Service Discovery Database.
williamr@2
   474
williamr@2
   475
Used to create subsessions to database functionality. A clients must create
williamr@2
   476
and connect a session, before using a RSdpDatabase subsession to access the
williamr@2
   477
database.
williamr@2
   478
williamr@2
   479
@see RSdpDatabase */
williamr@2
   480
	{
williamr@2
   481
public:
williamr@2
   482
	IMPORT_C RSdp();
williamr@2
   483
	IMPORT_C TInt Connect();
williamr@2
   484
	IMPORT_C TVersion Version() const;
williamr@2
   485
	IMPORT_C void ResourceCountMarkStart();
williamr@2
   486
	IMPORT_C void ResourceCountMarkEnd();
williamr@2
   487
	IMPORT_C TInt ResourceCount();
williamr@2
   488
	IMPORT_C TInt __DbgMarkHeap();
williamr@2
   489
	IMPORT_C TInt __DbgCheckHeap(TInt aCount);
williamr@2
   490
	IMPORT_C TInt __DbgMarkEnd(TInt aCount);
williamr@2
   491
	IMPORT_C TInt __DbgFailNext(TInt aCount);
williamr@2
   492
williamr@2
   493
private:
williamr@2
   494
	// This data padding has been added to help prevent future binary compatibility breaks	
williamr@2
   495
	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
williamr@2
   496
	TUint32     iPadding1; 
williamr@2
   497
	TUint32     iPadding2; 	
williamr@2
   498
	};
williamr@2
   499
williamr@2
   500
NONSHARABLE_CLASS(RSdpSubSession) : public RSubSessionBase
williamr@2
   501
/** Base class used in the derivation of RSdpDatabase. 
williamr@2
   502
williamr@2
   503
The class contains basic subssession functionality. It has no user accessible
williamr@2
   504
functions. */
williamr@2
   505
	{
williamr@2
   506
public:
williamr@2
   507
	/** Opens subsession on an RSdp session
williamr@2
   508
    @param aSession The session on which the subsession is being opened.
williamr@2
   509
    */
williamr@2
   510
	IMPORT_C virtual TInt Open(RSdp& aSession)=0;
williamr@2
   511
	/** Closes subsession */
williamr@2
   512
	IMPORT_C virtual void Close()=0;
williamr@2
   513
williamr@2
   514
private:
williamr@2
   515
	// This data padding has been added to help prevent future binary compatibility breaks	
williamr@2
   516
	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
williamr@2
   517
	TUint32     iPadding1; 
williamr@2
   518
	TUint32     iPadding2; 		
williamr@2
   519
	};
williamr@2
   520
williamr@2
   521
williamr@2
   522
williamr@2
   523
class CSdpAttrValueDES;
williamr@2
   524
class CSdpAttrValue;
williamr@2
   525
williamr@2
   526
NONSHARABLE_CLASS(RSdpDatabase) : public RSdpSubSession
williamr@2
   527
/** Subsession to the SDP through which service records and their attributes can 
williamr@2
   528
be added, deleted, and updated. */
williamr@2
   529
	{
williamr@2
   530
public:
williamr@2
   531
	IMPORT_C RSdpDatabase();
williamr@2
   532
	IMPORT_C TInt Open(RSdp& aSession);
williamr@2
   533
	IMPORT_C void Close();
williamr@2
   534
	IMPORT_C void CreateServiceRecordL(const TUUID& aUUID, TSdpServRecordHandle& aHandle);
williamr@2
   535
	IMPORT_C void CreateServiceRecordL(CSdpAttrValueDES& aUUIDList, TSdpServRecordHandle& aHandle);
williamr@2
   536
	IMPORT_C void UpdateAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue& aAttrValue);
williamr@2
   537
	IMPORT_C void UpdateAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, TUint aUintValue);
williamr@2
   538
	IMPORT_C void UpdateAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, const TDesC16& aDesCValue);
williamr@2
   539
	IMPORT_C void UpdateAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, const TDesC8& aDesCValue);
williamr@2
   540
	IMPORT_C void DeleteAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID);
williamr@2
   541
	IMPORT_C void DeleteAttribute(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID);
williamr@2
   542
	IMPORT_C void DeleteRecordL(TSdpServRecordHandle aHandle);
williamr@2
   543
	IMPORT_C void DeleteRecord(TSdpServRecordHandle aHandle);
williamr@2
   544
private:
williamr@2
   545
	HBufC8* iBuffer; //used for synchronous requests (could have been local)
williamr@2
   546
	
williamr@2
   547
	// This data padding has been added to help prevent future binary compatibility breaks	
williamr@2
   548
	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
williamr@2
   549
	TUint32     iPadding1; 
williamr@2
   550
	TUint32     iPadding2; 		
williamr@2
   551
	};
williamr@2
   552
williamr@2
   553
williamr@2
   554
class MSdpElementBuilder
williamr@2
   555
/** Constructs an attribute value, or a set of attributes, from multiple data elements.
williamr@2
   556
williamr@2
   557
The builder interface is used for building single attribute values, and sets of attribute 
williamr@2
   558
value, attribute ID pairs, as for example in a service record.
williamr@2
   559
williamr@2
   560
In particular, the builder interface can be implemented to receive the results from 
williamr@2
   561
CSdpAgent attribute queries.
williamr@2
   562
williamr@2
   563
Each member function itself returns an MSdpElementBuilder interface that can 
williamr@2
   564
then be used to add further elements. 
williamr@2
   565
williamr@2
   566
For more on the format of attribute values, see [BS1 Service Discovery Protocol 
williamr@2
   567
3].
williamr@2
   568
williamr@2
   569
Note that the interface defines each function to leave with the error KErrGeneral.
williamr@2
   570
williamr@2
   571
@see CSdpAgent::AttributeRequestL() */
williamr@2
   572
	{
williamr@2
   573
public:
williamr@2
   574
	IMPORT_C virtual MSdpElementBuilder* BuildUnknownL(TUint8 aType, TUint8 aSizeDesc, const TDesC8& aData);
williamr@2
   575
	IMPORT_C virtual MSdpElementBuilder* BuildNilL();
williamr@2
   576
	IMPORT_C virtual MSdpElementBuilder* BuildUintL(const TDesC8& aUint);
williamr@2
   577
	IMPORT_C virtual MSdpElementBuilder* BuildIntL(const TDesC8& aInt);
williamr@2
   578
	IMPORT_C virtual MSdpElementBuilder* BuildUUIDL(const TUUID& aUUID);
williamr@2
   579
	IMPORT_C virtual MSdpElementBuilder* BuildBooleanL(TBool aBool);
williamr@2
   580
	IMPORT_C virtual MSdpElementBuilder* BuildStringL(const TDesC8& aString);
williamr@2
   581
	IMPORT_C virtual MSdpElementBuilder* BuildDESL();  // Must not return NULL
williamr@2
   582
	IMPORT_C virtual MSdpElementBuilder* BuildDEAL();  // ditto
williamr@2
   583
	IMPORT_C virtual MSdpElementBuilder* StartListL(); // ditto
williamr@2
   584
	IMPORT_C virtual MSdpElementBuilder* EndListL();
williamr@2
   585
	IMPORT_C virtual MSdpElementBuilder* BuildURLL(const TDesC8& aURL);
williamr@2
   586
	
williamr@2
   587
    /**
williamr@2
   588
 	 Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is.
williamr@2
   589
	 @param aInterface UID of the interface to return
williamr@2
   590
	 @param aObject the container for another interface as specified by aInterface
williamr@2
   591
	 */
williamr@2
   592
	IMPORT_C void MSEB_ExtensionInterfaceL(TUid aInterface, void*& aObject);	
williamr@2
   593
	};
williamr@2
   594
williamr@2
   595
/** Types of attribute data elements. */
williamr@2
   596
enum TSdpElementType
williamr@2
   597
	{
williamr@2
   598
	/** Null type. */
williamr@2
   599
	ETypeNil		=  0,
williamr@2
   600
	/** Unsigned integer. */
williamr@2
   601
	ETypeUint		=  1,
williamr@2
   602
	/** Signed integer. */
williamr@2
   603
	ETypeInt		=  2,
williamr@2
   604
	/** UUID. */
williamr@2
   605
	ETypeUUID		=  3,
williamr@2
   606
	/** Text string. */
williamr@2
   607
	ETypeString		=  4,
williamr@2
   608
	/** Boolean. */
williamr@2
   609
	ETypeBoolean	=  5,
williamr@2
   610
	/** Data element sequence. */
williamr@2
   611
	ETypeDES		=  6,
williamr@2
   612
	/** Data element alternative. */
williamr@2
   613
	ETypeDEA		=  7,
williamr@2
   614
	/** URL. */
williamr@2
   615
	ETypeURL		=  8,
williamr@2
   616
	/** Outside SDP reserved range. */
williamr@2
   617
	ETypeEncoded	= 32,	// Outside SDP reserved range
williamr@2
   618
	};
williamr@2
   619
williamr@2
   620
class MSdpAttributeValueVisitor;
williamr@2
   621
williamr@2
   622
NONSHARABLE_CLASS(CSdpAttrValue) : public CBase
williamr@2
   623
/** Base class for classes that encapsulate SDP attributes values.
williamr@2
   624
williamr@2
   625
Sub-classes of this wrap specific types of SDP service record attributes. 
williamr@2
   626
For example, CSdpBoolean derives from CSdpAttrValue to encapsulate boolean 
williamr@2
   627
attributes. The base class defines getters for all types: for example, it 
williamr@2
   628
declares a function Bool() that returns the attribute value as a TBool. Note 
williamr@2
   629
though that the function would panic unless called on actual CSdpBoolean.
williamr@2
   630
williamr@2
   631
A common base class allows attributes of all types to be used polymorphically. 
williamr@2
   632
You can use CSdpAttrValue's Type() function to find the actual type being 
williamr@2
   633
used, and upcast the pointer appropriately. */
williamr@2
   634
	{
williamr@2
   635
public:
williamr@2
   636
	CSdpAttrValue();
williamr@2
   637
	virtual ~CSdpAttrValue();
williamr@2
   638
williamr@2
   639
williamr@2
   640
	/** Gets the attribute type.
williamr@2
   641
	
williamr@2
   642
	@return Attribute type */
williamr@2
   643
	virtual TSdpElementType Type() const=0;
williamr@2
   644
williamr@2
   645
williamr@2
   646
	/** Gets the size of the attribute.
williamr@2
   647
	
williamr@2
   648
	@return Size of the attribute in bytes */
williamr@2
   649
	virtual TUint DataSize() const=0;
williamr@2
   650
williamr@2
   651
williamr@2
   652
	// getter interface
williamr@2
   653
	virtual TUint Uint() const;
williamr@2
   654
	virtual TInt Int() const;
williamr@2
   655
	virtual TBool DoesIntFit() const;
williamr@2
   656
	virtual TInt Bool() const;
williamr@2
   657
	virtual const TUUID &UUID() const;
williamr@2
   658
	virtual const TPtrC8 Des() const;
williamr@2
   659
	
williamr@2
   660
	virtual void AcceptVisitorL(MSdpAttributeValueVisitor& aVisitor);
williamr@2
   661
williamr@2
   662
	IMPORT_C void Uint64(TUint64& aValue) const; 
williamr@2
   663
 	IMPORT_C void Uint128(TUint64& aLo, TUint64& aHi) const;
williamr@2
   664
williamr@2
   665
protected:
williamr@2
   666
	TInt Extension_(TUint aExtensionId, TAny *&a0, TAny *a1);
williamr@2
   667
	};
williamr@2
   668
williamr@2
   669
/** Base class for classes that specify lists of attribute data elements.
williamr@2
   670
williamr@2
   671
It implements the MSdpElementBuilder interface to build data elements into 
williamr@2
   672
an attribute value.
williamr@2
   673
williamr@2
   674
@see CSdpAttrValueDEA
williamr@2
   675
@see CSdpAttrValueDES */
williamr@2
   676
NONSHARABLE_CLASS(CSdpAttrValueList) : public CSdpAttrValue, public MSdpElementBuilder
williamr@2
   677
	{
williamr@2
   678
public:
williamr@4
   679
	virtual ~CSdpAttrValueList();
williamr@4
   680
	virtual void AcceptVisitorL(MSdpAttributeValueVisitor& aVisitor);
williamr@4
   681
	virtual TUint DataSize() const;
williamr@2
   682
	IMPORT_C void AppendValueL(CSdpAttrValue* aValue);
williamr@2
   683
williamr@2
   684
	// MSdpElementBuilder interface
williamr@2
   685
	/** Adds an element of any type.
williamr@2
   686
	
williamr@2
   687
	@param aType Type descriptor
williamr@2
   688
	@param aSizeDesc Size descriptor
williamr@2
   689
	@param aData Data field
williamr@2
   690
	@return Attribute value with added element */
williamr@4
   691
	virtual MSdpElementBuilder* BuildUnknownL(TUint8 aType, TUint8 aSizeDesc, const TDesC8& aData);
williamr@4
   692
	virtual MSdpElementBuilder* BuildNilL();
williamr@4
   693
	virtual MSdpElementBuilder* BuildUintL(const TDesC8& aUint);
williamr@4
   694
	virtual MSdpElementBuilder* BuildIntL(const TDesC8& aInt);
williamr@4
   695
	virtual MSdpElementBuilder* BuildUUIDL(const TUUID& aUUID);
williamr@4
   696
	virtual MSdpElementBuilder* BuildBooleanL(TBool aBool);
williamr@4
   697
	virtual MSdpElementBuilder* BuildStringL(const TDesC8& aString);
williamr@4
   698
	virtual MSdpElementBuilder* BuildDESL();
williamr@4
   699
	virtual MSdpElementBuilder* BuildDEAL();
williamr@4
   700
	virtual MSdpElementBuilder* StartListL();
williamr@4
   701
	virtual MSdpElementBuilder* EndListL();
williamr@4
   702
	virtual MSdpElementBuilder* BuildURLL(const TDesC8& aString);
williamr@4
   703
	virtual MSdpElementBuilder* BuildEncodedL(const TDesC8& aString);
williamr@2
   704
williamr@2
   705
protected:
williamr@2
   706
	CSdpAttrValueList(MSdpElementBuilder *aBuilder);
williamr@2
   707
	void ConstructL();
williamr@2
   708
williamr@2
   709
protected:
williamr@2
   710
	/** Array of attribute values contained in this CSdpAttrValueList class*/
williamr@2
   711
	CArrayPtr<CSdpAttrValue> *iList;
williamr@2
   712
	
williamr@2
   713
private:
williamr@2
   714
	MSdpElementBuilder *iParent;
williamr@2
   715
	};
williamr@2
   716
williamr@2
   717
williamr@2
   718
NONSHARABLE_CLASS(CSdpAttrValueNil) : public CSdpAttrValue
williamr@2
   719
/** A null type data attribute. */
williamr@2
   720
	{
williamr@2
   721
public:
williamr@2
   722
	IMPORT_C static CSdpAttrValueNil *NewNilL();
williamr@2
   723
	virtual ~CSdpAttrValueNil();
williamr@2
   724
	virtual TSdpElementType Type() const;
williamr@2
   725
	virtual TUint DataSize() const;
williamr@2
   726
	
williamr@2
   727
private:
williamr@2
   728
	CSdpAttrValueNil();
williamr@2
   729
	};
williamr@2
   730
williamr@2
   731
/** Max size for an SDP Uint attribute value in bytes */
williamr@2
   732
static const TInt KSdpMaxUintSize = 16;
williamr@2
   733
williamr@2
   734
NONSHARABLE_CLASS(CSdpAttrValueUint) : public CSdpAttrValue
williamr@2
   735
/** A unsigned integer value of an attribute.
williamr@2
   736
williamr@2
   737
The value can be up to 128 bits in size. You need to choose to use either Uint() for up to 32 bit size,
williamr@2
   738
Uint64() for up to 64 bit size or Uint128() for up to 128 bit size. The size can be found using DataSize().
williamr@2
   739
If the incorrect function is used the code will panic. 
williamr@2
   740
*/
williamr@2
   741
	{
williamr@2
   742
public:
williamr@2
   743
	IMPORT_C static CSdpAttrValueUint* NewUintL(const TDesC8 &aUint);
williamr@2
   744
	virtual ~CSdpAttrValueUint();
williamr@2
   745
williamr@2
   746
	IMPORT_C void SetUintValue(const TDesC8& aValue);
williamr@2
   747
	virtual TSdpElementType Type() const;
williamr@2
   748
	virtual TUint DataSize() const;
williamr@2
   749
	TUint Uint() const;
williamr@2
   750
	virtual TBool DoesIntFit() const;
williamr@2
   751
	virtual const TPtrC8 Des() const;
williamr@2
   752
williamr@2
   753
private:
williamr@2
   754
	TInt Extension_(TUint aExtensionId, TAny *&a0, TAny *a1);
williamr@2
   755
	CSdpAttrValueUint(const TDesC8 & aUint);
williamr@2
   756
	
williamr@2
   757
private:
williamr@2
   758
	TBuf8<KSdpMaxUintSize> iUint;
williamr@2
   759
	};
williamr@2
   760
williamr@2
   761
/** 
williamr@2
   762
Max size for an SDP Int attribute value in bytes 
williamr@2
   763
The new value is KSdpMaxIntSize
williamr@2
   764
@deprecated
williamr@2
   765
*/
williamr@2
   766
static const TInt KMaxIntSize  = 16;
williamr@2
   767
williamr@2
   768
/** 
williamr@2
   769
Max size for an SDP Int attribute value in bytes 
williamr@2
   770
*/
williamr@2
   771
static const TInt KSdpMaxIntSize  = 16;
williamr@2
   772
williamr@2
   773
NONSHARABLE_CLASS(CSdpAttrValueInt) : public CSdpAttrValue
williamr@2
   774
/** A signed integer value of an attribute.
williamr@2
   775
williamr@2
   776
The value can be up to 128 bits in size. */
williamr@2
   777
	{
williamr@2
   778
public:
williamr@2
   779
	IMPORT_C static CSdpAttrValueInt* NewIntL(const TDesC8 &aInt);
williamr@2
   780
	virtual ~CSdpAttrValueInt();
williamr@2
   781
	virtual TSdpElementType Type() const;
williamr@2
   782
	virtual TUint DataSize() const;
williamr@2
   783
	virtual TInt Int() const;
williamr@2
   784
	virtual TBool DoesIntFit() const;
williamr@2
   785
	virtual const TPtrC8 Des() const;
williamr@2
   786
	
williamr@2
   787
private:
williamr@2
   788
	CSdpAttrValueInt(const TDesC8 & aInt);
williamr@2
   789
	
williamr@2
   790
private:
williamr@2
   791
	TBuf8<KSdpMaxIntSize> iInt;
williamr@2
   792
	};
williamr@2
   793
williamr@2
   794
williamr@2
   795
NONSHARABLE_CLASS(CSdpAttrValueUUID) : public CSdpAttrValue
williamr@2
   796
/** A UUID value of an attribute.
williamr@2
   797
williamr@2
   798
The value can be up to 128 bits in size. */
williamr@2
   799
	{
williamr@2
   800
public:
williamr@2
   801
	IMPORT_C static CSdpAttrValueUUID* NewUUIDL(const TUUID& aUUID);
williamr@2
   802
	virtual ~CSdpAttrValueUUID();
williamr@2
   803
	virtual TSdpElementType Type() const;
williamr@2
   804
	virtual TUint DataSize() const;
williamr@2
   805
	// getters
williamr@2
   806
	virtual const TUUID &UUID() const;
williamr@2
   807
	virtual const TPtrC8 Des() const;
williamr@2
   808
	
williamr@2
   809
private:
williamr@2
   810
	CSdpAttrValueUUID(const TUUID& aUUID);
williamr@2
   811
	
williamr@2
   812
private:
williamr@2
   813
	TUUID iUUID;
williamr@2
   814
	};
williamr@2
   815
williamr@2
   816
NONSHARABLE_CLASS(CSdpAttrValueString) : public CSdpAttrValue
williamr@2
   817
/** A Text String value of an attribute.
williamr@2
   818
williamr@2
   819
The encoding of the string is up to the user. The interpretation of the encoding 
williamr@2
   820
is enabled using facilities in SDP. */
williamr@2
   821
	{
williamr@2
   822
public:
williamr@2
   823
	IMPORT_C static CSdpAttrValueString* NewStringL(const TDesC8& aString);
williamr@2
   824
	virtual ~CSdpAttrValueString();
williamr@2
   825
	virtual TSdpElementType Type() const;
williamr@2
   826
	virtual TUint DataSize() const;
williamr@2
   827
	virtual const TPtrC8 Des() const;
williamr@2
   828
	
williamr@2
   829
private:
williamr@2
   830
	CSdpAttrValueString();
williamr@2
   831
	void ConstructL(const TDesC8& aString);
williamr@2
   832
	
williamr@2
   833
private:
williamr@2
   834
	HBufC8 *iBuffer;
williamr@2
   835
	};
williamr@2
   836
williamr@2
   837
NONSHARABLE_CLASS(CSdpAttrValueBoolean) : public CSdpAttrValue
williamr@2
   838
/** A Boolean value of an attribute. */
williamr@2
   839
	{
williamr@2
   840
public:
williamr@2
   841
	IMPORT_C static CSdpAttrValueBoolean *NewBoolL(TBool aBool);
williamr@2
   842
	virtual ~CSdpAttrValueBoolean();
williamr@2
   843
	virtual TSdpElementType Type() const;
williamr@2
   844
	virtual TUint DataSize() const;
williamr@2
   845
	virtual TBool Bool() const;
williamr@2
   846
	
williamr@2
   847
private:
williamr@2
   848
	CSdpAttrValueBoolean(TBool aBool);
williamr@2
   849
	
williamr@2
   850
private:
williamr@2
   851
	TBool iBool;
williamr@2
   852
	};
williamr@2
   853
williamr@2
   854
NONSHARABLE_CLASS(CSdpAttrValueDES) : public CSdpAttrValueList
williamr@2
   855
/** A Data element sequence (DES) value of an attribute.
williamr@2
   856
williamr@2
   857
A DES can contain other values within it, including other sequences. This 
williamr@2
   858
enables arbitrary tree structures to be created.
williamr@2
   859
williamr@2
   860
Most of the functionality is supplied by the base class CSdpAttrValueList. */
williamr@2
   861
	{
williamr@2
   862
public:
williamr@2
   863
	IMPORT_C static CSdpAttrValueDES* NewDESL(MSdpElementBuilder* aBuilder);
williamr@2
   864
	virtual TSdpElementType Type() const;
williamr@2
   865
	
williamr@2
   866
private:
williamr@2
   867
	CSdpAttrValueDES(MSdpElementBuilder *aBuilder);
williamr@2
   868
	};
williamr@2
   869
williamr@2
   870
NONSHARABLE_CLASS(CSdpAttrValueDEA) : public CSdpAttrValueList
williamr@2
   871
/** A Data element alternative (DEA) value of an attribute: this is an attribute 
williamr@2
   872
whose value is a sequence of data elements from which one data element is 
williamr@2
   873
to be selected
williamr@2
   874
williamr@2
   875
Most of the functionality is supplied by the base class CSdpAttrValueList. */
williamr@2
   876
	{
williamr@2
   877
public:
williamr@2
   878
	IMPORT_C static CSdpAttrValueDEA* NewDEAL(MSdpElementBuilder* aBuilder);
williamr@2
   879
	virtual TSdpElementType Type() const;
williamr@2
   880
	
williamr@2
   881
private:
williamr@2
   882
	CSdpAttrValueDEA(MSdpElementBuilder *aBuilder);
williamr@2
   883
	};
williamr@2
   884
williamr@2
   885
NONSHARABLE_CLASS(CSdpAttrValueURL) : public CSdpAttrValue
williamr@2
   886
/** A URL value of an attribute. */
williamr@2
   887
	{
williamr@2
   888
public:
williamr@2
   889
	IMPORT_C static CSdpAttrValueURL* NewURLL(const TDesC8& aString);
williamr@2
   890
	virtual ~CSdpAttrValueURL();
williamr@2
   891
	virtual TSdpElementType Type() const;
williamr@2
   892
	virtual const TPtrC8 Des() const;
williamr@2
   893
	virtual TUint DataSize() const;
williamr@2
   894
	
williamr@2
   895
private:
williamr@2
   896
	CSdpAttrValueURL();
williamr@2
   897
	void ConstructL(const TDesC8& aString);
williamr@2
   898
	
williamr@2
   899
private:
williamr@2
   900
	HBufC8 *iBuffer;
williamr@2
   901
	};
williamr@2
   902
williamr@2
   903
class MSdpAttributeValueVisitor
williamr@2
   904
/** Abstract interface that can be implemented to receive an enumeration of the 
williamr@2
   905
values in an attribute list.
williamr@2
   906
williamr@2
   907
The class member functions are called by an CSdpAttrValue (or one of its sub-classes) 
williamr@2
   908
object when CSdpAttrValue::AcceptVisitorL() is called.
williamr@2
   909
williamr@2
   910
Note that:
williamr@2
   911
williamr@2
   912
When AcceptVisitorL() is called on attributes that are not lists (not DEA 
williamr@2
   913
or DES), only VisitAttributeValueL() is called, passing the attribute value 
williamr@2
   914
object itself (i.e. *this), and the value attribute type.
williamr@2
   915
williamr@2
   916
When AcceptVisitorL() is called on attributes that are lists (DEA or DES), 
williamr@2
   917
VisitAttributeValueL() is called for each member of the list
williamr@2
   918
williamr@2
   919
This implements the standard Visitor pattern.
williamr@2
   920
williamr@2
   921
@see CSdpAttrValue::AcceptVisitorL() */
williamr@2
   922
	{
williamr@2
   923
public:
williamr@2
   924
	/** Called to pass an attribute value.
williamr@2
   925
	
williamr@2
   926
	@param aValue Attribute value
williamr@2
   927
	@param aType Value type */
williamr@2
   928
    virtual void VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType)=0;
williamr@2
   929
	
williamr@2
   930
	
williamr@2
   931
	/** Called to indicate the start of a list of attribute values.
williamr@2
   932
	
williamr@2
   933
	This call is followed by a call to VisitAttributeValueL() for each attribute 
williamr@2
   934
	value in the list, and concluded by a call to EndList().
williamr@2
   935
	
williamr@2
   936
	@param aList Attribute value list */
williamr@2
   937
    virtual void StartListL(CSdpAttrValueList &aList)=0;
williamr@2
   938
	
williamr@2
   939
	
williamr@2
   940
	/** Called to indicate the end of a list of attribute values. */
williamr@2
   941
    virtual void EndListL()=0;
williamr@2
   942
    
williamr@2
   943
    /**
williamr@2
   944
 	 Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is.
williamr@2
   945
	 @param aInterface UID of the interface to return
williamr@2
   946
	 @param aObject the container for another interface as specified by aInterface
williamr@2
   947
	 */
williamr@2
   948
	IMPORT_C virtual void MSAVV_ExtensionInterfaceL(TUid aInterface, void*& aObject);    
williamr@2
   949
	};
williamr@2
   950
williamr@2
   951
class SdpUtil
williamr@2
   952
/**Integer Putter/Getter Utility Class 
williamr@2
   953
williamr@2
   954
Utility class for putting integer values into/getting integer values out of descriptors  */
williamr@2
   955
	{
williamr@2
   956
public:
williamr@2
   957
	IMPORT_C static TUint GetUint(const TDesC8& aData);
williamr@2
   958
	IMPORT_C static void PutUint(TUint8* aPtr, TInt64 aInt, TInt aNumberOfBytes);
williamr@2
   959
	IMPORT_C static void PutUint64(TUint8* aPtr, const TUint64& aNumber);			
williamr@2
   960
	IMPORT_C static void GetUint64(const TDesC8& aData, TUint64& aNumber);
williamr@2
   961
	IMPORT_C static void PutUint128(TUint8* aPtr, const TUint64& aLo, const TUint64& aHi);	
williamr@2
   962
	IMPORT_C static void GetUint128(const TDesC8& aData, TUint64& aLo, TUint64& aHi);	
williamr@2
   963
	};
williamr@2
   964
	
williamr@2
   965
/**Integer to Descriptor Convertor
williamr@2
   966
williamr@2
   967
Utility class to convert EPOC integers into TDesC8's, in the correct
williamr@2
   968
format for passing to the BuildIntL and BuildUintL members in SDP.
williamr@2
   969
This is effectively a Big-endian variant of TPckgBuf.
williamr@2
   970
*/
williamr@2
   971
williamr@2
   972
williamr@2
   973
template<class T>
williamr@2
   974
class TSdpIntBuf : public TBufC8<sizeof(T)>
williamr@2
   975
	{
williamr@2
   976
public:
williamr@2
   977
	inline TSdpIntBuf(const T& aRef);
williamr@2
   978
	};
williamr@2
   979
williamr@2
   980
/**Speciality of Integer to Descriptor Convertor for TUint64s*/
williamr@2
   981
TEMPLATE_SPECIALIZATION class TSdpIntBuf<TUint64> :public TBufC8<sizeof(TUint64)>
williamr@2
   982
	{
williamr@2
   983
public:
williamr@2
   984
	IMPORT_C TSdpIntBuf(const TUint64& aRef);
williamr@2
   985
	};
williamr@2
   986
williamr@2
   987
/**Speciality of Integer to Descriptor Convertor for TUint32s*/
williamr@2
   988
TEMPLATE_SPECIALIZATION class TSdpIntBuf<TUint32> : public TSdpIntBuf<TUint>
williamr@2
   989
	{
williamr@2
   990
public:
williamr@2
   991
	IMPORT_C TSdpIntBuf(const TUint32& aRef);
williamr@2
   992
	};
williamr@2
   993
williamr@2
   994
/**Speciality of Integer to Descriptor Convertor for TUint16s*/
williamr@2
   995
TEMPLATE_SPECIALIZATION class TSdpIntBuf<TUint16> : public TSdpIntBuf<TUint>
williamr@2
   996
	{
williamr@2
   997
public:
williamr@2
   998
	IMPORT_C TSdpIntBuf(const TUint16& aRef);
williamr@2
   999
	};
williamr@2
  1000
williamr@2
  1001
/**Speciality of Integer to Descriptor Convertor for TUint8s*/
williamr@2
  1002
TEMPLATE_SPECIALIZATION class TSdpIntBuf<TUint8> : public TSdpIntBuf<TUint>
williamr@2
  1003
	{
williamr@2
  1004
public:
williamr@2
  1005
	IMPORT_C TSdpIntBuf(const TUint8& aRef);
williamr@2
  1006
	};
williamr@2
  1007
williamr@2
  1008
williamr@2
  1009
williamr@2
  1010
// This function has to be inline and not exported since otherwise
williamr@2
  1011
// the replacement of T for the class provided doesn't work.
williamr@2
  1012
template <class T>
williamr@2
  1013
inline TSdpIntBuf<T>::TSdpIntBuf(const T &aRef)
williamr@2
  1014
	{
williamr@2
  1015
	TBufC8<sizeof(T)>::DoSetLength(sizeof(T));
williamr@2
  1016
	SdpUtil::PutUint(TBufC8<sizeof(T)>::iBuf, TInt64(aRef), sizeof(T));
williamr@2
  1017
	}
williamr@2
  1018
williamr@2
  1019
//*************************************************************
williamr@2
  1020
//
williamr@2
  1021
//  SDP Agent client API
williamr@2
  1022
//
williamr@2
  1023
//*************************************************************
williamr@2
  1024
williamr@2
  1025
class MSdpAgentNotifier
williamr@2
  1026
/** Handles responses to Bluetooth Service Discovery Protocol queries.
williamr@2
  1027
williamr@2
  1028
Clients that make queries through CSdpAgent must implement this interface 
williamr@2
  1029
to handle the responses. 
williamr@2
  1030
williamr@2
  1031
@see CSdpAgent::AttributeRequestL() */
williamr@2
  1032
	{
williamr@2
  1033
public:
williamr@2
  1034
	/** Called when an service record request (CSdpAgent::NextRecordRequestComplete()) 
williamr@2
  1035
	operation completes.
williamr@2
  1036
	
williamr@2
  1037
	@param aError KErrNone if successful;
williamr@2
  1038
	              KErrEof if there are no more SDP records left to be read; or an SDP error.
williamr@2
  1039
	@param aHandle Service record for which the query was made
williamr@2
  1040
	@param aTotalRecordsCount Total number of matching records
williamr@2
  1041
	@see CSdpAgent::NextRecordRequestL() */
williamr@2
  1042
	virtual void NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount)=0;
williamr@2
  1043
williamr@2
  1044
	/** Called when an attribute request (CSdpAgent::AttributeRequestL()) wants to 
williamr@2
  1045
	pass up a result.
williamr@2
  1046
	
williamr@2
  1047
	@param aHandle Service record for which the query was made
williamr@2
  1048
	@param aAttrID ID of the attribute obtained
williamr@2
  1049
	@param aAttrValue Attribute value obtained
williamr@2
  1050
	@see CSdpAgent::AttributeRequestL() */
williamr@2
  1051
	virtual void AttributeRequestResult(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue)=0;
williamr@2
  1052
williamr@2
  1053
	/** Called when an attribute request (CSdpAgent::AttributeRequestL()) wants to 
williamr@2
  1054
	signal the completion of a attribute request.
williamr@2
  1055
	
williamr@2
  1056
	@param aHandle Service record for which the query was made
williamr@2
  1057
	@param aError an error
williamr@2
  1058
	@see CSdpAgent::AttributeRequestL() */
williamr@2
  1059
	virtual void AttributeRequestComplete(TSdpServRecordHandle, TInt aError)=0;
williamr@2
  1060
williamr@2
  1061
    /**
williamr@2
  1062
 	 Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is.
williamr@2
  1063
	 @param aInterface UID of the interface to return
williamr@2
  1064
	 @param aObject the container for another interface as specified by aInterface
williamr@2
  1065
	 */
williamr@2
  1066
	IMPORT_C virtual void MSAN_ExtensionInterfaceL(TUid aInterface, void*& aObject);	
williamr@2
  1067
	};
williamr@2
  1068
williamr@2
  1069
class CSdpAgentEng;
williamr@2
  1070
class CSdpSearchPattern;
williamr@2
  1071
class CSdpAttrIdMatchList;
williamr@2
  1072
williamr@2
  1073
NONSHARABLE_CLASS(CSdpAgent) : public CBase
williamr@2
  1074
/** Makes Bluetooth service discovery protocol (SDP) requests to a remote device.
williamr@2
  1075
williamr@2
  1076
To make SDP requests, 
williamr@2
  1077
williamr@2
  1078
Construct a CSdpAgent object with the Bluetooth address of the remote device 
williamr@2
  1079
to query.
williamr@2
  1080
williamr@2
  1081
Set the classes of service that you want to query for. The classes have predefined 
williamr@2
  1082
UUIDs, which you specify with SetRecordFilterL(). 
williamr@2
  1083
williamr@2
  1084
Get results through NextRecordRequestL(). Information on services is stored 
williamr@2
  1085
as records, which can be queried in turn for attribute values for the service 
williamr@2
  1086
through AttributeRequestL().
williamr@2
  1087
williamr@2
  1088
A user of this class must implement MSdpAgentNotifier to receive the responses 
williamr@2
  1089
to queries.
williamr@2
  1090
williamr@2
  1091
Note that queries are asynchronous, although this is hidden in the API. The 
williamr@2
  1092
implication is that the interface functions that receive responses are only 
williamr@2
  1093
called when the thread's active scheduler can schedule handling of the completion 
williamr@2
  1094
of the query. 
williamr@2
  1095
williamr@2
  1096
@see MSdpAgentNotifier */
williamr@2
  1097
	{
williamr@2
  1098
public:
williamr@2
  1099
	IMPORT_C static CSdpAgent* NewL(MSdpAgentNotifier& aNotifier, const TBTDevAddr& aDevAddr);
williamr@2
  1100
	IMPORT_C static CSdpAgent* NewLC(MSdpAgentNotifier& aNotifier, const TBTDevAddr& aDevAddr);
williamr@2
  1101
	IMPORT_C ~CSdpAgent();
williamr@2
  1102
	IMPORT_C void SetRecordFilterL(const CSdpSearchPattern& aUUIDFilter);
williamr@2
  1103
	IMPORT_C void SetAttributePredictorListL(const CSdpAttrIdMatchList& aMatchList);
williamr@2
  1104
	IMPORT_C void NextRecordRequestL();
williamr@2
  1105
williamr@2
  1106
	IMPORT_C void AttributeRequestL(TSdpServRecordHandle aHandle, 
williamr@2
  1107
								   TSdpAttributeID aAttrID);
williamr@2
  1108
	IMPORT_C void AttributeRequestL(TSdpServRecordHandle aHandle, 
williamr@2
  1109
								   const CSdpAttrIdMatchList& aMatchList);
williamr@2
  1110
	IMPORT_C void AttributeRequestL(MSdpElementBuilder* aBuilder,
williamr@2
  1111
		                           TSdpServRecordHandle aHandle, 
williamr@2
  1112
								   TSdpAttributeID aAttrID);
williamr@2
  1113
	IMPORT_C void AttributeRequestL(MSdpElementBuilder* aBuilder,
williamr@2
  1114
		                           TSdpServRecordHandle aHandle, 
williamr@2
  1115
								   const CSdpAttrIdMatchList& aMatchList);
williamr@2
  1116
	IMPORT_C void Cancel();
williamr@2
  1117
williamr@2
  1118
private:
williamr@2
  1119
	CSdpAgent();
williamr@2
  1120
	void ConstructL(MSdpAgentNotifier& aNotifier, TBTDevAddr aDevAddr);
williamr@2
  1121
williamr@2
  1122
williamr@2
  1123
private:
williamr@2
  1124
	CSdpAgentEng* iAgentEngine;	
williamr@2
  1125
	};
williamr@2
  1126
williamr@2
  1127
NONSHARABLE_CLASS(CSdpSearchPattern) : public CBase, public MSdpElementBuilder
williamr@2
  1128
/** A list of Bluetooth service classes, represented as Universal Unique Identifiers 
williamr@2
  1129
(UUIDs), to be matched in SDP Service Search Requests.
williamr@2
  1130
williamr@2
  1131
@see CSdpAgent::SetRecordFilterL()
williamr@2
  1132
@see TUUID */
williamr@2
  1133
	{
williamr@2
  1134
public:
williamr@2
  1135
	IMPORT_C static CSdpSearchPattern* NewL();
williamr@2
  1136
	IMPORT_C void ConstructL();
williamr@2
  1137
	IMPORT_C ~CSdpSearchPattern();
williamr@2
  1138
	IMPORT_C TInt AddL(const TUUID& aUUID);
williamr@2
  1139
	IMPORT_C TInt Remove(const TUUID& aUUID);
williamr@2
  1140
	IMPORT_C TInt Find(const TUUID& aUUID, TInt &aPos) const;
williamr@2
  1141
	IMPORT_C TInt Count() const;
williamr@2
  1142
	IMPORT_C const TUUID At(TInt anIndex) const;
williamr@2
  1143
	IMPORT_C void Reset();
williamr@2
  1144
	/** Tests if the list is empty.
williamr@2
  1145
	
williamr@2
  1146
	@return True if the list is empty */
williamr@2
  1147
	IMPORT_C TBool IsEmpty();
williamr@2
  1148
	
williamr@2
  1149
private:
williamr@2
  1150
	CSdpSearchPattern();
williamr@2
  1151
williamr@2
  1152
private:
williamr@2
  1153
	// Implementation of Mbuilder interface
williamr@2
  1154
	MSdpElementBuilder* BuildUUIDL(const TUUID& aUUID);
williamr@2
  1155
	MSdpElementBuilder* BuildDESL();
williamr@2
  1156
	MSdpElementBuilder* StartListL();
williamr@2
  1157
	MSdpElementBuilder* EndListL();
williamr@2
  1158
	
williamr@2
  1159
private:
williamr@2
  1160
	CArrayFixFlat<TUUID>* iUUIDArray;
williamr@2
  1161
	};
williamr@2
  1162
williamr@2
  1163
struct TAttrRange
williamr@2
  1164
/** A range of attribute ID values.
williamr@2
  1165
williamr@2
  1166
This class is used in an attribute list, CSdpAttrIdMatchList, so that all 
williamr@2
  1167
attributes with IDs in the specified range are considered.
williamr@2
  1168
williamr@2
  1169
@see CSdpAttrIdMatchList */
williamr@2
  1170
	{
williamr@2
  1171
public:
williamr@2
  1172
	/** Default constructor. */
williamr@2
  1173
	IMPORT_C TAttrRange();
williamr@2
  1174
	
williamr@2
  1175
	
williamr@2
  1176
	/** Constructor with single ID.
williamr@2
  1177
	
williamr@2
  1178
	@param aAttrId The start and the end of the range are both set to aAttrId */
williamr@2
  1179
	IMPORT_C TAttrRange(TSdpAttributeID aAttrId);
williamr@2
  1180
	
williamr@2
  1181
	
williamr@2
  1182
	/** Constructor with start and end IDs.
williamr@2
  1183
	
williamr@2
  1184
	@param aStart ID for the start of the range
williamr@2
  1185
	@param aEnd ID for the end of the range */
williamr@2
  1186
	IMPORT_C TAttrRange(TSdpAttributeID aStart, TSdpAttributeID aEnd);
williamr@2
  1187
	
williamr@2
  1188
	
williamr@2
  1189
	/** Tests if the specified ID is either within the range.
williamr@2
  1190
	
williamr@2
  1191
	@param aAttrId ID to test
williamr@2
  1192
	@return True if in range, else false */
williamr@2
  1193
	IMPORT_C TBool IsInRange(TSdpAttributeID aAttrId) const;
williamr@2
  1194
	
williamr@2
  1195
	
williamr@2
  1196
	/** Tests if the specified ID is either within the range, is one less than the 
williamr@2
  1197
	lower bound, or one more than the upper bound.
williamr@2
  1198
	
williamr@2
  1199
	@param aAttrId ID to test
williamr@2
  1200
	@return True if contiguous, else false */
williamr@2
  1201
	IMPORT_C TBool IsContiguousWith(TSdpAttributeID aAttrId) const;
williamr@2
  1202
	
williamr@2
  1203
	
williamr@2
  1204
	/** Tests if the specified range is contiguous with the range.
williamr@2
  1205
	
williamr@2
  1206
	@param aRange Range to test
williamr@2
  1207
	@return True if contiguous, else false */
williamr@2
  1208
	IMPORT_C TBool IsContiguousWith(TAttrRange aRange) const;
williamr@2
  1209
williamr@2
  1210
public:
williamr@2
  1211
	/** ID of the start of the range */
williamr@2
  1212
	TSdpAttributeID iStart;
williamr@2
  1213
	/** ID of the end of the range */
williamr@2
  1214
	TSdpAttributeID iEnd;
williamr@2
  1215
	
williamr@2
  1216
private:
williamr@2
  1217
	// This data padding has been added to help prevent future binary compatibility breaks	
williamr@2
  1218
	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
williamr@2
  1219
	TUint32     iPadding1; 
williamr@2
  1220
	TUint32     iPadding2; 	
williamr@2
  1221
	};
williamr@2
  1222
williamr@2
  1223
williamr@2
  1224
/** Greatest range possible for attribute IDs.
williamr@2
  1225
 
williamr@2
  1226
Useful for including all attributes in a CSdpAttrIdMatchList
williamr@2
  1227
@see CSdpAttrIdMatchList*/
williamr@2
  1228
#define KAttrRangeAll TAttrRange(0, KMaxTUint16)
williamr@2
  1229
williamr@2
  1230
williamr@2
  1231
class CSdpServRecord;
williamr@2
  1232
class TElementEncoder;
williamr@2
  1233
class MAttributeMatchHandler;
williamr@2
  1234
williamr@2
  1235
NONSHARABLE_CLASS(CSdpAttrIdMatchList) : public CBase, public MSdpElementBuilder
williamr@2
  1236
/** SDP Attribute ID Match list.
williamr@2
  1237
williamr@2
  1238
Holds a list of Attribute IDs to be retrieved from a remote device in an Service 
williamr@2
  1239
Attribute Request. Set in terms of ranges of attributes, each one specified 
williamr@2
  1240
through a TAttrRange. */
williamr@2
  1241
	{
williamr@2
  1242
public:
williamr@2
  1243
	IMPORT_C static CSdpAttrIdMatchList* NewL();
williamr@2
  1244
	IMPORT_C static CSdpAttrIdMatchList* NewL(const CSdpAttrIdMatchList& aAttrMatchList);
williamr@2
  1245
	IMPORT_C ~CSdpAttrIdMatchList();
williamr@2
  1246
	IMPORT_C void AddL(TAttrRange aRange);
williamr@2
  1247
	IMPORT_C void RemoveL(TAttrRange aRange);
williamr@2
  1248
	TInt Find(TSdpAttributeID aAttrId, TInt &aPos) const;
williamr@2
  1249
	
williamr@2
  1250
	// Do not use this - it gives an off-by-one error for aPos
williamr@2
  1251
	// unless the attribute is the first one in a contiguous range.
williamr@2
  1252
	// Use InMatchListRange() instead
williamr@2
  1253
	IMPORT_C TBool InMatchList(TSdpAttributeID aAttrId, TInt &aPos) const; 
williamr@2
  1254
	
williamr@2
  1255
williamr@2
  1256
williamr@2
  1257
	/** Tests if the specified attribute ID is in the list.
williamr@2
  1258
	
williamr@2
  1259
	@param aAttrId Attribute ID to test
williamr@2
  1260
	@return ETrue if the attribute is in the list, else EFalse */
williamr@2
  1261
	IMPORT_C TBool InMatchList(TSdpAttributeID aAttrId) const;
williamr@2
  1262
williamr@2
  1263
williamr@2
  1264
	/** Gets the number of separate ranges of attribute IDs in the list.
williamr@2
  1265
	
williamr@2
  1266
	@return Number of ranges of attribute IDs in the list */
williamr@2
  1267
	IMPORT_C TInt Count() const;
williamr@2
  1268
williamr@2
  1269
	void FindAttributesL(CSdpServRecord &aRec, MAttributeMatchHandler &aHandler) const;
williamr@2
  1270
	
williamr@2
  1271
	/**
williamr@4
  1272
	This method is for internal sub-system use only, it is not to be used otherwise.
williamr@2
  1273
	@internalTechnology
williamr@2
  1274
	@released
williamr@2
  1275
	*/
williamr@2
  1276
    IMPORT_C TUint EncodeL(TElementEncoder aEncoder) const;
williamr@2
  1277
    
williamr@2
  1278
    
williamr@2
  1279
	/** Tests if the specified attribute ID is in the list.
williamr@2
  1280
	
williamr@2
  1281
	@param aAttrId Attribute ID to test
williamr@2
  1282
	@param aRange Position of the range of IDs in the list which contains aAttrId, or 0 if not found
williamr@2
  1283
	@return ETrue if the attribute is in the list, else EFalse */
williamr@2
  1284
	IMPORT_C TBool InMatchListRange(TSdpAttributeID aAttrId, TInt &aRange) const; 
williamr@2
  1285
    
williamr@2
  1286
williamr@2
  1287
private:
williamr@2
  1288
	// Implementation of MSdpElementBuilder interface
williamr@2
  1289
	MSdpElementBuilder* BuildUintL(const TDesC8& aUint);
williamr@2
  1290
	MSdpElementBuilder* BuildDESL();
williamr@2
  1291
	MSdpElementBuilder* StartListL();
williamr@2
  1292
	MSdpElementBuilder* EndListL();
williamr@2
  1293
	TInt FindInOrContiguousWith(TSdpAttributeID aAttrId, TInt &aPos) const;
williamr@2
  1294
williamr@2
  1295
private:
williamr@2
  1296
	CSdpAttrIdMatchList();
williamr@2
  1297
	CArrayFix<TAttrRange>* iList;
williamr@2
  1298
	
williamr@2
  1299
	__DECLARE_TEST;
williamr@2
  1300
	};
williamr@2
  1301
williamr@2
  1302
williamr@2
  1303
// interface via NetDB
williamr@2
  1304
// includes parser and builder to use it
williamr@2
  1305
williamr@2
  1306
williamr@2
  1307
/** Cannot bind to specifed sockets protocol, as already bound. */
williamr@2
  1308
const static TInt KErrSdpAlreadyBound = -6400;
williamr@2
  1309
/** Remote device gave unknown error. */
williamr@2
  1310
const static TInt KErrSdpPeerError = -6401;
williamr@2
  1311
/** Local device is not connected. */
williamr@2
  1312
const static TInt KErrSdpClientNotConnected = -6402;
williamr@2
  1313
/** Invalid/unsupported SDP version. */
williamr@2
  1314
const static TInt KErrSdpUnsupportedVersion = -6403;
williamr@2
  1315
/** Invalid Service Record Handle. */
williamr@2
  1316
const static TInt KErrSdpBadRecordHandle = -6404;
williamr@2
  1317
/** Invalid Continuation State. */
williamr@2
  1318
const static TInt KErrSdpBadContinuationState = -6405;
williamr@2
  1319
/** SDP server rejected the request. */
williamr@2
  1320
const static TInt KErrSdpServerRejectedRequest = -6406;
williamr@2
  1321
/** Request buffer was ill-formed. */
williamr@2
  1322
const static TInt KErrSdpBadRequestBufferLength = -6407;
williamr@2
  1323
/** Result buffer was ill-formed. */
williamr@2
  1324
const static TInt KErrSdpBadResultBufferLength = -6408;
williamr@2
  1325
/** UUID entry was ill-formed. */
williamr@2
  1326
const static TInt KErrSdpBadUUIDLength = -6409;
williamr@2
  1327
/** Response was ill-formed. */
williamr@2
  1328
const static TInt KErrSdpBadResultData = -6410;
williamr@2
  1329
/** SDP database is full. */
williamr@2
  1330
const static TInt KErrSdpDatabaseFull = -6411;
williamr@2
  1331
williamr@2
  1332
williamr@2
  1333
template <class T> class CSdpStackFix;
williamr@2
  1334
williamr@2
  1335
NONSHARABLE_CLASS(CElementParser) : public CBase
williamr@2
  1336
/** Parser for SDP attribute values.
williamr@2
  1337
williamr@2
  1338
The class parses an input buffer containing an attribute value into its constituent 
williamr@2
  1339
data elements. It calls an MSdpElementBuilder object each time a data element 
williamr@2
  1340
is decoded.
williamr@2
  1341
williamr@2
  1342
This parser can parse incrementally, and be fed new data as it arrives.
williamr@2
  1343
williamr@2
  1344
@see MSdpElementBuilder */
williamr@2
  1345
	{
williamr@2
  1346
public:
williamr@2
  1347
NONSHARABLE_CLASS(CLinearBuf) : public CBase
williamr@2
  1348
/*Buffer used for a buffered parse.*/
williamr@2
  1349
	{
williamr@2
  1350
public:
williamr@2
  1351
	static CLinearBuf* NewLC(TInt aExpandSize);
williamr@2
  1352
	~CLinearBuf();
williamr@2
  1353
	void AppendL(const TDesC8& aData);
williamr@2
  1354
	const TPtrC8 Ptr() const;
williamr@2
  1355
	void Consume(TInt aLength);
williamr@2
  1356
	TInt Size() const;
williamr@2
  1357
williamr@2
  1358
private:
williamr@2
  1359
	CLinearBuf();
williamr@2
  1360
	void ConstructL(TInt aExpandSize);
williamr@2
  1361
williamr@2
  1362
	CBufFlat* iBuf;
williamr@2
  1363
	TInt iStartOffset;
williamr@2
  1364
	};
williamr@2
  1365
williamr@2
  1366
public:
williamr@2
  1367
	IMPORT_C static CElementParser* NewL(MSdpElementBuilder* aBuilder);
williamr@2
  1368
	IMPORT_C ~CElementParser();
williamr@2
  1369
	IMPORT_C TInt ParseElementsL(const TDesC8& aData);
williamr@2
  1370
	IMPORT_C TBool BufferedParseL(const TDesC8& aData);
williamr@2
  1371
	IMPORT_C void Reset();
williamr@2
  1372
	IMPORT_C void Reset(MSdpElementBuilder* aBuilder);
williamr@2
  1373
	IMPORT_C void SetBuilder(MSdpElementBuilder* aBuilder);
williamr@2
  1374
	IMPORT_C MSdpElementBuilder* Builder();
williamr@2
  1375
williamr@2
  1376
private:
williamr@2
  1377
	void ConstructL();
williamr@2
  1378
	CElementParser(MSdpElementBuilder* aBuilder);
williamr@2
  1379
	static TBool IsComposite(TUint8 aType);
williamr@2
  1380
	void CloseListsL();
williamr@2
  1381
williamr@2
  1382
	MSdpElementBuilder* iBuilder;
williamr@2
  1383
	CSdpStackFix<TInt>* iListStack;
williamr@2
  1384
	CLinearBuf* iRemainderBuf;
williamr@2
  1385
	};
williamr@2
  1386
williamr@2
  1387
_LIT(KSdpClientPanic,"SDPServer");
williamr@2
  1388
enum TSdpClientPanic
williamr@2
  1389
	{
williamr@2
  1390
	ESdpBadRequest = 0,
williamr@2
  1391
	ESdpBadDescriptor = 1,
williamr@2
  1392
	ESdpBadSubSessionHandle = 6,
williamr@2
  1393
	ESdpBadSubSessionRemove = 7,
williamr@2
  1394
	ESdpNonExistantRecordHandle = 12,
williamr@2
  1395
	};
williamr@2
  1396
williamr@2
  1397
#endif