/*****************************************************************************
 * Copyright (c) 1990-2000 Digi International Inc., All Rights Reserved
 * 
 * This software contains proprietary and confidential information of Digi
 * International Inc.  By accepting transfer of this copy, Recipient agrees
 * to retain this software in confidence, to prevent disclosure to others,
 * and to make no use of this software other than that for which it was
 * delivered.  This is an unpublished copyrighted work of Digi International
 * Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
 * prohibited.
 * 
 * Restricted Rights Legend
 *
 * Use, duplication, or disclosure by the Government is subject to
 * restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
 * Technical Data and Computer Software clause at DFARS 252.227-7031 or
 * subparagraphs (c)(1) and (2) of the Commercial Computer Software -
 * Restricted Rights at 48 CFR 52.227-19, as applicable.
 *
 * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
 *
 *****************************************************************************/

static const char stub_inc_rcsid[] = "@(#) " "$Id: stub.inc,v 1.3 2000/04/19 22:45:46 chrism Exp $";

/* DUMMY TEST CODE */

#include <string.h>

uint32 __stdcall MGMT_DECL stub_Trace(uint32 BoardNumber,	/* 1 to total boards or ignored if not applicable */
												uint16 Command,			/* obvious */
												void *mpkt,					/* msg packet.  This is the data portion of the ioctl. */
												uint16 mpktlen,			/* need to know its length */
												void *rpkt,					/* response packet. This is the data portion of the ioctl response */
												uint16 rpktlen,			/* I hate access violations. */
												TRC_DATACOPY_CB cb,		/* This is the function I call when traces come in. */
												TRCARG handle)				/* cb functions "handle" */
{
	return (BAD_COMMAND);
}

uint32 __stdcall MGMT_DECL stub_Command(uint32 BoardNumber,	/* 1 to total boards or ignored if not  applicable */
					  uint16 Command,										/* obvious */
					  void *mpkt,											/* msg packet. This is the data portion of the ioctl. */
					  uint16 mpktlen,										/* need to know its length */
					  void *rpkt,											/* response packet.  This is the data portion of the ioctl response */
					  uint16 rpktlen)										/* I hate access violations. */
{
	if (Command == GET_MGMT_SHIM_VER)
	{
		((get_mgmt_shim_ver_response_t *) rpkt)->ver = 0x00010002;
		return (MGMT_OK);
	}

	if (Command == GET_MGMT_BOARD_NO)
	{
		((get_mgmt_board_no_response_t *) rpkt)->NumberOfBoards = 3;
		return (MGMT_OK);
	}

	if (Command == GET_MGMT_BOARD_INFO)
	{
		get_mgmt_board_info_response_t *response;

		response = (get_mgmt_board_info_response_t *) rpkt;

		if (BoardNumber == 1)
		{
			response->BoardInfo.BoardNo = 1;
			response->BoardInfo.BrdId = 0xFF;
			response->BoardInfo.BoardType = POST_TYPE_LONDON_U;
			response->BoardInfo.TotalPorts = 4;
			response->BoardInfo.TotalChannels = 4 * 2;
		}
		else if (BoardNumber == 2)
		{
			response->BoardInfo.BoardNo = 2;
			response->BoardInfo.BrdId = 0xFF;
			response->BoardInfo.BoardType = POST_TYPE_CHASKA;
			response->BoardInfo.TotalPorts = 8;
			response->BoardInfo.TotalChannels = 8 * 1;
		}
		else if (BoardNumber == 3)
		{
			response->BoardInfo.BoardNo = 3;
			response->BoardInfo.BrdId = 0xFF;
			response->BoardInfo.BoardType = POST_TYPE_HOUSTON_T1;
			response->BoardInfo.TotalPorts = 2;
			response->BoardInfo.TotalChannels = 2 * 24;
		}
		else
			return (BAD_DEVICE);

		return (MGMT_OK);
	}

	if (Command == GET_ADAPTER_INFO)
	{
		get_adapter_info_response_t *response;

		response = (get_adapter_info_response_t *) rpkt;

		if (BoardNumber == 1)
		{
			response->info.board_type = POST_TYPE_LONDON_U;
			response->info.port_count = 4;
			response->info.channels_per_port = 2;
			response->info.memory_size = 1;
			response->info.fep_version = 918492591L;
			response->info.csc_version = 3;
			response->info.pump_version = 4;
			response->info.main_board_revision = 5;
			strcpy((char *) &response->info.main_board_serial[0],
					 "1234567");
			response->info.daughter_card_revision = 6;
			strcpy((char *) &response->info.daughter_card_serial[0],
					 "1234567");
		}
		else if (BoardNumber == 2)
		{
			response->info.board_type = POST_TYPE_CHASKA;
			response->info.port_count = 8;
			response->info.channels_per_port = 1;
			response->info.memory_size = 1;
			response->info.fep_version = 918492591L;
			response->info.csc_version = 3;
			response->info.pump_version = 4;
			response->info.main_board_revision = 5;
			strcpy((char *) &response->info.main_board_serial[0],
					 "2234567");
			response->info.daughter_card_revision = 6;
			strcpy((char *) &response->info.daughter_card_serial[0],
					 "2234567");
		}
		else if (BoardNumber == 3)
		{
			response->info.board_type = POST_TYPE_HOUSTON_T1;
			response->info.port_count = 2;
			response->info.channels_per_port = 24;
			response->info.memory_size = 1;
			response->info.fep_version = 918492591L;
			response->info.csc_version = 3;
			response->info.pump_version = 4;
			response->info.main_board_revision = 5;
			strcpy((char *) &response->info.main_board_serial[0],
					 "3234567");
			response->info.daughter_card_revision = 6;
			strcpy((char *) &response->info.daughter_card_serial[0],
					 "3234567");
		}
		else
			return (BAD_DEVICE);

		return (MGMT_OK);
	}

	if (Command == GET_MODEM_NATIONALITY)
	{
		modem_nationality_t *response;

		response = (modem_nationality_t *) rpkt;
		response->country_code = 1;

		return (MGMT_OK);
	}

	if (Command == GET_MGMT_PROTOCOL_VERSION)
	{
		mgmt_protocol_version_t *response;

		response = (mgmt_protocol_version_t *) rpkt;
#if defined( REV1)
		response->version = 1;
#elif defined( REV3)
		response->version = 3;
#endif

		return (MGMT_OK);
	}

	if (Command == GET_ADAPTER_STATE)
	{
		get_adapter_state_response_t *response;

		response = (get_adapter_state_response_t *) rpkt;
		response->state.memory_usage = 10;
		response->state.cpu_usage = 11;
		response->state.dxb_h2a_count = 12;
		response->state.dxb_a2h_count = 13;
		response->state.uptime.seconds = 14;
		response->state.uptime.mseconds = 15;

		return (MGMT_OK);
	}

	if (Command == GET_DS1_CONFIG)
	{
		get_ds1_config_response_t *response;

		response = (get_ds1_config_response_t *) rpkt;
		response->config.coding = LINE_CODE_B8ZS;
		response->config.framing = FRAME_ESF;
		response->config.if_type = LONG_HAUL;
		response->config.long_haul_lbo = LBO_00_0_DB;
		response->config.short_haul_len = SH_0_133;
		response->config.signalling = PRI_NI2;
		response->config.wink_digits = 1;
		response->config.clocking = TIMING_LOOP;
		response->config.jitter_atten = 1;
		response->config.eq_gain_limit = 1;
		response->config.leased_mask = 1;

		return (MGMT_OK);
	}

	if (Command == GET_DS1_EXT_CONFIG)
	{
		get_ds1_ext_config_response_t *response;

		response = (get_ds1_ext_config_response_t *) rpkt;

		response->config.tx_special = 1;
		response->config.auto_config = 1;
		response->config.loopback = 1;

		return (MGMT_OK);
	}

	if (Command == GET_DS1_STATUS)
	{
		get_ds1_status_response_t *response;

		response = (get_ds1_status_response_t *) rpkt;

		response->status.rx_special = 1;
		response->status.alarm = 1;
		response->status.loopback = 1;

		return (MGMT_OK);
	}

	if (Command == GET_DS1_EXT_STATUS)
	{
		get_ds1_ext_status_response_t *response;

		response = (get_ds1_ext_status_response_t *) rpkt;

		response->status.errored_seconds = 1;
		response->status.unavailable_seconds = 1;
		response->status.bursty_seconds = 1;
		response->status.severe_seconds = 1;
		response->status.severe_framing_seconds = 1;
		response->status.controlled_slip_seconds = 1;
		response->status.loss_of_frame_count = 1;
		response->status.degraded_minutes = 1;
		response->status.line_errored_seconds = 1;
		response->status.line_code_violations = 1;
		response->status.crc_error_count = 1;

		return (MGMT_OK);
	}

	if (Command == GET_DS1_CT1_SIG_STATUS)
	{
		get_ds1_ct1_sig_status_response_t *response;

		response = (get_ds1_ct1_sig_status_response_t *) rpkt;

		return (MGMT_OK);
	}

	if (Command == GET_BRI_CONFIG)
	{
		get_bri_config_response_t *response;

		response = (get_bri_config_response_t *) rpkt;
		response->config.switch_type = 1;
		response->config.auto_spid = 2;
		strcpy((char *) &response->config.directory[0].number[0],
				 "1234567");
		strcpy((char *) &response->config.directory[0].sub_address[0],
				 "1234567");
		strcpy((char *) &response->config.directory[0].spid[0],
				 "1234567");

		response->config.directory[1].number[0] = '\0';
		response->config.directory[1].sub_address[0] = '\0';
		response->config.directory[1].spid[0] = '\0';

		return (MGMT_OK);
	}

	if (Command == GET_BRI_STATUS)
	{
		get_bri_status_response_t *response;

		response = (get_bri_status_response_t *) rpkt;

		response->status.power = 1;
		response->status.activation_state = 1;
		response->status.rx_info_state = 1;
		response->status.tx_info_state = 1;
		response->status.loss_of_sync = 1;
		response->status.collisions = 1;

		return (MGMT_OK);
	}

	if (Command == GET_DCHAN_EXT_CONFIG)
	{
		get_dchan_ext_config_response_t *response;

		response = (get_dchan_ext_config_response_t *) rpkt;

		response->config.mode = 1;
		response->config.address_type = 1;
		response->config.numbering_plan = 1;
		response->config.subaddress_type = 1;

		return (MGMT_OK);
	}

	if (Command == GET_DCHAN_EXT_STATUS)
	{
		get_dchan_ext_status_response_t *response;

		response = (get_dchan_ext_status_response_t *) rpkt;

#if defined( REV1)
		response->status.tei_state = 1;
#elif defined( REV3)
		response->status.tei_state[0] = 1;
#endif

		response->status.hdlc.tx_bytes = 1;
		response->status.hdlc.rx_bytes = 1;
		response->status.hdlc.tx_frames = 1;
		response->status.hdlc.rx_frames = 1;
		response->status.hdlc.rx_bad_frames = 1;
		response->status.hdlc.rx_short_frames = 1;
		response->status.hdlc.rx_long_frames = 1;
		response->status.hdlc.rx_aborts = 1;
		response->status.hdlc.rx_overruns = 1;
		response->status.hdlc.rx_crc_errors = 1;
		response->status.hdlc.rx_buffer_overflows = 1;
		response->status.hdlc.tx_underruns = 1;

		response->status.lapd.RR_rx_cmd = 1;
		response->status.lapd.RR_rx_rsp = 1;
		response->status.lapd.RR_tx_cmd = 1;
		response->status.lapd.RR_tx_rsp = 1;
		response->status.lapd.RR_tx_cmd_p = 1;
		response->status.lapd.RNR_rx_cmd = 1;
		response->status.lapd.RNR_rx_rsp = 1;
		response->status.lapd.RNR_tx_cmd = 1;
		response->status.lapd.RNR_tx_rsp = 1;
		response->status.lapd.RNR_tx_cmd_p = 1;
		response->status.lapd.REJ_rx_cmd = 1;
		response->status.lapd.REJ_rx_rsp = 1;
		response->status.lapd.REJ_tx_cmd = 1;
		response->status.lapd.REJ_tx_rsp = 1;
		response->status.lapd.REJ_tx_cmd_p = 1;
		response->status.lapd.I_tx_cmd = 1;
		response->status.lapd.I_rx_cmd = 1;
		response->status.lapd.SABME_rx_cmd = 1;
		response->status.lapd.SABME_tx_cmd = 1;
		response->status.lapd.DISC_rx_cmd = 1;
		response->status.lapd.DISC_tx_cmd = 1;
		response->status.lapd.UA_rx_rsp = 1;
		response->status.lapd.UA_tx_rsp = 1;
		response->status.lapd.DM_rx_rsp = 1;
		response->status.lapd.DM_tx_rsp = 1;
		response->status.lapd.UI_rx_cmd = 1;
		response->status.lapd.UI_tx_cmd = 1;
		response->status.lapd.FRMR_rx_rsp = 1;
		response->status.lapd.FRMR_tx_rsp = 1;
		response->status.lapd.XID_rx_cmd = 1;
		response->status.lapd.XID_rx_rsp = 1;
		response->status.lapd.XID_tx_cmd = 1;
		response->status.lapd.XID_tx_rsp = 1;
		response->status.lapd.rx_badlen = 1;
		response->status.lapd.rx_unknown = 1;
		response->status.lapd.rx_bad = 1;
		response->status.lapd.rx_dud = 1;
		response->status.lapd.rx_ign = 1;
		response->status.lapd.tx_rtr = 1;
		response->status.lapd.tx_ign = 1;
		response->status.lapd.T200_exp = 1;
		response->status.lapd.T200_N200_exp = 1;
		response->status.lapd.rx_mgmt_dud = 1;
		response->status.lapd.rx_mgmt_badlen = 1;
		response->status.lapd.rx_mgmt_ign = 1;
		response->status.lapd.rx_mgmt_unknown = 1;
		response->status.lapd.rx_tei_assigned = 1;
		response->status.lapd.rx_tei_denied = 1;
		response->status.lapd.rx_tei_check = 1;
		response->status.lapd.rx_tei_remove = 1;

		return (MGMT_OK);
	}

	if (Command == GET_CALL_STATUS)
	{
		get_call_status_response_t *response;

		response = (get_call_status_response_t *) rpkt;

		response->status.call_state = 1;
		response->status.call_type = 1;
		response->status.index = 1;
		response->status.timeslot = 1;

		return (MGMT_OK);
	}

	if (Command == GET_ALL_CALL_STATUS)
	{
		int temp, pc;
		get_all_call_status_response_t *response;

		response = (get_all_call_status_response_t *) rpkt;

		if (BoardNumber == 1)
			pc = 8;					  // 2;

		else if (BoardNumber == 2)
			pc = 8;					  // 1;

		else
			pc = 23;

		response->count = pc;
		for (temp = 0; temp < pc; temp++)
		{
			response->status[temp].call_state = 1;
			response->status[temp].call_type = 1;
			response->status[temp].index = 1;
			response->status[temp].timeslot = 1;
		}

		return (MGMT_OK);
	}

	if (Command == GET_MODEM_CONFIG)
	{
		get_modem_config_response_t *response;

		response = (get_modem_config_response_t *) rpkt;

		response->config.answer_rings = 1;
		response->config.clid_enable = 1;
		response->config.max_rate = 1;
		response->config.min_rate = 1;
		response->config.hangup = 0;
		response->config.reset = 0;

		return (MGMT_OK);
	}

	if (Command == GET_MODEM_EXT_CONFIG)
	{
		get_modem_ext_config_response_t *response;

		response = (get_modem_ext_config_response_t *) rpkt;

		response->config.busy_out = 1;
		response->config.leased_line = 1;
		response->config.audio_level_rx = 1;
		response->config.audio_level_tx = 1;

		return (MGMT_OK);
	}

	if (Command == GET_MODEM_STATUS)
	{
		get_modem_status_response_t *response;

		response = (get_modem_status_response_t *) rpkt;

		response->status.mode = 1;
		response->status.dte_tx_rate = 1;
		response->status.dte_rx_rate = 1;
		response->status.port = 1;
		response->status.index = 1;
		response->status.connect_time = 1;
		response->status.initial_tx_rate = 1;
		response->status.initial_rx_rate = 1;
		response->status.current_tx_rate = 1;
		response->status.current_rx_rate = 1;
		response->status.modulation = 1;
		response->status.compression = 1;
		response->status.error_correction = 1;
		response->status.page_number = 1;
		response->status.last_disconnect = 1;

		strcpy((char *) &response->status.clid[0], "1234567");
		strcpy((char *) &response->status.local_dn[0], "1234567");
		strcpy((char *) &response->status.remote_dn[0], "1234567");

		return (MGMT_OK);
	}

	if (Command == GET_MODEM_EXT_STATUS)
	{
		get_modem_ext_status_response_t *response;

		response = (get_modem_ext_status_response_t *) rpkt;

#ifdef REV1
		response->status.symbol_rate = 1;
		response->status.carrier_freq = 1;
		response->status.estimated_snr = 1;
		response->status.estimated_rtt = 1;
		response->status.tx_signal_level = 1;
		response->status.rx_signal_level = 1;
		response->status.local_retrains = 1;
		response->status.remote_retrains = 1;
		response->status.manual_retrains = 1;
		response->status.renegotiate_count = 1;
		response->status.mean_square_error = 1;
		response->status.trellis_size = 1;
		response->status.block_errors = 1;
		response->status.resends = 1;
		response->status.dictionary_size = 1;
		response->status.max_string_length = 1;
#endif

		return (MGMT_OK);
	}

	if (Command == GET_BCHAN_EXT_CONFIG)
	{
		get_bchan_ext_config_response_t *response;

		response = (get_bchan_ext_config_response_t *) rpkt;

		response->config.hangup = 1;
		response->config.cause_code = 1;

		return (MGMT_OK);
	}

	if (Command == GET_BCHAN_STATUS)
	{
		get_bchan_status_response_t *response;

		response = (get_bchan_status_response_t *) rpkt;

		response->status.mode = 1;
		response->status.dte_tx_rate = 1;
		response->status.dte_rx_rate = 1;
		response->status.port = 1;
		response->status.index = 1;
		response->status.connect_time = 1;
		response->status.channel_rate = 1;
		response->status.compression = 1;
		response->status.last_disconnect = 1;

		strcpy((char *) &response->status.local_dn[0], "1234567");
		strcpy((char *) &response->status.remote_dn[0], "1234567");

		return (MGMT_OK);
	}

	if (Command == GET_BCHAN_EXT_STATUS)
	{
		get_bchan_ext_status_response_t *response;

		response = (get_bchan_ext_status_response_t *) rpkt;

		response->status.hdlc.tx_bytes = 1;
		response->status.hdlc.rx_bytes = 1;
		response->status.hdlc.tx_frames = 1;
		response->status.hdlc.rx_frames = 1;
		response->status.hdlc.rx_bad_frames = 1;
		response->status.hdlc.rx_short_frames = 1;
		response->status.hdlc.rx_long_frames = 1;
		response->status.hdlc.rx_aborts = 1;
		response->status.hdlc.rx_overruns = 1;
		response->status.hdlc.rx_crc_errors = 1;
		response->status.hdlc.rx_buffer_overflows = 1;
		response->status.hdlc.tx_underruns = 1;

		return (MGMT_OK);
	}

	if (Command == GET_SERIAL_STATUS)
	{
		get_serial_status_response_t *response;

		response = (get_serial_status_response_t *) rpkt;

		response->status.port_state = 1;
		response->status.frame_mode = 1;

		response->status.in_flow_type[0] = 1;
		response->status.in_flow_type[1] = 0;
		response->status.in_flow_type[2] = 0;

		response->status.out_flow_type[0] = 0;
		response->status.out_flow_type[1] = 0;
		response->status.out_flow_type[2] = 0;

		response->status.in_flow_state[0] = 0;
		response->status.in_flow_state[1] = 0;
		response->status.in_flow_state[2] = 0;

		response->status.out_flow_state[0] = 0;
		response->status.out_flow_state[1] = 0;
		response->status.out_flow_state[2] = 0;

		response->status.mdm_sig_state[0] = 1;
		response->status.mdm_sig_state[1] = 1;
		response->status.mdm_sig_state[2] = 1;
		response->status.mdm_sig_state[3] = 1;
		response->status.mdm_sig_state[4] = 1;
		response->status.mdm_sig_state[5] = 1;

		response->status.in_speed = 1;
		response->status.out_speed = 1;
		response->status.autobaud = 1;

		response->status.data_bits = 1;
		response->status.stop_bits = 1;
		response->status.parity = 1;

		return (MGMT_OK);
	}

	if (Command == GET_SERIAL_EXT_STATUS)
	{
		get_serial_ext_status_response_t *response;

		response = (get_serial_ext_status_response_t *) rpkt;

		response->status.tx_bytes = 1;
		response->status.rx_bytes = 1;
		response->status.tx_frames = 1;
		response->status.rx_frames = 1;
		response->status.rx_bad_frames = 1;
		response->status.rx_short_frames = 1;
		response->status.rx_long_frames = 1;
		response->status.rx_aborts = 1;
		response->status.rx_overruns = 1;
		response->status.rx_crc_errors = 1;
		response->status.rx_buffer_overflows = 1;
		response->status.tx_underruns = 1;

		response->status.interrupted_frames = 1;

		response->status.breaks_received = 1;
		response->status.parity_errs = 1;
		response->status.framing_errs = 1;
		response->status.overrun_errs = 1;

		response->status.rxaccm = 1;
		response->status.txaccm = 1;

		return (MGMT_OK);
	}

	if (Command == GET_SERIAL_CONFIG)
	{
		get_serial_config_response_t *response;

		response = (get_serial_config_response_t *) rpkt;

		response->config.port_type = 1;
		response->config.clock_source = 1;
		response->config.alt_pin = 1;

		return (MGMT_OK);
	}

	if (Command == GET_SERIAL_EXT_CONFIG)
	{
		get_serial_ext_config_response_t *response;

		response = (get_serial_ext_config_response_t *) rpkt;

		response->config.unpause_rx = 0;
		response->config.unpause_tx = 0;

		return (MGMT_OK);
	}

	return (BAD_COMMAND);
}
