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