initopt(3N)
NAME
initopt() − initialize a NetIPC option buffer
SYNOPSIS
#include <sys/ns_ipc.h>
void initopt(short opt[], short maxoptions, short ∗result);
DESCRIPTION
initopt() must be used to intitialize a Net IPC option buffer. Options can be added to the buffer by calling addopt() and read by calling readopt() (see addopt(3N) and readopt(3N)).
The maxoptions parameter specifies the maximum number of options that can be placed in the buffer. For example, if maxoptions specifies one, then one option can be added to the buffer. If three is specified then three options can be added. Options are indexed starting from zero.
Each time a Net IPC options buffer is to be used, it should be initialized to the number of options to be added. If fewer options are added than the buffer is initialized for, a resulting unitialized option may cause an error. A given buffer can be reused, but should be reinitialized before each use.
A Net IPC option buffer consists of space for overhead and space for options. optoverhead() returns the number of bytes needed in a buffer for a given number of options (see optoverhead(3N)). The bytes needed for option data depends upon the number and type of the options to be added, and must be calculated by the programmer. An option buffer can be larger than necessary.
Parameters
opt (input parameter)
The address of the buffer to be initialized.
maxtoptions (input parameter)
The maximum number of options to be added to the buffer.
result (output parameter)
The result code returned. Refer to diagnostics section below for more information.
RETURN VALUE
None. Errors are returned in the result parameter.
DIAGNOSTICS
initopt() sets result to the value indicated when the following conditions are encountered:
[NSR_ADDR_OPT] The options parameter is null.
[NSR_NO_ERROR] The call was successful.
[NSR_OPT_TOTAL] The num_entries parameter is negative.
AUTHOR
initopt() was developed by HP.
SEE ALSO
ipcconnect(2), ipccontrol(2), ipccreate(2), ipcdest(2), ipcgetnodename(2), ipclookup(2), ipcname(2), ipcnamerase(2), ipcrecv(2), ipcrecvcn(2), ipcselect(2), ipcsend(2), ipcsetnodename(2), ipcshutdown(2), addopt(3N), ipcerrmsg(3N), optoverhead(3N), readopt(2).
Hewlett-Packard Company — HP-UX Release 9.0: August 1992