nbp(3N) nbp(3N)NAME nbp_parse_entity, nbp_make_entity, nbp_confirm, nbp_lookup, nbp_register, nbp_remove - perform AppleTalk Name Binding Protocol (NBP) interface operations SYNOPSIS #include <at/appletalk.h> #include <at/nbp.h> int nbp_parse_entity(entity, str); at_entity_t *entity; char *str; int nbp_make_entity(entity, object, type, zone); at_entity_t *entity; char *object, *type, *zone; int nbp_confirm(entity, dest, retry); at_entity_t *entity; at_inet_t *dest; at_retry_t *retry; int nbp_lookup(entity, buf, max, retry); at_entity_t *entity; at_nbptuple_t *buf; int max; at_retry_t *retry; int nbp_register(entity, fd, retry); at_entity_t *entity; int fd; at_retry_t *retry; int nbp_remove(entity, fd ) ; at_entity_t *entity; int fd; DESCRIPTION The NBP interface provides applications with access to NBP operations. The routines use these structures (defined in <at/appletalk.h>): typedef struct at_inet { at_net net; at_node node; at_socket socket; } at_inet_t; typedef struct at_retry { short interval; short retries; u_char backoff; January 1992 1
nbp(3N) nbp(3N)} at_retry_t; The AppleTalk NBP operations also use these structures (defined 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; The at_inet_t structure specifies the AppleTalk internet address of a Datagram Delivery Protocol (DDP) socket endpoint. The at_retry_t structure specifies the retry interval and maximum count for a transaction. The members of this structure are as follows: interval The interval in seconds before NBP retries a request. retries The maximum number of retries for this NBP request. backoff Not used by NBP. The at_nvestr_t structure specifies an NBP entity string. The members of this structure are as follows: len The length of the string in bytes. str The character data for this string. The at_entity_t structure describes an entity name, which consists of three NBP entity strings: object, type, and zone. All NBP routines work with the at_entity_t structure. Two utility routines, nbp_parse_entity and nbp_make_entity, are 2 January 1992
nbp(3N) nbp(3N)provided to aid in creating at_entity_t structures from C strings. The nbp_parse_entity structure constructs an NBP entity name from a NULL-terminated C string of the form object, object:type or object:type@zone. The entity name is placed in the at_entity_t structure entity. This routine returns 0 on successful completion. The nbp_make_entity structure 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. Use the object, type, and zone character strings to construct the entity name. This routine returns 0 on successful completion. The nbp_confirm structure sends a confirmation request to the specified node to see if an entity name is still registered at the specified AppleTalk internet address. entity A pointer to the at_entity_t structure containing the entity name. No wild cards are allowed in the entity- name strings, but an asterisk (*) for the zone name is acceptable. dest The AppleTalk internet address to confirm. If the name is still registered on the node but is registered at a different socket number, the socket number in dest is updated. retry A pointer to the structure that specifies the NBP request retry interval in seconds and the maximum retry count. If retry is NULL, the system uses the default values: a 1-second interval and eight retries. On successful completion, nbp_confirm returns 1. It returns 0 when the name is not confirmed, and -1 if an error occurs. The nbp_lookup structure returns a list of registered name- address pairs obtained by means of an NBP look-up. The parameters are as follows: entity A pointer to the at_entity_t structure containing the entity name to be looked up. buf An array of at_nbptuple_t to receive entity tuples. max The maximum number of entity tuples to accept. If max or more distinct tuples are received before the look-up January 1992 3
nbp(3N) nbp(3N)retry count is exceeded, the look-up terminates. retry A pointer to the structure that specifies the NBP request retry interval in seconds and the maximum retry count. If retry is NULL, the system uses the default values: a 1-second interval and eight retries. On success, nbp_lookup returns the number of entity tuples actually received. The nbp_register structure adds the specified name-socket pair to the list of registered names on this node. The parameters are as follows: entity A pointer to the at_entity_t structure containing the entity name to be registered. The zone field of entity is always ignored. No wild cards are allowed in the entity strings. fd An AppleTalk file descriptor to be registered with the given name. retry A pointer to the structure that specifies the NBP request retry interval in seconds and the maximum retry count. If retry is NULL, the system uses the default values: a 1-second interval and eight retries. The nbp_remove structure removes the specified entity name from the list of registered names on this node. The parameters are as follows: entity A pointer to the at_entity_t structure containing the entity name to be removed. The zone field of entity is always ignored. No wild cards are allowed in the entity strings. fd The AppleTalk file descriptor that is registered with the given name. STATUS MESSAGES AND VALUES All routines return -1 if an error occurs with a detailed error code in errno: EINVAL The entity name is invalid. ETIMEDOUT The request exceeded maximum retry count. 4 January 1992
nbp(3N) nbp(3N)EADDRNOTAVAIL The nbp_register routine was given a name that is already registered, or the nbp_remove routine was given an unregistered name. WARNINGS Strings in entity names and entity tuples are not NULL- terminated. All characters in network-visible entity (NVE) names are significant, including trailing blanks. See Inside AppleTalk for a description of NVE names. SEE ALSO ddp(3N) Inside AppleTalk January 1992 5