DEFINITION CPT_1501_840000618 1501
DEFINITION TYPE_EDS_ZB_S_840000618 0x00
DEFINITION MODULE_TRAIT_840000618 0x5000
DEFINITION ERR_TAILLE_840000618 0x050
DEFINITION ERR_SYNTAX_840000618 0x070
DEFINITION ERR_CROISE_840000618 0x0F0
REGISTRE ENTIER erreur_840000618
REGISTRE ENTIER callEvStarTime_present_840000618
REGISTRE ENTIER recEntityType_present_840000618
REGISTRE ENTIER sender_present_840000618
REGISTRE ENTIER IMSI_present_840000618
REGISTRE ENTIER val_modifList_840000618
REGISTRE ENTIER val_defCallHand_840000618
REGISTRE ENTIER val_servLevel_840000618
REGISTRE ENTIER val_recEntityType_840000618
REGISTRE ENTIER val_recEntityCode_840000618
REGISTRE ENTIER recEntityCode_present_840000618
REGISTRE ENTIER val_bearerCode_840000618
REGISTRE ENTIER val_tlservCode_840000618
REGISTRE ENTIER val_radioChnlUsed_840000618
REGISTRE ENTIER indice_octet_840000618
REGISTRE ENTIER taille_callRefNb_840000618
REGISTRE ENTIER appel_urgent_840000618
REGISTRE ENTIER caract_840000618
REGISTRE POINTEUR pt_str_840000618
REGISTRE POINTEUR pt_codetype_840000618
REGISTRE ENTIER code_rejet_840000618
REGISTRE ENTIER EFFICACE_840000618
REGISTRE ENTIER MODULE_840000618
REGISTRE ENTIER ERREUR_840000618
####################################################################
# Traitement : Ttap310ZB_S_trt.src, Article EDS Zones Blanches Entrant (TAP 3.10)
#
#	Creation : 15/09/05 Par : AE
# 19/01/11 - BEA - G3R1 lot4 Verification/Correction des variables (constantes, entiers, pointeurs)
# 07/02/11 - QC821 : modifification pointeur pt_codetype de 2000 (evolution spec)
####################################################################





trace("Ttap310ZB_S : Debut Traitement")

# Initialisations

EFFICACE_840000618 = 1
MODULE_840000618 = MODULE_TRAIT_840000618
ERREUR_840000618 = 0
code_rejet_840000618 = 0

pt_codetype_840000618="pt_codetype123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
i_strcpy(pt_codetype_840000618,"")
pt_str_840000618 = "pt_str7890123456789012345678901234567890123456789012345678901234"
i_strcpy(pt_str_840000618,"")

#####################################################################
# Controle syntaxique de l'article
#####################################################################

#
# Test de la validite du champ callEvStarTime
# Si champ absent -> errone

callEvStarTime_present_840000618 = i_valid_field_n(g_iartin,$Ttap310ZB_S::callEvStarTime)
SI (!callEvStarTime_present_840000618)
ALORS
	trace("Ttap310ZB_S :champ callEvStarTime absent => ERRONE")
	ERREUR_840000618 = ERR_SYNTAX_840000618
	code_rejet_840000618 = MODULE_840000618 + ERREUR_840000618 + EFFICACE_840000618
	erreur_840000618=i_PlvMessEmettre(8030, 2 , g_iartin, "", 2, code_rejet_840000618, "callEvStarTime", 0)
	SAUT STOCKE_ERRONE
FINSI

#
# Test de la validite du champ sender
# Si champ absent -> errone

sender_present_840000618 =  i_valid_field_n(g_iartin,$Ttap310ZB_S::sender)
SI (!sender_present_840000618)
ALORS
	trace("Ttap310ZB_S :champ sender absent => ERRONE")
	ERREUR_840000618 = ERR_SYNTAX_840000618
	code_rejet_840000618 = MODULE_840000618 + ERREUR_840000618 + EFFICACE_840000618
	erreur_840000618=i_PlvMessEmettre(8030, 2 , g_iartin, "", 2, code_rejet_840000618, "sender", 0)
	SAUT STOCKE_ERRONE
FINSI

#
# Test de la validite du champ recEntityType
# Si champ absent -> errone

recEntityType_present_840000618 = i_valid_field_n(g_iartin,$Ttap310ZB_S::recEntityType)
SI (!recEntityType_present_840000618)
ALORS
	trace("Ttap310ZB_S :champ recEntityType absent => ERRONE")
	ERREUR_840000618 = ERR_SYNTAX_840000618
	code_rejet_840000618 = MODULE_840000618 + ERREUR_840000618 + EFFICACE_840000618
	erreur_840000618=i_PlvMessEmettre(8030, 2 , g_iartin, "", 2, code_rejet_840000618, "recEntityType", 0)
	SAUT STOCKE_ERRONE
FINSI

#
# Test de la validite du champ recEntityCode
# Si champ absent -> errone

recEntityCode_present_840000618 = i_valid_field_n(g_iartin,$Ttap310ZB_S::recEntityCode)
SI (!recEntityCode_present_840000618)
ALORS
	trace("Ttap310ZB_S :champ recEntityCode absent => ERRONE")
	ERREUR_840000618 = ERR_SYNTAX_840000618
	code_rejet_840000618 = MODULE_840000618 + ERREUR_840000618 + EFFICACE_840000618
	erreur_840000618=i_PlvMessEmettre(8030, 2 , g_iartin, "", 2, code_rejet_840000618, "recEntityCode", 0)
	SAUT STOCKE_ERRONE
FINSI

#
# Test de la validite du champ calledNumber
# Si Appel non urgent et calledNumber absent -> errone

SI (i_valid_field_n(g_iartin,$Ttap310ZB_S::tlservCode))
ALORS
	SI (i_get_art_field(g_iartin,$Ttap310ZB_S::tlservCode) == 0x12)
	ALORS
		appel_urgent_840000618 = 1
	FINSI
FINSI

# Si appel urgent sortant calledNumber pas obligatoire
SI (appel_urgent_840000618 != 1)
ALORS
	SI (!i_valid_field_n(g_iartin,$Ttap310ZB_S::calledNumber))
	ALORS
		trace("Ttap310ZB_S : Appel non urgent et champ calledNumber absent => ERRONE")
		ERREUR_840000618 = ERR_SYNTAX_840000618
		code_rejet_840000618 = MODULE_840000618 + ERREUR_840000618 + EFFICACE_840000618
		erreur_840000618=i_PlvMessEmettre(8031, 2 , g_iartin, "", 2, code_rejet_840000618, "calledNumber", 0)
		SAUT STOCKE_ERRONE
	FINSI
FINSI

#
# Test de la validite du champ IMSI
# Si champ IMSI absent -> errone

IMSI_present_840000618 = i_valid_field_n(g_iartin,$Ttap310ZB_S::IMSI)
SI (!IMSI_present_840000618)
ALORS
	trace("Ttap310ZB_S :champ IMSI absent => ERRONE")
	ERREUR_840000618 = ERR_SYNTAX_840000618
	code_rejet_840000618 = MODULE_840000618 + ERREUR_840000618 + EFFICACE_840000618
	erreur_840000618=i_PlvMessEmettre(8030, 2 , g_iartin, "", 2, code_rejet_840000618, "IMSI", 0)
	SAUT STOCKE_ERRONE
FINSI

#####################################################################
# Fin controle syntaxique de l'article
#####################################################################


#####################################################################
# Controles semantiques de l'article
#####################################################################
#
# Test semantique champ callRefNb
#
SI (i_valid_field_n(g_iartin,$Ttap310ZB_S::callRefNb))
ALORS
	taille_callRefNb_840000618 = i_get_art_field(g_iartin,$Ttap310ZB_S::callRefNb-1)
	SI (taille_callRefNb_840000618 > 32)
	ALORS
		trace("Ttap310ZB_S :Erreur champ callRefNb depassement la taille du champ en sortie")

		ERREUR_840000618 = ERR_TAILLE_840000618
		code_rejet_840000618 = MODULE_840000618 + ERREUR_840000618 + EFFICACE_840000618

		erreur_840000618=i_PlvMessEmettre(8033, 2 , g_iartin, "", 3, code_rejet_840000618, "callRefNb",taille_callRefNb_840000618)
		SAUT STOCKE_ERRONE
	FINSI

# cas ou callRefNb est de taille impaire => erreur
	SI ((taille_callRefNb_840000618 % 2) == 1)
	ALORS
		trace("Ttap310ZB_S :Erreur champ callRefNb de taille impaire")

		ERREUR_840000618 = ERR_TAILLE_840000618
		code_rejet_840000618 = MODULE_840000618 + ERREUR_840000618 + EFFICACE_840000618

		erreur_840000618=i_PlvMessEmettre(8034, 2 , g_iartin, "", 3, code_rejet_840000618, "callRefNb",taille_callRefNb_840000618)
		SAUT STOCKE_ERRONE
	FINSI

	indice_octet_840000618 = 0
	POINT BOUCLE_CALLREFNB

	SI (indice_octet_840000618 < taille_callRefNb_840000618)
	ALORS
		caract_840000618 = i_get_field_char_780042429(g_iartin,$Ttap310ZB_S::callRefNb,indice_octet_840000618)
#ASOUI		caract = i_get_art_fieldtab(g_iartin,$Ttap310ZB_S::callRefNb,indice_octet)
		SI ( ((caract_840000618 < 0x30)||(caract_840000618 > 0x39))&&((caract_840000618 < 0x61)||(caract_840000618 > 0x66))&&((caract_840000618 < 0x41)||(caract_840000618 > 0x46)) )
		ALORS
			trace("Ttap310ZB_S :Erreur champ callRefNb contient un digit incorrect")
			ERREUR_840000618 = ERR_SYNTAX_840000618
			code_rejet_840000618 = MODULE_840000618 + ERREUR_840000618 + EFFICACE_840000618
			erreur_840000618=i_PlvMessEmettre(8035, 2 , g_iartin, "", 2, code_rejet_840000618, "callRefNb", 0)
			SAUT STOCKE_ERRONE
		FINSI
		indice_octet_840000618 = indice_octet_840000618 + 1
		SAUT BOUCLE_CALLREFNB
	FINSI
FINSI

#
# Test semantique champ recEntityType
#
val_recEntityCode_840000618 =  i_get_art_field(g_iartin,$Ttap310ZB_S::recEntityCode)

#- recherche de recEntityType qui contient le recEntityCode=val_recEntityCode
#-- Appel a a fonction geType pour extraitre le type correspondant ? code_CDR=val_recEntityCode
erreur_840000618=i_get_field_str(g_iartin,"recEntityType",pt_codetype_840000618)

val_recEntityType_840000618=getType_780042429(pt_codetype_840000618,val_recEntityCode_840000618)

SI (val_recEntityType_840000618 != 0x01)
ALORS
	trace1("Ttap310ZB_S :Mauvaise valeur champ recEntityType: <0x%x>",val_recEntityType_840000618)
	SAUT STOCKE_ELIMINE
FINSI


#
# Test semantique champ sender
#
erreur_840000618 = i_get_field_str(g_iartin,"sender",pt_str_840000618)
SI ( (i_strcmp(pt_str_840000618,"FRAF3")) && (i_strcmp(pt_str_840000618,"FRAF2")) )
ALORS
	trace("Ttap310ZB_S : Mauvaise valeur champ sender")
	SAUT STOCKE_ELIMINE
FINSI

#
# Test semantique si tlservCode et bearerCode sont renseignes => Erreur
#
val_tlservCode_840000618 = i_get_art_field(g_iartin,$Ttap310ZB_S::tlservCode)
SI ((val_tlservCode_840000618 & 0xFF) != 0xFF)
ALORS
	val_bearerCode_840000618 = i_get_art_field(g_iartin,$Ttap310ZB_S::bearerCode)
	SI ((val_bearerCode_840000618 & 0xFF) != 0xFF)
	ALORS
		trace3("Ttap310ZB_S : Erreur tlservCode=0x%x bearerCode=0x%x",val_tlservCode_840000618,val_bearerCode_840000618,0)
		ERREUR_840000618 = ERR_CROISE_840000618
		code_rejet_840000618 = MODULE_840000618 + ERREUR_840000618 + EFFICACE_840000618
		erreur_840000618=i_PlvMessEmettre(8037, 2 , g_iartin, "", 3, code_rejet_840000618, val_tlservCode_840000618, val_bearerCode_840000618)
		SAUT STOCKE_ERRONE
	FINSI
FINSI

#
# Test semantique champ tlservCode
#
SI (i_valid_field_n(g_iartin,$Ttap310ZB_S::tlservCode))
ALORS
	val_tlservCode_840000618 = i_get_art_field(g_iartin,$Ttap310ZB_S::tlservCode)
	SI ( (val_tlservCode_840000618!=0x11) && (val_tlservCode_840000618!=0x12) && (val_tlservCode_840000618!=0x21)
		&& (val_tlservCode_840000618!=0x22) && (val_tlservCode_840000618!=0x61) && (val_tlservCode_840000618!=0x62)
		&& (val_tlservCode_840000618!=0x63) && (val_tlservCode_840000618!=0xFF) )
	ALORS
		trace1("Ttap310ZB_S :Mauvaise valeur du champ tlservCode : <0x%x>",val_tlservCode_840000618)
		SAUT STOCKE_ELIMINE
	FINSI
FINSI

#
# Test semantique champ radioChnlUsed
#
SI (i_valid_field_n(g_iartin,$Ttap310ZB_S::radioChnlUsed))
ALORS
	val_radioChnlUsed_840000618 = i_get_art_field(g_iartin,$Ttap310ZB_S::radioChnlUsed)
	SI ( (val_radioChnlUsed_840000618!=0x00) && (val_radioChnlUsed_840000618!=0x01) )
	ALORS
		trace1("Ttap310ZB_S : Mauvaise valeur champ radioChnlUsed : <0x%x>",val_radioChnlUsed_840000618)
		SAUT STOCKE_ELIMINE
	FINSI
FINSI

#
# Test semantique champ C_servLevel
#
SI (i_valid_field_n(g_iartin,$Ttap310ZB_S::C_servLevel))
ALORS
	val_servLevel_840000618 = i_get_art_field(g_iartin,$Ttap310ZB_S::C_servLevel)
	SI ( (val_servLevel_840000618!=0x00) && (val_servLevel_840000618!=0x01)
		&& (val_servLevel_840000618!=0x02) && (val_servLevel_840000618!=0x03) )
	ALORS
		trace1("Ttap310ZB_S : Mauvaise valeur champ C_servLevel : <0x%x>",val_servLevel_840000618)
		SAUT STOCKE_ELIMINE
	FINSI
FINSI

#
# Test semantique champ defCallHand
#
SI (i_valid_field_n(g_iartin,$Ttap310ZB_S::defCallHand))
ALORS
	val_defCallHand_840000618 = i_get_art_field(g_iartin,$Ttap310ZB_S::defCallHand)
	SI ( (val_defCallHand_840000618!=0x00) && (val_defCallHand_840000618!=0x01) )
	ALORS
		trace1("Ttap310ZB_S : Mauvaise valeur champ defCallHand : <0x%x>",val_defCallHand_840000618)
		SAUT STOCKE_ELIMINE
	FINSI
FINSI

#
# Test semantique champ C_modifList
#
SI (i_valid_field_n(g_iartin,$Ttap310ZB_S::C_modifList))
ALORS
	val_modifList_840000618 = i_get_art_field(g_iartin,$Ttap310ZB_S::C_modifList)
	SI ( (val_modifList_840000618 < 0x00) || (val_modifList_840000618 > 0x07) )
	ALORS
		trace1("Ttap310ZB_S : Mauvaise valeur champ C_modifList : <0x%x>",val_modifList_840000618)
		SAUT STOCKE_ELIMINE
	FINSI
FINSI

#####################################################################
# FIN tests semantiques
#####################################################################

trace( "Ttap310ZB_S :Fin Traitement Stockage de l'article en OK" )
#erreur = i_isolate_large_PDU(g_iartin)
erreur_840000618 = i_stocke_art(g_iartin, 0, PT_OK, 0)
erreur_840000618=i_incr_cpt(CPT_1501_840000618, TYPE_EDS_ZB_S_840000618, g_ieec, 0, i_DHgetLocalTime(4, 7, i_date_audit()), 1)
RETOUR TRAIT_OK

POINT STOCKE_ERRONE
trace( "Ttap310ZB_S :Fin Traitement Stockage de l'article en ERRONE" )
#erreur = i_isolate_large_PDU(g_iartin)

erreur_840000618 = i_make_art_rej(g_iartin, g_iartout, code_rejet_840000618)
# /FE 54
erreur_840000618 = i_stocke_art(g_iartout, 0, PT_ERRONE, 0)
RETOUR TRAIT_OK

POINT STOCKE_ELIMINE
trace( "Ttap310ZB_S :Fin Traitement Stockage de l'article en ELIMINE" )
#erreur = i_isolate_large_PDU(g_iartin)
erreur_840000618 = i_stocke_art(g_iartin, 0, PT_DIVERS, 0)
RETOUR TRAIT_OK
#------------------- Fin  Ttap310ZB_S_trt.src ------------------------------------
