home *** CD-ROM | disk | FTP | other *** search
- /*
- * netbios version of c-tree
- * netbios functions common to server and application interface
- *
- * This program is the CONFIDENTIAL and PROPRIETARY property
- * of FairCom(R) Corporation. Any unauthorized use, reproduction or
- * transfer of this program is strictly prohibited.
- *
- * Copyright (c) 1987, 1988, 1989 FairCom Corporation
- * (Subject to limited distribution and
- * restricted disclosure only.)
- * *** ALL RIGHTS RESERVED ***
- *
- * 4006 West Broadway
- * Columbia, MO 65203
- *
- *
- * c-tree(R) Version 4.3
- * Release C
- * February 7, 1989 17:30
- *
- */
-
- /*
- * notes: names passed to these functions should be 16 chars long
- * (except for the special name "*").
- *
- * do_nb() is called to actually do the int 5c. it is implemented
- * differently for server (in ctstsr) and application (ctamsg).
- */
-
- #include "ctstdr.h"
- #include "ctnbio.h"
-
- extern UCOUNT far do_nb(NCB far *);
-
- /*
- * installed check
- */
-
- /* returns 0 if installed */
-
- UCOUNT nb_install_check()
- {
- NCB ncb;
- ULONG far * bp;
-
- memset(&ncb,0,sizeof(NCB));
- ncb.cmd = 0xff;
-
- bp = (ULONG far *) (0x5c * 4);
- if (!*bp || NERRbadcmd != do_nb((NCB far *)&ncb))
- return -1;
- else
- return 0;
- }
-
-
- /*
- * adapter status
- */
-
- UCOUNT nb_adapter_stat(ncb, nowait, anr, name, buf, buflen)
- NCB *ncb;
- UTEXT nowait, *name;
- UCOUNT (far *anr)();
- NB_ASTS *buf;
- UCOUNT buflen;
-
- {
- /* name may be a "*" or NULL to get local stat */
- if (!name || *name == '*')
- ncb->rname[0] = '*';
- else
- cpybuf(ncb->rname, name, 16);
- ncb->bufptr = (UTEXT far *) buf;
- ncb->buflen = buflen;
- ncb->anr = anr;
- ncb->cmd = NCBastatus | nowait;
- return(do_nb((NCB far *)ncb));
- }
-
- /*
- * add name
- */
-
- UCOUNT nb_addname(ncb, nowait, anr, name)
- NCB *ncb;
- UTEXT nowait, *name;
- UCOUNT (far *anr)();
- {
- cpybuf(ncb->lname, name, 16);
- ncb->anr = anr;
- ncb->cmd = NCBaddname | nowait;
- return(do_nb((NCB far *)ncb));
- }
-
- /*
- * delete name
- */
-
- UCOUNT nb_delname(ncb, nowait, anr, name)
- NCB *ncb;
- UTEXT nowait, *name;
- UCOUNT (far *anr)();
- {
- cpybuf(ncb->lname, name, 16);
- ncb->anr = anr;
- ncb->cmd = NCBdelname | nowait;
- return(do_nb((NCB far *)ncb));
- }
-
- /*
- * listen
- */
-
- UCOUNT nb_listen(ncb, nowait, anr, name, rname, rto, sto)
- NCB *ncb;
- UTEXT nowait, *name, *rname, rto, sto;
- UCOUNT (far *anr)();
- {
- cpybuf(ncb->lname, name, 16);
- /* rname may be a "*" or NULL to listen for anybody */
- if (!rname || *rname == '*')
- ncb->rname[0] = '*';
- else
- cpybuf(ncb->rname, rname, 16);
- ncb->rto = rto;
- ncb->sto = sto;
- ncb->anr = anr;
- ncb->cmd = NCBlisten | nowait;
- return(do_nb((NCB far *)ncb));
- }
-
- /*
- * call
- */
-
- UCOUNT nb_call(ncb, nowait, anr, to, fr, rto, sto)
- NCB *ncb;
- UTEXT nowait, *to, *fr, rto, sto;
- UCOUNT (far *anr)();
- {
- cpybuf(ncb->lname, fr, 16);
- cpybuf(ncb->rname, to, 16);
- ncb->rto = rto;
- ncb->sto = sto;
- ncb->anr = anr;
- ncb->cmd = NCBcall | nowait;
- return(do_nb((NCB far *)ncb));
- }
-
-
- /*
- * send
- */
-
- UCOUNT nb_send(ncb, nowait, anr, lsn, msg, msglen)
- NCB *ncb;
- UTEXT nowait, lsn, *msg;
- UCOUNT (far *anr)(), msglen;
- {
- ncb->lsn = lsn;
- ncb->bufptr = (UTEXT far *) msg;
- ncb->buflen = msglen;
- ncb->anr = anr;
- ncb->cmd = NCBsend | nowait;
- return(do_nb((NCB far *)ncb));
- }
-
-
- /*
- * receive
- */
-
- UCOUNT nb_recv(ncb, nowait, anr, lsn, msg, maxlen)
- NCB *ncb;
- UTEXT nowait, lsn, *msg;
- UCOUNT (far *anr)(), maxlen;
- {
- ncb->lsn = lsn;
- ncb->bufptr = (UTEXT far *) msg;
- ncb->buflen = maxlen;
- ncb->anr = anr;
- ncb->cmd = NCBreceive | nowait;
- return(do_nb((NCB far *)ncb));
- }
-
- /*
- * receive any
- */
-
- UCOUNT nb_recvany(ncb, nowait, anr, namenum, msg, maxlen)
- NCB *ncb;
- UTEXT nowait, namenum, *msg;
- UCOUNT (far *anr)(), maxlen;
- {
- ncb->namenum = namenum;
- ncb->bufptr = (UTEXT far *) msg;
- ncb->buflen = maxlen;
- ncb->anr = anr;
- ncb->cmd = NCBrecvany | nowait;
- return(do_nb((NCB far *)ncb));
- }
-
- /*
- * hangup
- */
-
- UCOUNT nb_hangup(ncb, nowait, anr, lsn)
- NCB *ncb;
- UTEXT nowait, lsn;
- UCOUNT (far *anr)();
- {
- ncb->lsn = lsn;
- ncb->anr = anr;
- ncb->cmd = NCBhangup | nowait;
- return(do_nb((NCB far *)ncb));
- }
-
- /*
- * cancel
- */
-
- UCOUNT nb_cancel(ncb, tgtncb)
- NCB *ncb, *tgtncb;
- {
- ncb->bufptr = (UTEXT far *) tgtncb;
- ncb->cmd = NCBcancel;
- return(do_nb((NCB far *)ncb));
- }
-