Plan B User's Manual


Name

import ­ Imports a box under a given name in the name space.

Synopsis

#include <ulib.h>

void import(char* nm, char* addr, char* sel, int p);

Description

Import defines a new name for a box. The name defined, nm, is introduced in the prefix table that implements the name space. After the call, any name starting with the same prefix is considered to match and the imported box may be selected for the operation.

The box imported is located at the server whose network address is addr and is known by that server as the box with name and constraint given by sel.

The special network address any may be used to request that any box advertised as sel be imported to the name space as soon as the advertisement is received.

The p parameter determines the place where the entry is placed in the name space. This is important since entries are searched in order from the ones above to the ones below. For automatic imports of advertised boxes, entries are added to the place determined at the time of the call. Values for p can be:

MABOVE   determines that the entry goes above existing ones.
MBELOW   determines that it goes below existing ones.
MUNIX    determines that goes above after removing existing ones for the same name.

Example

import("/c", "nautilus:777", "/b", MABOVE);
import("/c", "any", "/b!*!p98", MABOVE);
The first call adds the name (the prefix) /c to the name space above existing entries. The box known as /b by the server reachable by the connection /b/con/nautilus:777 is the one installed. The second call is similar, but instead of requesting an immediate import, arranges for boxes advertised under the name /b with constraints matching *!98 to be imported under the name /c as soon as the ad is received (their entries will be installed above the ones existing at the time of the call).

Source

/src/b/port/box.c

See also

intro(2), forget(2), and import(1).

Bugs



Plan B User's Manual. First edition.