#ifndef cp_sta_data_sta_own_data_h #define cp_sta_data_sta_own_data_h /* Cesar project {{{ * * Copyright (C) 2008 Spidcom * * <<>> * * }}} */ /** * \file cp/sta/data/sta_own_data.h * \brief Station own data. * \ingroup cp_sta_data * */ #include "cp/defs.h" #include "cp/cp.h" #include "cp/sta/mgr/sta.h" #include /** Forward declaration. */ typedef struct cp_sta_own_data_private_t cp_sta_own_data_private_t; /** * Station own data. */ struct cp_sta_own_data_t { /** * Indicate if the station was CCo preferred. */ bool cco_prefered; /** * The AVLN HFID. */ const char hfid_avln [CP_HFID_SIZE + 1]; /** * The user HFID. */ const char hfid_user [CP_HFID_SIZE + 1]; /** * The manufacturer HFID. */ const char hfid_manufacturer [CP_HFID_SIZE + 1]; /** * Current hybrid mode. */ mac_coexistence_mode_t hybrid_mode; /** * The current NID being track for the NTB synchronization. */ cp_nid_t nid_track; /** * The PCo to discuss with. */ cp_sta_t * pco; }; typedef struct cp_sta_own_data_t cp_sta_own_data_t; BEGIN_DECLS /** * Initialise the station own data to default values. * \param ctx the module context. */ void cp_sta_own_data_init (cp_t *ctx); /** * Uninitialise the station own data to default values. * \param ctx the module context. */ void cp_sta_own_data_uninit (cp_t *ctx); /** * Set the TEI of the station. * \param ctx the module context. * \param tei The TEI station. */ void cp_sta_own_data_set_tei (cp_t * ctx, u8 tei); /** * Get the value of the constant TEI. * \param ctx the module context. * \return Get the station TEI. * */ cp_tei_t cp_sta_own_data_get_tei (cp_t *ctx); /** * Set the station Mac address. * \param ctx the module context. * \param mac_addr The Mac address of the station. */ void cp_sta_own_data_set_mac_address (cp_t *ctx, mac_t mac_addr); /** * Get the station mac address. * \param ctx the module context. * \return Get the station Mac address. */ mac_t cp_sta_own_data_get_mac_address (cp_t *ctx); /** * Set the Station NPW. * \param ctx the module context. * \param sta the station own data. * \param npw The new NPW. * * TODO : inform the driver ? */ void cp_sta_own_data_set_npw (cp_t *ctx, const char * npw); /** * Return the pointer to the NPW as a constant data. * \param ctx the module context. * \return Get the station NPW. * * The user shall call the set_npw function to modify the NPW */ const char * cp_sta_own_data_get_npw (cp_t *ctx); /** * Set the station NMK. * \param ctx the module context. * \param nmk The NMK to set. * * \todo Call the MSG to send a MME to the linux Driver. */ void cp_sta_own_data_set_nmk (cp_t *ctx, const cp_key_t nmk); /** * Get the NMK of the AVLN. * \param ctx the module context. * \return Get the station NMK * */ cp_key_t cp_sta_own_data_get_nmk (cp_t *ctx); /** * Set the device password. * \param ctx the module context. * \param dpw The new device password. * * // TODO : inform the driver ? */ void cp_sta_own_data_set_dpw (cp_t *ctx, const char *dpw); /** * Return the Device password. * \param ctx the module context. * \return Get the station DPW. */ const char * cp_sta_own_data_get_dpw (cp_t *ctx); /** * Set the security level. * \param ctx the module context. * \param sl The security level. * * And send a message to the HLE */ void cp_sta_own_data_set_security_level (cp_t *ctx, cp_security_level_t sl); /** * Return the security level. * \param ctx the module context. * \param sta the station own data. * \return Get the security level. * */ cp_security_level_t cp_sta_own_data_get_security_level (cp_t *ctx); /** * Set the CCo status of the station. * \param ctx the module context. * \param status The current CCo status of the station. * * It shall send a message to the Linux Driver */ void cp_sta_own_data_set_was_cco (cp_t *ctx, bool status); /** * Get the the CCo status of the station after a reboot. * \param ctx the module context. * \return the CCo status. */ bool cp_sta_own_data_get_was_cco (cp_t *ctx); /** * Set the AVLN HFID. * * \param ctx the module context. * \param data the human identifier. */ void cp_sta_own_data_set_hfid_avln (cp_t *ctx, const char* data); /** * Set the User HFID. * * \param ctx the module context. * \param data the human identifier. */ void cp_sta_own_data_set_hfid_user (cp_t *ctx, const char* data); /** * Set the Manufacturer HFID. * * \param ctx the module context. * \param data the human identifier. */ void cp_sta_own_data_set_hfid_manufacturer (cp_t *ctx, const char* data); /** * Set the GLID to send proxy data. * \param ctx the module context. * \param glid The GLID to use when a proxy beacon shall be sent. */ void cp_sta_own_data_set_pco_glid (cp_t *ctx, u8 glid); /** * Get the PCO GLID. * \param ctx the module context. * \param sta the station own data. * \return The GLID to send proxy data. */ u8 cp_sta_own_data_get_pco_glid (cp_t *ctx); /** * Get the PCO status. * \param ctx the module context. * \param sta the station own data. * \return True if the station is PCO, false otherwise. */ bool cp_sta_own_data_get_pco_status (cp_t *ctx); /** * Set the PCO status. * \param ctx the module context. * \param sta the station own data. * \param pco The PCO status. */ void cp_sta_own_data_set_pco_status (cp_t *ctx, bool pco); /** * Set the CCo status of the station. * \param ctx the CP context. */ void cp_sta_own_data_set_cco_status (cp_t *ctx, bool cco); /** * Get the CCo status of the station. * \param ctx the CP context. * \return the boolean indicating the state. */ bool cp_sta_own_data_get_cco_status (cp_t *ctx); /** * Set the authentication status. * \param ctx the CP context. * \param authenticated the station status. */ void cp_sta_own_data_set_authenticated_status (cp_t *ctx, bool authenticated); /** * Get the authentication status. * \param ctx the CP context. * \return the station authentication status. */ bool cp_sta_own_data_get_authenticated_status (cp_t *ctx); /** * Update the Station NID. * \param ctx the Control plane context. * \param nid the station NID. */ void cp_sta_own_data_set_nid (cp_t *ctx, cp_nid_t nid); /** * Get the Station NID. * \param ctx the Control plane context. * \param nid the station NID. */ cp_nid_t cp_sta_own_data_get_nid (cp_t *ctx); /** * Update the Station SNID. * \param ctx the Control plane context. * \param nid the station NID. */ void cp_sta_own_data_set_snid (cp_t *ctx, cp_snid_t snid); /** * Get the Station SNID. * \param ctx the Control plane context. * \return the station SNID. */ cp_snid_t cp_sta_own_data_get_snid (cp_t *ctx); /** * Set the current TEK. * \param ctx the module context. * \param key the TEK. */ void cp_sta_own_data_set_tek (cp_t *ctx, const cp_key_t key); /** * Get the current TEK. * \param ctx the module context. * \return the TEK. */ cp_key_t cp_sta_own_data_get_tek (cp_t *ctx); /** * Get backup CCo status. * \param ctx the control plane context. * \return true if we are backup CCo. */ bool cp_sta_own_data_get_backup_cco_status (cp_t *ctx); END_DECLS #endif /* cp_sta_data_sta_own_data_h */