[comp.os.vms] Quick way to see if a DECnet node is reachable

jon@gaia.UUCP (Jonathan Corbet) (05/09/87)

Somebody recently asked about how one might quickly see if a DECnet node
is reachable.  Below is some code which does just that.  It uses the
(undocumented) netacp calls that were published in the Pageswapper last
year.  Be warned: this stuff is undocumented, unsupported.  It could break
at any new release of the system!

There are two files here, "reachable.c" and "nfbdef.h".  The latter is a
little long, but I have modified it enough (mostly by adding structure
definitions) that I couldn't just say "get it from lib.mlb".

enjoy.

Jonathan Corbet
{seismo | hplabs | gatech}!hao!gaia!jon
{ucbvax | allegra | cbosgd}!nbires!gaia!jon


------- reachable.c ---------------------
/* 1/86 jc */

# include "nfbdef.h"
# include <iodef.h>
# include <stdio.h>

# define error(s) (((s) & 0x1) == 0)


reachable (node)
char *node;
/*
 * Return TRUE iff the given node is reachable.
 * NOTE:	This routine relies on an undocumented interface to NETACP
 *		that is discussed in the January '86 Pageswapper.
 */
{
	struct nfb nfb;
	struct nfbkey key;
	int chan = 0, status, len = 0, ef = 0;
	short iosb[4];
	char buf[1024];
	int nfbd[2] = { sizeof (struct nfb), &nfb };
	int keyd[2] = { sizeof (struct nfbkey), &key };
/*
 * Set up the NFB.
 */
	nfb.nfb$b_fct = NFB$C_FC_SHOW;
	nfb.nfb$b_flags = NFB$M_MULT;
	nfb.nfb$b_database = NFB$C_DB_NDI;
	nfb.nfb$l_srch_key = NFB$C_NDI_REA;
	nfb.nfb$b_oper = NFB$C_OP_EQL;
	nfb.nfb$l_srch2_key = NFB$C_NDI_LOO;
	nfb.nfb$b_oper2 = NFB$C_OP_NEQ;
	nfb.nfb$b_mbz1 = 0;
	nfb.nfb$w_cell_size = 0;
	nfb.nfb$l_fldid[0] = NFB$C_NDI_NNA;
	nfb.nfb$l_fldid[1] = NFB$C_ENDOFLIST;
/*
 * Set up the match key.
 */
	key.p4_count = 0;
	key.srch = 1;
	key.srch2 = 1;
	key.start = 0;
/*
 * Get a net channel.
 */
	lib$get_ef (&ef);
	status = sys$assign (descr ("_NET:"), &chan, 0, 0);
	if (error (status))
		syserr (status, "Assign to net");
/*
 * Do the qio.
 */
	status = sys$qiow (ef, chan, IO$_ACPCONTROL, iosb, 0, 0,
		nfbd, keyd, &len, descr_n (buf, 1024), 0, 0);
	if (error (status))
		syserr (status, "QIO status");
	else if error (iosb[0])
		syserr (iosb[0], "QIO iosb");
/*
 * Release our resources.
 */
	sys$dassgn (chan);
	lib$free_ef (&ef);
/*
 * See if the node is reachable.
 */
	return (is_reachable (buf, len, node));
}




is_reachable (buf, len, node)
char *buf;
int len;
char *node;
/*
 * Pass through the given buffer and see if the given node appears therein.
 */
{
	int length;
	char *cp = buf;
/*
 * Pass through the structure.
 */
	while ((cp - buf) < len)
	{
	/*
	 * The first two bytes are the length of the node name.  Sometimes
	 * one sees a length of zero, caused by nodes in the same area for
	 * which no name has been set.
	 */
		if (length = * (short *) cp)
		{
			if (! strncmp (node, cp + 2, length))
				return (TRUE);
		}
	/*
	 * Advance to the next name.
	 */
		cp += length + 2;
	}
	return (FALSE);
}


------- nfbdef.h -----------------------

/*
	$NFBDEF symbol definitions from LIB.MLB
 */
/*
 * My own version of this file, with comments and structure definitions
 * added.  jc.
 */
# define	NFB$B_DATABASE	0X2
# define	NFB$B_FCT	0X0
# define	NFB$B_FLAGS	0X1
# define	NFB$B_MBZ1	0XD
# define	NFB$B_OPER	0X3
# define	NFB$B_OPER2	0XC
# define	NFB$B_STR_TEXT	0X2
# define	NFB$C_AJI_ADD	0X13010010
# define	NFB$C_AJI_BLO	0X13010013
# define	NFB$C_AJI_CIR	0X13020042
# define	NFB$C_AJI_COL	0X13020040
# define	NFB$C_AJI_LCK	0X13000001
# define	NFB$C_AJI_LIT	0X13010012
# define	NFB$C_AJI_NNA	0X13020041
# define	NFB$C_AJI_REA	0X13000002
# define	NFB$C_AJI_RPR	0X13010014
# define	NFB$C_AJI_TYP	0X13010011
# define	NFB$C_ARI_ADD	0X14010010
# define	NFB$C_ARI_COL	0X14020040
# define	NFB$C_ARI_DCO	0X14010011
# define	NFB$C_ARI_DHO	0X14010012
# define	NFB$C_ARI_DLI	0X14020041
# define	NFB$C_ARI_LCK	0X14000001
# define	NFB$C_ARI_NND	0X14010013
# define	NFB$C_ARI_REA	0X14000002
# define	NFB$C_CRI_ACB	0X4010029
# define	NFB$C_CRI_ACI	0X401002A
# define	NFB$C_CRI_BBT	0X4010025
# define	NFB$C_CRI_BLK	0X4000003
# define	NFB$C_CRI_BLO	0X4010017
# define	NFB$C_CRI_CHN	0X4010021
# define	NFB$C_CRI_CHR	0X4020043
# define	NFB$C_CRI_CNT	0X4020044
# define	NFB$C_CRI_COL	0X4020040
# define	NFB$C_CRI_COS	0X4010018
# define	NFB$C_CRI_CTA	0X4010011
# define	NFB$C_CRI_DEVNAM	0X402004A
# define	NFB$C_CRI_DLM	0X4000005
# define	NFB$C_CRI_DRT	0X4010036
# define	NFB$C_CRI_DTE	0X4020049
# define	NFB$C_CRI_DTH	0X4010031
# define	NFB$C_CRI_DYB	0X401002E
# define	NFB$C_CRI_DYI	0X401002F
# define	NFB$C_CRI_DYT	0X4010030
# define	NFB$C_CRI_HET	0X4010019
# define	NFB$C_CRI_IAB	0X401002B
# define	NFB$C_CRI_IAI	0X401002C
# define	NFB$C_CRI_IAT	0X401002D
# define	NFB$C_CRI_LCK	0X4000001
# define	NFB$C_CRI_LCT	0X4010015
# define	NFB$C_CRI_LIT	0X401001A
# define	NFB$C_CRI_LOO	0X4020046
# define	NFB$C_CRI_MBL	0X4010022
# define	NFB$C_CRI_MRB	0X4010027
# define	NFB$C_CRI_MRC	0X401001B
# define	NFB$C_CRI_MRT	0X4010034
# define	NFB$C_CRI_MST	0X4010032
# define	NFB$C_CRI_MTR	0X4010028
# define	NFB$C_CRI_MWI	0X4010023
# define	NFB$C_CRI_NAM	0X4020041
# define	NFB$C_CRI_NUM	0X4020048
# define	NFB$C_CRI_OWPID	0X4010010
# define	NFB$C_CRI_P2P	0X4020045
# define	NFB$C_CRI_PLS	0X401001E
# define	NFB$C_CRI_PNA	0X4010016
# define	NFB$C_CRI_PNN	0X4020047
# define	NFB$C_CRI_POL	0X401001D
# define	NFB$C_CRI_RCT	0X401001C
# define	NFB$C_CRI_RPR	0X4010035
# define	NFB$C_CRI_SER	0X4000002
# define	NFB$C_CRI_SRV	0X4010012
# define	NFB$C_CRI_STA	0X4010013
# define	NFB$C_CRI_SUB	0X4010014
# define	NFB$C_CRI_TRI	0X4010024
# define	NFB$C_CRI_TRT	0X4010026
# define	NFB$C_CRI_TYP	0X4010020
# define	NFB$C_CRI_USE	0X401001F
# define	NFB$C_CRI_VER	0X4000004
# define	NFB$C_CRI_VMSNAM	0X4020042
# define	NFB$C_CRI_XPT	0X4010033
# define	NFB$C_CTX_SIZE	0X40
# define	NFB$C_DB_AJI	0X13	/* Adjacency information	*/
# define	NFB$C_DB_ARI	0X14	/* Area information 		*/
# define	NFB$C_DB_CRI	0X4	/* Circuit information		*/
# define	NFB$C_DB_EFI	0X6	/* Event logging filters	*/
# define	NFB$C_DB_ESI	0X7	/* Event logging sinks		*/
# define	NFB$C_DB_LLI	0X8	/* Logical links		*/
# define	NFB$C_DB_LNI	0X1	/* Local node information	*/
# define	NFB$C_DB_MAX	0X1B
# define	NFB$C_DB_NDI	0X2	/* Common node information	*/
# define	NFB$C_DB_OBI	0X3	/* Object information		*/
# define	NFB$C_DB_PLI	0X5	/* Line information		*/
# define	NFB$C_DB_PSI1	0X15
# define	NFB$C_DB_PSI2	0X16
# define	NFB$C_DB_PSI3	0X17
# define	NFB$C_DB_PSI4	0X18
# define	NFB$C_DB_PSI5	0X19
# define	NFB$C_DB_SDI	0X1A	/* Service (DLE) Information	*/
# define	NFB$C_DB_SPI	0X12	/* Server process info		*/
# define	NFB$C_DB_XAI	0X1B	/* X.25 access database		*/
# define	NFB$C_DB_XD5	0XD
# define	NFB$C_DB_XD9	0XF
# define	NFB$C_DB_XDI	0XB
# define	NFB$C_DB_XGI	0XA
# define	NFB$C_DB_XNI	0X9
# define	NFB$C_DB_XS5	0XC
# define	NFB$C_DB_XS9	0XE
# define	NFB$C_DB_XTI	0X10
# define	NFB$C_DB_XTT	0X11
# define	NFB$C_DB_XXX	0X1C

# define	NFB$C_DECLNAME	0X15		/* Declare name		*/
# define	NFB$C_DECLOBJ	0X16		/* Declare object	*/
# define	NFB$C_DECLSERV	0X17		/* Declare server avail	*/
# define	NFB$C_EFI_B1	0X6010012
# define	NFB$C_EFI_B2	0X6010013
# define	NFB$C_EFI_COL	0X6020040
# define	NFB$C_EFI_EVE	0X6020041
# define	NFB$C_EFI_LCK	0X6000001
# define	NFB$C_EFI_SB1	0X6020042
# define	NFB$C_EFI_SB2	0X6020043
# define	NFB$C_EFI_SB3	0X6020044
# define	NFB$C_EFI_SIN	0X6010010
# define	NFB$C_EFI_SP1	0X6010011
# define	NFB$C_ENDOFLIST	0X0
# define	NFB$C_ESI_B1	0X7010013
# define	NFB$C_ESI_B2	0X7010014
# define	NFB$C_ESI_COL	0X7020040
# define	NFB$C_ESI_LCK	0X7000001
# define	NFB$C_ESI_LNA	0X7020041
# define	NFB$C_ESI_SB1	0X7020042
# define	NFB$C_ESI_SB2	0X7020043
# define	NFB$C_ESI_SB3	0X7020044
# define	NFB$C_ESI_SNK	0X7010010
# define	NFB$C_ESI_SP1	0X7010012
# define	NFB$C_ESI_STA	0X7010011
# define	NFB$C_FC_CLEAR	0X24		/* Clear field values	   */
# define	NFB$C_FC_DELETE	0X21		/* Delete an entry from db */
# define	NFB$C_FC_LOOP	0X26		/* (PSI) loop x.25 lines   */
# define	NFB$C_FC_MAX	0X26
# define	NFB$C_FC_SET	0X23		/* Set/modify field values */
# define	NFB$C_FC_SHOW	0X22		/* Return specified info   */
# define	NFB$C_FC_ZERCOU	0X25		/* Zero counters	   */
# define	NFB$C_LENGTH	0X10
# define	NFB$C_LLI_CNT	0X8010018
# define	NFB$C_LLI_COL	0X8020040
# define	NFB$C_LLI_DLY	0X8010010
# define	NFB$C_LLI_IPID	0X8010016
# define	NFB$C_LLI_LCK	0X8000001
# define	NFB$C_LLI_LLN	0X8010012
# define	NFB$C_LLI_PID	0X8010015
# define	NFB$C_LLI_PNA	0X8010014
# define	NFB$C_LLI_PNN	0X8020043
# define	NFB$C_LLI_PRC	0X8020042
# define	NFB$C_LLI_RID	0X8020044
# define	NFB$C_LLI_RLN	0X8010013
# define	NFB$C_LLI_STA	0X8010011
# define	NFB$C_LLI_USR	0X8020041
# define	NFB$C_LLI_XWB	0X8010017
# define	NFB$C_LNI_ACL	0X1010011
# define	NFB$C_LNI_ADD	0X1010010
# define	NFB$C_LNI_ALI	0X1010033
# define	NFB$C_LNI_AMC	0X1010030
# define	NFB$C_LNI_AMH	0X1010031
# define	NFB$C_LNI_BRT	0X101002C
# define	NFB$C_LNI_BUS	0X1010024
# define	NFB$C_LNI_CNT	0X1020042
# define	NFB$C_LNI_COL	0X1020040
# define	NFB$C_LNI_DAC	0X1010028
# define	NFB$C_LNI_DFA	0X1010016
# define	NFB$C_LNI_DPX	0X1010029
# define	NFB$C_LNI_DWE	0X1010017
# define	NFB$C_LNI_ETY	0X101001A
# define	NFB$C_LNI_IAT	0X1010018
# define	NFB$C_LNI_IDE	0X1020043
# define	NFB$C_LNI_ITI	0X1010012
# define	NFB$C_LNI_LCK	0X1000001
# define	NFB$C_LNI_LPC	0X1010025
# define	NFB$C_LNI_LPD	0X1010027
# define	NFB$C_LNI_LPH	0X101002B
# define	NFB$C_LNI_LPL	0X1010026
# define	NFB$C_LNI_MAD	0X101001E
# define	NFB$C_LNI_MAR	0X101002D
# define	NFB$C_LNI_MBE	0X101002E
# define	NFB$C_LNI_MBR	0X101002F
# define	NFB$C_LNI_MBU	0X1010023
# define	NFB$C_LNI_MCO	0X1010020
# define	NFB$C_LNI_MHO	0X1010021
# define	NFB$C_LNI_MLK	0X1010015
# define	NFB$C_LNI_MLN	0X101001F
# define	NFB$C_LNI_MVE	0X1020044
# define	NFB$C_LNI_MVI	0X1010022
# define	NFB$C_LNI_NAM	0X1020041
# define	NFB$C_LNI_NVE	0X1020045
# define	NFB$C_LNI_OTI	0X1010013
# define	NFB$C_LNI_PHA	0X1020047
# define	NFB$C_LNI_PIQ	0X101002A
# define	NFB$C_LNI_RFA	0X1010019
# define	NFB$C_LNI_RSI	0X101001C
# define	NFB$C_LNI_RTI	0X101001B
# define	NFB$C_LNI_RVE	0X1020046
# define	NFB$C_LNI_SAD	0X101001D
# define	NFB$C_LNI_SBS	0X1010032
# define	NFB$C_LNI_STA	0X1010014
# define	NFB$C_LNI_SUP	0X1000002
# define	NFB$C_LOGEVENT	0X1C
/*
 * Node information that can be gotten.
 */
# define	NFB$C_NDI_ACC	0X2010020 /* L: Access switch		*/
# define	NFB$C_NDI_ACL	0X2010014 /* L: Active links		*/
# define	NFB$C_NDI_ADD	0X2010012 /* L: address			*/
# define	NFB$C_NDI_CNT	0X2020042 /* S: Counters		*/
# define	NFB$C_NDI_COL	0X2020040 /* S: Collating fields	*/
# define	NFB$C_NDI_CPU	0X201001A /* L: CPU type		*/
# define	NFB$C_NDI_CTA	0X2010011 /* L: Due time for counters	*/
# define	NFB$C_NDI_CTI	0X2010013 /* L: Counter timer		*/
# define	NFB$C_NDI_DAD	0X201001C /* L: Dump address		*/
# define	NFB$C_NDI_DCO	0X2010017 /* L: Destination cost	*/
# define	NFB$C_NDI_DCT	0X201001D /* L: Dump count		*/
# define	NFB$C_NDI_DEL	0X2010015 /* L: Delay			*/
# define	NFB$C_NDI_DFL	0X2020056 /* S: Diagnostic load file	*/
# define	NFB$C_NDI_DHO	0X2010018 /* L: Destination hops	*/
# define	NFB$C_NDI_DLI	0X202004D /* S: Destination line	*/
# define	NFB$C_NDI_DTY	0X2010016 /* L: Destination type	*/
# define	NFB$C_NDI_DUM	0X202004A /* S: Dump file		*/
# define	NFB$C_NDI_HAC	0X2020041 /* S: Node addr/loopline	*/
# define	NFB$C_NDI_HWA	0X2020057 /* S: Hardware NI addr	*/
# define	NFB$C_NDI_IHO	0X201001F /* L: Host			*/
# define	NFB$C_NDI_LCK	0X2000001 /* B: Parameters are locked	*/
# define	NFB$C_NDI_LOA	0X2020046 /* S: Load file		*/
# define	NFB$C_NDI_LOO	0X2000002 /* B: Loopback node		*/
# define	NFB$C_NDI_LPA	0X2020058 /* S: Loop assist NI addr	*/
# define	NFB$C_NDI_NAC	0X2020052 /* S: Nonpriv user account	*/
# define	NFB$C_NDI_NLI	0X202004C /* S: Loopback line		*/
# define	NFB$C_NDI_NNA	0X2020043 /* S: Node name		*/
# define	NFB$C_NDI_NND	0X2010022 /* L: Next node address	*/
# define	NFB$C_NDI_NNN	0X2020059 /* S: Next node name		*/
# define	NFB$C_NDI_NPW	0X2020053 /* S: Nonpriv password	*/
# define	NFB$C_NDI_NUS	0X2020051 /* S: Nonpriv user id		*/
# define	NFB$C_NDI_OHO	0X201001E /* L: Host			*/
# define	NFB$C_NDI_PAC	0X202004F /* S: Priveleged account	*/
# define	NFB$C_NDI_PPW	0X2020050 /* S: Priveleged password	*/
# define	NFB$C_NDI_PRX	0X2010021 /* L: Proxy parameter		*/
# define	NFB$C_NDI_PUS	0X202004E /* S: Priveleged user ID	*/
# define	NFB$C_NDI_REA	0X2000003 /* B: Node is reachable	*/
# define	NFB$C_NDI_RPA	0X2020054 /* S: Receive password	*/
# define	NFB$C_NDI_SDU	0X202004B /* S: Secondary dumper	*/
# define	NFB$C_NDI_SDV	0X2010019 /* L: Service device		*/
# define	NFB$C_NDI_SID	0X2020049 /* S: Software ID		*/
# define	NFB$C_NDI_SLI	0X2020044 /* S: Service line		*/
# define	NFB$C_NDI_SLO	0X2020047 /* S: Secondary loader	*/
# define	NFB$C_NDI_SNV	0X2010023 /* L: Service node version	*/
# define	NFB$C_NDI_SPA	0X2020045 /* S: Service password	*/
# define	NFB$C_NDI_STY	0X201001B /* L: Software type		*/
# define	NFB$C_NDI_TAD	0X2010010 /* L: Local node address	*/
# define	NFB$C_NDI_TLO	0X2020048 /* S: Tertiary loader		*/
# define	NFB$C_NDI_TPA	0X2020055 /* S: Transmit password	*/
# define	NFB$C_OBI_ACC	0X3020047
# define	NFB$C_OBI_CHN	0X3010013
# define	NFB$C_OBI_COL	0X3020040
# define	NFB$C_OBI_FID	0X3020045
# define	NFB$C_OBI_HPR	0X3010011
# define	NFB$C_OBI_IAC	0X3020043
# define	NFB$C_OBI_LCK	0X3000001
# define	NFB$C_OBI_LPR	0X3010010
# define	NFB$C_OBI_NAM	0X3020044
# define	NFB$C_OBI_NUM	0X3010014
# define	NFB$C_OBI_PID	0X3010015
# define	NFB$C_OBI_PRX	0X3010016
# define	NFB$C_OBI_PSW	0X3020048
# define	NFB$C_OBI_SET	0X3000002
# define	NFB$C_OBI_SFI	0X3020042
# define	NFB$C_OBI_UCB	0X3010012
# define	NFB$C_OBI_USR	0X3020046
# define	NFB$C_OBI_ZNA	0X3020041
/*
 * Comparison operation codes.
 */
# define	NFB$C_OP_EQL	0X0		/* Equal to		*/
# define	NFB$C_OP_FNDMAX	0X5		/* */
# define	NFB$C_OP_FNDMIN	0X4
# define	NFB$C_OP_FNDPOS	0X6
# define	NFB$C_OP_GTRU	0X1		/* Greater than, unsigned */
# define	NFB$C_OP_LSSU	0X2		/* Less than, unsigned	*/
# define	NFB$C_OP_MAXFCT	0X3
# define	NFB$C_OP_MAXINT	0X6
# define	NFB$C_OP_NEQ	0X3		/* Not equal		*/

# define	NFB$C_PLI_BFN	0X501001E
# define	NFB$C_PLI_BFS	0X5010027
# define	NFB$C_PLI_BUS	0X501001F
# define	NFB$C_PLI_CHR	0X5020043
# define	NFB$C_PLI_CLO	0X5000005
# define	NFB$C_PLI_CNT	0X5020044
# define	NFB$C_PLI_COL	0X5020040
# define	NFB$C_PLI_CON	0X5000004
# define	NFB$C_PLI_CTA	0X5010010
# define	NFB$C_PLI_DDT	0X501001B
# define	NFB$C_PLI_DEVNAM	0X5020047
# define	NFB$C_PLI_DLT	0X501001C
# define	NFB$C_PLI_DUP	0X5000003
# define	NFB$C_PLI_EPT	0X5010026
# define	NFB$C_PLI_HTI	0X5010016
# define	NFB$C_PLI_HWA	0X5020046
# define	NFB$C_PLI_LCK	0X5000001
# define	NFB$C_PLI_LCT	0X5010013
# define	NFB$C_PLI_LPC	0X5010023
# define	NFB$C_PLI_LPD	0X5010025
# define	NFB$C_PLI_LPL	0X5010024
# define	NFB$C_PLI_MBL	0X5010017
# define	NFB$C_PLI_MCD	0X5020045
# define	NFB$C_PLI_MOD	0X5010022
# define	NFB$C_PLI_MRT	0X5010018
# define	NFB$C_PLI_MWI	0X5010019
# define	NFB$C_PLI_NAM	0X5020041
# define	NFB$C_PLI_PLVEC	0X5010020
# define	NFB$C_PLI_PRO	0X5010014
# define	NFB$C_PLI_RTT	0X5010021
# define	NFB$C_PLI_SER	0X5000002
# define	NFB$C_PLI_SLT	0X501001A
# define	NFB$C_PLI_SRT	0X501001D
# define	NFB$C_PLI_STA	0X5010011
# define	NFB$C_PLI_STI	0X5010015
# define	NFB$C_PLI_SUB	0X5010012
# define	NFB$C_PLI_VMSNAM	0X5020042
# define	NFB$C_READEVENT	0X1D
# define	NFB$C_SDI_CIR	0X1A020041
# define	NFB$C_SDI_COL	0X1A020040
# define	NFB$C_SDI_LCK	0X1A000001
# define	NFB$C_SDI_PHA	0X1A020042
# define	NFB$C_SDI_PID	0X1A010011
# define	NFB$C_SDI_PRC	0X1A020043
# define	NFB$C_SDI_SUB	0X1A010010
# define	NFB$C_SPI_ACS	0X12020041
# define	NFB$C_SPI_CHN	0X12010012
# define	NFB$C_SPI_COL	0X12020040
# define	NFB$C_SPI_IRP	0X12010011
# define	NFB$C_SPI_LCK	0X12000001
# define	NFB$C_SPI_NCB	0X12020044
# define	NFB$C_SPI_PID	0X12010010
# define	NFB$C_SPI_PNM	0X12020045
# define	NFB$C_SPI_PRL	0X12000002
# define	NFB$C_SPI_RID	0X12020042
# define	NFB$C_SPI_RNA	0X12010013
# define	NFB$C_SPI_SFI	0X12020043
# define	NFB$C_TYP_BIT	0X0
# define	NFB$C_TYP_L	0X1
# define	NFB$C_TYP_LNG	0X1
# define	NFB$C_TYP_S	0X2
# define	NFB$C_TYP_STR	0X2
# define	NFB$C_TYP_V	0X0
# define	NFB$C_WILDCARD	0X1
# define	NFB$C_XAI_ACC	0X1B020044
# define	NFB$C_XAI_COL	0X1B020040
# define	NFB$C_XAI_LCK	0X1B000001
# define	NFB$C_XAI_NDA	0X1B010010
# define	NFB$C_XAI_NET	0X1B020041
# define	NFB$C_XAI_NOD	0X1B020045
# define	NFB$C_XAI_PSW	0X1B020043
# define	NFB$C_XAI_USR	0X1B020042
# define	NFB$C_XD5_ACC	0XD02004A
# define	NFB$C_XD5_CMK	0XD020042
# define	NFB$C_XD5_COL	0XD020040
# define	NFB$C_XD5_CVL	0XD020043
# define	NFB$C_XD5_DST	0XD020041
# define	NFB$C_XD5_FIL	0XD020047
# define	NFB$C_XD5_GRP	0XD020044
# define	NFB$C_XD5_LCK	0XD000001
# define	NFB$C_XD5_NOD	0XD010012
# define	NFB$C_XD5_NUM	0XD020045
# define	NFB$C_XD5_OBJ	0XD020046
# define	NFB$C_XD5_PRI	0XD010010
# define	NFB$C_XD5_PSW	0XD020049
# define	NFB$C_XD5_SAD	0XD010011
# define	NFB$C_XD5_USR	0XD020048
# define	NFB$C_XD9_ACC	0XF02004A
# define	NFB$C_XD9_CMK	0XF020042
# define	NFB$C_XD9_COL	0XF020040
# define	NFB$C_XD9_CVL	0XF020043
# define	NFB$C_XD9_DST	0XF020041
# define	NFB$C_XD9_FIL	0XF020047
# define	NFB$C_XD9_GRP	0XF020044
# define	NFB$C_XD9_LCK	0XF000001
# define	NFB$C_XD9_NOD	0XF010012
# define	NFB$C_XD9_NUM	0XF020045
# define	NFB$C_XD9_OBJ	0XF020046
# define	NFB$C_XD9_PRI	0XF010010
# define	NFB$C_XD9_PSW	0XF020049
# define	NFB$C_XD9_SAD	0XF010011
# define	NFB$C_XD9_USR	0XF020048
# define	NFB$C_XDI_ACH	0XB010010
# define	NFB$C_XDI_ASW	0XB010011
# define	NFB$C_XDI_CHN	0XB020042
# define	NFB$C_XDI_CNT	0XB020045
# define	NFB$C_XDI_COL	0XB020040
# define	NFB$C_XDI_CTM	0XB010012
# define	NFB$C_XDI_DTE	0XB020041
# define	NFB$C_XDI_LCK	0XB000001
# define	NFB$C_XDI_LIN	0XB020043
# define	NFB$C_XDI_MCH	0XB010013
# define	NFB$C_XDI_MCI	0XB010016
# define	NFB$C_XDI_NET	0XB020044
# define	NFB$C_XDI_STA	0XB010014
# define	NFB$C_XDI_SUB	0XB010015
# define	NFB$C_XGI_COL	0XA020040
# define	NFB$C_XGI_GDT	0XA020042
# define	NFB$C_XGI_GNM	0XA010010
# define	NFB$C_XGI_GRP	0XA020041
# define	NFB$C_XGI_GTY	0XA010011
# define	NFB$C_XGI_LCK	0XA000001
# define	NFB$C_XNI_CAT	0X9010010
# define	NFB$C_XNI_CLT	0X9010011
# define	NFB$C_XNI_COL	0X9020040
# define	NFB$C_XNI_DBL	0X9010012
# define	NFB$C_XNI_DWI	0X9010013
# define	NFB$C_XNI_LCK	0X9000001
# define	NFB$C_XNI_MBL	0X9010014
# define	NFB$C_XNI_MCL	0X9010015
# define	NFB$C_XNI_MNS	0X9000002
# define	NFB$C_XNI_MRS	0X9010016
# define	NFB$C_XNI_MST	0X9010017
# define	NFB$C_XNI_MWI	0X9010018
# define	NFB$C_XNI_NET	0X9020041
# define	NFB$C_XNI_RST	0X9010019
# define	NFB$C_XNI_STT	0X901001A
# define	NFB$C_XS5_ACI	0XC010012
# define	NFB$C_XS5_CNT	0XC020041
# define	NFB$C_XS5_COL	0XC020040
# define	NFB$C_XS5_CTM	0XC010013
# define	NFB$C_XS5_LCK	0XC000001
# define	NFB$C_XS5_MCI	0XC010010
# define	NFB$C_XS5_STA	0XC010011
# define	NFB$C_XS9_ACI	0XE010012
# define	NFB$C_XS9_CNT	0XE020041
# define	NFB$C_XS9_COL	0XE020040
# define	NFB$C_XS9_CTM	0XE010013
# define	NFB$C_XS9_LCK	0XE000001
# define	NFB$C_XS9_MCI	0XE010010
# define	NFB$C_XS9_STA	0XE010011
# define	NFB$C_XTI_BFZ	0X10010011
# define	NFB$C_XTI_COL	0X10020040
# define	NFB$C_XTI_CPL	0X10010012
# define	NFB$C_XTI_FNM	0X10020041
# define	NFB$C_XTI_LCK	0X10000001
# define	NFB$C_XTI_MBF	0X10010014
# define	NFB$C_XTI_MBK	0X10010013
# define	NFB$C_XTI_MVR	0X10010015
# define	NFB$C_XTI_STA	0X10010010
# define	NFB$C_XTT_COL	0X11020040
# define	NFB$C_XTT_CPS	0X11010011
# define	NFB$C_XTT_LCK	0X11000001
# define	NFB$C_XTT_TPT	0X11020041
# define	NFB$C_XTT_TST	0X11010010
# define	NFB$K_LENGTH	0X10
# define	NFB$L_BIT_VALUE	0X0
# define	NFB$L_FLDID	0X10
# define	NFB$L_LNG_VALUE	0X0
# define	NFB$L_PARAM_ID	0X0
# define	NFB$L_SRCH2_KEY	0X8
# define	NFB$L_SRCH_KEY	0X4
# define	NFB$M_DB	0XFF000000
# define	NFB$M_ERRUPD	0X1
# define	NFB$M_INX	0XFFFF
# define	NFB$M_MULT	0X2
# define	NFB$M_NOCTX	0X4
# define	NFB$M_SPARE	0XFC0000
# define	NFB$M_TYP	0X30000
# define	NFB$S_DB	0X8
# define	NFB$S_INX	0X10
# define	NFB$S_SPARE	0X6
# define	NFB$S_TYP	0X2
# define	NFB$V_DB	0X18
# define	NFB$V_ERRUPD	0X0
# define	NFB$V_INX	0X0
# define	NFB$V_MULT	0X1
# define	NFB$V_NOCTX	0X2
# define	NFB$V_SPARE	0X12
# define	NFB$V_TYP	0X10
# define	NFB$W_CELL_SIZE	0XE
# define	NFB$W_STR_COUNT	0X0
# define	NFB$_ERR_CELL	0X9
# define	NFB$_ERR_DB	0X2
# define	NFB$_ERR_FCT	0X1
# define	NFB$_ERR_FLAGS	0XE
# define	NFB$_ERR_OPER	0XA
# define	NFB$_ERR_OPER2	0XD
# define	NFB$_ERR_P1	0X3
# define	NFB$_ERR_P2	0X4
# define	NFB$_ERR_P3	0X5
# define	NFB$_ERR_P4	0X6
# define	NFB$_ERR_P5	0X7
# define	NFB$_ERR_P6	0X8
# define	NFB$_ERR_SRCH	0XB
# define	NFB$_ERR_SRCH2	0XC

/*
 * The NFB definition.
 */
# define NFB_RQST 40
struct nfb
{
	unsigned char nfb$b_fct;
	unsigned char nfb$b_flags;
	unsigned char nfb$b_database;
	unsigned char nfb$b_oper;
	unsigned long nfb$l_srch_key;
	unsigned long nfb$l_srch2_key;
	unsigned char nfb$b_oper2;
	unsigned char nfb$b_mbz1;
	unsigned short int nfb$w_cell_size;
	unsigned long int nfb$l_fldid[NFB_RQST];
};

/*
 * The match key structure.
 */
struct nfbkey
{
	unsigned int p4_count;
	unsigned int srch;
	unsigned int srch2;
	unsigned short start;
	unsigned char ctx[NFB$C_CTX_SIZE];
};
-- 
Jonathan Corbet
{seismo | hplabs | gatech}!hao!gaia!jon
{ucbvax | allegra | cbosgd}!nbires!gaia!jon