#ifndef cp_cco_action_h #define cp_cco_action_h /* Cesar project {{{ * * Copyright (C) 2008 Spidcom * * <<>> * * }}} */ /** * \file cp/cco/cco_action.h * \brief CCo Public functions. * \ingroup cp_cco * */ #include "cp/cp.h" #include "cp/mme.h" #include "cp/beacon/beacon.h" #include "cp/sta/mgr/sta.h" #include "cp/cco/action/handover.h" /** Forward declaration. */ typedef struct cp_cco_action_t cp_cco_action_t; BEGIN_DECLS /** * initialisation of CCo action module. * \param ctx the module context. * */ void cp_cco_action_init (cp_t *ctx); /** * Uninitialisation of CCo action module. * \param ctx the module context. * */ void cp_cco_action_uninit (cp_t *ctx); /** * Change the SNID using the beacon module. * \param ctx the module context. * * It shall request the SNIDs in use from the station manager to choose * one randomly in the available SNIDs */ void cp_cco_action_snid_change (cp_t *ctx); /** * Change the SNID right now. * \param ctx the module context. * * It shall request the SNIDs in use from the station manager to choose * one randomly in the available SNIDs */ void cp_cco_action_snid_change_now (cp_t *ctx); /** * perform garbage actions of CCo's responsibility. * \param ctx the module context. */ void cp_cco_action_garbage (cp_t *ctx); /** * generate a new NEK value. * \param ctx the module context. * * NEK shall be used no more than 1 hour, so must be changed after 1 * hour for that purpose, NEK expiration date is checked at every occurrence * of the global garbage collector timer and if current NEK expiration * date reached, a new NEK value shall be generated by calling this function */ void cp_cco_action_gen_nek (cp_t *ctx); /** * Send the TEI map with the data corresponding to the station leaving. * \param ctx the CP context. * \param sta the station which leaves the AVLN. * * It will not add a reference on the station and will not release it. */ void cp_cco_action__cco__sta_leave_send_tei_map (cp_t *ctx, cp_sta_t *sta); /** * manage association of a station. * \param ctx the module context. * \param assoc_req CM_ASSOC.REQ MME msg having being received */ void cp_cco_action__cco__cc_assoc_req (cp_t *ctx, cp_mme_rx_t * assoc_req); /** * manage association of a station. * \param ctx the module context. * \param assoc_req CM_ASSOC.REQ MME msg having being received */ void cp_cco_action__ucco__cc_assoc_req (cp_t *ctx, cp_mme_rx_t * assoc_req); /** * manage authentication of a station. * \param ctx the module context. * \param get_key_req CM_GET_KEY.REQ MME msg having being decrypted */ void cp_cco_action__cco__cm_get_key_req_pid0 (cp_t *ctx, cp_mme_rx_t * get_key_req); /** * manage explicit leave request of a station. * \param ctx the module context. * \param sta provided by the garbage function to send a CC_LEAVE_IND. * * Remove the station from the station manager. * \warn It does not release the reference of the station provided * in parameters. */ void cp_cco_action__cco__tei_expired (cp_t *ctx, cp_sta_t *sta); /** * Release a station. * \param ctx the CP context. * \param mme the MME received. */ void cp_cco_action__cco__cc_leave (cp_t *ctx, cp_mme_rx_t *mme); /** * Start to act as a CCo coming from the unassociated state.. * \param ctx the module context. * * This function shall: * - Choose a TEI for the station to authenticate it. * - Choose a SNID for the AVLN. * - Create and set our AVLN in the station manager. * - Change the station CCo status. * - Generate the NEK. * - Program the NEK change timer. * - Send a central beacon. */ void cp_cco_action__unassoc__cco_start (cp_t *ctx); /** * Start to act as a CCo coming from the unassociated state.. * \param ctx the module context. * * This function shall: * - Change the station CCo status. * - Generate the NEK. * - Program the NEK change timer (to change in few minutes). * - Program the beacon timer to send a central beacon at the beginning of * the next beacon period. */ void cp_cco_action__assoc__cco_start (cp_t *ctx); /** * Stop acting as a CCo and become a simple station. * \param ctx the module context. * * This function shall: * - Change the station status. * - Reprogram the beacon timer to expire a few time after the beacon period * start date. * - Stop the NEK generation. */ void cp_cco_action__cco__assoc_stop (cp_t *ctx); /** * Stop acting as a CCo and become a unassociated station. * \param ctx the module context. * * This function shall: * - Change the station status. * - Reprogram the beacon timer to expire a few time after the beacon period * start date. * - Stop the NEK generation. * - Delete the AVLN. * - Change the station authenticated status to not authenticated. */ void cp_cco_action__cco__unassoc_stop (cp_t *ctx); /** * The Handover can not be done cause of a countdown in the central beacon. * \param ctx the module context. * * This function will be called on each beacon timer expiration to send a * central beacon and try to handover the CCo functionality to stop. */ void cp_cco_action_drv_mac_stop_suspend (cp_t *ctx); /** * Stop the station. * \param ctx the module context. * * This function should stop the station. * - Stop the pbproc. * - Stop the hle * - deactivate the SAR * - deactivate the beacon module. * - cleanup the SAR. */ void cp_cco_action_drv_mac_stop_ended (cp_t *ctx); /** * Release a TEI. * \param ctx the module context. * \param tei The TEI value to release. * */ void cp_cco_action_tei_release (cp_t *ctx, u8 tei); /** * Set the TEI in use. * \param ctx the module context. * \param tei the TEI already in use. * * Use this function for the handover to disallow the new CCo to use a TEI * already in use. */ void cp_cco_action_tei_in_use (cp_t *ctx, cp_tei_t tei); /** * Clear the TEI compute mechanism. * \param ctx the module context. * * Use this function on the CCO stop. */ void cp_cco_action_tei_clear (cp_t *ctx); /** * CCo STOP on the DRV_MAC_STOP MME. * \param ctx the module context. * * This function shall produce a handover on the network to allow another * station to become the network CCo. So it shall inform the beacon module to * set the hoip flag in the central beacon and provide a handover in progress * bentry in the central beacon. * * \warn This function will not stop the CCo. This shall be done once the * handover has been done on the network. */ void cp_cco_action_drv_mac_stop (cp_t *ctx); /** * CCo selection for the drv mac stop request. * \param ctx the module context. * \param sta the station to add. */ void cp_cco_action_cco_selection__mac_stop_sta_add (cp_t *ctx, cp_sta_t *sta); /** * Add a station to the CCo selection procedure. * \param ctx the module context. * \param net the station's NET. * \param sta the station to add. * * This function shall add the station only if it can be a better CCo and if * out station is not CCo User appointed. */ void cp_cco_action_cco_selection__sta_add (cp_t *ctx, cp_net_t *net, cp_sta_t *sta); /** * Handle SC_CCO => CC_ASSOC_REQ. * \param ctx control plane context. * \param mme the handled MME. * * If it's the STA with which we are doing the SC assoc, reply with ok, * otherwise, reply with temporary failure. */ void cp_cco_action_sc__sc_cco__cc_assoc_req (cp_t *ctx, cp_mme_rx_t *mme); /** * The handover is ended. * \param ctx control plane context. * * Allow the ASSOC FSM to go to the authenticated state */ void cp_cco_action_handover_ended (cp_t *ctx); /** * Start providing the NEK to the authenticated stations. * \param ctx control plane context. * * CCO_NEK_CHANGE_IDLE -> CCO_NEK_CHANGE_WAIT_STA_CNF. * This function should start a timer to check the timeout. */ void cp_cco_action_nek_provide (cp_t *ctx); /** * Timeout NEK exchange with a station. * \param ctx control plane context. * * This should try to provide the nek to another station if the peered station * was not the last of the AVLN, in the other case it should stop the FSM * going to the IDLE state. */ void cp_cco_action_nek_change_timeout_wait (cp_t *ctx); /** * Timeout NEK exchange with a station. * \param ctx control plane context. * * This should try to provide the nek to another station if the peered station * was not the last of the AVLN, in the other case it should stop the FSM * going to the IDLE state. */ void cp_cco_action_nek_change_timeout_process (cp_t *ctx); /** * Received the CM_SET_KEY.CNF from the station. * \param ctx control plane context. * \param mme the handled MME. * * CCO_NEK_CHANGE_WAIT_STA_CNF -> CCO_NEK_CHANGE_PROCESS_CM_SET_KEY_CNF * Check the security parameters and the prn. */ void cp_cco_action_cm_set_key_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme); /** * Call the beacon module to start inserting the EKS bentry in the central * beacon. * \param ctx control plane context. */ void cp_cco_action_nek_change_prevent (cp_t *ctx); END_DECLS #endif /* cp_cco_action_h */