Metropoli BBS
VIEWER: diag.h MODE: TEXT (ASCII)
/* diag.h :  ipx/spx diagnostics  header file  */



/*
    Copyright (C) 1992 Indian Institute of Technology, Bombay
    Written by V. Srinivas and Vishwas Joglekar,
    Dept of Computer Science and Engineering.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 1, or (at your option)
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/



#define MAX_NODE_INFO	100
#define MAX_DIAG_NETWORKS  50


#define MAX_SPX_PKT_SIZE    		512

/* diagnostic request types  */
#define	RETURN_IPX_SPX_VERSION	   	0
#define RETURN_IPX_STATISTICS      	1
#define RETURN_SPX_STATISTICS      	2
#define RETURN_CONN_ID_TABLE	   	3
#define RETURN_SERVER_NAME_TABLE   	4
#define RETURN_PRIMARY_SERVER_INFO      5
#define RETURN_SHELL_VERSION	   	6

#define RETURN_SHELL_DRIVER_CONFIG 	0
#define RETURN_SHELL_DRIVER_DIAG_STAT	1



/* shell/router/server components	*/
#define IPX__SPX	  0
#define BRIDGE_DRIVER	  1
#define SHELL_DRIVER	  2
#define NWSHELL		  3
#define VAP_SHELL	  4
#define EXTERNAL_ROUTER   5
#define INTERNAL_ROUTER   6
#define NON_DEDICATED_FS  7
#define STAR_68000	  8

/***************                              */
#define DIAG_TX_INTERVAL  20
#define DIAG_RETRIES    5
/* status of nodes  */
#define INACTIVE 0
#define ACTIVE   1
#define UNKNOWN  2

/* for diagnostic component types  */
#define  DIAG_ROUTER       1
#define  DIAG_NODE         2
#define  DIAG_FILE_SERVER  3


/* IPX/SPX Configuration request packet  */
typedef struct{
IPX_HEADER header;
BYTE exclusion_addr_cnt;
BYTE exclusion_addr[80][6];
}CONFIG_REQ_PKT;

/* IPX/SPX Configuration response packet */
typedef struct{
IPX_HEADER header;
BYTE major_version; /* major version of the diagnostics */
BYTE minor_version; /* minor version of the diagnostics */
BYTE SPX_Diagnostic_sock[2];
BYTE component_cnt;   /* number of components in the packet */
BYTE components[9];
}CONFIG_RESP_PKT;

 /* SPX header		*/
 typedef struct{
	IPX_HEADER header;
	BYTE conn_control;
	BYTE data_stream_type;
	BYTE src_conn_id[2];
	BYTE des_conn_id[2];
	BYTE seq_no[2];
	BYTE ack_no[2];
	BYTE alloc_no[2];   /* Credit    */
 }SPX_HEADER;



/* IPX/SPX version, response pkt */
typedef struct{
	SPX_HEADER	header;
	BYTE	completion_code; /* 0 successful, ffh failure */
	BYTE	interval_marker[4]; /* lo-hi , clock ticks */
	BYTE	ipx_ver[2];  /* major, minor */
	BYTE    spx_ver[2];  /* major, minor */
}IPX_SPX_VERSION;


/* diagnostic request pkt for ipx/spx component calls  */
typedef struct{
	SPX_HEADER header;
	BYTE component_pos;
	BYTE diag_req_type;
}DIAG_REQ_PKT;


 typedef struct{
	SPX_HEADER header;
	BYTE  data[MAX_SPX_PKT_SIZE];
 }SPX_PKT;

 /* shell driver diagnostics packet  */
 typedef struct{
	SPX_HEADER header;
	BYTE completion_code;
	BYTE interval_marker[4];
	BYTE reserved;
	BYTE statistics_ver[2];
	BYTE total_tx_pkts[4]; /* total pkts transmitted */
	BYTE total_rx_pkts[4]; /* total pkts  received */
	BYTE no_ecb_avail_cnt[2];
	BYTE pkt_tx_big_cnt[4]; /* pkt too big to be transmitted */
	BYTE pkt_tx_small_cnt[4];  /* pkt too small to be transmitted */
	BYTE pkt_rx_overflow_cnt[2]; /* pkt recv buffer overflow cnt */
	BYTE pkt_rx_big_cnt[2]; /* too big pkts received */
	BYTE pkt_rx_small_cnt[2]; /* too small pkts received */
	BYTE pkt_tx_err_cnt[2];   /* pkt transmission  error cnt */
	BYTE pkt_rx_err_cnt[2];  /* pkt recv error cnt */
	BYTE retry_tx_cnt[2];  /* no of retries during transmission */
	BYTE checksum_errs[2]; /* no of checksum errors */
	BYTE no_of_custom_vars[2];
	BYTE custom_vars[8];
	BYTE text[50];
}SHELL_DRIVER_DIAG_STAT_PKT;

/* server information */
typedef struct{
	BYTE server_used;
	BYTE order_no;
	BYTE net_id[4];
	BYTE node_id[6];
	BYTE sock[2];
	BYTE recv_timeout[2];
	BYTE router_id[6];
	BYTE seq_no;
	BYTE conn_id;
	BYTE conn_ok;
	BYTE max_timeout[2];
	BYTE reserved[5];
}SERVER_INFO;

/* connection information for all attached servers */
typedef struct{
	SPX_HEADER header;
	BYTE completion_code;
	BYTE interval_marker[4];
	SERVER_INFO server[8];
}CONN_ID_TABLE_PKT;

/* os version of the node */
typedef struct{
	SPX_HEADER	header;
	BYTE completion_code;
	BYTE interval_marker[4];
	BYTE machine_id;
	BYTE os_info[40];
}OS_VERSION_PKT;


/* primary server information pkt */
typedef struct{
	SPX_HEADER header;
	BYTE completion_code;
	BYTE interval_marker[4];
	BYTE server_pos_no; /* index into the server name table */
}PRIMARY_SERVER_INFO_PKT;

/* server name table   */
typedef struct{
	SPX_HEADER header;
	BYTE completion_code;
	BYTE interval_marker[4];
	BYTE server_name_tbl[8][48];
}SERVER_NAME_TBL_PKT;

/*  shell driver configuration packet     */
typedef struct{
	SPX_HEADER header;
	BYTE completion_code;
	BYTE interval_marker[4];
	BYTE reserved1[4];
	BYTE node_id[6];
	BYTE reserved2;
	BYTE nodeid_type;
	BYTE max_data_size[2];
	BYTE reserved3[2];
	BYTE lan_hw_id;
	BYTE transport_time[2];
	BYTE reserved4;
	BYTE ether_type[2]; /* ethernet type, blue book or 802.3 */
	BYTE major_ver;
	BYTE minor_ver;
	BYTE misc_flags;
	BYTE select_config;
	BYTE lan_desc[80];
	BYTE io_addr1[2];
	BYTE decode_range1[2];
	BYTE io_addr2[2];
	BYTE decode_range2[2];
	BYTE mem_addr1[3];
	BYTE mdecode_range1[2];
	BYTE mem_addr2[3];
	BYTE mdecode_range2[2];
	BYTE irq_use1;
	BYTE irq1;
	BYTE irq_use2;
	BYTE irq2;
	BYTE dma_use1;
	BYTE dma1;
	BYTE dma_use2;
	BYTE dma2;
	BYTE micro_channel_flags;
	BYTE reserved5;
	BYTE text_desc[80];
}SHELL_DRIVER_CONFIG_PKT;

/* node information  */
struct node_information{
WORD diag_pkts_recvd; /* no of diag configuration response pkts recvd */
WORD clock_ticks; /* if this is zero then the node is down  */
struct time down_time; /* time when the node went down */
WORD status; /* whether node is up or down      */
INTERNET_ADDRESS	node_addr;
BYTE    name[13];    /* name of the node   */
BYTE	interval_marker[2];
BYTE	spx_socket[2];
BYTE	ipx_spx_ver[2];
BYTE	component_cnt;
BYTE	components[9];
BYTE	diag_ver[2];
BYTE	statistics_ver[2];
struct node_information *next, *prev;
struct manage_info *man;
};

/* Network management information about a node */
struct manage_info{
BYTE	primary_server[48];
INTERNET_ADDRESS	serv_addr; /* primary server address */
BYTE	user_info[48];
BYTE	machine_id;
BYTE	conn_id;
BYTE	serv_timeout;
BYTE	seq_no;
BYTE	conn_ok;
BYTE	router_id;  /* intermediate rout_id */
/* Driver info */
BYTE	transport_time[2];   /* no of ticks */
BYTE	ETHER_TYPE[2];
BYTE	ether_ver[2];
BYTE	misc_flags;
BYTE	lan_desc[80];
BYTE	text_desc[80];
BYTE	max_data_size;
BYTE	total_tx_pkts[4];
BYTE	total_rx_pkts[4];
BYTE	no_ecb_avail_cnt[2];
BYTE	pkt_rx_overflow_int[2];
BYTE	pkt_rx_too_small_int[2];
BYTE	retries_tx_pkt[2];
BYTE	check_sum_errs_int[2];
BYTE	pkt_tx_errs[2];
BYTE	pkt_rx_errs[2];
};

typedef struct node_information NODE_INFO;


struct node_info_ptr{
   NODE_INFO *head, *tail; /* head and tail of the bucket */
   };

/* information about all the nodes on a given network  */
struct nodes_on_net{
     WORD node_count; /* no of nodes on the network */
     struct node_info_ptr node_info_table[MAX_PRIME];
};

/* network information table contains ptrs to the node information
   table for all the nodes in that network  */
 struct network_info{
	BYTE net_id[4];
	BYTE name[9];
	struct  network_info *next,*prev;
	struct nodes_on_net node_info;
 };

extern struct network_info *network_info_table[MAX_PRIME];
#define NULLNWPTR  (struct network_info *) 0
#define NULLNPTR	(struct node_information *) 0
[ RETURN TO DIRECTORY ]