Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ITS - Intelligent Transport Systems
ITS
Commits
01097524
Commit
01097524
authored
Jul 26, 2016
by
garciay
Browse files
Merge with C2C project
Add AcSecPrimitive/AcSecResponse support for CAM (DENM & GN to be done)
parent
964ca145
Changes
126
Expand all
Hide whitespace changes
Inline
Side-by-side
javasrc/adapter/org/etsi/adapter/ITERequired.java
View file @
01097524
...
@@ -60,4 +60,15 @@ public interface ITERequired {
...
@@ -60,4 +60,15 @@ public interface ITERequired {
* @return Value associated to the TA parameter
* @return Value associated to the TA parameter
*/
*/
Value
getTaParameter
(
String
param
);
Value
getTaParameter
(
String
param
);
/**
* Logs the debug message.
*/
void
logDebug
(
String
debugMessage
);
/**
* Logs the error message.
*/
void
logError
(
String
errorMessage
);
}
}
javasrc/adapter/org/etsi/its/adapter/ComponentMgr.java
View file @
01097524
...
@@ -12,6 +12,7 @@ import java.util.LinkedHashMap;
...
@@ -12,6 +12,7 @@ import java.util.LinkedHashMap;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Observer
;
import
java.util.Observer
;
import
org.etsi.adapter.TERFactory
;
import
org.etsi.common.ITuple
;
import
org.etsi.common.ITuple
;
import
org.etsi.common.Tuple
;
import
org.etsi.common.Tuple
;
import
org.etsi.its.adapter.ports.IObservable
;
import
org.etsi.its.adapter.ports.IObservable
;
...
@@ -58,7 +59,7 @@ public class ComponentMgr{
...
@@ -58,7 +59,7 @@ public class ComponentMgr{
public
void
addComponent
(
TriComponentId
component
)
{
public
void
addComponent
(
TriComponentId
component
)
{
// Sanity check
// Sanity check
if
(
component
==
null
)
{
if
(
component
==
null
)
{
System
.
err
.
println
(
"Error: Trying to add null component"
);
TERFactory
.
getInstance
().
logError
(
"Error: Trying to add null component"
);
return
;
return
;
}
}
...
@@ -81,11 +82,11 @@ public class ComponentMgr{
...
@@ -81,11 +82,11 @@ public class ComponentMgr{
public
void
addPort
(
final
String
componentName
,
final
TriPortId
ttcnPort
,
final
IPort
port
)
{
public
void
addPort
(
final
String
componentName
,
final
TriPortId
ttcnPort
,
final
IPort
port
)
{
// Sanity checks
// Sanity checks
if
(
componentName
.
isEmpty
()
||
(
ttcnPort
==
null
)
||
(
port
==
null
))
{
if
(
componentName
.
isEmpty
()
||
(
ttcnPort
==
null
)
||
(
port
==
null
))
{
System
.
err
.
println
(
"Wrong parameters"
);
TERFactory
.
getInstance
().
logError
(
"Wrong parameters"
);
return
;
return
;
}
}
if
(!
mapCompNameToTriComp
.
containsKey
(
componentName
))
{
if
(!
mapCompNameToTriComp
.
containsKey
(
componentName
))
{
System
.
err
.
println
(
"Error: Trying to add port to unknown component"
);
TERFactory
.
getInstance
().
logError
(
"Error: Trying to add port to unknown component"
);
return
;
return
;
}
}
if
(!
mapTriPortToTuple
.
containsKey
(
componentName
))
{
if
(!
mapTriPortToTuple
.
containsKey
(
componentName
))
{
...
@@ -110,7 +111,7 @@ public class ComponentMgr{
...
@@ -110,7 +111,7 @@ public class ComponentMgr{
// Sanity checks
// Sanity checks
if
(
componentName
==
null
||
componentName
.
isEmpty
())
{
if
(
componentName
==
null
||
componentName
.
isEmpty
())
{
System
.
err
.
println
(
"Invalid component"
);
TERFactory
.
getInstance
().
logError
(
"Invalid component"
);
return
null
;
return
null
;
}
}
...
@@ -127,15 +128,15 @@ public class ComponentMgr{
...
@@ -127,15 +128,15 @@ public class ComponentMgr{
// Sanity checks
// Sanity checks
if
(
componentName
.
isEmpty
()
||
portName
.
isEmpty
())
{
if
(
componentName
.
isEmpty
()
||
portName
.
isEmpty
())
{
System
.
err
.
println
(
"Wrong parameters"
);
TERFactory
.
getInstance
().
logError
(
"Wrong parameters"
);
return
null
;
return
null
;
}
}
if
(!
mapCompNameToTriComp
.
containsKey
(
componentName
))
{
if
(!
mapCompNameToTriComp
.
containsKey
(
componentName
))
{
System
.
err
.
println
(
"Unknown component"
);
TERFactory
.
getInstance
().
logError
(
"Unknown component"
);
return
null
;
return
null
;
}
}
if
(!
mapTriPortToTuple
.
containsKey
(
componentName
))
{
if
(!
mapTriPortToTuple
.
containsKey
(
componentName
))
{
System
.
err
.
println
(
"No port list entry"
);
TERFactory
.
getInstance
().
logError
(
"No port list entry"
);
return
null
;
return
null
;
}
}
...
@@ -160,15 +161,15 @@ public class ComponentMgr{
...
@@ -160,15 +161,15 @@ public class ComponentMgr{
// Sanity checks
// Sanity checks
if
(
componentName
.
isEmpty
()
||
portName
.
isEmpty
())
{
if
(
componentName
.
isEmpty
()
||
portName
.
isEmpty
())
{
System
.
err
.
println
(
"Wrong parameters"
);
TERFactory
.
getInstance
().
logError
(
"Wrong parameters"
);
return
null
;
return
null
;
}
}
if
(!
mapCompNameToTriComp
.
containsKey
(
componentName
))
{
if
(!
mapCompNameToTriComp
.
containsKey
(
componentName
))
{
System
.
err
.
println
(
"Unknown component"
);
TERFactory
.
getInstance
().
logError
(
"Unknown component"
);
return
null
;
return
null
;
}
}
if
(!
mapTriPortToTuple
.
containsKey
(
componentName
))
{
if
(!
mapTriPortToTuple
.
containsKey
(
componentName
))
{
System
.
err
.
println
(
"No port list entry"
);
TERFactory
.
getInstance
().
logError
(
"No port list entry"
);
return
null
;
return
null
;
}
}
...
@@ -204,15 +205,15 @@ public class ComponentMgr{
...
@@ -204,15 +205,15 @@ public class ComponentMgr{
// Sanity checks
// Sanity checks
if
(
componentName
.
isEmpty
()
||
portName
.
isEmpty
())
{
if
(
componentName
.
isEmpty
()
||
portName
.
isEmpty
())
{
System
.
err
.
println
(
"Wrong parameters"
);
TERFactory
.
getInstance
().
logError
(
"Wrong parameters"
);
return
;
return
;
}
}
if
(!
mapCompNameToTriComp
.
containsKey
(
componentName
))
{
if
(!
mapCompNameToTriComp
.
containsKey
(
componentName
))
{
System
.
err
.
println
(
"Unknown component"
);
TERFactory
.
getInstance
().
logError
(
"Unknown component"
);
return
;
return
;
}
}
if
(!
mapTriPortToTuple
.
containsKey
(
componentName
))
{
if
(!
mapTriPortToTuple
.
containsKey
(
componentName
))
{
System
.
err
.
println
(
"No port list entry"
);
TERFactory
.
getInstance
().
logError
(
"No port list entry"
);
return
;
return
;
}
}
...
...
javasrc/adapter/org/etsi/its/adapter/Management.java
View file @
01097524
...
@@ -48,7 +48,7 @@ public class Management implements IManagementTA, IManagementLayers {
...
@@ -48,7 +48,7 @@ public class Management implements IManagementTA, IManagementLayers {
/**
/**
* Maximum time for getting Long position vector (in seconds)
* Maximum time for getting Long position vector (in seconds)
*/
*/
private
static
final
int
GET_LPV_TIMEOUT
=
10
;
private
static
final
int
GET_LPV_TIMEOUT
=
10
;
//FIXME: Might be a parameter rather than a constant
/**
/**
* Interval for polling the location table during GetLpv (in ms)
* Interval for polling the location table during GetLpv (in ms)
...
@@ -353,6 +353,8 @@ public class Management implements IManagementTA, IManagementLayers {
...
@@ -353,6 +353,8 @@ public class Management implements IManagementTA, IManagementLayers {
// Ensure that management settings are reset
// Ensure that management settings are reset
beaconHeader
=
null
;
beaconHeader
=
null
;
enqueueBeacon
=
null
;
enqueueBeacon
=
null
;
locTable
.
clear
();
}
}
@Override
@Override
...
...
javasrc/adapter/org/etsi/its/adapter/PcapMultiplexer.java
View file @
01097524
...
@@ -49,7 +49,7 @@ public class PcapMultiplexer implements Runnable {
...
@@ -49,7 +49,7 @@ public class PcapMultiplexer implements Runnable {
int
r
=
Pcap
.
findAllDevs
(
alldevs
,
errbuf
);
int
r
=
Pcap
.
findAllDevs
(
alldevs
,
errbuf
);
if
(
r
==
Pcap
.
NOT_OK
||
alldevs
.
isEmpty
())
{
if
(
r
==
Pcap
.
NOT_OK
||
alldevs
.
isEmpty
())
{
System
.
err
.
printf
(
"Can't read list of devices, error is %s"
,
errbuf
.
toString
());
TERFactory
.
getInstance
().
logError
(
"Can't read list of devices, error is %s"
+
errbuf
.
toString
());
return
;
return
;
}
}
...
@@ -72,7 +72,7 @@ public class PcapMultiplexer implements Runnable {
...
@@ -72,7 +72,7 @@ public class PcapMultiplexer implements Runnable {
}
}
device
=
alldevs
.
get
(
ifaceIndex
);
device
=
alldevs
.
get
(
ifaceIndex
);
System
.
out
.
println
(
"Listening: "
+
device
.
getName
());
//
TERFactory.getInstance().logDebug
("Listening: " + device.getName());
}
}
/**
/**
...
@@ -84,7 +84,7 @@ public class PcapMultiplexer implements Runnable {
...
@@ -84,7 +84,7 @@ public class PcapMultiplexer implements Runnable {
}
}
public
synchronized
void
register
(
Layer
client
,
byte
[]
macAddress
,
short
frameType
)
{
public
synchronized
void
register
(
Layer
client
,
byte
[]
macAddress
,
short
frameType
)
{
System
.
out
.
println
(
">>>PcapMultiplexer.registering: "
+
frameType
);
//
TERFactory.getInstance().logDebug
(">>>PcapMultiplexer.registering: " + frameType);
if
(
clientsToMacs
.
isEmpty
())
{
if
(
clientsToMacs
.
isEmpty
())
{
// Open interface
// Open interface
...
@@ -94,7 +94,7 @@ public class PcapMultiplexer implements Runnable {
...
@@ -94,7 +94,7 @@ public class PcapMultiplexer implements Runnable {
pcap
=
Pcap
.
openLive
(
device
.
getName
(),
snaplen
,
flags
,
timeout
,
errbuf
);
pcap
=
Pcap
.
openLive
(
device
.
getName
(),
snaplen
,
flags
,
timeout
,
errbuf
);
if
(
pcap
==
null
)
{
if
(
pcap
==
null
)
{
System
.
err
.
printf
(
"Error while opening device for capture: "
TERFactory
.
getInstance
().
logError
(
"Error while opening device for capture: "
+
errbuf
.
toString
());
+
errbuf
.
toString
());
return
;
return
;
}
}
...
@@ -103,7 +103,7 @@ public class PcapMultiplexer implements Runnable {
...
@@ -103,7 +103,7 @@ public class PcapMultiplexer implements Runnable {
filter
=
""
;
filter
=
""
;
}
}
else
{
else
{
System
.
out
.
println
(
"Another Client !"
);
//
TERFactory.getInstance().logDebug
("Another Client !");
filter
=
filter
+
" and "
;
filter
=
filter
+
" and "
;
}
}
...
@@ -114,7 +114,7 @@ public class PcapMultiplexer implements Runnable {
...
@@ -114,7 +114,7 @@ public class PcapMultiplexer implements Runnable {
}
}
filter
=
filter
+
"not ether src "
+
strMacAddress
;
filter
=
filter
+
"not ether src "
+
strMacAddress
;
System
.
out
.
println
(
"New filter: "
+
filter
);
//
TERFactory.getInstance().logDebug
("New filter: " + filter);
// Apply filter
// Apply filter
PcapBpfProgram
bpfFilter
=
new
PcapBpfProgram
();
PcapBpfProgram
bpfFilter
=
new
PcapBpfProgram
();
...
@@ -122,7 +122,7 @@ public class PcapMultiplexer implements Runnable {
...
@@ -122,7 +122,7 @@ public class PcapMultiplexer implements Runnable {
int
netmask
=
0
;
int
netmask
=
0
;
int
r
=
pcap
.
compile
(
bpfFilter
,
filter
,
optimize
,
netmask
);
int
r
=
pcap
.
compile
(
bpfFilter
,
filter
,
optimize
,
netmask
);
if
(
r
!=
Pcap
.
OK
)
{
if
(
r
!=
Pcap
.
OK
)
{
System
.
out
.
println
(
"Filter error: "
+
pcap
.
getErr
());
//
TERFactory.getInstance().logDebug
("Filter error: " + pcap.getErr());
}
}
pcap
.
setFilter
(
bpfFilter
);
pcap
.
setFilter
(
bpfFilter
);
...
...
javasrc/adapter/org/etsi/its/adapter/SecurityHelper.java
View file @
01097524
This diff is collapsed.
Click to expand it.
javasrc/adapter/org/etsi/its/adapter/layers/BtpLayer.java
View file @
01097524
...
@@ -23,108 +23,108 @@ public class BtpLayer extends Layer {
...
@@ -23,108 +23,108 @@ public class BtpLayer extends Layer {
/**
/**
* Parameter name for BTP packet type
* Parameter name for BTP packet type
*/
*/
public
static
final
String
BTP_TYPE
=
"BtpType"
;
public
static
final
String
BTP_TYPE
=
"BtpType"
;
/**
/**
* Parameter name for BTP destination port
* Parameter name for BTP destination port
*/
*/
public
static
final
String
BTP_DSTPORT
=
"BtpDstPort"
;
public
static
final
String
BTP_DSTPORT
=
"BtpDstPort"
;
/**
/**
* Parameter name for BTP source port
* Parameter name for BTP source port
*/
*/
public
static
final
String
BTP_SRCPORT
=
"BtpSrcPort"
;
public
static
final
String
BTP_SRCPORT
=
"BtpSrcPort"
;
/**
/**
* Parameter name for BTP destination port information
* Parameter name for BTP destination port information
*/
*/
public
static
final
String
BTP_DSTPORTINFO
=
"BtpDstPortInfo"
;
public
static
final
String
BTP_DSTPORTINFO
=
"BtpDstPortInfo"
;
/**
/**
* BTP packet type A
* BTP packet type A
*/
*/
public
static
final
int
TYPE_A
=
0
;
public
static
final
int
TYPE_A
=
0
;
/**
/**
* BTP packet type B
* BTP packet type B
*/
*/
public
static
final
int
TYPE_B
=
1
;
public
static
final
int
TYPE_B
=
1
;
/**
/**
* Constructor
* Constructor
* @param management Layer management instance
* @param management Layer management instance
* @param lowerStack Lower protocol stack
* @param lowerStack Lower protocol stack
*/
*/
public
BtpLayer
(
IManagementLayers
management
,
Stack
<
String
>
lowerStack
)
{
public
BtpLayer
(
IManagementLayers
management
,
Stack
<
String
>
lowerStack
)
{
super
(
management
,
lowerStack
);
super
(
management
,
lowerStack
);
}
}
/* (non-Javadoc)
/* (non-Javadoc)
* @see org.etsi.its.adapter.layers.Layer#send(byte[], java.util.Map)
* @see org.etsi.its.adapter.layers.Layer#send(byte[], java.util.Map)
*/
*/
@Override
@Override
public
boolean
send
(
byte
[]
message
,
Map
<
String
,
Object
>
params
)
{
public
boolean
send
(
byte
[]
message
,
Map
<
String
,
Object
>
params
)
{
// Destination Port (16 bits)
// Destination Port (16 bits)
int
dstPort
;
int
dstPort
;
try
{
try
{
dstPort
=
(
Integer
)
params
.
get
(
BTP_DSTPORT
);
dstPort
=
(
Integer
)
params
.
get
(
BTP_DSTPORT
);
}
}
catch
(
NullPointerException
e
)
{
catch
(
NullPointerException
e
)
{
dstPort
=
0
;
dstPort
=
0
;
}
}
byte
[]
encapsulated
=
ByteHelper
.
intToByteArray
(
dstPort
,
2
);
byte
[]
encapsulated
=
ByteHelper
.
intToByteArray
(
dstPort
,
2
);
if
(
params
.
get
(
BTP_TYPE
).
equals
(
TYPE_A
))
{
if
(
params
.
get
(
BTP_TYPE
).
equals
(
TYPE_A
))
{
// Source Port (16 bits)
// Source Port (16 bits)
int
srcPort
;
int
srcPort
;
try
{
try
{
srcPort
=
(
Integer
)
params
.
get
(
BTP_SRCPORT
);
srcPort
=
(
Integer
)
params
.
get
(
BTP_SRCPORT
);
}
}
catch
(
NullPointerException
e
)
{
catch
(
NullPointerException
e
)
{
srcPort
=
0
;
srcPort
=
0
;
}
}
encapsulated
=
ByteHelper
.
concat
(
encapsulated
,
ByteHelper
.
intToByteArray
(
srcPort
,
2
));
encapsulated
=
ByteHelper
.
concat
(
encapsulated
,
ByteHelper
.
intToByteArray
(
srcPort
,
2
));
}
}
else
{
else
{
// Destination port info (16 bits)
// Destination port info (16 bits)
int
dstPortInfo
;
int
dstPortInfo
;
try
{
try
{
dstPortInfo
=
(
Integer
)
params
.
get
(
BTP_DSTPORTINFO
);
dstPortInfo
=
(
Integer
)
params
.
get
(
BTP_DSTPORTINFO
);
}
}
catch
(
NullPointerException
e
)
{
catch
(
NullPointerException
e
)
{
dstPortInfo
=
0
;
dstPortInfo
=
0
;
}
}
encapsulated
=
ByteHelper
.
concat
(
encapsulated
,
ByteHelper
.
intToByteArray
(
dstPortInfo
,
2
));
encapsulated
=
ByteHelper
.
concat
(
encapsulated
,
ByteHelper
.
intToByteArray
(
dstPortInfo
,
2
));
}
}
// Update params
// Update params
//
if(lowerLayerName != null && lowerLayerName.equals("GN")) {
//
if(lowerLayerName != null && lowerLayerName.equals("GN")) {
//
params.put(GnLayer.GN_NEXTHEADER, "BTP-A"); // TODO Alex to confirm removal
//
params.put(GnLayer.GN_NEXTHEADER, "BTP-A"); // TODO Alex to confirm removal
//
}
//
}
return
super
.
send
(
ByteHelper
.
concat
(
encapsulated
,
message
),
params
);
return
super
.
send
(
ByteHelper
.
concat
(
encapsulated
,
message
),
params
);
}
}
/* (non-Javadoc)
/* (non-Javadoc)
* @see org.etsi.its.adapter.layers.Layer#receive(byte[])
* @see org.etsi.its.adapter.layers.Layer#receive(byte[])
*/
*/
@Override
@Override
public
void
receive
(
byte
[]
message
,
Map
<
String
,
Object
>
lowerInfo
)
{
public
void
receive
(
byte
[]
message
,
Map
<
String
,
Object
>
lowerInfo
)
{
byte
[]
dstPort
=
new
byte
[
2
];
byte
[]
dstPort
=
new
byte
[
2
];
System
.
arraycopy
(
message
,
0
,
dstPort
,
0
,
2
);
System
.
arraycopy
(
message
,
0
,
dstPort
,
0
,
2
);
byte
[]
srcPort
=
new
byte
[
2
];
byte
[]
srcPort
=
new
byte
[
2
];
System
.
arraycopy
(
message
,
2
,
srcPort
,
0
,
2
);
System
.
arraycopy
(
message
,
2
,
srcPort
,
0
,
2
);
int
payloadLength
=
message
.
length
-
4
;
int
payloadLength
=
message
.
length
-
4
;
byte
[]
payload
=
new
byte
[
payloadLength
];
byte
[]
payload
=
new
byte
[
payloadLength
];
System
.
arraycopy
(
message
,
4
,
payload
,
0
,
payloadLength
);
System
.
arraycopy
(
message
,
4
,
payload
,
0
,
payloadLength
);
lowerInfo
.
put
(
BTP_DSTPORT
,
dstPort
);
lowerInfo
.
put
(
BTP_DSTPORT
,
dstPort
);
lowerInfo
.
put
(
BTP_DSTPORTINFO
,
srcPort
);
lowerInfo
.
put
(
BTP_DSTPORTINFO
,
srcPort
);
super
.
receive
(
payload
,
lowerInfo
);
super
.
receive
(
payload
,
lowerInfo
);
}
}
}
}
javasrc/adapter/org/etsi/its/adapter/layers/GnLayer.java
View file @
01097524
...
@@ -90,7 +90,7 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
...
@@ -90,7 +90,7 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
* Parameter name for packet's lifetime
* Parameter name for packet's lifetime
*/
*/
public
static
final
String
GN_LIFETIME
=
"GnLifetime"
;
public
static
final
String
GN_LIFETIME
=
"GnLifetime"
;
/**
/**
* GeoNetworking header type for unknown messages
* GeoNetworking header type for unknown messages
*/
*/
...
@@ -237,7 +237,7 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
...
@@ -237,7 +237,7 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
*/
*/
@Override
@Override
public
boolean
send
(
byte
[]
message
,
Map
<
String
,
Object
>
params
)
{
public
boolean
send
(
byte
[]
message
,
Map
<
String
,
Object
>
params
)
{
System
.
out
.
println
(
">>> GnLayer.send: "
+
ByteHelper
.
byteArrayToString
(
message
));
//
TERFactory.getInstance().logDebug
(">>> GnLayer.send: " + ByteHelper.byteArrayToString(message));
byte
[]
extHdr
=
null
;
byte
[]
extHdr
=
null
;
int
ht
;
int
ht
;
...
@@ -299,7 +299,7 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
...
@@ -299,7 +299,7 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
toBeSent
=
createSecuredMessage
(
basicHdr
,
commonHdr
,
extHdr
,
message
);
toBeSent
=
createSecuredMessage
(
basicHdr
,
commonHdr
,
extHdr
,
message
);
}
}
System
.
out
.
println
(
"<<< GnLayer.send: "
+
ByteHelper
.
byteArrayToString
(
toBeSent
));
//
TERFactory.getInstance().logDebug
("<<< GnLayer.send: " + ByteHelper.byteArrayToString(toBeSent));
return
super
.
send
(
toBeSent
,
params
);
return
super
.
send
(
toBeSent
,
params
);
}
}
...
@@ -308,7 +308,7 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
...
@@ -308,7 +308,7 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
*/
*/
@Override
@Override
public
void
receive
(
byte
[]
message
,
Map
<
String
,
Object
>
lowerInfo
)
{
public
void
receive
(
byte
[]
message
,
Map
<
String
,
Object
>
lowerInfo
)
{
System
.
out
.
println
(
">>> GnLayer.receive: "
+
ByteHelper
.
byteArrayToString
(
message
));
//
TERFactory.getInstance().logDebug
(">>> GnLayer.receive: " + ByteHelper.byteArrayToString(message));
byte
[]
basicHdr
=
new
byte
[
4
];
byte
[]
basicHdr
=
new
byte
[
4
];
System
.
arraycopy
(
message
,
0
,
basicHdr
,
0
,
4
);
System
.
arraycopy
(
message
,
0
,
basicHdr
,
0
,
4
);
...
@@ -350,7 +350,7 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
...
@@ -350,7 +350,7 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
params
.
put
(
GN_DEPV
,
depv
);
params
.
put
(
GN_DEPV
,
depv
);
params
.
put
(
GN_TYPE
,
HT_LS
);
params
.
put
(
GN_TYPE
,
HT_LS
);
params
.
put
(
GN_SUBTYPE
,
HST_LSREPLY
);
params
.
put
(
GN_SUBTYPE
,
HST_LSREPLY
);
System
.
out
.
println
(
"GnLayer.receive: Send LS_REPLAY in unsecured mode"
);
//
TERFactory.getInstance().logDebug
("GnLayer.receive: Send LS_REPLAY in unsecured mode");
send
(
null
,
params
);
send
(
null
,
params
);
}
}
}
}
...
@@ -371,13 +371,16 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
...
@@ -371,13 +371,16 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
super
.
receive
(
payload
,
lowerInfo
);
super
.
receive
(
payload
,
lowerInfo
);
}
}
}
}
// Security disable, null will be translated into omit
lowerInfo
.
put
(
SecurityHelper
.
SEC_SSP
,
null
);
lowerInfo
.
put
(
SecurityHelper
.
SEC_ITS_AID
,
null
);
}
else
if
(
nextHeader
==
0x02
)
{
// Secured tag
}
else
if
(
nextHeader
==
0x02
)
{
// Secured tag
byte
[]
payload
=
SecurityHelper
.
getInstance
().
checkSecuredProfileAndExtractPayload
(
message
,
basicHdr
.
length
,
management
.
isEnforceSecuredModeSet
(),
management
.
getItsAidOther
());
byte
[]
payload
=
SecurityHelper
.
getInstance
().
checkSecuredProfileAndExtractPayload
(
message
,
basicHdr
.
length
,
management
.
isEnforceSecuredModeSet
(),
management
.
getItsAidOther
()
,
lowerInfo
);
if
(
payload
!=
null
)
{
if
(
payload
!=
null
)
{
//
System.out.println
("GnLayer.receive: payload=" + ByteHelper.byteArrayToString(payload));
//
TERFactory.getInstance().logDebug
("GnLayer.receive: payload=" + ByteHelper.byteArrayToString(payload));
byte
[]
commonHdr
=
new
byte
[
8
];
byte
[]
commonHdr
=
new
byte
[
8
];
System
.
arraycopy
(
payload
,
0
,
commonHdr
,
0
,
8
);
System
.
arraycopy
(
payload
,
0
,
commonHdr
,
0
,
8
);
//
System.out.println
("GnLayer.receive: commonHdr=" + ByteHelper.byteArrayToString(commonHdr));
//
TERFactory.getInstance().logDebug
("GnLayer.receive: commonHdr=" + ByteHelper.byteArrayToString(commonHdr));
nextHeader
=
(
byte
)((
commonHdr
[
0
]
&
(
byte
)
0xF0
)
>>
4
);
nextHeader
=
(
byte
)((
commonHdr
[
0
]
&
(
byte
)
0xF0
)
>>
4
);
int
trafficClass
=
(
int
)(
commonHdr
[
2
]);
int
trafficClass
=
(
int
)(
commonHdr
[
2
]);