ARPerations.h

/*
    File:       ARPerations.h
 
    Contains:   Interface to the standard ARP operations
 
    Written by: Quinn "The Eskimo!" 
 
    Copyright:  Copyright © 1997-1999 by Apple Computer, Inc., All Rights Reserved.
 
                You may incorporate this Apple sample source code into your program(s) without
                restriction. This Apple sample source code has been provided "AS IS" and the
                responsibility for its operation is yours. You are not permitted to redistribute
                this Apple sample source code as "Apple sample source code" after having made
                changes. If you're going to re-distribute the source, we require that you make
                it clear in the source that the code was descended from Apple sample source
                code, but that you've made changes.
 
    Change History (most recent first):
                7/21/1999   Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
                
 
*/
 
// Pick up the standard UInt32 and Handle types.
 
#include <Types.h>
 
 
OSStatus ARPGetCacheReport(Handle cacheReport);
    // Gets a report about the contents of the ARP
    // cache in standard Macintosh 'TEXT' format.
    // You must create the handle before calling this routine
    // and dispose it after it returns.  The routine will
    // resize as appropriate.
 
 
OSStatus ARPAddEntry(char *interfaceName,
                        UInt32 arpProto,
                        UInt32 flags,
                        void *protoAddress, UInt32 protoSize, void *protoMask,
                        void *hardwareAddress, UInt32 hardwareSize);
    // Add an entry to the ARP cache for the given
    // interface.  arpProto is the ARP
    // protocol type, typically IP_ARP_PROTO_TYPE for 
    // IP ARP.  See "OTARPModule.h" for
    // a description of the flags parameter.  protoAddress
    // is a pointer to the protocol address.  protoSize
    // is the length of the protocol address.  These would
    // normally be &InetHost and sizeof(InetHost) respectively.
    // protoMask is a pointer to the protocol mask for this
    // entry.  Normally you would pass a protoMask of $FFFFFFFF.
    // I'm not sure what other values do.  hardwareAddress
    // and hardwareSize specify the hardware address for the
    // entry.  For an Ethernet-style interface, these are
    // a pointer to the Ethernet address and 6 respectively.
 
OSStatus ARPDeleteEntry(char *interfaceName,
                        UInt32 arpProto,
                        void *protoAddress, UInt32 protoSize);
    // Delete an entry from the ARP cache for the given
    // interface.
    // arpProto is the ARP protocol type, typically IP_ARP_PROTO_TYPE
    // for IP ARP.
    // protoAddress and protoSize specify the
    // protocol address of the entry to delete.  These would
    // normally be &InetHost and sizeof(InetHost) respectively.
    
OSStatus ARPCacheQuery(char *interfaceName,
                        UInt32 arpProto,
                        void *protoAddress, UInt32 protoSize,
                        void *hardwareAddress, UInt32 hardwareSize, UInt32 *flags);
    // Look up an entry in the ARP cache for a given
    // interface.    
    // arpProto is the ARP protocol type, typically IP_ARP_PROTO_TYPE
    // for IP ARP.
    // protoAddress and protoSize specify the
    // protocol address of machine you are looking up.  These would
    // normally be &InetHost and sizeof(InetHost) respectively.
    // You should set hardwareAddress to point to a buffer 
    // where the hardware address is returned.  You should give
    // the size of the buffer in hardwareSize.  You should set
    // flags to point to a buffer where the ARP cache entry's
    // flags are returned.  See "OTARPModule.h" for
    // a description of the possible flag values.
 
OSStatus ARPInterfaceUp(char *configString, UInt32 *interfaceCookie);
    // Bring an ARP interface up.  configString is the
    // name of the port over which to bring the interface up, ie
    // the name you would pass to OTCreateConfiguration to address
    // that port.  Aliases, such as "enet", are allowed.
    // The UInt32 pointed to by interfaceCookie is set to a
    // value you can pass to ARPInterfaceDown to tear the
    // interface down.
 
OSStatus ARPInterfaceDown(UInt32 interfaceCookie);
    // Tear an ARP interface down.  interfaceCookie is the
    // value you got from ARPInterfaceUp when you brought the
    // interface up.