Commit 7e8cf552 authored by camahonchak's avatar camahonchak

Fixed a logic error for setting the type.

parent f5a99a76
......@@ -77,14 +77,16 @@ public class TruviewInfo
private jpcap.packet.UDPPacket firstPacket;
private static final Logger logger = Logger.getLogger(TruviewInfo.class);
public static final int XAIT_ID = 0x74;
public static final int NIT_ID = 0xc2;
public static final int NTT_ID = 0xc3;
public static final int SVCT_ID = 0xc4;
public static final int STT_ID = 0xc5;
public static final byte XAIT_ID = (byte)0x74;
public static final byte NIT_ID = (byte)0xc2;
public static final byte NTT_ID = (byte)0xc3;
public static final byte SVCT_ID = (byte)0xc4;
public static final byte STT_ID = (byte)0xc5;
public static final int ID_LOC = 16;
public static final int ID_LOC = 0;
public static final int ID_LOC2 = 4;
public static final int ID_LOC3 = 16;
/**
* Main Constructor.
......@@ -370,14 +372,14 @@ public class TruviewInfo
public static int getTunneltype(final int inPort, final UDPPacket inPacket)
{
int type = -1;
int id = (0x000000FF & ((int)inPacket.data[0]));
byte id = (byte)inPacket.data[0];
// If the packet is larger than the byte location for the id
// that we are looking for
if (inPacket.data.length > ID_LOC)
if (inPacket.data.length > ID_LOC2)
{
// This is an unsigned byte, convert it
int id2 = (0x000000FF & ((int)inPacket.data[ID_LOC]));
byte id2 = (byte)inPacket.data[ID_LOC2];
// If the packet is an XAIT
if(id2 == XAIT_ID)
......@@ -392,23 +394,43 @@ public class TruviewInfo
{
type = SCTE65_TUNNEL_TYPE;
}
else
{
// Get the type from the port map if we didn't get a type match
// above
type = getTunneltype(inPort);
}
// If the packet is larger than the byte location for the id
// that we are looking for
if (inPacket.data.length > ID_LOC3)
{
// This is an unsigned byte, convert it
byte id3 = (byte)inPacket.data[ID_LOC3];
// If the packet is an XAIT
if(id3 == XAIT_ID)
{
type = OCAP_XAIT_TUNNEL_TYPE;
}
// If the packet is another desired type
else if ( id3 == NIT_ID ||
id3 == NTT_ID ||
id3 == SVCT_ID ||
id3 == STT_ID)
{
type = SCTE65_TUNNEL_TYPE;
}
}
// If the packet has one of the desired types below in the
// first byte set it accordingly
else if ( id == NIT_ID
if ( id == NIT_ID
|| id == NTT_ID
|| id == SVCT_ID
|| id == STT_ID)
{
type = SCTE65_TUNNEL_TYPE;
}
else
else if(id == (byte)0x85)
{
type = SA_CA_TUNNEL_TYPE;
}
if(type == -1)
{
// Get the type from the port map
type = getTunneltype(inPort);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment