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
59d1aa09
Commit
59d1aa09
authored
16 years ago
by
dw6
Browse files
Options
Downloads
Patches
Plain Diff
adding flexibility to use interface index / no interface
parent
1236931e
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/MulticastSocketProtocol.cc
+38
-16
38 additions, 16 deletions
Socket/Protocols/INet/MulticastSocketProtocol.cc
Socket/Protocols/INet/MulticastSocketProtocol.hh
+18
-0
18 additions, 0 deletions
Socket/Protocols/INet/MulticastSocketProtocol.hh
with
56 additions
and
16 deletions
Socket/Protocols/INet/MulticastSocketProtocol.cc
+
38
−
16
View file @
59d1aa09
...
...
@@ -311,23 +311,30 @@ senf::INet6MulticastSocketProtocol::mcDropMembership(INet6Address const & mcAddr
}
namespace
{
void
mc6SSMSourceRequest
(
int
operation
,
int
fd
,
senf
::
INet6Address
const
&
group
,
senf
::
INet6Address
const
&
source
,
std
::
string
const
&
iface
)
{
struct
group_source_req
req
;
::
memset
(
&
req
,
0
,
sizeof
(
req
));
req
.
gsr_interface
=
if_nametoindex
(
iface
.
c_str
());
if
(
req
.
gsr_interface
==
0
)
throw
senf
::
SystemException
(
"::if_nametoindex()"
,
ENOENT
SENF_EXC_DEBUGINFO
);
req
.
gsr_group
.
ss_family
=
AF_INET6
;
std
::
copy
(
group
.
begin
(),
group
.
end
(),
reinterpret_cast
<
struct
sockaddr_in6
&>
(
req
.
gsr_group
).
sin6_addr
.
s6_addr
);
req
.
gsr_source
.
ss_family
=
AF_INET6
;
std
::
copy
(
source
.
begin
(),
source
.
end
(),
reinterpret_cast
<
struct
sockaddr_in6
&>
(
req
.
gsr_source
).
sin6_addr
.
s6_addr
);
if
(
::
setsockopt
(
fd
,
SOL_IPV6
,
MCAST_JOIN_SOURCE_GROUP
,
&
req
,
sizeof
(
req
))
<
0
)
SENF_THROW_SYSTEM_EXCEPTION
(
"::setsockopt()"
);
void
mc6SSMSourceRequest
(
int
operation
,
int
fd
,
senf
::
INet6Address
const
&
group
,
senf
::
INet6Address
const
&
source
,
int
const
&
ifacei
)
{
struct
group_source_req
req
;
::
memset
(
&
req
,
0
,
sizeof
(
req
));
req
.
gsr_interface
=
ifacei
;
req
.
gsr_group
.
ss_family
=
AF_INET6
;
std
::
copy
(
group
.
begin
(),
group
.
end
(),
reinterpret_cast
<
struct
sockaddr_in6
&>
(
req
.
gsr_group
).
sin6_addr
.
s6_addr
);
req
.
gsr_source
.
ss_family
=
AF_INET6
;
std
::
copy
(
source
.
begin
(),
source
.
end
(),
reinterpret_cast
<
struct
sockaddr_in6
&>
(
req
.
gsr_source
).
sin6_addr
.
s6_addr
);
if
(
::
setsockopt
(
fd
,
SOL_IPV6
,
MCAST_JOIN_SOURCE_GROUP
,
&
req
,
sizeof
(
req
))
<
0
)
SENF_THROW_SYSTEM_EXCEPTION
(
"::setsockopt()"
);
}
void
mc6SSMSourceRequest
(
int
operation
,
int
fd
,
senf
::
INet6Address
const
&
group
,
senf
::
INet6Address
const
&
source
,
std
::
string
const
&
iface
)
{
int
ifacei
=
if_nametoindex
(
iface
.
c_str
());
if
(
ifacei
==
0
)
throw
senf
::
SystemException
(
"::if_nametoindex()"
,
ENOENT
SENF_EXC_DEBUGINFO
);
mc6SSMSourceRequest
(
operation
,
fd
,
group
,
source
,
ifacei
);
}
}
prefix_
void
senf
::
INet6MulticastSocketProtocol
::
mcJoinSSMSource
(
INet6Address
const
&
group
,
...
...
@@ -338,6 +345,20 @@ prefix_ void senf::INet6MulticastSocketProtocol::mcJoinSSMSource(INet6Address co
mc6SSMSourceRequest
(
MCAST_JOIN_SOURCE_GROUP
,
fd
(),
group
,
source
,
iface
);
}
prefix_
void
senf
::
INet6MulticastSocketProtocol
::
mcJoinSSMSource
(
INet6Address
const
&
group
,
INet6Address
const
&
source
,
int
ifacei
)
const
{
mc6SSMSourceRequest
(
MCAST_JOIN_SOURCE_GROUP
,
fd
(),
group
,
source
,
ifacei
);
}
prefix_
void
senf
::
INet6MulticastSocketProtocol
::
mcJoinSSMSource
(
INet6Address
const
&
group
,
INet6Address
const
&
source
)
const
{
mc6SSMSourceRequest
(
MCAST_JOIN_SOURCE_GROUP
,
fd
(),
group
,
source
,
0
);
}
prefix_
void
senf
::
INet6MulticastSocketProtocol
::
mcLeaveSSMSource
(
INet6Address
const
&
group
,
INet6Address
const
&
source
,
std
::
string
const
&
iface
)
...
...
@@ -346,6 +367,7 @@ prefix_ void senf::INet6MulticastSocketProtocol::mcLeaveSSMSource(INet6Address c
mc6SSMSourceRequest
(
MCAST_LEAVE_SOURCE_GROUP
,
fd
(),
group
,
source
,
iface
);
}
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
//#include "MulticastSocketProtocol.mpp"
...
...
This diff is collapsed.
Click to expand it.
Socket/Protocols/INet/MulticastSocketProtocol.hh
+
18
−
0
View file @
59d1aa09
...
...
@@ -197,6 +197,24 @@ namespace senf {
\param[in] source SSM multicast source to join the
group on
\param[in] iface interface to join the group on */
void
mcJoinSSMSource
(
INet6Address
const
&
group
,
INet6Address
const
&
source
,
int
ifacei
)
const
;
///< join SSM multicast group
/**< This call will join the multicast group \a group for
traffic from \a source. A single group may be joined
multiple times on different sources.
\param[in] group multicast group to join
\param[in] source SSM multicast source to join the
group on
\param[in] ifacei interface index to join the group on */
void
mcJoinSSMSource
(
INet6Address
const
&
group
,
INet6Address
const
&
source
)
const
;
///< join SSM multicast group
/**< This call will join the multicast group \a group for
traffic from \a source. A single group may be joined
multiple times on different sources.
\param[in] group multicast group to join
\param[in] source SSM multicast source to join the
group on */
void
mcLeaveSSMSource
(
INet6Address
const
&
group
,
INet6Address
const
&
source
,
std
::
string
const
&
iface
)
const
;
///< leave SSM multicast group
...
...
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