* net/mld/mld_poll.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/net/netconfig.h>
#include <nuttx/net/netdev.h>
#include <nuttx/net/netstats.h>
#include <nuttx/net/ip.h>
#include "devif/devif.h"
#include "mld/mld.h"
* Public Functions
****************************************************************************/
* Name: mld_poll
*
* Description:
* Poll the groups associated with the device to see if any MLD messages
* are pending transfer.
*
* Returned Value:
* Returns a non-zero value if a IGP message is sent.
*
* Assumptions:
* This function must be called with the network locked.
*
****************************************************************************/
void mld_poll(FAR struct net_driver_s *dev)
{
FAR struct mld_group_s *group;
dev->d_len = 0;
dev->d_sndlen = 0;
if (IS_MLD_GENPEND(dev->d_mld.flags))
{
CLR_MLD_GENPEND(dev->d_mld.flags);
if (IS_MLD_QUERIER(dev->d_mld.flags))
{
mld_send(dev, NULL, MLD_SEND_GENQUERY);
return;
}
}
for (group = (FAR struct mld_group_s *)dev->d_mld.grplist.head;
group;
group = group->next)
{
if (IS_MLD_SCHEDMSG(group->flags))
{
mld_send(dev, group, group->msgtype);
CLR_MLD_SCHEDMSG(group->flags);
group->msgtype = MLD_SEND_NONE;
* it up.
*/
if (IS_MLD_WAITMSG(group->flags))
{
mldinfo("Awakening waiter\n");
CLR_MLD_WAITMSG(group->flags);
nxsem_post(&group->sem);
}
break;
}
else if (IS_MLD_RPTPEND(group->flags))
{
mld_send(dev, group, mld_report_msgtype(dev));
CLR_MLD_RPTPEND(group->flags);
break;
}
}
}