#ifndef	_RADIUS_STRUCT_H
#define	_RADIUS_STRUCT_H

#include "./radius_pub.h"

typedef struct _RADIUS_TLV_TS
{
	BYTE	type;
	BYTE	length;
	BYTE	value[RADIUS_TS_VALUE_LEN];
}__attribute__((packed)) RADIUS_TLV_TS;// text or string

typedef struct _RADIUS_TLV_AIT
{
	BYTE	type;
	BYTE	length;
	DWORD	value;
}__attribute__((packed)) RADIUS_TLV_AIT;//address, integer or time

typedef struct _RADIUS_ATTRIBUTE_USER_NAME
{
	BYTE				flag;
	RADIUS_TLV_TS		user_name;
}__attribute__((packed)) RADIUS_ATTRIBUTE_USER_NAME;

typedef struct _RADIUS_ATTRIBUTE_USER_PASSWORD
{
	BYTE				flag;
	RADIUS_TLV_TS		user_password;
}__attribute__((packed)) RADIUS_ATTRIBUTE_USER_PASSWORD;

typedef struct _RADIUS_ATTRIBUTE_CHAP_PASSWORD
{
	BYTE				flag;
	RADIUS_TLV_TS		chap_password;
}__attribute__((packed)) RADIUS_ATTRIBUTE_CHAP_PASSWORD;

typedef struct _RADIUS_ATTRIBUTE_NAS_IP_ADDRESS
{
	BYTE				flag;
	RADIUS_TLV_AIT		nas_ip_addr;
}__attribute__((packed)) RADIUS_ATTRIBUTE_NAS_IP_ADDRESS;

typedef struct _RADIUS_ATTRIBUTE_NAS_PORT
{
	BYTE				flag;
	RADIUS_TLV_AIT		nas_port;
}__attribute__((packed)) RADIUS_ATTRIBUTE_NAS_PORT;

typedef struct _RADIUS_ATTRIBUTE_SERVICE_TYPE
{
	BYTE				flag;
	RADIUS_TLV_AIT		service_type;
}__attribute__((packed)) RADIUS_ATTRIBUTE_SERVICE_TYPE;

typedef struct _RADIUS_ATTRIBUTE_FRAMED_PROTOCOL
{
	BYTE				flag;
	RADIUS_TLV_AIT		framed_protocol;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FRAMED_PROTOCOL;

typedef struct _RADIUS_ATTRIBUTE_FRAMED_IP_ADDR
{
	BYTE				flag;
	RADIUS_TLV_AIT		framed_ip_addr;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FRAMED_IP_ADDR;

typedef struct _RADIUS_ATTRIBUTE_FRAMED_IP_NETMASK
{
	BYTE				flag;
	RADIUS_TLV_AIT		framed_ip_netmask;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FRAMED_IP_NETMASK;

typedef struct _RADIUS_ATTRIBUTE_FRAMED_ROUTING
{
	BYTE				flag;
	RADIUS_TLV_AIT		framed_routing;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FRAMED_ROUTING;

typedef struct _RADIUS_ATTRIBUTE_FILTER_ID
{
	BYTE				flag;
	RADIUS_TLV_TS		filter_id;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FILTER_ID;

typedef struct _RADIUS_ATTRIBUTE_FRAMED_MTU
{
	BYTE				flag;
	RADIUS_TLV_AIT		framed_mtu;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FRAMED_MTU;

typedef struct _RADIUS_ATTRIBUTE_FRAMED_COMPRESSION
{
	BYTE				flag;
	RADIUS_TLV_AIT		framed_compression;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FRAMED_COMPRESSION;

typedef struct _RADIUS_ATTRIBUTE_LOGIN_IP_HOST
{
	BYTE				flag;
	RADIUS_TLV_AIT		login_ip_host;
}__attribute__((packed)) RADIUS_ATTRIBUTE_LOGIN_IP_HOST;

typedef struct _RADIUS_ATTRIBUTE_LOGIN_SERVICE
{
	BYTE				flag;
	RADIUS_TLV_AIT		login_service;
}__attribute__((packed)) RADIUS_ATTRIBUTE_LOGIN_SERVICE;

typedef struct _RADIUS_ATTRIBUTE_LOGIN_TCP_PORT
{
	BYTE				flag;
	RADIUS_TLV_AIT		login_tcp_port;
}__attribute__((packed)) RADIUS_ATTRIBUTE_LOGIN_TCP_PORT;

typedef struct _RADIUS_ATTRIBUTE_REPLY_MESSAGE
{
	BYTE				flag;
	RADIUS_TLV_TS		reply_message;
}__attribute__((packed)) RADIUS_ATTRIBUTE_REPLY_MESSAGE;

typedef struct _RADIUS_ATTRIBUTE_CALLBACK_NUMBER
{
	BYTE				flag;
	RADIUS_TLV_TS		callback_number;
}__attribute__((packed)) RADIUS_ATTRIBUTE_CALLBACK_NUMBER;

typedef struct _RADIUS_ATTRIBUTE_CALLBACK_ID
{
	BYTE				flag;
	RADIUS_TLV_TS		callback_id;
}__attribute__((packed)) RADIUS_ATTRIBUTE_CALLBACK_ID;

typedef struct _RADIUS_ATTRIBUTE_FRAMED_ROUTE
{
	BYTE				flag;
	RADIUS_TLV_TS		framed_route;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FRAMED_ROUTE;

typedef struct _RADIUS_ATTRIBUTE_FRAMED_IPX_NETWORK
{
	BYTE				flag;
	RADIUS_TLV_AIT		framed_ipx_network;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FRAMED_IPX_NETWORK;

typedef struct _RADIUS_ATTRIBUTE_STATE
{
	BYTE				flag;
	RADIUS_TLV_TS		state;
}__attribute__((packed)) RADIUS_ATTRIBUTE_STATE;

typedef struct _RADIUS_ATTRIBUTE_CLASS
{
	BYTE				flag;
	RADIUS_TLV_TS		radius_class;
}__attribute__((packed)) RADIUS_ATTRIBUTE_CLASS;

typedef struct _RADIUS_VENDOR_PPAC_SUB_ATTR_AIC
{
	BYTE				flag;
	DWORD				aic;	/* subtype=1
							 sub_type + length + aic = 1 + 1 + 4
							AvailableInClient value 
							0x00000001	|	Volume metering supported
							0x00000010	|	Duration metering supported
							0x00000100	|	Resource metering supported
							0x00001000	|	Pools supported
							0x00010000	|	Rating groups supported
							0x00100000	|	Multi-Services supported
       						0x01000000	|	Tariff Switch supported
							0x10000000	|	Reserved*/
}__attribute__((packed)) RADIUS_VENDOR_PPAC_SUB_ATTR_AIC;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_PPAC//perpaid accounting capability
{
	BYTE								continuation;//continuation = 0xxxxxxx
	RADIUS_VENDOR_PPAC_SUB_ATTR_AIC	aic;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_PPAC;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_STC//session termination capability
{
	BYTE		continuation;//continuation = 0xxxxxxx
	DWORD		stc;/*session termination capability  
						0x00000000	|	Reserved
						0x00000001	|	Dynamic Authorization Extensions (RFC 3576) is supported.
						...			|	All further values are reserved.*/
	
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_STC;

typedef struct _RADIUS_TLV_DECIMAL
{
	BYTE		type;
	long long		integer;
	DWORD			exponent;	//int
}__attribute__((packed)) RADIUS_TLV_DECIMAL;

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_QID
{
	BYTE				flag;
	RADIUS_TLV_TS		qid;
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_QID;//quota identifier

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_VQ
{
	BYTE					flag;
	RADIUS_TLV_DECIMAL		vq;//length = 2 + (8 or 12); value contian value-digits field 8 octets or value-digits field plus the exponent field 12 octets
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_VQ;//volume quota

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_VT
{
	BYTE					flag;
	RADIUS_TLV_DECIMAL		vt;
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_VT;//volume threshold

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_DQ
{
	BYTE				flag;
	RADIUS_TLV_AIT		dq;
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_DQ;//duration quota

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_DT
{
	BYTE				flag;
	RADIUS_TLV_AIT		dt;
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_DT;//duration threshold

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_RQ
{
	BYTE					flag;
	RADIUS_TLV_DECIMAL		rq;
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_RQ;//resource quota

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_RT
{
	BYTE					flag;
	RADIUS_TLV_DECIMAL		rt;
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_RT;//resource threshold

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_UR
{
	BYTE				flag;
	RADIUS_TLV_AIT		ur;/*	0	| Reserved
								1	| Pre-initialization
								2	| Initial Request
								3	| Threshold Reached
								4	| Quota Reached
								5	| TITSU Approaching
								6	| Remote Forced Disconnect
								7	| Client Service Termination
								8	| "Access Service" Terminated
								9	| Service not established
								10	| One-Time Charging
							11...255	| **Available for IANA registration***///length = 2 + 1
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_UR;//update reason

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_PS
{
	BYTE				flag;
	RADIUS_TLV_AIT		ps;
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_PS;//prepaid server

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_SID
{
	BYTE				flag;
	RADIUS_TLV_TS		sid;
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_SID;

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_RGID
{
	BYTE				flag;
	RADIUS_TLV_AIT		rgid;//two octets
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_RGID;

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_TA
{
	BYTE				flag;
	RADIUS_TLV_AIT		ta;/*	0	| Reserved
								1	| Terminate
								2	| Request More Quota
								3	| Redirect/Filter
							4..255     | **Available for IANA registration***///one octet
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_TA;

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_PLID
{
	BYTE				flag;
	RADIUS_TLV_AIT		plid;//one octet
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_PLID;

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_PM
{
	BYTE					flag;
	RADIUS_TLV_DECIMAL		pm;
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_PM;

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_RA
{
	BYTE				flag;
	RADIUS_TLV_AIT		ra;/*	0	| Reserved
								1	| Balance Check
								2	| Price Enquiry
							3..255	| **Available for IANA registration***///one octet
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_RA;

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_CBR
{
	BYTE				flag;
	RADIUS_TLV_AIT		cbr;/*	0	| Success; Sufficient funds available in the user's prepaid account
								1	| Failure; Insufficient funds available
							2..255	| **Available for IANA registration***///one octet
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_CBR;

typedef struct _RADIUS_VENDOR_PPAQ_SUB_ATTR_CI
{
	BYTE					flag;
	BYTE					type;
	long long					integer;
	int						exponent;
	DWORD					currency_code;
	BYTE					cost_unit[RADIUS_TS_VALUE_LEN];
}__attribute__((packed)) RADIUS_VENDOR_PPAQ_SUB_ATTR_CI;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_PPAQ
{
	BYTE									continuation;
	RADIUS_VENDOR_PPAQ_SUB_ATTR_QID		qid;//quota id type = 1
	RADIUS_VENDOR_PPAQ_SUB_ATTR_VQ		vq;//type = 2
	RADIUS_VENDOR_PPAQ_SUB_ATTR_VT		vt;//type=3
	RADIUS_VENDOR_PPAQ_SUB_ATTR_DQ		dq;//type=4
	RADIUS_VENDOR_PPAQ_SUB_ATTR_DT		dt;//type=5
	RADIUS_VENDOR_PPAQ_SUB_ATTR_RQ		rq;//type=6
	RADIUS_VENDOR_PPAQ_SUB_ATTR_RT		rt;//tyep=7
	RADIUS_VENDOR_PPAQ_SUB_ATTR_UR		ur;//type=8
	RADIUS_VENDOR_PPAQ_SUB_ATTR_PS		ps;//type=9
	RADIUS_VENDOR_PPAQ_SUB_ATTR_SID		sid;//service id type=10
	RADIUS_VENDOR_PPAQ_SUB_ATTR_RGID		rgid;//type=11
	RADIUS_VENDOR_PPAQ_SUB_ATTR_TA		ta;//type=12
	RADIUS_VENDOR_PPAQ_SUB_ATTR_PLID		plid;//pool id type=13
	RADIUS_VENDOR_PPAQ_SUB_ATTR_PM		pm;//type=14
	RADIUS_VENDOR_PPAQ_SUB_ATTR_RA		ra;//type=15
	RADIUS_VENDOR_PPAQ_SUB_ATTR_CBR		cbr;//type=16
	RADIUS_VENDOR_PPAQ_SUB_ATTR_CI		ci;//type=17
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_PPAQ;

typedef struct _RADIUS_VENDOR_PTS_SUB_ATTR_VUATS
{
	BYTE					flag;
	RADIUS_TLV_DECIMAL		vuats;
}__attribute__((packed)) RADIUS_VENDOR_PTS_SUB_ATTR_VUATS;

typedef struct _RADIUS_VENDOR_PTS_SUB_ATTR_TSI
{
	BYTE				flag;
	RADIUS_TLV_AIT		tsi;
}__attribute__((packed)) RADIUS_VENDOR_PTS_SUB_ATTR_TSI;

typedef struct _RADIUS_VENDOR_PTS_SUB_ATTR_TITSU
{
	BYTE				flag;
	RADIUS_TLV_AIT		titsu;
}__attribute__((packed)) RADIUS_VENDOR_PTS_SUB_ATTR_TITSU;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_PTS
{
	BYTE									continuation;
	RADIUS_VENDOR_PTS_SUB_ATTR_VUATS		vuats;//volume used afer tariff switch
	RADIUS_VENDOR_PTS_SUB_ATTR_TSI		tsi;//tariff switch interval
	RADIUS_VENDOR_PTS_SUB_ATTR_TITSU		titsu;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_PTS;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_IMSI
{
	BYTE		imsi[RADIUS_MAX_LEN_OF_IMSI];
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_IMSI;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_CID
{
	DWORD		cid;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_CID;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_PDP_TYPE
{
	DWORD		pdp_type;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_PDP_TYPE;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_CG_ADDR
{
	DWORD		cg_addr;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_CG_ADDR;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_NQP
{
	BYTE		nqp[RADIUS_TS_VALUE_LEN];
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_NQP;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_SGSN_ADDR
{
	DWORD		sgsn_addr;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_SGSN_ADDR;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_GGSN_ADDR
{
	DWORD		ggsn_addr;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_GGSN_ADDR;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_MCC_MNC
{
	BYTE		mcc[RADIUS_MAX_LEN_OF_MCC];
	BYTE		mnc[RADIUS_MAX_LEN_OF_MNC];
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_MCC_MNC;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_GGSN_MCC_MNC
{
	BYTE		mcc[RADIUS_MAX_LEN_OF_MCC];
	BYTE		mnc[RADIUS_MAX_LEN_OF_MNC];
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_GGSN_MCC_MNC;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_NSAPI
{
	BYTE		nsapi;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_NSAPI;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_SSI
{
	BYTE		ssi;//length=1, value=0xFF;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_SSI;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_SM
{
	BYTE		sm;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_SM;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_CC
{
	BYTE		cc[RADIUS_TS_VALUE_LEN];
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_CC;

/*typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_CG_IPV6
{
	BYTE				flag;
	
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_CG_IPV6;*/

/*typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_SGSN_IPV6
{
	BYTE				flag;
	
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_SGSN_IPV6;*/

/*typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_GGSN_IPV6
{
	BYTE				flag;
	
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_GGSN_IPV6;*/

/*typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_IPV6_DNS
{
	BYTE				flag;
	
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_IPV6_DNS;*/

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP_SGSN_MCC_MNC
{
	BYTE		mcc[RADIUS_MAX_LEN_OF_MCC];
	BYTE		mnc[RADIUS_MAX_LEN_OF_MNC];
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP_SGSN_MCC_MNC;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP2_IKE
{
	DWORD		ike;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP2_IKE;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP2_SL
{
	DWORD		sl;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP2_SL;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP2_STC
{
	DWORD		stc;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP2_STC;

typedef struct _RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_QID
{
	BYTE				flag;
	RADIUS_TLV_AIT		qid;
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_QID;//quota identifier

typedef struct _RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_VQ
{
	BYTE					flag;
	RADIUS_TLV_DECIMAL		vq;//for aricent
//	RADIUS_TLV_AIT			vq;//length = 2 + 4, 3gpp2
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_VQ;//volume quota

typedef struct _RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_VQO
{
	BYTE					flag;
//	RADIUS_TLV_DECIMAL		vqo;//for aricent
	RADIUS_TLV_AIT			vqo;//length = 2 + 2, 3gpp2
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_VQO;//volume quota overflow

typedef struct _RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_VT
{
	BYTE					flag;
	RADIUS_TLV_DECIMAL		vt;//for aricent
//	RADIUS_TLV_AIT			vt;//length = 2 + 4, 3gpp2
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_VT;//volume threshold

typedef struct _RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_VTO
{
	BYTE					flag;
//	RADIUS_TLV_DECIMAL		vto;//for aricent
	RADIUS_TLV_AIT			vto;//length = 2 + 2, 3gpp2
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_VTO;//volume threshold

typedef struct _RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_DQ
{
	BYTE				flag;
	RADIUS_TLV_AIT		dq;
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_DQ;//duration quota

typedef struct _RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_DT
{
	BYTE				flag;
	RADIUS_TLV_AIT		dt;
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_DT;//duration threshold

typedef struct _RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_UR
{
	BYTE				flag;
	RADIUS_TLV_AIT		ur;/*	0	| Reserved
								1	| Pre-initialization
								2	| Initial Request
								3	| Threshold Reached
								4	| Quota Reached
								5	| Remote Forced Disconnect
								6	| Client Service Termination
								7	| Main SC released
								8	| Service Connection not established
								9	| Tariff Switch Update
								10	| Incorrect Quota type Received
								11	| Poorly Formed Quota Attribute*///length = 2 + 2
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_UR;//update reason

typedef struct _RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_PS
{
	BYTE				flag;
	RADIUS_TLV_AIT		ps;//only support ipv4
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_PS;//prepaid server


typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP2_PPAQ
{
	RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_QID	qid;//quota id type = 1
	RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_VQ		vq;//type = 2
	RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_VQO	vqo;//type = 3
	RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_VT		vt;//type=4
	RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_VTO	vto;//type = 5
	RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_DQ		dq;//type=6
	RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_DT		dt;//type=7
	RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_UR		ur;//type=8
	RADIUS_VENDOR_3GPP2_PPAQ_SUB_ATTR_PS		ps;//type=9
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP2_PPAQ;

typedef struct _RADIUS_VENDOR_3GPP2_PPAC_SUB_ATTR_AIC
{
	BYTE			flag;
	DWORD			aic;/*	0x00000001	PrePaid Accounting for Volume supported
							0x00000002	PrePaid Accounting for Duration supported
							0x00000003	PrePaid Accounting for Volume and Duration supported (non concurrently)
							Others		Reserved, treat like Not Capable of PrePaid Accounting (=0).*/
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PPAC_SUB_ATTR_AIC;

typedef struct _RADIUS_VENDOR_3GPP2_PPAC_SUB_ATTR_SFS
{
	BYTE			flag;
	DWORD			sfs;/*	0x00000000	PrePaid Accounting not used
							0x00000001	Usage of PrePaid Accounting for Volume. (only possible if the AvailableInClient supports PrePaid Accounting for Volume)
							0x00000002	Usage of PrePaid Accounting for Duration. (only possible if the AvailableInClient supports PrePaid Accounting for Duration)
							0x00000003	Usage of PrePaid Accounting for Volume and Duration (non concurrent) (only possible if the AvailableInClient supports PrePaid Accounting for Volume and duration)
							Others		Reserved, treat like PrePaid Accounting not used (=0).*/
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PPAC_SUB_ATTR_SFS;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP2_PPAC
{
	RADIUS_VENDOR_3GPP2_PPAC_SUB_ATTR_AIC	aic;//available in client
	RADIUS_VENDOR_3GPP2_PPAC_SUB_ATTR_SFS	sfs;//select for session
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP2_PPAC;

typedef struct _RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_QID
{
	BYTE				flag;
	RADIUS_TLV_AIT		qid;
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_QID;//quota identifier

typedef struct _RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_VUATS
{
	BYTE					flag;
	RADIUS_TLV_AIT			vuats;
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_VUATS;

typedef struct _RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_VUATSO
{
	BYTE					flag;
	RADIUS_TLV_AIT			vuatso;
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_VUATSO;

typedef struct _RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_TSI
{
	BYTE					flag;
	RADIUS_TLV_AIT			tsi;
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_TSI;

typedef struct _RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_TITSU
{
	BYTE					flag;
	RADIUS_TLV_AIT			titsu;
}__attribute__((packed)) RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_TITSU;

typedef struct _RADIUS_VENDOR_ATTRIBUTE_3GPP2_PTS
{
	RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_QID		qid;
	RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_VUATS	vuats;
	RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_VUATSO	vuatso;
	RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_TSI		tsi;
	RADIUS_VENDOR_3GPP2_PTS_SUB_ATTR_TITSU	titsu;
}__attribute__((packed)) RADIUS_VENDOR_ATTRIBUTE_3GPP2_PTS;

typedef struct _RADIUS_ATTRIBUTE_VENDOR_SPECIFIC
{
	BYTE				flag;
	DWORD				vendor_id;//24757 for wimax; 10415 for 3GPP; 5535 
	BYTE				vendor_type;//(vendor id=24757 wimax :35 for PPAC; 36 for Session Termination Capability;37 for PPAQ;38 for pts)
	BYTE				vendor_length;

	union
	{
		RADIUS_VENDOR_ATTRIBUTE_PPAC				ppac;
		RADIUS_VENDOR_ATTRIBUTE_STC				stc;
		RADIUS_VENDOR_ATTRIBUTE_PPAQ				ppaq;
		RADIUS_VENDOR_ATTRIBUTE_PTS				pts;
	}attribute;

	union
	{
		RADIUS_VENDOR_ATTRIBUTE_3GPP_IMSI					imsi;
		RADIUS_VENDOR_ATTRIBUTE_3GPP_CID					charging_id;
		RADIUS_VENDOR_ATTRIBUTE_3GPP_PDP_TYPE				pdp_type;
		RADIUS_VENDOR_ATTRIBUTE_3GPP_CG_ADDR				cg_addr;
		RADIUS_VENDOR_ATTRIBUTE_3GPP_NQP					negotiated_qos;
		RADIUS_VENDOR_ATTRIBUTE_3GPP_SGSN_ADDR			sgsn_addr;
		RADIUS_VENDOR_ATTRIBUTE_3GPP_GGSN_ADDR			ggsn_addr;
		RADIUS_VENDOR_ATTRIBUTE_3GPP_MCC_MNC				mcc_mnc;
		RADIUS_VENDOR_ATTRIBUTE_3GPP_GGSN_MCC_MNC		ggsn_mcc_mnc;
		RADIUS_VENDOR_ATTRIBUTE_3GPP_NSAPI				nsapi;
		RADIUS_VENDOR_ATTRIBUTE_3GPP_SSI					ssi;
		RADIUS_VENDOR_ATTRIBUTE_3GPP_SM					sm;
		RADIUS_VENDOR_ATTRIBUTE_3GPP_CC					cc;
		RADIUS_VENDOR_ATTRIBUTE_3GPP_SGSN_MCC_MNC		sgsn_mcc_mnc;
	}attribute_3gpp;

	union
	{
//		RADIUS_VENDOR_ATTRIBUTE_3GPP2_IKE		ike;
		RADIUS_VENDOR_ATTRIBUTE_3GPP2_STC		stc;
		RADIUS_VENDOR_ATTRIBUTE_3GPP2_PPAQ	ppaq;
		RADIUS_VENDOR_ATTRIBUTE_3GPP2_PPAC	ppac;
		RADIUS_VENDOR_ATTRIBUTE_3GPP2_PTS		pts;
	}attribute_3gpp2;
}__attribute__((packed)) RADIUS_ATTRIBUTE_VENDOR_SPECIFIC;

typedef struct _RADIUS_ATTRIBUTE_SESSION_TIMEOUT
{
	BYTE				flag;
	RADIUS_TLV_AIT		session_timeout;
}__attribute__((packed)) RADIUS_ATTRIBUTE_SESSION_TIMEOUT;

typedef struct _RADIUS_ATTRIBUTE_IDLE_TIMEOUT
{
	BYTE				flag;
	RADIUS_TLV_AIT		idle_timeout;
}__attribute__((packed)) RADIUS_ATTRIBUTE_IDLE_TIMEOUT;

typedef struct _RADIUS_ATTRIBUTE_TERMINATION_ACTION
{
	BYTE				flag;
	RADIUS_TLV_AIT		termination_action;
}__attribute__((packed)) RADIUS_ATTRIBUTE_TERMINATION_ACTION;
/*
typedef struct _RADIUS_ATTRIBUTE_CALLED_STATION_ID
{
	BYTE				flag;
	RADIUS_TLV_TS		called_station_id;
}__attribute__((packed)) RADIUS_ATTRIBUTE_CALLED_STATION_ID;*/

typedef struct _RADIUS_ATTRIBUTE_CALLED_STATION_ID	// expand
{
	BYTE				option;	// 1, server; 2, client
	union
	{
		struct
		{
			BYTE			num;
			RADIUS_TLV_TS 	called_station_id[RADIUS_MAX_NUM_OF_NOWSMS_CALLED_ID];	//RADIUS_ATTRIBUTE_CALLED_STATION_ID
		}server;
		struct
		{
	//		WORD			len;
			BYTE			called_list[RADIUS_MAX_NUM_OF_NOWSMS_CALLED_LIST];
		}client;
	}called;
}__attribute__((packed)) RADIUS_ATTRIBUTE_CALLED_STATION_ID;

typedef struct _RADIUS_ATTRIBUTE_CALLING_STATION_ID
{
	BYTE				flag;
	RADIUS_TLV_TS		calling_station_id;
}__attribute__((packed)) RADIUS_ATTRIBUTE_CALLING_STATION_ID;

typedef struct _RADIUS_ATTRIBUTE_NAS_IDENTIFIER
{
	BYTE				flag;
	RADIUS_TLV_TS		nas_identifier;
}__attribute__((packed)) RADIUS_ATTRIBUTE_NAS_IDENTIFIER;

typedef struct _RADIUS_ATTRIBUTE_PROXY_STATE
{
	BYTE				flag;
	RADIUS_TLV_TS		proxy_state;
}__attribute__((packed)) RADIUS_ATTRIBUTE_PROXY_STATE;

typedef struct _RADIUS_ATTRIBUTE_LOGIN_LAT_SERVICE
{
	BYTE				flag;
	RADIUS_TLV_TS		login_lat_service;
}__attribute__((packed)) RADIUS_ATTRIBUTE_LOGIN_LAT_SERVICE;

typedef struct _RADIUS_ATTRIBUTE_LOGIN_LAT_NODE
{
	BYTE				flag;
	RADIUS_TLV_TS		login_lat_node;
}__attribute__((packed)) RADIUS_ATTRIBUTE_LOGIN_LAT_NODE;

typedef struct _RADIUS_ATTRIBUTE_LOGIN_LAT_GROUP
{
	BYTE				flag;
	RADIUS_TLV_TS		login_lat_group;
}__attribute__((packed)) RADIUS_ATTRIBUTE_LOGIN_LAT_GROUP;

typedef struct _RADIUS_ATTRIBUTE_FRAMED_APPLETALK_LINK
{
	BYTE				flag;
	RADIUS_TLV_AIT		framed_appletalk_link;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FRAMED_APPLETALK_LINK;

typedef struct _RADIUS_ATTRIBUTE_FRAMED_APPLETAKL_NETWORK
{
	BYTE				flag;
	RADIUS_TLV_AIT		framed_appletalk_network;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FRAMED_APPLETALK_NETWORK;

typedef struct _RADIUS_ATTRIBUTE_FRAMED_APPLETALK_ZONE
{
	BYTE				flag;
	RADIUS_TLV_TS		framed_appletalk_zone;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FRAMED_APPLETALK_ZONE;

typedef struct _RADIUS_ATTRIBUTE_CHAP_CHALLENGE
{
	BYTE				flag;
	RADIUS_TLV_TS		chap_challenge;
}__attribute__((packed)) RADIUS_ATTRIBUTE_CHAP_CHALLENGE;

typedef struct _RADIUS_ATTRIBUTE_NAS_PORT_TYPE
{
	BYTE				flag;
	RADIUS_TLV_AIT		nas_port_type;
}__attribute__((packed)) RADIUS_ATTRIBUTE_NAS_PORT_TYPE;

typedef struct _RADIUS_ATTRIBUTE_PORT_LIMIT
{
	BYTE				flag;
	RADIUS_TLV_AIT		port_limit;
}__attribute__((packed)) RADIUS_ATTRIBUTE_PORT_LIMIT;

typedef struct _RADIUS_ATTRIBUTE_LOGIN_LAT_PORT
{
	BYTE				flag;
	RADIUS_TLV_TS		login_lat_port;
}__attribute__((packed)) RADIUS_ATTRIBUTE_LOGIN_LAT_PORT;

typedef struct _RADIUS_ATTRIBUTE_EAP_MESSAGE
{
	BYTE				flag;
	RADIUS_TLV_TS		eap_message;
}__attribute__((packed)) RADIUS_ATTRIBUTE_EAP_MESSAGE;

typedef struct _RADIUS_ATTRIBUTE_ACCT_STATUS_TYPE
{
	BYTE				flag;
	RADIUS_TLV_AIT		acct_status_type;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_STATUS_TYPE;

typedef struct _RADIUS_ATTRIBUTE_ACCT_DELAY_TIME
{
	BYTE				flag;
	RADIUS_TLV_AIT		acct_delay_time;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_DELAY_TIME;

typedef struct _RADIUS_ATTRIBUTE_ACCT_INPUT_OCTETS
{
	BYTE				flag;
	RADIUS_TLV_AIT		acct_input_octets;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_INPUT_OCTETS;

typedef struct _RADIUS_ATTRIBUTE_ACCT_OUTPUT_OCTETS
{
	BYTE				flag;
	RADIUS_TLV_AIT		acct_output_octets;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_OUTPUT_OCTETS;

typedef struct _RADIUS_ATTRIBUTE_ACCT_SESSION_ID
{
	BYTE				flag;
	RADIUS_TLV_TS		acct_session_id;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_SESSION_ID;

typedef struct _RADIUS_ATTRIBUTE_ACCT_AUTHENTIC
{
	BYTE				flag;
	RADIUS_TLV_AIT		acct_authentic;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_AUTHENTIC;

typedef struct _RADIUS_ATTRIBUTE_ACCT_SESSION_TIME
{
	BYTE				flag;
	RADIUS_TLV_AIT		acct_session_time;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_SESSION_TIME;

typedef struct _RADIUS_ATTRIBUTE_ACCT_INPUT_PACKETS
{
	BYTE				flag;
	RADIUS_TLV_AIT		acct_input_packets;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_INPUT_PACKETS;

typedef struct _RADIUS_ATTRIBUTE_ACCT_OUTPUT_PACKETS
{
	BYTE				flag;
	RADIUS_TLV_AIT		acct_output_packets;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_OUTPUT_PACKETS;

typedef struct _RADIUS_ATTRIBUTE_ACCT_TERMINATE_CAUSE
{
	BYTE				flag;
	RADIUS_TLV_AIT		acct_terminate_cause;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_TERMINATE_CAUSE;

typedef struct _RADIUS_ATTRIBUTE_ACCT_MULTI_SESSION_ID
{
	BYTE				flag;
	RADIUS_TLV_TS		acct_multi_session_id;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_MULTI_SESSION_ID;

typedef struct _RADIUS_ATTRIBUTE_ACCT_LINK_COUNT
{
	BYTE				flag;
	RADIUS_TLV_AIT		acct_link_count;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_LINK_COUNT;

typedef struct _RADIUS_ATTRIBUTE_ACCT_INPUT_GIGAWORDS
{
	BYTE				flag;
	RADIUS_TLV_AIT		acct_input_gigawords;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_INPUT_GIGAWORDS;

typedef struct _RADIUS_ATTRIBUTE_ACCT_OUTPUT_GIGAWORDS
{
	BYTE				flag;
	RADIUS_TLV_AIT		acct_output_gigawords;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_OUTPUT_GIGAWORDS;

typedef struct _RADIUS_ATTRIBUTE_EVENT_TIMESTAMP
{
	BYTE				flag;
	RADIUS_TLV_AIT		event_timestamp;
}__attribute__((packed)) RADIUS_ATTRIBUTE_EVENT_TIMESTAMP;

typedef struct _RADIUS_ATTRIBUTE_ARAP_PASSWORD
{
	BYTE				flag;
	RADIUS_TLV_TS		arap_password;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ARAP_PASSWORD;

typedef struct _RADIUS_ATTRIBUTE_ARAP_FEATURES
{
	BYTE				flag;
	RADIUS_TLV_TS		arap_features;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ARAP_FEATURES;

typedef struct _RADIUS_ATTRIBUTE_ARAP_ZONE_ACCESS
{
	BYTE				flag;
	RADIUS_TLV_AIT		arap_zone_access;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ARAP_ZONE_ACCESS;

typedef struct _RADIUS_ATTRIBUTE_ARAP_SECURITY
{
	BYTE				flag;
	RADIUS_TLV_AIT		arap_security;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ARAP_SECURITY;

typedef struct _RADIUS_ATTRIBUTE_ARAP_SECURITY_DATA
{
	BYTE				flag;
	RADIUS_TLV_TS		arap_security_data;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ARAP_SECURITY_DATA;

typedef struct _RADIUS_ATTRIBUTE_PASSWORD_RETRY
{
	BYTE				flag;
	RADIUS_TLV_AIT		password_retry;
}__attribute__((packed)) RADIUS_ATTRIBUTE_PASSWORD_RETRY;

typedef struct _RADIUS_ATTRIBUTE_PROMPT
{
	BYTE				flag;
	RADIUS_TLV_AIT		prompt;
}__attribute__((packed)) RADIUS_ATTRIBUTE_PROMPT;

typedef struct _RADIUS_ATTRIBUTE_CONNECT_INFO
{
	BYTE				flag;
	RADIUS_TLV_TS		connect_info;
}__attribute__((packed)) RADIUS_ATTRIBUTE_CONNECT_INFO;

typedef struct _RADIUS_ATTRIBUTE_CONFIGURATION_TOKEN
{
	BYTE				flag;
	RADIUS_TLV_TS		configuration_token;
}__attribute__((packed)) RADIUS_ATTRIBUTE_CONFIGURATION_TOKEN;

typedef struct _RADIUS_ATTRIBUTE_MESSAGE_AUTHENTICATOR
{
	BYTE				flag;
	RADIUS_TLV_TS		message_authenticator;
}__attribute__((packed)) RADIUS_ATTRIBUTE_MESSAGE_AUTHENTICATOR;

typedef struct _RADIUS_ATTRIBUTE_ARAP_CHALLENGE_RESPONSE
{
	BYTE				flag;
	RADIUS_TLV_TS		arap_challenge_response;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ARAP_CHALLENGE_RESPONSE;

typedef struct _RADIUS_ATTRIBUTE_ACCT_INTERIM_INTERVAL
{
	BYTE				flag;
	RADIUS_TLV_AIT		acct_interim_interval;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ACCT_INTERIM_INTERVAL;

typedef struct _RADIUS_ATTRIBUTE_NAS_PORT_ID
{
	BYTE				flag;
	RADIUS_TLV_TS		nas_port_id;
}__attribute__((packed)) RADIUS_ATTRIBUTE_NAS_PORT_ID;

typedef struct _RADIUS_ATTRIBUTE_FRAMED_POOL
{
	BYTE				flag;
	RADIUS_TLV_TS		framed_pool;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FRAMED_POOL;

typedef struct _RADIUS_ATTRIBUTE_FRAMED_INTERFACE_ID
{
	BYTE				flag;
	RADIUS_TLV_TS		framed_interface_id;
}__attribute__((packed)) RADIUS_ATTRIBUTE_FRAMED_INTERFACE_ID;

typedef struct _RADIUS_ATTRIBUTE_ORIGINATION_LINE_INFO
{
	BYTE				flag;
	RADIUS_TLV_TS		origination_line_info;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ORIGINATING_LINE_INFO;

typedef struct _RADIUS_ATTRIBUTE_ERROR_CAUSE
{
	BYTE				flag;
	RADIUS_TLV_AIT		error_cause;
}__attribute__((packed)) RADIUS_ATTRIBUTE_ERROR_CAUSE;


typedef struct _RADIUS_ATTRIBUTE_NOWSMS_PREAUTH_TYPE
{
	BYTE				flag;
//	BYTE				type;
//	RADIUS_TLV_TS		pre_auth_type;
	RADIUS_TLV_AIT		pre_auth_type;
}__attribute__((packed)) RADIUS_ATTRIBUTE_NOWSMS_PREAUTH_TYPE;

typedef struct _RADIUS_ATTRIBUTE_NOWSMS_MSG_COUNT
{
	BYTE				flag;
	RADIUS_TLV_AIT		msg_count;
}__attribute__((packed)) RADIUS_ATTRIBUTE_NOWSMS_MSG_COUNT;
typedef struct _RADIUS_ATTRIBUTE_NOWSMS_MSG_ID
{
	BYTE				flag;
	RADIUS_TLV_AIT		msg_id;
}__attribute__((packed)) RADIUS_ATTRIBUTE_NOWSMS_MSG_ID;
typedef struct _RADIUS_ATTRIBUTE_NOWSMS_SIZE
{
	BYTE				flag;
	RADIUS_TLV_AIT		size;
}__attribute__((packed)) RADIUS_ATTRIBUTE_NOWSMS_SIZE;
typedef struct _RADIUS_ATTRIBUTE_NOWSMS_COUNT_ID_SIZE	//nowsms
{
	BYTE				flag;
	BYTE				type;
//	BYTE				length;
	RADIUS_ATTRIBUTE_NOWSMS_MSG_COUNT	msg_count;
	RADIUS_ATTRIBUTE_NOWSMS_MSG_ID		msg_id;
	RADIUS_ATTRIBUTE_NOWSMS_SIZE			size;
}__attribute__((packed)) RADIUS_ATTRIBUTE_NOWSMS_COUNT_ID_SIZE;


typedef struct _RADIUS_FRAMED_COMPRESSION
{
	BYTE										num;
	RADIUS_ATTRIBUTE_FRAMED_COMPRESSION		framed_compression[RADIUS_MAX_NUM_OF_FRAMED_COMPRESSION];
}__attribute__((packed)) RADIUS_FRAMED_COMPRESSION;

typedef struct _RADIUS_LOGIN_IP_HOST
{
	BYTE								num;
	RADIUS_ATTRIBUTE_LOGIN_IP_HOST		login_ip_host[RADIUS_MAX_NUM_OF_LOGIN_IP_HOST];
}__attribute__((packed)) RADIUS_LOGIN_IP_HOST;

typedef struct _RADIUS_VENDOR_SPECIFIC
{
	BYTE								num;
	RADIUS_ATTRIBUTE_VENDOR_SPECIFIC	vendor_specific[RADIUS_MAX_NUM_OF_VENDOR_SPECIFIC];
}__attribute__((packed)) RADIUS_VENDOR_SPECIFIC;

typedef struct _RADIUS_PROXY_STATE
{
	BYTE								num;
	RADIUS_ATTRIBUTE_PROXY_STATE		proxy_state[RADIUS_MAX_NUM_OF_PROXY_STATE];
}__attribute__((packed)) RADIUS_PROXY_STATE;

typedef struct _RADIUS_FILTER_ID
{
	BYTE							num;
	RADIUS_ATTRIBUTE_FILTER_ID		filter_id[RADIUS_MAX_NUM_OF_FILTER_ID];
}__attribute__((packed)) RADIUS_FILTER_ID;

typedef struct _RADIUS_REPLY_MESSAGE
{
	BYTE								num;
	RADIUS_ATTRIBUTE_REPLY_MESSAGE		reply_message[RADIUS_MAX_NUM_OF_REPLY_MESSAGE];
}__attribute__((packed)) RADIUS_REPLY_MESSAGE;

typedef struct _RADIUS_FRAMED_ROUTE
{
	BYTE								num;
	RADIUS_ATTRIBUTE_FRAMED_ROUTE		framed_route[RADIUS_MAX_NUM_OF_FRAMED_ROUTE];
}__attribute__((packed)) RADIUS_FRAMED_ROUTE;

typedef struct _RADIUS_CLASS
{
	BYTE						num;
	RADIUS_ATTRIBUTE_CLASS		radius_class[RADIUS_MAX_NUM_OF_CLASS];
}__attribute__((packed)) RADIUS_CLASS;

typedef struct _RADIUS_FRAMED_APPLETALK_NETWORK
{
	BYTE											num;
	RADIUS_ATTRIBUTE_FRAMED_APPLETALK_NETWORK	framed_appletalk_network[RADIUS_MAX_NUM_OF_FRAMED_APPLETALK_NETWORK];
}__attribute__((packed)) RADIUS_FRAMED_APPLETALK_NETWORK;

typedef struct _RADIUS_ACCT_MULTI_SESSION_ID
{
	BYTE										num;
	RADIUS_ATTRIBUTE_ACCT_MULTI_SESSION_ID	acct_multi_session_id[RADIUS_MAX_NUM_OF_ACCT_MULTI_SESSION_ID];
}__attribute__((packed)) RADIUS_ACCT_MULTI_SESSION_ID;

typedef struct _RADIUS_ACCT_LINK_COUNT
{
	BYTE									num;
	RADIUS_ATTRIBUTE_ACCT_LINK_COUNT		acct_link_count[RADIUS_MAX_NUM_OF_ACCT_LINK_COUNT];
}__attribute__((packed)) RADIUS_ACCT_LINK_COUNT;

typedef struct _RADIUS_EAP_MESSAGE
{
	BYTE								num;
	RADIUS_ATTRIBUTE_EAP_MESSAGE		eap_message[RADIUS_MAX_NUM_OF_EAP_MESSAGE];
}__attribute__((packed)) RADIUS_EAP_MESSAGE;

typedef struct _RADIUS_ARAP_SECURITY_DATA
{
	BYTE									num;
	RADIUS_ATTRIBUTE_ARAP_SECURITY_DATA	arap_security_data[RADIUS_MAX_NUM_OF_ARAP_SECURITY_DATA];	
}__attribute__((packed)) RADIUS_ARAP_SECURITY_DATA;

typedef struct _RADIUS_CONFIGURATION_TOKEN
{
	BYTE										num;
	RADIUS_ATTRIBUTE_CONFIGURATION_TOKEN		configuration_token[RADIUS_MAX_NUM_OF_CONFIGURATION_TOKEN];
}__attribute__((packed)) RADIUS_CONFIGURATION_TOKEN;

typedef struct _RADIUS_ERROR_CAUSE
{
	BYTE										num;
	RADIUS_ATTRIBUTE_ERROR_CAUSE				error_cause[RADIUS_MAX_NUM_OF_ERROR_CAUSE];
}__attribute__((packed)) RADIUS_ERROR_CAUSE;


typedef struct _RADIUS_ACCESS_REQUEST
{
	BYTE			secret[RADIUS_MAX_LEN_OF_SHARE_KEY];

	RADIUS_ATTRIBUTE_USER_NAME					user_name;
	RADIUS_ATTRIBUTE_USER_PASSWORD			user_password;//An Access-Request MUST NOT contain both a User-Password and a CHAP-Password
	RADIUS_ATTRIBUTE_CHAP_PASSWORD			chap_password;//An Access-Request MUST NOT contain both a User-Password and a CHAP-Password
	RADIUS_ATTRIBUTE_NAS_IP_ADDRESS			nas_ip_addr;//An Access-Request MUST contain either a NAS-IP-Address or a NAS-Identifier (or both)
	RADIUS_ATTRIBUTE_NAS_PORT					nas_port;
	RADIUS_ATTRIBUTE_SERVICE_TYPE				service_type;
	RADIUS_ATTRIBUTE_FRAMED_PROTOCOL			framed_protocol;
	RADIUS_ATTRIBUTE_FRAMED_IP_ADDR			framed_ip_addr;
	RADIUS_ATTRIBUTE_FRAMED_IP_NETMASK		framed_ip_netmask;
	RADIUS_ATTRIBUTE_FRAMED_MTU				framed_mtu;
	RADIUS_FRAMED_COMPRESSION					framed_compression;
	RADIUS_LOGIN_IP_HOST						login_ip_host;
	RADIUS_ATTRIBUTE_CALLBACK_NUMBER			callback_number;
	RADIUS_ATTRIBUTE_STATE						state;
	RADIUS_VENDOR_SPECIFIC						vendor_specific;
	RADIUS_ATTRIBUTE_CALLED_STATION_ID			called_station_id;
	RADIUS_ATTRIBUTE_CALLING_STATION_ID		calling_station_id;
	RADIUS_ATTRIBUTE_NAS_IDENTIFIER				nas_identifier;//An Access-Request MUST contain either a NAS-IP-Address or a NAS-Identifier (or both)
	RADIUS_PROXY_STATE							proxy_state;
	RADIUS_ATTRIBUTE_LOGIN_LAT_SERVICE			login_lat_service;
	RADIUS_ATTRIBUTE_LOGIN_LAT_NODE			login_lat_node;
	RADIUS_ATTRIBUTE_LOGIN_LAT_GROUP			login_lat_group;
	RADIUS_ATTRIBUTE_CHAP_CHALLENGE			chap_challenge;//not support to encode
	RADIUS_ATTRIBUTE_NAS_PORT_TYPE				nas_port_type;
	RADIUS_ATTRIBUTE_PORT_LIMIT					port_limit;
	RADIUS_ATTRIBUTE_LOGIN_LAT_PORT			login_lat_port;
	RADIUS_ATTRIBUTE_ACCT_SESSION_ID		acct_session_id;
	RADIUS_ATTRIBUTE_ARAP_PASSWORD			arap_password;//not support to encode
	RADIUS_ATTRIBUTE_ARAP_SECURITY				arap_security;//not support to encode
	RADIUS_ARAP_SECURITY_DATA					arap_security_data;//not support to encode
	RADIUS_ATTRIBUTE_CONNECT_INFO				connect_info;
	RADIUS_EAP_MESSAGE							eap_message;
	RADIUS_ATTRIBUTE_MESSAGE_AUTHENTICATOR	message_authenticator;
	RADIUS_ATTRIBUTE_NAS_PORT_ID				nas_port_id;
	RADIUS_ATTRIBUTE_NOWSMS_PREAUTH_TYPE		pre_auth_type;	//nowsms
	RADIUS_ATTRIBUTE_NOWSMS_COUNT_ID_SIZE	count_id_size;	//nowsms
}__attribute__((packed)) RADIUS_ACCESS_REQUEST;

typedef struct _RADIUS_ACCESS_ACCEPT
{
	RADIUS_ATTRIBUTE_USER_NAME					user_name;
	RADIUS_ATTRIBUTE_SERVICE_TYPE				service_type;
	RADIUS_ATTRIBUTE_FRAMED_PROTOCOL			framed_protocol;
	RADIUS_ATTRIBUTE_FRAMED_IP_ADDR			framed_ip_addr;
	RADIUS_ATTRIBUTE_FRAMED_IP_NETMASK		framed_ip_netmask;
	RADIUS_ATTRIBUTE_FRAMED_ROUTING			framed_routing;
	RADIUS_FILTER_ID							filter_id;
	RADIUS_ATTRIBUTE_FRAMED_MTU				framed_mtu;
	RADIUS_FRAMED_COMPRESSION					framed_compression;
	RADIUS_LOGIN_IP_HOST						login_ip_host;
	RADIUS_ATTRIBUTE_LOGIN_SERVICE				login_service;
	RADIUS_ATTRIBUTE_LOGIN_TCP_PORT			login_tcp_port;
	RADIUS_REPLY_MESSAGE						reply_message;
	RADIUS_ATTRIBUTE_CALLBACK_NUMBER			callback_number;
	RADIUS_ATTRIBUTE_CALLBACK_ID				callback_id;
	RADIUS_FRAMED_ROUTE						framed_route;
	RADIUS_ATTRIBUTE_FRAMED_IPX_NETWORK		framed_ipx_network;
	RADIUS_ATTRIBUTE_STATE						state;
	RADIUS_CLASS								radius_class;
	RADIUS_VENDOR_SPECIFIC						vendor_specific;
	RADIUS_ATTRIBUTE_SESSION_TIMEOUT			session_timeout;
	RADIUS_ATTRIBUTE_IDLE_TIMEOUT				idle_timeout;
	RADIUS_ATTRIBUTE_TERMINATION_ACTION		termination_action;
	RADIUS_PROXY_STATE							proxy_state;
	RADIUS_ATTRIBUTE_LOGIN_LAT_SERVICE			login_lat_service;
	RADIUS_ATTRIBUTE_LOGIN_LAT_NODE			login_lat_node;
	RADIUS_ATTRIBUTE_LOGIN_LAT_GROUP			login_lat_group;
	RADIUS_ATTRIBUTE_FRAMED_APPLETALK_LINK		framed_appletalk_link;
	RADIUS_FRAMED_APPLETALK_NETWORK			framed_appletalk_network;
	RADIUS_ATTRIBUTE_FRAMED_APPLETALK_ZONE	framed_appletalk_zone;
	RADIUS_ATTRIBUTE_PORT_LIMIT					port_limit;
	RADIUS_ATTRIBUTE_LOGIN_LAT_PORT			login_lat_port;
	RADIUS_ATTRIBUTE_ARAP_FEATURES				arap_features;//not support to encode
	RADIUS_ATTRIBUTE_ARAP_ZONE_ACCESS			arap_zone_access;//not support to encode
	RADIUS_CONFIGURATION_TOKEN				configuration_token;
	RADIUS_EAP_MESSAGE							eap_message;
	RADIUS_ATTRIBUTE_MESSAGE_AUTHENTICATOR	message_authenticator;
	RADIUS_ATTRIBUTE_ARAP_CHALLENGE_RESPONSE	arap_challenge_response;//not support to encode
	RADIUS_ATTRIBUTE_ACCT_INTERIM_INTERVAL		acct_interim_interval;
	RADIUS_ATTRIBUTE_FRAMED_POOL				framed_pool;
}__attribute__((packed)) RADIUS_ACCESS_ACCEPT;

typedef struct _RADIUS_ACCESS_REJECT
{
	RADIUS_REPLY_MESSAGE						reply_message;
	RADIUS_PROXY_STATE							proxy_state;
	RADIUS_ATTRIBUTE_PASSWORD_RETRY			password_retry;
	RADIUS_EAP_MESSAGE							eap_message;
	RADIUS_ATTRIBUTE_MESSAGE_AUTHENTICATOR	message_authenticator;
}__attribute__((packed)) RADIUS_ACCESS_REJECT;

typedef struct _RADIUS_ACCESS_CHALLENGE
{
	RADIUS_REPLY_MESSAGE						reply_message;
	RADIUS_ATTRIBUTE_STATE						state;
	RADIUS_VENDOR_SPECIFIC						vendor_specific;
	RADIUS_ATTRIBUTE_SESSION_TIMEOUT			session_timeout;
	RADIUS_ATTRIBUTE_IDLE_TIMEOUT				idle_timeout;
	RADIUS_PROXY_STATE							proxy_state;
	RADIUS_ATTRIBUTE_ARAP_FEATURES				arap_features;
	RADIUS_ATTRIBUTE_ARAP_SECURITY				arap_security;//not support to encode
	RADIUS_ARAP_SECURITY_DATA					arap_security_data;//not support to encode
	RADIUS_ATTRIBUTE_PROMPT					prompt;
	RADIUS_EAP_MESSAGE							eap_message;
	RADIUS_ATTRIBUTE_MESSAGE_AUTHENTICATOR	message_authenticator;
	RADIUS_ATTRIBUTE_ARAP_CHALLENGE_RESPONSE	arap_challenge_response;
}__attribute__((packed)) RADIUS_ACCESS_CHALLENGE;

typedef struct _RADIUS_ACCOUNTING_REQUEST
{
	RADIUS_ATTRIBUTE_USER_NAME					user_name;
	RADIUS_ATTRIBUTE_NAS_IP_ADDRESS			nas_ip_addr;//An Access-Request MUST contain either a NAS-IP-Address or a NAS-Identifier (or both)
	RADIUS_ATTRIBUTE_NAS_PORT					nas_port;
	RADIUS_ATTRIBUTE_SERVICE_TYPE				service_type;
	RADIUS_ATTRIBUTE_FRAMED_PROTOCOL			framed_protocol;
	RADIUS_ATTRIBUTE_FRAMED_IP_ADDR			framed_ip_addr;
	RADIUS_ATTRIBUTE_FRAMED_IP_NETMASK		framed_ip_netmask;
	RADIUS_ATTRIBUTE_FRAMED_ROUTING			framed_routing;
	RADIUS_FILTER_ID							filter_id;
	RADIUS_ATTRIBUTE_FRAMED_MTU				framed_mtu;
	RADIUS_FRAMED_COMPRESSION					framed_compression;
	RADIUS_LOGIN_IP_HOST						login_ip_host;
	RADIUS_ATTRIBUTE_LOGIN_SERVICE				login_service;
	RADIUS_ATTRIBUTE_LOGIN_TCP_PORT			login_tcp_port;
	RADIUS_ATTRIBUTE_CALLBACK_NUMBER			callback_number;
	RADIUS_ATTRIBUTE_CALLBACK_ID				callback_id;
	RADIUS_FRAMED_ROUTE						framed_route;
	RADIUS_ATTRIBUTE_FRAMED_IPX_NETWORK		framed_ipx_network;
	RADIUS_CLASS								radius_class;
	RADIUS_VENDOR_SPECIFIC						vendor_specific;
	RADIUS_ATTRIBUTE_SESSION_TIMEOUT			session_timeout;
	RADIUS_ATTRIBUTE_IDLE_TIMEOUT				idle_timeout;
	RADIUS_ATTRIBUTE_TERMINATION_ACTION		termination_action;
	RADIUS_ATTRIBUTE_CALLED_STATION_ID			called_station_id;
	RADIUS_ATTRIBUTE_CALLING_STATION_ID		calling_station_id;
	RADIUS_ATTRIBUTE_NAS_IDENTIFIER				nas_identifier;//An Access-Request MUST contain either a NAS-IP-Address or a NAS-Identifier (or both)
	RADIUS_PROXY_STATE							proxy_state;
	RADIUS_ATTRIBUTE_LOGIN_LAT_SERVICE			login_lat_service;
	RADIUS_ATTRIBUTE_LOGIN_LAT_NODE			login_lat_node;
	RADIUS_ATTRIBUTE_LOGIN_LAT_GROUP			login_lat_group;
	RADIUS_ATTRIBUTE_FRAMED_APPLETALK_LINK		framed_appletalk_link;
	RADIUS_FRAMED_APPLETALK_NETWORK			framed_appletalk_network;
	RADIUS_ATTRIBUTE_FRAMED_APPLETALK_ZONE	framed_appletalk_zone;
	RADIUS_ATTRIBUTE_ACCT_STATUS_TYPE			acct_status_type;
	RADIUS_ATTRIBUTE_ACCT_DELAY_TIME			acct_delay_time;
	RADIUS_ATTRIBUTE_ACCT_INPUT_OCTETS		acct_input_octets;
	RADIUS_ATTRIBUTE_ACCT_OUTPUT_OCTETS		acct_output_octets;
	RADIUS_ATTRIBUTE_ACCT_SESSION_ID			acct_session_id;
	RADIUS_ATTRIBUTE_ACCT_AUTHENTIC			acct_authentic;
	RADIUS_ATTRIBUTE_ACCT_SESSION_TIME		acct_session_time;
	RADIUS_ATTRIBUTE_ACCT_INPUT_PACKETS		acct_input_packets;
	RADIUS_ATTRIBUTE_ACCT_OUTPUT_PACKETS		acct_output_packets;
	RADIUS_ATTRIBUTE_ACCT_TERMINATE_CAUSE		acct_terminate_cause;
	RADIUS_ACCT_MULTI_SESSION_ID				acct_multi_session_id;
	RADIUS_ACCT_LINK_COUNT					acct_link_count;
	RADIUS_ATTRIBUTE_NAS_PORT_TYPE				nas_port_type;
	RADIUS_ATTRIBUTE_PORT_LIMIT					port_limit;
	RADIUS_ATTRIBUTE_LOGIN_LAT_PORT			login_lat_port;
}__attribute__((packed)) RADIUS_ACCOUNTING_REQUEST;

typedef struct _RADIUS_ACCOUNTING_RESPONSE
{
	RADIUS_VENDOR_SPECIFIC						vendor_specific;
	RADIUS_PROXY_STATE							proxy_state;
}__attribute__((packed)) RADIUS_ACCOUNTING_RESPONSE;

typedef struct _RADIUS_DISCONNECT_REQUEST
{
	RADIUS_ATTRIBUTE_USER_NAME					user_name;
	RADIUS_ATTRIBUTE_NAS_IP_ADDRESS			nas_ip_addr;
	RADIUS_ATTRIBUTE_NAS_PORT					nas_port;
	RADIUS_ATTRIBUTE_SERVICE_TYPE				service_type;
	RADIUS_ATTRIBUTE_FRAMED_IP_ADDR			framed_ip_addr;
	RADIUS_REPLY_MESSAGE						reply_message;
	RADIUS_ATTRIBUTE_STATE						state;
	RADIUS_CLASS								radius_class;
	RADIUS_VENDOR_SPECIFIC						vendor_specific;
	RADIUS_ATTRIBUTE_CALLED_STATION_ID			called_station_id;
	RADIUS_ATTRIBUTE_CALLING_STATION_ID		calling_station_id;
	RADIUS_ATTRIBUTE_NAS_IDENTIFIER				nas_identifier;
	RADIUS_PROXY_STATE							prxoy_state;
	RADIUS_ATTRIBUTE_ACCT_SESSION_ID			acct_session_id;
	RADIUS_ATTRIBUTE_ACCT_TERMINATE_CAUSE		acct_terminate_cause;
	RADIUS_ATTRIBUTE_ACCT_MULTI_SESSION_ID	acct_multi_session_id;
	RADIUS_ATTRIBUTE_EVENT_TIMESTAMP			event_timestamp;
	RADIUS_ATTRIBUTE_NAS_PORT_TYPE				nas_port_type;
	RADIUS_EAP_MESSAGE							eap_message;
	RADIUS_ATTRIBUTE_MESSAGE_AUTHENTICATOR	message_authenticator;
	RADIUS_ATTRIBUTE_NAS_PORT_ID				nas_port_id;
	RADIUS_ATTRIBUTE_ORIGINATING_LINE_INFO		originating_line_info;//not support to encode
	RADIUS_ATTRIBUTE_FRAMED_INTERFACE_ID		framed_interface_id;//not support to encode
//	RADIUS_ATTRIBUTE_NAS_IPV6_ADDR			nas_ipv6_addr;//not support to encode
//	RADIUS_ATTRIBUTE_FRAMED_IPV6_PREFIX		framed_ipv6_prefix;//not support to encode
}__attribute__((packed)) RADIUS_DISCONNECT_REQUEST;

typedef struct _RADIUS_DISCONNECT_ACK
{
	RADIUS_ATTRIBUTE_STATE						state;
	RADIUS_PROXY_STATE							proxy_state;
	RADIUS_ATTRIBUTE_ACCT_TERMINATE_CAUSE		acct_terminate_cause;
	RADIUS_ATTRIBUTE_EVENT_TIMESTAMP			event_timestamp;
	RADIUS_ATTRIBUTE_EAP_MESSAGE				eap_message;
	RADIUS_ATTRIBUTE_MESSAGE_AUTHENTICATOR	message_authenticator;
	RADIUS_ERROR_CAUSE						error_cause;
}__attribute__((packed)) RADIUS_DISCONNECT_ACK;

typedef struct _RADIUS_DISCONNECT_NAK
{
	RADIUS_ATTRIBUTE_SERVICE_TYPE				service_type;
	RADIUS_ATTRIBUTE_STATE						state;
	RADIUS_PROXY_STATE							proxy_state;
	RADIUS_ATTRIBUTE_EVENT_TIMESTAMP			event_timestamp;
	RADIUS_ATTRIBUTE_MESSAGE_AUTHENTICATOR	message_authenticator;
	RADIUS_ERROR_CAUSE						error_cause;
}__attribute__((packed)) RADIUS_DISCONNECT_NAK;

typedef struct _RADIUS_ADDR
{
	WORD	port;
	union
	{
		DWORD	ipV4;
		DWORD	ipV6[4];
	}addr;
}__attribute__((packed)) RADIUS_ADDR;

typedef struct _RADIUS_PID
{
	BYTE			flag;

	BYTE			sap_index;

	BYTE			type;//indcation or request
	BYTE			state;

	BYTE			rv_msg_flag;//recv msg or not
	
	BYTE			trans_req_msg_type;//request msg type of process transaction

	BYTE			identifier;
	BYTE			authenticator[RADIUS_MAX_LEN_OF_AUTH];//store request or indication authenticator

	BYTE			sd_msg_flag;

	BYTE			nas_id;
	RADIUS_ADDR	peer_addr;

	BYTE			sd_msg_type;
	WORD			msg_len;
	BYTE			msg[RADIUS_MAX_LEN_OF_MSG];

	WORD			usr_pid;

	WORD			timer;
}__attribute__((packed)) RADIUS_PID;

typedef struct _RADIUS_MSG
{
	BYTE			msg_type;

	union
	{
		RADIUS_ACCESS_REQUEST			access_request;
		RADIUS_ACCESS_ACCEPT			access_accept;
		RADIUS_ACCESS_REJECT			access_reject;
		RADIUS_ACCESS_CHALLENGE		access_challenge;
		RADIUS_ACCOUNTING_REQUEST		accounting_request;
		RADIUS_ACCOUNTING_RESPONSE	accounting_response;
		RADIUS_DISCONNECT_REQUEST		disconnect_request;
		RADIUS_DISCONNECT_ACK			disconnect_ack;
		RADIUS_DISCONNECT_NAK			disconnect_nak;
	}msg;
}__attribute__((packed)) RADIUS_MSG;

typedef struct _RADIUS_ATTR_PARSE_FUNCTION
{
	int	 (*parse_function)(RADIUS_MSG *, const BYTE *, BYTE);
}__attribute__((packed)) RADIUS_ATTR_PARSE_FUNCTION;

typedef struct _RADIUS_SAP
{
	char		name[RADIUS_MAX_LEN_OF_USER_NAME];

	int		(*radius_ind)(WORD *usr_pid, WORD pid, RADIUS_MSG *msg_pdu);

	int		(*radius_cnf)(WORD usr_pid, WORD pid, RADIUS_MSG *msg_pdu);
}__attribute__((packed)) RADIUS_SAP;

typedef struct _RADIUS_ENCRYPT_USER_PASSWORD_CONTEXT
{
	DWORD	i[2];

	BYTE	result[RADIUS_MAX_LEN_OF_RESULT];

	BYTE	in[RADIUS_MAX_LEN_OF_IN];

	BYTE	count;
	int		result_len;
}__attribute__((packed)) RADIUS_ENCRYPT_USER_PASSWORD_CONTEXT;

typedef struct _RADIUS_NAS_INFO
{
	BYTE		flag;

	BYTE		sap_index;

	DWORD		nas_ip;
	BYTE		share_key[RADIUS_MAX_LEN_OF_SHARE_KEY];
	BYTE		password[RADIUS_MAX_LEN_OF_PASSWORD];
}__attribute__((packed)) RADIUS_NAS_INFO;

#endif

