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

📄 wtypes.h

📁 wdiag-0.10.gz ( Diagnostic source )
💻 H
字号:
/* Westell 6100 multicast data collection utility. * Shared code for wstart and wstop. * * Copyright: Josh Carroll (josh.carroll@gmail.com) * 10/13/2004 * * wtypes.h is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 2. *  * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. *  * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA **//* defines common to wstop and wstart *//* make sure MAX_MODEL_NUMBER is updated when adding * struct members to the wstart and/or wstop code.  * This implicitly requires that this value be the * highest order index in EITHER wstop or wstart * to work properly */#define MAX_MODEL_NUMBER 4#define MAX_PACKET_SIZE 10#define MAX_PACKET_COUNT 10#define MAX_MCAST_COUNT 10#define IGMP_PKT_SIZE (sizeof(struct ip) + sizeof(struct igmp))/* free macro to ensure we free only when a pointer is not NULL */#define wfree(ptr) if(ptr) { free(ptr); ptr = NULL; }#define W_NO_DATA "n/a"/* timeout after 3 seconds waiting for a poll from the modem */#define POLL_TIMEOUT 3/* free macro to ensure we free only when a pointer is not NULL */#define wfree(ptr) if(ptr) { free(ptr); ptr = NULL; }/* this enum holds the fields for the westell data and their decimal factors	-1 indicates no factoring */enum fields { TIMECTR = -1, SNR_UP = 10, PWR_UP = 10, ATTN_UP = 10, SYNCRATE_UP = -1,				SNR_DOWN = 10, PWR_DOWN = 10, ATTN_DOWN = 10, SYNCRATE_DOWN = -1,				FEC_ERRORS = -1, CRC_ERRORS = -1, HEC_ERRORS = -1, SIGNAL_LOST = -1,				FRAME_LOST = -1, TX_CELLS = -1, RX_CELLS = -1, DROPPED_CELLS = -1,				ETHERNET_RX = -1, ETHERNET_TX = -1, ETHERNET_DISCARD = -1 };typedef struct field {	int8_t offset; /* offset for this piece of data */	int8_t size; /* size in bytes for this piece of data */} field_t;/* this stores the offsets and sizes of a modem type */typedef struct model {	char model_number[10];	field_t timectr;	field_t snr_up;	field_t pwr_up;	field_t attn_up;	field_t syncrate_up;	field_t snr_down;	field_t pwr_down;	field_t attn_down;	field_t syncrate_down;	field_t fec_errors;	field_t crc_errors;	field_t hec_errors;	field_t signal_lost;	field_t frame_lost;	field_t tx_cells;	field_t rx_cells;	field_t dropped_cells;	field_t ethernet_rx;	field_t ethernet_tx;	field_t ethernet_discard;	int server_port;	int packet_size;	char mcast_group [16];} wmodel_t;/* this holds the actual information from the modem. * we use a 32-bit size here, which is the greatest common * size of the data. If in the future we need a 64-bit value * in the data, we would have to change this accordingly */struct modemdata {	int32_t timectr;	int32_t snr_up;	int32_t pwr_up;	int32_t attn_up;	int32_t syncrate_up;	int32_t snr_down;	int32_t pwr_down;	int32_t attn_down;	int32_t syncrate_down;	int32_t fec_errors;	int32_t crc_errors;	int32_t hec_errors;	int32_t signal_lost;	int32_t frame_lost;	int32_t tx_cells;	int32_t rx_cells;	int32_t dropped_cells;	int32_t ethernet_rx;	int32_t ethernet_tx;	int32_t ethernet_discard;};/* data structures common to wstop and wstart */typedef struct westell_packet {	unsigned short int src_port;	unsigned short int dst_port;	/* pad this will null values if we don't use up all the array */	unsigned short int packet_length;	uint8_t data[MAX_PACKET_SIZE];} wpacket_t;typedef struct westell_igmp_packet {	char mcast_dest[16];	char mcast_group[16];} wmcast_t;/* this stores the offsets and sizes of a modem type */typedef struct westell_model {	char model_number[10];	unsigned short int num_packets;	wpacket_t packets[MAX_PACKET_COUNT];	unsigned short int num_mcasts;	wmcast_t multicasts[MAX_MCAST_COUNT];	char broadcast_ip[16];} pmodel_t;/* this holds an array of model structs that * defines the offsets and sizes for each modem type we know about * It is currently setup for the 610010 and 610030 (which are the same, * this is just for vebosity. Adding another modem should be trivial. * All offstes and sizes are in bytes. If a field is not sent or * is not included in a modem, set the offset and size to -1*/extern wmodel_t models[];

⌨️ 快捷键说明

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