/*++
*******************************************************************************
* 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		  *
*																			  *
*******************************************************************************

Module Name:

   lapbdll.C

Abstract:

    Physical Layer MIB SNMP Extension Agent for Windows NT.

    This files provides the definitions and structures used in collecting
    the LAPB specific information from the SXB driver interface. This data
    is used by the LAPB SNMP MIB extension agent DLL.

Author:

   Carl Caldwell

--*/
#ifndef SNMP_LAPB_MIB_SXB_DEFS
#define SNMP_LAPB_MIB_SXB_DEFS 1

#include "uint.h"
#include "ll_proto.h"
#include "ll_control.h"
#include "DsIoctl.h"

#define MAXIOCBSZ   1024    /* max ioctl data block size */

// Use SXB_USER_GETMSG and SXB_USER_IOCTL to get data from, and
// communicate with the adapter
//

#define X_IOCTL_DATA_SIZE               512
#define X_GETMSG_CTRL_SIZE              512
#define X_GETMSG_DATA_SIZE              4096

typedef struct X_IOCTL
{
	DS_IOCTL DsIoctl;
	UCHAR Data[ X_IOCTL_DATA_SIZE ]; // Buffer for DsIoctl
} X_IOCTL, FAR *PX_IOCTL;

#define SXB_DEVICE_NAME_SIZE	32

typedef struct X_GETMSG
{
	DS_GETMSG DsGetMsg;
	UCHAR Control[ X_GETMSG_CTRL_SIZE ]; // Ctrl for DsGetMsg
	UCHAR Data[ X_GETMSG_DATA_SIZE ];    // Data for DsGetMsg
} X_GETMSG, FAR *PX_GETMSG;


// This structure is used on each port to collect the data associated with each port
// It is created as a linked list that will contin all the port information
typedef struct LAPB_SXB_INFO
{
	INT		IoctlType;		//It's either stats, or config in this mib
    CHAR	AdapterId;      //Dll internal adapter identifier 
    ULONG	PortId;         //Dll internal adapter port identifier 
    ULONG	Snid;           //Used as port identifier in ioctl calls
    CHAR	DeviceName[SXB_DEVICE_NAME_SIZE]; //Name of SXB device opened
    HANDLE	hSxbPort;       //Handle returned on open to access the device
    HANDLE  VCLapbDevice;    //SXB internal handle used to manipulate firmware structs
    ULONG	dwBytesWritten; //Returned by GetStats request to SXB indicating data size
    WCHAR	LapbName[SXB_DEVICE_NAME_SIZE];    //SXB internal name of LAPB device
    X_IOCTL XIoctl;         //Ioctl used to communicate with SXB 

    union {
		struct rfc_1381_admn_struct * pLapbConfigData;	// Pointer to the statistics area
		struct rfc_1381_flow_struct * pLapbFlowData;	// Pointer to the configuration area
	} upData;
    struct LAPB_SXB_INFO *  pNextLapbSxbInfo; //Next struct in list
    struct LAPB_SXB_INFO *  pPreviousLapbSxbInfo; //Previous struct in list
} LAPB_SXB_INFO, FAR *PLAPB_SXB_INFO;

//SXB device name constants for SXB_USER_GET_MSG ioctl
#define ID_STR_SXB_LAPB_STATS    "LAPB"

//Index into the linked list of ioctls for SXB
#define PORT_IOCTL_NDX_CONFIG	0	//The second port ioctl is config
#define PORT_IOCTL_NDX_FLOW		1	//The first port ioctl is the stats

//// These structures and constants will be used to handle the configuration
//// of the SXB driver from the registry

// This structure is used on each port to list the circuits present on each port
// It is created as a linked list that will contin all the port information
typedef struct SXB_CIRCUIT_INFO
{
	short circuit;
    struct SXB_CIRCUIT_INFO * pNextSxbCircuitInfo; //Previous struct in list
    struct SXB_CIRCUIT_INFO * pPreviousSxbCircuitInfo; //Previous struct in list
} SXB_CIRCUIT_INFO, FAR *PSXB_CIRCUIT_INFO;

// This structure is used on each port to collect the data associated with each port
// It is created as a linked list that will contin all the port information
typedef struct SXB_PORT_INFO
{
    CHAR	DeviceName[32];		//Name of SXB device opened
	INT     ProtocolId;
    ULONG	Snid;				//Used as port identifier in ioctl calls
	UINT	WANLinksPortId;
	struct SXB_CIRCUIT_INFO * pCircuitList;
    struct SXB_PORT_INFO *    pNextSxbPortInfo; //Next struct in list
    struct SXB_PORT_INFO *    pPreviousSxbPortInfo; //Previous struct in list
} SXB_PORT_INFO, FAR *PSXB_PORT_INFO;

#define SXB_PROTOCOL_ID_NONE		0
#define SXB_PROTOCOL_ID_FRAME_RELAY	1
#define SXB_PROTOCOL_ID_X25			2

#define MAX_VALUE_NAME              128
#define MAX_DATA_LEN                1024

#endif
