📄 common.h
字号:
/* Westell 6100 multicast data collection utility. * Shared code for wstart and wstop. * * Copyright: Josh Carroll (josh.carroll@gmail.com) * 10/13/2004 * * common.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 **//* common headers */#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <netdb.h>#include <stdio.h>#include <unistd.h>#include <string.h>#include <stdlib.h>#include <netinet/in_systm.h>#include <netinet/ip.h>#include <netinet/igmp.h>/* struct definitions, etc */#include "wtypes.h"/* configuration file support */#include "conf.h"/* function prototypes *//* function to send packets to the modem */int send_packet(wpacket_t *pkt, char *bcast);/* header checksum */unsigned short chksum(unsigned short *hdr, int len);/* subscribe or leave the multicast group */void multicast_subscribe(char dest[], char group[]);void multicast_leave(char dest[], char group[]);void usage(char *prog);/* print all the information received from the modem, in the future this function should provide the ability to print only specific fields via a configurationfile or options to the westell program */void print_data(struct modemdata data, int decimal_print);void print_info(const char *prefix, int32_t val, int divisor, int decimal_print);/* grab the data from the modem struct */int32_t getfield(const unsigned char *packet, const field_t *pkt_field);/* listens for the multicast data, storing the data in the packet */int listen_for_mcast(int model, unsigned char *packet, int packet_size, char *listen_addr);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -