module SMPP_Templates {

import from General_Types all;
import from SMPP_Types all;

template (value) SMPP_header ts_SMPP_hdr(OCT4 command_id, SMPP_error_code status,
					 integer seq := 0) := {
	command_len := 0,
	command_id := command_id,
	command_status := status,
	seq_num := seq
}
template SMPP_header tr_SMPP_hdr(template OCT4 command_id, template SMPP_error_code status,
			  template integer seq := ?) := {
	command_len := ?,
	command_id := command_id,
	command_status := status,
	seq_num := seq
}

template (value) SMPP_PDU ts_SMPP(OCT4 command_id, SMPP_error_code status,
				  template (value) SMPP_operation_body body) := {
	header := ts_SMPP_hdr(command_id, status),
	body := body
}
template SMPP_PDU tr_SMPP(template OCT4 command_id, template SMPP_error_code status,
			  template integer seq := ?,
			  template SMPP_operation_body body := ?) := {
	header := tr_SMPP_hdr(command_id, status, seq),
	body := body
}



template (value) SMPP_PDU ts_SMPP_BIND_TX(template (value) SMPP_Bind bind) := {
	header := ts_SMPP_hdr(c_SMPP_command_id_bind_transmitter, ESME_ROK),
	body := {
		bind_transmitter := bind
	}
}
template SMPP_PDU tr_SMPP_BIND_TX(template (value) SMPP_Bind bind, template integer seq := ?) := {
	header := tr_SMPP_hdr(c_SMPP_command_id_bind_transmitter, ESME_ROK, seq),
	body := {
		bind_transmitter := bind
	}
}

template (value) SMPP_PDU ts_SMPP_BIND_TX_resp(SMPP_error_code status,
						template (value) SMPP_Bind_resp bind) := {
	header := ts_SMPP_hdr(c_SMPP_command_id_bind_transmitter_resp, status),
	body := {
		bind_transmitter_resp := bind
	}
}

template (value) SMPP_PDU ts_SMPP_BIND_RX(template (value) SMPP_Bind bind) := {
	header := ts_SMPP_hdr(c_SMPP_command_id_bind_receiver, ESME_ROK),
	body := {
		bind_receiver := bind
	}
}
template SMPP_PDU tr_SMPP_BIND_RX(template (value) SMPP_Bind bind, template integer seq := ?) := {
	header := tr_SMPP_hdr(c_SMPP_command_id_bind_receiver, ESME_ROK, seq),
	body := {
		bind_receiver := bind
	}
}

template (value) SMPP_PDU ts_SMPP_BIND_RX_resp(SMPP_error_code status,
						template (value) SMPP_Bind_resp bind) := {
	header := ts_SMPP_hdr(c_SMPP_command_id_bind_receiver_resp, status),
	body := {
		bind_receiver_resp := bind
	}
}

template (value) SMPP_PDU ts_SMPP_BIND_TRX(template (value) SMPP_Bind bind) := {
	header := ts_SMPP_hdr(c_SMPP_command_id_bind_transceiver, ESME_ROK),
	body := {
		bind_transceiver := bind
	}
}
template SMPP_PDU tr_SMPP_BIND_TRX(template (value) SMPP_Bind bind, template integer seq := ?) := {
	header := tr_SMPP_hdr(c_SMPP_command_id_bind_transceiver, ESME_ROK, seq),
	body := {
		bind_transceiver := bind
	}
}

template (value) SMPP_PDU ts_SMPP_BIND_TRX_resp(SMPP_error_code status,
						template (value) SMPP_Bind_resp bind) := {
	header := ts_SMPP_hdr(c_SMPP_command_id_bind_transceiver_resp, status),
	body := {
		bind_transceiver_resp := bind
	}
}

template (value) SMPP_PDU ts_SMPP_ENQ_LINK := {
	header := ts_SMPP_hdr(c_SMPP_command_id_enquire_link, ESME_ROK),
	body := {
		enquire_link := {}
	}
}

template (value) SMPP_PDU ts_SMPP_ENQ_LINK_resp := {
	header := ts_SMPP_hdr(c_SMPP_command_id_enquire_link_resp, ESME_ROK),
	body := {
		enquire_link_resp := {}
	}
}

template (value) SMPP_PDU ts_SMPP_DELIVER_SM_resp(SMPP_error_code status, integer seq) := {
	header := ts_SMPP_hdr(c_SMPP_command_id_deliver_sm_resp, status, seq),
	body := {
		deliver_sm_resp := {
			message_id := "", /* unused */
			opt_pars := omit
		}
	}
}

template (value) SMPP_PDU ts_SMPP_SUBMIT_SM(SMPP_SM sm) := {
	header := ts_SMPP_hdr(c_SMPP_command_id_submit_sm, ESME_ROK),
	body := {
		submit_sm := sm
	}
}

/* Section 5.2.12 esm_class */
template SMPP_BIT1 tr_ESM_CLASS_DEFAULT := '??????00'B;
template SMPP_BIT1 tr_ESM_CLASS_DATAGRAM := '??????01'B;
template SMPP_BIT1 tr_ESM_CLASS_TRANSACTION := '??????10'B;
template SMPP_BIT1 tr_ESM_CLASS_STORE_FORWARD := '??????11'B;
template SMPP_BIT1 tr_ESM_CLASS_UDHI := '?1??????'B;
template SMPP_BIT1 tr_ESM_CLASS_REPLYP_PATH := '1???????'B;




}