2025-04-27 07:49:33 -04:00

1 line
2.7 KiB
C

// ===========================================================================
// UAMNetwork.h © 1998 Microsoft Corp. All rights reserved.
// ===========================================================================
#pragma once
#include "UAMUtils.h"
#define kDDPPacketLength 576 //The size of one packet
#define kAFPIconSize 128 //Black & white icons are 128 bytes
//
//Pascal style strings used to determine supported UAMs.
//
#define PSTR_AFPVersion22 "\pAFP2.2"
#define PSTR_AFPVersionOfChoice "\pAFPVersion 2.1"
#define PSTR_ClearTextLogin "\pCleartxt Passwrd"
#define PSTR_GuestLogin "\pNo User Authent"
#define PSTR_EncryptedLogin1_0 "\pMicrosoft V1.0"
#define PSTR_EncryptedLogin2_0 "\pMS2.0"
#define kOneWayEncryptedArgSize 16
#define kServerChallengeMaxLen 8
#define kServerChallengeExtCharMapTableSize 128
#define kStartingExtendedCharValue 0x80
#define kIllegalMappedExtChar 0xFF
#define UAM_USERNAMELEN 33
#define UAM_CLRTXTPWDLEN 14
#define UAM_ENCRYPTEDPWLEN 32
//
//Mac's time is based from January 1, 1904 while a server's is based on the
//year 2000. Below is the difference between the two for conversion and a
//macro to make life easier.
//
#define NUM_SECS_FROM_1904_TO_2000 3029529600
#define LOCAL_TIME(serverTime) (NUM_SECS_FROM_1904_TO_2000 + serverTime)
typedef unsigned char PassWord[8];
//
//Struct for accessing server info after a ASPGetStatus call. This is the
//header information provided from the call. See Inside Appletalk p. 13-95/97
//
typedef struct
{
short machineTypeOffset;
short afpVersionOffset;
short supportedUAMOffset;
short volumeIconOffset;
short serverFlags;
}ServerInfoReplyBlock, *ServerInfoReplyBlockP;
//FPGetSrvrInfo() server flags bit values
typedef enum {
kSupportsCopyFile = 0x1,
kSupportsChngPswd = 0x2,
kDontAllowSavePwd = 0x4,
kSupportsSrvrMsgs = 0x8,
kSupportsSrvrSig = 0x10,
kSupportsTCPIP = 0x20,
kSupportsSrvrNotification = 0x40
}ServerStatusReplyFlags;
//
//Enums for supported UAMs on the server.
//
enum {
kGuestSupported = 0x1,
kClearTxtSupported = 0x2,
kMSUAMSupported = 0x4,
kMSUAM_V2_Supported = 0x8
};
//
//The reply block returned when using MSUAM.
//
typedef struct _MSUAMLoginReplyBlock
{
char serverChallenge[kServerChallengeMaxLen];
char serverExtCharMapTable[kServerChallengeExtCharMapTableSize];
}MSUAMLoginReplyBlock;
//
//Prototypes for UAMNetwork live here.
//
void UAM_GetSupportedUAMS(ServerInfoReplyBlockP inReplyInfo, long *ioSupported);
Boolean UAM_MapCharactersIntoHostSet(char *szTarg, char *mappingTbl);
void UAM_CryptEncrypt(char *inClearPassword, char *inServerChallenge, char *outEncryptPW);
void UAM_DoublePasswordEncrypt(char *inCPPassword, char *inCPKeyPass, char *outDest);