home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
lan
/
nbtest.arj
/
NBTEST.H
< prev
next >
Wrap
Text File
|
1992-03-26
|
7KB
|
131 lines
/* C include file for NetBios applications */
/****************************************************************************
* CONSTANTS *
****************************************************************************/
/* Values for ncb_command */
#define N_RESET 0x32 /* RESET LOCAL ATTACHMENT */
#define N_STATUS 0x33 /* RECEIVE STATUS OF SESSIONS */
#define N_CANCEL 0x35 /* CANCEL INDICATED REQUEST */
#define N_ADDNAME 0x30 /* ADD UNIQUE NAME */
#define N_ADDGROUPNAME 0x36 /* ADD NON UNIQUE NAME */
#define N_DELETENAME 0x31 /* DELETE NAME */
#define N_CALL 0x10 /* OPEN A SESSION */
#define N_LISTEN 0x11 /* LISTEN FOR A CALL */
#define N_HANGUP 0x12 /* END A SESSION */
#define N_SEND 0x14 /* SEND */
#define N_SENDMULTIPLE 0x17 /* SEND */
#define N_RECEIVE 0x15 /* RECEIVE */
#define N_RECEIVEANY 0x16 /* RECEIVE FROM ANY */
#define N_SESSIONSTATUS 0x34 /* SESSION STATUS */
#define N_SENDDATAGRAM 0x20 /* SEND A DATAGRAM */
#define N_RECEIVEDATAGRAM 0x21 /* RECEIVE A DATAGRAM */
#define N_SENDBROADCAST 0x22 /* SEND A BROADCAST DATAGRAM */
#define N_RECEIVEBROADCAST 0x23 /* RECEIVE A BROADCAST DATAGRAM */
#define N_NOWAIT 0x80 /* NO-WAIT FLAG */
/* Values for ncb_retcode */
#define E_GOOD_RET 0x00 /* GOOD RETURN */
#define E_BAD_BUFLEN 0x01 /* ILLEGAL BUFFER LENGTH */
#define E_BAD_CMD 0x03 /* ILLEGAL COMMAND */
#define E_TIME_OUT 0x05 /* COMMAND TIMED OUT */
#define E_BUF_FULL 0x06 /* MESSAGE INCOMPLETE (NOT ERR */
#define E_SESNUM_ERR 0x08 /* SESSION NUMBER OUT OF RANGE */
#define E_NO_RESOURCE 0x09 /* NO RESOURCE AVAILABLE */
#define E_SES_CLOSE 0x0A /* SESSION CLOSED */
#define E_CMD_ABORT 0x0B /* COMMAND CANCELLED */
#define E_DUP_NAME 0x0D /* DUPLICATE NAME */
#define E_TBL_FULL 0x0E /* NAME TABLE FULL */
#define E_NO_DEL 0x0F /* NAME HAS ACTIVE SESSION */
#define E_SESTBL_FUL 0x11 /* LOCAL SESSION TABLE FULL */
#define E_ALNUM_ERR 0x13 /* ILLEGAL NAMES NUMBER */
#define E_NOFND_CALLNAME 0x14 /* COULDN'T FIND CALLED NAME */
#define E_BAD_NAME 0x15 /* CAN'T PUT * IN NCB_NAME */
#define E_NAME_USED 0x16 /* NAME IN USE */
#define E_EQL_NAMES 0x17 /* NAME DELETED */
#define E_SES_BAD 0x18 /* SESSION ENDED ABNORMALLY */
#define E_MUL_NAME 0x19 /* NAME CONFLICT DETECTED */
#define E_INCOM_REM 0x1A /* INCOMPATIBLE REMOTE DEVICE */
#define E_LANA_LOCKED 0x21 /* INTERFACE BUSY */
#define E_MAX_CMD 0x22 /* TOO MANY COMMANDS */
#define E_LANA_NUM 0x23 /* INVALID LANA_NUM VALUE */
#define E_CMD_CNL 0x24 /* COMMAND CMPLTD WHILE CANCEL */
#define E_NO_CNL 0x26 /* COMMAND NO VALID TO CANCEL */
#define E_YS_ERR 0x40 /* SYSTEM ERROR */
#define E_CON_CARRIER_NOT_ME 0x41 /* CONTINUOUS CARRIER (I did) */
#define E_CON_CARRIER_ME 0x42 /* CONTINUOUS CARRIER (I didn't)*/
#define E_NO_CARRIER 0x43 /* NO CARRIER DETECTED */
/****************************************************************************
* TYPE DEFINITIONS *
****************************************************************************/
/* define BYTE/WORD/DWORD as unsigned char/int/long */
typedef unsigned char BYTE;
typedef unsigned int WORD;
typedef unsigned long DWORD;
/* NCB structure */
typedef struct ncb_tag
{
BYTE ncb_command; /* ncb COMMAND FIELD */
BYTE ncb_retcode; /* ncb RETURN CODE */
BYTE ncb_lsn; /* ncb LOCAL SESSION NUMBER */
BYTE ncb_num; /* ncb ALIAS NUMBER */
BYTE _far * ncb_buffer; /* ncb MESSAGE BUFFER */
WORD ncb_length; /* ncb LENGTH (IN BYTES) */
BYTE ncb_callname[16]; /* ncb NAME ON REMOTE ATTACHMENT */
BYTE ncb_name[16]; /* ncb ALIAS NAME */
BYTE ncb_rto; /* ncb RECEIVE TIMEOUT */
BYTE ncb_sto; /* ncb SEND TIMEOUT */
void (_interrupt _far *ncb_post)();
/* ncb POINTER TO POST ROUTINE */
BYTE ncb_lana_num; /* ncb ADAPTER NR (0 or 1) */
BYTE ncb_cmd_cplt; /* ncb COMMAND PENDING INDICATION */
BYTE ncb_reserved[14]; /* ncb RESERVED AREA */
} NCB;
/* name table entry */
typedef struct name_entry_tag
{
BYTE name[16]; /* name */
BYTE name_nr; /* # name */
BYTE name_stat; /* name status */
} NAME_ENTRY;
/* adapter status structure */
typedef struct adapter_stat
{
BYTE stat_uin[6]; /* unit identification number */
BYTE stat_jumper; /* external jumper */
BYTE stat_selftest; /* results of last self-test */
BYTE stat_version[2]; /* software version high/low */
WORD stat_period; /* duration of reporting period in minutes */
WORD stat_crc; /* # CRC errors */
WORD stat_align; /* # alignment errors */
WORD stat_collision; /* # collisions */
WORD stat_abort; /* # aborted transmissions */
DWORD stat_txpacket; /* # ok transmitted packets */
DWORD stat_rxpacket; /* # ok received packets */
WORD stat_retx; /* # retransmissions */
WORD stat_rxexhaust; /* # receive exhausted */
BYTE stat_rsv1[8];
WORD stat_freencb; /* # free command buffers */
WORD stat_cfgncb; /* max # NCB's */
WORD stat_maxncb; /* max # command buffers */
BYTE stat_rsv2[4];
WORD stat_pendsess; /* # pending sessions */
WORD stat_cfgsess; /* max pending sessions */
WORD stat_maxsess; /* max # sessions */
WORD stat_psize; /* maximum packet size */
WORD stat_nrnames; /* # names in local name table */
NAME_ENTRY
stat_localname[16]; /* local name table */
} ADAPTER_STATUS;