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
9aaed4a7
Commit
9aaed4a7
authored
16 years ago
by
dw6
Browse files
Options
Downloads
Patches
Plain Diff
change to tapSocketProtocol to save interface index
parent
d95f174b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Socket/Protocols/Raw/TunTapSocketHandle.cc
+22
-6
22 additions, 6 deletions
Socket/Protocols/Raw/TunTapSocketHandle.cc
Socket/Protocols/Raw/TunTapSocketHandle.hh
+8
-4
8 additions, 4 deletions
Socket/Protocols/Raw/TunTapSocketHandle.hh
with
30 additions
and
10 deletions
Socket/Protocols/Raw/TunTapSocketHandle.cc
+
22
−
6
View file @
9aaed4a7
...
...
@@ -21,8 +21,8 @@
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
\brief
\brief
*/
#include
"TunTapSocketHandle.hh"
...
...
@@ -39,13 +39,13 @@
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
prefix_
void
senf
::
TapSocketProtocol
::
init_client
()
prefix_
std
::
string
senf
::
TapSocketProtocol
::
init_client
()
const
{
init_client
(
std
::
string
());
return
init_client
(
std
::
string
());
}
prefix_
void
senf
::
TapSocketProtocol
::
init_client
(
std
::
string
const
&
interface_name
,
bool
const
NO_PI
)
prefix_
std
::
string
senf
::
TapSocketProtocol
::
init_client
(
std
::
string
const
&
interface_name
,
bool
const
NO_PI
)
const
{
int
f
;
...
...
@@ -59,7 +59,9 @@ prefix_ void senf::TapSocketProtocol::init_client(std::string const & interface_
interface_name
.
copy
(
ifr
.
ifr_name
,
IFNAMSIZ
);
if
(
::
ioctl
(
f
,
TUNSETIFF
,
(
void
*
)
&
ifr
)
<
0
)
SENF_THROW_SYSTEM_EXCEPTION
(
"Could not create tap device: "
)
<<
ifr
.
ifr_name
<<
"."
;
ifaceIndex_
=
if_nametoindex
(
ifr
.
ifr_name
);
fd
(
f
);
return
ifaceName
();
}
prefix_
unsigned
senf
::
TapSocketProtocol
::
available
()
...
...
@@ -95,11 +97,25 @@ prefix_ bool senf::TapSocketProtocol::eof()
return
false
;
}
prefix_
unsigned
int
senf
::
TapSocketProtocol
::
ifaceIndex
()
const
{
return
ifaceIndex_
;
}
prefix_
std
::
string
senf
::
TapSocketProtocol
::
ifaceName
()
const
{
char
buf
[
IF_NAMESIZE
];
if_indextoname
(
ifaceIndex_
,
buf
);
return
std
::
string
(
buf
);
}
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
//#include "TunTapSocketHandle.mpp"
// Local Variables:
// mode: c++
// fill-column: 100
...
...
This diff is collapsed.
Click to expand it.
Socket/Protocols/Raw/TunTapSocketHandle.hh
+
8
−
4
View file @
9aaed4a7
...
...
@@ -77,20 +77,20 @@ namespace senf {
public:
///\name Constructors
///@{
void
init_client
()
const
;
std
::
string
init_client
()
const
;
///< Create TAP socket
/**< \todo document me */
/**< \note This member is implicitly called from the
ProtocolClientSocketHandle::ProtocolClientSocketHandle()
constructor */
void
init_client
(
std
::
string
const
&
interface_name
,
bool
const
NO_PI
=
true
)
const
;
std
::
string
init_client
(
std
::
string
const
&
interface_name
,
bool
const
NO_PI
=
true
)
const
;
///< Create TAP socket
/**< \todo document me
\param[in] address remote address to connect to */
/**< \note This member is implicitly called from the
ProtocolClientSocketHandle::ProtocolClientSocketHandle()
constructor */
///@}
///\name Abstract Interface Implementation
...
...
@@ -98,7 +98,11 @@ namespace senf {
unsigned
available
()
const
;
bool
eof
()
const
;
unsigned
int
ifaceIndex
()
const
;
std
::
string
ifaceName
()
const
;
private:
mutable
unsigned
int
ifaceIndex_
;
///@}
};
...
...
@@ -116,7 +120,7 @@ namespace senf {
//#include "TunTapSocketHandle.mpp"
#endif
// Local Variables:
// mode: c++
// fill-column: 100
...
...
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