aboutsummaryrefslogtreecommitdiffstats
path: root/PyPI/MLRsearch/MANIFEST.in
blob: 58073271d1d32fb0ab46699503f3a30270da8fec (plain)
1
2
3
4
5
6
# Include the README
include README.rst

# Include the license file
include LICENSE.txt
*/ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 *------------------------------------------------------------------
 * Copyright (c) 2018 Cisco and/or its affiliates.
 * Licensed 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.
 *------------------------------------------------------------------
 */

#include <igmp/igmp_group.h>
#include <igmp/igmp.h>

void
igmp_group_free_all_srcs (igmp_group_t * group)
{
  igmp_src_t *src;

  /* *INDENT-OFF* */
  FOR_EACH_SRC (src, group, IGMP_FILTER_MODE_INCLUDE,
    ({
      igmp_src_free(src);
    }));
  /* *INDENT-ON* */

  hash_free (group->igmp_src_by_key[IGMP_FILTER_MODE_INCLUDE]);
  hash_free (group->igmp_src_by_key[IGMP_FILTER_MODE_EXCLUDE]);
}

void
igmp_group_src_remove (igmp_group_t * group, igmp_src_t * src)
{
  hash_unset_mem (group->igmp_src_by_key[IGMP_FILTER_MODE_INCLUDE], src->key);
  hash_unset_mem (group->igmp_src_by_key[IGMP_FILTER_MODE_EXCLUDE], src->key);
}

igmp_src_t *
igmp_group_src_update (igmp_group_t * group,
		       const igmp_key_t * skey, igmp_mode_t mode)
{
  igmp_src_t *src;

  src = igmp_src_lookup (group, skey);

  if (NULL == src)
    {
      src = igmp_src_alloc (igmp_group_index (group), skey, mode);

      hash_set_mem (group->igmp_src_by_key[IGMP_FILTER_MODE_INCLUDE],
		    src->key, igmp_src_index (src));
    }
  else
    {
      igmp_src_refresh (src);
    }

  return (src);
}

void
igmp_group_clear (igmp_group_t * group)
{
  igmp_config_t *config;
  u32 ii;

  ASSERT (group);

  config = igmp_config_get (group->config);

  /* If interface is in ROUTER mode and IGMP proxy is enabled
   * remove mfib path.
   */
  if (config->mode == IGMP_MODE_ROUTER)
    {
      igmp_proxy_device_mfib_path_add_del (group, /* add */ 0);
    }

  IGMP_DBG ("clear-group: %U %U",
	    format_igmp_key, group->key,
	    format_vnet_sw_if_index_name,
	    vnet_get_main (), config->sw_if_index);

  igmp_group_free_all_srcs (group);

  for (ii = 0; ii < IGMP_GROUP_N_TIMERS; ii++)
    {
      igmp_timer_retire (&group->timers[ii]);
    }

  hash_unset_mem (config->igmp_group_by_key, group->key);
  clib_mem_free (group->key);
  pool_put (igmp_main.groups, group);
}

igmp_group_t *
igmp_group_alloc (igmp_config_t * config,
		  const igmp_key_t * gkey, igmp_filter_mode_t mode)
{
  igmp_main_t *im = &igmp_main;
  igmp_group_t *group;
  u32 ii;

  IGMP_DBG ("new-group: %U", format_igmp_key, gkey);
  pool_get (im->groups, group);
  clib_memset (group, 0, sizeof (igmp_group_t));
  group->key = clib_mem_alloc (sizeof (igmp_key_t));
  clib_memcpy (group->key, gkey, sizeof (igmp_key_t));
  group->igmp_src_by_key[IGMP_FILTER_MODE_INCLUDE] =
    hash_create_mem (0, sizeof (igmp_key_t), sizeof (uword));
  group->igmp_src_by_key[IGMP_FILTER_MODE_EXCLUDE] =
    hash_create_mem (0, sizeof (igmp_key_t), sizeof (uword));
  group->router_filter_mode = mode;
  group->config = igmp_config_index (config);
  group->n_reports_sent = 0;

  for (ii = 0; ii < IGMP_GROUP_N_TIMERS; ii++)
    group->timers[ii] = IGMP_TIMER_ID_INVALID;

  hash_set_mem (config->igmp_group_by_key, group->key, group - im->groups);

  /* If interface is in ROUTER mode and IGMP proxy is enabled
   * add mfib path.
   */
  if (config->mode == IGMP_MODE_ROUTER)
    {
      igmp_proxy_device_mfib_path_add_del (group, /* add */ 1);
    }

  return (group);
}

/**
 * the set of present sources minus the new set
 */
ip46_address_t *
igmp_group_present_minus_new (igmp_group_t * group,
			      igmp_filter_mode_t mode,
			      const ip46_address_t * saddrs)
{
  const ip46_address_t *s1;
  ip46_address_t *pmn;
  igmp_src_t *src;
  u32 found;

  pmn = NULL;

  /* *INDENT-OFF* */
  if (0 == vec_len(saddrs))
    {
      FOR_EACH_SRC(src, group, mode,
        ({
          vec_add1(pmn, *src->key);
        }));
    }
  else
    {
      FOR_EACH_SRC(src, group, mode,
        ({
          found = 0;
          vec_foreach(s1, saddrs)
            {
              if (ip46_address_is_equal(s1, src->key))
                {
                  found = 1;
                  break;
                }
            }

          if (!found)
            vec_add1(pmn, *src->key);
        }));
    }
  /* *INDENT-ON* */

  return (pmn);
}

/**
 * the set of new sources minus the present set
 */
ip46_address_t *
igmp_group_new_minus_present (igmp_group_t * group,
			      igmp_filter_mode_t mode,
			      const ip46_address_t * saddrs)
{
  const ip46_address_t *s1;
  ip46_address_t *npm;
  igmp_src_t *src;
  u32 found;

  npm = NULL;

  /* *INDENT-OFF* */
  vec_foreach(s1, saddrs)
    {
      found = 0;
      FOR_EACH_SRC(src, group, mode,
        ({
          if (ip46_address_is_equal(s1, src->key))
            {
              found = 1;
              break;
            }
        }));

      if (!found)
        vec_add1(npm, *s1);
    }
  /* *INDENT-ON* */

  return (npm);
}

ip46_address_t *
igmp_group_new_intersect_present (igmp_group_t * group,
				  igmp_filter_mode_t mode,
				  const ip46_address_t * saddrs)
{
  ip46_address_t *intersect;
  const ip46_address_t *s1;
  igmp_src_t *src;

  intersect = NULL;

  /* *INDENT-OFF* */
  FOR_EACH_SRC(src, group, mode,
    ({
      vec_foreach(s1, saddrs)
        {
          if (s1->ip4.as_u32 == src->key->ip4.as_u32)
            {
              vec_add1(intersect, *s1);
              break;
            }
        }
    }));
  /* *INDENT-ON* */

  return (intersect);
}

u32
igmp_group_n_srcs (const igmp_group_t * group, igmp_filter_mode_t mode)
{
  return (hash_elts (group->igmp_src_by_key[mode]));
}


igmp_src_t *
igmp_src_lookup (igmp_group_t * group, const igmp_key_t * key)
{
  uword *p;
  igmp_src_t *src = NULL;
  if (!group)
    return NULL;

  p = hash_get_mem (group->igmp_src_by_key[IGMP_FILTER_MODE_INCLUDE], key);
  if (p)
    src = vec_elt_at_index (igmp_main.srcs, p[0]);

  return src;
}

u32
igmp_group_index (const igmp_group_t * g)
{
  return (g - igmp_main.groups);
}

igmp_group_t *
igmp_group_get (u32 index)
{
  return (pool_elt_at_index (igmp_main.groups, index));
}

u8 *
format_igmp_group_timer_type (u8 * s, va_list * args)
{
  igmp_group_timer_type_t type = va_arg (*args, igmp_group_timer_type_t);

  switch (type)
    {
#define _(v,t) case IGMP_GROUP_TIMER_##v: return (format (s, "%s", t));
      foreach_igmp_group_timer
#undef _
    }
  return (s);
}

u8 *
format_igmp_group (u8 * s, va_list * args)
{
  igmp_group_t *group = va_arg (*args, igmp_group_t *);
  u32 indent = va_arg (*args, u32);
  igmp_src_t *src;
  u32 ii;

  s = format (s, "%U%U",
	      format_white_space, indent, format_igmp_key, group->key);

  for (ii = 0; ii < IGMP_GROUP_N_TIMERS; ii++)
    s = format (s, "\n%U  %U:%U", format_white_space, indent,
		format_igmp_group_timer_type, ii,
		format_igmp_timer_id, group->timers[ii]);

  /* *INDENT-OFF* */
  FOR_EACH_SRC (src, group, IGMP_FILTER_MODE_INCLUDE,
  ({
    s = format (s, "\n%U", format_igmp_src, src, indent+4);
  }));
  /* *INDENT-ON* */

  return (s);
}

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */