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