⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 app-packet.h

📁 模拟器提供了一个简单易用的平台
💻 H
字号:
#ifndef _APP_PACKET_H_#define _APP_PACKET_H_#include <packet.h>#define LOWER_K 3#define UPPER_2K (2*LOWER_K)#define UPPER_3K (3*LOWER_K)#define MAX_RET_COUNT 2049#define HOST_INFO_SIZE	6enum AppPacketSubType {  JOIN_QUERY,  JOIN_FORWARD,  JOIN_RESPONSE,  CLUSTER_REFRESH,  CLUSTER_MERGE,  PING_QUERY,  PING_RESPONSE,  PACKET_DATA,  PACKET_UNDEFINED};struct PacketAgentInfo {  int agent_id;  int node_id;};struct join_query_pkt { int q_lid; /* The queried layer id. -1 for query to BSE */ bool attach; /* If this an attach request */ double send_time; /* Time when the packet was sent */};struct join_forward_pkt { PacketAgentInfo src_ag; int q_lid; /* The queried layer id. -1 for query to BSE */ bool attach; PacketAgentInfo original_dst; /* This was the agent to which the join request		      * was actually sent to */ double send_time; /* Time when the packet was sent */};struct TreeInfo {  PacketAgentInfo ag;  int num_children;  double dist; /* Distance from self to this agent */};struct join_response_pkt {  bool accept; /* If this was a join accept or a join reject */  int layer_id;  int mbr_count;  TreeInfo agent_arr[MAX_RET_COUNT];  PacketAgentInfo exp_src; /* This was the agent to which the join request		      * was actually sent to */};struct cluster_refresh_pkt {  int layer_id;  int mbr_count;  TreeInfo agent_arr[MAX_RET_COUNT];  /* Info about the higher layer, only carried by the cluster leader */  int hl_mbr_count;  TreeInfo * hl_agent_arr;  bool is_root;  bool root_xfer; /* True if the root is being transferred */  bool cluster_remove;};struct cluster_merge_pkt {  int layer_id;  int mbr_count;  TreeInfo agent_arr[MAX_RET_COUNT];};struct ping_query_pkt {  double src_time;  int lid;};struct ping_response_pkt {  bool accept;  int lid;  double src_time;  int mbr_count;  TreeInfo * agent_arr;};struct data_pkt {  PacketAgentInfo original_src;  int seq_no;  int lid;};class AppPacket : public Packet {public :  static int m_app_pkt_gen_count;  static int m_pkt_display_period;  static int m_jq_cnt;  static int m_jf_cnt;  static int m_jr_cnt;  static int m_cr_cnt;  static int m_cm_cnt;  static int m_pq_cnt;  static int m_pr_cnt;  static int m_pd_cnt;  static int m_pu_cnt;  AppPacketSubType st;  union {    join_query_pkt joinq_p;    join_forward_pkt joinforward_p;    join_response_pkt joinresp_p;    cluster_refresh_pkt clusterrefresh_p;    cluster_merge_pkt clustermerge_p;    ping_query_pkt pingq_p;    ping_response_pkt pingresp_p;    data_pkt data_p;  } u;  AppPacket (AppPacketSubType St);  ~AppPacket (void);  static void display_pkt_stats (void);};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -