nbp(3)

NAME
nbp_parse_entity, nbp_make_entity, nbp_confirm, nbp_lookup, nbp_register, nbp_remove - AppleTalk Name Binding Protocol (NBP) interface.

SYNOPSIS
#include <at/appletalk.h>
#include <at/nbp.h>

int nbp_parse_entity(at_entity_t *entity, char *str);

int nbp_make_entity(at_entity_t *entity, char *object,
char *type, char *zone);

int nbp_confirm(at_entity_t *entity, at_inet_t *dest,
at_retry_t *retry);

int nbp_lookup(at_entity_t *entity, at_nbptuple_t *buf,
int max, at_retry_t *retry);

int nbp_register(at_entity_t *entity, int fd,
at_retry_t *retry);

int nbp_remove(at_entity_t *entity, int fd);

DESCRIPTION
The NBP interface provides applications with access to the AppleTalk name Binding Protocol operations. These routines use the following structures defined in <at/appletalk.h>:

    typedef	struct	at_inet {
    	u_short		net;
    	at_node		node;
    	at_socket	socket;
    } at_inet_t;

    typedef	struct	at_retry {
    	short		interval;
    	short		retries;
    	u_char		backoff;
    } at_retry_t;

and in <at/nbp.h>:

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

    typedef	struct	at_entity {
    	at_nvestr_t	object;
    	at_nvestr_t	type;
    	at_nvestr_t	zone;
    } at_entity_t;

    typedef struct at_nbptuple {
    	at_inet_t       enu_addr;
    	u_char		enu_enum;
    	at_entity_t 	enu_entity;
    } at_nbptuple_t;

at_inet_t specifies the AppleTalk internet address of a DDP socket endpoint.

at_retry_t specifies the retry interval and maximum count for a transaction. The members of this structure are:

interval
    The interval in seconds before NBP retries a request.

retries
    The maximum number of retries for this NBP request. If retries is AT_INF_RETRY, then the request will be repeated infinitely.

at_nvestr_t specifies the an NBP entity string. This structure is used to describe the three strings object, type, and zone; which make up an entity name. The members of this structure are:

len The length of the string in bytes.

str The character data for this string.

An entity name is described by the structure at_entity_t which consists of the above three strings: object, type, and zone.

nbp_parse_entity constructs an NBP entity name from a NULL-terminated "C" string of the form object:type, object:type@zone, type@zone, or just type. The entity name is placed into the at_entity_t structure entity. This routine returns zero on success.

nbp_make_entity constructs an NBP entity name from object, type, and zone strings. The strings are NULL-terminated "C" strings. The entity name is placed into the at_entity_t structure entity. object, type and zone are the character strings to use in constructing the entity name. This routine returns zero on success.

nbp_confirm sends a confirmation request to the specified node to see if an entity name is still registered at the specified AppleTalk internet address. entity is a pointer to the at_entity_t structure containing the entity name. No metacharacters are allowed in the entity name strings. dest is the AppleTalk internet address to confirm. If the name is still registered on the node but at a different socket number, the socket number in dest is updated.

The retry pointer specifies the NBP request retry timeout in seconds and the maximum retry count. If retry is NULL, the default values of a 1 second timeout and 8 retries are used. The retries field of retry can be set to AT_INF_RETRY, in which case the transaction will be repeated infinitely.

nbp_lookup returns a list of registered name-address pairs via an NBP lookup. entity is a pointer to the at_entity_t structure containing the entity name to be looked up. buf is an array of at_nbptuple_t to receive entity tuples. max is the maximum number of entity tuples to accept. If more than max tuples are received before the lookup retry is exceeded, the lookup terminates. On success, nbp_lookup returns the number of entity tuples actually received.

The retry pointer specifies the NBP request retry timeout in seconds and the maximum retry count. If retry is NULL, the default values of a 1 second timeout and 8 retries are used. The retries field of retry can be set to AT_INF_RETRY, in which case the transaction will be repeated infinitely.

nbp_register adds the specified name-socket pair to the list of registered names on this node. entity is a pointer to the at_entity_t structure containing the entity name to be registered. Fd indicates an AppleTalk file descriptor which should be registered with the given name. The zone field of entity is always ignored. No metacharacters are allowed in the strings. socket

The retry pointer specifies the NBP request retry timeout in seconds and the maximum retry count. If retry is NULL, the default values of a 1 second timeout and 8 retries are used. The retries field of retry can be set to AT_INF_RETRY, in which case the transaction will be repeated infinitely.

nbp_remove removes the specified entity name from the list of registered names on this node. entity is a pointer to the at_entity_t structure containing the entity name to be registered. Fd indicates an AppleTalk file descriptor which is registered with the given name. The zone field of entity is always ignored. No metacharacters are allowed in the strings.

SEE ALSO
ddp(3n)

DIAGNOSTICS
All routines return -1 on error, with a detailed error code in errno:

[EINVAL]
    Invalid entity name (all).

[ETIMEDOUT]
    Request exceeded maximum retry count (nbp_confirm, nbp_lookup, and nbp_register).

WARNINGS
Strings in entity names and entity tuples are not NULL terminated.