zip(3)

NAME
AppleTalk Zone Information Protocol (ZIP) interface

SYNOPSIS
#include <netat/appletalk.h>
#include <AppleTalk/at_proto.h>

int zip_getmyzone(char *ifName, at_nvestr_t *zone);

int zip_getzonelist(char *ifName, int *context, u_char *zones, int *size);

int zip_getlocalzones(char *ifName, int *context, u_char *zones, int *size);

DESCRIPTION
The ZIP interface provides applications with access to the AppleTalk Zone Information Protocol operations.

The zip_getmyzone routine obtains the zone name for the local network. The request is completed on the node itself.

ifName
    A pointer to a character string containing the interface name, e.g. en0. If ifName is a null pointer (ZIP_DEF_INTERFACE) the default interface will be used.

zone
    A pointer to the zone name. The zone string is defined by the following structure:

    typedef struct  at_nvestr {
            u_char  len;
            u_char  str[NBP_NVE_STR_SIZE];
    } at_nvestr_t;

len The size of the string in bytes.

str The zone name.

This routine returns 0 upon success, -1 on failure.

The zip_getzonelist routine is used to obtain a complete list of all the zone names defined in the internet. This routine sends a ZIP request to a bridge for the list of zone names in the internet. The list is placed into the supplied buffer as concatenated at_nvestr_t structures.

ifName
    A pointer to a character string containing the interface name, e.g. en0. If ifName is a null pointer (ZIP_DEF_INTERFACE) the default interface will be used.

context
    *context should be set to ZIP_FIRST_ZONE for the first call. The returned value may be used in the next call, unless it is equal to ZIP_NO_MORE_ZONES.

zones
    Pointer to the beginning of the "zones" buffer. Zone data returned will be a sequence of at_nvestr_t Pascal-style strings, as it comes back from the ZIP_GETZONELIST request sent over ATP.

size
    Length of the "zones" buffer; must be at least (ATP_DATA_SIZE+1) bytes in length.

zip_getzonelist will return the zone count on success, and -1 on failure.

The zip_getlocalzones routine usage and behavior are the same as zip_getzonelist except that it returns the list of zones on the local EtherTalk cable rather than all the zones on the internet.

DIAGNOSTICS
All routines return -1 on error with a detailed error code stored in errno.

[EINVAL]
    Invalid parameter (all).

[EIO]
    An I/O error occurred.

[ENETUNREACH]
    A bridge node could not be found to process the request (all).

[ENXIO]
    An error occurred while sending a message to a device.

Routines also return any error codes returned by the underlying ATP, DDP, or ALAP layers.

WARNING
The returned zone strings are not null-terminated.

SEE ALSO
ddp(3), lap(3), atp(3),
Inside AppleTalk.