Thanks, guys. I'm close on the AFP - I think. I'm still trying to get the IP address. I think I have the OTAddress returned but don't know how to interpret it. I get through all of these success (with noErr) PBHGetVInfoSync(), then get through PBGetVolMountInfoSize() which then lets me call PBGetVolMountInfo(). I then have the data I need to tell that the FS is actually an AppleShare, I also have the correct server name (this is the server's computer name as typed in System Prefs -> sharing -- but this is gethostbyname() resolvable) and also have the correct volume/share name returned in the ParamBlockRec. After I call PBGetVolMountInfo() I then call PBHGetVolParmsSync() trying to get the GetVolParmsInfoBuff.vMServerAdr field. The PBHGetVolParmsSync() returns noErr but I don't know how to interpret the OTAddress structure. Your email below makes me think the PBGetVolMountInfo() would give the IP address of the AFP server but I don't see it anywhere -- so I then tried to use PBHGetVolParmsSync(). Apple Developer page says I need to copy the vMServerAdr before I have access to it -- but I don't understand this.
params.ioParam.ioCompletion = nil; params.ioParam.ioVRefNum = (short)actualVolumeRefNum; params.ioParam.ioNamePtr = nil; params.ioParam.ioBuffer = (Ptr)&volParms; params.ioParam.ioReqCount = sizeof(GetVolParmsInfoBuffer); erc = PBHGetVolParmsSync(¶ms); if(erc == noErr) { if (volParms.vMServerAdr != 0) printf("Server has an IP address\n"); strncpy(data1,(const void *)&volParms.vMServerAdr,sizeof(struct OTAddress)); // Doing a copy to see if it works otaddr = (struct OTAddress *)data1; // Just trying to interpret the OTAddressType before -- but I also don't see a way to get an IP from the fAddress UInt8. printf("Address Type = %u and AF_INET = %u and ATALK = %u and DNS = %u\n",otaddr->fAddressType,AF_INET,AF_ATALK_DDP,AF_DNS);
}
Thanks Guys. I tried to post this entire function but it was too big. I do appreciate your continual help -- all be glad to email you all the function when I'm done.
thank you Dalton Hamilton
On Oct 28, 2005, at 10:47 PM, Philip D. Wasson wrote:
We do something similar in a few of our apps (all Carbon). To see if the desired volume is already mounted, we start by iterating through all mounted volumes using the Carbon File Manager call PBHGetVInfoSync() in indexed mode; that gets each valid volume reference number. For each, we call PBGetVolMountInfo() to get the remote mounting info and compare the values therein with what we're looking for (you'll get an error for local volumes).
|