/*	HLR CDMA cdr structure 				*/
/*	Created by daniel:2005-06-21		*/
/*	Modify  by daniel:2005-06-21		*/
/*	--------------------------------	*/

#define	DMHPAR_ASWID	0
#define	DMHPAR_AUDSN	1
#define	DMHPAR_AUDSUB	2
#define	DMHPAR_BIN		6
#define	DMHPAR_BILLIND	7
#define	DMHPAR_CDDGTS	8
#define DMHPAR_CDLOC	9
#define	DMHPAR_CGDGTS	10
#define DMHPAR_CGLOC	11
#define	DMHPAR_CHRGAMT	12
#define	DMHPAR_CNVDUR	13
#define	DMHPAR_CNVUSG	14
#define DMHPAR_DATE		15
#define DMHPAR_DIALDGTS	16
#define DMHPAR_DUR		17
#define DMHPAR_IDSUB	18
#define DMHPAR_LNUM		19
#define DMHPAR_MODIND	20
#define DMHPAR_OSWID	21
#define DMHPAR_RLEG		22
#define DMHPAR_SEGNUM	23
#define DMHPAR_SSWID	24
#define DMHPAR_SWNO		25
#define DMHPAR_SID		26
#define DMHPAR_TOD		27
#define DMHPAR_TKNUM	29
#define DMHPAR_ACTIND	32
#define DMHPAR_AJCKT	33
#define DMHPAR_ACTSUB	34
#define DMHPAR_ACHDUR	37
#define DMHPAR_ACHUSG	38
#define DMHPAR_AIRSSUB	39
#define DMHPAR_AUTHCNT	42
#define DMHPAR_AUTHDEN	43
#define DMHPAR_AUTHTYP	44
#define	DMHPAR_CJCKT	47
#define	DMHPAR_CELLID	49
#define	DMHPAR_CHRGIND	50
#define	DMHPAR_CHRGSUB	51
#define	DMHPAR_CHRGTAX	52
#define	DMHPAR_CHRGTIND	53
#define	DMHPAR_CHRGUNIT	54
#define	DMHPAR_DENACC	56
#define	DMHPAR_DESTDGTS	57
#define	DMHPAR_ESN		58
#define	DMHPAR_EVTIND	60
#define	DMHPAR_FPARM	61
#define	DMHPAR_FBDUR	62
#define	DMHPAR_FBIND	64
#define DMHPAR_FBUSG	65
#define	DMHPAR_FEATIND	66
#define	DMHPAR_FEATOPN	67
#define	DMHPAR_FRIND	68
#define DMHPAR_HCOORD	69
#define DMHPAR_HSWID	70
#define	DMHPAR_IECCDUR	71
#define	DMHPAR_INCDUR	73
#define	DMHPAR_INCUSG	74
#define	DMHPAR_LLIND	78
#define	DMHPAR_LJCKT	81
#define	DMHPAR_MIN		84
#define	DMHPAR_MRPI		85
#define DMHPAR_NPANXX	86
#define	DMHPAR_NUMACT	87
#define	DMHPAR_NUMCHRG	89
#define	DMHPAR_NUMEVT	90
#define	DMHPAR_NUMLEG	91
#define	DMHPAR_NUMSEG	93
#define	DMHPAR_OLSUB	94
#define	DMHPAR_OGTDUR	95
#define	DMHPAR_OGTUSG	96
#define	DMHPAR_PLNAM	97
#define	DMHPAR_RCHNUM	99
#define	DMHPAR_RPI		100
#define	DMHPAR_REDIND	101
#define	DMHPAR_RLSUB	102
#define	DMHPAR_RBIN		103
#define	DMHPAR_RELIND	104
#define	DMHPAR_RIN		106
#define	DMHPAR_SRT		109
#define	DMHPAR_SJCKT	110
#define	DMHPAR_SPNAM	112
#define	DMHPAR_TSSUB	113
#define	DMHPAR_TSWID	114
#define	DMHPAR_TLSUB	115
#define	DMHPAR_TDO		116
#define	DMHPAR_TTIND	117
#define DMHPAR_VCOORD	118
#define	DMHPAR_BINR		128
#define	DMHPAR_BRI		129
#define DMHPAR_EJCKT	142
#define DMHPAR_EVTSUB	143
#define DMHPAR_FALSUB	146
#define DMHPAR_PACAIND	150
#define DMHPAR_PACASUB	151
#define DMHPAR_AUXLSUB	161
#define DMHPAR_IMEI		165
#define DMHPAR_IMSI		166
#define DMHPAR_LATA		167
#define DMHPAR_NUMOCT	168
#define DMHPAR_NUMPKT	169
#define DMHPAR_TEXIND	170
#define DMHPAR_CHRGTCOD	171
#define DMHPAR_CHRGTTBL	172
#define DMHPAR_FILLIND	178
#define DMHPAR_FILLIC	179
#define DMHPAR_MDN		184
#define DMHPAR_NEICLNP	186
#define DMHPAR_NUMFAL	188
#define DMHPAR_NUMRED	189
#define DMHPAR_NUMORG	190
#define DMHPAR_NUMTRM	191
#define DMHPAR_SELUSE	193
#define DMHPAR_SUCOD	194
#define DMHPAR_MYTYP	196
#define DMHPAR_NUMAUX	199
#define DMHPAR_NEIIP	200
#define DMHPAR_IWFDUR	202
#define DMHPAR_RETIND	207
#define DMHPAR_RICODE	208
#define DMHPAR_RSEG		209
#define DMHPAR_WCNTRY	214

#define EVTIND_authorizationGranted				1
#define EVTIND_authorizationExpired				2
#define EVTIND_authorizationDenied				3
#define EVTIND_securityViolationReport			4
#define EVTIND_inactive							5
#define EVTIND_deregistration					6
#define EVTIND_registrationCanceled				7
#define EVTIND_profileUpdated					8
#define EVTIND_qualificationUpdated				9
#define EVTIND_terminationDeniedInvalid			10
#define EVTIND_terminationDeniedUnassigned		11
#define EVTIND_terminationDeniedInactive		12
#define EVTIND_terminationDeniedUnregistered	13
#define EVTIND_terminationDeniedNoPageResponse	14
#define EVTIND_terminationDeniedBusy			15
#define EVTIND_terminationDeniedSCA				16
#define EVTIND_terminationDeniedDND				17
#define EVTIND_terminationDeniedCD				18
#define EVTIND_terminationDeniedCS				19
#define EVTIND_terminationDeniedOther			20
#define EVTIND_callDelivered					21
#define EVTIND_callForwarded					22
#define EVTIND_callForwardingNotification		23
#define EVTIND_messageWaitingNotification		24
#define EVTIND_originationDeniedNoTrunk			25
#define EVTIND_originationDeniedUnrecognized	26
#define EVTIND_originationDeniedCB				27
#define EVTIND_originationDeniedOther			28
#define EVTIND_unspecifiedHourlyEvent			29
#define EVTIND_unspecifiedDailyEvent			30
#define EVTIND_unspecifiedWeeklyEvent			31
#define EVTIND_unspecifiedMonthlyEvent			32
#define EVTIND_unspecifiedQuarterlyEvent		33
#define EVTIND_unspecifiedSemi_annualEvent		34
#define EVTIND_unspecifiedAnnualEvent			35
#define EVTIND_featureAccessAttempted			36
#define EVTIND_SMSMO							37
#define EVTIND_SMSMT							38
#define EVTIND_SMSNOT							39

#define ACTIND_unspecified						0
#define ACTIND_locallyDeniedRegistration		1
#define ACTIND_homeDeniedRegistration			2
#define ACTIND_powerOnRegistration				3
#define ACTIND_autonomousRegistration			4
#define ACTIND_missedAutonomousRegistration		5
#define ACTIND_movementRegistration				6
#define ACTIND_movementDetected					7
#define ACTIND_powerDownDeregistration			8
#define ACTIND_pageResponse						0
#define ACTIND_noPageResponse					10
#define ACTIND_messageWaiting					11
#define ACTIND_abbreviatedAlert					12
#define ACTIND_alert							13
#define ACTIND_alertWithInformation				14
#define ACTIND_alertingAnswered					15
#define ACTIND_pACARequest						16
#define ACTIND_originationRequest				17
#define ACTIND_flashRequestWithoutInformation	18
#define ACTIND_flashRequestWithInformation		19
#define ACTIND_callModeChanged					20
#define ACTIND_lostRadioContact					21
#define ACTIND_measurementRequest				22
#define ACTIND_mAHORequest						23
#define ACTIND_intraSystemHandoff				24
#define ACTIND_interSystemHandoff				25
#define ACTIND_powerControlProblem				26
#define ACTIND_protocolError					27
#define ACTIND_spuriousEmissions				28
#define ACTIND_orderedRegistration				29
#define ACTIND_trafficChannelRegistration		30
#define ACTIND_dataBurst_ShortMessage			31
#define ACTIND_featureNotification				32
#define ACTIND_lock								33
#define ACTIND_unlock							34
#define ACTIND_maintenanceRequired				35
#define ACTIND_intrasystemSoftHandoffBegin		36
#define ACTIND_intersystemSoftHandoffBegin		37
#define ACTIND_packetDataRegistrationOnly		38

#define FEATIND_callForwarding_Unconditional			1
#define FEATIND_callForwarding_Busy						2
#define FEATIND_callForwarding_NoAnswer					3
#define FEATIND_callForwarding_Other					4
#define FEATIND_callWaiting								5
#define FEATIND_threeWayCalling							6
#define FEATIND_callDelivery							7
#define FEATIND_doNotDisturb							8
#define FEATIND_conferenceCalling						9
#define FEATIND_callTransfer							10
#define FEATIND_callingNumberIdentificationRestriction	11
#define FEATIND_selectiveCallAcceptance					12
#define FEATIND_authorizationCode						13
#define FEATIND_speedDialing							14
#define FEATIND_adviceOfCharging						15
#define FEATIND_voiceMail								16
#define FEATIND_callForwardDefault						17
#define FEATIND_callingNumberIdentificationPresentation	18
#define FEATIND_flexibleAlerting						19
#define FEATIND_messageWaitingNotification				20
#define FEATIND_mobileAccessHunting						21
#define FEATIND_passwordCallAcceptance					22
#define FEATIND_preferredLanguageService				23
#define FEATIND_priorityAccessAndChannelAssignment		24
#define FEATIND_remoteFeatureControl					25
#define FEATIND_subscriberPINAccess						26
#define FEATIND_subscriberPINIntercept					27
#define FEATIND_voicePrivacy							28
#define FEATIND_shortMessageDeliveryPoint_ToPointBearer	29
#define FEATIND_shortMessageDeliveryBroadcast			30
#define FEATIND_cellularPagingTeleservice				31
#define FEATIND_cellularMessagingTeleservice			32
#define FEATIND_intersystemCall							33
#define FEATIND_voiceMailDelete							34
#define FEATIND_voiceMailSend							35
#define FEATIND_voiceMailDeposit						36
#define FEATIND_answerHold								37
#define FEATIND_userSelectiveCallForwarding				38

#define FEATOPN_featureRegistration					1
#define FEATOPN_featureDeregistration				2
#define FEATOPN_featureActivation					3
#define FEATOPN_featureDeactivation					4
#define FEATOPN_featureInvocation					5
#define FEATOPN_featurePerCallActivation			6
#define FEATOPN_featurePerCallDeactivation			7
#define FEATOPN_featureRegistrationAndActivation	8
#define FEATOPN_featureInterrogation				9
#define FEATOPN_featureTesting						10
#define FEATOPN_screenListEditing					11

#define FRIND_timerExpiry		1
#define FRIND_networkFailure	2
#define FRIND_operationError	3
#define FRIND_operationReject	4
#define FRIND_unspecified		5
#define FRIND_unsuccessful		6
#define FRIND_successful		7

typedef struct DMH_CallLocation
{
	u32	param_flag;

	u8	HcoordinateLen;
	u8	Hcoordinate[3];

	u8	NPANXX[3];

	u8	PlaceNameLen;
	u8	PlaceName[20];

	u8	StateProvinceName[2];

	u8	VcoordinateLen;
	u8	Vcoordinate[3];

	u8	LocalAccessTransportAreaLen;
	u8	LocalAccessTransportArea[4];

	u8	WorldCountry[3];
}DMH_CallLocation;

typedef struct	DMH_ReturnIndicator
{
	u32	param_flag;

	u8	ReturnIndicatorCode;

//optional part
	struct
	{
		u8	ParameterIdentifierLen;
		u8	ParameterIdentifier[16];
	}	FaultyParameter;

}DMH_ReturnIndicator;

typedef struct	DMH_FillIndicator
{
	struct
	{
		u8	ParameterIdentifierLen;
		u8	ParameterIdentifier[16];
	}	FaultyParameter;

	u8	FillIndicatorCode;
}DMH_FillIndicator;

typedef struct	DMH_AuditSubrecord
{
	u32	param_flag;
	
	u8	audsnLen;
	u8	audsn[4];//AuditSequenceNumber

//optional part
	u8	achdurLen;
	u8	achdur[4];//AirChannelDuration
	u8	cnvdurLen;
	u8	cnvdur[4];//ConversationDuration
	u8	fbdurLen;
	u8	fbdur[4];//FeatureBridgeDuration
	u8	ieccdurLen;
	u8	ieccdur[4];//IECConnectDuration
	u8	incdurLen;
	u8	incdur[4];//IncomingTrunkDuration
	u8	numactLen;
	u8	numact[4];//NumberOfActivities
	u8	numchrgLen;
	u8	numchrg[4];//NumberOfCharges
	u8	numevtLen;
	u8	numevt[4];//NumberOfEvents
	u8	numlegLen;
	u8	numleg[4];//NumberOfLegs
	u8	numsegLen;
	u8	numseg[4];//NumberOfSegments
	u8	ogtdurLen;
	u8	ogtdur[4];//OutgoingTrunkDuration
	u8	numfalLen;
	u8	numfal[4];//NumberOfFeatureActivationLegs
	u8	numorgLen;
	u8	numorg[8];//NumberOfOriginationLegs
	u8	numredLen;
	u8	numred[4];//NumberOfRedirectionLegs
	u8	numtrmLen;
	u8	numtrm[4];//NumberOfTerminationLegs
	u8	numauxLen;
	u8	numaux[4];//NumberOfAuxiliaryLegs
	u8	numoctLen;
	u8	numoct[4];//NumberOfOctets
	u8	numpktLen;
	u8	numpkt[4];//NumberOfPackets
	u8	iwfdurLen;
	u8	iwfdur[4];//IWFDuration
	DMH_FillIndicator		fillind;
	DMH_ReturnIndicator	retind;
}DMH_AuditSubrecord;

typedef	struct	DMH_SwitchID
{
	u32	param_flag;

	u8	swno;//SwitchNumber
	u8	sid[2];//SystemIdentifier
	u8	bri[2];//BusinessRelationIdentifier
	u8	mytyp;//SystemMyTypeCode
}DMH_SwitchID;

typedef struct	DMH_IdentitySubrecord
{
	u32	param_flag;

	u8	Date[3];
	struct
	{
		u8	ChoiceFlag;

		u8	esn[4];
		u8	imei[5];
	}	Choice1;

	struct
	{
		u8	ChoiceFlag;

		u8	min[5];
		u8	imsi[8];
		u8	neiclnp[19];
		u8	neiip[4];
	}	Choice2;

	u8	tdoLen;
	u8	tdo[2];//TimeDateOffset
	u8	todLen;
	u8	tod[3];//TimeOfDay

	struct
	{
		u8	ChoiceFlag;

		DMH_SwitchID	aswid;//AnchorSWID
		DMH_SwitchID	oswid;//OriginatingSWID
		DMH_SwitchID	sswid;//ServingSWID
	}	Choice3;

	u8	binLen;
	u8	bin[4];//BillingIdentificationNumber

	DMH_SwitchID	hswid;//HomeSWID

	u8	mdnLen;
	u8	mdn[8];
	DMH_FillIndicator		fillind;
	DMH_ReturnIndicator	retind;

}DMH_IdentitySubrecord;

typedef struct	DMH_EventSubrecord
{
	u32	param_flag;

	u8	evtind;//EventIndicator
	u8	rinLen;
	u8	rin[4];//ReportIdentificationNumber

//optional part
	DMH_SwitchID	aswid;//AnchorSWID

	u8	authcnt;//AuthorizationCount
	u8	authden;//AuthorizationDenied
	u8	authtyp;//AuthorizationType
	u8	binLen;
	u8	bin[4];//BillingIdentificationNumber
	u8	Date[3];
	u8	denacc;//DenyAccess
	u8	featind;//FeatureIndicator
	u8	featopn;//FeatureOperation
	u8	frind;//FeatureResultIndicator

	DMH_SwitchID	oswid;//OriginatingSWID

	u8	rbinLen;
	u8	rbin[4];//RelatedBillingIdentificationNumber
	u8	srt;//SecurityReportType

	DMH_SwitchID	sswid;//ServingSWID

	u8	tdoLen;
	u8	tdo[2];//TimeDateOffset
	u8	todLen;
	u8	tod[3];//TimeOfDay
	DMH_FillIndicator		fillind;
	DMH_ReturnIndicator	retind;
}DMH_EventSubrecord;

typedef struct	DMH_ChargeSubrecord
{
	u32	param_flag;

	u8	chrgamtLen;
	u8	chrgamt[4];//ChargeAmount
	u8	chrgind;//ChargeIndicator

//optional part
	u8	chrgtaxLen;
	u8	chrgtax[4];//ChargeTax
	u8	chrgtind;//ChargeTaxIndicator
	u8	chrgunit;//ChargeUnits
	u8	durLen;
	u8	dur[4];//Duration
	u8	mrpi;//MultipleRatePeriodIndicator,len=0
	u8	plnamLen;
	u8	plnam[20];//PlaceName
	u8	rpi;//RatePeriodIndicator
	u8	spnam[2];//StateProvinceName
	u8	ttind;//TollTariffIndicator
	u8	wcntry[3];//WorldCountry

	struct
	{
		u8	ChoiceFlag;

		u8	lnum;//LegNumber
		u8	segnum;//SegmentNumber
	}	Choice;

	u8	chrgtcodLen;
	u8	chrgtcod[2];//ChargeTaxCode
	u8	chrgttbl;//ChargeTaxTable
	u8	numoctLen;
	u8	numoct[4];//NumberOfOctets
	u8	numpktLen;
	u8	numpkt[4];//NumberOfPackets
	u8	seluseLen;
	u8	seluse[100];//SelectiveUse
	u8	sucod;//SelectiveUseCode
	u8	texind;//TaxExemptIndicator
	DMH_FillIndicator	fillind;
	DMH_ReturnIndicator	retind;
}DMH_ChargeSubrecord;

typedef	struct	DMH_BeginForwardPath
{
	u32	param_flag;

	u8	cellidLen;
	u8	cellid[2];//CellIdentifier
	u8	modind;//ModulationIndicator
	u8	rchnumLen;
	u8	rchnum[2];//RadioChannelNumber
	u8	tknumLen;
	u8	tknum[2];//TrunkNumber

//optional part
	u8	bearind;//BearerIndicator
	u8	locidLen;
	u8	locid[2];//LocationAreaIdentifier
	u8	radattr[2];//RadioAttributes
	u8	trnsnumLen;
	u8	trnsnum[2];//TransceiverNumber
	u8	tkgrpLen;
	u8	tkgrp[2];//TrunkGroup

	struct
	{
		u8	ChoiceFlag;
		//will add encode in the future

	}	Choice;

	u8	cellnamLen;
	u8	cellnam[8];//CellName
	u8	tgpnamLen;
	u8	tgpnam[12];//TrunkGroupName
	u8	uzLen;
	u8	uz[3];//UserZoneNumber
	u8	bndclsLen;
	u8	bndcls[63];//BandClass
	u8	freqind;//FrequencyIndicator
}DMH_BeginForwardPath;//BeginForwardPath

typedef	struct	DMH_EndForwardPath
{
	u32	param_flag;
}DMH_EndForwardPath;//BeginForwardPath

typedef struct	DMH_ActivitySubrecord
{
	u32	param_flag;

	u8	actind;//ActivityIndicator
	u8	rinLen;
	u8	rin[4];//ReportIdentificationNumber

//optional part
	u8	authden;//AuthorizationDenied

	DMH_BeginForwardPath	bfpath;
	u8	binLen;
	u8	bin[4];//BillingIdentificationNumber
	u8	Date[3];
	u8	denacc;//DenyAccess
	u8	srt;//SecurityReportType

	DMH_SwitchID	sswid;//ServingSWID

	u8	tdoLen;
	u8	tdo[2];//TimeDateOffset
	u8	todLen;
	u8	tod[3];//TimeOfDay
	DMH_FillIndicator		fillind;
	u8	rsegLen;
	u8	rseg[3];//RelatedSegmentNumber
	DMH_ReturnIndicator	retind;
}DMH_ActivitySubrecord;

typedef struct	DMH_FeatureBridgeUsage
{
	u32 param_flag;
	
	u8	fbind; //FeatureBridgeIndicator	
	u8	durLen;
	u8	dur[4];//Duration
	u8	rlegLen;
	u8	rleg[3];//RelatedLegNumber
	u8	todLen;
	u8	tod[3];//TimeOfDay
	
}DMH_FeatureBridgeUsage;

typedef struct	DMH_IncomingTrunkUsage
{
	u32 param_flag;
		
	u8	durLen;
	u8	dur[4];//Duration
	u8	todLen;
	u8	tod[3];//TimeOfDay
	u8	tknumLen;
	u8	tknum[2];//TrunkNumber

	u8	cardgts[2];//CarrierDigits
	u8	Date[3];
	u8	relind;//ReleaseIndicator
	u8	tdoLen;
	u8	tdo[2];//TimeDateOffset
	u8	tkgrpLen;
	u8	tkgrp[2];//TrunkGroup
	u8	tgpnamLen;
	u8	tgpnam[12];//TrunkGroupName
}DMH_IncomingTrunkUsage;

typedef struct	DMH_OutgoingTrunkUsage
{
	u32 param_flag;
		
	u8	durLen;
	u8	dur[4];//Duration
	u8	todLen;
	u8	tod[3];//TimeOfDay
	u8	tknumLen;
	u8	tknum[2];//TrunkNumber

	u8	cardgts[2];//CarrierDigits
	u8	Date[3];
	u8	relind;//ReleaseIndicator
	u8	tdoLen;
	u8	tdo[2];//TimeDateOffset
	u8	tkgrpLen;
	u8	tkgrp[2];//TrunkGroup
	u8	tgpnamLen;
	u8	tgpnam[12];//TrunkGroupName
}DMH_OutgoingTrunkUsage;

typedef struct	DMH_AirChannelUsage
{
	u32 param_flag;
		
	DMH_BeginForwardPath	bfpath;
	u8	durLen;
	u8	dur[4];//Duration
	u8	todLen;
	u8	tod[3];//TimeOfDay
	u8	Date[3];

//optional part
	DMH_EndForwardPath		efpath;
	u8	relind;//ReleaseIndicator
	u8	tdoLen;
	u8	tdo[2];//TimeDateOffset
}DMH_AirChannelUsage;

typedef struct	DMH_AirSegmentSubrecord
{
	u32	param_flag;

	DMH_AirChannelUsage	achusg;//AirChannelUsage
	u8	segnum;//SegmentNumber

//optional part
	struct
	{
		u32	param_flag;

		u8	latLen;
		u8	lat[3];//Latitude
		u8	LONGLen;
		u8	LONG[3];//Longitude
		u8	resolLen;
		u8	resol[3];//Resolution
	}begloc;//BeginLocation
	DMH_IncomingTrunkUsage	incusg;//IncomingTrunkUsage
	u8	lsind;//LastSegmentIndicator,len=0
	DMH_SwitchID	sswid;//ServingSWID
	u8	cgblind;//ChargeableIndicator
	DMH_FillIndicator		fillind;
	DMH_ReturnIndicator	retind;

}DMH_AirSegmentSubrecord;

typedef struct	DMH_FeatureActivationLegSubrecord
{
	u32 param_flag;

	u8	dialdgtsLen;
	u8	dialdgts[32];//DialedDigits
	u8	lnum;//LegNumber

//optional part will be encoded in the future
	u8	frind;//FeatureResultIndicator, BIT13
	u8	llind;//LastLegIndicator, BIT15
}DMH_FeatureActivationLegSubrecord;

typedef struct	DMH_ConversationUsage
{
	u32	param_flag;

	u8	durLen;
	u8	dur[4];//Duration
	u8	todLen;
	u8	tod[3];//TimeOfDay

//optional part
	u8	Date[3];
	u8	relind;//ReleaseIndicator
	u8	tdoLen;
	u8	tdo[2];//TimeDateOffset
	u8	numoctLen;
	u8	numoct[4];//NumberOfOctets
	u8	numpktLen;
	u8	numpkt[4];//NumberOfPackets
}DMH_ConversationUsage;

typedef struct	DMH_OriginationLegSubrecord
{
	u32 param_flag;

	u8	billind;//BillingIndicator
	u8	dialdgtsLen;
	u8	dialdgts[32];//DialedDigits
	u8	lnum;//LegNumber

	DMH_CallLocation		CalledLocation;//BIT8

	DMH_CallLocation		CallingLocation;//BIT11

	DMH_ConversationUsage	cnvusg;//ConversationUsage,BIT14
	DMH_FeatureBridgeUsage	fbusg;//FeatureBridgeUsage,BIT16
	u8						llind;//LastLegIndicator,len=0,BIT19
	DMH_OutgoingTrunkUsage	ogtusg;//OutgoingTrunkUsage.BIT20

}DMH_OriginationLegSubrecord;

typedef struct	DMH_PACASegmentSubrecord
{
	u32 param_flag;

	u8	cellidLen;
	u8	cellid[2];//CellIdentifier
	u8	durLen;
	u8	dur[4];//Duration
	u8	pacaind;//PACAIndicator
	u8	segnum;//SegmentNumber
}DMH_PACASegmentSubrecord;

typedef struct	DMH_RedirectionLegSubrecord
{
	u32 param_flag;

	u8	billind;//BillingIndicator
	u8	cddgtsLen;
	u8	cddgts[9];//CalledDigits
	DMH_IncomingTrunkUsage	incusg;//IncomingTrunkUsage
	u8	lnum;//LegNumber
	u8	redind;//RedirectionIndicator
	
//optional part
	DMH_CallLocation		CalledLocation;//BIT6

	u8	cgdgtsLen;
	u8	cgdgts[9];//CallingDigits, BIT8

	DMH_CallLocation		CallingLocation;//BIT9

	DMH_ConversationUsage	cnvusg;//ConversationUsage,BIT12
	u8	destdgtsLen;
	u8	destdgts[32];//DestinationDigits,BIT13
	u8	llind;//LastLegIndicator,len=0,BIT18
	DMH_OutgoingTrunkUsage	ogtusg;//OutgoingTrunkUsage.BIT19

}DMH_RedirectionLegSubrecord;

typedef struct	DMH_TandemSegmentSubrecord
{
	u32 param_flag;

	DMH_OutgoingTrunkUsage	ogtusg;//OutgoingTrunkUsage
	u8	segnum;//SegmentNumber
	DMH_SwitchID	tswid;//ServingSWID

//optional part will be added in the future
}DMH_TandemSegmentSubrecord;

typedef struct	DMH_TerminationLegSubrecord
{
	u32	param_flag;

	u8	billind;//BillingIndicator
	u8	lnum;//LegNumber

//optional part
	DMH_CallLocation		CalledLocation;//BIT6

	u8	cgdgtsLen;
	u8	cgdgts[9];//CallingDigits,BIT9

	DMH_CallLocation		CallingLocation;//BIT10

	DMH_ConversationUsage	cnvusg;//ConversationUsage,BIT13
	DMH_FeatureBridgeUsage	fbusg;//FeatureBridgeUsage,BIT16
	DMH_IncomingTrunkUsage	incusg;//IncomingTrunkUsage,BIT17
	u8						llind;//LastLegIndicator,len=0,BIT19
	
}DMH_TerminationLegSubrecord;

typedef struct	DMH_AuxiliaryLegSubrecord
{
	u32	param_flag;

	u8	billind;//BillingIndicator
	u8	lnum;//LegNumber
}DMH_AuxiliaryLegSubrecord;

typedef struct	DMH_EventJacket
{
	u32						param_flag;

	DMH_AuditSubrecord		audsub;
	DMH_IdentitySubrecord	idsub;
	DMH_EventSubrecord		evtsub;
	DMH_ChargeSubrecord		chrgsub;
}DMH_EventJacket;

typedef struct	DMH_ActivityJacket
{
	u32						param_flag;

	DMH_AuditSubrecord		audsub;
	DMH_IdentitySubrecord	idsub;
	DMH_ActivitySubrecord	actsub;
	DMH_ChargeSubrecord	chrgsub;
}DMH_ActivityJacket;

typedef struct	DMH_CallJacket
{
	u32									param_flag;

	DMH_AuditSubrecord					audsub;
	DMH_IdentitySubrecord				idsub;

	DMH_ActivitySubrecord				actsub;
	DMH_AirSegmentSubrecord				airssub;
	DMH_ChargeSubrecord					chrgsub;
	DMH_FeatureActivationLegSubrecord	falsub;
	DMH_OriginationLegSubrecord			olsub;
	DMH_PACASegmentSubrecord			pacasub;
	DMH_RedirectionLegSubrecord			rlsub;
	DMH_TandemSegmentSubrecord			tssub;
	DMH_TerminationLegSubrecord			tlsub;
	DMH_AuxiliaryLegSubrecord			auxlsub;
}DMH_CallJacket;

typedef struct	DMH_LegJacket
{
	u32									param_flag;

	DMH_IdentitySubrecord				idsub;

	DMH_ChargeSubrecord					chrgsub;
	DMH_FeatureActivationLegSubrecord	falsub;
	DMH_OriginationLegSubrecord			olsub;
	DMH_RedirectionLegSubrecord			rlsub;
	DMH_TerminationLegSubrecord			tlsub;
	DMH_AuxiliaryLegSubrecord			auxlsub;
}DMH_LegJacket;

typedef struct	DMH_SegmentJacket
{
	u32									param_flag;

	DMH_IdentitySubrecord				idsub;

	DMH_ActivitySubrecord				actsub;
	DMH_AirSegmentSubrecord				airssub;
	DMH_ChargeSubrecord					chrgsub;
	DMH_PACASegmentSubrecord			pacasub;
	DMH_TandemSegmentSubrecord			tssub;
}DMH_SegmentJacket;



int assign_DMHEventJacket(DMH_EventJacket *ptr,u8 *buf);
int assign_DMH_ActivityJacket(DMH_ActivityJacket *ptr,u8 *buf);
int assign_DMH_CallJacket(DMH_CallJacket *ptr,u8 *buf);
int assign_DMH_LegJacket(DMH_LegJacket *ptr,u8 *buf);
int assign_DMH_SegmentJacket(DMH_SegmentJacket *ptr,u8 *buf);
void encode_DMH_date(u8 *date);
u8 encode_DMH_TimeDateOffset(u8 *TimeDateOffset);
u8 encode_DMH_TimeOfDay(u8 *TimeOfDay);

