|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: /* ! 26: File: NameRegistry.h ! 27: ! 28: Contains: NameRegistry Interfaces . ! 29: ! 30: Version: Technology: PowerSurge 1.0.2. ! 31: Package: Universal Interfaces 2.1.2 on ETO #20 ! 32: ! 33: Copyright: � 1984-1995 by Apple Computer, Inc. ! 34: All rights reserved. ! 35: ! 36: Bugs?: If you find a problem with this file, use the Apple Bug Reporter ! 37: stack. Include the file and version information (from above) ! 38: in the problem description and send to: ! 39: Internet: [email protected] ! 40: AppleLink: APPLE.BUGS ! 41: ! 42: */ ! 43: ! 44: #ifndef __NAMEREGISTRY__ ! 45: #define __NAMEREGISTRY__ ! 46: ! 47: ! 48: #ifndef __TYPES__ ! 49: //#include "types.h" ! 50: #endif ! 51: #include "conditionalmacros.h" ! 52: ! 53: #ifdef __cplusplus ! 54: extern "C" { ! 55: #endif ! 56: ! 57: #if PRAGMA_ALIGN_SUPPORTED ! 58: #pragma options align=mac68k ! 59: #endif ! 60: ! 61: #if PRAGMA_IMPORT_SUPPORTED ! 62: #pragma import on ! 63: #endif ! 64: ! 65: typedef void *RegPropertyValue; ! 66: ! 67: /* Length of property value */ ! 68: typedef UInt32 RegPropertyValueSize; ! 69: ! 70: /* Namespace generation number */ ! 71: typedef UInt32 RegSpecGeneration; ! 72: ! 73: /* ****************************************************************************** ! 74: ** ! 75: ** RegEntryID : The Global x-Namespace Entry Identifier ! 76: // ! 77: */ ! 78: struct RegEntryID { ! 79: UInt8 opaque[16]; ! 80: }; ! 81: typedef struct RegEntryID RegEntryID, *RegEntryIDPtr; ! 82: ! 83: /* ****************************************************************************** ! 84: ** ! 85: ** Root Entry Name Definitions (Applies to all Names in the RootNameSpace) ! 86: // ! 87: // * Names are a colon separated list of name components. Name components ! 88: // may not themselves contain colons. ! 89: // * Names are presented as null terminated Unicode character strings. ! 90: // * Names follow similar parsing rules to Apple file system absolute ! 91: // and relative paths. However the '::' parent directory syntax is ! 92: // not currently supported. ! 93: */ ! 94: /* Max length of Entry Name */ ! 95: ! 96: enum { ! 97: kRegCStrMaxEntryNameLength = 47 ! 98: }; ! 99: ! 100: /* Entry Names are single byte ASCII */ ! 101: typedef char RegCStrEntryName, *RegCStrEntryNamePtr, RegCStrEntryNameBuf[kRegCStrMaxEntryNameLength + 1]; ! 102: ! 103: typedef char RegCStrPathName; ! 104: ! 105: typedef UInt32 RegPathNameSize; ! 106: ! 107: ! 108: enum { ! 109: kRegPathNameSeparator = 0x3A, /* ':' */ ! 110: kRegEntryNameTerminator = 0x00, /* '\0' */ ! 111: kRegPathNameTerminator = 0x00 /* '\0' */ ! 112: }; ! 113: ! 114: /* ****************************************************************************** ! 115: ** ! 116: ** Property Name and ID Definitions ! 117: // (Applies to all Properties Regardless of NameSpace) ! 118: */ ! 119: enum { ! 120: kRegMaximumPropertyNameLength = 31, /* Max length of Property Name */ ! 121: kRegPropertyNameTerminator = 0x00 /* '\0' */ ! 122: }; ! 123: ! 124: typedef char RegPropertyName, *RegPropertyNamePtr, RegPropertyNameBuf[kRegMaximumPropertyNameLength + 1]; ! 125: ! 126: /* ****************************************************************************** ! 127: ** ! 128: ** Iteration Operations ! 129: // ! 130: // These specify direction when traversing the name relationships ! 131: */ ! 132: typedef UInt32 RegIterationOp; ! 133: ! 134: typedef RegIterationOp RegEntryIterationOp; ! 135: ! 136: ! 137: enum { ! 138: /* ! 139: ** Absolute locations ! 140: */ ! 141: kRegIterRoot = 0x2UL, ! 142: /* ! 143: ** "Upward" Relationships ! 144: */ ! 145: kRegIterParents = 0x3UL, /* include all parent(s) of entry */ ! 146: /* ! 147: ** "Downward" Relationships ! 148: // ! 149: */ ! 150: kRegIterChildren = 0x4UL, /* include all children */ ! 151: kRegIterSubTrees = 0x5UL, /* include all sub trees of entry */ ! 152: kRegIterDescendants = 0x5UL, /* include all descendants of entry */ ! 153: /* ! 154: "Horizontal" Relationships ! 155: */ ! 156: kRegIterSibling = 0x6UL, /* include all siblings */ ! 157: /* ! 158: ** Keep doing the same thing ! 159: */ ! 160: kRegIterContinue = 0x1UL ! 161: }; ! 162: ! 163: /* ****************************************************************************** ! 164: ** ! 165: ** Name Entry and Property Modifiers ! 166: // ! 167: ! 168: // ! 169: // Modifiers describe special characteristics of names ! 170: // and properties. Modifiers might be supported for ! 171: // some names and not others. ! 172: // ! 173: // Device Drivers should not rely on functionality ! 174: // specified as a modifier. ! 175: */ ! 176: typedef UInt32 RegModifiers; ! 177: ! 178: typedef RegModifiers RegEntryModifiers; ! 179: ! 180: typedef RegModifiers RegPropertyModifiers; ! 181: ! 182: ! 183: enum { ! 184: kRegNoModifiers = 0x00000000UL, /* no entry modifiers in place */ ! 185: kRegUniversalModifierMask = 0x0000FFFFUL, /* mods to all entries */ ! 186: kRegNameSpaceModifierMask = 0x00FF0000UL, /* mods to all entries within namespace */ ! 187: kRegModifierMask = 0xFF000000UL /* mods to just this entry */ ! 188: }; ! 189: ! 190: /* Universal Property Modifiers */ ! 191: enum { ! 192: kRegPropertyValueIsSavedToNVRAM = 0x00000020UL, /* property is non-volatile (saved in NVRAM) */ ! 193: kRegPropertyValueIsSavedToDisk = 0x00000040UL /* property is non-volatile (saved on disk) */ ! 194: }; ! 195: ! 196: /* *********************** ! 197: ** ! 198: ** The Registry API ! 199: // ! 200: /////////////////////// */ ! 201: /* *********************** ! 202: ** ! 203: ** Entry Management ! 204: // ! 205: /////////////////////// */ ! 206: /*------------------------------- ! 207: * EntryID handling ! 208: */ ! 209: /* ! 210: * Initialize an EntryID to an known invalid state ! 211: * note: invalid != uninitialized ! 212: */ ! 213: extern OSStatus RegistryEntryIDInit(RegEntryID *id); ! 214: /* ! 215: * Compare EntryID's for equality or if invalid ! 216: * ! 217: * If a NULL value is given for either id1 or id2 the other id ! 218: * is compared with and invalid ID. If both are NULL, the id's ! 219: * are consided equal (result = true). ! 220: */ ! 221: extern Boolean RegistryEntryIDCompare(const RegEntryID *id1, const RegEntryID *id2); ! 222: /* ! 223: * Copy an EntryID ! 224: */ ! 225: extern OSStatus RegistryEntryIDCopy(const RegEntryID *src, RegEntryID *dst); ! 226: /* ! 227: * Free an ID so it can be reused. ! 228: */ ! 229: extern OSStatus RegistryEntryIDDispose(RegEntryID *id); ! 230: /*------------------------------- ! 231: * Adding and removing entries ! 232: * ! 233: * If (parentEntry) is NULL, the name is assumed ! 234: * to be a rooted path. It is rooted to an anonymous, unnamed root. ! 235: */ ! 236: extern OSStatus RegistryCStrEntryCreate(const RegEntryID *parentEntry, const RegCStrPathName *name, RegEntryID *newEntry); ! 237: extern OSStatus RegistryEntryDelete(const RegEntryID *id); ! 238: struct RegEntryIter { ! 239: void *opaque; ! 240: }; ! 241: typedef struct RegEntryIter *RegEntryIterPtr; ! 242: ! 243: typedef struct RegEntryIter RegEntryIter; ! 244: ! 245: /* ! 246: * create/dispose the iterator structure ! 247: * defaults to root with relationship = kReIterDescendants ! 248: */ ! 249: extern OSStatus RegistryEntryIterateCreate(RegEntryIter *cookie); ! 250: extern OSStatus RegistryEntryIterateDispose(RegEntryIter *cookie); ! 251: /* ! 252: * set Entry Iterator to specified entry ! 253: */ ! 254: extern OSStatus RegistryEntryIterateSet(RegEntryIter *cookie, const RegEntryID *startEntryID); ! 255: /* ! 256: * Return each value of the iteration ! 257: * ! 258: * return entries related to the current entry ! 259: * with the specified relationship ! 260: */ ! 261: extern OSStatus RegistryEntryIterate(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done); ! 262: /* ! 263: * return entries with the specified property ! 264: * ! 265: * A NULL RegPropertyValue pointer will return an ! 266: * entry with the property containing any value. ! 267: */ ! 268: extern OSStatus RegistryEntrySearch(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done, const RegPropertyName *propertyName, const void *propertyValue, RegPropertyValueSize propertySize); ! 269: /*-------------------------------- ! 270: * Find a name in the namespace ! 271: * ! 272: * This is the fast lookup mechanism. ! 273: * NOTE: A reverse lookup mechanism ! 274: * has not been provided because ! 275: * some name services may not ! 276: * provide a fast, general reverse ! 277: * lookup. ! 278: */ ! 279: extern OSStatus RegistryCStrEntryLookup(const RegEntryID *searchPointID, const RegCStrPathName *pathName, RegEntryID *foundEntry); ! 280: /*--------------------------------------------- ! 281: * Convert an entry to a rooted name string ! 282: * ! 283: * A utility routine to turn an Entry ID ! 284: * back into a name string. ! 285: */ ! 286: extern OSStatus RegistryEntryToPathSize(const RegEntryID *entryID, RegPathNameSize *pathSize); ! 287: extern OSStatus RegistryCStrEntryToPath(const RegEntryID *entryID, RegCStrPathName *pathName, RegPathNameSize pathSize); ! 288: /* ! 289: * Parse a path name. ! 290: * ! 291: * Retrieve the last component of the path, and ! 292: * return a spec for the parent. ! 293: */ ! 294: extern OSStatus RegistryCStrEntryToName(const RegEntryID *entryID, RegEntryID *parentEntry, RegCStrEntryName *nameComponent, Boolean *done); ! 295: /* ****************************************************** ! 296: ** ! 297: ** Property Management ! 298: // ! 299: ////////////////////////////////////////////////////// */ ! 300: /*------------------------------- ! 301: * Adding and removing properties ! 302: */ ! 303: extern OSStatus RegistryPropertyCreate(const RegEntryID *entryID, const RegPropertyName *propertyName, const void *propertyValue, RegPropertyValueSize propertySize); ! 304: extern OSStatus RegistryPropertyDelete(const RegEntryID *entryID, const RegPropertyName *propertyName); ! 305: /*--------------------------- ! 306: * Traversing the Properties of a name ! 307: * ! 308: */ ! 309: struct RegPropertyIter { ! 310: void *opaque; ! 311: }; ! 312: typedef struct RegPropertyIter *RegPropertyIterPtr; ! 313: ! 314: typedef struct RegPropertyIter RegPropertyIter; ! 315: ! 316: extern OSStatus RegistryPropertyIterateCreate(const RegEntryID *entry, RegPropertyIter *cookie); ! 317: extern OSStatus RegistryPropertyIterateDispose(RegPropertyIter *cookie); ! 318: extern OSStatus RegistryPropertyIterate(RegPropertyIter *cookie, RegPropertyName *foundProperty, Boolean *done); ! 319: /* ! 320: * Get the value of the specified property for the specified entry. ! 321: * ! 322: */ ! 323: extern OSStatus RegistryPropertyGetSize(const RegEntryID *entryID, const RegPropertyName *propertyName, RegPropertyValueSize *propertySize); ! 324: /* ! 325: * (*siz) is the maximum size of the value returned in the buffer ! 326: * pointer to by (val). Upon return, (*siz) is the size of the ! 327: * value returned. ! 328: */ ! 329: extern OSStatus RegistryPropertyGet(const RegEntryID *entryID, const RegPropertyName *propertyName, void *propertyValue, RegPropertyValueSize *propertySize); ! 330: extern OSStatus RegistryPropertySet(const RegEntryID *entryID, const RegPropertyName *propertyName, const void *propertyValue, RegPropertyValueSize propertySize); ! 331: /* ****************************************************** ! 332: ** ! 333: ** Modibute (err, I mean Modifier) Management ! 334: // ! 335: ////////////////////////////////////////////////////// */ ! 336: /* ! 337: * Modifiers describe special characteristics of names ! 338: * and properties. Modifiers might be supported for ! 339: * some names and not others. ! 340: * ! 341: * Device Drivers should not rely on functionality ! 342: * specified as a modifier. These interfaces ! 343: * are for use in writing Experts. ! 344: */ ! 345: /* ! 346: * Get and Set operators for entry modifiers ! 347: */ ! 348: extern OSStatus RegistryEntryGetMod(const RegEntryID *entry, RegEntryModifiers *modifiers); ! 349: extern OSStatus RegistryEntrySetMod(const RegEntryID *entry, RegEntryModifiers modifiers); ! 350: /* ! 351: * Get and Set operators for property modifiers ! 352: */ ! 353: extern OSStatus RegistryPropertyGetMod(const RegEntryID *entry, const RegPropertyName *name, RegPropertyModifiers *modifiers); ! 354: extern OSStatus RegistryPropertySetMod(const RegEntryID *entry, const RegPropertyName *name, RegPropertyModifiers modifiers); ! 355: /* ! 356: * Iterator operator for entry modifier search ! 357: */ ! 358: extern OSStatus RegistryEntryMod(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done, RegEntryModifiers matchingModifiers); ! 359: /* ! 360: * Iterator operator for entries with matching ! 361: * property modifiers ! 362: */ ! 363: extern OSStatus RegistryEntryPropertyMod(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done, RegPropertyModifiers matchingModifiers); ! 364: ! 365: #if PRAGMA_IMPORT_SUPPORTED ! 366: #pragma import off ! 367: #endif ! 368: ! 369: #if PRAGMA_ALIGN_SUPPORTED ! 370: #pragma options align=reset ! 371: #endif ! 372: ! 373: #ifdef __cplusplus ! 374: } ! 375: #endif ! 376: ! 377: #endif /* __NAMEREGISTRY__ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.