Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
senf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wiback
senf
Commits
48a51803
Commit
48a51803
authored
16 years ago
by
tho
Browse files
Options
Downloads
Patches
Plain Diff
added MACAddress::uint64()
parent
ab998fe5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Socket/Protocols/Raw/MACAddress.cci
+12
-0
12 additions, 0 deletions
Socket/Protocols/Raw/MACAddress.cci
Socket/Protocols/Raw/MACAddress.hh
+2
-1
2 additions, 1 deletion
Socket/Protocols/Raw/MACAddress.hh
Socket/Protocols/Raw/MACAddress.test.cc
+2
-0
2 additions, 0 deletions
Socket/Protocols/Raw/MACAddress.test.cc
with
16 additions
and
1 deletion
Socket/Protocols/Raw/MACAddress.cci
+
12
−
0
View file @
48a51803
...
@@ -108,6 +108,18 @@ prefix_ boost::uint64_t senf::MACAddress::eui64()
...
@@ -108,6 +108,18 @@ prefix_ boost::uint64_t senf::MACAddress::eui64()
(boost::uint64_t( (*this)[5] ) );
(boost::uint64_t( (*this)[5] ) );
}
}
prefix_ boost::uint64_t senf::MACAddress::uint64()
const
{
return
(boost::uint64_t( (*this)[0] ) << 40) |
(boost::uint64_t( (*this)[1] ) << 32) |
(boost::uint64_t( (*this)[2] ) << 24) |
(boost::uint64_t( (*this)[3] ) << 16) |
(boost::uint64_t( (*this)[4] ) << 8) |
(boost::uint64_t( (*this)[5] ) );
}
///////////////////////////////cci.e///////////////////////////////////////
///////////////////////////////cci.e///////////////////////////////////////
#undef prefix_
#undef prefix_
...
...
This diff is collapsed.
Click to expand it.
Socket/Protocols/Raw/MACAddress.hh
+
2
−
1
View file @
48a51803
...
@@ -48,7 +48,7 @@ namespace senf {
...
@@ -48,7 +48,7 @@ namespace senf {
The following statements all create the same MAC address <code>00:1A:2B:3C:4D:5F</code>
The following statements all create the same MAC address <code>00:1A:2B:3C:4D:5F</code>
\code
\code
// Used to construct constant MAC addresses
// Used to construct constant MAC addresses
MACAddress(0x001A2B3C4D5Flu)
MACAddress(0x001A2B3C4D5Fl
l
u)
// Construct a MAC address from it's string representation:
// Construct a MAC address from it's string representation:
MACAddress::from_string("00:1a:2b:3c:4d:5f") // case is ignored
MACAddress::from_string("00:1a:2b:3c:4d:5f") // case is ignored
...
@@ -128,6 +128,7 @@ namespace senf {
...
@@ -128,6 +128,7 @@ namespace senf {
boost
::
uint32_t
nic
()
const
;
///< Return last 3 bytes of the address
boost
::
uint32_t
nic
()
const
;
///< Return last 3 bytes of the address
boost
::
uint64_t
eui64
()
const
;
///< Build EUI-64 from the MAC address
boost
::
uint64_t
eui64
()
const
;
///< Build EUI-64 from the MAC address
boost
::
uint64_t
uint64
()
const
;
///< Return MAC address as uint64 value
std
::
string
toString
()
const
;
///< Return string representation of MAC address like 12:34:56:78:90:ab
std
::
string
toString
()
const
;
///< Return string representation of MAC address like 12:34:56:78:90:ab
...
...
This diff is collapsed.
Click to expand it.
Socket/Protocols/Raw/MACAddress.test.cc
+
2
−
0
View file @
48a51803
...
@@ -84,6 +84,8 @@ BOOST_AUTO_UNIT_TEST(macAddress)
...
@@ -84,6 +84,8 @@ BOOST_AUTO_UNIT_TEST(macAddress)
BOOST_CHECK_EQUAL
(
mac
,
senf
::
MACAddress
::
from_eui64
(
0xa1b2c3fffed4e5f6llu
)
);
BOOST_CHECK_EQUAL
(
mac
,
senf
::
MACAddress
::
from_eui64
(
0xa1b2c3fffed4e5f6llu
)
);
BOOST_CHECK_THROW
(
senf
::
MACAddress
::
from_eui64
(
0u
),
senf
::
AddressSyntaxException
);
BOOST_CHECK_THROW
(
senf
::
MACAddress
::
from_eui64
(
0u
),
senf
::
AddressSyntaxException
);
BOOST_CHECK_EQUAL
(
senf
::
MACAddress
(
0x1a2b3c4d5e6fULL
).
uint64
(),
0x1a2b3c4d5e6fULL
);
}
}
///////////////////////////////cc.e////////////////////////////////////////
///////////////////////////////cc.e////////////////////////////////////////
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment