williamr@2: // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @file williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: #ifndef BTSDP_H williamr@2: #define BTSDP_H williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: williamr@2: /** The UID of the SDP Server. williamr@2: williamr@2: @see TBTServiceSecurity */ williamr@2: static const TUid KUidServiceSDP = {0x100095FA}; williamr@2: williamr@2: /** Attribute ID. */ williamr@2: typedef TUint16 TSdpAttributeID; williamr@2: williamr@2: // Universal Attributes williamr@2: /** Service Record Handle. */ williamr@2: static const TSdpAttributeID KSdpAttrIdServiceRecordHandle = 0x0000; williamr@2: /** Service ClassID List. */ williamr@2: static const TSdpAttributeID KSdpAttrIdServiceClassIDList = 0x0001; williamr@2: /** Service Record State. */ williamr@2: static const TSdpAttributeID KSdpAttrIdServiceRecordState = 0x0002; williamr@2: /** ServiceID. */ williamr@2: static const TSdpAttributeID KSdpAttrIdServiceID = 0x0003; williamr@2: /** Protocol Descriptor List. */ williamr@2: static const TSdpAttributeID KSdpAttrIdProtocolDescriptorList = 0x0004; williamr@2: /** Browse Group List. */ williamr@2: static const TSdpAttributeID KSdpAttrIdBrowseGroupList = 0x0005; williamr@2: /** Language Base Attribute ID List. */ williamr@2: static const TSdpAttributeID KSdpAttrIdLanguageBaseAttributeIDList = 0x0006; williamr@2: /** Service Info Time To Live. */ williamr@2: static const TSdpAttributeID KSdpAttrIdServiceInfoTimeToLive = 0x0007; williamr@2: /** Service Availability. */ williamr@2: static const TSdpAttributeID KSdpAttrIdServiceAvailability = 0x0008; williamr@2: /** Bluetooth Profile Descriptor List. */ williamr@2: static const TSdpAttributeID KSdpAttrIdBluetoothProfileDescriptorList = 0x0009; williamr@2: /** Documentation URL. */ williamr@2: static const TSdpAttributeID KSdpAttrIdDocumentationURL = 0x000A; williamr@2: /** Client Executable URL. */ williamr@2: static const TSdpAttributeID KSdpAttrIdClientExecutableURL = 0x000B; williamr@2: /** Icon URL. */ williamr@2: static const TSdpAttributeID KSdpAttrIdIconURL = 0x000C; williamr@2: williamr@2: williamr@2: /** PAN Profile Security enforcement */ williamr@2: static const TSdpAttributeID KSdpAttrIdSecurityDescription = 0x030a; williamr@2: williamr@2: /** PAN Profile, NAP access type */ williamr@2: static const TSdpAttributeID KSdpAttrIdNetAccessType = 0x030b; williamr@2: williamr@2: /** PAN Profile, NAP maximum throughput of uplink network (octets/second) */ williamr@2: static const TSdpAttributeID KSdpAttrIdMaxNetAccessRate = 0x030c; williamr@2: williamr@2: /** PAN Profile, NAP IPv4 Subnet */ williamr@2: static const TSdpAttributeID KSdpAttrIdIPv4Subnet = 0x030d; williamr@2: williamr@2: /** PAN Profile, NAP IPv6 Subnet */ williamr@2: static const TSdpAttributeID KSdpAttrIdIPv6Subnet = 0x030e; williamr@2: williamr@2: /** SupportedCapabilities */ williamr@2: static const TSdpAttributeID KSdpAttrIdSupportedCapabilities = 0x0310; williamr@2: /** SupportedFeatures */ williamr@2: static const TSdpAttributeID KSdpAttrIdSupportedFeatures = 0x0311; williamr@2: /** SupportedFunctions */ williamr@2: static const TSdpAttributeID KSdpAttrIdSupportedFunctions = 0x0312; williamr@2: williamr@2: williamr@2: // Language specific attributes williamr@2: williamr@2: /** Primary Language. */ williamr@2: static const TSdpAttributeID KSdpAttrIdBasePrimaryLanguage = 0x0100; williamr@2: static const TSdpAttributeID KSdpAttrIdCharacterEncodingUTF8 = 0x006a; williamr@2: williamr@2: /** Service Name. williamr@2: williamr@2: This is an offset that should be added to the attribute ID base (contained williamr@2: in the LanguageBaseAttributeIDList attribute). */ williamr@2: static const TInt KSdpAttrIdOffsetServiceName = 0x0000; // + Language offset williamr@2: williamr@2: williamr@2: /** Service Description. williamr@2: williamr@2: This is an offset that should be added to the attribute ID base (contained williamr@2: in the LanguageBaseAttributeIDList attribute). */ williamr@2: static const TInt KSdpAttrIdOffsetServiceDescription = 0x0001; // + Language offset williamr@2: williamr@2: williamr@2: /** Provider Name. williamr@2: williamr@2: This is an offset that should be added to the attribute ID base (contained williamr@2: in the LanguageBaseAttributeIDList attribute). */ williamr@2: static const TInt KSdpAttrIdOffsetProviderName = 0x0002; // + Language offset williamr@2: williamr@2: williamr@2: // SDP server specific attributes williamr@2: /** Version Number List. */ williamr@2: static const TSdpAttributeID KSdpAttrIdSdpServerVersionNumberList = 0x0200; williamr@2: /** Service Database State. */ williamr@2: static const TSdpAttributeID KSdpAttrIdSdpServerServiceDatabaseState = 0x0201; williamr@2: /** GroupID. */ williamr@2: static const TSdpAttributeID KSdpAttrIdSdpServerGroupID = 0x0200; williamr@2: williamr@2: williamr@2: // Protocol UUIDs (add to these as necessary) williamr@2: static const TInt KL2CAPUUID = 0x0100; williamr@2: static const TInt KBnepUUID = 0x000f; williamr@2: static const TInt KAvctpUUID = 0x0017; williamr@2: static const TInt KAvdtpUUID = 0x0019; williamr@2: static const TInt KObexProtocolUUID = 0x0008; williamr@2: static const TInt KRFCommUUID = 0x0003; williamr@2: williamr@2: // Service class UUIDs (add to these as necessary) williamr@2: /** L2CAP UUID used for continuation tests*/ williamr@2: static const TUint32 KSdpContTestUUID = 0x100; williamr@2: /** Serial Port UUID */ williamr@2: static const TInt KSerialPortUUID = 0x1101; williamr@2: /** Dial Networking UUID */ williamr@2: static const TInt KDialUpNetworkingUUID = 0x1103; williamr@2: /** General Networking UUID */ williamr@2: static const TInt KGenericNetworkingUUID = 0x1201; williamr@2: /** Fax UUID */ williamr@2: static const TInt KFaxUUID = 0x1111; williamr@2: /** Generic Telaphony UUID */ williamr@2: static const TInt KGenericTelephonyUUID = 0x1204; williamr@2: /** Obex UUID */ williamr@2: static const TInt KObexUUID = 0x1105; williamr@2: /** Attribute number for the Protocol Descriptor List */ williamr@2: static const TInt KProtocolDescriptorListUUID = 0x0004; williamr@2: /** Public Browse Group UUID */ williamr@2: static const TInt KPublicBrowseGroupUUID = 0x1002; williamr@2: /** Browse Group Descriptor Service Class UUID */ williamr@2: static const TInt KBrowseGroupDescriptorServiceClassUUID = 0x1001; williamr@2: /** Service Discovery Server Service Class UUID */ williamr@2: static const TInt KServiceDiscoveryServerServiceClassUUID = 0x1000; williamr@2: /** PAN Service Class UUID */ williamr@2: static const TInt KPanUUUID = 0x1115; williamr@2: /** PAN NAP Service Class UUID */ williamr@2: static const TInt KPanNapUUID = 0x1116; williamr@2: /** PAN GN Service Class UUID */ williamr@2: static const TInt KPanGnUUID = 0x1117; williamr@2: /** Audio Source (service class) UUID */ williamr@2: static const TInt KAudioSourceUUID = 0x110a; williamr@2: /** Audio Sink (service class) UUID */ williamr@2: static const TInt KAudioSinkUUID = 0x110b; williamr@2: /** Remote control target (service class) UUID */ williamr@2: static const TInt KAVRemoteControlTargetUUID = 0x110c; williamr@2: /** Advanced audio distribution (A2DP) (profile descriptor) UUID */ williamr@2: static const TInt KAdvancedAudioDistributionUUID = 0x110d; williamr@2: /** Remote control (service class) UUID */ williamr@2: static const TInt KAVRemoteControlUUID = 0x110E; williamr@2: /** PBAP PSE Service Class UUID */ williamr@2: static const TInt KPbapPseUUID = 0x112F; williamr@2: williamr@2: williamr@2: // Language codes, as per "ISO 639:1988 (E/F)" williamr@2: /** Afar */ williamr@2: static const TInt16 KLanguageAfar = 0x6161; // aa williamr@2: /** Abkhazian */ williamr@2: static const TInt16 KLanguageAbkhazian = 0x6162; // ab williamr@2: /** Afrikaans */ williamr@2: static const TInt16 KLanguageAfrikaans = 0x6166; // af williamr@2: /** Amharic */ williamr@2: static const TInt16 KLanguageAmharic = 0x616D; // am williamr@2: /** Arabic */ williamr@2: static const TInt16 KLanguageArabic = 0x6172; // ar williamr@2: /** Assamese */ williamr@2: static const TInt16 KLanguageAssamese = 0x6173; // as williamr@2: /** Aymara */ williamr@2: static const TInt16 KLanguageAymara = 0x6179; // ay williamr@2: /** Azerbaijani */ williamr@2: static const TInt16 KLanguageAzerbaijani = 0x617A; // az williamr@2: /** Bashkir */ williamr@2: static const TInt16 KLanguageBashkir = 0x6261; // ba williamr@2: /** Byelorussian */ williamr@2: static const TInt16 KLanguageByelorussian = 0x6265; // be williamr@2: /** Bulgarian */ williamr@2: static const TInt16 KLanguageBulgarian = 0x6267; // bg williamr@2: /** Bihari */ williamr@2: static const TInt16 KLanguageBihari = 0x6268; // bh williamr@2: /** Bislama */ williamr@2: static const TInt16 KLanguageBislama = 0x6269; // bi williamr@2: /** Bengali */ williamr@2: static const TInt16 KLanguageBengali = 0x626E; // bn - also Bangala williamr@2: /** Tibetan */ williamr@2: static const TInt16 KLanguageTibetan = 0x626F; // bo williamr@2: /** Breton */ williamr@2: static const TInt16 KLanguageBreton = 0x6272; // br williamr@2: /** Catalan */ williamr@2: static const TInt16 KLanguageCatalan = 0x6361; // ca williamr@2: /** Corsican */ williamr@2: static const TInt16 KLanguageCorsican = 0x636F; // co williamr@2: /** Czech */ williamr@2: static const TInt16 KLanguageCzech = 0x6373; // cs williamr@2: /** Welsh */ williamr@2: static const TInt16 KLanguageWelsh = 0x6379; // cy williamr@2: /** Danish */ williamr@2: static const TInt16 KLanguageDanish = 0x6461; // da williamr@2: /** German */ williamr@2: static const TInt16 KLanguageGerman = 0x6465; // de williamr@2: /** Bhutani */ williamr@2: static const TInt16 KLanguageBhutani = 0x647A; // dz williamr@2: /** Greek */ williamr@2: static const TInt16 KLanguageGreek = 0x656C; // el williamr@2: /** English */ williamr@2: static const TInt16 KLanguageEnglish = 0x656E; // en williamr@2: /** Esperanto */ williamr@2: static const TInt16 KLanguageEsperanto = 0x656F; // eo williamr@2: /** Spanish */ williamr@2: static const TInt16 KLanguageSpanish = 0x6573; // es williamr@2: /** Estonian */ williamr@2: static const TInt16 KLanguageEstonian = 0x6574; // et williamr@2: /** Basque */ williamr@2: static const TInt16 KLanguageBasque = 0x6575; // eu williamr@2: /** Persian */ williamr@2: static const TInt16 KLanguagePersian = 0x6661; // fa williamr@2: /** Finnish */ williamr@2: static const TInt16 KLanguageFinnish = 0x6669; // fi williamr@2: /** Fiji */ williamr@2: static const TInt16 KLanguageFiji = 0x666A; // fj williamr@2: /** Faroese */ williamr@2: static const TInt16 KLanguageFaroese = 0x666F; // fo williamr@2: /** French */ williamr@2: static const TInt16 KLanguageFrench = 0x6672; // fr williamr@2: /** Frisian */ williamr@2: static const TInt16 KLanguageFrisian = 0x6679; // fy williamr@2: /** Irish */ williamr@2: static const TInt16 KLanguageIrish = 0x6761; // ga williamr@2: /** Scots Gaelic */ williamr@2: static const TInt16 KLanguageScotsGaelic = 0x6764; // gd williamr@2: /** Galician */ williamr@2: static const TInt16 KLanguageGalician = 0x676C; // gl williamr@2: /** Guarani */ williamr@2: static const TInt16 KLanguageGuarani = 0x676E; // gn williamr@2: /** Gujarati */ williamr@2: static const TInt16 KLanguageGujarati = 0x6775; // gu williamr@2: /** Hausa */ williamr@2: static const TInt16 KLanguageHausa = 0x6861; // ha williamr@2: /** Hebrew */ williamr@2: static const TInt16 KLanguageHebrew = 0x6865; // he - formerly iw williamr@2: /** Hindi */ williamr@2: static const TInt16 KLanguageHindi = 0x6869; // hi williamr@2: /** Croatian */ williamr@2: static const TInt16 KLanguageCroatian = 0x6872; // hr williamr@2: /** Hungarian */ williamr@2: static const TInt16 KLanguageHungarian = 0x6875; // hu williamr@2: /** Armenian */ williamr@2: static const TInt16 KLanguageArmenian = 0x6879; // hy williamr@2: /** Interlingua */ williamr@2: static const TInt16 KLanguageInterlingua = 0x6961; // ia williamr@2: /** Indonesian */ williamr@2: static const TInt16 KLanguageIndonesian = 0x6964; // id - formerly in williamr@2: /** Interlingue */ williamr@2: static const TInt16 KLanguageInterlingue = 0x6965; // ie williamr@2: /** Inupiak */ williamr@2: static const TInt16 KLanguageInupiak = 0x696B; // ik williamr@2: /** Icelandic */ williamr@2: static const TInt16 KLanguageIcelandic = 0x6973; // is williamr@2: /** Italian */ williamr@2: static const TInt16 KLanguageItalian = 0x6974; // it williamr@2: /** Inuktitut */ williamr@2: static const TInt16 KLanguageInuktitut = 0x6975; // iu williamr@2: /** Japanese */ williamr@2: static const TInt16 KLanguageJapanese = 0x6A61; // ja williamr@2: /** Javanese */ williamr@2: static const TInt16 KLanguageJavanese = 0x6A77; // jw williamr@2: /** Georgian */ williamr@2: static const TInt16 KLanguageGeorgian = 0x6B61; // ka williamr@2: /** Kazakh */ williamr@2: static const TInt16 KLanguageKazakh = 0x6B6B; // kk williamr@2: /** Greenlandic */ williamr@2: static const TInt16 KLanguageGreenlandic = 0x6B6C; // kl williamr@2: /** Cambodian */ williamr@2: static const TInt16 KLanguageCambodian = 0x6B6D; // km williamr@2: /** Kannada */ williamr@2: static const TInt16 KLanguageKannada = 0x6B6E; // kn williamr@2: /** Korean */ williamr@2: static const TInt16 KLanguageKorean = 0x6B6F; // ko williamr@2: /** Kashmiri */ williamr@2: static const TInt16 KLanguageKashmiri = 0x6B73; // ks williamr@2: /** Kurdish */ williamr@2: static const TInt16 KLanguageKurdish = 0x6B75; // ku williamr@2: /** Kirghiz */ williamr@2: static const TInt16 KLanguageKirghiz = 0x6B79; // ky williamr@2: /** Latin */ williamr@2: static const TInt16 KLanguageLatin = 0x6C61; // la williamr@2: /** Lingala */ williamr@2: static const TInt16 KLanguageLingala = 0x6C6E; // ln williamr@2: /** Laothian */ williamr@2: static const TInt16 KLanguageLaothian = 0x6C6F; // lo williamr@2: /** Lithuanian */ williamr@2: static const TInt16 KLanguageLithuanian = 0x6C74; // lt williamr@2: /** Latvian */ williamr@2: static const TInt16 KLanguageLatvian = 0x6C76; // lv - also Lettish williamr@2: /** Malagasy */ williamr@2: static const TInt16 KLanguageMalagasy = 0x6D67; // mg williamr@2: /** Maori */ williamr@2: static const TInt16 KLanguageMaori = 0x6D69; // mi williamr@2: /** Macedonian */ williamr@2: static const TInt16 KLanguageMacedonian = 0x6D6B; // mk williamr@2: /** Malayalam */ williamr@2: static const TInt16 KLanguageMalayalam = 0x6D6C; // ml williamr@2: /** Mongolian */ williamr@2: static const TInt16 KLanguageMongolian = 0x6D6E; // mn williamr@2: /** Moldavian */ williamr@2: static const TInt16 KLanguageMoldavian = 0x6D6F; // mo williamr@2: /** Marathi */ williamr@2: static const TInt16 KLanguageMarathi = 0x6D72; // mr williamr@2: /** Malay */ williamr@2: static const TInt16 KLanguageMalay = 0x6D73; // ms williamr@2: /** Maltese */ williamr@2: static const TInt16 KLanguageMaltese = 0x6D74; // mt williamr@2: /** Burmese */ williamr@2: static const TInt16 KLanguageBurmese = 0x6D79; // my williamr@2: /** Nauru */ williamr@2: static const TInt16 KLanguageNauru = 0x6E61; // na williamr@2: /** Nepali */ williamr@2: static const TInt16 KLanguageNepali = 0x6E65; // ne williamr@2: /** Dutch */ williamr@2: static const TInt16 KLanguageDutch = 0x6E6C; // nl williamr@2: /** Norwegian */ williamr@2: static const TInt16 KLanguageNorwegian = 0x6E6F; // no williamr@2: /** Occitan */ williamr@2: static const TInt16 KLanguageOccitan = 0x6F63; // oc williamr@2: /** Oromo */ williamr@2: static const TInt16 KLanguageOromo = 0x6F6D; // om - (Afan) williamr@2: /** Oriya */ williamr@2: static const TInt16 KLanguageOriya = 0x6F72; // or williamr@2: /** Punjabi */ williamr@2: static const TInt16 KLanguagePunjabi = 0x7061; // pa williamr@2: /** Polish */ williamr@2: static const TInt16 KLanguagePolish = 0x706C; // pl williamr@2: /** Pashto */ williamr@2: static const TInt16 KLanguagePashto = 0x7073; // ps williamr@2: /** Portuguese */ williamr@2: static const TInt16 KLanguagePortuguese = 0x7074; // pt williamr@2: /** Quechua */ williamr@2: static const TInt16 KLanguageQuechua = 0x7175; // qu williamr@2: /** Rhaeto Romance */ williamr@2: static const TInt16 KLanguageRhaetoRomance = 0x726D; // rm williamr@2: /** Kirundi */ williamr@2: static const TInt16 KLanguageKirundi = 0x726E; // rn williamr@2: /** Romanian */ williamr@2: static const TInt16 KLanguageRomanian = 0x726F; // ro williamr@2: /** Russian */ williamr@2: static const TInt16 KLanguageRussian = 0x7275; // ru williamr@2: /** Kinyarwanda */ williamr@2: static const TInt16 KLanguageKinyarwanda = 0x7277; // rw williamr@2: /** Sanskrit */ williamr@2: static const TInt16 KLanguageSanskrit = 0x7361; // sa williamr@2: /** Sindhi */ williamr@2: static const TInt16 KLanguageSindhi = 0x7364; // sd williamr@2: /** Sangho */ williamr@2: static const TInt16 KLanguageSangho = 0x7367; // sg williamr@2: /** SerboCroatian */ williamr@2: static const TInt16 KLanguageSerboCroatian = 0x7368; // sh williamr@2: /** Sinhalese */ williamr@2: static const TInt16 KLanguageSinhalese = 0x7369; // si williamr@2: /** Slovak */ williamr@2: static const TInt16 KLanguageSlovak = 0x736B; // sk williamr@2: /** Slovenian */ williamr@2: static const TInt16 KLanguageSlovenian = 0x736C; // sl williamr@2: /** Samoan */ williamr@2: static const TInt16 KLanguageSamoan = 0x736D; // sm williamr@2: /** Shona */ williamr@2: static const TInt16 KLanguageShona = 0x736E; // sn williamr@2: /** Somali */ williamr@2: static const TInt16 KLanguageSomali = 0x736F; // so williamr@2: /** Albanian */ williamr@2: static const TInt16 KLanguageAlbanian = 0x7371; // sq williamr@2: /** Serbian */ williamr@2: static const TInt16 KLanguageSerbian = 0x7372; // sr williamr@2: /** Siswati */ williamr@2: static const TInt16 KLanguageSiswati = 0x7373; // ss williamr@2: /** Sesotho */ williamr@2: static const TInt16 KLanguageSesotho = 0x7374; // st williamr@2: /** Sundanese */ williamr@2: static const TInt16 KLanguageSundanese = 0x7375; // su williamr@2: /** Swedish */ williamr@2: static const TInt16 KLanguageSwedish = 0x7376; // sv williamr@2: /** Swahili */ williamr@2: static const TInt16 KLanguageSwahili = 0x7377; // sw williamr@2: /** Tamil */ williamr@2: static const TInt16 KLanguageTamil = 0x7461; // ta williamr@2: /** Telugu */ williamr@2: static const TInt16 KLanguageTelugu = 0x7465; // te williamr@2: /** Tajik */ williamr@2: static const TInt16 KLanguageTajik = 0x7467; // tg williamr@2: /** Thai */ williamr@2: static const TInt16 KLanguageThai = 0x7468; // th williamr@2: /** Tigrinya */ williamr@2: static const TInt16 KLanguageTigrinya = 0x7469; // ti williamr@2: /** Turkmen */ williamr@2: static const TInt16 KLanguageTurkmen = 0x746B; // tk williamr@2: /** Tagalog */ williamr@2: static const TInt16 KLanguageTagalog = 0x746C; // tl williamr@2: /** Setswana */ williamr@2: static const TInt16 KLanguageSetswana = 0x746E; // tn williamr@2: /** Tonga */ williamr@2: static const TInt16 KLanguageTonga = 0x746F; // to williamr@2: /** Turkish */ williamr@2: static const TInt16 KLanguageTurkish = 0x7472; // tr williamr@2: /** Tsonga */ williamr@2: static const TInt16 KLanguageTsonga = 0x7473; // ts williamr@2: /** Tatar */ williamr@2: static const TInt16 KLanguageTatar = 0x7474; // tt williamr@2: /** Twi */ williamr@2: static const TInt16 KLanguageTwi = 0x7477; // tw williamr@2: /** Uighur */ williamr@2: static const TInt16 KLanguageUighur = 0x7567; // ug williamr@2: /** Ukrainian */ williamr@2: static const TInt16 KLanguageUkrainian = 0x756B; // uk williamr@2: /** Urdu */ williamr@2: static const TInt16 KLanguageUrdu = 0x7572; // ur williamr@2: /** Uzbek */ williamr@2: static const TInt16 KLanguageUzbek = 0x757A; // uz williamr@2: /** Vietnamese */ williamr@2: static const TInt16 KLanguageVietnamese = 0x7669; // vi williamr@2: /** Volapuk */ williamr@2: static const TInt16 KLanguageVolapuk = 0x766F; // vo williamr@2: /** Wolof */ williamr@2: static const TInt16 KLanguageWolof = 0x776F; // wo williamr@2: /** Xhosa */ williamr@2: static const TInt16 KLanguageXhosa = 0x7868; // xh williamr@2: /** Yiddish */ williamr@2: static const TInt16 KLanguageYiddish = 0x7969; // yi - formerly ji williamr@2: /** Yoruba */ williamr@2: static const TInt16 KLanguageYoruba = 0x796F; // yo williamr@2: /** Zhuang */ williamr@2: static const TInt16 KLanguageZhuang = 0x7A61; // za williamr@2: /** Chinese */ williamr@2: static const TInt16 KLanguageChinese = 0x7A68; // zh williamr@2: /** Zulu */ williamr@2: static const TInt16 KLanguageZulu = 0x7A75; // zu williamr@2: williamr@2: //***********************************************************************/ williamr@2: // williamr@2: // SDP database server API williamr@2: // williamr@2: //***********************************************************************/ williamr@2: williamr@2: /** Typedef for a TSdpAttributeID package buf */ williamr@2: typedef TPckgBuf TSdpAttributeIDPckgBuf; williamr@2: /** Handle to a service record. */ williamr@2: typedef TUint32 TSdpServRecordHandle; williamr@2: /** Typedef for a TSdpServRecordHandle package buf */ williamr@2: typedef TPckgBuf TSdpServRecordHandlePckgBuf; williamr@2: williamr@2: NONSHARABLE_CLASS(RSdp) : public RSessionBase williamr@2: /** Provides a session to the Service Discovery Database. williamr@2: williamr@2: Used to create subsessions to database functionality. A clients must create williamr@2: and connect a session, before using a RSdpDatabase subsession to access the williamr@2: database. williamr@2: williamr@2: @see RSdpDatabase */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C RSdp(); williamr@2: IMPORT_C TInt Connect(); williamr@2: IMPORT_C TVersion Version() const; williamr@2: IMPORT_C void ResourceCountMarkStart(); williamr@2: IMPORT_C void ResourceCountMarkEnd(); williamr@2: IMPORT_C TInt ResourceCount(); williamr@2: IMPORT_C TInt __DbgMarkHeap(); williamr@2: IMPORT_C TInt __DbgCheckHeap(TInt aCount); williamr@2: IMPORT_C TInt __DbgMarkEnd(TInt aCount); williamr@2: IMPORT_C TInt __DbgFailNext(TInt aCount); williamr@2: williamr@2: private: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(RSdpSubSession) : public RSubSessionBase williamr@2: /** Base class used in the derivation of RSdpDatabase. williamr@2: williamr@2: The class contains basic subssession functionality. It has no user accessible williamr@2: functions. */ williamr@2: { williamr@2: public: williamr@2: /** Opens subsession on an RSdp session williamr@2: @param aSession The session on which the subsession is being opened. williamr@2: */ williamr@2: IMPORT_C virtual TInt Open(RSdp& aSession)=0; williamr@2: /** Closes subsession */ williamr@2: IMPORT_C virtual void Close()=0; williamr@2: williamr@2: private: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: class CSdpAttrValueDES; williamr@2: class CSdpAttrValue; williamr@2: williamr@2: NONSHARABLE_CLASS(RSdpDatabase) : public RSdpSubSession williamr@2: /** Subsession to the SDP through which service records and their attributes can williamr@2: be added, deleted, and updated. */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C RSdpDatabase(); williamr@2: IMPORT_C TInt Open(RSdp& aSession); williamr@2: IMPORT_C void Close(); williamr@2: IMPORT_C void CreateServiceRecordL(const TUUID& aUUID, TSdpServRecordHandle& aHandle); williamr@2: IMPORT_C void CreateServiceRecordL(CSdpAttrValueDES& aUUIDList, TSdpServRecordHandle& aHandle); williamr@2: IMPORT_C void UpdateAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue& aAttrValue); williamr@2: IMPORT_C void UpdateAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, TUint aUintValue); williamr@2: IMPORT_C void UpdateAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, const TDesC16& aDesCValue); williamr@2: IMPORT_C void UpdateAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, const TDesC8& aDesCValue); williamr@2: IMPORT_C void DeleteAttributeL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID); williamr@2: IMPORT_C void DeleteAttribute(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID); williamr@2: IMPORT_C void DeleteRecordL(TSdpServRecordHandle aHandle); williamr@2: IMPORT_C void DeleteRecord(TSdpServRecordHandle aHandle); williamr@2: private: williamr@2: HBufC8* iBuffer; //used for synchronous requests (could have been local) williamr@2: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: williamr@2: class MSdpElementBuilder williamr@2: /** Constructs an attribute value, or a set of attributes, from multiple data elements. williamr@2: williamr@2: The builder interface is used for building single attribute values, and sets of attribute williamr@2: value, attribute ID pairs, as for example in a service record. williamr@2: williamr@2: In particular, the builder interface can be implemented to receive the results from williamr@2: CSdpAgent attribute queries. williamr@2: williamr@2: Each member function itself returns an MSdpElementBuilder interface that can williamr@2: then be used to add further elements. williamr@2: williamr@2: For more on the format of attribute values, see [BS1 Service Discovery Protocol williamr@2: 3]. williamr@2: williamr@2: Note that the interface defines each function to leave with the error KErrGeneral. williamr@2: williamr@2: @see CSdpAgent::AttributeRequestL() */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildUnknownL(TUint8 aType, TUint8 aSizeDesc, const TDesC8& aData); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildNilL(); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildUintL(const TDesC8& aUint); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildIntL(const TDesC8& aInt); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildUUIDL(const TUUID& aUUID); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildBooleanL(TBool aBool); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildStringL(const TDesC8& aString); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildDESL(); // Must not return NULL williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildDEAL(); // ditto williamr@2: IMPORT_C virtual MSdpElementBuilder* StartListL(); // ditto williamr@2: IMPORT_C virtual MSdpElementBuilder* EndListL(); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildURLL(const TDesC8& aURL); williamr@2: williamr@2: /** williamr@2: Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is. williamr@2: @param aInterface UID of the interface to return williamr@2: @param aObject the container for another interface as specified by aInterface williamr@2: */ williamr@2: IMPORT_C void MSEB_ExtensionInterfaceL(TUid aInterface, void*& aObject); williamr@2: }; williamr@2: williamr@2: /** Types of attribute data elements. */ williamr@2: enum TSdpElementType williamr@2: { williamr@2: /** Null type. */ williamr@2: ETypeNil = 0, williamr@2: /** Unsigned integer. */ williamr@2: ETypeUint = 1, williamr@2: /** Signed integer. */ williamr@2: ETypeInt = 2, williamr@2: /** UUID. */ williamr@2: ETypeUUID = 3, williamr@2: /** Text string. */ williamr@2: ETypeString = 4, williamr@2: /** Boolean. */ williamr@2: ETypeBoolean = 5, williamr@2: /** Data element sequence. */ williamr@2: ETypeDES = 6, williamr@2: /** Data element alternative. */ williamr@2: ETypeDEA = 7, williamr@2: /** URL. */ williamr@2: ETypeURL = 8, williamr@2: /** Outside SDP reserved range. */ williamr@2: ETypeEncoded = 32, // Outside SDP reserved range williamr@2: }; williamr@2: williamr@2: class MSdpAttributeValueVisitor; williamr@2: williamr@2: NONSHARABLE_CLASS(CSdpAttrValue) : public CBase williamr@2: /** Base class for classes that encapsulate SDP attributes values. williamr@2: williamr@2: Sub-classes of this wrap specific types of SDP service record attributes. williamr@2: For example, CSdpBoolean derives from CSdpAttrValue to encapsulate boolean williamr@2: attributes. The base class defines getters for all types: for example, it williamr@2: declares a function Bool() that returns the attribute value as a TBool. Note williamr@2: though that the function would panic unless called on actual CSdpBoolean. williamr@2: williamr@2: A common base class allows attributes of all types to be used polymorphically. williamr@2: You can use CSdpAttrValue's Type() function to find the actual type being williamr@2: used, and upcast the pointer appropriately. */ williamr@2: { williamr@2: public: williamr@2: CSdpAttrValue(); williamr@2: virtual ~CSdpAttrValue(); williamr@2: williamr@2: williamr@2: /** Gets the attribute type. williamr@2: williamr@2: @return Attribute type */ williamr@2: virtual TSdpElementType Type() const=0; williamr@2: williamr@2: williamr@2: /** Gets the size of the attribute. williamr@2: williamr@2: @return Size of the attribute in bytes */ williamr@2: virtual TUint DataSize() const=0; williamr@2: williamr@2: williamr@2: // getter interface williamr@2: virtual TUint Uint() const; williamr@2: virtual TInt Int() const; williamr@2: virtual TBool DoesIntFit() const; williamr@2: virtual TInt Bool() const; williamr@2: virtual const TUUID &UUID() const; williamr@2: virtual const TPtrC8 Des() const; williamr@2: williamr@2: virtual void AcceptVisitorL(MSdpAttributeValueVisitor& aVisitor); williamr@2: williamr@2: IMPORT_C void Uint64(TUint64& aValue) const; williamr@2: IMPORT_C void Uint128(TUint64& aLo, TUint64& aHi) const; williamr@2: williamr@2: protected: williamr@2: TInt Extension_(TUint aExtensionId, TAny *&a0, TAny *a1); williamr@2: }; williamr@2: williamr@2: /** Base class for classes that specify lists of attribute data elements. williamr@2: williamr@2: It implements the MSdpElementBuilder interface to build data elements into williamr@2: an attribute value. williamr@2: williamr@2: @see CSdpAttrValueDEA williamr@2: @see CSdpAttrValueDES */ williamr@2: NONSHARABLE_CLASS(CSdpAttrValueList) : public CSdpAttrValue, public MSdpElementBuilder williamr@2: { williamr@2: public: williamr@2: IMPORT_C virtual ~CSdpAttrValueList(); williamr@2: IMPORT_C virtual void AcceptVisitorL(MSdpAttributeValueVisitor& aVisitor); williamr@2: IMPORT_C virtual TUint DataSize() const; williamr@2: IMPORT_C void AppendValueL(CSdpAttrValue* aValue); williamr@2: williamr@2: // MSdpElementBuilder interface williamr@2: /** Adds an element of any type. williamr@2: williamr@2: @param aType Type descriptor williamr@2: @param aSizeDesc Size descriptor williamr@2: @param aData Data field williamr@2: @return Attribute value with added element */ williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildUnknownL(TUint8 aType, TUint8 aSizeDesc, const TDesC8& aData); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildNilL(); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildUintL(const TDesC8& aUint); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildIntL(const TDesC8& aInt); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildUUIDL(const TUUID& aUUID); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildBooleanL(TBool aBool); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildStringL(const TDesC8& aString); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildDESL(); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildDEAL(); williamr@2: IMPORT_C virtual MSdpElementBuilder* StartListL(); williamr@2: IMPORT_C virtual MSdpElementBuilder* EndListL(); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildURLL(const TDesC8& aString); williamr@2: IMPORT_C virtual MSdpElementBuilder* BuildEncodedL(const TDesC8& aString); williamr@2: williamr@2: protected: williamr@2: CSdpAttrValueList(MSdpElementBuilder *aBuilder); williamr@2: void ConstructL(); williamr@2: williamr@2: protected: williamr@2: /** Array of attribute values contained in this CSdpAttrValueList class*/ williamr@2: CArrayPtr *iList; williamr@2: williamr@2: private: williamr@2: MSdpElementBuilder *iParent; williamr@2: }; williamr@2: williamr@2: williamr@2: NONSHARABLE_CLASS(CSdpAttrValueNil) : public CSdpAttrValue williamr@2: /** A null type data attribute. */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CSdpAttrValueNil *NewNilL(); williamr@2: virtual ~CSdpAttrValueNil(); williamr@2: virtual TSdpElementType Type() const; williamr@2: virtual TUint DataSize() const; williamr@2: williamr@2: private: williamr@2: CSdpAttrValueNil(); williamr@2: }; williamr@2: williamr@2: /** Max size for an SDP Uint attribute value in bytes */ williamr@2: static const TInt KSdpMaxUintSize = 16; williamr@2: williamr@2: NONSHARABLE_CLASS(CSdpAttrValueUint) : public CSdpAttrValue williamr@2: /** A unsigned integer value of an attribute. williamr@2: williamr@2: 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: Uint64() for up to 64 bit size or Uint128() for up to 128 bit size. The size can be found using DataSize(). williamr@2: If the incorrect function is used the code will panic. williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CSdpAttrValueUint* NewUintL(const TDesC8 &aUint); williamr@2: virtual ~CSdpAttrValueUint(); williamr@2: williamr@2: IMPORT_C void SetUintValue(const TDesC8& aValue); williamr@2: virtual TSdpElementType Type() const; williamr@2: virtual TUint DataSize() const; williamr@2: TUint Uint() const; williamr@2: virtual TBool DoesIntFit() const; williamr@2: virtual const TPtrC8 Des() const; williamr@2: williamr@2: private: williamr@2: TInt Extension_(TUint aExtensionId, TAny *&a0, TAny *a1); williamr@2: CSdpAttrValueUint(const TDesC8 & aUint); williamr@2: williamr@2: private: williamr@2: TBuf8 iUint; williamr@2: }; williamr@2: williamr@2: /** williamr@2: Max size for an SDP Int attribute value in bytes williamr@2: The new value is KSdpMaxIntSize williamr@2: @deprecated williamr@2: */ williamr@2: static const TInt KMaxIntSize = 16; williamr@2: williamr@2: /** williamr@2: Max size for an SDP Int attribute value in bytes williamr@2: */ williamr@2: static const TInt KSdpMaxIntSize = 16; williamr@2: williamr@2: NONSHARABLE_CLASS(CSdpAttrValueInt) : public CSdpAttrValue williamr@2: /** A signed integer value of an attribute. williamr@2: williamr@2: The value can be up to 128 bits in size. */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CSdpAttrValueInt* NewIntL(const TDesC8 &aInt); williamr@2: virtual ~CSdpAttrValueInt(); williamr@2: virtual TSdpElementType Type() const; williamr@2: virtual TUint DataSize() const; williamr@2: virtual TInt Int() const; williamr@2: virtual TBool DoesIntFit() const; williamr@2: virtual const TPtrC8 Des() const; williamr@2: williamr@2: private: williamr@2: CSdpAttrValueInt(const TDesC8 & aInt); williamr@2: williamr@2: private: williamr@2: TBuf8 iInt; williamr@2: }; williamr@2: williamr@2: williamr@2: NONSHARABLE_CLASS(CSdpAttrValueUUID) : public CSdpAttrValue williamr@2: /** A UUID value of an attribute. williamr@2: williamr@2: The value can be up to 128 bits in size. */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CSdpAttrValueUUID* NewUUIDL(const TUUID& aUUID); williamr@2: virtual ~CSdpAttrValueUUID(); williamr@2: virtual TSdpElementType Type() const; williamr@2: virtual TUint DataSize() const; williamr@2: // getters williamr@2: virtual const TUUID &UUID() const; williamr@2: virtual const TPtrC8 Des() const; williamr@2: williamr@2: private: williamr@2: CSdpAttrValueUUID(const TUUID& aUUID); williamr@2: williamr@2: private: williamr@2: TUUID iUUID; williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(CSdpAttrValueString) : public CSdpAttrValue williamr@2: /** A Text String value of an attribute. williamr@2: williamr@2: The encoding of the string is up to the user. The interpretation of the encoding williamr@2: is enabled using facilities in SDP. */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CSdpAttrValueString* NewStringL(const TDesC8& aString); williamr@2: virtual ~CSdpAttrValueString(); williamr@2: virtual TSdpElementType Type() const; williamr@2: virtual TUint DataSize() const; williamr@2: virtual const TPtrC8 Des() const; williamr@2: williamr@2: private: williamr@2: CSdpAttrValueString(); williamr@2: void ConstructL(const TDesC8& aString); williamr@2: williamr@2: private: williamr@2: HBufC8 *iBuffer; williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(CSdpAttrValueBoolean) : public CSdpAttrValue williamr@2: /** A Boolean value of an attribute. */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CSdpAttrValueBoolean *NewBoolL(TBool aBool); williamr@2: virtual ~CSdpAttrValueBoolean(); williamr@2: virtual TSdpElementType Type() const; williamr@2: virtual TUint DataSize() const; williamr@2: virtual TBool Bool() const; williamr@2: williamr@2: private: williamr@2: CSdpAttrValueBoolean(TBool aBool); williamr@2: williamr@2: private: williamr@2: TBool iBool; williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(CSdpAttrValueDES) : public CSdpAttrValueList williamr@2: /** A Data element sequence (DES) value of an attribute. williamr@2: williamr@2: A DES can contain other values within it, including other sequences. This williamr@2: enables arbitrary tree structures to be created. williamr@2: williamr@2: Most of the functionality is supplied by the base class CSdpAttrValueList. */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CSdpAttrValueDES* NewDESL(MSdpElementBuilder* aBuilder); williamr@2: virtual TSdpElementType Type() const; williamr@2: williamr@2: private: williamr@2: CSdpAttrValueDES(MSdpElementBuilder *aBuilder); williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(CSdpAttrValueDEA) : public CSdpAttrValueList williamr@2: /** A Data element alternative (DEA) value of an attribute: this is an attribute williamr@2: whose value is a sequence of data elements from which one data element is williamr@2: to be selected williamr@2: williamr@2: Most of the functionality is supplied by the base class CSdpAttrValueList. */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CSdpAttrValueDEA* NewDEAL(MSdpElementBuilder* aBuilder); williamr@2: virtual TSdpElementType Type() const; williamr@2: williamr@2: private: williamr@2: CSdpAttrValueDEA(MSdpElementBuilder *aBuilder); williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(CSdpAttrValueURL) : public CSdpAttrValue williamr@2: /** A URL value of an attribute. */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CSdpAttrValueURL* NewURLL(const TDesC8& aString); williamr@2: virtual ~CSdpAttrValueURL(); williamr@2: virtual TSdpElementType Type() const; williamr@2: virtual const TPtrC8 Des() const; williamr@2: virtual TUint DataSize() const; williamr@2: williamr@2: private: williamr@2: CSdpAttrValueURL(); williamr@2: void ConstructL(const TDesC8& aString); williamr@2: williamr@2: private: williamr@2: HBufC8 *iBuffer; williamr@2: }; williamr@2: williamr@2: class MSdpAttributeValueVisitor williamr@2: /** Abstract interface that can be implemented to receive an enumeration of the williamr@2: values in an attribute list. williamr@2: williamr@2: The class member functions are called by an CSdpAttrValue (or one of its sub-classes) williamr@2: object when CSdpAttrValue::AcceptVisitorL() is called. williamr@2: williamr@2: Note that: williamr@2: williamr@2: When AcceptVisitorL() is called on attributes that are not lists (not DEA williamr@2: or DES), only VisitAttributeValueL() is called, passing the attribute value williamr@2: object itself (i.e. *this), and the value attribute type. williamr@2: williamr@2: When AcceptVisitorL() is called on attributes that are lists (DEA or DES), williamr@2: VisitAttributeValueL() is called for each member of the list williamr@2: williamr@2: This implements the standard Visitor pattern. williamr@2: williamr@2: @see CSdpAttrValue::AcceptVisitorL() */ williamr@2: { williamr@2: public: williamr@2: /** Called to pass an attribute value. williamr@2: williamr@2: @param aValue Attribute value williamr@2: @param aType Value type */ williamr@2: virtual void VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType)=0; williamr@2: williamr@2: williamr@2: /** Called to indicate the start of a list of attribute values. williamr@2: williamr@2: This call is followed by a call to VisitAttributeValueL() for each attribute williamr@2: value in the list, and concluded by a call to EndList(). williamr@2: williamr@2: @param aList Attribute value list */ williamr@2: virtual void StartListL(CSdpAttrValueList &aList)=0; williamr@2: williamr@2: williamr@2: /** Called to indicate the end of a list of attribute values. */ williamr@2: virtual void EndListL()=0; williamr@2: williamr@2: /** williamr@2: Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is. williamr@2: @param aInterface UID of the interface to return williamr@2: @param aObject the container for another interface as specified by aInterface williamr@2: */ williamr@2: IMPORT_C virtual void MSAVV_ExtensionInterfaceL(TUid aInterface, void*& aObject); williamr@2: }; williamr@2: williamr@2: class SdpUtil williamr@2: /**Integer Putter/Getter Utility Class williamr@2: williamr@2: Utility class for putting integer values into/getting integer values out of descriptors */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static TUint GetUint(const TDesC8& aData); williamr@2: IMPORT_C static void PutUint(TUint8* aPtr, TInt64 aInt, TInt aNumberOfBytes); williamr@2: IMPORT_C static void PutUint64(TUint8* aPtr, const TUint64& aNumber); williamr@2: IMPORT_C static void GetUint64(const TDesC8& aData, TUint64& aNumber); williamr@2: IMPORT_C static void PutUint128(TUint8* aPtr, const TUint64& aLo, const TUint64& aHi); williamr@2: IMPORT_C static void GetUint128(const TDesC8& aData, TUint64& aLo, TUint64& aHi); williamr@2: }; williamr@2: williamr@2: /**Integer to Descriptor Convertor williamr@2: williamr@2: Utility class to convert EPOC integers into TDesC8's, in the correct williamr@2: format for passing to the BuildIntL and BuildUintL members in SDP. williamr@2: This is effectively a Big-endian variant of TPckgBuf. williamr@2: */ williamr@2: williamr@2: williamr@2: template williamr@2: class TSdpIntBuf : public TBufC8 williamr@2: { williamr@2: public: williamr@2: inline TSdpIntBuf(const T& aRef); williamr@2: }; williamr@2: williamr@2: /**Speciality of Integer to Descriptor Convertor for TUint64s*/ williamr@2: TEMPLATE_SPECIALIZATION class TSdpIntBuf :public TBufC8 williamr@2: { williamr@2: public: williamr@2: IMPORT_C TSdpIntBuf(const TUint64& aRef); williamr@2: }; williamr@2: williamr@2: /**Speciality of Integer to Descriptor Convertor for TUint32s*/ williamr@2: TEMPLATE_SPECIALIZATION class TSdpIntBuf : public TSdpIntBuf williamr@2: { williamr@2: public: williamr@2: IMPORT_C TSdpIntBuf(const TUint32& aRef); williamr@2: }; williamr@2: williamr@2: /**Speciality of Integer to Descriptor Convertor for TUint16s*/ williamr@2: TEMPLATE_SPECIALIZATION class TSdpIntBuf : public TSdpIntBuf williamr@2: { williamr@2: public: williamr@2: IMPORT_C TSdpIntBuf(const TUint16& aRef); williamr@2: }; williamr@2: williamr@2: /**Speciality of Integer to Descriptor Convertor for TUint8s*/ williamr@2: TEMPLATE_SPECIALIZATION class TSdpIntBuf : public TSdpIntBuf williamr@2: { williamr@2: public: williamr@2: IMPORT_C TSdpIntBuf(const TUint8& aRef); williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: // This function has to be inline and not exported since otherwise williamr@2: // the replacement of T for the class provided doesn't work. williamr@2: template williamr@2: inline TSdpIntBuf::TSdpIntBuf(const T &aRef) williamr@2: { williamr@2: TBufC8::DoSetLength(sizeof(T)); williamr@2: SdpUtil::PutUint(TBufC8::iBuf, TInt64(aRef), sizeof(T)); williamr@2: } williamr@2: williamr@2: //************************************************************* williamr@2: // williamr@2: // SDP Agent client API williamr@2: // williamr@2: //************************************************************* williamr@2: williamr@2: class MSdpAgentNotifier williamr@2: /** Handles responses to Bluetooth Service Discovery Protocol queries. williamr@2: williamr@2: Clients that make queries through CSdpAgent must implement this interface williamr@2: to handle the responses. williamr@2: williamr@2: @see CSdpAgent::AttributeRequestL() */ williamr@2: { williamr@2: public: williamr@2: /** Called when an service record request (CSdpAgent::NextRecordRequestComplete()) williamr@2: operation completes. williamr@2: williamr@2: @param aError KErrNone if successful; williamr@2: KErrEof if there are no more SDP records left to be read; or an SDP error. williamr@2: @param aHandle Service record for which the query was made williamr@2: @param aTotalRecordsCount Total number of matching records williamr@2: @see CSdpAgent::NextRecordRequestL() */ williamr@2: virtual void NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount)=0; williamr@2: williamr@2: /** Called when an attribute request (CSdpAgent::AttributeRequestL()) wants to williamr@2: pass up a result. williamr@2: williamr@2: @param aHandle Service record for which the query was made williamr@2: @param aAttrID ID of the attribute obtained williamr@2: @param aAttrValue Attribute value obtained williamr@2: @see CSdpAgent::AttributeRequestL() */ williamr@2: virtual void AttributeRequestResult(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue)=0; williamr@2: williamr@2: /** Called when an attribute request (CSdpAgent::AttributeRequestL()) wants to williamr@2: signal the completion of a attribute request. williamr@2: williamr@2: @param aHandle Service record for which the query was made williamr@2: @param aError an error williamr@2: @see CSdpAgent::AttributeRequestL() */ williamr@2: virtual void AttributeRequestComplete(TSdpServRecordHandle, TInt aError)=0; williamr@2: williamr@2: /** williamr@2: Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is. williamr@2: @param aInterface UID of the interface to return williamr@2: @param aObject the container for another interface as specified by aInterface williamr@2: */ williamr@2: IMPORT_C virtual void MSAN_ExtensionInterfaceL(TUid aInterface, void*& aObject); williamr@2: }; williamr@2: williamr@2: class CSdpAgentEng; williamr@2: class CSdpSearchPattern; williamr@2: class CSdpAttrIdMatchList; williamr@2: williamr@2: NONSHARABLE_CLASS(CSdpAgent) : public CBase williamr@2: /** Makes Bluetooth service discovery protocol (SDP) requests to a remote device. williamr@2: williamr@2: To make SDP requests, williamr@2: williamr@2: Construct a CSdpAgent object with the Bluetooth address of the remote device williamr@2: to query. williamr@2: williamr@2: Set the classes of service that you want to query for. The classes have predefined williamr@2: UUIDs, which you specify with SetRecordFilterL(). williamr@2: williamr@2: Get results through NextRecordRequestL(). Information on services is stored williamr@2: as records, which can be queried in turn for attribute values for the service williamr@2: through AttributeRequestL(). williamr@2: williamr@2: A user of this class must implement MSdpAgentNotifier to receive the responses williamr@2: to queries. williamr@2: williamr@2: Note that queries are asynchronous, although this is hidden in the API. The williamr@2: implication is that the interface functions that receive responses are only williamr@2: called when the thread's active scheduler can schedule handling of the completion williamr@2: of the query. williamr@2: williamr@2: @see MSdpAgentNotifier */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CSdpAgent* NewL(MSdpAgentNotifier& aNotifier, const TBTDevAddr& aDevAddr); williamr@2: IMPORT_C static CSdpAgent* NewLC(MSdpAgentNotifier& aNotifier, const TBTDevAddr& aDevAddr); williamr@2: IMPORT_C ~CSdpAgent(); williamr@2: IMPORT_C void SetRecordFilterL(const CSdpSearchPattern& aUUIDFilter); williamr@2: IMPORT_C void SetAttributePredictorListL(const CSdpAttrIdMatchList& aMatchList); williamr@2: IMPORT_C void NextRecordRequestL(); williamr@2: williamr@2: IMPORT_C void AttributeRequestL(TSdpServRecordHandle aHandle, williamr@2: TSdpAttributeID aAttrID); williamr@2: IMPORT_C void AttributeRequestL(TSdpServRecordHandle aHandle, williamr@2: const CSdpAttrIdMatchList& aMatchList); williamr@2: IMPORT_C void AttributeRequestL(MSdpElementBuilder* aBuilder, williamr@2: TSdpServRecordHandle aHandle, williamr@2: TSdpAttributeID aAttrID); williamr@2: IMPORT_C void AttributeRequestL(MSdpElementBuilder* aBuilder, williamr@2: TSdpServRecordHandle aHandle, williamr@2: const CSdpAttrIdMatchList& aMatchList); williamr@2: IMPORT_C void Cancel(); williamr@2: williamr@2: private: williamr@2: CSdpAgent(); williamr@2: void ConstructL(MSdpAgentNotifier& aNotifier, TBTDevAddr aDevAddr); williamr@2: williamr@2: williamr@2: private: williamr@2: CSdpAgentEng* iAgentEngine; williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(CSdpSearchPattern) : public CBase, public MSdpElementBuilder williamr@2: /** A list of Bluetooth service classes, represented as Universal Unique Identifiers williamr@2: (UUIDs), to be matched in SDP Service Search Requests. williamr@2: williamr@2: @see CSdpAgent::SetRecordFilterL() williamr@2: @see TUUID */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CSdpSearchPattern* NewL(); williamr@2: IMPORT_C void ConstructL(); williamr@2: IMPORT_C ~CSdpSearchPattern(); williamr@2: IMPORT_C TInt AddL(const TUUID& aUUID); williamr@2: IMPORT_C TInt Remove(const TUUID& aUUID); williamr@2: IMPORT_C TInt Find(const TUUID& aUUID, TInt &aPos) const; williamr@2: IMPORT_C TInt Count() const; williamr@2: IMPORT_C const TUUID At(TInt anIndex) const; williamr@2: IMPORT_C void Reset(); williamr@2: /** Tests if the list is empty. williamr@2: williamr@2: @return True if the list is empty */ williamr@2: IMPORT_C TBool IsEmpty(); williamr@2: williamr@2: private: williamr@2: CSdpSearchPattern(); williamr@2: williamr@2: private: williamr@2: // Implementation of Mbuilder interface williamr@2: MSdpElementBuilder* BuildUUIDL(const TUUID& aUUID); williamr@2: MSdpElementBuilder* BuildDESL(); williamr@2: MSdpElementBuilder* StartListL(); williamr@2: MSdpElementBuilder* EndListL(); williamr@2: williamr@2: private: williamr@2: CArrayFixFlat* iUUIDArray; williamr@2: }; williamr@2: williamr@2: struct TAttrRange williamr@2: /** A range of attribute ID values. williamr@2: williamr@2: This class is used in an attribute list, CSdpAttrIdMatchList, so that all williamr@2: attributes with IDs in the specified range are considered. williamr@2: williamr@2: @see CSdpAttrIdMatchList */ williamr@2: { williamr@2: public: williamr@2: /** Default constructor. */ williamr@2: IMPORT_C TAttrRange(); williamr@2: williamr@2: williamr@2: /** Constructor with single ID. williamr@2: williamr@2: @param aAttrId The start and the end of the range are both set to aAttrId */ williamr@2: IMPORT_C TAttrRange(TSdpAttributeID aAttrId); williamr@2: williamr@2: williamr@2: /** Constructor with start and end IDs. williamr@2: williamr@2: @param aStart ID for the start of the range williamr@2: @param aEnd ID for the end of the range */ williamr@2: IMPORT_C TAttrRange(TSdpAttributeID aStart, TSdpAttributeID aEnd); williamr@2: williamr@2: williamr@2: /** Tests if the specified ID is either within the range. williamr@2: williamr@2: @param aAttrId ID to test williamr@2: @return True if in range, else false */ williamr@2: IMPORT_C TBool IsInRange(TSdpAttributeID aAttrId) const; williamr@2: williamr@2: williamr@2: /** Tests if the specified ID is either within the range, is one less than the williamr@2: lower bound, or one more than the upper bound. williamr@2: williamr@2: @param aAttrId ID to test williamr@2: @return True if contiguous, else false */ williamr@2: IMPORT_C TBool IsContiguousWith(TSdpAttributeID aAttrId) const; williamr@2: williamr@2: williamr@2: /** Tests if the specified range is contiguous with the range. williamr@2: williamr@2: @param aRange Range to test williamr@2: @return True if contiguous, else false */ williamr@2: IMPORT_C TBool IsContiguousWith(TAttrRange aRange) const; williamr@2: williamr@2: public: williamr@2: /** ID of the start of the range */ williamr@2: TSdpAttributeID iStart; williamr@2: /** ID of the end of the range */ williamr@2: TSdpAttributeID iEnd; williamr@2: williamr@2: private: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: williamr@2: /** Greatest range possible for attribute IDs. williamr@2: williamr@2: Useful for including all attributes in a CSdpAttrIdMatchList williamr@2: @see CSdpAttrIdMatchList*/ williamr@2: #define KAttrRangeAll TAttrRange(0, KMaxTUint16) williamr@2: williamr@2: williamr@2: class CSdpServRecord; williamr@2: class TElementEncoder; williamr@2: class MAttributeMatchHandler; williamr@2: williamr@2: NONSHARABLE_CLASS(CSdpAttrIdMatchList) : public CBase, public MSdpElementBuilder williamr@2: /** SDP Attribute ID Match list. williamr@2: williamr@2: Holds a list of Attribute IDs to be retrieved from a remote device in an Service williamr@2: Attribute Request. Set in terms of ranges of attributes, each one specified williamr@2: through a TAttrRange. */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CSdpAttrIdMatchList* NewL(); williamr@2: IMPORT_C static CSdpAttrIdMatchList* NewL(const CSdpAttrIdMatchList& aAttrMatchList); williamr@2: IMPORT_C ~CSdpAttrIdMatchList(); williamr@2: IMPORT_C void AddL(TAttrRange aRange); williamr@2: IMPORT_C void RemoveL(TAttrRange aRange); williamr@2: TInt Find(TSdpAttributeID aAttrId, TInt &aPos) const; williamr@2: williamr@2: // Do not use this - it gives an off-by-one error for aPos williamr@2: // unless the attribute is the first one in a contiguous range. williamr@2: // Use InMatchListRange() instead williamr@2: IMPORT_C TBool InMatchList(TSdpAttributeID aAttrId, TInt &aPos) const; williamr@2: williamr@2: williamr@2: williamr@2: /** Tests if the specified attribute ID is in the list. williamr@2: williamr@2: @param aAttrId Attribute ID to test williamr@2: @return ETrue if the attribute is in the list, else EFalse */ williamr@2: IMPORT_C TBool InMatchList(TSdpAttributeID aAttrId) const; williamr@2: williamr@2: williamr@2: /** Gets the number of separate ranges of attribute IDs in the list. williamr@2: williamr@2: @return Number of ranges of attribute IDs in the list */ williamr@2: IMPORT_C TInt Count() const; williamr@2: williamr@2: void FindAttributesL(CSdpServRecord &aRec, MAttributeMatchHandler &aHandler) const; williamr@2: williamr@2: /** williamr@2: @internalTechnology williamr@2: @released williamr@2: */ williamr@2: IMPORT_C TUint EncodeL(TElementEncoder aEncoder) const; williamr@2: williamr@2: williamr@2: /** Tests if the specified attribute ID is in the list. williamr@2: williamr@2: @param aAttrId Attribute ID to test williamr@2: @param aRange Position of the range of IDs in the list which contains aAttrId, or 0 if not found williamr@2: @return ETrue if the attribute is in the list, else EFalse */ williamr@2: IMPORT_C TBool InMatchListRange(TSdpAttributeID aAttrId, TInt &aRange) const; williamr@2: williamr@2: williamr@2: private: williamr@2: // Implementation of MSdpElementBuilder interface williamr@2: MSdpElementBuilder* BuildUintL(const TDesC8& aUint); williamr@2: MSdpElementBuilder* BuildDESL(); williamr@2: MSdpElementBuilder* StartListL(); williamr@2: MSdpElementBuilder* EndListL(); williamr@2: TInt FindInOrContiguousWith(TSdpAttributeID aAttrId, TInt &aPos) const; williamr@2: williamr@2: private: williamr@2: CSdpAttrIdMatchList(); williamr@2: CArrayFix* iList; williamr@2: williamr@2: __DECLARE_TEST; williamr@2: }; williamr@2: williamr@2: williamr@2: // interface via NetDB williamr@2: // includes parser and builder to use it williamr@2: williamr@2: williamr@2: /** Cannot bind to specifed sockets protocol, as already bound. */ williamr@2: const static TInt KErrSdpAlreadyBound = -6400; williamr@2: /** Remote device gave unknown error. */ williamr@2: const static TInt KErrSdpPeerError = -6401; williamr@2: /** Local device is not connected. */ williamr@2: const static TInt KErrSdpClientNotConnected = -6402; williamr@2: /** Invalid/unsupported SDP version. */ williamr@2: const static TInt KErrSdpUnsupportedVersion = -6403; williamr@2: /** Invalid Service Record Handle. */ williamr@2: const static TInt KErrSdpBadRecordHandle = -6404; williamr@2: /** Invalid Continuation State. */ williamr@2: const static TInt KErrSdpBadContinuationState = -6405; williamr@2: /** SDP server rejected the request. */ williamr@2: const static TInt KErrSdpServerRejectedRequest = -6406; williamr@2: /** Request buffer was ill-formed. */ williamr@2: const static TInt KErrSdpBadRequestBufferLength = -6407; williamr@2: /** Result buffer was ill-formed. */ williamr@2: const static TInt KErrSdpBadResultBufferLength = -6408; williamr@2: /** UUID entry was ill-formed. */ williamr@2: const static TInt KErrSdpBadUUIDLength = -6409; williamr@2: /** Response was ill-formed. */ williamr@2: const static TInt KErrSdpBadResultData = -6410; williamr@2: /** SDP database is full. */ williamr@2: const static TInt KErrSdpDatabaseFull = -6411; williamr@2: williamr@2: williamr@2: template class CSdpStackFix; williamr@2: williamr@2: NONSHARABLE_CLASS(CElementParser) : public CBase williamr@2: /** Parser for SDP attribute values. williamr@2: williamr@2: The class parses an input buffer containing an attribute value into its constituent williamr@2: data elements. It calls an MSdpElementBuilder object each time a data element williamr@2: is decoded. williamr@2: williamr@2: This parser can parse incrementally, and be fed new data as it arrives. williamr@2: williamr@2: @see MSdpElementBuilder */ williamr@2: { williamr@2: public: williamr@2: NONSHARABLE_CLASS(CLinearBuf) : public CBase williamr@2: /*Buffer used for a buffered parse.*/ williamr@2: { williamr@2: public: williamr@2: static CLinearBuf* NewLC(TInt aExpandSize); williamr@2: ~CLinearBuf(); williamr@2: void AppendL(const TDesC8& aData); williamr@2: const TPtrC8 Ptr() const; williamr@2: void Consume(TInt aLength); williamr@2: TInt Size() const; williamr@2: williamr@2: private: williamr@2: CLinearBuf(); williamr@2: void ConstructL(TInt aExpandSize); williamr@2: williamr@2: CBufFlat* iBuf; williamr@2: TInt iStartOffset; williamr@2: }; williamr@2: williamr@2: public: williamr@2: IMPORT_C static CElementParser* NewL(MSdpElementBuilder* aBuilder); williamr@2: IMPORT_C ~CElementParser(); williamr@2: IMPORT_C TInt ParseElementsL(const TDesC8& aData); williamr@2: IMPORT_C TBool BufferedParseL(const TDesC8& aData); williamr@2: IMPORT_C void Reset(); williamr@2: IMPORT_C void Reset(MSdpElementBuilder* aBuilder); williamr@2: IMPORT_C void SetBuilder(MSdpElementBuilder* aBuilder); williamr@2: IMPORT_C MSdpElementBuilder* Builder(); williamr@2: williamr@2: private: williamr@2: void ConstructL(); williamr@2: CElementParser(MSdpElementBuilder* aBuilder); williamr@2: static TBool IsComposite(TUint8 aType); williamr@2: void CloseListsL(); williamr@2: williamr@2: MSdpElementBuilder* iBuilder; williamr@2: CSdpStackFix* iListStack; williamr@2: CLinearBuf* iRemainderBuf; williamr@2: }; williamr@2: williamr@2: _LIT(KSdpClientPanic,"SDPServer"); williamr@2: enum TSdpClientPanic williamr@2: { williamr@2: ESdpBadRequest = 0, williamr@2: ESdpBadDescriptor = 1, williamr@2: ESdpBadSubSessionHandle = 6, williamr@2: ESdpBadSubSessionRemove = 7, williamr@2: ESdpNonExistantRecordHandle = 12, williamr@2: }; williamr@2: williamr@2: #endif