亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ftmap.c

?? netflow,抓包
?? C
字號:
/* * Copyright (c) 2001 Mark Fullmer and The Ohio State University * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * *      $Id: ftmap.c,v 1.7 2003/02/13 02:38:42 maf Exp $ */#include "ftconfig.h"#include "ftlib.h"#include <sys/time.h>#include <sys/types.h>#include <sys/uio.h>#include <sys/socket.h>#include <sys/resource.h>#include <netinet/in.h>#include <arpa/inet.h>#include <sys/stat.h>#include <syslog.h>#include <dirent.h>#include <limits.h>#include <unistd.h>#include <stdio.h>#include <stdlib.h>#include <time.h>#include <fcntl.h>#include <zlib.h>#if HAVE_STRINGS_H #include <strings.h>#endif#if HAVE_STRING_H  #include <string.h>#endif#if !HAVE_STRSEP  char    *strsep (char **, const char *);#endifstatic struct ftmap_ifname *parse_ifname(char **buf2);static struct ftmap_ifalias *parse_ifalias(char **buf2);static struct ftmap_ifname *ftmap_ifname_new2(char *ip, char *ifIndex,  char *name);struct ftmap_ifalias *ftmap_ifalias_new2(char *ip, char *ifIndex_list,  char *name);static void ftmap_ifalias_free(struct ftmap_ifalias *ftmia);static void ftmap_ifname_free(struct ftmap_ifname *ftmin);/* function: ftmap_new * * allocate and initialize struct ftmap * * returns allocated ftmap or NULL for error **/struct ftmap *ftmap_new(void){  struct ftmap *ftmap;  if (!(ftmap = malloc(sizeof (struct ftmap))))    return ftmap;  bzero(ftmap, sizeof (struct ftmap));  FT_LIST_INIT(&ftmap->ifalias);  FT_LIST_INIT(&ftmap->ifname);  return ftmap;} /* ftmap_new *//* * function: ftmap_ifalias_new2 * * Allocate and initialize a ftmap_ifalias.  Free this with * ftmap_ifalias_free().  Used internally to convert from char* * * returns allocated structure, or NULL for error. */struct ftmap_ifalias *ftmap_ifalias_new2(char *ip, char *ifIndex_list,  char *name){  struct ftmap_ifalias *ftmia;  u_int32 bip;  u_int16 *list, entries;  int n;  char *c, *buf;  entries = 0;  /* count entries in list */  for (n = 1, c = ifIndex_list; *c; ++c)    if (*c == ',')      ++entries;  if (!(list = malloc(entries * sizeof (u_int16))))    return (struct ftmap_ifalias*)0L;  buf = ifIndex_list;  n = 0;  for (;;) {    c = strsep(&buf, ",");    if (!c)      break;    list[n++] = atoi(c);  }  bip = scan_ip(ip);  ftmia = ftmap_ifalias_new(bip, list, entries, name);  free (list);  return ftmia;} /* ftmap_ifalias_new2 *//* * function: ftmap_ifalias_new * * Allocate and initialize a ftmap_ifalias.  Free this with * ftmap_ifalias_free() * * returns allocated structure, or NULL for error. */struct ftmap_ifalias *ftmap_ifalias_new(u_int32 ip, u_int16 *ifIndex_list,  u_int16 entries, char *name){  struct ftmap_ifalias *ftmia;  int ret, n;  ret = -1;  ftmia = (struct ftmap_ifalias*)0L;  if (!(ftmia = malloc(sizeof (struct ftmap_ifalias))))    goto ftmap_ifalias_new_out;  bzero(ftmia, sizeof (struct ftmap_ifalias));  n = strlen(name);  if (!(ftmia->name = malloc(n)))    goto ftmap_ifalias_new_out;  if (!(ftmia->ifIndex_list = malloc(entries * sizeof (u_int16))))    goto ftmap_ifalias_new_out;  ftmia->ip = ip;  ftmia->entries = entries;  strcpy(ftmia->name, name);  for (n = 0; n < entries; ++n)    ftmia->ifIndex_list[n] = ifIndex_list[n];  ret = 0;ftmap_ifalias_new_out:  if (ret == -1) {    if (ftmia->name)      free(ftmia->name);    if (ftmia->ifIndex_list)      free(ftmia->ifIndex_list);    if (ftmia)      free (ftmia);  }  return ftmia;} /* ftmap_ifalias_new *//* * function: ftmap_ifalias_free * * Free resources allocated by ftmap_ifalias_new() */static void ftmap_ifalias_free(struct ftmap_ifalias *ftmia){  if (ftmia) {  if (ftmia->name)    free(ftmia->name);  if (ftmia->ifIndex_list)    free(ftmia->ifIndex_list);    free (ftmia);  }} /* ftmap_ifalias_free *//* * function: ftmap_ifname_new2 * * Allocate and initialize a ftmap_ifname.  Free this with * ftmap_ifname_free().  Used internally to convert from char values. * * returns allocated structure, or NULL for error. */struct ftmap_ifname *ftmap_ifname_new2(char *ip, char *ifIndex, char *name){  u_int32 bip;  u_int16 bifIndex;  bip = scan_ip(ip);  bifIndex = atoi(ifIndex);  return ftmap_ifname_new(bip, bifIndex, name);} /* ftmap_ifname_new2 *//* * function: ftmap_ifname_new * * Allocate and initialize a ftmap_ifname.  Free this with * ftmap_ifname_free() * * returns allocated structure, or NULL for error. */struct ftmap_ifname *ftmap_ifname_new(u_int32 ip, u_int16 ifIndex, char *name){  struct ftmap_ifname *ftmin;  int ret, n;  ret = -1;  ftmin = (struct ftmap_ifname*)0L;  if (!(ftmin = malloc(sizeof (struct ftmap_ifname))))    goto ftmap_ifname_new_out;  bzero(ftmin, sizeof (struct ftmap_ifname));  n = strlen(name);  if (!(ftmin->name = malloc(n)))    goto ftmap_ifname_new_out;  ftmin->ip = ip;  ftmin->ifIndex = ifIndex;  strcpy(ftmin->name, name);  ret = 0;ftmap_ifname_new_out:  if (ret == -1) {    if (ftmin->name)      free(ftmin->name);    if (ftmin)      free (ftmin);  }  return ftmin;} /* ftmap_ifname_new *//* * function: ftmap_ifname_free * * Free resources allocated by ftmap_ifname_new() */static void ftmap_ifname_free(struct ftmap_ifname *ftmin){  if (ftmin) {    if (ftmin->name)      free(ftmin->name);    free(ftmin);  }} /* ftmap_ifname_free *//* * function: ftmap_load * * Allocate a struct ftmap, open fname, read and parse the file. * Free resources allocated with ftmap_free().  Only entries with ip * are returned if ip != 0. * * returns initalized ftmap with entries loaded from fname or NULL on error. *  */struct ftmap *ftmap_load(char *fname, u_int32 ip){  struct stat sb;  struct ftmap *ftmap;  struct ftmap_ifname *ftmin;  struct ftmap_ifalias *ftmia;  int fd, ret;  char *buf, *buf2, *c;  ret = -1;  fd = -1;  buf = NULL;  if (!(ftmap = ftmap_new()))    goto ftmap_load_out;  if ((fd = open(fname, O_RDONLY, 0)) < 0) {    fterr_warn("open(%s)", fname);    goto ftmap_load_out;  }    if (fstat(fd, &sb) < 0) {    fterr_warn("stat(%s)", fname);    goto ftmap_load_out;  }  /* allocate storage for file */  if (!(buf = malloc(sb.st_size+1))) {    fterr_warn("malloc()");    goto ftmap_load_out;  }  /*   * file format   *   *  ifmap 1.2.3.4 99 FastEthernet0/0   *  ifmap 1.2.3.4 100 ATM0/0/0   *   *  ifalias 1.2.3.4 6,7,8,9 outside   *  */  /* read in file */  if (read(fd, buf, sb.st_size) != sb.st_size) {    fterr_warnx("read(): short");    goto ftmap_load_out;  }     /* null terminate file */  buf[sb.st_size] = 0;  buf2 = buf;  for (;;) {    for (;;) {      c = strsep(&buf2, " \t\n");      if ((c && *c != 0) || (!c))        break;    }    /* no more tokens to parse */    if (!c)      break;    if (c && !strcmp(c, "ifname")) {      ftmin = parse_ifname(&buf2);      if (ftmin) {        /* add to list */        if (!ip || (ip && ftmin->ip == ip))          FT_LIST_INSERT_HEAD(&ftmap->ifname, ftmin, chain);        else          free(ftmin);      } else {        /* error */        goto ftmap_load_out;      }    } else if (c && !strcmp(c, "ifalias")) {      ftmia = parse_ifalias(&buf2);      if (ftmia) {        /* add to list */        if (!ip || (ip && ftmia->ip == ip))          FT_LIST_INSERT_HEAD(&ftmap->ifalias, ftmia, chain);        else          free(ftmia);      } else {        /* error */        goto ftmap_load_out;      }    } else if (c && (*c == '#')) {      /* comment line */      continue;    } else {      fterr_warnx("Unexpected token: %s", c);      goto ftmap_load_out;    }/* allow # comments */    /* end of file */    if (buf2 >= (buf+sb.st_size))      break;  }  ret = 0; ftmap_load_out:  if (fd != -1)    close (fd);  if (buf)    free(buf);  if (ret == -1) {    ftmap_free(ftmap);    ftmap = (struct ftmap*)0L;  }  return ftmap;} /* ftmap_load *//* * function: ftmap_free * * frees resources allocated with ftmap_load() * */void ftmap_free(struct ftmap *ftmap){  struct ftmap_ifalias *ftmia, *ftmia2;  struct ftmap_ifname *ftmin, *ftmin2;  if (!ftmap)    return;  /* running down the ifalias list free all entries */  FT_LIST_FOREACH(ftmin, &ftmap->ifname, chain) {    FT_LIST_REMOVE(ftmin, chain);    ftmin2 = ftmin;    if (!(ftmin = FT_LIST_NEXT(ftmin, chain)))      break;    ftmap_ifname_free(ftmin2);  }  /* running down the ifname list free all entries */  FT_LIST_FOREACH(ftmia, &ftmap->ifalias, chain) {    FT_LIST_REMOVE(ftmia, chain);    ftmia2 = ftmia;    if (!(ftmia = FT_LIST_NEXT(ftmia, chain)))      break;    /* XXX memory leak? */    ftmap_ifalias_free(ftmia2);  }  free(ftmap);} /* ftmap_free *//* * function: parse_ifname() * * Parse a single line terminted with 0 or \n.  Allocate a  * struct ftmap_ifname initialized with elements from the parsed * line.  If the line ends in \n, that \n will be replaced by a 0. * * returns struct ftmap_ifname allocated and initialized, or NULL for error. *  */struct ftmap_ifname *parse_ifname(char **buf2){  struct ftmap_ifname *ftmin;  char *c, *ip, *ifIndex, *ifName;  ftmin = (struct ftmap_ifname*)0L;  for (;;) {    c = strsep(buf2, " \t");    if ((c && *c != 0) || (!c))      break;  }  if (!c) {    fterr_warnx("Expecting IP Address");    return ftmin;  }  ip = c;  for (;;) {    c = strsep(buf2, " \t");    if ((c && *c != 0) || (!c))      break;  }  if (!c) {    fterr_warnx("Expecting ifIndex");    return ftmin;  }  ifIndex = c;  for (;;) {    c = strsep(buf2, " \t\n");    if ((c && *c != 0) || (!c))      break;  }  if (!c) {    fterr_warnx("Expecting ifName");    return ftmin;  }  ifName = c;  ftmin = ftmap_ifname_new2(ip, ifIndex, ifName);  return ftmin;} /* parse_ifname *//* * function: parse_ifalias() * * Parse a single line terminted with 0 or \n.  Allocate a  * struct ftmap_ifalias initialized with elements from the parsed * line.  If the line ends in \n, that \n will be replaced by a 0. * * returns struct ftmap_ifalias allocated and initialized, or NULL for error. *  */struct ftmap_ifalias *parse_ifalias(char **buf2){  struct ftmap_ifalias *ftmia;  char *c, *ip, *index_list, *name;  ftmia = (struct ftmap_ifalias*)0L;  for (;;) {    c = strsep(buf2, " \t");    if ((c && *c != 0) || (!c))      break;  }  if (!c) {    fterr_warnx("Expecting IP Address");    return ftmia;  }  ip = c;  for (;;) {    c = strsep(buf2, " \t");    if ((c && *c != 0) || (!c))      break;  }  if (!c) {    fterr_warnx("Expecting ifIndex list");    return ftmia;  }  index_list = c;  for (;;) {    c = strsep(buf2, " \t\n");    if ((c && *c != 0) || (!c))      break;  }  if (!c) {    fterr_warnx("Expecting Alias");    return ftmia;  }  name = c;  ftmia = ftmap_ifalias_new2(ip, index_list, name);  return ftmia;} /* parse_ifalias */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美丝袜第三区| 国产午夜精品理论片a级大结局| 日韩女优毛片在线| 国产精品毛片久久久久久| 美女一区二区视频| 在线这里只有精品| 中文字幕av一区二区三区高 | 亚洲欧洲日产国码二区| 爽好多水快深点欧美视频| 成人成人成人在线视频| 日韩一本二本av| 午夜亚洲国产au精品一区二区| 成熟亚洲日本毛茸茸凸凹| 日韩欧美国产综合在线一区二区三区 | 久久九九全国免费| 亚洲成人第一页| 一本一道久久a久久精品| 国产日韩欧美精品一区| 人人超碰91尤物精品国产| 欧美无人高清视频在线观看| 中文字幕在线一区| 国产最新精品精品你懂的| 欧美一二三区在线| 五月婷婷综合在线| 欧美日韩综合色| 一区二区三区欧美激情| 91免费视频网址| 亚洲欧洲成人av每日更新| 国产91精品精华液一区二区三区 | 91精品在线免费观看| 亚洲素人一区二区| 波多野结衣91| 亚洲伦理在线精品| 一本大道久久a久久精品综合| 中文字幕在线免费不卡| 91免费观看视频在线| 中文字幕佐山爱一区二区免费| 99国产精品一区| 尤物视频一区二区| 欧美群妇大交群中文字幕| 天天射综合影视| 欧美电视剧在线看免费| 国产一区二区三区在线观看免费视频| 久久只精品国产| 大胆亚洲人体视频| 亚洲老妇xxxxxx| 欧美日本视频在线| 寂寞少妇一区二区三区| 久久人人超碰精品| 91在线精品秘密一区二区| 一区二区三区精品在线观看| 欧美精品免费视频| 国产精品一区二区久激情瑜伽 | 99久久99久久久精品齐齐| 亚洲人妖av一区二区| 91黄色激情网站| 日本中文字幕不卡| 精品久久久久一区二区国产| 成人黄色电影在线| 亚洲一卡二卡三卡四卡五卡| 日韩午夜精品视频| 成人av在线影院| 日韩二区三区四区| 久久婷婷久久一区二区三区| 99国产精品一区| 美女爽到高潮91| 国产精品电影院| 欧美一区二区三区四区高清| 高清国产一区二区三区| 午夜欧美电影在线观看| 国产欧美日韩精品在线| 欧美日韩综合色| 从欧美一区二区三区| 免费精品视频在线| 中文字幕在线观看不卡视频| 精品欧美乱码久久久久久| 91麻豆精品一区二区三区| 久久 天天综合| 亚洲国产精品久久艾草纯爱| 国产清纯在线一区二区www| 欧美日韩视频在线观看一区二区三区 | 欧美挠脚心视频网站| 成人午夜视频网站| 日本vs亚洲vs韩国一区三区| 一区二区中文视频| 久久久久久99精品| 欧美伦理影视网| 色综合中文字幕国产| 秋霞av亚洲一区二区三| 国产精品色婷婷久久58| 精品少妇一区二区三区视频免付费 | 亚洲一区二区欧美激情| 久久久久一区二区三区四区| 欧美一区二区三区小说| 在线观看av一区二区| jlzzjlzz欧美大全| 高清视频一区二区| 精品一区在线看| 日韩av中文字幕一区二区三区| 亚洲精选一二三| 国产精品电影一区二区三区| 中文字幕巨乱亚洲| 国产无人区一区二区三区| 欧美成人r级一区二区三区| 欧美日韩国产高清一区二区| 91福利区一区二区三区| 一本大道久久a久久综合婷婷| 99免费精品在线观看| 成人h动漫精品一区二区| 粉嫩嫩av羞羞动漫久久久| 国产一区二区三区黄视频 | 伦理电影国产精品| 免费一级片91| 青青国产91久久久久久| 日韩精品欧美精品| 日韩av在线发布| 蜜臀av在线播放一区二区三区| 日本成人在线一区| 国产一区欧美二区| 国产精品一区二区你懂的| 国产a精品视频| 成人污污视频在线观看| 99久久国产综合精品麻豆| 91蝌蚪porny九色| 欧美视频一区二区三区| 欧美日韩精品久久久| 91精品国产91久久久久久一区二区| 欧美久久久久久蜜桃| 欧美一区欧美二区| 久久日韩精品一区二区五区| 久久久久久久久岛国免费| 国产精品久久一级| 一区二区三区不卡视频| 日韩成人免费电影| 国内精品第一页| 丁香五精品蜜臀久久久久99网站 | 亚洲综合一区二区精品导航| 亚洲自拍偷拍图区| 美国精品在线观看| 国产成人三级在线观看| 99天天综合性| 欧美一个色资源| 国产精品萝li| 天天综合色天天综合| 高清国产一区二区三区| 欧美探花视频资源| 久久美女艺术照精彩视频福利播放| 中文字幕精品综合| 日韩精品一级二级| aaa亚洲精品一二三区| 欧美日韩色综合| 国产日韩欧美激情| 日韩精品电影一区亚洲| 国产传媒欧美日韩成人| 欧美日韩一区中文字幕| 国产日韩精品一区二区三区| 亚洲国产婷婷综合在线精品| 国产精品538一区二区在线| 色狠狠av一区二区三区| 亚洲精品一区二区三区四区高清| 日韩美女啊v在线免费观看| 美女视频黄a大片欧美| 色综合咪咪久久| 欧美精品一区二区三区在线播放 | 中文字幕一区三区| 免费精品99久久国产综合精品| 91在线观看视频| 久久久国产精品麻豆| 亚洲超碰精品一区二区| 成人毛片视频在线观看| 日韩欧美一区二区免费| 亚洲激情男女视频| 国产精品66部| 欧美刺激脚交jootjob| 亚洲日本va在线观看| 成人av在线电影| 欧美精品一区二区不卡 | 国产成人日日夜夜| 日韩视频在线你懂得| 亚洲国产成人精品视频| 一本色道久久综合精品竹菊| 国产午夜精品一区二区三区嫩草| 青青草原综合久久大伊人精品 | 亚洲一二三区在线观看| av男人天堂一区| 国产日韩一级二级三级| 韩国精品在线观看| 日韩一区二区免费在线观看| 夜夜嗨av一区二区三区网页| 97精品电影院| 国产精品福利在线播放| 岛国一区二区三区| 欧美激情在线免费观看| 国内不卡的二区三区中文字幕| 日韩午夜在线观看视频| 美女视频一区在线观看| 精品欧美一区二区久久| 国产专区综合网| 国产日韩精品视频一区| 国产激情视频一区二区在线观看 |