blob: e6b3fe03ede45f423f223b41dbbdeff28fa448ae [file] [log] [blame]
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<script type="text/javascript" language="javascript" src="../../lib/public/vendor/jquery/jquery-1.8.0.js"></script>
<script type="text/javascript" language="javascript" src="../../seed/es/demo_packets.json"></script>
<style>
table {
border-collapse: collapse;
}
th {
text-align: left;
padding: 2px 10px 2px 5px;
}
td {
border-width: 1px;
padding: 6px;
border-style: inset;
border-color: gray;
background-color: white;}
td.info { min-width: 300px;}
</style>
</head>
<body>
<script type="text/javascript">
$(document).ready(function(e) {
/*
function print_packet_row ()
Number
Time
Source
Destination
Protocol
Length
Info
*/
function print_packet_row ( packet_index ) {
var pcap_count = 0;
console.log(jsonObject.pdml.packet[packet_index].proto[0].field[0].$.name);
console.log(jsonObject.pdml.packet[packet_index].proto[0].field[0].$.name==="num");
var first_packet = jsonObject.pdml.packet[0];
var current_proto = jsonObject.pdml.packet[0].proto[0];
var temp_string = '<tr><td class="num"></td><td class="time"></td><td class="source"></td><td class="destination"></td><td class="protocols"></td><td class="length"></td><td class="info"></td></tr>';
var protos_length = first_packet.proto.length;
var current_proto_fields_length = current_proto.field.length;
for (i = 0; i < protos_length; ++i) {
console.log ('protos_length = ', protos_length, ', i = ', i);
current_protos_length = jsonObject.pdml.packet[packet_index].proto[i].field.length
for (j = 0; j < current_protos_length; ++j) {
console.log ('current_protos_length = ', current_protos_length, ', j = ', j, '\njsonObject.pdml.packet[packet_index].proto[i].field[j].$.show = ', jsonObject.pdml.packet[packet_index].proto[i].field[j].$.show, '\nname: ', jsonObject.pdml.packet[packet_index].proto[i].field[j].$.name);
switch ( jsonObject.pdml.packet[packet_index].proto[i].field[j].$.name ) {
case 'num':
// soon to be organized into an array to be placed in the dashboard
// currently swapping out the table cells via the DOM
temp_string = temp_string.replace('<td class="num">', '<td class="num">'+jsonObject.pdml.packet[packet_index].proto[i].field[j].$.show);
break;
case 'len':
// soon to be organized into an array to be placed in the dashboard
// currently swapping out the table cells via the DOM
temp_string = temp_string.replace('<td class="length">', '<td class="length">'+jsonObject.pdml.packet[packet_index].proto[i].field[j].$.show);
break;
case 'timestamp':
// soon to be organized into an array to be placed in the dashboard
// currently swapping out the table cells via the DOM
temp_string = temp_string.replace('<td class="time">', '<td class="time">'+jsonObject.pdml.packet[packet_index].proto[i].field[j].$.show);
break;
case 'eth.src':
// soon to be organized into an array to be placed in the dashboard
// currently swapping out the table cells via the DOM
temp_string = temp_string.replace('<td class="source">', '<td class="source">'+jsonObject.pdml.packet[packet_index].proto[i].field[j].$.show);
break;
case 'eth.dst':
// soon to be organized into an array to be placed in the dashboard
// currently swapping out the table cells via the DOM
temp_string = temp_string.replace('<td class="destination">', '<td class="destination">'+jsonObject.pdml.packet[packet_index].proto[i].field[j].$.show);
break;
case 'frame.protocols':
// soon to be organized into an array to be placed in the dashboard
// currently swapping out the table cells via the DOM
temp_string = temp_string.replace('<td class="protocols">', '<td class="protocols">'+jsonObject.pdml.packet[packet_index].proto[i].field[j].$.show);
break;
}
}
}
console.log(temp_string);
console.log('current_proto.field.length = ', current_proto.field.length);
$('table').append(temp_string);
}
$.each( jsonObject.pdml.packet, function ( index ) {
print_packet_row( index );
});
//console.log('jsonObject.pdml.packet.length = ', jsonObject.pdml.packet.length);
});
</script>
<dl>
<dt></dt>
<dd></dd>
</dl>
<table style="">
<tr>
<th>No.</th>
<th>Time</th>
<th>Source</th>
<th>Destination</th>
<th>Protocol</th>
<th>Length</th>
<th>Info</th>
</tr>
</table>
</body>
</html>