
/*
 Copyright 1999-2000 by Digi International (www.digi.com)

 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 2, or (at your option)
 any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; 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.
*/

/*
 * dxbmgmt.h
 *
 *
 */

/*
 * File: Mgmtshim.h
 *
 * Shim Version 1:
 *				Original file.
 * Shim Version 2:
 *				Changed Command() and Trace() to MgmtCommand() and MgmtTrace(). -tds
 */

#ifndef DxbMgmt_h
#define DxbMgmt_h

#ifndef MGMT_DECL
#define MGMT_DECL
#endif /* #ifndef MGMT_DECL */

#include "mgmtdflt.h"

typedef void *TRCARG ;
typedef int (*TRC_DATACOPY_CB)(uint8 *TrcData, uint32 TrcLen, TRCARG arg);

/*
 * Shim version define.
 * 
 * This indicates the version of the mgmtshim.h api.  There is no major
 * minor thing going on here.
 */
#define MGMT_SHIM_VERSION	0x00000002

/*
 * MGMT Shim commands 
 */
#define MGMT_BOARD_NO	1
#define MGMT_BOARD_INFO	2
#define MGMT_SHIM_VER	3
#define MGMT_STOP_TRC	4
#define MGMT_DRV_VERS   5

#define GET_MGMT_BOARD_NO		(SHIM(MGMT_BOARD_NO))
#define GET_MGMT_BOARD_INFO		(SHIM(MGMT_BOARD_INFO))
#define GET_MGMT_SHIM_VER		(SHIM(MGMT_SHIM_VER))
#define SET_MGMT_STOP_TRC		(SHIM(MGMT_STOP_TRC))
#define GET_MGMT_DRV_VERS		(SHIM(MGMT_DRV_VERS))

/*
 * MgmtBoard_t
 *
 * This is the payload for the GET_BOARD_INFO command.
 */
typedef struct
{
	uint32	BoardNo;		/* which board is this */
	uint32	BrdId;		/* Slot, HW instance, whatever */
	uint32	BoardType;		/* what kind of board is this. */
	uint32	TotalChannels;	/* how many channels are on this board */
	uint32	TotalPorts;
} mgmt_board_info_t ;

/*
 * Command request and response packets
 */
typedef struct
{
	uint32	NumberOfBoards ;	/* number of boards in the system. */
} get_mgmt_board_no_response_t ;	/* the request has no parameters */

typedef struct
{
	uint32	BoardNo ;		/* which board are we looking for? */
} get_mgmt_board_info_request_t ;

typedef struct
{
	mgmt_board_info_t	BoardInfo ;
} get_mgmt_board_info_response_t ;

typedef struct
{
	uint32	ver ;
} get_mgmt_shim_ver_response_t ;	/* the request has no parameters */

/*
 * Defines for get mgmt drv version function
 */
#define MGMT_DXB_DRV_VER	1
#define MGMT_MGMT_DRV_VER	2
#define MGMT_SER_DRV_VER	3
#define MGMT_ISDN_DRV_VER	4
#define MGMT_X25_DRV_VER 	5
#define MGMT_FR_RELAY_DRV_VER 	6
#define MGMT_MAX_DRV_TYPES	7


#define MAX_DRVRS			8
#define VN_MAX				32		/* max characters in the mgmt_drv_vers_t */

typedef struct
{
	uint32 driverCount;		/* number of drivers associated w brd*/
	struct {
		uint32 type;			/* driver type (Enumerated above) */
		uint8  name[VN_MAX];	/* driver name */
		uint8  version[VN_MAX];	/* driver version in ascii */
	} drivers[MAX_DRVRS];
} mgmt_drv_vers_t ;

typedef struct
{
	mgmt_drv_vers_t	versions ;
} get_mgmt_drv_vers_response_t ;

/* Note that set_mgmt_stop_trc has no request or response packets.  It
   triggers on the "handle" parameter to the trace function. */

/*
 * MgmtCommand
 */
uint32 MGMT_DECL
MgmtCommand (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. */

/*
 * MgmtTrace
 */
uint32  MGMT_DECL
MgmtTrace (	uint32			BoardNumber,	/* 1 to total boards */
			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" */

#endif /* #ifndef DxbMgmt_h */

