summaryrefslogtreecommitdiff
path: root/cesar/cp/msg/inc/msg_field.h
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp/msg/inc/msg_field.h')
-rw-r--r--cesar/cp/msg/inc/msg_field.h410
1 files changed, 410 insertions, 0 deletions
diff --git a/cesar/cp/msg/inc/msg_field.h b/cesar/cp/msg/inc/msg_field.h
new file mode 100644
index 0000000000..d970de1b3c
--- /dev/null
+++ b/cesar/cp/msg/inc/msg_field.h
@@ -0,0 +1,410 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}}
+ * \file msg_cm_conn_field.h
+ * \brief File Description
+ * \ingroup cp/msg
+ *
+ */
+
+
+#ifndef MSG_CM_CONN_FIELD_H_
+#define MSG_CM_CONN_FIELD_H_
+
+#include "cp/msg/inc/msg_const.h"
+
+/////////////////// ENUM ///////////////////////////
+
+// QMP Forward/Reverse definition (section 7.8.1 table 7-146)
+typedef enum
+{
+ QMP_FORWARD = 0x00, // forward (from source to receiver)
+ QMP_REVERSE = 0X01 // reverse (from receiver to source)
+} qmp_forward_or_reverse_t;
+
+// VALID CINFO definition (section 7.8.1 table 7-145)
+typedef enum
+{
+ CINFO_NOT_VALID = 0x00,
+ CINFO_VALID = 0x01
+} cinfo_valid_t;
+
+// MAC Service Type definition (section 7.8.1 table 7-145)
+typedef enum
+{
+ MAC_CONTENTION_FREE = 0x00, // Contention-free service
+ MAC_CONTENTION = 0x01, // Contention-based service
+ MAC_CONTENTION_FREE_PREFERRED = 0x02 // Contention-free service preferred
+} mac_service_type_t;
+
+// User Priority definition (section 7.8.1 table 7-145)
+typedef enum
+{
+ USER_PRIORITY_CAP0 = 0x00,
+ USER_PRIORITY_CAP1 = 0x01,
+ USER_PRIORITY_CAP2 = 0x02,
+ USER_PRIORITY_CAP3 = 0x03
+} user_priority_t;
+
+// Arrival Time Stamp definition (section 7.8.1 table 7-145)
+typedef enum
+{
+ ATS_NOT_FOR_HLE = 0x00,
+ ATS_FOR_HLE = 0x01
+} ats_t;
+
+/////////////////// DEFINTION ///////////////////////////
+
+typedef u32 len_t;
+
+// QMP Length definition (section 7.8.1 table 7-146)
+typedef u8 qmp_len_t;
+
+// CSPEC_LEN definition (section 7.8.1 table 7-144)
+typedef u16 cspec_len_t; // Length of CSPEC, including the 2 octets CSPEC_LEN field
+
+// CID definition (section 5.2.1.4.2)
+typedef u16 cid_t;
+
+// LID definition (section 5.2.1.4.2)
+typedef u8 lid_t;
+
+// LLID definition (section 5.2.1.4.2)
+typedef u8 llid_t;
+
+// LLID_F definition (section 5.2.1.4.2)
+typedef u8 llid_f_t;
+
+// LLID_R definition (section 5.2.1.4.2)
+typedef u8 llid_r_t;
+
+// TEI (Terminal Equipment Identifier) definition (section 7.3.2.1)
+//typedef u8 tei_t;
+
+// QMP Body
+#define MAX_SIZE_QMP_BODY 37
+typedef u8 qmp_body_t[MAX_SIZE_QMP_BODY];
+
+
+typedef struct
+{
+ bool available;
+ u32 value;
+}qmp_delay_bound_t;
+
+typedef struct
+{
+ bool delay_bound_available :1;
+ bool jitter_bound_available:1;
+ bool average_msdu_size_available:1;
+ bool maximum_msdu_size_available:1;
+ bool average_data_rate_available:1;
+ bool minimum_data_rate_available:1;
+ bool maximum_data_rate_available:1;
+ bool maximum_inter_txop_time_available:1;
+ bool minimum_inter_txop_time_available:1;
+ bool maximum_burst_size_available:1;
+ bool exception_policy_available:1;
+ bool inactivity_interval_available:1;
+ bool msdu_error_rate_available:1;
+ bool clst_available:1;
+ bool cdesc_available:1;
+ bool vendor_specific_available:1;
+ bool ats_tolerance_available:1;
+ bool smallest_tolerable_data_rate_available:1;
+ bool original_average_data_rate_available:1;
+ bool rx_window_size_available:1;
+ bool smoothing_buffer_size_available:1;
+ bool bidirectional_burst_available:1;
+ bool txops_per_beacon_period_available:1;
+ bool average_number_of_pbs_per_txop_available:1;
+ bool minimum_number_of_pbs_per_txop_available:1;
+ bool maximum_number_of_pbs_per_txop_available:1;
+ bool ppb_threshold_available:1;
+ bool surplus_bandwith_available:1;
+ bool cco_vendor_specific_available:1;
+ bool smallest_tolerable_average_number_of_pbs_per_txop_available:1;
+ bool original_average_number_of_pbs_per_txop_available:1;
+ bool cco_bidirectional_burst_available:1;
+}qmp_valid_field_t;
+
+
+typedef enum
+{
+ EXCEPTION_TERMINATE_CONNEXION = 0x00,
+ EXCEPTION_RECONFIGURE_CONNEXION = 0x01
+}qmp_exception_policy_t;
+
+typedef enum
+{
+ IP_VERSION_4 = 0x00,
+ IP_VERSION_6 = 0x01
+}ip_version_t;
+
+typedef struct
+{
+ ip_version_t ip_version:8;
+ union
+ {
+ u8 ipv4_source_address[4];
+ u8 ipv6_source_address[16];
+ };
+ u16 source_port;
+ union
+ {
+ u8 ipv4_destination_address[4];
+ u8 ipv6_destination_address[16];
+ };
+ u16 destination_port;
+ u8 protocol_type;
+}cdesc_t;
+/*
+// QMP (QoS and MAC Parameter) definition (section 7.8.1 table 7-146)
+typedef struct
+{
+ qmp_forward_or_reverse_t forward_or_reverse:8;
+ union
+ {
+ qmp_valid_field_t valid;
+ u32 valid_in_block;
+ };
+ struct
+ {
+ u32 delay_bound;
+ u32 jitter_bound;
+ u16 average_msdu_size;
+ u16 maximum_msdu_size;
+ u16 average_data_rate;
+ u16 minimum_data_rate;
+ u16 maximum_data_rate;
+ u16 maximum_inter_txop_time;
+ u16 minimum_inter_txop_time;
+ u16 maximum_burst_size;
+ qmp_exception_policy_t exception_policy;
+ u32 inactivity_interval;
+ u16 msdu_error_rate;
+ u8 clst;
+ cdesc_t cdesc;
+ u16 ats_tolerance;
+ u16 smallest_tolerable_data_rate;
+ u16 original_average_data_rate;
+ u16 rx_window_size;
+ u32 smoothing_buffer_size; //warning on 24 bits
+ u8 bidirectional_burst;
+ }cm;
+
+ struct
+ {
+ u8 txops_per_beacon_period;
+ u16 average_number_of_pbs_per_txop;
+ u16 minimum_number_of_pbs_per_txop;
+ u16 maximum_number_of_pbs_per_txop;
+ u16 ppb_threshold;
+ u16 surplus_bandwith;
+ u16 smallest_tolerable_average_number_of_pbs_per_txop;
+ u16 original_average_number_of_pbs_per_txop;
+ u8 cco_bidirectional_burst;
+ }cco;
+
+} qmp_t;
+
+
+
+
+// Smoothing definition (section 7.8.1 table 7-145)
+typedef enum
+{
+ SMOOTHING_NOT_REQUESTED = 0x00,
+ SMOOTHING_REQUESTED = 0x01
+}smoothing_t;
+
+
+// CINFO definition (section 7.8.1 table 7-145)
+typedef struct
+{
+ cinfo_valid_t valid:8;
+ mac_service_type_t mac_service_type:8;
+ user_priority_t user_priority:8; // Channel access priority of the Connection
+ ats_t ats:8;
+ smoothing_t smoothing:8;
+} cinfo_t;
+
+// CSPEC definition (section 7.8.1 table 7-144)
+typedef struct
+{
+ cspec_len_t len; // Length of CSPEC, including the 2 octets CSPEC_LEN field
+ cinfo_t cinfo_forward; // Forward Connection Information
+ cinfo_t cinfo_reverse; // Reverse Connection Information
+ qmp_t qmp_forward; // Forward QoS and MAC Parameters
+ qmp_t qmp_reverse; // Reverse QoS and MAC Parameters
+} cspec_t;
+
+// Conn Info definition (section 11.5.23 table 11-117)
+typedef struct
+{
+ cid_t cid; // Connection identifier of the Link
+ tei_t dtei; // TEI of the destination STA
+ tei_t stei; // TEI of the source STA
+ lid_t lid_f; // Link ID of the Forward Link
+ lid_t lid_r; // Link ID of the Reverse Link
+ cspec_t cspec; // Connection cspec
+} conn_info_t;
+
+*/
+///////////////////////////////////////////////////
+///////////// CLASSIFIER_RULE //////////////////
+///////////////////////////////////////////////////
+
+
+typedef u8 ethernet_destination_address_t[6];
+typedef u8 ethernet_source_address_t[6];
+typedef u8 vlan_user_priority_t;
+typedef u16 vlan_id_t;
+typedef u8 ipv4_type_of_service_t;
+typedef u8 ipv4_protocol_t;
+typedef u8 ipv4_source_address_t[4];
+typedef u8 ipv4_destination_address_t[4];
+typedef u8 ipv6_traffic_class_t;
+typedef u8 ipv6_flow_label_t[3];
+typedef u8 ipv6_source_address_t[16];
+typedef u8 ipv6_destination_address_t[16];
+typedef u16 tcp_source_port_t;
+typedef u16 tcp_destination_port_t;
+typedef u16 udp_source_port_t;
+typedef u16 udp_destination_port_t;
+
+typedef struct
+{
+ bool ethernet_destination_address_field_available :1;
+ bool ethernet_source_address_field_available : 1;
+ bool vlan_user_priority_field_available : 1;
+ bool vlan_id_field_available : 1;
+ bool ipv4_type_of_protocol_field_available :1;
+ bool ipv4_protocol_field_available : 1;
+ bool ipv4_source_address_field_available : 1;
+ bool ipv4_destination_address_field_available : 1;
+ bool ipv6_traffic_class_field_available : 1;
+ bool ipv6_flow_label_field_available : 1;
+ bool ipv6_source_address_field_available : 1;
+ bool ipv6_destination_address_field_available : 1;
+ bool tcp_source_port_field_available : 1;
+ bool tcp_destination_port_field_available : 1;
+ bool udp_source_port_field_available : 1;
+ bool udp_destination_port_field_available : 1;
+} classifier_rules_available_t;
+
+typedef struct
+{
+ union
+ {
+ classifier_rules_available_t classifier_rules_available;
+ u32 classifier_rules_available_block;
+ };
+ ethernet_destination_address_t ethernet_destination_address;
+ ethernet_source_address_t ethernet_source_address;
+ vlan_user_priority_t vlan_user_priority;
+ vlan_id_t vlan_id;
+ ipv4_type_of_service_t ipv4_type_of_service;
+ ipv4_protocol_t ipv4_protocol;
+ ipv4_source_address_t ipv4_source_address;
+ ipv4_destination_address_t ipv4_destination_address;
+ ipv6_traffic_class_t ipv6_traffic_class;
+ ipv6_flow_label_t ipv6_flow_label;
+ ipv6_source_address_t ipv6_source_address;
+ ipv6_destination_address_t ipv6_destination_address;
+ tcp_source_port_t tcp_source_port;
+ tcp_destination_port_t tcp_destination_port;
+ udp_source_port_t udp_source_port;
+ udp_destination_port_t udp_destination_port;
+} classifier_rules_data_t;
+
+// Classifier Rule Set Version definition (section 6.3 table 6-138)
+typedef enum
+{
+ CLASSIFIER_CURRENT_VERSION = 0x00 // Current Version
+ // 0X01 to 0x0FF reserved for future use
+} classifier_version_t;
+
+// Classifier Rule definition (section 6.3 table 6-138)
+typedef struct
+{
+ classifier_version_t classifier_version:8;
+ u8 nbr_rules;
+ classifier_rules_data_t data;
+} classifier_rules_t;
+
+typedef u8 id_t;
+
+// Reason Code definition (section 11.5.18) needed by cm_conn_rel_ind
+typedef enum
+{
+ NORMAL_RELEASE = 0x00,
+ VIOLATED_CSPEC = 0x01
+} reason_code_t;
+
+// New Connection Result definition (section 11.5.17 table 11-280)
+typedef enum
+{
+ CONN_SUCCESS = 0x00,
+ CONN_FAILURE_CLASSIFIER_RULE_NOT_SUPPORTED = 0x01,
+ CONN_FAILURE_CLASSIFIER_RESSOURCE_NOT_AVAILABLE = 0x02,
+ CONN_FAILURE_MAXIMUM_CONNECTION_REACHED = 0x03,
+ CONN_FAILURE_OTHER = 0X04
+} conn_new_result_t;
+
+// Mod Connection Result definition (section 11.5.21 table 11-284)
+typedef enum
+{
+ CONN_MOD_SUCCESS = 0x00,
+ CONN_MOD_FAILED = 0X01
+} conn_mod_result_t;
+
+// Add Connection Result definition (section 12.2.2.2)
+typedef enum
+{
+ CONN_ADD_SUCCESS = 0x00,
+ CONN_ADD_FAILED = 0x01
+} conn_add_result_t;
+
+// Info Connection - Request Type (section 11.5.22 table 11-285)
+typedef enum
+{
+ CONN_INFO_ALL_ACTIVE_CONNECTIONS = 0x00,
+ CONN_INFO_SPECIFIC_CID = 0x01,
+ CONN_INFO_GLOBAL_LINK = 0x02
+} conn_info_req_type_t;
+
+
+
+
+///////////////////////////////////////////////////////////////////////////
+//////////////////// FUNCTION DECLARATION /////////////////////////////////
+///////////////////////////////////////////////////////////////////////////
+
+/*
+void msg_field_cinfo_init (cinfo_t*);
+void msg_field_qmp_init (qmp_t*);
+void msg_field_cid_init (cid_t*);
+void msg_field_classifier_init(classifier_rules_t*);
+void msg_field_cspec_init (cspec_t*);
+
+
+len_t msg_field_cid_get_from_stream (u8* stream, cid_t* cid);
+len_t msg_field_cinfo_get_from_stream (u8* stream, cinfo_t* cinfo);
+len_t msg_field_qmp_get_from_stream (u8* stream,u8* stream_end, qmp_t* qmp, qmp_forward_or_reverse_t qmp_type);
+len_t msg_field_classifier_get_from_stream (u8* stream, classifier_rules_t* claissifier_rules);
+len_t msg_field_cspec_get_from_stream (u8* stream, cspec_t* cspec);
+
+len_t msg_field_cid_set_on_stream (u8* stream, cid_t* cid);
+len_t msg_field_classifier_set_on_stream (u8* stream, classifier_rules_t* classifier_rules);
+len_t msg_field_qmp_set_on_stream (u8* stream, qmp_t* qmp);
+len_t msg_field_cinfo_set_on_stream (u8* stream, cinfo_t* cinfo);
+len_t msg_field_cspec_set_on_stream (u8* stream, cspec_t* cspec);
+
+*/
+
+#endif /*MSG_CM_CONN_FIELD_H_*/