From 9cd3b62f9df2feb017eb5fadcb3f280711d00361 Mon Sep 17 00:00:00 2001 From: Thierry Carré Date: Mon, 12 Dec 2011 17:08:04 +0100 Subject: cesar/cp/sta/mgr: net_list.c not used, and so removed --- cesar/cp/sta/mgr/src/net_list.c | 265 ---------------------------------------- 1 file changed, 265 deletions(-) delete mode 100644 cesar/cp/sta/mgr/src/net_list.c diff --git a/cesar/cp/sta/mgr/src/net_list.c b/cesar/cp/sta/mgr/src/net_list.c deleted file mode 100644 index 1017b8494b..0000000000 --- a/cesar/cp/sta/mgr/src/net_list.c +++ /dev/null @@ -1,265 +0,0 @@ -/* Cesar project {{{ - * - * Copyright (C) 2008 Spidcom - * - * <<>> - * - * }}} */ -/** - * \file cp/sta/mgr/src/net_list.c - * \brief Network list manager. - * \ingroup cp_sta_mgr - * - */ -#include "common/std.h" -#include "mac/common/timings.h" - -#include "cp/defs.h" -#include "cp/sta/mgr/net_list.h" - -#include "cp/sta/mgr/inc/net_list.h" -#include "cp/sta/mgr/inc/sta.h" - -#include "cp/inc/context.h" -/** - * Initialise the lists. - * \param ctx the module context. - * \param network the network list. - */ -void -cp_net_list_init (cp_t *ctx, cp_net_list_t *network) -{ - uint i; - - dbg_assert (ctx); - dbg_assert (network); - - for (i = 0; i < CP_NET_LIST_NB_AVLN; i++) - { - cp_net_init (ctx, &network->networks[i]); - } -} - -/** Uninitialise the network list. - * \param ctx the module context. - * \param network the network list. - */ -void -cp_net_list_uninit (cp_t *ctx, cp_net_list_t *network) -{ - uint i; - dbg_assert (ctx); - dbg_assert (network); - - for (i = 0; i < CP_NET_LIST_NB_AVLN; i++) - { - cp_net_uninit (ctx, &network->networks[i]); - } -} - -/** - * Add an AVLN to the list. - * \param ctx the module context. - * \param network the network list. - * \param snid The AVLN's SNID to add. - * \param nid The AVLN's NID to add. - * \return return the network added. - */ -cp_net_t * -cp_net_list_add_avln (cp_t *ctx, cp_net_list_t *network, - cp_snid_t snid, cp_nid_t nid) -{ - uint i; - cp_net_t *net; - dbg_assert (ctx); - dbg_assert (HPAV_NID_IS_VALID (nid)); - dbg_assert (network); - net = cp_net_list_get_avln (ctx, network, snid, nid); - - if (!net) - { - for (i = 0; i < CP_NET_LIST_NB_AVLN; i++) - { - if (network->networks[i].present == false) - { - net = &network->networks[i]; - break; - } - } - } - - // No net available. - if (!net) - return NULL; - - // Insert it as present. - if (!net->present) - { - net->present = true; - net->snid = snid; - net->nid = nid; - } - - return net; -} - -/** - * Removes an AVLN from the sta manager. - * \param ctx the module context. - * \param network the network list. - * \param snid The AVLN's SNID to remove. - * \param nid The AVLN's NID to remove. - */ -void -cp_net_list_remove_avln (cp_t *ctx, cp_net_list_t *network, - cp_snid_t snid, cp_nid_t nid) -{ - cp_net_t *net; - dbg_assert (network); - dbg_assert (HPAV_NID_IS_VALID (nid)); - dbg_assert (ctx); - - net = cp_net_list_get_avln (ctx, network, snid, nid); - - // Test if the network exist - if (!net) - return; - - cp_net_uninit (ctx, net); -} - -/** - * Returns the AVLN corresponding to the snid and nid. - * \param ctx the module context. - * \param network the network list. - * \param snid The AVLN's snid to get. - * \param nid The AVLN's NID to get. - * \return return the network. - */ -cp_net_t * -cp_net_list_get_avln (cp_t *ctx, cp_net_list_t *network, - cp_snid_t snid, cp_nid_t nid) -{ - uint i; - dbg_assert (ctx); - dbg_assert (HPAV_NID_IS_VALID (nid)); - dbg_assert (network); - - for (i = 0; i < CP_NET_LIST_NB_AVLN; i++) - { - if (nid == network->networks[i].nid - && snid == network->networks[i].snid - && network->networks[i].present) - return &network->networks[i]; - } - return NULL; -} - -cp_net_t * -cp_net_list_get_first_avln (cp_t *ctx, cp_net_list_t *network) -{ - dbg_assert (ctx); - dbg_assert (network); - cp_net_t *net; - /* Loop over nets. */ - for (net = &network->networks[0]; - net != &network->networks[CP_NET_LIST_NB_AVLN]; - net++) - { - if (net->present) - return net; - } - /* None found. */ - return NULL; -} - -cp_net_t * -cp_net_list_get_next_avln (cp_t *ctx, cp_net_list_t *network, cp_net_t *prev) -{ - dbg_assert (ctx); - dbg_assert (network); - dbg_assert (prev); - cp_net_t *net; - /* Loop over nets. */ - for (net = prev + 1; - net != &network->networks[CP_NET_LIST_NB_AVLN]; - net++) - { - if (net->present) - return net; - } - /* None found. */ - return NULL; -} - -/** - * Create a 16 bits flag indicating which SNID are in use. - * \param ctx the module context. - * \param network the network list. - * \return A 16 bits flag - */ -u16 -cp_net_list_get_snid_present (cp_t *ctx, cp_net_list_t *network) -{ - u16 snidflags = 0; - uint i; - - dbg_assert (ctx); - - for (i = 0; i < CP_NET_LIST_NB_AVLN; i++) - { - if (network->networks[i].present) - { - snidflags |= (u16) (1 << (network->networks[i].snid)); - } - } - - return snidflags; -} - -/** - * Get the number of discovered station on all AVLNs. - * \param ctx the module context. - * \param network the network list. - * \return the number of discovered station. - */ -u8 -cp_net_list_get_num_discovered_stas (cp_t *ctx, cp_net_list_t *network) -{ - u8 num = 0; - uint i; - - dbg_assert (ctx); - - for (i = 0; i < CP_NET_LIST_NB_AVLN; i++) - { - num += cp_net_get_num_discovered_stas (ctx, &network->networks[i]); - } - - return num; -} - -/** - * Get the number of discovered networks. - * \param ctx the module context. - * \param network the network list. - * \return the number of discovered networks. - */ -u8 -cp_net_list_get_num_discovered_net (cp_t *ctx, cp_net_list_t *network) -{ - u8 num = 0; - uint i; - - dbg_assert (network); - - for (i = 0; i < CP_NET_LIST_NB_AVLN; i++) - { - if ((ctx->sta_mgr.our_avln != &network->networks[i]) - && network->networks[i].present) - num ++; - } - - return num; -} - -- cgit v1.2.3