#ident "$Id: il3_ie.h,v 1.5 1997/04/21 14:14:53 meern Exp $"
/*****************************************************************************
 * 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.
 * 
 *****************************************************************************/

/*
 *
 * Copyright (c) 1993-1994 Spider Systems Limited
 *
 * This Source Code is furnished under Licence, and may not be
 * copied or distributed without express written agreement.
 *
 * All rights reserved.  Made in Scotland.
 *
 * Authors: Harry Bryson
 *
 * il3_ie.h of il3 module
 *
 * SpiderISDN
 * Release 3.0.0 94/12/20
 * 
 * SpiderISDN Release 3 - Official Release.
 *
 */
 
/*
 * il3_ie.h
 */

#define	RATE_64		0x01	/* Info. Transfer Rates for Bearer Cap */
#define	RATE_2_64	0x02
#define	RATE_384	0x04
#define	RATE_1536	0x08
#define	RATE_1920	0x10	/* Info. Transfer Rates for Bearer Cap */
#define RATE_MULTI	0x12    /* Info. Transfer Rate multi-rate Bear Serv*/

/*
 * Skip over unwanted entensions to information element (2:a,b etc.)
 * a = copied IE, i = present index, j = maximum index
 */

/* 
 * to be added to il3/il3sm.h 
 */
#define	IL3_254STATE_FACILITY_REG_REQ	0x80000000	

#define	NAT_NOT_BRITISH		(NAT_FRENCH|NAT_GERMAN|NAT_ETSI)
#define	NAT_CCITT		0x8000

#define	BIT_8			0x80
#define	IE_SHIFT_MASK 		0x90	/* Fixed SHIFT mask. */
#define	IE_SHIFT_CODESET_MASK	0x07	/* Fixed SHIFT codeset mask. */
#define	IE_COMPREHENSION_MASK	0xF0	/* Table 4.3, Note 5 */

#define	NORMAL_SIZE_IE		36	/* any IE > 36 => il3cglob */
#define	SMALL_IE		2	/* BODGE for IEDARG_MIN */
#define	MAX_IE			255	/* BODGE for IEDARG_MAX */

/*
 * Network-specific facility values.
 */
#define	NSF_1TR6_VA	0x1d	/* Verbindung Aktivieren */
#define	NSF_1TR6_VD	0x1e	/* Verbindung Deactivieren */
#define	NSF_1TR6_SPV	0x1f	/* Semipermanente Verbindung */

/*
 * IE's
 */
#define 	IE_I_NONE	0	/* Invalid index */
#define 	IE_I_END	255	/* Invalid index */
#define 	IE_MAND		0x80	/* Top bit set=>mandatory */

#define 	IE_PD_Q931	0x08	/* 0000 1000 */
/*
 * Codeset 0
 */
#define	IE_SEGMENTED_MESSAGE	0x00	/* 000 0000 */
#define	IE_I_SEGMENTED_MESSAGE	1	/* IE_I_ => index */
#define	IE_BEARER_CAP		0x04	/* 000 0100 */
#define	IE_I_BEARER_CAP		2
#define	IE_CAUSE		0x08	/* 000 1000 */
#define	IE_I_CAUSE		3
#define	IE_CONNECTED_ADD	0x0c	/* 000 1100 */
#define	IE_I_CONNECTED_ADD	4
#define	IE_CALL_IDENTITY	0x10	/* 001 0000 */
#define	IE_I_CALL_IDENTITY	5
#define	IE_CALL_STATE		0x14	/* 001 0100 */
#define	IE_I_CALL_STATE		6
#define	IE_CHANNEL_ID		0x18	/* 001 1000 */
#define	IE_I_CHANNEL_ID		7
#define	IE_FACILITY		0x1c	/* 001 1100 */
#define	IE_I_FACILITY		8
#define	IE_PROGRESS_IND		0x1e	/* 001 1110 */
#define	IE_I_PROGRESS_IND	9
#define	IE_NET_SPEC_FAC		0x20	/* 010 0000 */
#define	IE_I_NET_SPEC_FAC	10
#define	IE_NOTIFICATION_IND	0x27	/* 010 0111 */
#define	IE_I_NOTIFICATION_IND	11
#define	IE_DISPLAY		0x28	/* 010 1000 */
#define	IE_I_DISPLAY		12
#define	IE_DATE_TIME		0x29	/* 010 1001 */
#define	IE_I_DATE_TIME		13
#define	IE_KEYPAD_FAC		0x2c	/* 010 1100 */
#define	IE_I_KEYPAD_FAC		14
#define	IE_SIGNAL		0x34	/* 011 0100 */
#define	IE_I_SIGNAL		15
#define	IE_INFORMATION_RATE	0x40	/* 100 0000 */
#define	IE_I_INFORMATION_RATE	16
#define	IE_TRANSIT_DELAY	0x42	/* 100 0010 */
#define	IE_I_TRANSIT_DELAY	17
#define	IE_TRANSIT_SEL_IND	0x43	/* 100 0011 */
#define	IE_I_TRANSIT_SEL_IND	18
#define	IE_P_LAY_PARAMS		0x44	/* 100 0100 */
#define	IE_I_P_LAY_PARAMS	19
#define	IE_P_LAY_WIN		0x45	/* 100 0101 */
#define	IE_I_P_LAY_WIN		20
#define	IE_PACKET_SIZE		0x46	/* 100 0110 */
#define	IE_I_PACKET_SIZE	21
#define	IE_CALLING_PAR_NO	0x6c	/* 110 1100 */
#define	IE_I_CALLING_PAR_NO	22
#define	IE_CALLING_PAR_SUBADD	0x6d	/* 110 1101 */
#define	IE_I_CALLING_PAR_SUBADD	23
#define	IE_CALLED_PAR_NO	0x70	/* 111 0000 */
#define	IE_I_CALLED_PAR_NO	24
#define	IE_CALLED_PAR_SUBADD	0x71	/* 111 0001 */
#define	IE_I_CALLED_PAR_SUBADD	25
#define	IE_REDIRECTING_NO	0x74	/* 111 0100 */
#define	IE_I_REDIRECTING_NO	26
#define	IE_TRANSIT_NET_SEL	0x78	/* 111 1000 */
#define	IE_I_TRANSIT_NET_SEL	27
#define	IE_RESTART_IND		0x79	/* 111 1001 */
#define	IE_I_RESTART_IND	28
#define	IE_LOW_LAYER_COMPAT	0x7c	/* 111 1100 */
#define	IE_I_LOW_LAYER_COMPAT	29
#define	IE_HIGH_LAYER_COMPAT	0x7d	/* 111 1101 */
#define	IE_I_HIGH_LAYER_COMPAT	30
#define	IE_USER_USER_INFO	0x7e	/* 111 1110 */
#define	IE_I_USER_USER_INFO	31
#define	IE_ESCAPE_FOR_EXTN	0x7f	/* 111 1111 */
#define	IE_I_ESCAPE_FOR_EXTN	32

/*
 * NOT used anymore
 */
#define	IE_SWITCHHOOK		0x37	/* 011 0110 */
#define	IE_I_SWITCHHOOK		33
#define	IE_FEATURE_ACT		0x78	/* 011 1000 */
#define	IE_I_FEATURE_ACT	34
#define	IE_FEATURE_IND		0x79	/* 011 1001 */
#define	IE_I_FEATURE_IND	35

/*
 * Codeset 6
 */
#define	IE_SERVICE_IND		0x01	/* 000 0001 */
#define	IE_I_SERVICE_IND	36
#define	IE_CHARGING_INFO	0x02	/* 000 0010 */
#define	IE_I_CHARGING_INFO	37
#define	IE_DATE			0x03	/* 000 0011 */
#define	IE_I_DATE		38
#define	IE_FACILITY_SEL		0x05	/* 000 0101 */
#define	IE_I_FACILITY_SEL	39
#define	IE_STATS_FAC		0x06	/* 000 0110 */
#define	IE_I_STATS_FAC		40
#define	IE_STATS_CALLED_USER	0x07	/* 000 0111 */
#define	IE_I_STATS_CALLED_USER	41
#define	IE_ADD_TX_ATTRIB	0x08	/* 000 1000 */
#define	IE_I_ADD_TX_ATTRIB	42
#define	IE_TERMINAL_CAP		0x24	/* 010 0100 */
#define	IE_I_TERMINAL_CAP	43
#define	IE_USER_USER_FAC	0x7a	/* 111 1010 */
#define	IE_I_USER_USER_FAC	44
/*
 * Extension of Codeset 6 for NTT(INS-64 Japan) Meer
 */
#define	IE_ADVICE_OF_CHARGE	0x01	/* 000 0001 */
#define	IE_I_ADVICE_OF_CHARGE	54
#define	IE_BLOCK_CHANNEL_ID	0x03	/* 000 0011 */
#define IE_I_BLOCK_CHANNEL_ID   55

/*
 * Codeset 0 single octet information elements
 */
#define	IE_SNGL_RESERVED	0x80	/* 1000 ---- */
#define	IE_I_SNGL_RESERVED	45
#define	IE_MORE_DATA		0xa0	/* 1010 0000 */
#define	IE_I_MORE_DATA		46
#define	IE_SENDING_COMPLETE	0xa1	/* 1010 00001 */
#define	IE_I_SENDING_COMPLETE	47
#define	IE_CONGEST_LEVEL	0xb0	/* 1011 ---- */
#define	IE_I_CONGEST_LEVEL	48

#ifdef NATIONAL_ISDN
/*
 * National ISDN specifics.
 */
#define	IE_SPID			0x3a	/* 011 1010 */
#define	IE_I_SPID		49
#define	IE_ENDPOINT		0x3b	/* 011 1011 */
#define	IE_I_ENDPOINT		50

/*
 * Data contained within the type field of the information request information
 * element.
 */
#define IE_TYPE_INFO_REQ_UNDEFINED	0x00
#define IE_TYPE_INFO_REQ_AUTHORIZATION	0x01
#define IE_TYPE_INFO_REQ_ADDRESS	0x02
#define IE_TYPE_INFO_REQ_TID		0x03
#define IE_TYPE_INFO_REQ_PROMPT_ADDIT	0x40

#define	IE_INFO_REQ		0x32	/* 011 0010 */
#define	IE_I_INFO_REQ		51

/*
 * MUST KEEP IE_I_REPEAT_IND SECOND LAST ENTRY.
 * Used to validate ied.
 */
#define	IE_REPEAT_IND		0xd0	/* 1101 ---- */
#define	IE_I_REPEAT_IND		52

#define	IE_I_LAST		53	/* Always the last index 
			 	 	 * so I can find end of list
			 		 */
#else /* NATIONAL_ISDN }*/
/*
 * MUST KEEP IE_I_REPEAT_IND SECOND LAST ENTRY.
 * Used to validate ied.
 */
#define	IE_REPEAT_IND		0xd0	/* 1101 ---- */
#define	IE_I_REPEAT_IND		49

#define	IE_I_LAST		50	/* Always the last index 
			 	 	 * so I can find end of list
			 		 */
#endif

/* Meer */
#ifdef ATNT
#define IE_41449_CHANGE_STATUS		0x01
#define IE_I_41449_CHANGE_STATUS 	1
#define IE_I_41449_CHANNEL_ID    	2
#define IE_I_41449_REPEAT_IND    	3
#define IE_I_41449_LAST		 	4

extern ie_t ied_41449[];

#endif

#define	is_single_octet_ie(iedi)	(ied[iedi].ie_id_coding & BIT_8)
extern ie_t ied[];
