+ /**
+ * Adds to the passed Match this packet's header fields
+ *
+ * @param match
+ * The Match object to populate
+ */
+ public void populateMatch(Match match) {
+ // To be overridden by derived packet classes which have well known
+ // header fields so that Packet.getMatch would return desired result
+ }
+
+ /**
+ * Returns the Match object containing this packet and its payload
+ * encapsulated packets' header fields
+ *
+ * @return The Match containing the header fields of this packet and of its
+ * payload encapsulated packets
+ */
+ public Match getMatch() {
+ Match match = new Match();
+ Packet packet = this;
+ while (packet != null) {
+ packet.populateMatch(match);
+ packet = packet.getPayload();
+ }
+ return match;
+ }