Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Pavlin Radoslavov
2014-10-31 21:14:14 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b139f4d947d0405d9442d179dd36a3fe50ba2dbc
b139f4d9
1 parent
af5ff795
Added support for IPv6 to IpAddressSerializer and IpPrefixSerializer.
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
core/store/serializers/src/main/java/org/onlab/onos/store/serializers/IpAddressSerializer.java
core/store/serializers/src/main/java/org/onlab/onos/store/serializers/IpPrefixSerializer.java
core/store/serializers/src/main/java/org/onlab/onos/store/serializers/IpAddressSerializer.java
View file @
b139f4d
...
...
@@ -46,8 +46,13 @@ public class IpAddressSerializer extends Serializer<IpAddress> {
final
int
octLen
=
input
.
readInt
();
byte
[]
octs
=
new
byte
[
octLen
];
input
.
readBytes
(
octs
);
// TODO: Add support for reading/writing the IP version
return
IpAddress
.
valueOf
(
IpAddress
.
Version
.
INET
,
octs
);
// Use the address size to decide whether it is IPv4 or IPv6 address
if
(
octLen
==
IpAddress
.
INET_BYTE_LENGTH
)
{
return
IpAddress
.
valueOf
(
IpAddress
.
Version
.
INET
,
octs
);
}
if
(
octLen
==
IpAddress
.
INET6_BYTE_LENGTH
)
{
return
IpAddress
.
valueOf
(
IpAddress
.
Version
.
INET6
,
octs
);
}
return
null
;
// Shouldn't be reached
}
}
...
...
core/store/serializers/src/main/java/org/onlab/onos/store/serializers/IpPrefixSerializer.java
View file @
b139f4d
...
...
@@ -52,7 +52,13 @@ public final class IpPrefixSerializer extends Serializer<IpPrefix> {
byte
[]
octs
=
new
byte
[
octLen
];
input
.
readBytes
(
octs
);
int
prefLen
=
input
.
readInt
();
// TODO: Add support for reading/writing the IP version
return
IpPrefix
.
valueOf
(
IpAddress
.
Version
.
INET
,
octs
,
prefLen
);
// Use the address size to decide whether it is IPv4 or IPv6 address
if
(
octLen
==
IpAddress
.
INET_BYTE_LENGTH
)
{
return
IpPrefix
.
valueOf
(
IpAddress
.
Version
.
INET
,
octs
,
prefLen
);
}
if
(
octLen
==
IpAddress
.
INET6_BYTE_LENGTH
)
{
return
IpPrefix
.
valueOf
(
IpAddress
.
Version
.
INET6
,
octs
,
prefLen
);
}
return
null
;
// Shouldn't be reached
}
}
...
...
Please
register
or
login
to post a comment