📄 wimedia_defs.h
字号:
#ifndef WiMedia_DEFS_H#define WiMedia_DEFS_H// #include <bsd-list.h>/* ====================================================================== Definitions ====================================================================== */const int MAX_NODE_COUNT = 32;const int MAX_FLOWS = 128;const int MAX_SUPERFRAME_SIZE = 64000;const int MAX_ACKED_PACKETS = 64;const int MAX_ACKED_IN_BEACON = 512;// Maximum length of the data in each fragmentconst int MAX_MAC153_FRAME_LENGTH = 2048;const int CW_MIN = 31;const int CW_MAX = 1023;const double SLOT_TIME = 0.000005;const int MAC153_GUARD_TIME = 10;const int MAC153_A_FIRST_GTS_GAP = 100;const int MAC153_MAC_HEADER_LENGTH = 16;const double MAC153_SIFS = 10e-6;const double MAC153_MIFS = 2e-6;const double MAC153_DIFS = 20e-6;const double MAC153_PHY_HEADER_TX_TIME = 8e-6;const int MAC11E_GUARD_TIME = 16;const int MAC11E_A_FIRST_GTS_GAP = 16;const int MAC11E_MAC_HEADER_LENGTH = 16;const double MAC11E_SIFS = 16e-6;const double MAC11E_DIFS = 26e-6;const double MAC11E_PHY_HEADER_TX_TIME = 20e-6;// The following destination class is used for duplicate detectionclass Host2 {public: LIST_ENTRY(Host2) link_; u_int32_t index_; u_int32_t seqno_[MAX_FLOWS];};enum TrafficType { Traffic_NRT, // Non-Realtime traffic (used for Contention access period!) Traffic_CFT, // Used by standard mac for Contention Free Traffic // The following types are used for different kinds of Contention Free Traffics // to allow better scheduling. It is not used by standard 802.15.3 MAC Traffic_CBR, // Constant bit rate traffic Traffic_MPEG // MPEG traffic};enum MacACKType { ACK_None, ACK_Immediate, ACK_Delayed, ACK_Beacon};struct ScheduleInfo { int dev_id_; int flow_count_; int gts_start_[MAX_FLOWS]; int gts_duration_[MAX_FLOWS]; int gts_flowid_[MAX_FLOWS]; TrafficType gts_traffic_type_[MAX_FLOWS]; MacACKType gts_ack_type_[MAX_FLOWS]; ScheduleInfo *next_;};struct FlowInfo { int flow_id_; int qs_; // queue size int unacked_qs_; // unacked queue size MacACKType ack_type_; int nMaxAcks_; double deadline_; // true if the flow is an outgoing flow. bool bFlowOut_;};const int MAC153_MAX_CTA = 128; // maximum number of CTAs in a beacon frameconst int MAC153_LEN_CTA_BLOCK = 6; // Length of each CTA Block// Information Element for Channel Time Allocations (CTAs)struct InfoElement_CTA { int dest_id; // Destinatino DEV ID - same as the MAC address int src_id_; // Source DEV ID - same as the MAC address u_char stream_idx_; // Stream index u_int16_t slot_location_; // Slot Location - The value is the time offset from the end of the beacoin u_int16_t slot_duration_; // Slot Duration - The resolution is 1 us TrafficType traffic_type_; MacACKType ack_type_;};struct beacon_frame_body { int cta_count; // actual number of cta's in the beacon frame struct InfoElement_CTA cta[MAC153_MAX_CTA]; // channel time allocations // Flow ids of the acks int ms_acked_seqno_[MAX_ACKED_IN_BEACON]; // First is packet seq, and thn frag id, then total no of fragments int ms_acked_packets_[MAX_ACKED_IN_BEACON][3]; inline int body_size() { return MAC153_LEN_CTA_BLOCK * cta_count + 2; }};class MacMib {public: double sifs; double difs; double mifs; int AFirstGTSGap; int GuardTime; int MACHeaderLength; // in terms of bytes double PHYHeaderTxTime; // in terms of seconds int RTSThreshold; int ShortRetryLimit; int LongRetryLimit; int FailedCount; int RetryCount; int ACKFailureCount; MacMib() : sifs(MAC153_SIFS),difs(MAC153_DIFS),mifs(MAC153_MIFS),AFirstGTSGap(MAC153_A_FIRST_GTS_GAP),GuardTime(MAC153_GUARD_TIME), MACHeaderLength(MAC153_MAC_HEADER_LENGTH),PHYHeaderTxTime(MAC153_PHY_HEADER_TX_TIME), RTSThreshold(3000), ShortRetryLimit(7), LongRetryLimit(7), FailedCount(0) ,RetryCount(0), ACKFailureCount(0) { } ~MacMib() {}};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -