From 09b3dfa4c6482e32128513e186b7379ea7269c26 Mon Sep 17 00:00:00 2001 From: chertier Date: Thu, 27 Mar 2008 17:44:25 +0000 Subject: 1st try of full station integration with CP+DP and new interface/sniffer module - manage DRV MMEs to setup CP/station parameters - manage MME header with or without VLAN Tag field git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1669 017c9cb6-072f-447c-8318-d5b54f68fe89 --- cp/msg/inc/msg_const.h | 136 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 115 insertions(+), 21 deletions(-) diff --git a/cp/msg/inc/msg_const.h b/cp/msg/inc/msg_const.h index 2bff4a8b8d..c393d63df8 100644 --- a/cp/msg/inc/msg_const.h +++ b/cp/msg/inc/msg_const.h @@ -20,14 +20,40 @@ /* * Homeplug AV constantes */ -#define MSG_VLAN_TAG 0 // TBD -#define MSG_MTYPE 0xE188 // 11.1 -#define MSG_MME_HEADER_SIZE 19 -#define MSG_MM_VERSION 0x01 // 11.1.5 +#define MSG_VLAN_TAG 0 // TBD +#define MSG_VLAN_TAG_IEEE_802_1Q 0x8100 // 11.1.3 +#define MSG_MTYPE 0x88E1 // 11.1 +#define MSG_MTYPE_IEEE_ETHERTYPE MSG_MTYPE +#define MSG_MME_HEADER_SIZE 19 +#define MSG_MM_VERSION 0x01 // 11.1.5 + +/* physical min & max length of MME header (refer to Table 11-178 in HP_AV spec) */ +#define MME_HEADER_MINSIZE 19 // physical min length of MME message header (MME header having no "VLAN Tag" field) +#define MME_HEADER_MAXSIZE 23 // physical max length of MME message header (MME header having a "VLAN Tag" field) + /* * other constants */ +// MMTYPE base-values for DRV-MME messages +#define DRV_STA_SET_MAC_ADDR 0xA000 +#define DRV_STA_SET_CCO_PREF 0xA004 +#define DRV_STA_SET_WAS_CCO 0xA008 +#define DRV_STA_SET_NPW 0xA00C +#define DRV_STA_SET_DPW 0xA010 +#define DRV_STA_SET_SL 0xA014 +#define DRV_STA_SET_M_STA_HFID 0xA018 +#define DRV_STA_SET_U_STA_HFID 0xA01C +#define DRV_STA_SET_AVLN_HFID 0xA020 +#define DRV_STA_SET_TONEMASK 0xA024 +#define DRV_STA_START 0xA028 +#define DRV_STA_STOP 0xA02C + +// MMTYPE sub-values for MMEs (REQ, CNF, IND or RSP) +#define REQ 0x00 +#define CNF 0x01 +#define IND 0x02 +#define RSP 0x03 /* * mm type constants @@ -151,21 +177,32 @@ typedef enum mm_type_t CM_LINK_STATS_REQ = 0x604C, CM_LINK_STATS_CNF = 0x604D, - DRV_MAC_START_REQ = 0x8000, - DRV_SET_MAC_ADDRESS_REQ = 0x8001, - DRV_SET_CCO_PREFERENCE_REQ = 0x8002, - DRV_SET_WAS_CCO_REQ = 0x8003, - DRV_SET_NPW_REQ = 0x8004, - DRV_SET_DPW_REQ = 0x8005, - DRV_SET_M_STA_HFID_REQ = 0x8006, - DRV_SET_U_STA_HFID_REQ = 0x8007, - DRV_SET_AVLN_HFID_REQ = 0x8008, - DRV_SET_SL_REQ = 0x8009, - DRV_SET_TONEMASK_REQ = 0x800A, - DRV_SET_NID_REQ = 0x800B, - DRV_SET_SNID_REQ = 0x800C, - DRV_MAC_STOP_REQ = 0x800D, - + DRV_STA_SET_MAC_ADDR_REQ = DRV_STA_SET_MAC_ADDR + REQ, + DRV_STA_SET_MAC_ADDR_CNF = DRV_STA_SET_MAC_ADDR + CNF, + DRV_STA_SET_CCO_PREF_REQ = DRV_STA_SET_CCO_PREF + REQ, + DRV_STA_SET_CCO_PREF_CNF = DRV_STA_SET_CCO_PREF + CNF, + DRV_STA_SET_WAS_CCO_REQ = DRV_STA_SET_WAS_CCO + REQ, + DRV_STA_SET_WAS_CCO_CNF = DRV_STA_SET_WAS_CCO + CNF, + DRV_STA_SET_WAS_CCO_IND = DRV_STA_SET_WAS_CCO + IND, + DRV_STA_SET_WAS_CCO_RSP = DRV_STA_SET_WAS_CCO + RSP, + DRV_STA_SET_NPW_REQ = DRV_STA_SET_NPW + REQ, + DRV_STA_SET_NPW_CNF = DRV_STA_SET_NPW + CNF, + DRV_STA_SET_DPW_REQ = DRV_STA_SET_DPW + REQ, + DRV_STA_SET_DPW_CNF = DRV_STA_SET_DPW + CNF, + DRV_STA_SET_SL_REQ = DRV_STA_SET_SL + REQ, + DRV_STA_SET_SL_CNF = DRV_STA_SET_SL + CNF, + DRV_STA_SET_M_STA_HFID_REQ = DRV_STA_SET_M_STA_HFID + REQ, + DRV_STA_SET_M_STA_HFID_CNF = DRV_STA_SET_M_STA_HFID + CNF, + DRV_STA_SET_U_STA_HFID_REQ = DRV_STA_SET_U_STA_HFID + REQ, + DRV_STA_SET_U_STA_HFID_CNF = DRV_STA_SET_U_STA_HFID + CNF, + DRV_STA_SET_AVLN_HFID_REQ = DRV_STA_SET_AVLN_HFID + REQ, + DRV_STA_SET_AVLN_HFID_CNF = DRV_STA_SET_AVLN_HFID + CNF, + DRV_STA_SET_TONEMASK_REQ = DRV_STA_SET_TONEMASK + REQ, + DRV_STA_SET_TONEMASK_CNF = DRV_STA_SET_TONEMASK + CNF, + DRV_STA_START_REQ = DRV_STA_START + REQ, + DRV_STA_START_CNF = DRV_STA_START + CNF, + DRV_STA_STOP_REQ = DRV_STA_STOP + REQ, + DRV_STA_STOP_CNF = DRV_STA_STOP + CNF, TEST_MSG_NUM, MSG_UNKNOW = 0xFFFF @@ -205,11 +242,51 @@ typedef struct msg_mme_b_t // Table 11-178 u8 mm_entry[ETH_PACKET_MAX_SIZE - MSG_MME_HEADER_SIZE - 4]; } __attribute__ ((packed)) msg_mme_b_t; +/* + * MME header + * + * here, it is not the MME header format on phy but internal software format + * avoiding memory-alignment questions, thus more easy & suitable + * to manage MME header info + */ +struct mme_header_type { + bool vlan_tag_flag; + union { + u8 b[8]; + unsigned long long u64; + } un_osa; + union { + u8 b[8]; + unsigned long long u64; + } un_oda; + union { + u8 b[4]; + unsigned long u32; + } un_vlan_tag; + union { + u8 b[4]; + unsigned long u32; + } un_mtype; + union { + u8 b[4]; + unsigned long u32; + } un_mmv; + union { + u8 b[4]; + unsigned long u32; + } un_mmtype; + union { + u8 b[4]; + unsigned long u32; + } un_fmi; +}; +typedef struct mme_header_type mme_header_type; + typedef struct msg_list_mme_t { - mm_type_t mm_type; // Message type + mm_type_t mm_type; // HP_AV Message type identifier //void (*msg_func) (const msg_mme_t *msg); // Function processing the message - int msg_num; + int msg_num; // FSM transition identifier (see FSM data & constants generated by VisualState from FSM model designed with VisualState) } msg_list_mme_t; typedef enum encryption_type_t @@ -227,5 +304,22 @@ typedef struct msg_param_t peks_t peks; // if the message is soft encrypted, set the peks } msg_param_t; +/** + * \brief Get DRV-MME .REQ message name + * + * \param cnf the REQ message type identifier + * \return the .REQ message name string constant + */ +char * +get_str_drv_mme_req(int req); + +/** + * \brief Get DRV-MME .CNF message name + * + * \param cnf the CNF message type identifier + * \return the .CNF message name string constant + */ +char * +get_str_drv_mme_cnf(int cnf); #endif /*MSG_CONST_H_*/ -- cgit v1.2.3