summaryrefslogtreecommitdiff
path: root/cesar/mac/common/defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/mac/common/defs.h')
-rw-r--r--cesar/mac/common/defs.h110
1 files changed, 110 insertions, 0 deletions
diff --git a/cesar/mac/common/defs.h b/cesar/mac/common/defs.h
new file mode 100644
index 0000000000..0e311629d1
--- /dev/null
+++ b/cesar/mac/common/defs.h
@@ -0,0 +1,110 @@
+#ifndef mac_common_defs_h
+#define mac_common_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file mac/common/defs.h
+ * \brief Mac common definitions.
+ * \ingroup mac_common
+ */
+
+/** Number of usable bytes per PB520. */
+#define MAC_PB520_BYTES 512
+
+/** Number of usable bytes per PB136. */
+#define MAC_PB136_BYTES 128
+
+/** Maximum number of symbols per MPDU. */
+#define MAC_MAX_SYMB_PER_MPDU 112
+
+/** Maximum number of physical PHY blocks per MPDU. */
+#define MAC_MAX_PB_PER_MPDU 236
+
+/** Link identifiers. */
+enum mac_lid_t
+{
+ MAC_LID_MIN = 0x00,
+ MAC_PLID_MIN = 0x00,
+ MAC_PLID_MAX = 0x03,
+ MAC_PLID_NB = MAC_PLID_MAX - MAC_PLID_MIN + 1,
+ MAC_LLID_MIN = 0x04,
+ MAC_LLID_MAX = 0x7f,
+ MAC_LLID_NB = MAC_LLID_MAX - MAC_LLID_MIN + 1,
+ MAC_GLID_MIN = 0x80,
+ MAC_GLID_MAX = 0xf7,
+ MAC_GLID_NB = MAC_GLID_MAX - MAC_GLID_MIN + 1,
+ MAC_LID_MAX = 0xf7,
+ MAC_LID_NB = MAC_LID_MAX - MAC_LID_MIN + 1,
+ MAC_LID_NONE = 0xf8,
+ MAC_LID_SPC_HOLE = 0x00,
+ MAC_LID_SPC_CENTRAL = 0xfb,
+ MAC_LID_CFPI = 0xfc,
+ MAC_LID_DISCOVER = 0xfd,
+ MAC_LID_BEACON_MAX = MAC_LID_DISCOVER,
+ MAC_LID_SHARED_CSMA = 0xfe,
+ MAC_LID_LOCAL_CSMA = 0xff
+};
+
+/** Test if a LID is a Priority LID (PLID).
+ * \warning This is a macro, the argument may be evaluated several time. */
+#define MAC_LID_IS_PLID(lid) ((lid) < MAC_PLID_NB)
+
+/** Test if a LID is a Local LID (LLID).
+ * \warning This is a macro, the argument may be evaluated several time. */
+#define MAC_LID_IS_LLID(lid) ((lid) >= MAC_LLID_MIN && (lid) <= MAC_LLID_MAX)
+
+/** Test if a LID is a Global LID (GLID).
+ * \warning This is a macro, the argument may be evaluated several time. */
+#define MAC_LID_IS_GLID(lid) ((lid) >= MAC_GLID_MIN && (lid) <= MAC_GLID_MAX)
+
+/** Test if a LID is a connection based link LID (LLID or GLID).
+ * \warning This is a macro, the argument may be evaluated several time. */
+#define MAC_LID_IS_CLID(lid) ((lid) >= MAC_LLID_MIN && (lid) <= MAC_GLID_MAX)
+
+/** Test if a LID is a regular LID (any of PLID, LLID or GLID).
+ * \warning This is a macro, the argument may be evaluated several time. */
+#define MAC_LID_IS_XLID(lid) ((lid) < MAC_LID_NB)
+
+/** Terminal Equipment Identifier. */
+enum mac_tei_t
+{
+ MAC_TEI_UNASSOCIATED = 0,
+ MAC_TEI_STA_MIN = 1,
+ MAC_TEI_STA_MAX = 0xfe,
+ MAC_TEI_STA_NB = MAC_TEI_STA_MAX - MAC_TEI_STA_MIN + 1,
+ MAC_TEI_BCAST = 0xff,
+};
+
+/** Test if a TEI is between STA_MIN and STA_MAX.
+ * \warning This is a macro, the argument may be evaluated several time. */
+#define MAC_TEI_IS_STA(tei) \
+ ((tei) >= MAC_TEI_STA_MIN && (tei) <= MAC_TEI_STA_MAX)
+
+/** Coexistence modes.
+ * \warning Full Hybrid mode is also used in CSMA-Only with HomePlug 1.0
+ * compatible frame length. This maps directly to beacon HM field. */
+enum mac_coexistence_mode_t
+{
+ MAC_COEXISTENCE_AV_ONLY_MODE,
+ MAC_COEXISTENCE_SHARED_CSMA_HYBRID_MODE,
+ MAC_COEXISTENCE_FULL_HYBRID_MODE,
+ MAC_COEXISTENCE_HYBRID_DELIMITERS_MODE,
+ MAC_COEXISTENCE_NB,
+};
+typedef enum mac_coexistence_mode_t mac_coexistence_mode_t;
+
+/** Encryption Key Select. */
+enum mac_eks_t
+{
+ MAC_EKS_MIN = 0,
+ MAC_EKS_MAX = 7,
+ MAC_EKS_NB = MAC_EKS_MAX - MAC_EKS_MIN + 1,
+ MAC_EKS_CLEAR = 0xf,
+};
+
+#endif /* mac_common_defs_h */