summaryrefslogtreecommitdiff
path: root/cesar/cp2/sta/data
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp2/sta/data')
-rw-r--r--cesar/cp2/sta/data/inc/own_data.h30
-rw-r--r--cesar/cp2/sta/data/inc/sta_data.h33
-rw-r--r--cesar/cp2/sta/data/net_list.h83
-rw-r--r--cesar/cp2/sta/data/own_data.h111
-rw-r--r--cesar/cp2/sta/data/sta_data.h122
5 files changed, 379 insertions, 0 deletions
diff --git a/cesar/cp2/sta/data/inc/own_data.h b/cesar/cp2/sta/data/inc/own_data.h
new file mode 100644
index 0000000000..df9e67ca0c
--- /dev/null
+++ b/cesar/cp2/sta/data/inc/own_data.h
@@ -0,0 +1,30 @@
+#ifndef cp2_sta_data_inc_own_data_h
+#define cp2_sta_data_inc_own_data_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp2/sta/data/inc/own_data.h
+ * \brief Station own data.
+ * \ingroup cp_sta_data
+ *
+ * Structure containing the station own data.
+ */
+
+struct cp_sta_own_data_private
+{
+ /** STA's tei. */
+ u8 tei;
+ /** Mac address. */
+ mac_t mac_address;
+ /** Security level. */
+ u8 security_level;
+};
+typedef struct cp_sta_own_data_private cp_sta_own_data_private;
+
+
+#endif /* cp2_sta_data_inc_own_data_h */
diff --git a/cesar/cp2/sta/data/inc/sta_data.h b/cesar/cp2/sta/data/inc/sta_data.h
new file mode 100644
index 0000000000..9bfe395837
--- /dev/null
+++ b/cesar/cp2/sta/data/inc/sta_data.h
@@ -0,0 +1,33 @@
+#ifndef cp2_sta_data_inc_sta_data_h
+#define cp2_sta_data_inc_sta_data_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp2/sta/data/inc/sta_data.h
+ * \brief Sta private paramters.
+ * \ingroup cp_sta_data
+ *
+ */
+
+struct cp_sta_private_t
+{
+ /** TEI of the station. */
+ u8 tei;
+ /** STA's mac address. */
+ mac_t mac_address;
+ /** boolean associated. */
+ bool assoc;
+ /** CCo status. */
+ bool cco_status;
+ /** PCo status. */
+ bool pco_status;
+ /** backup CCo status. */
+ bool backup_cco_status;
+};
+
+#endif /* cp2_sta_data_inc_sta_data_h */
diff --git a/cesar/cp2/sta/data/net_list.h b/cesar/cp2/sta/data/net_list.h
new file mode 100644
index 0000000000..52f1ff1d8e
--- /dev/null
+++ b/cesar/cp2/sta/data/net_list.h
@@ -0,0 +1,83 @@
+#ifndef cp2_sta_data_net_list_h
+#define cp2_sta_data_net_list_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp2/sta/data/net_list.h
+ * \brief CP Net list managing an AVLN.
+ * \ingroup cp_sta_data
+ *
+ * The Network list data for one AVLN.
+ */
+
+#include "cp2/sta/data/sta_list.h"
+
+struct cp_net_list_t
+{
+ /** Short Network ID. */
+ u16 snid;
+ /** Network ID. */
+ u64 nid;
+ /** Network Membership Key. */
+ uint nmk;
+ /** Network password. */
+ u128 npw;
+ /** Network present. */
+ bool present;
+ /** CCo in the AVLN. */
+ cp_sta_t cco;
+ /** PCo in the AVLN. */
+ cp_sta_t pco;
+};
+typedef struct cp_net_list_t cp_net_list_t;
+
+/** Add a sta to this AVLN.
+ * \param net_list the net list to add the sta.
+ * \param sta the sta to add.
+ */
+void
+cp_net_list_add_sta(cp_net_list_t *net_list, cp_sta_t *sta);
+
+/** Remove a station from the AVLN.
+ * \param net_list the list to remove ths sta.
+ * \param the sta to remove.
+ */
+void
+cp_net_list_remove_sta(cp_net_list_t *net_list, cp_sta_t *sta);
+
+/** Remove the sta by providing the STA's tei from this AVLN.
+ * \param net_list the net_list from the one the sta shall be removed.
+ * \param tei the station's tei.
+ */
+void
+cp_net_list_remove_sta_from_tei(cp_net_list_t *net_list, u8 tei);
+
+/** Get the station from the AVLN.
+ * \param net_list the net_list to get the station.
+ * \param tei the tei of the station.
+ * \return the station if it is in the AVLN, NULL otherwise.
+ */
+cp_sta_t *
+cp_net_list_get_sta(cp_net_list_t *net_list, u8 tei);
+
+/** Get the first station of the AVLN.
+ * \param net_list the AVLN list to get it's first sta.
+ * \return the first station if the AVLN has one.
+ */
+cp_sta_t *
+cp_net_list_first_sta(cp_net_list_t *net_list);
+
+/** Get the next station from the AVLN.
+ * \param net_list the AVLN net list.
+ * \param sta the current station to get the next one.
+ * \return the next station of the one provided.
+ */
+cp_sta_t *
+cp_sta_t cp_net_list_next_sta(cp_net_list_t *net_list, cp_sta_t *sta);
+
+#endif /* cp2_sta_data_net_list_h */
diff --git a/cesar/cp2/sta/data/own_data.h b/cesar/cp2/sta/data/own_data.h
new file mode 100644
index 0000000000..2865cd1346
--- /dev/null
+++ b/cesar/cp2/sta/data/own_data.h
@@ -0,0 +1,111 @@
+#ifndef cp2_sta_data_own_data_h
+#define cp2_sta_data_own_data_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp2/sta/data/own_data.h
+ * \brief Station own data.
+ * \ingroup cp_sta_data
+ *
+ * Structure containing the station own data.
+ */
+
+#include "cp2/defs.h"
+#include "cp2/sta/data/inc/own_data.h"
+
+/** Waning When storing data bigger than one word, think about the access. */
+
+struct cp_sta_own_data
+{
+ /** Private part only usable with the accessor defined below. */
+ cp_sta_own_data_private private;
+
+ /** NID. */
+ u64 nid;
+ /** NMK. */
+ u8 nmk[NMK_SIZE];
+ /** Network password. */
+ u8 npw[MAX_NPW_SIZE];
+ /** Devide password. */
+ u8 dpw[MAX_DPW_SIZE];
+
+
+ /** CCo prefered status. */
+ bool cco_prefered;
+ /** Was CCo status. */
+ bool was_cco;
+
+
+ /** Manufacturer Human identifier. */
+ u8 hfid_manu[HFID_SIZE];
+ /** User HFID. */
+ u8 hfid_user[HFID_SIZE];
+ /** Avln HFID. */
+ u8 hfid_avln[HFID_SIZE];
+};
+typedef struct cp_sta_own_data cp_sta_own_data;
+
+/** Initialise the sta own data
+ * \param ctx the CP context.
+ */
+void
+cp_sta_data_own_init (cp_t *ctx);
+
+/** Uninitialise the sta own data.
+ * \param ctx the cp context.
+ */
+void
+cp_sta_data_own_uninit (cp_t *ctx);
+
+/** Set the Mac address of the sta.
+ * \param ctx the CP context.
+ * \param mac the mac address of the station.
+ *
+ * This function will update the mac config to update the mac address in it.
+ */
+void
+cp_sta_data_own_set_mac_address (cp_t *ctx);
+
+/** Get the Mac address of the sta.
+ * \param ctx the CP context.
+ * \return the station's mac address.
+ */
+mac_t
+cp_sta_data_own_get_mac_address (cp_t *ctx);
+
+/** Set the TEI of the station.
+ * \param ctx the cp context.
+ * \param tei the station's tei.
+ *
+ * This function will update the mac config.
+ */
+void
+cp_sta_data_own_set_tei (cp_t *ctx, u8 tei);
+
+/** Get the station's tei.
+ * \param ctx the CP context.
+ * \return the station's tei.
+ */
+u8
+cp_sta_data_own_get_tei (cp_t *ctx);
+
+/** Set the station Security level.
+ * \param ctx the CP context.
+ * \param sl the security level policy.
+ */
+void
+cp_sta_data_own_set_security_level (cp_t *ctx, u8 sl);
+
+/** Get the security level.
+ * \param ctx the CP context.
+ * \return the station's security level.
+ */
+u8
+cp_sta_data_own_get_security_level (cp_t *ctx);
+
+#endif /* cp2_sta_data_own_data_h */
diff --git a/cesar/cp2/sta/data/sta_data.h b/cesar/cp2/sta/data/sta_data.h
new file mode 100644
index 0000000000..d7dba97021
--- /dev/null
+++ b/cesar/cp2/sta/data/sta_data.h
@@ -0,0 +1,122 @@
+#ifndef cp2_sta_data_sta_data_h
+#define cp2_sta_data_sta_data_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp2/sta/data/sta_data.h
+ * \brief Sta data.
+ * \ingroup cp_sta_data
+ *
+ * Sta data.
+ */
+
+/* forward declaration. */
+typedef struct cp_sta_data_private_t cp_sta_data_private_t;
+
+struct cp_msg_reassembly_ctx_t
+{
+
+};
+typedef struct cp_msg_reassembly_ctx_t cp_msg_reassembly_ctx_t;
+
+struct cp_sta_data_t
+{
+ /** Private part. */
+ cp_sta_data_private_t private;
+ /** Visible true if the STA is visible by out STA. */
+ bool visible;
+ /** Last seen. */
+ uint last_seen_ntb;
+ /** Reassembly context. */
+ cp_msg_reassembly_ctx_t rea;
+};
+typedef struct cp_sta_data_t cp_sta_data_t;
+
+/** Get the TEI of the station.
+ * \param sta the station.
+ * \return the sta's tei.
+ */
+u8
+cp_sta_get_tei(cp_sta_t *sta);
+
+/** Get the mac address of the station.
+ * \param sta the station.
+ * \return the sta's mac address.
+ */
+mac_t
+cp_sta_get_mac_address(cp_sta_t *sta);
+
+/** Set the associated status of the station.
+ * \param sta the station.
+ * \param associated the association status, true if associated, false
+ * otherwise.
+ */
+void
+cp_sta_set_associated (cp_sta_t *sta, bool associated);
+
+/** Get the association status.
+ * \param sta the station.
+ * \return the association status.
+ *
+ * This function will return true if the station is associated, false
+ * otherwise.
+ */
+bool
+cp_sta_is_associated (cp_sta_t *sta);
+
+/** Set the CCo status of the station.
+ * \param sta the station.
+ * \param cco the cco status, true if the sta is cco, false otherwise.
+ */
+void
+cp_sta_set_cco_status (cp_sta_t *sta, bool cco);
+
+/** Get the station CCo's status.
+ * \param sta the station.
+ * \return the cco status of the sta.
+ *
+ * This function will return true if the Station is CCo, false otherwise.
+ */
+bool
+cp_sta_is_cco_status (cp_sta_t *sta);
+
+/** Set the PCo status of the station.
+ * \param sta the station.
+ * \param pco the pco status, true if the sta is pco false otherwise.
+ */
+void
+cp_sta_set_pco_status (cp_sta_t *sta, bool pco);
+
+/** Get the PCo status of the station.
+ * \param sta the station.
+ * \return the PCo's station status.
+ *
+ * This will return true if the STA is PCo, false otherwise.
+ */
+bool
+cp_sta_is_pco_status (cp_sta_t *sta);
+
+/** Set the backup CCo status of the station.
+ * \param sta the station.
+ * \param backup_cco the backup cco status.
+ *
+ * This shall set true if the station is backup CCo, false otherwise.
+ */
+void
+cp_sta_set_backup_cco_status (cp_sta_t *sta, bool backup_cco);
+
+/** Get the backup CCo of the station.
+ * \param sta the sta.
+ * \return the sta's backup cco status.
+ *
+ * This will return true if the station is backup cco, false otherwise.
+ */
+bool
+cp_sta_is_backup_cco_status (cp_sta_t *sta);
+
+#endif /* cp2_sta_data_sta_data_h */