📄 iwspy-sim.c
字号:
/* $Id: iwspy-sim.c,v 1.12 2001/07/11 15:12:44 jm Exp $ * Dynamics iwspy simulator module * * Dynamic hierarchial IP tunnel * Copyright (C) 1998-2000, Dynamics group * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. See README and COPYING for * more details. */#include <malloc.h>#include <unistd.h>#include <stdio.h>#include <getopt.h>extern char *optarg;extern int optind, opterr, optopt;#include <errno.h>#include <string.h>#include <assert.h>#include <limits.h>#include <asm/types.h>#include <sys/types.h>#include <sys/socket.h>#include <sys/ioctl.h>#include <linux/wireless.h>#include "dyn_wireless.h"#include "debug.h"#include "util.h"#define DEBUG_FLAG '4'#define USAGE "iwspy_sim -d <device> [-h] {[<mac_address> "\"<qualities_file>] .. | -m <mac_address>}\n"#define MAX_LINE 80#define MAX_FILES 64extern int opt_debug;static struct option const long_options[] ={ {"help", no_argument, NULL, 'h'}, {"device", required_argument, NULL, 'd'}, {0, 0, 0, 0}};int free_nodes(struct quality_values *q){ struct quality_values *t; while (q != NULL) { t = q; q = q->next; free(t); } return 0;}/* Format of file (filetype): 0 = no timestamp, only quality value in one line 1 = timstamps in seconds and quality value in one line 2 = timestamps in tens of milliseconds and qual. value in one line*/struct quality_values *read_quals(FILE *f, int *ival, int *filetype){ struct quality_values *q, *t; char buf[MAX_LINE], hw[ETH_ALEN+1], addr[20]; int ret, qual; unsigned long tstamp; q = t = dyn_wireless_get_quals_node(NULL); /* Read the interval from the first line */ *ival = 0; fgets(buf, MAX_LINE, f); ret = sscanf(buf, "# %d %d", ival, filetype); if (ret != 2) { fprintf(stderr, "Header not found!
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -