headers/AppleShareRegistry.h

/*
    File:       AppleShareRegistry.h
 
    Contains:   AppleShareRegistry data types Interfaces. Formerly known as OAM and OAMTypes...
 
    Version:    Technology: AppleShare IP 6.0
                Release:    ASIP 6.0 SDK - Friday, July 10, 1998 11:16:11 AM
 
    Copyright:  © 1995-1998 by Apple Computer, Inc., all rights reserved.
 
    Bugs?:      For bug reports, consult the following page on
                the World Wide Web:
 
                    http://developer.apple.com/bugreporter/
 
*/
#ifndef __APPLESHAREREGISTRY__
#define __APPLESHAREREGISTRY__
 
#ifndef __MIXEDMODE__
#include <MixedMode.h>
#endif
#ifndef __TYPES__
#include <Types.h>
#endif
 
 
 
#if PRAGMA_ONCE
#pragma once
#endif
 
#ifdef __cplusplus
extern "C" {
#endif
 
#if PRAGMA_IMPORT
#pragma import on
#endif
 
#if PRAGMA_STRUCT_ALIGN
    #pragma options align=mac68k
#elif PRAGMA_STRUCT_PACKPUSH
    #pragma pack(push, 2)
#elif PRAGMA_STRUCT_PACK
    #pragma pack(2)
#endif
 
 
enum {
    kOAMMachineShortID          = 0,
    kOAMOwnerShortID            = 1
};
 
/* Object Types & Attribute Signatures*/
 
enum {
    kOAMAnyObjectType           = FOUR_CHAR_CODE('****'),
    kOAMMachine                 = FOUR_CHAR_CODE('mach'),
    kOAMUser                    = FOUR_CHAR_CODE('user'),
    kOAMGroup                   = FOUR_CHAR_CODE('grop'),
    kOAMService                 = FOUR_CHAR_CODE('serv')
};
 
/* Attribute Signatures */
 
enum {
    kOAMBasic                   = FOUR_CHAR_CODE('----'),
    kOAMGestalt                 = FOUR_CHAR_CODE('gest'),
    kOAMClassicFS               = FOUR_CHAR_CODE('clfs')
};
 
/* Attribute Types */
 
enum {
                                                                /* All Objects */
    kOAMShortID                 = FOUR_CHAR_CODE('shid'),       /* UInt32 */
    kOAMName                    = FOUR_CHAR_CODE('name'),       /* Str31 */
    kOAMInternetName            = FOUR_CHAR_CODE('inam'),       /* Str31 */
    kOAMType                    = FOUR_CHAR_CODE('type'),       /* OSType */
                                                                /* User Object Attributes */
    kOAMPasswordAttribute       = FOUR_CHAR_CODE('pwd '),       /* char[8] (zero padded) */
    kOAMPasswordLen             = FOUR_CHAR_CODE('pwdL'),       /* UInt8 */
    kOAMUserFlags               = FOUR_CHAR_CODE('flgs'),       /* UInt16 */
    kOAMUserFailedPasswordAttempts = FOUR_CHAR_CODE('blog'),    /* UInt16 */
    kOAMUserPasswordCreationTime = FOUR_CHAR_CODE('pwdD'),      /* UInt32 (set by OAM agent) */
    kOAMUserNumGroups           = FOUR_CHAR_CODE('nmem'),       /* UInt16 (read only) */
    kOAMPrimaryGroup            = FOUR_CHAR_CODE('pgrp'),       /* UGRec (id and name) */
    kOAMDisableDate             = FOUR_CHAR_CODE('disD'),       /* SInt32 */
    kOAMLastLogin               = FOUR_CHAR_CODE('logD'),       /* SInt32 */
    kOAMUserComment             = FOUR_CHAR_CODE('cmnt'),       /* Str197 */
    kOAMUserPhoneRecord         = FOUR_CHAR_CODE('976 '),       /* OAMUserPhoneRecord */
                                                                /* Service Object Attributes */
    kOAMShortStatus             = FOUR_CHAR_CODE('shst'),       /* UInt32 */
    kOAMServiceFlags            = FOUR_CHAR_CODE('flag'),       /* OAMFlags */
    kOAMServicePSN              = FOUR_CHAR_CODE('psn '),       /* ProcessSerialNumber */
    kOAMServiceFSSpec           = FOUR_CHAR_CODE('fssp'),       /* FSSpec */
    kOAMServiceType             = FOUR_CHAR_CODE('styp'),       /* OSType */
                                                                /* Machine Object Attributes */
    kOAMGuestProgramLinking     = FOUR_CHAR_CODE('gstl'),       /* SInt16 */
    kOAMNoGuestAccess           = FOUR_CHAR_CODE('gsta'),       /* SInt16 */
    kOAMProgramLinking          = FOUR_CHAR_CODE('prgl'),       /* SInt16 */
    kOAMBoot                    = FOUR_CHAR_CODE('boot'),       /* SInt16 */
    kOAMFileSharingEnabled      = FOUR_CHAR_CODE('fshr'),       /* SInt16 */
    kOAMApple2Mode              = FOUR_CHAR_CODE('apl2'),       /* SInt16 */
    kOAMNoSavePassword          = FOUR_CHAR_CODE('spwd'),       /* SInt16 */
    kOAMMultihoming             = FOUR_CHAR_CODE('mlth'),       /* SInt16 */
    kOAMGuestInited             = FOUR_CHAR_CODE('gsti'),       /* SInt16 */
    kOAMUGInited                = FOUR_CHAR_CODE('ugin'),       /* SInt16 */
    kOAMUGFileVersion           = FOUR_CHAR_CODE('vers'),       /* SInt16 (read only) */
    kOAMServerName              = FOUR_CHAR_CODE('name'),       /* Str32 */
    kOAMDefaultShutdown         = FOUR_CHAR_CODE('smin'),       /* SInt16 */
    kOAMMinPasswordLen          = FOUR_CHAR_CODE('plen'),       /* UInt8 */
    kOAMMaxBadLogins            = FOUR_CHAR_CODE('bmax'),       /* SInt16 */
    kOAMMaxPwdChgTime           = FOUR_CHAR_CODE('pwdc'),       /* SInt16 */
    kOAMLoginDisabledTime       = FOUR_CHAR_CODE('disT'),       /* SInt32 */
    kOAMUniqueID                = FOUR_CHAR_CODE('uniq'),       /* SInt32 */
    kOAMMoreSFlags              = FOUR_CHAR_CODE('msfl'),       /* OAMFlags */
    kOAMOtherFlags              = FOUR_CHAR_CODE('oflg'),       /* OAMFlags */
    kOAMOTPort                  = FOUR_CHAR_CODE('port')        /* SInt16 */
};
 
/* userFlag bits */
 
enum {
    kOAMDefaultNewUserSettings  = 0,
    kOAMIACEnabledMask          = 0x0001,                       /* IAC is enabled for this user */
    kOAMLoginEnabledMask        = 0x0100,                       /* Login is enabled for this user */
    kOAMSuperUserMask           = 0x0200,                       /* This user is a superuser */
    kOAMDisableChangePwdMask    = 0x0400,                       /* User CANNOT change password */
    kOAMGetNewPwdMask           = 0x1000
};
 
/* kShortStatus codes for registered services */
 
enum {
    kOAMServiceNotRunning       = 1,
    kOAMServiceRunning          = 2,
    kOAMServiceStartingUp       = 3,
    kOAMServiceShutingDown      = 4
};
 
 
enum {
    kOAMServiceAutoLaunch       = 0x00000001,                   /* Launch on startup */
    kOAMServiceAutoShutdown     = 0x00000002                    /* Shutdown on quit */
};
 
typedef UInt32                          OAMEventCode;
typedef OSStatus                        OAMStatus;
typedef UInt32                          OAMCallID;
typedef UInt32                          OAMSessionID;
typedef OSType                          OAMType;
typedef OAMType *                       OAMTypePtr;
typedef OSType                          OAMObjectType;
typedef UInt32                          OAMFlags;
typedef UInt32                          OAMShortObjectSpec;
typedef UInt32 *                        OAMShortObjectSpecPtr;
 
enum {
    kOAMOptionFlags             = FOUR_CHAR_CODE('oflg'),
    kOAMOptionThreadBlockCall   = FOUR_CHAR_CODE('tpre'),
    kOAMOptionThreadYieldCall   = FOUR_CHAR_CODE('tpos'),
    kOAMOptionThreadUnblockCall = FOUR_CHAR_CODE('twak')
};
 
 
enum {
    kOAMOptionThreadMgr         = 1,
    kOAMOptionExternalThreadMgr = 2
};
 
 
struct OAMOption {
    OSType                          option;
    UInt32                          value;
};
typedef struct OAMOption                OAMOption;
 
enum {
    kOAMLocatorAppletalk        = 0
};
 
 
struct OAMServerLocator {
    UInt16                          specSize;                   /* total size of this locator spec struct */
    UInt32                          protType;                   /* kOAMLocatorAppletalk -> appletalk */
    UInt32                          reserved1;
    UInt32                          reserved2;                  /* probably script */
    Str63                           name;
    UInt8                           protSpecific[4];            /* variable size protocol specific part */
};
typedef struct OAMServerLocator         OAMServerLocator;
 
enum {
    kOAMServerAppleTalk         = 0
};
 
 
struct OAMServerSpec {
    UInt16                          specSize;                   /* total size of this server spec struct */
    UInt32                          protType;                   /* kOAMServerAppleTalk -> appletalk */
    UInt32                          reserved1;
    UInt32                          reserved2;
    Str63                           name;
    UInt8                           protSpecific[4];            /* variable size protocol specific part */
};
typedef struct OAMServerSpec            OAMServerSpec;
/* Agent Status */
 
enum {
    kOAMAgentNotInstalled       = 0,
    kOAMAgentNotRunning         = 1,
    kOAMAgentStartingUp         = 2,
    kOAMAgentRunning            = 3,
    kOAMAgentShuttingDown       = 4,
    kOAMAgentNotRunningATTClose = 5,
    kOAMAgentGenesis            = 6
};
 
/* specType */
 
enum {
    kOAMObjectSpecByShortID     = 1,
    kOAMObjectSpecByNameType    = 2
};
 
 
struct OAMObjectSpec {
    OAMType                         objectType;
    OAMType                         specType;                   /* kOAMObjectSpecByShortID->short id, kOAMObjectSpecByNameType->nametype and others... */
    union {
        OAMShortObjectSpec              shortID;
        Str31                           name;
        UInt8                           otherTypes[4];
    }                               u;
};
typedef struct OAMObjectSpec            OAMObjectSpec;
/* keyType */
 
enum {
    kOAMKeyClearText            = 0
};
 
 
struct OAMKey {
    OAMType                         keyType;                    /* kOAMKeyClearText->cleartext password */
    UInt32                          keyBufferLen;
    UInt8                           keyBuffer[8];
};
typedef struct OAMKey                   OAMKey;
 
struct OAMBufferDescriptor {
    void *                          buffer;
    UInt32                          bufferLen;
    UInt32                          actCount;
};
typedef struct OAMBufferDescriptor      OAMBufferDescriptor;
 
struct OAMAttributeDescriptor {
    OAMType                         attributeSignature;
    OAMType                         attributeType;
    OAMBufferDescriptor             bufferDescriptor;
    OSStatus                        status;
    UInt32                          offset;
    UInt32                          actSize;
};
typedef struct OAMAttributeDescriptor   OAMAttributeDescriptor;
/* iterationType */
 
enum {
    kOAMIterObjects             = 1,
    kOAMIterMembers             = 2,
    kOAMIterMemberships         = 3
};
 
/* iterationFlags */
 
enum {
    kOAMIterByIndex             = 1,
    kOAMIterByObject            = 2
};
 
 
union OAMSpecOrIndex {
    OAMObjectSpec *                 startingObject;
    UInt32                          startingIndex;
};
typedef union OAMSpecOrIndex            OAMSpecOrIndex;
 
struct OAMIterationSpec {
    OAMType                         iterationType;
    OAMFlags                        iterationFlags;
    OAMTypePtr                      typeList;
    OAMObjectSpec *                 iterArgument;
    UInt32                          maxToGet;
    OAMSpecOrIndex                  u;
                                                                /* set by call */
    UInt32                          totalSize;
    UInt32                          lastPosition;
    Boolean                         more;
};
typedef struct OAMIterationSpec         OAMIterationSpec;
 
struct OAMParseInfo {
    UInt32                          reserved[32];
};
typedef struct OAMParseInfo             OAMParseInfo;
/* optionType */
 
enum {
    kOAMNotifyStartOption       = FOUR_CHAR_CODE('nstt'),
    kOAMNotifyStopOption        = FOUR_CHAR_CODE('nstp'),
    kOAMNotifySelfOption        = FOUR_CHAR_CODE('nslf')
};
 
/* notify OAMOptionsFlags */
 
enum {
    kOAMOptionUserData          = 2
};
 
/* notifyID */
 
enum {
    kOAMNotifyNewObject         = 1,
    kOAMNotifyDeleteObject      = 2,
    kOAMNotifyRenameObject      = 3,
    kOAMNotifyAttributeSet      = 4,
    kOAMNotifyMemberAdd         = 5,
    kOAMNotifyMemberRemove      = 6,
    kOAMNotifyLogin             = 7,
    kOAMNotifyAll               = 8,
    kOAMMaxNotify               = kOAMNotifyAll
};
 
 
struct OAMBooleanOption {
    UInt16                          value;
};
typedef struct OAMBooleanOption         OAMBooleanOption;
 
enum {
    kOAMNotifyAllObjects        = -1
};
 
 
struct OAMNotifyOption {
    UInt32                          notifyID;
    UInt32                          objectID;                   /* kOAMNotifyAllObjects -> all objects */
};
typedef struct OAMNotifyOption          OAMNotifyOption;
 
struct OAMNotificationSpec {
    OAMType                         oamType;
    OAMBufferDescriptor             bufferDescriptor;
};
typedef struct OAMNotificationSpec      OAMNotificationSpec;
 
struct OAMNotification {
    UInt16                          version;                    /* 0 */
    OAMSessionID                    sess;
    OAMShortObjectSpec              objectID;
    UInt32                          notifyID;                   /* notifyID = kOAMNotifyNewObject | kOAMNotifyAttributeSet | .... */
    UInt32                          userData;
    union {
        OAMType                         oamType;
        OAMShortObjectSpec              member;
    }                               u;
};
typedef struct OAMNotification          OAMNotification;
/* OAM Notification Support */
typedef CALLBACK_API_C( void , OAMNotificationProcPtr )(OAMNotification *notification);
typedef STACK_UPP_TYPE(OAMNotificationProcPtr)                  OAMNotificationUPP;
enum { uppOAMNotificationProcInfo = 0x000000C1 };               /* no_return_value Func(4_bytes) */
#define NewOAMNotificationProc(userRoutine)                     (OAMNotificationUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppOAMNotificationProcInfo, GetCurrentArchitecture())
#define CallOAMNotificationProc(userRoutine, notification)      CALL_ONE_PARAMETER_UPP((userRoutine), uppOAMNotificationProcInfo, (notification))
/* session option */
 
enum {
    kOAMOptionMemory            = FOUR_CHAR_CODE(' mem')
};
 
/* authentication flags */
 
enum {
    kOAMAuthLogin               = 0,
    kOAMAuthLoginContinue       = 1,
    kOAMAuthChangeKey           = 2,
    kOAMAuthChangeKeyContinue   = 3
};
 
 
enum {
    kOAMAuthStream              = 1
};
 
 
struct OAMAuthenticateInfo {
    OAMObjectSpec *                 objectSpec;
    UInt16                          flags;
    UInt16                          stage;                      /* intialial set to zero */
    OAMStatus                       objStatus;
    UInt8                           uam[64];
    UInt8                           reserved[64];
};
typedef struct OAMAuthenticateInfo      OAMAuthenticateInfo;
 
typedef unsigned char                   OAMCallNumber[128];
/* bits for phoneFlags */
 
enum {
    kOAMLoginBit                = 0,
    kOAMCallbackBit             = 1
};
 
 
struct OAMUserPhoneRecord {
    SInt16                          phoneFlags;
    SInt16                          retryCount;
    OAMCallNumber                   callNum;                    /* callback number*/
};
typedef struct OAMUserPhoneRecord       OAMUserPhoneRecord;
/* Error Codes */
 
enum {
                                                                /* General */
    kOAMInitializationErr       = -29300,
    kOAMParameterErr            = -29301,
    kOAMGeneralErr              = -29302,                       /* Objects */
    kOAMObjectNotFoundErr       = -29310,
    kOAMContainerObjectNotFoundErr = -29311,
    kOAMMemberObjectNotFoundErr = -29312,
    kOAMDuplicateObjectErr      = -29320,
    kOAMMaximumObjectsErr       = -29330,
    kOAMMaximumMemberObjectsErr = -29331,                       /* Attributes */
    kOAMAttributeNotFoundErr    = -29340,
    kOAMAttributeReadOnlyErr    = -29341,
    kOAMAttributeReadWriteOnlyErr = -29342,
    kOAMAttributeBufferTooSmallErr = -29343,
    kOAMAttributeBufferTooLargeErr = -29344,
    kOAMMaximumAttributesErr    = -29345,                       /* Buffers */
    kOAMBufferTooSmallErr       = -29350,
    kOAMBufferTooLargeErr       = -29351,                       /* Authentication */
    kOAMAuthenticationErr       = -29360,
    kOAMAuthenticationInProgressErr = -29361,
    kOAMLoginDisabledErr        = -29362,
    kOAMAuthenticationServerErr = -29363,
    kOAMUAMNotFoundErr          = -29364,
    kOAMAdminDisabledErr        = -29365,                       /* Password */
    kOAMPasswordNeedsChangeErr  = -29370,
    kOAMPasswordExpiredErr      = -29371,
    kOAMPasswordMinimumLenErr   = -29372,
    kOAMSamePasswordErr         = -29373,
    kOAMPasswordChangeDisabledErr = -29374,                     /* Session */
    kOAMServerNotFoundErr       = -29380,
    kOAMServerNotInstalledErr   = -29381,
    kOAMServerNotReadyErr       = -29382,
    kOAMNoMachineNameErr        = -29383,
    kOAMRequestTooLargeErr      = -29384,
    kOAMNetworkErr              = -29385,
    kOAMSessionIDErr            = -29386,
    kOAMMaximumSessionsErr      = -29387
};
 
 
enum {
    kOAMParseDone               = 99
};
 
EXTERN_API_C( OAMStatus )
OAMInitialize                   (UInt32                 numSessions,
                                 UInt32                 maxNumCalls,
                                 OAMBufferDescriptor *  buffer_i,
                                 OAMOption *            flags_i);
 
 
EXTERN_API_C( OAMStatus )
OAMDeInitialize                 (void);
 
EXTERN_API_C( OAMStatus )
OAMFindServer                   (OAMServerLocator *     locator_i,
                                 OAMBufferDescriptor *  buffer_o,
                                 UInt32 *               numInBuffer_o,
                                 UInt32 *               numFound_o,
                                 OAMOption *            options);
 
 
EXTERN_API_C( OAMStatus )
OAMFindServerExtract            (OAMBufferDescriptor *  buffer_i,
                                 UInt32                 index_i,
                                 OAMServerSpec *        spec_o);
 
 
EXTERN_API_C( UInt32 )
OAMGetSize                      (UInt32                 numSessions,
                                 UInt32                 maxNumCalls);
 
EXTERN_API_C( OAMStatus )
OAMGetLocalServerStatus         (UInt32 *               serverStatus);
 
EXTERN_API_C( OAMStatus )
OAMOpenSession                  (OAMServerSpec *        server_i,
                                 OAMSessionID *         sessID_o,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMCloseSession                 (OAMSessionID           sessID_o,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMAuthenticateSession          (OAMSessionID           sessID,
                                 OAMObjectSpec *        user,
                                 OAMKey *               key,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMCreateObject                 (OAMSessionID           sessID,
                                 OAMObjectSpec *        object,
                                 OAMAttributeDescriptor * attr,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMDeleteObject                 (OAMSessionID           sessID,
                                 OAMObjectSpec *        object,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMGetAttribute                 (OAMSessionID           sessID,
                                 OAMObjectSpec *        object,
                                 OAMAttributeDescriptor * attr,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMSetAttribute                 (OAMSessionID           sessID,
                                 OAMObjectSpec *        key,
                                 OAMAttributeDescriptor * attr,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMDeleteAttribute              (OAMSessionID           sessID,
                                 OAMObjectSpec *        object,
                                 OAMAttributeDescriptor * attr,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMIsGroupMember                (OAMSessionID           sessID,
                                 OAMObjectSpec *        group,
                                 OAMObjectSpec *        member,
                                 Boolean *              isMember,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMAddGroupMember               (OAMSessionID           sessID,
                                 OAMObjectSpec *        group,
                                 OAMObjectSpec *        newMember,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMRemoveGroupMember            (OAMSessionID           sessID,
                                 OAMObjectSpec *        group,
                                 OAMObjectSpec *        oldMember,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMIterate                      (OAMSessionID           sessID,
                                 OAMIterationSpec *     iterSpec,
                                 OAMAttributeDescriptor * desc,
                                 OAMBufferDescriptor *  buffer,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMParseAttributeBuffer         (OAMBufferDescriptor *  buffer,
                                 OAMAttributeDescriptor * desc,
                                 OAMParseInfo *         parseInfo);
 
EXTERN_API_C( OAMStatus )
OAMParseGetNextObject           (OAMParseInfo *         parseInfo,
                                 OAMObjectSpec *        object);
 
EXTERN_API_C( OAMStatus )
OAMParseGetNextAttribute        (OAMParseInfo *         parseInfo,
                                 OAMAttributeDescriptor * attr);
 
EXTERN_API_C( OAMStatus )
OAMSetNotificationProc          (OAMSessionID           sessID,
                                 OAMNotificationUPP     procPtr,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMRequestNotification          (OAMSessionID           sessionID,
                                 OAMNotificationSpec *  notificationSpec,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMBecomeHelperThread           (void);
 
EXTERN_API_C( OAMStatus )
OAMStartService                 (OAMSessionID           sessID,
                                 OAMObjectSpec *        objectSpec,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMStopService                  (OAMSessionID           sessID,
                                 OAMObjectSpec *        objectSpec,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMAuthenticateObject           (OAMSessionID           sessID,
                                 OAMAuthenticateInfo *  authInfo,
                                 OAMBufferDescriptor *  inDescriptor,
                                 OAMBufferDescriptor *  outDescriptor,
                                 OAMOption *            options);
 
EXTERN_API_C( OAMStatus )
OAMChangeObjectKey              (OAMSessionID           sessID,
                                 OAMAuthenticateInfo *  authInfo,
                                 OAMBufferDescriptor *  inDescriptor,
                                 OAMBufferDescriptor *  outDescriptor,
                                 OAMOption *            options);
 
 
 
#if PRAGMA_STRUCT_ALIGN
    #pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
    #pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
    #pragma pack()
#endif
 
#ifdef PRAGMA_IMPORT_OFF
#pragma import off
#elif PRAGMA_IMPORT
#pragma import reset
#endif
 
#ifdef __cplusplus
}
#endif
 
#endif /* __APPLESHAREREGISTRY__ */