Re: Mounting remote volume over IP
Re: Mounting remote volume over IP
- Subject: Re: Mounting remote volume over IP
- From: "Philip D. Wasson" <email@hidden>
- Date: Wed, 14 Aug 2002 16:18:40 -0400
Oops, I only replied directly, so here's the answer I gave, in case it
can help someone else or someone has something to add (or correct) that
might benefit me too.
On Tuesday, August 13, 2002, at 05:24 , Lorenzo Thurman wrote:
[...]
I'm trying to write a program that mounts a remote AppleShare volume
over IP. The documentation, TN1111, I understand for the most part
except for two data structures, AFPTagData and AFPAlternateAddress. I'm
not sure how to fill them out. This is what I have so far with respect
to those two, the data type for all the fields is a short (UInt8):
AFPTagData data;
data.fLength = kAFPTagLengthIP;
data.fType = kAFPTagTypeIP;
data.fData[0] = ??? // What goes here?
AFPAlternateAddress addr;
addr.fAddressCount = 1; // I only have one address
addr.fAddressList[0] = ??? // What goes here?
[...]
Don't forget the addr.fVersion field, which was missing from the 3.2
Universal Headers (according to a comment in more recent headers).
AFPAlternateAddress is a version and count of addresses, followed by the
data for those addresses. AFPTagData just sets out the general format
for an address record. I see 4 specific address types in <files.h>:
kAFPTagTypeIP, kAFPTagTypeIPPort, kAFPTagTypeDDP, and kAFPTagTypeDNS.
The comments next to the constant tell you what the format is for the
address data. There are corresponding constants for the size of each
type's data as well.
The type I use in our application is kAFPTagTypeIPPort, whose data is a
4 byte IP address followed by a 2-byte port, both in big-endian
(network) order, which is the natural order for 68K and PowerPC. This
means that the format of the whole AFPAlternateAddress record, assuming
you're only specifying one alternate address, is:
UInt8 AFPAlternateAddress.fVersion (= 0)
UInt8 AFPAlternateAddress.fAddressCount (= 1)
UInt8 AFPTagData.fLength (= kAFPTagLengthIPPort)
UInt8 AFPTagData.fType (= kAFPTagTypeIPPort)
UInt32 IP Address (= target address)
UInt16 IP Port (= target port)(548 is the default for AFP-over-TCP)
To make this easier, I just declared a struct containing all these
things. The struct should be packed (watch out for alignment).
struct {
UInt8 fAltVersion;
UInt8 fAddressCount;
UInt8 fLength;
UInt8 fType;
UInt32 fAddress;
UInt16 fPort;
} myAltAddress;
I just fill in this struct and pass it to MoreFiles'
BuildAFPXVolMountInfo which stuffs all the fields into a
AFPXVolMountInfo struct.
Good luck.
----------------------------------------
Philip D. Wasson
Senior Software Engineer
Managing Editor Inc.
email@hidden
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.