lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #ifndef __ZPING_H__ |
| 2 | #define __ZPING_H__ |
| 3 | |
| 4 | #include "headers.h" |
| 5 | |
| 6 | typedef unsigned int u_int; |
| 7 | |
| 8 | typedef signed char int8_t; |
| 9 | typedef unsigned char u_int8_t; |
| 10 | typedef signed short int16_t; |
| 11 | typedef unsigned short u_int16_t; |
| 12 | typedef signed int int32_t; |
| 13 | typedef unsigned int u_int32_t; |
| 14 | typedef signed long long int64_t; |
| 15 | typedef unsigned long long u_int64_t; |
| 16 | |
| 17 | #define ZPING_EXCLUDE 0x01 |
| 18 | |
| 19 | #define DEFAULT_BUFFER_SIZE 1460 |
| 20 | |
| 21 | #define DEFAULT_BUFFER_COPY_TIMEOUT 3 |
| 22 | |
| 23 | typedef enum { |
| 24 | //pc²àʹÓ÷¶Î§0~31 |
| 25 | LABEL_NULL = 0, |
| 26 | |
| 27 | CLINET_RECV, |
| 28 | CLINET_SEND, |
| 29 | SERVER_RECV, |
| 30 | SERVER_SEND, |
| 31 | |
| 32 | //AP²àÍø¿ÚÒÔ32¿ªÊ¼£¬²»Í¬µÄºË²ÉÓò»Í¬µÄÊý¾Ý¶Î¶¨Òå,32~63 |
| 33 | AP_USB_IN = 32, |
| 34 | AP_USB_OUT, |
| 35 | AP_PS_IN, |
| 36 | AP_PS_OUT, |
| 37 | AP_WIFI_WAN_IN, |
| 38 | AP_WIFI_WAN_OUT, |
| 39 | AP_WIFI_LAN_IN, |
| 40 | AP_WIFI_LAN_OUT, |
| 41 | AP_ETH_WAN_IN, |
| 42 | AP_ETH_WAN_OUT, |
| 43 | AP_ETH_LAN_IN, |
| 44 | AP_ETH_LAN_OUT, |
| 45 | AP_PS_EXT1_IN, |
| 46 | AP_PS_EXT1_OUT, |
| 47 | AP_PS_EXT2_IN, |
| 48 | AP_PS_EXT2_OUT, |
| 49 | AP_PS_EXT3_IN, |
| 50 | AP_PS_EXT3_OUT, |
| 51 | AP_PS_EXT4_IN, |
| 52 | AP_PS_EXT4_OUT, |
| 53 | |
| 54 | //CP²àÍø¿ÚÒÑ64¿ªÊ¼.64~95 |
| 55 | CP_ETH1_IN = 64, |
| 56 | CP_ETH1_OUT, |
| 57 | CP_ETH2_IN, |
| 58 | CP_ETH2_OUT, |
| 59 | CP_ETH3_IN, |
| 60 | CP_ETH3_OUT, |
| 61 | CP_ETH4_IN, |
| 62 | CP_ETH4_OUT, |
| 63 | CP_PS1_IN, |
| 64 | CP_PS1_OUT, |
| 65 | CP_PS2_IN, |
| 66 | CP_PS2_OUT, |
| 67 | CP_PS3_IN, |
| 68 | CP_PS3_OUT, |
| 69 | CP_PS4_IN, |
| 70 | CP_PS4_OUT, |
| 71 | CP_CTRM1_IN, |
| 72 | CP_CTRM1_OUT, |
| 73 | CP_CTRM2_IN, |
| 74 | CP_CTRM2_OUT, |
| 75 | CP_CTRM3_IN, |
| 76 | CP_CTRM3_OUT, |
| 77 | CP_CTRM4_IN, |
| 78 | CP_CTRM4_OUT, |
| 79 | } zping_label; |
| 80 | |
| 81 | typedef struct { |
| 82 | zping_label label; |
| 83 | char name[32]; |
| 84 | } zping_print_t; |
| 85 | |
| 86 | |
| 87 | #pragma pack(push) |
| 88 | #pragma pack(1) |
| 89 | typedef struct { // 4 bytes align |
| 90 | u_int16_t id; // useless in this case, use id in the icmp header instead |
| 91 | u_int16_t item_count; |
| 92 | u_int16_t item_index; |
| 93 | u_int16_t item_index_padding; |
| 94 | u_int16_t flags; |
| 95 | u_int16_t flags_padding; |
| 96 | } zping_hdr_t; |
| 97 | |
| 98 | typedef struct { // 4 bytes align |
| 99 | u_int16_t label; |
| 100 | u_int16_t label_padding; |
| 101 | |
| 102 | u_int32_t secs; |
| 103 | u_int32_t secs_padding; |
| 104 | |
| 105 | u_int32_t usecs; |
| 106 | u_int32_t usecs_padding; |
| 107 | |
| 108 | u_int16_t last_seq; |
| 109 | u_int16_t last_seq_padding; |
| 110 | } zping_item_t ; |
| 111 | |
| 112 | typedef struct { // 4 bytes align |
| 113 | u_int16_t label; |
| 114 | u_int16_t label_padding; |
| 115 | |
| 116 | u_int16_t last_seq; |
| 117 | u_int16_t last_seq_padding; |
| 118 | } zping_pktlost_item_t; |
| 119 | #pragma pack(pop) |
| 120 | |
| 121 | #endif /* __ZPING_H__ */ |