Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
senf
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
b5e293ed
Commit
b5e293ed
authored
16 years ago
by
dw6
Browse files
Options
Downloads
Patches
Plain Diff
adding toString and toin6_addr
parent
515ee32d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Socket/Protocols/INet/INet6Address.cc
+15
-5
15 additions, 5 deletions
Socket/Protocols/INet/INet6Address.cc
Socket/Protocols/INet/INet6Address.hh
+6
-0
6 additions, 0 deletions
Socket/Protocols/INet/INet6Address.hh
with
21 additions
and
5 deletions
Socket/Protocols/INet/INet6Address.cc
+
15
−
5
View file @
b5e293ed
...
...
@@ -85,17 +85,27 @@ prefix_ senf::INet6Address senf::INet6Address::from_string(std::string const & s
throw
UnknownHostnameException
(
s
);
}
prefix_
std
::
ostream
&
senf
::
operator
<<
(
std
::
ostream
&
os
,
INet6Address
const
&
addr
)
{
prefix_
in6_addr
senf
::
INet6Address
::
toin6_addr
()
const
{
::
in6_addr
ina
;
std
::
copy
((
*
this
).
begin
(),
(
*
this
).
end
(),
&
ina
.
s6_addr
[
0
]);
return
ina
;
}
prefix_
std
::
string
senf
::
INet6Address
::
toString
()
const
{
char
buffer
[
5
*
8
];
std
::
copy
(
addr
.
begin
(),
addr
.
end
(),
&
ina
.
s
6_addr
[
0
]
);
::
inet_ntop
(
AF_INET6
,
&
ina
,
buffer
,
sizeof
(
buffer
));
::
in6_addr
ina
=
(
*
this
).
toin
6_addr
(
);
::
inet_ntop
(
AF_INET6
,
&
ina
,
buffer
,
sizeof
(
buffer
));
buffer
[
sizeof
(
buffer
)
-
1
]
=
0
;
os
<<
buffer
;
return
buffer
;
}
prefix_
std
::
ostream
&
senf
::
operator
<<
(
std
::
ostream
&
os
,
INet6Address
const
&
addr
)
{
os
<<
addr
.
toString
();
return
os
;
}
senf
::
INet6Address
const
senf
::
INet6Address
::
None
;
senf
::
INet6Address
const
senf
::
INet6Address
::
Loopback
(
0u
,
0u
,
0u
,
0u
,
0u
,
0u
,
0u
,
1u
);
senf
::
INet6Address
const
senf
::
INet6Address
::
AllNodes
(
0xFF02u
,
0u
,
0u
,
0u
,
0u
,
0u
,
0u
,
1u
);
...
...
This diff is collapsed.
Click to expand it.
Socket/Protocols/INet/INet6Address.hh
+
6
−
0
View file @
b5e293ed
...
...
@@ -203,6 +203,12 @@ namespace senf {
\par
INet4 compatible INet6 addresses are not directly
supported, they are deprecated in the RFC. */
std
::
string
toString
()
const
;
///< get the string representation of this INet6Address
in6_addr
toin6_addr
()
const
;
///< get the linux in6_addr struct (convinience only)
///@}
///////////////////////////////////////////////////////////////////////////
///\name Accessors
...
...
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