slink(ADMN)


slink -- STREAMS linker

Synopsis

/etc/slink [ -c file ] [ -f ] [ -u ] [ -v ] [ function [ arg ... ]]

Description

slink is a STREAMS configuration utility which is used to define the various modules and drivers required for STREAMS TCP/IP. (Note that networking interfaces are defined via the /etc/confnet.d/interface file.)

The following options may be specified on the slink command line:


-c file
Use file instead of /etc/inet/strcf.

-f
Do not fork. slink must remain in the foreground, holding open its file descriptors. This assumes that persistent links are not being used. In this case, slink will only be able to build streams that are defined to use regular links (I_LINK; see streamio(HW)).

-u
Unlink persistent links (shut down the protocol stack). This option can only be run by the user root, and not by others with root authority.

-v
Verbose mode (each operation is logged to stderr).
If a function is specified as an argument, it will be used instead of the boot function.

The configuration file contains a list of functions, each of which is composed of a list of commands. Each command is a call to one of the functions defined in the configuration file or to one of a set of built-in functions. Among the built-in functions are the basic STREAMS operations open, link, plink, and push, along with several TCP/IP-specific functions.

A function definition has the following form:

   function-name {
   	command1
   	command2
   	...
   }
The syntax for commands is:
   function arg1 arg2 arg3 ...
or
   var = function arg1 arg2 arg3 ...
The placement of newlines is important: a newline must follow the left and right braces and every command. Extra newlines are allowed; that is, where one newline is required, more than one may be used. A backslash (\) followed immediately by a newline is considered equivalent to a space; that is, it may be used to continue a command on a new line. The use of other white space characters (spaces and tabs) is at the discretion of the user, except that there must be white space separating the function name and the arguments of a command.

Comments are delimited by ``#'' and newline, and are considered equivalent to a newline.

Function and variable names may be any string of characters taken from A-Z, a-z, 0-9, and ``_'', except that the first character cannot be a digit. Function names and variable names occupy separate name spaces. All functions are global and may be forward referenced. All variables are local to the functions in which they occur.

Variables are defined when they appear to the left of an equals (=) on a command line. For example:

   tcp = open /dev/inet/tcp
The variable acquires the value returned by the command. In the above example, the value of the variable tcp will be the file descriptor returned by the open call.

Arguments to a command may be either variables, parameters, or strings.

A variable that appears as an argument must have been assigned a value on a previous command line in that function.

Parameters take the form of a dollar sign ($) followed by one or two decimal digits, and are replaced with the corresponding argument from the function call. If a given parameter was not specified in the function call, an error results (for example, if a command references $3 and only two arguments were passed to the function, an execution error will occur).

Strings are sequences of characters optionally enclosed in double quotes ("). Quotes may be used to prevent a string from being interpreted as a variable name or a parameter, and to allow the inclusion of spaces, tabs, and the special characters {, }, =, and #. The backslash (\) may also be used to quote the characters {, }, =, ", #, and \ individually.

The following built-in functions are provided by slink:


addmcaddr MAC_address
Send a message to the network driver to implement a multicast Media Access Control (MAC) address (MAC_address). The 48-bit address must be formatted as six hexadecimal numbers separated by colons, for example: 01:00:5e:7f:7f:7f.

close fd
Close file descriptor fd.

dlattach fd unit
Send a DL_ATTACH_REQ message down the stream referenced by fd specifying unit unit.

dlbind fd sap
Send a DL_BIND_REQ message down the stream referenced by fd specifying the Service Access Point sap. The media-level address of the device at the bottom of the stream is returned if the operation succeeds. It can be used later as the argument to the sifaddr command.

dlsubsbind fd ssap
Send a DL_SUBS_BIND_REQ message down the stream referenced by fd specifying the Secondary Service Access Point ssap.

exit
Cause slink to exit due to the failure of a built-in command in the streams-linking process.

initqp path qname lowat hiwat ...
Send an INITQPARMS (initialize queue parameters) ioctl to the driver corresponding to pathname path. qname specifies the queue for which the low and high water marks will be set, and must be one of:


hd
stream head

rq
read queue

wq
write queue

muxrq
multiplexor read queue

muxwq
multiplexor write queue

lowat and hiwat specify the new low and high water marks for the queue. Both lowat and hiwat must be present. To change only one of these parameters, the other may be replaced with a dash ``-''. Up to five qname lowat hiwat triplets may be present.


link fd1 fd2
Link the stream referenced by fd2 beneath the stream referenced by fd1. Returns the link identifier associated with the link. Note that fd2 cannot be used after this operation.

noexit
Allow operations to continue rather than causing slink to exit due to the failure of a built-in command in the streams-linking process. The currently executing function is terminated and execution resumes at the next statement.

open path
Open the device specified by pathname path. Returns a file descriptor referencing the open stream.

plink fd1 fd2
Link the stream referenced by fd2 beneath the stream referenced by fd1 using a persistent link. Returns the link identifier associated with the link. Note that fd2 cannot be used after this operation.

push fd module
Push module onto the stream referenced by fd.

return val
Set the return value for the current function to val. Note that executing a return command does not terminate execution of the current function.

sifaddr fd name addr
Sends a SIOCSIFNAME ioctl down the stream referenced by fd. The arguments are an interface name and the media-level address associated with the specified name. This is used by the ARP driver to reply to ARP queries.

sifhrd fd type
Send a SIOCSHRDTYPE (set interface hardware type) ioctl down the stream referenced by fd. The hardware type is used by the ARP driver when sending messages. Legal values for type are ``ether'' and ``ieee''.

sifname fd link name flags
Send a SIOCSIFNAME (set interface name) ioctl down the stream referenced by fd for the link associated with link identifier link specifying the name name. flags are specified in hexadecimal by OR'ing the bit values defined in /usr/include/sys/net/if.h:


0x1
interface is up (IFF_UP)

0x2
broadcast address is valid (IFF_BROADCAST)

0x4
turn on debugging (IFF_DEBUG)

0x8
loopback through the network (IFF_LOOPBACK)

0x10
interface is a point-to-point link (IFF_POINTOPOINT)

0x20
interface wants to hear IP ioctl requests (IFF_WANTIOCTLS)

0x40
resources allocated (IFF_RUNNING)

0x80
no address resolution protocol (IFF_NOARP)

0x100
link-specific flag (IFF_LINK0)

0x200
receive all multicast packets (IFF_ALLMULTI; not implemented, reserved for future use)

0x400
link-specific flag (IFF_LINK1)

0x800
select one-packet mode (IFF_ONEPACKET)

0x1000
link-specific flag (IFF_LINK2)

0x2000
interface cannot hear own transmissions (IFF_SIMPLEX)

0x4000
interface supports IP multicasting (IFF_MULTICAST)


strcat str1 str2
Concatenate strings str1 and str2 and return the resulting string.

unitsel fd unit
Send a IF_UNITSEL (unit select) ioctl down the stream referenced by fd specifying unit unit.

Files


/etc/confnet.d/interface
interface definition file

/etc/inet/strcf
STREAMS TCP/IP configuration file

References

Intro(ADMP), strcf(SFF), streamio(HW)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005