diff --git a/src/1905_tlvs.h b/src/1905_tlvs.h index c0990979dbfd90bfb21c48467c13b670cbeaa275..70266183201e65d9cc6dfcf82eb27cffc45e14f6 100644 --- a/src/1905_tlvs.h +++ b/src/1905_tlvs.h @@ -557,4 +557,228 @@ struct tlv_ttl { uint16_t ttl; /* in secs */ } __attribute__((packed)); +#define IEEE1905_TCLAS_ELEM_ID (14) +#define IEEE1905_TCLAS_PROCESSING_ELEM_ID (44) + +struct ieee1905_element { + uint8_t element_id; + uint8_t length; + uint8_t data[]; +} __attribute__((packed));; + +struct ieee1905_ext_element { + uint8_t element_id; + uint8_t element_id_ext; + uint8_t length; + uint8_t data[]; +} __attribute__((packed));; + +struct ieee1905_vendor_element { + uint8_t element_id; + uint8_t length; + uint8_t oui[3]; + uint8_t oui_type; + uint8_t data[]; +} __attribute__((packed)); + +struct ieee1905_tclas_elem_cls_type4_ipv4 { + uint32_t src_ip; + uint32_t dst_ip; + uint16_t src_port; + uint16_t dst_port; + uint8_t dscp; + uint8_t protocol; + uint8_t param_mask; +}; + +struct ieee1905_tclas_elem_cls_type4_ipv6 { + uint8_t src_ip[16]; + uint8_t dst_ip[16]; + uint16_t src_port; + uint16_t dst_port; + uint8_t dscp; + uint8_t next_header; + uint8_t flow_label[3]; + uint8_t param_mask; +}; + +struct ieee1905_tclas_elem_cls_type4 { + uint8_t classifier_mask; + uint8_t ip_version; + union { + struct ieee1905_tclas_elem_cls_type4_ipv4 ipv4; + struct ieee1905_tclas_elem_cls_type4_ipv6 ipv6; + }; +}; + +enum ieee1905_tclas_elem_frame_classifier_type { + IEEE1905_TCLAS_ELEM_FRAME_CLASSIFIER_TYPE_ETH = 0, + IEEE1905_TCLAS_ELEM_FRAME_CLASSIFIER_TYPE_TCP_UDP_IP = 1, + IEEE1905_TCLAS_ELEM_FRAME_CLASSIFIER_TYPE_8021Q = 2, + IEEE1905_TCLAS_ELEM_FRAME_CLASSIFIER_TYPE_FILTER_OFFSET = 3, + IEEE1905_TCLAS_ELEM_FRAME_CLASSIFIER_TYPE_IP = 4, + IEEE1905_TCLAS_ELEM_FRAME_CLASSIFIER_TYPE_8021DQ = 5, + IEEE1905_TCLAS_ELEM_FRAME_CLASSIFIER_TYPE_8021MAC = 6, + IEEE1905_TCLAS_ELEM_FRAME_CLASSIFIER_TYPE_DL_PV1 = 7, + IEEE1905_TCLAS_ELEM_FRAME_CLASSIFIER_TYPE_UL_PV1 = 8, + IEEE1905_TCLAS_ELEM_FRAME_CLASSIFIER_TYPE_PV1_FULL = 9, + IEEE1905_TCLAS_ELEM_FRAME_CLASSIFIER_TYPE_IP_EXT= 10, +}; + +struct ieee1905_tclas_elem_frame_classifier { + uint8_t type; /**< Belongs to ieee1905_tclas_elem_frame_classifier_type + enumeration */ + /* classifier mask is put into specific classifier type for ease */ + union { + struct ieee1905_tclas_elem_cls_type4 params4; + }; +}; + +/* TCLAS element */ +struct ieee1905_tclas_elem { + uint8_t user_priority; + struct ieee1905_tclas_elem_frame_classifier classifier; +}; + +enum ieee1905_scs_desc_request_type { + IEEE1905_SCS_DESC_REQUEST_TYPE_ADD = 0, + IEEE1905_SCS_DESC_REQUEST_TYPE_REMOVE = 1, + IEEE1905_SCS_DESC_REQUEST_TYPE_CHANGE = 2, +}; + +struct ieee1905_tclas_processing { + uint8_t processing; +}; + +/* + * This structure can't be used directly because of variable tclas_elems in the + * middle + */ +struct ieee1905_scs_desc_add_change { + uint32_t intra_access_category_priority:24; + + /* Please note that elements must be prepended with ieee1905_element */ + struct ieee1905_tclas_elem tclas_elems[0]; + + struct ieee1905_element processing_element; /* ieee1905_tclas_processing */ +}; + + +#define IEEE1905_SCS_DESC_ELEM_ID (185) + +/** + * Part 11: Wireless LAN Medium Access Control + * (MAC) and Physical Layer (PHY) Specifications + * 9.4.2.121 SCS Descriptor element + */ +struct ieee1905_scs_desc { + uint8_t scsid; + uint8_t request_type; /* belongs to ieee1905_scs_desc_request_type enum */ + union { + struct ieee1905_scs_desc_add_change add_change; + uint8_t __dummy[0]; + }; +}; + +#define IEEE1905_MSCS_DESC_ELEM_ID (255) +#define IEEE1905_MSCS_DESC_ELEM_ID_EXT (88) + +/** + * Part 11: Wireless LAN Medium Access Control + * (MAC) and Physical Layer (PHY) Specifications + * 9.4.2.243 MSCS Descriptor element + */ +struct ieee1905_mscs_desc { + uint8_t request_type; /* belongs to ieee1905_scs_desc_request_type enum */ + uint8_t up_bitmap; + uint8_t up_limit; + int32_t stream_timeout; + + /* + * These elements are TCLAS Mask Elements (9.4.2.242), not TCLAS Elements + * directly + */ + struct ieee1905_tclas_elem tclas_elems[0]; +}; + +/* User-friendly structures that might be used in configuration parsing */ +struct ieee1905_scs_desc_usr { + uint8_t scsid; + uint32_t intra_access_category_priority; + + /* TCLAS elements */ + uint32_t tclas_elems_count; + struct ieee1905_tclas_elem *tclas_elems; + + /* Processing part */ + uint8_t processing; + uint8_t processing_present; +}; + +struct ieee1905_mscs_desc_usr { + uint8_t up_bitmap; + uint8_t up_limit; + int32_t stream_timeout; + + uint32_t tclas_elems_count; + struct ieee1905_tclas_elem *tclas_elems; +}; + +/* WiFi Easy Mesh Specification 17.2.71 - DSCP Mapping Table TLV */ +struct ieee1905_dscp_pcp_usr { + uint8_t dscp_pcp[64]; +}; + +/** Possible QoS management attribute IDs */ +enum ieee1905_qos_mgmt_attr_id { + IEEE1905_QOS_MGMT_ATTR_ID_PORT_RANGE = 1, + IEEE1905_QOS_MGMT_ATTR_ID_DSCP_POLICY = 2, + IEEE1905_QOS_MGMT_ATTR_ID_TCLAS = 3, + IEEE1905_QOS_MGMT_ATTR_ID_DOMAIN_NAME = 4, +}; + +#define IEEE1905_QOS_MGMT_ELEM_ID (0xDD) +#define IEEE1905_QOS_MGMT_ELEM_OUI { 0x50, 0x6F, 0x9A } +#define IEEE1905_QOS_MGMT_ELEM_OUI_TYPE (1) + +/** + * Single QoS management attribute - user-friendly container + */ +struct ieee1905_qos_mgmt_attr_usr { + uint8_t attribute_id; /* belongs to ieee1905_qos_mgmt_attr_id enumeration */ + union { + struct { + uint16_t start_port; /**< Start port in port range */ + uint16_t end_port; /**< End port in port range */ + } port_range; + struct { + uint8_t dscp_policy_id; /**< DSCP policy ID */ + uint8_t request_type; /* practically, this field is not needed + here, but we keep it here in order to + have just one structure for write/recv + functions */ + uint8_t dscp; /**< Target DSCP value */ + } dscp_policy; + struct { + struct ieee1905_tclas_elem_frame_classifier classifier; /**< + Complete TCLAS classifier */ + } tclas; + struct { + uint32_t domain_name_len; /**< Target domain name length */ + uint8_t *domain_name; /**< Target domain name */ + } domain_name; + }; +}; + +/** + * QoS management attribute container + */ +struct ieee1905_qos_mgmt_usr { + uint32_t attributes_count; /**< Number of + attributes + in attributes + field */ + struct ieee1905_qos_mgmt_attr_usr *attributes; /**< Array of attributes */ +}; + #endif /* _1905_TLVS_H_ */ diff --git a/src/extensions/map/easymesh.h b/src/extensions/map/easymesh.h index a91fd55df10cc7469b5552d51904da3bef213bb4..0a60bb03e9f1ccc8d8977430f48ee69cc7da73b1 100644 --- a/src/extensions/map/easymesh.h +++ b/src/extensions/map/easymesh.h @@ -1492,25 +1492,25 @@ struct tlv_sr_config_response { uint8_t code; } __attribute__((packed)); - -/** TLV: QoS management policy */ -struct tlv_qos_management_policy { - uint8_t num_mscs_disallowed; - struct sta_macaddr mscs_disallowed; - uint8_t num_scs_disallowed; - struct sta_macaddr scs_disallowed; -} __attribute__((packed)); - - /** TLV: QoS management descriptor */ -struct tlv_qos_management_desc { - uint16_t qmid; - uint8_t bssid[6]; - uint8_t sta[6]; - uint8_t desc[]; +struct tlv_qos_mgmt_desc { + uint16_t qmid; + macaddr_t bssid; + macaddr_t sta; + uint8_t desc[]; +} __attribute__((packed)); + +/** WiFi Easy Mesh Specification 17.2.70 Service Prioritization Requesst TLV */ +struct tlv_spr { + uint32_t rule_id; + uint8_t add_remove:1; + uint8_t rsvd1:7; + uint8_t precedence; + uint8_t output; + uint8_t always_match:1; + uint8_t rsvd2:7; } __attribute__((packed)); - /** TLV: Controller capability */ struct tlv_controller_cap { #define CONTROLLER_KIBMIB_COUNTER_SUPPORTED BIT(7)