/*****************************************************************************
 * Copyright (c) 1988-95 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 copyright work  Digi   International
 * Inc.    Except   as   permitted   by  federal  law,  17 USC 117, copying is
 * strictly prohibited.
 * 
 * Digi  International  Inc.  CONFIDENTIAL  -   (Digi    International    Inc.
 * Confidential  when   combined   with   the   aggregated  modules  for  this
 * product) OBJECT CODE ONLY SOURCE MATERIALS
 * 
 * (C) COPYRIGHT Digi International Inc. 1995
 * 
 * All Rights Reserved
 * 
 * US   Government   Users   Restricted   Rights   -   Use,   duplication   or
 * disclosure  restricted by GSA ADP Schedule Contract with Digi International
 * Inc.
 * 
 *****************************************************************************/

/*
 * $Id: wan_proto.h,v 1.3 1996/10/24 20:24:20 gary Exp $
 */

/******************************************************************
 *
 *  SpiderX25 Protocol Streams Component
 *
 *  Copyright 1991  Spider Systems Limited
 *
 *  WAN_PROTO.H
 *
 ******************************************************************/

#ifdef DEV_TEST

#define	WAN_DEV_TEST	5

#define	WAN_STREAM_INFO	2
#define	WAN_REG_SET	1
#define	WAN_REG_RD	0
#define	WAN_REG_WR	WAN_REG_SET

#endif

/*
    WAN primitive type values
*/
#define WAN_SID           1
#define WAN_REG		  	  2
#define WAN_CTL           3
#define WAN_DAT           4
#define	WAN_SETMODEM	  5
#define WAN_GETMODEM	  6
#define WAN_SETTUNE		  7
#define WAN_GETTUNE		  8
#define WAN_GETLINESTATUS 9


/*
    WAN_CTL type command values/events pairings
*/
#define WC_CONNECT        1
#define WC_CONCNF         2
#define WC_DISC           3
#define WC_DISCCNF        4

#define wconnect          0x01
#define wconcnf           0x02
#define wdisc             0x04
#define wdisccnf          0x08

/*
    WAN_DAT type command values
*/
#define WC_TX		  1
#define WC_RX		  2

/*
    Values for wan_status field
*/
#define WAN_FAIL          0
#define WAN_SUCCESS       1

/*
    Values for wan_remtype field
*/
#define WAN_TYPE_ASC    0          /* Ascii length in octets       */
#define WAN_TYPE_BCD    1          /* BCD   length in semi octets  */


/*
    SETSNID message for WAN
*/
struct wan_sid {
    uint8  wan_type;           /* WAN_SID                  */
    uint8  wan_spare[3];       /* for alignment		  */
    uint32 wan_snid;           /* Subnetwork ID for stream */
};

/*
    Registration message for WAN
*/
struct wan_reg {
    uint8  wan_type;           /* WAN_REG                        */
    uint8  wan_spare[3];       /* for alignment		  */
    uint32 wan_snid;           /* Subnetwork ID for the WAN line */
};

/*
    WAN Connection Control
*/
struct wan_ctl {
    uint8 wan_type;           /* WAN_CTL                        */
    uint8 wan_command;        /* WC_CONNECT/CONCNF/DISC/DISCCNF */
    uint8 wan_remtype;        /* Octets or semi octets          */
    uint8 wan_remsize;        /* Remote address length          */
    uint8 wan_remaddr[20];    /* Remote address                 */
    uint8 wan_status;         /* Result status                  */
    uint8 wan_diag;	      	  /* Extra Diagnostic		*/
	uint8 wan_rsv[2] ;		  /* Padding */ 
};

/*
    WAN Data messages - Transmit and Receive
*/
struct wan_msg {
    uint8 wan_type;           /* WAN_DAT     */
    uint8 wan_command;        /* WC_TX/WC_RX */
	uint8 wan_rsv[2] ;		 /* 32-bit Alignment */
};


/*
    Generic WAN protocol primitive
*/
union WAN_primitives {
    uint8 wan_type;	      /* Variant type             */
    struct wan_reg   wreg;    /* WAN Registration         */
    struct wan_sid   wsid;    /* WAN Subnetwork ID        */
    struct wan_ctl   wctl;    /* WAN Connection Control   */
    struct wan_msg   wmsg;    /* WAN Data Message         */
};

