/*	MAP dialogue PDU head file				*/
/*	written by Liu zhiguo 2002-01-14		*/
/*	Version 1.0 (according GSM 09.02 17.4)	*/
/*	-------------------------------------	*/
#ifndef _MAP_DLGPDU
#define _MAP_DLGPDU

#define MAPDLG_OPEN				0x00
#define MAPDLG_ACCEPT			0x01
#define MAPDLG_CLOSE			0x02
#define MAPDLG_REFUSE			0x03
#define MAPDLG_UABORT			0x04	// user abort
#define MAPDLG_PABORT			0x05	// provider abort

/*	+++++++++++++++++++++++++	*/
/*		MAP-Openinfo			*/
/*	+++++++++++++++++++++++++	*/
typedef struct MapDlgOpen_struct
{
	u8		param_flag;
	u8		peer_ref[ISDN_LEN+1];		// peer reference
	u8		local_ref[ISDN_LEN+1];		// local reference
}	MapDlgOpen_struct;

/*	+++++++++++++++++++++++++	*/
/*		MAP-Refuseinfo			*/
/*	+++++++++++++++++++++++++	*/
typedef enum MapDlgReason_enum
{
	noReasonGiven = 0,
	invalidDstRef = 1,	// invalid destination reference
	invalidOrgRef = 2	// invalid original reference
}	MapDlgReason_enum;

typedef struct	MapDlgRefuse_struct
{
	u8		param_flag;
	enum	MapDlgReason_enum	reason;
}	MapDlgRefuse_struct;

/*	+++++++++++++++++++++++++	*/
/*		MAP-UserAbortinfo		*/
/*	+++++++++++++++++++++++++	*/
typedef enum MapDlgRUReason_enum	// resource unavailable reason
{
	shortTRLimit = 0,	// short term resource limitation
	longTRLimit = 1		// long term resource limitation
}	MapDlgRUReason_enum;

typedef enum MapDlgPCReason_enum	// procedure cancellation reason
{
	handoverCancel = 0,		// hand over cancellation
	radioChanRelease = 1,	// radio channel release
	netPathRelease = 2,		// network path release
	callRelease = 3,		// call release
	assProFailure = 4,		// associated procedure failure
	randomDialRelease = 5,	// random dialogue release
	remOperFailure = 6		// remote operation failure
}	MapDlgPCReason_enum;

typedef struct MapDlgUAbort_struct
{
	u8		choice_flag;	// user abort choice
	union
	{
		enum MapDlgRUReason_enum	resunavi;		// resource unavailable, choice_flag = 2
		enum MapDlgPCReason_enum	appproccancel;	// application procedure cancellation, choice_flag = 3
	}	choice;
}	MapDlgUAbort_struct;

/*	+++++++++++++++++++++++++	*/
/*		MAP-UserAbortinfo		*/
/*	+++++++++++++++++++++++++	*/
typedef enum MapDlgPAbortReason_enum
{
	abnormaldial = 0,		// abnormal dialogue
	invalidPDU = 1
}	MapDlgPAbortReason_enum;

typedef struct MapDlgPAbort_struct	// MAP provider abort info
{
	u8		param_flag;
	enum	MapDlgPAbortReason_enum	reason;
}	MapDlgPAbort_struct;

/*	+++++++++++++++++++++++++	*/
/*		MAP-DialoguePDU			*/
/*	+++++++++++++++++++++++++	*/
typedef struct MapDlg_struct
{
	u8		dlg_type;
	union
	{
		struct	MapDlgOpen_struct		map_open;
		struct	MapDlgRefuse_struct		map_refuse;
		struct	MapDlgUAbort_struct		map_uabort;
		struct	MapDlgPAbort_struct		map_pabort;
	}	map_dlg;
}	MapDlg_struct;

u8 build_mapdlg(struct MapDlg_struct *dlg_ptr,u8 *data_buf);
u8 extract_mapdlg(struct MapDlg_struct *dlg_ptr,struct dlgport_struct *port_ptr);

#endif
