module OPCAP_Templates {

/* OPCAP_Templates, defining TTCN-3 templates for the osmo-pcap protocol.
 *
 * OPCAP is a non-standard protocol used between osmo-pcap-client and osmo-pcap-server.
 *
 * (C) 2021 by Harald Welte <laforge@gnumonks.org>
 * All rights reserved.
 *
 * Released under the terms of GNU General Public License, Version 2 or
 * (at your option) any later version.
 */

import from General_Types all;
import from Osmocom_Types all;
import from OPCAP_Types all;


template (present) OPCAP_PDU tr_OPCAP_FILE_HDR(template (present) uint32_t linktype := ?) := {
	msg_type := PKT_LINK_HDR,
	spare := ?,
	len := 24,
	u := {
		file := {
			magic := PCAP_MAGIC,
			version_major := PCAP_VERSION_MAJOR,
			version_minor := PCAP_VERSION_MINOR,
			thiszone := 0,
			sigfigs := 0,
			snaplen := 9000,
			linktype := linktype
		}
	}
}

template (present) OPCAP_PDU tr_OPCAP_PKT(template (present) octetstring payload,
					  template (present) uint32_t caplen := ?,
					  template (present) uint32_t len := ?) := {
	msg_type := PKT_LINK_DATA,
	spare := ?,
	len := ?,
	u := {
		packet := {
			ts_sec := ?,
			ts_usec := ?,
			caplen := caplen,
			len := len,
			payload := payload
		}
	}
}


};
