#ifndef cp2_sta_data_sta_mgr_h #define cp2_sta_data_sta_mgr_h /* Cesar project {{{ * * Copyright (C) 2008 Spidcom * * <<>> * * }}} */ /** * \file cp2/sta/data/sta_mgr.h * \brief Station and AVLN manager. * \ingroup cp_sta_data * * Manage the network list and its Stations. The station manager job it to * keep the integrity of the differents databases. */ #include "cp2/sta/data/net_list.h" #include "cp2/sta/data/sta_data.h" struct cp_sta_mgr_t { u16 current_sta_avln; }; typedef struct cp_sta_mgr_t cp_sta_mgr_t; /** Initialise the sta manager. * \return the sta manager context. */ cp_sta_mgr_t * cp_sta_mgr_init(void); /** Uninitialise the sta manager. * \param ctx the sta manager context. */ void cp_sta_mgr_uninit(cp_sta_mgr_t *ctx); /** Get an AVLN from the sta manager. * \param ctx the sta manager context. * \return the avln identified by its snid. * * This function shall return an avln with the snid provided or NULL if the * avln does not exists. */ cp_net_list_t* cp_sta_mgr_get_avln(cp_sta_mgr_t *ctx, u16 snid); /** Get our AVLN. * \param ctx the sta manager context. * \return Our AVLN. */ cp_net_list_t* cp_sta_mgr_get_our_avln(cp_sta_mgr_t *ctx); /** Add an AVLN. * \param ctx the sta manager context. * \param snid the new avln's snid. * \return the new avln. */ cp_net_list_t* cp_sta_mgr_add_avln(cp_sta_mgr_t *ctx, u16 snid); /** Remove an AVLN from the list and all the STAs associated in it. * \param ctx the sta manager context. * \param snid the avln snid. * * This function shall not remove our AVLN. */ void cp_sta_mgr_remove_avln(u16 snid); /** Add a station to a specified AVLN. * \param ctx the sta manager context. * \param tei the tei of the station * \param mac_addr the mac address * \param added true if the station was just create, flase otherwise. * \return the station just created. * * This function shall return the station just created and fill the added * boolean parameters with true value if the station has just been created or * false if the station already exists. */ cp_sta_t* cp_sta_mgr_add_sta(cp_sta_mgr_t *ctx, u16 snid, u8 tei, mac_t mac_addr, bool added); /** Remove a sta from the specified AVLN. * \param ctx the sta manager context. * \param snid the AVLN's snid. * \param tei the station tei. */ void cp_sta_mgr_remove_sta(cp_sta_mgr_t *ctx, u16 snid, u8 tei); /** Add a STA to our AVLN. * \param ctx the sta manager context. * \param tei the station tei * \param mac_address the station mac address. * \param added true if the station was just create, flase otherwise. * \return the station just created. * * This function shall return the station just created and fill the added * boolean parameters with true value if the station has just been created or * false if the station already exists. */ cp_sta_t* cp_sta_mgr_add_sta_our_avln(cp_sta_mgr_t *ctx, u8 tei, mac_t mac_address); /** Remove a STA of our AVLN. * \param ctx the sta manager context. * \param tei the station tei. */ void cp_sta_mgr_remove_sta_our_avln(cp_sta_mgr_t *ctx, u8 tei); /** Get a STA from an AVLN. * \param ctx the sta manager context. * \param snid the AVLN's snid. * \param tei the STA's tei. * \return The station associated of NULL of no tei is associated. */ cp_sta_t* cp_sta_mgr_get_sta(cp_sta_mgr_t *ctx, u16 snid, u8 tei); /** Get the STA in our AVLN corresponding to the tei provided. * \param ctx the sta manager context. * \param tei the station's tei * \return the station corresponding to the tei. */ cp_sta_t* cp_sta_mgr_get_sta_in_avln(cp_sta_mgr_t *ctx, u8 tei); /** Update the STA data in our AVLN. * \param ctx the sta manager context. * \param sta the station to update * \param tei the station's new tei * \param mac address the station's new mac address. */ void cp_sta_mgr_update_sta_in_avln(cp_sta_mgr_t *ctx, cp_sta_t *sta, u8 tei, mac_t mac_addr); /** Update the STA data in any AVLN. * \param ctx the sta manager context. * \param sta the station to update the data. * \param tei the station new tei. * \param mac_addr the station's new mac address. */ void cp_sta_mgr_update_sta(cp_sta_t sta, u8 tei, mac_t mac_addr); #endif /* cp2_sta_data_sta_mgr_h */