diff --git a/network/ARP协议实现指导书.docx b/network/ARP协议实现指导书.docx new file mode 100644 index 0000000..0f96cbe Binary files /dev/null and b/network/ARP协议实现指导书.docx differ diff --git a/network/ICMP协议实现详解.docx b/network/ICMP协议实现详解.docx new file mode 100644 index 0000000..ca9dfda Binary files /dev/null and b/network/ICMP协议实现详解.docx differ diff --git a/network/arp/ARP响应.png b/network/arp/ARP响应.png new file mode 100755 index 0000000..8b90831 Binary files /dev/null and b/network/arp/ARP响应.png differ diff --git a/network/arp/cmake编译运行.png b/network/arp/cmake编译运行.png new file mode 100755 index 0000000..821b5cd Binary files /dev/null and b/network/arp/cmake编译运行.png differ diff --git a/network/arp/labtemplate.typ b/network/arp/labtemplate.typ new file mode 100755 index 0000000..d9c1777 --- /dev/null +++ b/network/arp/labtemplate.typ @@ -0,0 +1,154 @@ +#let times = "Times LT Pro" +#let times = "Times New Roman" +#let song = (times, "FZShuSong-Z01") +#let hei = (times, "FZHei-B01") +#let kai = (times, "FZKai-Z03") +#let xbsong = (times, "FZXiaoBiaoSong-B05") +#let fsong = (times, "FangSong_GB2312") +#let code = (times, "DejaVu Sans Mono") +#let nudtlabpaper(title: "", + author: "", + id: "", + training_type:"", + grade: "", + major: "", + department: "", + advisor: "", + jobtitle: "", + lab: "", + date: "", + header_str: "", + body) = { + // Set the document's basic properties. + set document(author: author, title: title) + set page( + + margin: (left: 30mm, right: 30mm, top: 30mm, bottom: 30mm), + ) + + // Title row. + v(158pt) + align(center)[ + #block(text(weight: 700, size: 30pt, font: hei, tracking: 15pt, "计算机网络")) + ] + align(center)[ + #block(text(weight: 700, size: 30pt, font: song, tracking: 15pt, "本科实验报告")) + ] + + v(103pt) + pad( + left: 1em, + right: 1em, + grid( + columns: (80pt, 1fr), + rows: (17pt, auto), + text(weight: 700, size: 16pt, font: song, "实验名称:"), + align(center, text(weight: "regular", size: 16pt, font: song, title)), + text(""), + line(length: 100%) + ) + // #block(text(weight: 700, 1.75em, title)) + // underline(text(weight: 700, size: 16pt, font: song, title)) + ) + + // Author information. + + v(82.5pt) + + grid( + columns: (0.25fr, 0.25fr, 0.25fr, 0.25fr), + rows: (15pt, 8pt, 15pt, 8pt, 15pt, 8pt, 15pt, 8pt, 15pt), + text(size: 14pt, font: song, tracking: 10pt, "学员姓名"), + align(center, text(size: 14pt, font: song, author)), + text(size: 14pt, font: song, tracking: 54pt, "学号"), + align(center, text(size: 14pt, font: times, id)), + text(""), + line(length: 100%), + text(""), + line(length: 100%), + text(size: 14pt, font: song, tracking: 9pt, "培养类型"), + align(center, text(size: 14pt, font: song, training_type)), + text(size: 14pt, font: song, tracking: 54pt, "年级"), + align(center, text(size: 14pt, font: times, grade)), + text(""), + line(length: 100%), + text(""), + line(length: 100%), + text(size: 14pt, font: song, tracking: 54pt, "专业"), + align(center, text(size: 14pt, font: song, major)), + text(size: 14pt, font: song, tracking: 9pt, "所属学院"), + align(center, text(size: 14pt, font: song, department)), + text(""), + line(length: 100%), + text(""), + line(length: 100%), + text(size: 14pt, font: song, tracking: 9pt, "指导教员"), + align(center, text(size: 14pt, font: song, advisor)), + text(size: 14pt, font: song, tracking: 54pt, "职称"), + align(center, text(size: 14pt, font: song, jobtitle)), + text(""), + line(length: 100%), + text(""), + line(length: 100%), + text(size: 14pt, font: song, tracking: 20pt, "实验室"), + align(center, text(size: 14pt, font: song, lab)), + text(size: 14pt, font: song, tracking: 9pt, "实验时间"), + align(center, text(size: 14pt, font: song, date)), + text(""), + line(length: 100%), + text(""), + line(length: 100%), + ) + + v(50.5pt) + align(center, text(font: hei, size: 15pt, "国防科技大学教育训练部制")) + + pagebreak() + + set page( + margin: (left: 30mm, right: 30mm, top: 30mm, bottom: 30mm), + numbering: "i", + number-align: center, + ) + + v(14pt) + align(center)[ + #block(text(font: hei, size: 14pt, "《本科实验报告》填写说明")) + ] + + v(14pt) + text("") + par(first-line-indent: 2em, text(font: song, size: 12pt, "实验报告内容编排应符合以下要求:")) + + par(first-line-indent: 2em, text(font: fsong, size: 12pt, "(1)采用A4(21cm×29.7cm)白色复印纸,单面黑字。上下左右各侧的页边距均为3cm;缺省文档网格:字号为小4号,中文为宋体,英文和阿拉伯数字为Times New Roman,每页30行,每行36字;页脚距边界为2.5cm,页码置于页脚、居中,采用小5号阿拉伯数字从1开始连续编排,封面不编页码。")) + + par(first-line-indent: 2em, text(font: fsong, size: 12pt, "(2)报告正文最多可设四级标题,字体均为黑体,第一级标题字号为4号,其余各级标题为小4号;标题序号第一级用“一、”、“二、”……,第二级用“(一)”、“(二)” ……,第三级用“1.”、“2.” ……,第四级用“(1)”、“(2)” ……,分别按序连续编排。")) + + par(first-line-indent: 2em, text(font: fsong, size: 12pt, "(3)正文插图、表格中的文字字号均为5号。")) + + pagebreak() + + set page( + margin: (left: 30mm, right: 30mm, top: 30mm, bottom: 30mm), + numbering: "1", + number-align: center, + ) + + set heading(numbering: "1.1") + // set text(font: hei, lang: "zh") + + show heading: it => box(width: 100%)[ + #v(0.50em) + #set text(font: hei) + #counter(heading).display() + // #h(0.5em) + #it.body + ] + // Main body. + set par(justify: true) + + body +} + +#let para(t) = par(first-line-indent: 2em, text(font: song, size: 10.5pt, t)) + diff --git a/network/arp/main.pdf b/network/arp/main.pdf new file mode 100755 index 0000000..f65bc71 Binary files /dev/null and b/network/arp/main.pdf differ diff --git a/network/arp/main.txt b/network/arp/main.txt new file mode 100755 index 0000000..5dbd88c --- /dev/null +++ b/network/arp/main.txt @@ -0,0 +1,523 @@ +#set page(header: [ + #set par(spacing: 6pt) + #align(center)[#text(size: 11pt)[《计算机网络》实验报告]] + #v(-0.3em) + #line(length: 100%, stroke: (thickness: 1pt)) +],) + + #show heading: it => box(width: 100%)[ + #v(0.50em) + #set text(font: hei) + #it.body + ] + +// #outline(title: "目录",depth: 3, indent: 1em) +// #outline( +// title: [图目录], +// target: figure.where(kind: image), +// ) + + #show heading: it => box(width: 100%)[ + #v(0.50em) + #set text(font: hei) + #counter(heading).display() + // #h(0.5em) + #it.body + ] +#set enum(indent: 0.5em,body-indent: 0.5em,) +#pagebreak() + +// Display inline code in a small box +// that retains the correct baseline. +#show raw.where(block: false): box.with( + fill: luma(240), + inset: (x: 3pt, y: 0pt), + outset: (y: 3pt), + radius: 2pt, +) + +// Display block code in a larger block +// with more padding. +#show raw.where(block: true): it => block( + text(font: ("Consolas","FangSong_GB2312"), it), + fill: luma(240), + inset: 10pt, + radius: 4pt, + width: 100%, +) + + += 实验目的与要求 +== 实验目的 +== 实验要求 += 实验内容 += 实验原理 += 实验环境 +== 实验背景 +== 实验设备 +#para[ +#align(center)[#table( + columns: (auto, auto,auto), + rows:(2em,2em,3em), + inset: 10pt, + align: horizon+center, + table.header( + [*设备名称*], [*设备型号*], [*设备数量*] + ), + "交换机", "华为S5735", "2", + "PC", "联想启天M410 + Windows 10", "4", +)] + 另有网线若干,控制线2条。 +] += 实验步骤 +== 环境配置 +=== 虚拟机网络配置 +#para[ + 安装Windows 10虚拟机,并配置物理机和虚拟机的IP地址,使其能够互相访问: + - 物理机网卡IP地址配置为`192.168.254.1/24`; + - 虚拟机IP地址配置为`192.168.254.3/24`。 + #figure(image("物理机虚拟机IP配置.png",format: "png",width: 90%,fit: "stretch"),caption: "物理机与虚拟机IP配置") + 配置好之后,在两边的命令行中分别使用`ping`命令测试是否能够互相访问。同时,在物理机上开启Wireshark,以过滤条件`icmp`进行抓包,查看IP地址是否正确: + #figure(image("环境配置ping测试.png",format: "png",width: 100%,fit: "stretch"),caption: "环境配置ping通测试") + 从@figure2 中可以看到,物理机和虚拟机之间可以互相访问,且Wireshark抓包显示IP地址正确。 +] +=== 使用CMake运行项目 +#para[ + CMake配置较为简单。首先,在开发工具中安装对应版本CMake插件。其次,在终端中进入项目根目录,在此使用```shell mkdir build```命令新建`build`文件夹并进入该文件夹。接下来,使用CMake工具生成对应的Makefile文件:```shell cmake -G"MinGW Makefiles" ..```。 + 然后再运行```shell make```命令编译项目,最后使用```shell xnet.exe```命令即可运行项目: + #figure(image("cmake编译运行.png",format: "png",width: 70%,fit: "stretch"),caption: "CMake配置") + 其中,MinGW是一个Windows下的GNU编译器套件,可以在Windows下编译出Linux下的可执行文件。```shell cmake -G"MinGW Makefiles" ..```命令的作用是配置使用MinGW编译器。 + + 至此,环境配置结束。 +] +== 实现ARP协议 +#para[ + 代码已经实现了最基础的以太网协议,实现了以太网帧的封装和解封装。接下来在此基础上继续实现ARP协议。 +] +=== 定义相关数据结构 +#para[ + 在`xnet_tiny.h`中定义IP地址长度以及数据结构: + ```c + #define XNET_IPV4_ADDR_SIZE 4 // IP地址长度 + + // IP地址 + typedef union _xipaddr_t { + uint8_t array[XNET_IPV4_ADDR_SIZE]; // 以数据形式存储的ip + uint32_t addr; // 32位的ip地址 + }xipaddr_t; + ``` + 该数据结构定义了IP地址的数据结构,包括了IP地址的数组形式和32位的IP地址。 + + 然后定义MAC地址的长度,以及ARP表项的结构体: + ```c + #define XNET_MAC_ADDR_SIZE 6 // MAC地址长度 + + // ARP表项 + typedef struct _xarp_entry_t { + xipaddr_t ipaddr; // ip地址 + uint8_t macaddr[XNET_MAC_ADDR_SIZE]; // mac地址 + uint8_t state; // 状态位 + uint16_t tmo; // 当前超时 + uint8_t retry_cnt; // 当前重试次数 + }xarp_entry_t; + ``` + 该结构体定义了ARP表项的数据结构,包括了IP地址、MAC地址、状态位、超时时间和重试次数。 + + 定义ARP表项的最大数量: + ```c + #define XARP_CFG_ENTRY_SIZE 6 // ARP表大小 + ``` + 随后,在`xnet_tiny.c`中,将ARP表定义为全局变量,并定义一个表项指针,方便后续代码编写: + ```c + static xarp_entry_t arp_table[XARP_CFG_ENTRY_SIZE]; // ARP表 + static xarp_entry_t* arp_entry; // ARP表项指针 + ``` + +] +=== ARP表初始化 +#para[ + 接下来编写ARP表的初始化函数。首先在`xnet_tiny.h`中定义ARP表项的第一个状态: + ```c + #define XARP_ENTRY_FREE 0 // ARP表项空闲 + ``` + 然后在`xnet_tiny.c`中定义初始化函数```c void xarp_init(void)```: + ```c + // ARP初始化 + void xarp_init(void) { + for (arp_entry = arp_table; + arp_entry < XARP_CFG_ENTRY_SIZE * sizeof(xarp_entry_t) + arp_table; + arp_entry = arp_entry + sizeof(xarp_entry_t)) + { + arp_entry->state = XARP_ENTRY_FREE; // 此处用到了上面定义的状态 + } + arp_entry = arp_table; + } + ``` + 初始化函数```c void xarp_init(void)```是一个循环。首先将前面定义的全局表项指针指向ARP表的第一个表项,循环结束条件为指针指向的表项的地址超过ARP表的最后一个表项的地址。循环会遍历ARP表中的所有表项,将表项状态初始化为`XARP_STATE_FREE`。最后,函数会将表项指针指向第一个表项,避免其他初始化过程中可能的指针越界问题。 + + 最后,在协议栈的初始化函数中添加```c xarp_init()```: + ```c + void xnet_init (void) { + ethernet_init(); // 初始化以太网 + xarp_init(); // *初始化ARP + } + ``` +] +=== 定义ARP报文 +#para[ + 接下来编写无回报ARP报文的相关函数,所以需要先定义ARP报文结构,以及它所用到的相关结构。 + + 首先在`xnet_tiny.h`中定义ARP报文中的几个字段。可以靠Wireshark抓包分析来获取这些字段的值,下面是一个示例,展示通过抓包来获取```c XNET_PROTOCOL_IP = 0x0800```: + #figure(table( + columns: (auto), + rows:(auto,auto), + inset: 10pt, + align: horizon+center, + figure(image("抓一个arp分析结构.png",format: "png",fit:"stretch",width: 100%),), + figure(image("分析结构2.png",format: "png",fit:"stretch",width: 100%),), + stroke: none, + ),caption: "通过抓包分析来获取字段值",kind: image) + 代码编写如下: + ```c + #define XARP_HW_ETHER 0x1 // 硬件类型:以太网 + #define XARP_REQUEST 0x1 // Opcode:ARP请求包 + #define XARP_REPLY 0x2 // Opcode:ARP响应包 + + typedef enum _xnet_protocol_t { + XNET_PROTOCOL_ARP = 0x0806, // ARP协议 + XNET_PROTOCOL_IP = 0x0800, // IPv4协议 + XNET_PROTOCOL_ICMP = 1, // ICMP协议 + }xnet_protocol_t; + ``` + 然后定义ARP报文的数据结构: + ```c + typedef struct _xarp_packet_t { + uint16_t hw_type, pro_type; // 硬件类型和协议类型 + uint8_t hw_len, pro_len; // 硬件地址长 + 协议地址长 + uint16_t opcode; // 请求/响应 + uint8_t sender_mac[XNET_MAC_ADDR_SIZE]; // 发送包硬件地址 + uint8_t sender_ip[XNET_IPV4_ADDR_SIZE]; // 发送包协议地址 + uint8_t target_mac[XNET_MAC_ADDR_SIZE]; // 接收方硬件地址 + uint8_t target_ip[XNET_IPV4_ADDR_SIZE]; // 接收方协议地址 + }xarp_packet_t; + ``` + 然后,使用前面定义的```c union xipaddr_t```结构,在`xnet_tiny.h`和`xnet_tiny.c`中定义ARP报文发送函数需要用到的IP地址、组播MAC地址: + ```c + // xnet_tiny.h + #define XNET_CFG_NETIF_IP {192, 168, 254, 2} // 本项目模拟出的网卡的IP + + // xnet_tiny.c + static const xipaddr_t netif_ipaddr = XNET_CFG_NETIF_IP; + static const uint8_t ether_broadcast[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + ``` + 至此,定义ARP报文的数据结构结束。 +] +=== ARP报文发送函数 +#para[ + 下面编写ARP报文发送函数```c xarp_make_request(const xipaddr_t * ipaddr)```。 + ```c + /** + * 产生一个ARP请求,请求网络指定ip地址的机器发回一个ARP响应 + * @param ipaddr 请求的IP地址 + * @return 请求结果 + */ + xnet_err_t xarp_make_request(const xipaddr_t * ipaddr) { + xarp_packet_t* arp_packet; + xnet_packet_t * packet = xnet_alloc_for_send(sizeof(xarp_packet_t)); + + arp_packet = (xarp_packet_t *)packet->data; + arp_packet->hw_type = swap_order16(XARP_HW_ETHER); // 设置硬件类型为以太网 + arp_packet->pro_type = swap_order16(XNET_PROTOCOL_IP); // 设置协议类型为IP + arp_packet->hw_len = XNET_MAC_ADDR_SIZE; // 设置硬件地址长度 + arp_packet->pro_len = XNET_IPV4_ADDR_SIZE; // 设置协议地址长度 + arp_packet->opcode = swap_order16(XARP_REQUEST); // 设置操作码为ARP请求 + // 复制发送方MAC地址 + memcpy(arp_packet->sender_mac, netif_mac, XNET_MAC_ADDR_SIZE); + // 复制发送方IP地址 + memcpy(arp_packet->sender_ip, netif_ipaddr.array, XNET_IPV4_ADDR_SIZE); + // 目标MAC地址清零 + memset(arp_packet->target_mac, 0, XNET_MAC_ADDR_SIZE); + // 复制目标IP地址 + memcpy(arp_packet->target_ip, ipaddr->array, XNET_IPV4_ADDR_SIZE); + // 通过以太网发送ARP请求 + return ethernet_out_to(XNET_PROTOCOL_ARP, ether_broadcast, packet); + } + ``` + 这个函数的主要功能是生成并发送一个ARP请求报文,以请求指定IP地址(即函数的输入```c const xipaddr_t * ipaddr```)的机器返回其MAC地址。函数的具体步骤如下: + 1. 分配一个用于发送的ARP数据包```c arp_packet```,并将其数据段设置为ARP报文结构。 + 2. 设置ARP报文的各个字段,包括硬件类型`hw_type`、协议类型`pro_type`、硬件地址长度`hw_len`、协议地址长度`pro_len`、操作码`opcode`(设置为`XARP_REQUEST`)等。 + 3. 复制发送方(即本项目模拟出的网卡)的MAC地址和IP地址到ARP报文中。 + 4. 将目标MAC地址字段清零,并复制目标IP地址到ARP报文中。 + 5. 最后,通过以太网发送该ARP请求报文,返回发送结果(状态码)。 +] +=== 启动时的ARP请求 +#para[ + 在以太网协议的初始化函数```c static xnet_err_t ethernet_init(void)```中添加一个ARP请求: + ```c + /** + * 以太网初始化 + * @return 初始化结果 + */ + static xnet_err_t ethernet_init (void) { + xnet_err_t err = xnet_driver_open(netif_mac); + if (err < 0) return err; + + return xarp_make_request(&netif_ipaddr); // 发送ARP请求 + } + ``` + 这样,当协议栈初始化时,会发送一个ARP请求。 + + 下面用Wireshark抓包来验证ARP请求是否发送成功。首先,重新编译项目;其次,开启Wireshark抓包;最后,启动程序: + #figure(image("启动ARP2.png",format: "png",width: 100%,fit: "stretch"),caption: "启动时的ARP请求") + 从@figure3 中可以看到,ARP请求发送成功,说明编写至此的代码没有问题。 +] +=== ARP报文接收函数 +#para[ + ARP报文接收函数主要功能是处理接收到的ARP报文,包括解析报文、更新ARP表、发送ARP响应等。下面,根据这些需求编写ARP报文接收函数```c void xarp_in(xnet_packet_t * packet)```: + ```c + /** + * 处理接收到的ARP包 + * @param packet 输入的ARP包 + */ + void xarp_in(xnet_packet_t * packet) { + // 检查包的大小是否符合ARP包的最小长度要求 + if (packet->size >= sizeof(xarp_packet_t)) { + xarp_packet_t * arp_packet = (xarp_packet_t *) packet->data; + uint16_t opcode = swap_order16(arp_packet->opcode); + + // 检查包的合法性,包括硬件类型、硬件地址长度、协议类型、协议地址长度和操作码 + if ((swap_order16(arp_packet->hw_type) != XARP_HW_ETHER) || + (arp_packet->hw_len != XNET_MAC_ADDR_SIZE) || + (swap_order16(arp_packet->pro_type) != XNET_PROTOCOL_IP) || + (arp_packet->pro_len != XNET_IPV4_ADDR_SIZE) + || ((opcode != XARP_REQUEST) && (opcode != XARP_REPLY))) { + return; + } + + // 只处理目标IP地址为自己的ARP请求或响应包 + if (!xipaddr_is_equal_buf(&netif_ipaddr, arp_packet->target_ip)) { + return; + } + + // 根据操作码进行处理 + switch (swap_order16(arp_packet->opcode)) { + case XARP_REQUEST: // 处理ARP请求,发送ARP响应并更新ARP表项 + xarp_make_response(arp_packet); + update_arp_entry(arp_packet->sender_ip, arp_packet->sender_mac); + break; + case XARP_REPLY: // 处理ARP响应,更新ARP表项 + update_arp_entry(arp_packet->sender_ip, arp_packet->sender_mac); + break; + } + } + } + ``` + 该函数主要功能是处理接收到的ARP包。首先进行简单的长度判断,避免后续字段读取失败造成内存错误。随后检查包的合法性,包括硬件类型、硬件地址长度、协议类型、协议地址长度和操作码。APR响应只要求机器处理目标IP地址为自己的ARP请求或响应包,所以使用```c if (!xipaddr_is_equal_buf(&netif_ipaddr, arp_packet->target_ip))```来判断。最后,根据操作码进行处理,分别处理ARP请求和ARP响应: + - ARP请求:发送ARP响应(```c xarp_make_response(...)```)并更新ARP表项(```c update_arp_entry(...)```); + - ARP响应:只需要更新ARP表项。 + + 其中,用到的宏```c xipaddr_is_equal_buf()```函数用于比较两个IP地址是否相等,实现如下: + ```c + // 比较IP地址是否相等 + #define xipaddr_is_equal_buf(addr, buf) (memcmp( + (addr)->array, + (buf), + XNET_IPV4_ADDR_SIZE + ) + == 0 + ) + ``` + 然后,需要编写上面函数中调用的两个函数:```c xarp_make_response()```和```c update_arp_entry()```。 + + ```c xarp_make_response()```函数主要功能是:输入一个ARP请求包,通过此包内的源信息,生成对应的ARP响应,并发送出去。具体代码如下: + ```c + /** + * 生成一个ARP响应 + * @param arp_packet 接收到的ARP请求包 + * @return 生成结果 + */ + xnet_err_t xarp_make_response(xarp_packet_t * arp_packet) { + xarp_packet_t* response_packet; + xnet_packet_t * packet = xnet_alloc_for_send(sizeof(xarp_packet_t)); + + response_packet = (xarp_packet_t *)packet->data; + response_packet->hw_type = swap_order16(XARP_HW_ETHER); // 设置硬件类型为以太网 + response_packet->pro_type = swap_order16(XNET_PROTOCOL_IP); // 设置协议类型为IP + response_packet->hw_len = XNET_MAC_ADDR_SIZE; // 设置硬件地址长度 + response_packet->pro_len = XNET_IPV4_ADDR_SIZE; // 设置协议地址长度 + response_packet->opcode = swap_order16(XARP_REPLY); // 设置操作码为ARP响应 + // 复制目标MAC地址 + memcpy(response_packet->target_mac, arp_packet->sender_mac, XNET_MAC_ADDR_SIZE); + // 复制目标IP地址 + memcpy(response_packet->target_ip, arp_packet->sender_ip, XNET_IPV4_ADDR_SIZE); + // 复制发送方MAC地址 + memcpy(response_packet->sender_mac, netif_mac, XNET_MAC_ADDR_SIZE); + // 复制发送方IP地址 + memcpy(response_packet->sender_ip, netif_ipaddr.array, XNET_IPV4_ADDR_SIZE); + // 通过以太网发送ARP响应 + return ethernet_out_to(XNET_PROTOCOL_ARP, ether_broadcast, packet); + } + ``` + 可以发现此函数与前面的ARP请求函数```c xarp_make_request()```非常相似,只是操作码不同,此处为`XARP_REPLY`,其他字段均从源ARP请求报文中获取,并填入对应区域。 + + ```c update_arp_entry()```函数主要功能是更新所有ARP表项,附带一定的可视化功能。具体代码如下: + ```c + /** + * 更新ARP表项 + * @param src_ip 源IP地址 + * @param mac_addr 对应的mac地址 + */ + static void update_arp_entry(uint8_t* src_ip, uint8_t* mac_addr) { + for (arp_entry = arp_table; + arp_entry < XARP_CFG_ENTRY_SIZE * sizeof(xarp_entry_t) + arp_table; + arp_entry = arp_entry + sizeof(xarp_entry_t)) + { + // 检查ARP表项是否为空或者是否与给定的源IP地址匹配且状态不是有效的 + if (arp_entry->state == XARP_ENTRY_FREE || + ( arp_entry->state == XARP_ENTRY_OK + && xipaddr_is_equal_buf(&arp_entry->ipaddr, src_ip) + )) + { + // 更新ARP表项中的IP地址和MAC地址 + memcpy(arp_entry->ipaddr.array, src_ip, XNET_IPV4_ADDR_SIZE); + memcpy(arp_entry->macaddr, mac_addr, 6); + printf("learned☝🤓mac addr:\n"); + for ( + int i = 0; + i < sizeof(mac_addr) / sizeof(mac_addr[0]); + ++i) + { + printf("%02X%c", + mac_addr[i], + i < sizeof(mac_addr) / sizeof(mac_addr[0]) - 1 ? ':' : '\n' + ); + } + // 设置ARP表项状态为有效 + arp_entry->state = XARP_ENTRY_OK; + // 设置ARP表项的超时时间 + arp_entry->tmo = XARP_CFG_ENTRY_OK_TMO; + // 设置ARP表项的重试次数 + arp_entry->retry_cnt = XARP_CFG_MAX_RETRIES; + print_arp_table(); // 打印完整的ARP表 + return; // 更新后退出函数 + } + } + + // 如果ARP表已满,采用LRU策略替换最老的表项 + arp_entry = arp_table; // 重置arp_entry指向表头 + xarp_entry_t* oldest_entry = NULL; + uint32_t oldest_tmo = 0xFFFFFFFF; + for (arp_entry = arp_table; + arp_entry < XARP_CFG_ENTRY_SIZE * sizeof(xarp_entry_t) + arp_table; + arp_entry = arp_entry + sizeof(xarp_entry_t)) + { + if (arp_entry->tmo < oldest_tmo) { + oldest_tmo = arp_entry->tmo; + oldest_entry = arp_entry; + } + } + if (oldest_entry != NULL) { + // 更新最老的ARP表项 + memcpy(oldest_entry->ipaddr.array, src_ip, XNET_IPV4_ADDR_SIZE); + memcpy(oldest_entry->macaddr, mac_addr, 6); + printf("learned☝🤓mac addr:\n"); + for (int i = 0; i < sizeof(mac_addr) / sizeof(mac_addr[0]); ++i) { + printf("%02X%c", mac_addr[i], i < sizeof(mac_addr) / sizeof(mac_addr[0]) - 1 ? ':' : '\n'); + } + // 设置ARP表项状态为有效 + oldest_entry->state = XARP_ENTRY_OK; + // 设置ARP表项的超时时间 + oldest_entry->tmo = XARP_CFG_ENTRY_OK_TMO; + // 设置ARP表项的重试次数 + oldest_entry->retry_cnt = XARP_CFG_MAX_RETRIES; + print_arp_table(); // 打印完整的ARP表 + } + } + ``` + 这个函数很长。它主要功能是更新ARP表项。更新分为两种情况: + - ARP表还有空闲表项 + - ARP表已满,采用LRU策略替换最老的表项 + 首先,函数通过遍历ARP表中的所有表项,检查表项是否为空或者是否与给定的源IP地址匹配且状态不是有效的。如果满足条件,则更新ARP表项中的IP地址和MAC地址,并设置表项状态为有效,设置超时时间和重试次数(最后,会打印完整的ARP表)。如果ARP表已满,则采用LRU策略替换最老的表项。函数会遍历ARP表,找到超时时间最小的表项,并更新该表项的IP地址和MAC地址,设置表项状态为有效,设置超时时间和重试次数,最后打印完整的ARP表。 + + 用到的打印函数实现如下: + ```c + /** + * 打印完整的ARP表 + */ + void print_arp_table() { + printf("\n----ARP Table----\n"); + for (arp_entry = arp_table; arp_entry < XARP_CFG_ENTRY_SIZE * sizeof(xarp_entry_t) + arp_table; arp_entry = arp_entry + sizeof(xarp_entry_t)) { + if (arp_entry->state != XARP_ENTRY_FREE) { + printf("IP: "); + for (int i = 0; i < XNET_IPV4_ADDR_SIZE; ++i) { + printf("%d%c", + arp_entry->ipaddr.array[i], + i < XNET_IPV4_ADDR_SIZE - 1 ? '.' : '\n' + ); + } + printf("MAC: "); + for (int i = 0; i < 6; ++i) { + printf("%02X%c", arp_entry->macaddr[i], i < 5 ? ':' : '\n'); + } + printf( + "State: %s\n", + arp_entry->state == XARP_ENTRY_FREE ? "FREE" : + arp_entry->state == XARP_ENTRY_RESOLVING ? "RESOLVING" : "OK" + ); + } + } + printf("\n-----------------\n"); + } + ``` + + 最后,需要在以太网帧接收函数中添加ARP报文的处理: + ```c + /** + * 以太网数据帧输入输出 + * @param packet 待处理的包 + */ + static void ethernet_in (xnet_packet_t * packet) { + // 至少要比头部数据大 + if (packet->size <= sizeof(xether_hdr_t)) { + return; + } + // 根据协议类型分发到不同的处理函数 + xether_hdr_t* hdr = (xether_hdr_t*)packet->data; + switch (swap_order16(hdr->protocol)) { + case XNET_PROTOCOL_ARP: + // 移除以太网头部,处理ARP协议 + remove_header(packet, sizeof(xether_hdr_t)); + xarp_in(packet); + break; + case XNET_PROTOCOL_IP: { + break; + } + } + } + ``` + 其中,主要在```c case XNET_PROTOCOL_ARP```中添加了对ARP报文的处理。 + + 在继续之前,再次使用Wireshark检验这部分代码编写。重新编译后,按照以下流程进行检验: + - 开启Wireshark抓包; + - 运行本程序; + - 在虚拟机上ping本程序,以触发ARP请求; + - 查看Wireshark抓包结果和程序输出。 + #figure(image("ARP响应.png",format: "png",width: 100%,fit: "stretch"),caption: "ARP请求响应") + 从@figure4 中可以看到,ARP响应都发送成功,程序输出中也表明学习到了虚拟机的MAC地址,说明代码编写正确。 +] +=== ARP超时重传 += 实验总结 +== 内容总结 + +== 心得感悟 + +#show heading: it => box(width: 100%)[ + #v(0.50em) + #set text(font: hei) + // #counter(heading).display() + // #h(0.5em) + #it.body +] +#pagebreak() +#bibliography("ref.yml",full: true,title: "参考文献",style:"gb-7714-2015-numeric") diff --git a/network/arp/main.typ b/network/arp/main.typ new file mode 100755 index 0000000..0b57fd6 --- /dev/null +++ b/network/arp/main.typ @@ -0,0 +1,964 @@ +#import "labtemplate.typ": * +#show: nudtlabpaper.with(title: "TCP/IP 协议栈 ARP 协议实现实验", + author: "王李烜", + id: "202202001046", + training_type: "无军籍", + grade: "2022", + major: "网络工程", + department: "计算机学院", + advisor: "邱振宇", + jobtitle: "讲师", + lab: "305-505", + date: "2024.12.16", + header_str: "《计算机网络》实验报告", +) + +#set page(header: [ + #set par(spacing: 6pt) + #align(center)[#text(size: 11pt)[《计算机网络》实验报告]] + #v(-0.3em) + #line(length: 100%, stroke: (thickness: 1pt)) +],) + + #show heading: it => box(width: 100%)[ + #v(0.50em) + #set text(font: hei) + #it.body + ] + +#outline(title: "目录",depth: 3, indent: 1em) +#pagebreak() +#outline( + title: [图目录], + target: figure.where(kind: image), +) + + #show heading: it => box(width: 100%)[ + #v(0.50em) + #set text(font: hei) + #counter(heading).display() + // #h(0.5em) + #it.body + ] +#set enum(indent: 0.5em,body-indent: 0.5em,) +#pagebreak() + + += 实验概要 +== 实验内容 +#para[ + 本次实验的主要内容 ARP 协议实现。本次实验包含基础任务和拓展任务两部分, + 具体任务要求如下: + + - 基础任务:编写程序,完善 TCP/IP 协议栈的 ARP 协议部分。围绕 ARP 的初始化、无回报 ARP 的生成、ARP 的输入处理,以及 ARP 的超时重新请 求几个部分完成。并且保证完成 ARP 协议的完整实现。#box( + text(font: ("Times LT Pro","FZXiaoBiaoSong-B05"),fill: luma(240), weight:"bold", "本实验中Completed!"), + fill:blue, + inset: (x: 3pt, y: 0pt), + outset: (y: 3pt), + radius: 2pt,) + + - 拓展任务:拓展任务是可选任务,在基础任务实现的 ARP 协议实现基础上, 可选择性的完成如下任务: + + ARP 多个表项的实现;#box( + text(font: ("Times LT Pro","FZXiaoBiaoSong-B05"),fill: luma(240), weight:"bold", "本实验中Completed!"), + fill:blue, + inset: (x: 3pt, y: 0pt), + outset: (y: 3pt), + radius: 2pt,) + + IP 层的输入输出处理。#box( + text(font: ("Times LT Pro","FZXiaoBiaoSong-B05"),fill: luma(240), weight:"bold", "本实验中Completed!"), + fill:blue, + inset: (x: 3pt, y: 0pt), + outset: (y: 3pt), + radius: 2pt,) +] +== 实验要求 +#para[ + 本实验的具体过程及对应要求如下: + - 实验开始前准备工作:在实验开始前,学员需要掌握 C语言 编程基础,理解 TCP/IP 协议栈的工作原理,尤其是 ARP 协议的功能和作用。同时,熟悉 MAC 地址与 IP 地址的转换原理,了解网络设备如何通过 ARP 请求与响应进行地址解析。 + - 实验过程中:按照实验要求,完成 ARP 协议的实现。具体步骤包括:具体而言,构造 ARP 请求和响应报文,实现报文格式的编码与解析。发送 ARP请求,构建并广播 ARP 请求,获取目标设备的 MAC 地址。处理 ARP 响应,在收到响应后,提取并记录目标 IP 与 MAC 地址的映射。管理 ARP 缓存,设计缓存机制,存储 IP-MAC 映射,并实现超时处理机制。 + - 实验结束后:总结 ARP 协议的实现过程,详细描述报文格式、缓存管理和通信流程,并根据实验要求撰写实验报告,分析实验结果。 +] +== 实验目的 +#para[ + 在现代网络环境中, ARP协议广泛应用于各种网络设备和系统,如计算机、路由器和交换机等。深入理解ARP的工作原理,有助于掌握网络设备之间的通信机制,理解数据在网络中的传输过程。特别是对于网络工程和网络安全领域,从协议层面了解ARP,有助于识别和防范诸如ARP欺骗等网络攻击,提高网络的安全防护能力。 + + 通过本次实验,学员将亲自动手实现ARP协议的核心功能,包括ARP请求与响应的构建与解析、ARP缓存表的管理等。这不仅加深了对TCP/IP协议栈的理解,也培养了实际编程和问题解决的能力。掌握ARP协议的实现,对后续学习更复杂的网络协议(如IP、ICMP、TCP和UDP)以及从事网络相关工作都有重要的意义。 +] +// Display inline code in a small box +// that retains the correct baseline. +#show raw.where(block: false): it => box( + text(font: ("Consolas","FangSong_GB2312"), it), + fill: luma(240), + inset: (x: 3pt, y: 0pt), + outset: (y: 3pt), + radius: 2pt, +) + +// Display block code in a larger block +// with more padding. +#show raw.where(block: true): it => block( + text(font: ("Consolas","FangSong_GB2312"), it), + fill: luma(240), + inset: 10pt, + radius: 4pt, + width: 100%, +) + += 实验原理及方案 +#para[ + ARP(地址解析协议)是 TCP/IP 协议族中用于将 IP 地址解析为 MAC 地址的重要协议。IP 通信依赖于数据链路层的硬件地址(MAC 地址),而 ARP 负责动态地将网络层的 IP 地址转换为对应的数据链路层 MAC 地址,从而实现设备间的通信。ARP 协议的实现主要包括发送 ARP 请求、接收并处理 ARP 响应、更新 ARP 缓存、以及缓存超时机制。 +] +== ARP的初始化 +#para[ + 在一个典型的局域网中,设备通过 IP 地址进行网络层通信,但 IP 地址并不能直接用于数据链路层传输。以太网等数据链路层协议使用 MAC 地址进行通信,因此,发送设备需要将目标 IP 地址解析为 MAC 地址才能发送数据帧。 + + 如果该设备的 ARP 缓存中没有目标设备的 MAC 地址映射,它会广播 ARP 请求,询问网络上哪个设备持有特定的 IP 地址。ARP 请求是一个以太网层的广播包,发送到子网内所有设备,只有持有目标 IP 地址的设备才会进行响应。 + + ARP 初始化的过程是设备发现并解析网络中其他设备的关键步骤。ARP 请求包含源设备的 IP 地址和 MAC 地址,而目标设备通过 ARP 响应提供其对应的 MAC 地址。这个机制确保设备能够通过网络层(IP 地址)和链路层(MAC 地址)之间建立正确的映射关系。 +] +== 无回报 ARP 的生成 +#para[ + 无回报 ARP(Gratuitous ARP),又称为“主动 ARP”或“自愿 ARP”,是一种特殊的 ARP 操作。与典型的 ARP 请求不同,无回报 ARP 并不是为了解析目标设备的 MAC 地址,而是设备主动向网络发送广播 ARP 包,通常用于更新网络中的 IP-MAC 映射关系、检测 IP 地址冲突等。 + +无回报 ARP 是设备主动广播自身的 IP 地址和 MAC 地址,不带有显式的 ARP 请求和响应互动。其主要目的是通知网络中其他设备更新其 ARP 缓存表中的信息。这种情况下,设备并不期待其他设备回应。它是单向广播的,通常被用于下列几种情况: + +- 更新网络中的 ARP 表:当设备的 MAC 地址或 IP 地址发生变动时,可以主动发送无回报 ARP,以便通知网络中其他设备更新其 ARP 缓存。 +- IP 冲突检测:设备在启动时,通过发送无回报 ARP 来检测是否有其他设备占用了相同的 IP 地址。如果另一台设备使用了相同的 IP 地址,它会回应此 ARP 广播,从而帮助设备检测到 IP 冲突。 +- 负载均衡器和高可用性系统:当系统切换主备设备时,备设备通常会发送无回报 ARP 来通知网络中的所有节点其 IP-MAC 映射已经改变,避免继续向已下线的设备发送数据。 + +无回报 ARP 的生成过程如下: + +1. 生成 ARP 广播包:设备在确定需要广播自身 IP-MAC 映射时,会生成一个 ARP 广播包。该包包含设备自身的 IP 地址和 MAC 地址,并且目标硬件地址设置为全 0,因为无回报 ARP 并不是请求对方设备的 MAC 地址,而是向网络中的所有设备广播自身的信息。 +2. 设置操作码为 ARP 请求:尽管无回报 ARP 是主动广播,但它在帧结构中被标记为 ARP 请求(操作码为 1),这使得网络中的其他设备会将其视为一种信息广播,用于更新 ARP 缓存。 +3. 发送广播:ARP 广播包通过以太网层进行传输,目标 MAC 地址为 FF:FF:FF:FF:FF:FF,即局域网内的所有设备都可以接收到此广播。 +4. 网络中的设备处理:网络中所有收到此广播的设备会检查 ARP 包中的发送方 IP 地址和 MAC 地址,并将其更新到本地的 ARP 缓存表中。这样,即使该 IP 地址之前未出现在这些设备的 ARP 表中,它们也会记录并更新新的映射。 +] +== ARP 的输入处理 +#para[ + ARP(地址解析协议)的输入处理指的是设备在接收到 ARP 请求或响应时,如何对该 ARP 报文进行解析和处理,并据此更新设备的 ARP 缓存,或进一步采取必要的网络行为。ARP 输入处理的核心任务是解析报文,更新 ARP 缓存,并根据报文类型采取不同的操作。 + + 在这部分有以下步骤: + + - 接收 ARP 报文:设备通过网络接口接收到 ARP 报文,无论是广播还是单播形式。这些 ARP 报文可以是 ARP 请求、ARP 响应,或者是无回报 ARP。 + - 解析 ARP 报文:设备对 ARP 报文进行解析,提取其中的关键信息。 + - 检查报文有效性:设备检查 ARP 报文的有效性,包括检查硬件类型是否为以太网、协议类型是否为 IPv4、操作码是否为合法的请求或响应。如果报文不符合 ARP 协议规定,设备将丢弃该报文。 + - 更新 ARP 缓存:根据 ARP 报文中的信息,设备更新自己的 ARP 缓存表。设备通常会把报文中的发送方 IP 地址和发送方 MAC 地址映射记录下来,以便将来进行快速的 IP 到 MAC 地址解析。 + - 据操作码进行处理:不同类型的 ARP 报文有不同的处理方式: + - 如果接收到的是 ARP 请求,设备需要检查目标 IP 地址是否与自身的 IP 地址匹配,如果匹配,则需要发送一个 ARP 响应包,告知请求设备自己的 MAC 地址。 + - 如果接收到的是 ARP 响应,设备会根据响应包中的信息,更新或添加到 ARP 缓存表,并不再发送进一步的响应。 + - 如果接收到的是无回报 ARP,设备会将报文中的 IP-MAC 映射记录下来,以更新其 ARP 缓存。 +] +== ARP 的超时重新请求机制 +#para[ + ARP(地址解析协议)的超时重新请求机制指的是设备在尝试解析某个 IP 地址到 MAC 地址时,若未能在设定的时间内收到响应,会采取的重发 ARP 请求的策略。这种机制旨在保证网络设备在通信中能够及时获取目标设备的 MAC 地址,并维持 ARP 缓存的准确性。 + + ARP 缓存存储的是 IP 地址与 MAC 地址之间的映射关系。在通信过程中,网络设备通常会先查询 ARP 缓存以查找目标设备的 MAC 地址。如果缓存中存在该 IP 地址的记录,设备会直接使用缓存中的 MAC 地址进行通信;如果没有找到相应记录,设备会发出 ARP 请求,广播请求目标 IP 地址对应的 MAC 地址。 + + 如果设备在发送 ARP 请求后,未能在指定的时间内收到 ARP 响应,它会认为该 ARP 请求失败。这时,设备会重新发送 ARP 请求,通常会进行一定次数的重发,以确保能够成功解析目标设备的 MAC 地址。 +] += 实验环境 +== 实验设备与软件 +#para[ +#align(center)[#table( + columns: (auto, auto), + rows:(auto,auto,auto), + inset: 10pt, + align: horizon+center, + table.header( + [*名称*], [*型号或版本*], + ), + "物理机", "联想ThinkPad-Windows 10 22H4", + "虚拟机", "Virtual Box-Windows 10 22H4", + "Wireshark", "Wireshark 4.4.0", + "CMake", "CMake 3.31.3" +)] +] += 实验步骤 +== 环境配置 +=== 虚拟机网络配置 +#para[ + 安装Windows 10虚拟机,并配置物理机和虚拟机的IP地址,使其能够互相访问: + - 物理机网卡IP地址配置为`192.168.254.1/24`; + - 虚拟机IP地址配置为`192.168.254.3/24`。 + #figure(image("物理机虚拟机IP配置.png",format: "png",width: 90%,fit: "stretch"),caption: "物理机与虚拟机IP配置") + 配置好之后,在两边的命令行中分别使用`ping`命令测试是否能够互相访问。同时,在物理机上开启Wireshark,以过滤条件`icmp`进行抓包,查看IP地址是否正确: + #figure(image("环境配置ping测试.png",format: "png",width: 90%,fit: "stretch"),caption: "环境配置ping通测试") + 从@figure2 中可以看到,物理机和虚拟机之间可以互相访问,且Wireshark抓包显示IP地址正确。 +] +=== 使用CMake运行项目 +#para[ + CMake配置较为简单。首先,在开发工具中安装对应版本CMake插件。其次,在终端中进入项目根目录,在此使用```shell mkdir build```命令新建`build`文件夹并进入该文件夹。接下来,使用CMake工具生成对应的Makefile文件:```shell cmake -G"MinGW Makefiles" ..```。 + 然后再运行```shell make```命令编译项目,最后使用```shell xnet.exe```命令即可运行项目: + #figure(image("cmake编译运行.png",format: "png",width: 76%,fit: "stretch"),caption: "CMake配置") + 其中,MinGW是一个Windows下的GNU编译器套件,可以在Windows下编译出Linux下的可执行文件。```shell cmake -G"MinGW Makefiles" ..```命令的作用是配置使用MinGW编译器。 + + 至此,环境配置结束。 +] +== 实现ARP协议 +#para[ + 代码已经实现了最基础的以太网协议,实现了以太网帧的封装和解封装。接下来在此基础上继续实现ARP协议。 +] +=== 相关数据结构 +#para[ + 在`xnet_tiny.h`中定义IP地址长度以及数据结构: + ```c + #define XNET_IPV4_ADDR_SIZE 4 // IP地址长度 + + // IP地址 + typedef union _xipaddr_t { + uint8_t array[XNET_IPV4_ADDR_SIZE]; // 以数据形式存储的ip + uint32_t addr; // 32位的ip地址 + }xipaddr_t; + ``` + 该数据结构定义了IP地址的数据结构,包括了IP地址的数组形式和32位的IP地址。 + + 然后定义MAC地址的长度,以及ARP表项的结构体: + ```c + #define XNET_MAC_ADDR_SIZE 6 // MAC地址长度 + + // ARP表项 + typedef struct _xarp_entry_t { + xipaddr_t ipaddr; // ip地址 + uint8_t macaddr[XNET_MAC_ADDR_SIZE]; // mac地址 + uint8_t state; // 状态位 + uint16_t tmo; // 当前超时 + uint8_t retry_cnt; // 当前重试次数 + }xarp_entry_t; + ``` + 该结构体定义了ARP表项的数据结构,包括了IP地址、MAC地址、状态位、超时时间和重试次数。 + + 定义ARP表项的最大数量: + ```c + #define XARP_CFG_ENTRY_SIZE 8 // ARP表大小 + ``` + 随后,在`xnet_tiny.c`中,将ARP表定义为全局变量,并定义一个表项指针,方便后续代码编写: + ```c + static xarp_entry_t arp_table[XARP_CFG_ENTRY_SIZE]; // ARP表 + static xarp_entry_t* arp_entry; // ARP表项指针 + ``` + +] +=== ARP表初始化 +#para[ + 接下来编写ARP表的初始化函数。首先在`xnet_tiny.h`中定义ARP表项的第一个状态: + ```c + #define XARP_ENTRY_FREE 0 // ARP表项空闲 + ``` + 然后在`xnet_tiny.c`中定义初始化函数```c void xarp_init(void)```: + ```c + // ARP初始化 + void xarp_init(void) { + for (arp_entry = arp_table; + arp_entry < XARP_CFG_ENTRY_SIZE * sizeof(xarp_entry_t) + arp_table; + arp_entry = arp_entry + sizeof(xarp_entry_t)) + { + arp_entry->state = XARP_ENTRY_FREE; // 此处用到了上面定义的状态 + } + arp_entry = arp_table; + } + ``` + 初始化函数```c void xarp_init(void)```是一个循环。首先将前面定义的全局表项指针指向ARP表的第一个表项,循环结束条件为指针指向的表项的地址超过ARP表的最后一个表项的地址。循环会遍历ARP表中的所有表项,将表项状态初始化为`XARP_STATE_FREE`。最后,函数会将表项指针指向第一个表项,避免其他初始化过程中可能的指针越界问题。 + + 最后,在协议栈的初始化函数中添加```c xarp_init()```: + ```c + void xnet_init (void) { + ethernet_init(); // 初始化以太网 + xarp_init(); // *初始化ARP + } + ``` +] +=== ARP报文 +#para[ + 接下来编写无回报ARP报文的相关函数,所以需要先定义ARP报文结构,以及它所用到的相关结构。 + + 首先在`xnet_tiny.h`中定义ARP报文中的几个字段。可以靠Wireshark抓包分析来获取这些字段的值,下面是一个示例,展示通过抓包来获取```c XNET_PROTOCOL_IP = 0x0800```: + #figure(table( + columns: (auto), + rows:(auto,auto), + inset: 10pt, + align: horizon+center, + figure(image("抓一个arp分析结构.png",format: "png",fit:"stretch",width: 100%),), + figure(image("分析结构2.png",format: "png",fit:"stretch",width: 100%),), + stroke: none, + ),caption: "通过抓包分析来获取字段值",kind: image) + 代码编写如下: + ```c + #define XARP_HW_ETHER 0x1 // 硬件类型:以太网 + #define XARP_REQUEST 0x1 // Opcode:ARP请求包 + #define XARP_REPLY 0x2 // Opcode:ARP响应包 + + typedef enum _xnet_protocol_t { + XNET_PROTOCOL_ARP = 0x0806, // ARP协议 + XNET_PROTOCOL_IP = 0x0800, // IPv4协议 + XNET_PROTOCOL_ICMP = 1, // ICMP协议 + }xnet_protocol_t; + ``` + 然后定义ARP报文的数据结构: + ```c + typedef struct _xarp_packet_t { + uint16_t hw_type, pro_type; // 硬件类型和协议类型 + uint8_t hw_len, pro_len; // 硬件地址长 + 协议地址长 + uint16_t opcode; // 请求/响应 + uint8_t sender_mac[XNET_MAC_ADDR_SIZE]; // 发送包硬件地址 + uint8_t sender_ip[XNET_IPV4_ADDR_SIZE]; // 发送包协议地址 + uint8_t target_mac[XNET_MAC_ADDR_SIZE]; // 接收方硬件地址 + uint8_t target_ip[XNET_IPV4_ADDR_SIZE]; // 接收方协议地址 + }xarp_packet_t; + ``` + 然后,使用前面定义的```c union xipaddr_t```结构,在`xnet_tiny.h`和`xnet_tiny.c`中定义ARP报文发送函数需要用到的IP地址、组播MAC地址: + ```c + // xnet_tiny.h + #define XNET_CFG_NETIF_IP {192, 168, 254, 2} // 本项目模拟出的网卡的IP + + // xnet_tiny.c + static const xipaddr_t netif_ipaddr = XNET_CFG_NETIF_IP; + static const uint8_t ether_broadcast[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + ``` + 至此,定义ARP报文的数据结构结束。 +] +=== ARP报文发送函数 +#para[ + 下面编写ARP报文发送函数```c xarp_make_request(const xipaddr_t * ipaddr)```。 + ```c + /** + * 产生一个ARP请求,请求网络指定ip地址的机器发回一个ARP响应 + * @param ipaddr 请求的IP地址 + * @return 请求结果 + */ + xnet_err_t xarp_make_request(const xipaddr_t * ipaddr) { + xarp_packet_t* arp_packet; + xnet_packet_t * packet = xnet_alloc_for_send(sizeof(xarp_packet_t)); + + arp_packet = (xarp_packet_t *)packet->data; + arp_packet->hw_type = swap_order16(XARP_HW_ETHER); // 设置硬件类型为以太网 + arp_packet->pro_type = swap_order16(XNET_PROTOCOL_IP); // 设置协议类型为IP + arp_packet->hw_len = XNET_MAC_ADDR_SIZE; // 设置硬件地址长度 + arp_packet->pro_len = XNET_IPV4_ADDR_SIZE; // 设置协议地址长度 + arp_packet->opcode = swap_order16(XARP_REQUEST); // 设置操作码为ARP请求 + // 复制发送方MAC地址 + memcpy(arp_packet->sender_mac, netif_mac, XNET_MAC_ADDR_SIZE); + // 复制发送方IP地址 + memcpy(arp_packet->sender_ip, netif_ipaddr.array, XNET_IPV4_ADDR_SIZE); + // 目标MAC地址清零 + memset(arp_packet->target_mac, 0, XNET_MAC_ADDR_SIZE); + // 复制目标IP地址 + memcpy(arp_packet->target_ip, ipaddr->array, XNET_IPV4_ADDR_SIZE); + // 通过以太网发送ARP请求 + return ethernet_out_to(XNET_PROTOCOL_ARP, ether_broadcast, packet); + } + ``` + 这个函数的主要功能是生成并发送一个ARP请求报文,以请求指定IP地址(即函数的输入```c const xipaddr_t * ipaddr```)的机器返回其MAC地址。函数的具体步骤如下: + 1. 分配一个用于发送的ARP数据包```c arp_packet```,并将其数据段设置为ARP报文结构。 + 2. 设置ARP报文的各个字段,包括硬件类型`hw_type`、协议类型`pro_type`、硬件地址长度`hw_len`、协议地址长度`pro_len`、操作码`opcode`(设置为`XARP_REQUEST`)等。 + 3. 复制发送方(即本项目模拟出的网卡)的MAC地址和IP地址到ARP报文中。 + 4. 将目标MAC地址字段清零,并复制目标IP地址到ARP报文中。 + 5. 最后,通过以太网发送该ARP请求报文,返回发送结果(状态码)。 +] +=== 启动时的ARP请求 +#para[ + 在以太网协议的初始化函数```c static xnet_err_t ethernet_init(void)```中添加一个ARP请求: + ```c + /** + * 以太网初始化 + * @return 初始化结果 + */ + static xnet_err_t ethernet_init (void) { + xnet_err_t err = xnet_driver_open(netif_mac); + if (err < 0) return err; + + return xarp_make_request(&netif_ipaddr); // 发送ARP请求 + } + ``` + 这样,当协议栈初始化时,会发送一个ARP请求。 + + 下面用Wireshark抓包来验证ARP请求是否发送成功。首先,重新编译项目;其次,开启Wireshark抓包;最后,启动程序: + #figure(image("启动ARP2.png",format: "png",width: 100%,fit: "stretch"),caption: "启动时的ARP请求") + 从@figure3 中可以看到,ARP请求发送成功,说明编写至此的代码没有问题。 +] +=== ARP报文接收函数 +#para[ + ARP报文接收函数主要功能是处理接收到的ARP报文,包括解析报文、更新ARP表、发送ARP响应等。下面,根据这些需求编写ARP报文接收函数```c void xarp_in(xnet_packet_t * packet)```: + ```c + /** + * 处理接收到的ARP包 + * @param packet 输入的ARP包 + */ + void xarp_in(xnet_packet_t * packet) { + // 检查包的大小是否符合ARP包的最小长度要求 + if (packet->size >= sizeof(xarp_packet_t)) { + xarp_packet_t * arp_packet = (xarp_packet_t *) packet->data; + uint16_t opcode = swap_order16(arp_packet->opcode); + + // 检查包的合法性,包括硬件类型、硬件地址长度、协议类型、协议地址长度和操作码 + if ((swap_order16(arp_packet->hw_type) != XARP_HW_ETHER) || + (arp_packet->hw_len != XNET_MAC_ADDR_SIZE) || + (swap_order16(arp_packet->pro_type) != XNET_PROTOCOL_IP) || + (arp_packet->pro_len != XNET_IPV4_ADDR_SIZE) + || ((opcode != XARP_REQUEST) && (opcode != XARP_REPLY))) { + return; + } + + // 只处理目标IP地址为自己的ARP请求或响应包 + if (!xipaddr_is_equal_buf(&netif_ipaddr, arp_packet->target_ip)) { + return; + } + + // 根据操作码进行处理 + switch (swap_order16(arp_packet->opcode)) { + case XARP_REQUEST: // 处理ARP请求,发送ARP响应并更新ARP表项 + xarp_make_response(arp_packet); + update_arp_entry(arp_packet->sender_ip, arp_packet->sender_mac); + break; + case XARP_REPLY: // 处理ARP响应,更新ARP表项 + update_arp_entry(arp_packet->sender_ip, arp_packet->sender_mac); + break; + } + } + } + ``` + 该函数主要功能是处理接收到的ARP包。首先进行简单的长度判断,避免后续字段读取失败造成内存错误。随后检查包的合法性,包括硬件类型、硬件地址长度、协议类型、协议地址长度和操作码。APR响应只要求机器处理目标IP地址为自己的ARP请求或响应包,所以使用```c if (!xipaddr_is_equal_buf(&netif_ipaddr, arp_packet->target_ip))```来判断。最后,根据操作码进行处理,分别处理ARP请求和ARP响应: + - ARP请求:发送ARP响应(```c xarp_make_response(...)```)并更新ARP表项(```c update_arp_entry(...)```); + - ARP响应:只需要更新ARP表项。 + + 其中,用到的宏```c xipaddr_is_equal_buf()```函数用于比较两个IP地址是否相等,实现如下: + ```c + // 比较IP地址是否相等 + #define xipaddr_is_equal_buf(addr, buf) (memcmp( + (addr)->array, + (buf), + XNET_IPV4_ADDR_SIZE + ) + == 0 + ) + ``` + 然后,需要编写上面函数中调用的两个函数:```c xarp_make_response()```和```c update_arp_entry()```。 + + ```c xarp_make_response()```函数主要功能是:输入一个ARP请求包,通过此包内的源信息,生成对应的ARP响应,并发送出去。具体代码如下: + ```c + /** + * 生成一个ARP响应 + * @param arp_packet 接收到的ARP请求包 + * @return 生成结果 + */ + xnet_err_t xarp_make_response(xarp_packet_t * arp_packet) { + xarp_packet_t* response_packet; + xnet_packet_t * packet = xnet_alloc_for_send(sizeof(xarp_packet_t)); + + response_packet = (xarp_packet_t *)packet->data; + response_packet->hw_type = swap_order16(XARP_HW_ETHER); // 设置硬件类型为以太网 + response_packet->pro_type = swap_order16(XNET_PROTOCOL_IP); // 设置协议类型为IP + response_packet->hw_len = XNET_MAC_ADDR_SIZE; // 设置硬件地址长度 + response_packet->pro_len = XNET_IPV4_ADDR_SIZE; // 设置协议地址长度 + response_packet->opcode = swap_order16(XARP_REPLY); // 设置操作码为ARP响应 + // 复制目标MAC地址 + memcpy(response_packet->target_mac, arp_packet->sender_mac, XNET_MAC_ADDR_SIZE); + // 复制目标IP地址 + memcpy(response_packet->target_ip, arp_packet->sender_ip, XNET_IPV4_ADDR_SIZE); + // 复制发送方MAC地址 + memcpy(response_packet->sender_mac, netif_mac, XNET_MAC_ADDR_SIZE); + // 复制发送方IP地址 + memcpy(response_packet->sender_ip, netif_ipaddr.array, XNET_IPV4_ADDR_SIZE); + // 通过以太网发送ARP响应 + return ethernet_out_to(XNET_PROTOCOL_ARP, ether_broadcast, packet); + } + ``` + 可以发现此函数与前面的ARP请求函数```c xarp_make_request()```非常相似,只是操作码不同,此处为`XARP_REPLY`,其他字段均从源ARP请求报文中获取,并填入对应区域。 + + ```c update_arp_entry()```函数主要功能是更新所有ARP表项,附带一定的可视化功能。具体代码如下: + ```c + /** + * 更新ARP表项 + * @param src_ip 源IP地址 + * @param mac_addr 对应的mac地址 + */ + static void update_arp_entry(uint8_t* src_ip, uint8_t* mac_addr) { + for (arp_entry = arp_table; + arp_entry < XARP_CFG_ENTRY_SIZE * sizeof(xarp_entry_t) + arp_table; + arp_entry = arp_entry + sizeof(xarp_entry_t)) + { + // 检查ARP表项是否为空或者是否与给定的源IP地址匹配且状态不是有效的 + if (arp_entry->state == XARP_ENTRY_FREE || + ( arp_entry->state == XARP_ENTRY_OK + && xipaddr_is_equal_buf(&arp_entry->ipaddr, src_ip) + )) + { + // 更新ARP表项中的IP地址和MAC地址 + memcpy(arp_entry->ipaddr.array, src_ip, XNET_IPV4_ADDR_SIZE); + memcpy(arp_entry->macaddr, mac_addr, 6); + printf("learned☝🤓mac addr:\n"); + for ( + int i = 0; + i < sizeof(mac_addr) / sizeof(mac_addr[0]); + ++i) + { + printf("%02X%c", + mac_addr[i], + i < sizeof(mac_addr) / sizeof(mac_addr[0]) - 1 ? ':' : '\n' + ); + } + // 设置ARP表项状态为有效 + arp_entry->state = XARP_ENTRY_OK; + // 设置ARP表项的超时时间 + arp_entry->tmo = XARP_CFG_ENTRY_OK_TMO; + // 设置ARP表项的重试次数 + arp_entry->retry_cnt = XARP_CFG_MAX_RETRIES; + print_arp_table(); // 打印完整的ARP表 + return; // 更新后退出函数 + } + } + + // 如果ARP表已满,采用LRU策略替换最老的表项 + arp_entry = arp_table; // 重置arp_entry指向表头 + xarp_entry_t* oldest_entry = NULL; + uint32_t oldest_tmo = 0xFFFFFFFF; + for (arp_entry = arp_table; + arp_entry < XARP_CFG_ENTRY_SIZE * sizeof(xarp_entry_t) + arp_table; + arp_entry = arp_entry + sizeof(xarp_entry_t)) + { + if (arp_entry->tmo < oldest_tmo) { + oldest_tmo = arp_entry->tmo; + oldest_entry = arp_entry; + } + } + if (oldest_entry != NULL) { + // 更新最老的ARP表项 + memcpy(oldest_entry->ipaddr.array, src_ip, XNET_IPV4_ADDR_SIZE); + memcpy(oldest_entry->macaddr, mac_addr, 6); + printf("learned☝🤓mac addr:\n"); + for (int i = 0; i < sizeof(mac_addr) / sizeof(mac_addr[0]); ++i){ + printf("%02X%c", mac_addr[i], + i < sizeof(mac_addr) / sizeof(mac_addr[0]) - 1 ? ':' : '\n'); + } + // 设置ARP表项状态为有效 + oldest_entry->state = XARP_ENTRY_OK; + // 设置ARP表项的超时时间 + oldest_entry->tmo = XARP_CFG_ENTRY_OK_TMO; + // 设置ARP表项的重试次数 + oldest_entry->retry_cnt = XARP_CFG_MAX_RETRIES; + print_arp_table(); // 打印完整的ARP表 + } + } + ``` + 这个函数很长。它主要功能是更新ARP表项。更新分为两种情况: + - ARP表还有空闲表项 + - ARP表已满,采用LRU策略替换最老的表项 + 首先,函数通过遍历ARP表中的所有表项,检查表项是否为空或者是否与给定的源IP地址匹配且状态不是有效的。如果满足条件,则更新ARP表项中的IP地址和MAC地址,并设置表项状态为有效,设置超时时间和重试次数(最后,会打印完整的ARP表)。如果ARP表已满,则采用LRU策略替换最老的表项。函数会遍历ARP表,找到超时时间最小的表项,并更新该表项的IP地址和MAC地址,设置表项状态为有效,设置超时时间和重试次数,最后打印完整的ARP表。 + + 用到的打印函数实现如下: + ```c + /** + * 打印完整的ARP表 + */ + void print_arp_table() { + printf("\n----ARP Table----\n"); + for (arp_entry = arp_table; + arp_entry < XARP_CFG_ENTRY_SIZE * sizeof(xarp_entry_t) + arp_table; + arp_entry = arp_entry + sizeof(xarp_entry_t)) + { + if (arp_entry->state != XARP_ENTRY_FREE) { + printf("IP: "); + for (int i = 0; i < XNET_IPV4_ADDR_SIZE; ++i) { + printf("%d%c", + arp_entry->ipaddr.array[i], + i < XNET_IPV4_ADDR_SIZE - 1 ? '.' : '\n' + ); + } + printf("MAC: "); + for (int i = 0; i < 6; ++i) { + printf("%02X%c", arp_entry->macaddr[i], i < 5 ? ':' : '\n'); + } + printf( + "State: %s\n", + arp_entry->state == XARP_ENTRY_FREE ? "FREE" : + arp_entry->state == XARP_ENTRY_RESOLVING ? "RESOLVING" : "OK" + ); + } + } + printf("\n-----------------\n"); + } + ``` + + 最后,需要在以太网帧接收函数中添加ARP报文的处理: + ```c + /** + * 以太网数据帧输入输出 + * @param packet 待处理的包 + */ + static void ethernet_in (xnet_packet_t * packet) { + // 至少要比头部数据大 + if (packet->size <= sizeof(xether_hdr_t)) { + return; + } + // 根据协议类型分发到不同的处理函数 + xether_hdr_t* hdr = (xether_hdr_t*)packet->data; + switch (swap_order16(hdr->protocol)) { + case XNET_PROTOCOL_ARP: + // 移除以太网头部,处理ARP协议 + remove_header(packet, sizeof(xether_hdr_t)); + xarp_in(packet); + break; + case XNET_PROTOCOL_IP: { + break; + } + } + } + ``` + 其中,主要在```c case XNET_PROTOCOL_ARP```中添加了对ARP报文的处理。 + + 在继续之前,再次使用Wireshark检验这部分代码编写。重新编译后,按照以下流程进行检验: + - 开启Wireshark抓包; + - 运行本程序; + - 在虚拟机上ping本程序,以触发ARP请求; + - 查看Wireshark抓包结果和程序输出。 + #figure(image("ARP响应.png",format: "png",width: 100%,fit: "stretch"),caption: "ARP请求响应") + 从@figure4 中可以看到,ARP响应都发送成功,程序输出中也表明学习到了虚拟机的MAC地址,说明代码编写正确。 +] +=== ARP超时重传 +#para[ + 首先,需要定义ARP表项的其他两种状态#footnote[第一种状态已经在@State1 中定义过了。]:解析成功、和正在解析(即已发出重传的ARP请求报文,但还未收到响应): + ```c + #define XARP_ENTRY_OK 1 // ARP表项解析成功 + #define XARP_ENTRY_RESOLVING 2 // ARP表项正在解析 + #define XARP_TIMER_PERIOD 1 // ARP扫描周期,1s足够 + ``` + 然后需要定义超时时间和重试次数: + ```c + #define XARP_CFG_ENTRY_OK_TMO (10) // ARP表项超时时间 + #define XARP_CFG_ENTRY_PENDING_TMO (2) // ARP表项挂起超时时间 + #define XARP_CFG_MAX_RETRIES 4 // ARP表挂起时重试查询次数 + ``` + 在`xnet_tiny.c`中,`xarp_poll`函数负责定期检查ARP表项的状态,并根据需要触发重传。具体实现如下: + ```c + /** + * 查询ARP表项是否超时,超时则重新请求 + */ + void xarp_poll(void) { + // 检查ARP定时器是否超时 + if (xnet_check_tmo(&arp_timer, XARP_TIMER_PERIOD)) { + for ( arp_entry = arp_table; + arp_entry < XARP_CFG_ENTRY_SIZE * sizeof(xarp_entry_t) + arp_table; + arp_entry = arp_entry + sizeof(xarp_entry_t)) + { + switch (arp_entry->state) { + case XARP_ENTRY_RESOLVING: + // 如果ARP表项正在解析中,检查超时计数器 + if (--arp_entry->tmo == 0) { + // 如果重试次数用完,释放ARP表项 + if (arp_entry->retry_cnt-- == 0) { + arp_entry->state = XARP_ENTRY_FREE; + } + else { + // 否则继续重试,发送ARP请求 + xarp_make_request(&arp_entry->ipaddr); + arp_entry->state = XARP_ENTRY_RESOLVING; + arp_entry->tmo = XARP_CFG_ENTRY_PENDING_TMO; + } + } + break; + case XARP_ENTRY_OK: + // 如果ARP表项有效,检查超时计数器 + if (--arp_entry->tmo == 0) { + // 超时后重新发送ARP请求 + xarp_make_request(&arp_entry->ipaddr); + arp_entry->state = XARP_ENTRY_RESOLVING; + arp_entry->tmo = XARP_CFG_ENTRY_PENDING_TMO; + } + break; + } + } + } + } + ``` + 该函数主要功能是定时检查ARP表项的状态,具体步骤如下: + 1. 定时检查:```c xarp_poll()```函数会定期检查ARP表项的状态,检查周期由`XARP_TIMER_PERIOD`定义(1秒)。 + 2. 状态判断: + - 如果表项状态为`XARP_ENTRY_RESOLVING`(正在解析中),则检查超时计数器。如果超时且重试次数用完,则释放该表项;否则,重新发送ARP请求并重置超时计数器。 + - 如果表项状态为`XARP_ENTRY_OK`(有效),则检查超时计数器。如果超时,则重新发送ARP请求并将表项状态设置为`XARP_ENTRY_RESOLVING`。 + 3. 重传ARP请求:通过调用`xarp_make_request`函数,重新发送ARP请求以获取目标IP地址对应的MAC地址。 + 下面是用Wireshark抓包验证ARP超时重传的结果。重新编译后,直接运行程序,在虚拟机上ping本程序,以触发ARP请求。本程序学习完成之后,每秒钟会发送一次ARP请求。Wireshark抓包结果如下: + #figure(image("十秒一个2.png",format: "png",width: 100%,fit: "stretch"),caption: "固定间隔的ARP超时重传") + 注意@figure5 中左侧的`Time`一列,从上到下程序发出的ARP请求的时间依次增加10秒。这表明,ARP请求每10秒钟发送一次,在上面代码中的这一行定义过的ARP表项超时时间生效,ARP请求重传成功。 + ```c + #define XARP_CFG_ENTRY_OK_TMO (10) // ARP表项超时时间 + ``` + 至此,ARP协议的实现完成。 +] +== 实现IP协议 +#para[ + 以太网之上,除了ARP协议,还有IP协议。IP协议是网络层协议,负责将数据包从源主机传输到目的主机。IP协议的数据包称为IP数据报,包含了源IP地址和目的IP地址。 + + 与前面通过抓包来获取ARP数据包的各字段值的方法类似,IP数据包各字段值也可以通过抓包获取,但更方便的做法是查询RFC文档#footnote[文档地址:#link("https://www.rfc-editor.org/rfc/rfc791")[RFC 791: Internet Protocol]]来获取,此处不再展示。下面来实现IP协议。 +] +=== 定义IP数据报 +#para[ + 在 `xnet_tiny.h` 中定义IP数据报的结构体: + + ```c + typedef struct _xip_hdr_t { + uint8_t hdr_len : 4; // 首部长, 4字节为单位 + uint8_t version : 4; // 版本号 + uint8_t tos; // 服务类型 + uint16_t total_len; // 总长度 + uint16_t id; // 标识符 + uint16_t flags_fragment; // 标志与分段 + uint8_t ttl; // 存活时间 + uint8_t protocol; // 上层协议 + uint16_t hdr_checksum; // 首部校验和 + uint8_t src_ip[XNET_IPV4_ADDR_SIZE]; // 源IP + uint8_t dest_ip[XNET_IPV4_ADDR_SIZE]; // 目标IP + } xip_hdr_t; + ``` + + 该结构体定义了IP数据报的各个字段,包括: + - `hdr_len`:IP头部的长度,以4字节为单位。 + - `version`:IP版本号,通常为IPv4(值为4)。 + - `tos`:服务类型,用于指定数据报的优先级。 + - `total_len`:IP数据报的总长度。 + - `id`:标识符,用于标识IP数据报。 + - `flags_fragment`:标志和分段信息,用于IP分片。 + - `ttl`:生存时间,用于防止数据报在网络中无限循环。 + - `protocol`:上层协议类型,如ICMP、TCP或UDP。 + - `hdr_checksum`:IP头部的校验和,用于检测数据报是否损坏。 + - `src_ip` 和 `dest_ip`:源IP地址和目标IP地址。 + +] +=== 实现IP输入 +#para[ + IP输入函数 `xip_in` 负责处理接收到的IP数据报。在 `xnet_tiny.c` 中实现该函数: + + ```c + void xip_in(xnet_packet_t * packet) { + xip_hdr_t* iphdr = (xip_hdr_t*)packet->data; + uint32_t total_size, header_size; + uint16_t pre_checksum; + xipaddr_t src_ip; + + // 检查IP版本号是否为IPv4 + if (iphdr->version != XNET_VERSION_IPV4) { + return; + } + + // 检查头部长度和总长度是否符合要求 + header_size = iphdr->hdr_len * 4; + total_size = swap_order16(iphdr->total_len); + if ( + (header_size < sizeof(xip_hdr_t)) + || ((total_size < header_size) + || (packet->size < total_size)) + ) + return; + + + // 校验头部的校验和是否正确 + pre_checksum = iphdr->hdr_checksum; + iphdr->hdr_checksum = 0; + if (pre_checksum != checksum16((uint16_t*)iphdr, header_size, 0, 1)) { + return; + } + + // 检查目标IP地址是否为本机IP + if (!xipaddr_is_equal_buf(&netif_ipaddr, iphdr->dest_ip)) { + return; + } + + // 根据协议类型分发到不同的处理函数 + xipaddr_from_buf(&src_ip, iphdr->src_ip); + switch(iphdr->protocol) { + case XNET_PROTOCOL_ICMP: + remove_header(packet, header_size); + xicmp_in(&src_ip, packet); + break; + default: + break; + } + } + ``` + 函数逻辑、功能比较简单,概括如下:检查IP版本号是否为IPv4。然后验证IP头部的长度和总长度是否符合要求。再校验IP头部的校验和是否正确、检查目标IP地址是否为本机IP。最后根据上层协议类型(如ICMP),将数据报分发到相应的处理函数。 + +] +=== 实现IP输出 +#para[ + IP输出函数 `xip_out` 负责发送IP数据报。在 `xnet_tiny.c` 中,我们实现了该函数: + +```c +xnet_err_t xip_out(xnet_protocol_t protocol, xipaddr_t* dest_ip, xnet_packet_t * packet) +{ + static uint32_t ip_packet_id = 0; // 静态变量,用于生成唯一的IP包ID + xip_hdr_t * iphdr; + + add_header(packet, sizeof(xip_hdr_t)); // 添加IP头部 + iphdr = (xip_hdr_t*)packet->data; // 获取IP头部指针 + iphdr->version = XNET_VERSION_IPV4; // 设置IP版本号为IPv4 + iphdr->hdr_len = sizeof(xip_hdr_t) / 4; // 设置IP头部长度 + iphdr->tos = 0; // 设置服务类型 + iphdr->total_len = swap_order16(packet->size); // 设置总长度 + iphdr->id = swap_order16(ip_packet_id); // 设置包ID + iphdr->flags_fragment = 0; // 设置标志和片偏移 + iphdr->ttl = XNET_IP_DEFAULT_TTL; // 设置生存时间 + iphdr->protocol = protocol; // 设置上层协议类型 + memcpy(iphdr->dest_ip, dest_ip->array, XNET_IPV4_ADDR_SIZE); // 设置目标IP地址 + // 设置源IP地址 + memcpy(iphdr->src_ip, netif_ipaddr.array, XNET_IPV4_ADDR_SIZE); + iphdr->hdr_checksum = 0; // 初始化校验和字段 + // 计算并设置校验和 + iphdr->hdr_checksum = checksum16((uint16_t *)iphdr, sizeof(xip_hdr_t), 0, 1); + + ip_packet_id++; // 增加包ID + return ethernet_out(dest_ip, packet); // 通过以太网发送IP包 +} +``` + + 该函数的主要功能是: + 1. 添加IP头部到数据报中。 + 2. 设置IP头部的各个字段,包括版本号、头部长度、总长度、包ID、生存时间、上层协议类型、源IP地址和目标IP地址。 + 3. 计算并设置IP头部的校验和。 + 4. 通过以太网发送IP数据报。 +] +== 实现ICMP协议 +#para[ + 实现了ARP和IP协议之后,下面来实现ICMP协议。ICMP协议是网络层协议,用于在IP网络中传递控制消息。ICMP数据报的数据部分包含了ICMP报文的类型、代码和校验和等字段。实现ICMP的主要目的在于实现ping功能,即实现ICMP的ping响应。 +] +=== 定义ICMP数据报 +#para[ + ICMP(Internet Control Message Protocol)是网络层协议,用于在IP网络中传递控制消息。在 `xnet_tiny.h` 中,我们定义了ICMP数据报的结构体: + + + ```c + typedef struct _xicmp_hdr_t { + uint8_t type; // 类型 + uint8_t code; // 代码 + uint16_t checksum; // ICMP报文的校验和 + uint16_t id; // 标识符 + uint16_t seq; // 序号 + } xicmp_hdr_t; + ``` + + + 该结构体定义了ICMP数据报的各个字段,包括: + - `type`:ICMP消息类型,例如回显请求(`8`)和回显响应(`0`)。 + - `code`:ICMP消息代码,用于进一步细分消息类型。 + - `checksum`:ICMP报文的校验和,用于检测报文是否损坏。 + - `id` 和 `seq`:标识符和序号,用于匹配请求和响应。 + + 此外,我们还定义了ICMP消息类型的常量: + + ```c + #define XICMP_CODE_ECHO_REQUEST 8 // 回显请求 + #define XICMP_CODE_ECHO_REPLY 0 // 回显响应 + ``` + +] + +=== 实现ICMP输入 +#para[ + ICMP输入函数 `xicmp_in` 负责处理接收到的ICMP数据报。在 `xnet_tiny.c` 中,我们实现了该函数: + + + ```c + void xicmp_in(xipaddr_t *src_ip, xnet_packet_t * packet) { + xicmp_hdr_t* icmphdr = (xicmp_hdr_t *)packet->data; // 获取ICMP头部指针 + if ( + (packet->size >= sizeof(xicmp_hdr_t)) + && (icmphdr->type == XICMP_CODE_ECHO_REQUEST) + ) + { + reply_icmp_request(icmphdr, src_ip, packet); // 如果是ECHO请求,发送ECHO回复 + } + } + ``` + + + 该函数的主要功能是: + 1. 检查接收到的ICMP数据报是否完整。 + 2. 如果ICMP消息类型为回显请求(`XICMP_CODE_ECHO_REQUEST`),则调用 `reply_icmp_request` 函数发送回显响应。 +] + +=== 实现ICMP-ping响应 +#para[ + ICMP-ping响应函数 `reply_icmp_request` 负责生成并发送ICMP回显响应。在 `xnet_tiny.c` 中,我们实现了该函数: + + ```c + static xnet_err_t reply_icmp_request( xicmp_hdr_t * icmp_hdr, + xipaddr_t* src_ip, + xnet_packet_t * packet) + { + xicmp_hdr_t * replay_hdr; + xnet_packet_t * tx = xnet_alloc_for_send(packet->size); + + replay_hdr = (xicmp_hdr_t *)tx->data; // 获取ICMP头部指针 + replay_hdr->type = XICMP_CODE_ECHO_REPLY; // 设置ICMP类型为ECHO回复 + replay_hdr->code = 0; // 设置代码为0 + replay_hdr->id = icmp_hdr->id; // 复制ID + replay_hdr->seq = icmp_hdr->seq; // 复制序列号 + replay_hdr->checksum = 0; // 初始化校验和字段 + // 复制数据部分 + memcpy( + ((uint8_t *)replay_hdr)+ sizeof(xicmp_hdr_t), + ((uint8_t *)icmp_hdr) + sizeof(xicmp_hdr_t), + packet->size - sizeof(xicmp_hdr_t) + ); + // 计算校验和 + replay_hdr->checksum = checksum16((uint16_t*)replay_hdr, tx->size, 0, 1); + return xip_out(XNET_PROTOCOL_ICMP, src_ip, tx); // 发送ICMP回复包 + } + ``` + + 该函数的主要功能是: + 1. 分配一个新的数据包用于发送ICMP回显响应。 + 2. 设置ICMP回显响应的各个字段,包括类型、代码、ID、序列号和校验和。 + 3. 复制原始ICMP请求的数据部分到响应中。 + 4. 计算并设置ICMP回显响应的校验和。 + 5. 通过IP层发送ICMP回显响应。 + + 通过该函数,我们可以实现对ICMP-ping请求的响应,从而支持基本的网络连通性测试。 + + 下面进行测试。重新编译后,按照以下流程进行测试: + - 开启Wireshark抓包; + - 运行本程序; + - 在虚拟机上ping本程序,以触发ICMP-ping请求; + - 在虚拟机上查看ping结果,看是否ping通; + - 查看Wireshark抓包结果(见下页)。 + #figure(image("ping通.png",format: "png",width: 100%,fit: "stretch"),caption: "ICMP-ping响应") + 从@figure6 中可以看到,ICMP-ping响应发送成功,程序输出中也表明学习到了虚拟机的MAC地址,说明代码编写正确。 +] +== 关于多ARP表项 +#para[ + 代码在定义相关数据结构时(见@multiple_entry ),已经考虑到了多ARP表项的情况。在函数的具体实现中,均是使用循环遍历整个ARP表来进行表项的操作。 + + 在@figure4、@figure6 中的程序输出中,均有2个表项(对同一个ARP表项的不同状态)。如果考虑再添加一台虚拟机,则可以在输出中看到更多表项。但本次实验所用物理机内存有限,无法同时运行2个虚拟机,所以不再演示。 +] += 实验总结 +== 内容总结 +#para[ + 本次实验主要围绕ARP协议的实现展开,通过编写程序完善了TCP/IP协议栈的ARP协议部分。实验内容包括ARP的初始化、无回报ARP的生成、ARP的输入处理以及ARP的超时重新请求机制。在基础任务中,成功实现了ARP协议的核心功能,包括ARP请求与响应的构建与解析、ARP缓存表的管理等。此外,还完成了拓展任务,实现了多个ARP表项的管理以及IP层的输入输出处理。 + + 在实验过程中,首先通过Wireshark抓包分析了ARP报文的结构,并基于此定义了ARP报文的数据结构和相关函数。接着,实现了ARP报文的发送与接收功能,包括ARP请求的生成与广播、ARP响应的处理以及ARP缓存表的更新。通过定时器机制,实现了ARP表项的超时重传功能,确保了ARP缓存的准确性和及时性。 + + 在完成ARP协议的基础上,进一步实现了IP协议和ICMP协议。通过定义IP数据报和ICMP数据报的结构,实现了IP层的输入输出功能,并成功实现了ICMP的ping响应功能。实验结果表明,ARP、IP和ICMP协议的功能均得到了正确实现,能够有效支持网络设备之间的通信。 +] +== 心得感悟 +#para[ + 通过本次实验,我深刻理解了ARP协议的工作原理及其在网络通信中的重要作用。ARP协议作为TCP/IP协议栈中的重要组成部分,负责将IP地址解析为MAC地址,是网络设备之间通信的基础。通过亲手实现ARP协议的核心功能,我不仅加深了对ARP协议的理解,还掌握了网络协议栈的实现方法。 + + 在实验过程中,我遇到了一些挑战,例如如何正确解析ARP报文、如何管理ARP缓存表以及如何处理ARP超时重传等。通过查阅资料、分析抓包数据以及反复调试代码,我逐步解决了这些问题,并成功实现了ARP协议的功能。这让我认识到,网络协议的实现不仅需要扎实的理论基础,还需要细致的调试和问题解决能力。 + + 此外,通过实现IP和ICMP协议,我进一步了解了网络层协议的工作原理。IP协议负责数据包的传输,而ICMP协议则用于传递控制消息。通过实现ICMP的ping响应功能,我掌握了ICMP协议的基本实现方法,并理解了其在网络连通性测试中的应用。 + + 总的来说,本次实验让我对TCP/IP协议栈有了更深入的理解,并提升了我的编程能力和网络协议分析能力。这些知识和技能对我今后学习更复杂的网络协议以及从事网络相关工作具有重要意义。 +] +#show heading: it => box(width: 100%)[ + #v(0.50em) + #set text(font: hei) + // #counter(heading).display() + // #h(0.5em) + #it.body +] +#pagebreak() +#bibliography("ref.yml",full: true,title: "参考文献",style:"gb-7714-2015-numeric") + + +/* +根据这个网站的格式示范https://github.com/typst/hayagriva/blob/main/docs/file-format.md +为这个网页生成.yml文件 +https://blog.csdn.net/jxjdhdnd/article/details/138009187 +*/ \ No newline at end of file diff --git a/network/arp/ping通.png b/network/arp/ping通.png new file mode 100755 index 0000000..8e1aff5 Binary files /dev/null and b/network/arp/ping通.png differ diff --git a/network/arp/ref.yml b/network/arp/ref.yml new file mode 100755 index 0000000..07a4b20 --- /dev/null +++ b/network/arp/ref.yml @@ -0,0 +1,44 @@ +cmake_tutorial_csdn: + type: Web + title: "【一学就会】(一)C++编译工具链——基于VSCode的CMake、make与g++简单理解与应用示例" + author: "未知作者" + url: + value: "https://blog.csdn.net/weixin_46248871/article/details/137500744" + date: 2024-12-31 + abstract: "本文详细介绍了CMake、make与g++的基本概念、优劣比较以及应用示例,包括工具安装配置、CMake使用示例、g++使用教程等。" + +cmake_detailed_tutorial_csdn: + type: Web + title: "cmake使用详细教程(日常使用这一篇就足够了)" + author: "李吱恩" + url: + value: "https://blog.csdn.net/iuu77/article/details/129229361" + date: 2023-11-28 + abstract: "本文为博主原创文章,提供了cmake的详细使用教程,包括cmake安装、使用cmake配合程序编译的多种情况,如单个源文件程序编译、多个源文件、头文件在不同文件夹等场景。" + +rfc791_internet_protocol: + type: Web + title: "INTERNET PROTOCOL" + author: "Jon Postel" + url: + value: "https://www.rfc-editor.org/rfc/rfc791" + date: 1981-09 + abstract: "RFC 791 定义了互联网协议(IP),这是TCP/IP协议栈中的核心协议之一,负责在网络中传输数据包。文档详细介绍了IP协议的规范和操作。" + +windows_network_commands_cnblogs: + type: Web + title: "windows网络命令:ping、ipconfig、tracert、netstat、arp" + author: "刘玉坦" + url: + value: "https://www.cnblogs.com/liuyutan/p/13289747.html" + date: 2024-12-31 + abstract: "本文介绍了Windows系统中常用的网络诊断命令,包括ping、ipconfig、tracert、netstat和arp,以及它们的使用场景和参数说明。" + +bilibili_tcp_ip_stack: + type: Web + title: "c03.00 IP层的输入处理(2)" + author: "哔哩哔哩用户" + url: + value: "https://www.bilibili.com/video/BV1KL4y1P7vG" + date: 2024-12-31 + abstract: "视频教程,完全从0开始手写一个超轻量级的TCP/IP网络协议栈,支持以太网、ARP、IP、UDP、TCP协议,并实现了一个超小型的HTTP服务器。" \ No newline at end of file diff --git a/network/arp/tmp.md b/network/arp/tmp.md new file mode 100755 index 0000000..67d9503 --- /dev/null +++ b/network/arp/tmp.md @@ -0,0 +1,397 @@ +### ARP超时重传 + +在ARP协议中,如果某个ARP表项在一定时间内没有收到响应,或者表项的状态变为无效,系统会触发ARP超时重传机制。这一机制确保在网络中能够及时更新或重新获取目标设备的MAC地址。 + +#### 超时重传的实现 + +在`xnet_tiny.c`中,`xarp_poll`函数负责定期检查ARP表项的状态,并根据需要触发重传。具体实现如下: + +```c +/ + * 查询ARP表项是否超时,超时则重新请求 + */ +void xarp_poll(void) { + // 检查ARP定时器是否超时 + if (xnet_check_tmo(&arp_timer, XARP_TIMER_PERIOD)) { + for (arp_entry = arp_table; arp_entry < XARP_CFG_ENTRY_SIZE * sizeof(xarp_entry_t) + arp_table; arp_entry = arp_entry + sizeof(xarp_entry_t)) { + switch (arp_entry->state) { + case XARP_ENTRY_RESOLVING: + // 如果ARP表项正在解析中,检查超时计数器 + if (--arp_entry->tmo == 0) { + // 如果重试次数用完,释放ARP表项 + if (arp_entry->retry_cnt-- == 0) { + arp_entry->state = XARP_ENTRY_FREE; + } + else { + // 否则继续重试,发送ARP请求 + xarp_make_request(&arp_entry->ipaddr); + arp_entry->state = XARP_ENTRY_RESOLVING; + arp_entry->tmo = XARP_CFG_ENTRY_PENDING_TMO; + } + } + break; + case XARP_ENTRY_OK: + // 如果ARP表项有效,检查超时计数器 + if (--arp_entry->tmo == 0) { + // 超时后重新发送ARP请求 + xarp_make_request(&arp_entry->ipaddr); + arp_entry->state = XARP_ENTRY_RESOLVING; + arp_entry->tmo = XARP_CFG_ENTRY_PENDING_TMO; + } + break; + } + } + } +} +``` + +#### 超时重传的流程 + +1. 定时检查:`xarp_poll`函数会定期检查ARP表项的状态,检查周期由`XARP_TIMER_PERIOD`定义(默认为1秒)。 +2. 状态判断: + - 如果表项状态为`XARP_ENTRY_RESOLVING`(正在解析中),则检查超时计数器。如果超时且重试次数用完,则释放该表项;否则,重新发送ARP请求并重置超时计数器。 + - 如果表项状态为`XARP_ENTRY_OK`(有效),则检查超时计数器。如果超时,则重新发送ARP请求并将表项状态设置为`XARP_ENTRY_RESOLVING`。 +3. 重传ARP请求:通过调用`xarp_make_request`函数,重新发送ARP请求以获取目标IP地址对应的MAC地址。 + +#### 超时重传的意义 + +ARP超时重传机制确保了在网络中即使某些设备暂时不可达,系统也能通过多次尝试获取其MAC地址。这种机制在网络环境不稳定或设备频繁上下线的情况下尤为重要,能够有效避免因ARP表项失效导致的通信中断。 + +#### 实验验证 + +为了验证ARP超时重传机制的正确性,可以通过以下步骤进行测试: + +1. 启动程序:运行程序并确保ARP表项初始化完成。 +2. 模拟超时:在ARP表项超时后,观察是否触发了重传机制。 +3. 抓包分析:使用Wireshark抓包工具,查看是否在超时后重新发送了ARP请求。 + +通过以上步骤,可以验证ARP超时重传机制是否按预期工作。 + +```typ +#figure(image("ARP超时重传.png",format: "png",width: 100%,fit: "stretch"),caption: "ARP超时重传抓包结果") +``` + +从@figure5 中可以看到,ARP请求在超时后重新发送,说明超时重传机制工作正常。 + + + + +以下是 `=== 定义IP数据报`、`=== 实现IP输入` 和 `=== 实现IP输出` 部分的 Markdown 内容: + +```markdown +=== 定义IP数据报 +IP数据报是网络层协议的核心数据结构,包含了源IP地址、目标IP地址以及上层协议类型等信息。在 `xnet_tiny.h` 中,我们定义了IP数据报的结构体: + +```c +typedef struct _xip_hdr_t { + uint8_t hdr_len : 4; // 首部长, 4字节为单位 + uint8_t version : 4; // 版本号 + uint8_t tos; // 服务类型 + uint16_t total_len; // 总长度 + uint16_t id; // 标识符 + uint16_t flags_fragment; // 标志与分段 + uint8_t ttl; // 存活时间 + uint8_t protocol; // 上层协议 + uint16_t hdr_checksum; // 首部校验和 + uint8_t src_ip[XNET_IPV4_ADDR_SIZE]; // 源IP + uint8_t dest_ip[XNET_IPV4_ADDR_SIZE]; // 目标IP +} xip_hdr_t; +``` + +该结构体定义了IP数据报的各个字段,包括: +- `hdr_len`:IP头部的长度,以4字节为单位。 +- `version`:IP版本号,通常为IPv4(值为4)。 +- `tos`:服务类型,用于指定数据报的优先级。 +- `total_len`:IP数据报的总长度。 +- `id`:标识符,用于标识IP数据报。 +- `flags_fragment`:标志和分段信息,用于IP分片。 +- `ttl`:生存时间,用于防止数据报在网络中无限循环。 +- `protocol`:上层协议类型,如ICMP、TCP或UDP。 +- `hdr_checksum`:IP头部的校验和,用于检测数据报是否损坏。 +- `src_ip` 和 `dest_ip`:源IP地址和目标IP地址。 + +=== 实现IP输入 +IP输入函数 `xip_in` 负责处理接收到的IP数据报。在 `xnet_tiny.c` 中,我们实现了该函数: + +```c +void xip_in(xnet_packet_t * packet) { + xip_hdr_t* iphdr = (xip_hdr_t*)packet->data; + uint32_t total_size, header_size; + uint16_t pre_checksum; + xipaddr_t src_ip; + + // 检查IP版本号是否为IPv4 + if (iphdr->version != XNET_VERSION_IPV4) { + return; + } + + // 检查头部长度和总长度是否符合要求 + header_size = iphdr->hdr_len * 4; + total_size = swap_order16(iphdr->total_len); + if ((header_size < sizeof(xip_hdr_t)) || ((total_size < header_size) || (packet->size < total_size))) { + return; + } + + // 校验头部的校验和是否正确 + pre_checksum = iphdr->hdr_checksum; + iphdr->hdr_checksum = 0; + if (pre_checksum != checksum16((uint16_t*)iphdr, header_size, 0, 1)) { + return; + } + + // 检查目标IP地址是否为本机IP + if (!xipaddr_is_equal_buf(&netif_ipaddr, iphdr->dest_ip)) { + return; + } + + // 根据协议类型分发到不同的处理函数 + xipaddr_from_buf(&src_ip, iphdr->src_ip); + switch(iphdr->protocol) { + case XNET_PROTOCOL_ICMP: + remove_header(packet, header_size); + xicmp_in(&src_ip, packet); + break; + default: + break; + } +} +``` + +该函数的主要功能是: +1. 检查IP版本号是否为IPv4。 +2. 检查IP头部的长度和总长度是否符合要求。 +3. 校验IP头部的校验和是否正确。 +4. 检查目标IP地址是否为本机IP。 +5. 根据上层协议类型(如ICMP)将数据报分发到相应的处理函数。 + +=== 实现IP输出 +IP输出函数 `xip_out` 负责发送IP数据报。在 `xnet_tiny.c` 中,我们实现了该函数: + +```c +xnet_err_t xip_out(xnet_protocol_t protocol, xipaddr_t* dest_ip, xnet_packet_t * packet) { + static uint32_t ip_packet_id = 0; // 静态变量,用于生成唯一的IP包ID + xip_hdr_t * iphdr; + + add_header(packet, sizeof(xip_hdr_t)); // 添加IP头部 + iphdr = (xip_hdr_t*)packet->data; // 获取IP头部指针 + iphdr->version = XNET_VERSION_IPV4; // 设置IP版本号为IPv4 + iphdr->hdr_len = sizeof(xip_hdr_t) / 4; // 设置IP头部长度 + iphdr->tos = 0; // 设置服务类型 + iphdr->total_len = swap_order16(packet->size); // 设置总长度 + iphdr->id = swap_order16(ip_packet_id); // 设置包ID + iphdr->flags_fragment = 0; // 设置标志和片偏移 + iphdr->ttl = XNET_IP_DEFAULT_TTL; // 设置生存时间 + iphdr->protocol = protocol; // 设置上层协议类型 + memcpy(iphdr->dest_ip, dest_ip->array, XNET_IPV4_ADDR_SIZE); // 设置目标IP地址 + memcpy(iphdr->src_ip, netif_ipaddr.array, XNET_IPV4_ADDR_SIZE); // 设置源IP地址 + iphdr->hdr_checksum = 0; // 初始化校验和字段 + iphdr->hdr_checksum = checksum16((uint16_t *)iphdr, sizeof(xip_hdr_t), 0, 1); // 计算并设置校验和 + + ip_packet_id++; // 增加包ID + return ethernet_out(dest_ip, packet); // 通过以太网发送IP包 +} +``` + +该函数的主要功能是: +1. 添加IP头部到数据报中。 +2. 设置IP头部的各个字段,包括版本号、头部长度、总长度、包ID、生存时间、上层协议类型、源IP地址和目标IP地址。 +3. 计算并设置IP头部的校验和。 +4. 通过以太网发送IP数据报。 +``` + +### 说明: +1. 代码块:使用 ```c 插入代码块,并指定语言为 C。 +2. 标题:使用 `===` 表示三级标题。 +3. 段落:直接编写文本内容,Markdown 会自动处理段落格式。 + +将此内容插入到 `main.txt` 文件的适当位置即可。 + + + + + + + +以下是 `=== 定义ICMP数据报`、`=== 实现ICMP输入` 和 `=== 实现ICMP-ping响应` 部分的 Typst 代码: + +```typ +=== 定义ICMP数据报 +#para[ + ICMP(Internet Control Message Protocol)是网络层协议,用于在IP网络中传递控制消息。在 `xnet_tiny.h` 中,我们定义了ICMP数据报的结构体: + + #raw(block: true, lang: "c")[ + ```c + typedef struct _xicmp_hdr_t { + uint8_t type; // 类型 + uint8_t code; // 代码 + uint16_t checksum; // ICMP报文的校验和 + uint16_t id; // 标识符 + uint16_t seq; // 序号 + } xicmp_hdr_t; + ``` + ] + + 该结构体定义了ICMP数据报的各个字段,包括: + - `type`:ICMP消息类型,例如回显请求(`8`)和回显响应(`0`)。 + - `code`:ICMP消息代码,用于进一步细分消息类型。 + - `checksum`:ICMP报文的校验和,用于检测报文是否损坏。 + - `id` 和 `seq`:标识符和序号,用于匹配请求和响应。 + + 此外,我们还定义了ICMP消息类型的常量: + #raw(block: true, lang: "c")[ + ```c + #define XICMP_CODE_ECHO_REQUEST 8 // 回显请求 + #define XICMP_CODE_ECHO_REPLY 0 // 回显响应 + ``` + ] +] + +=== 实现ICMP输入 +#para[ + ICMP输入函数 `xicmp_in` 负责处理接收到的ICMP数据报。在 `xnet_tiny.c` 中,我们实现了该函数: + + #raw(block: true, lang: "c")[ + ```c + void xicmp_in(xipaddr_t *src_ip, xnet_packet_t * packet) { + xicmp_hdr_t* icmphdr = (xicmp_hdr_t *)packet->data; // 获取ICMP头部指针 + + if ((packet->size >= sizeof(xicmp_hdr_t)) && (icmphdr->type == XICMP_CODE_ECHO_REQUEST)) { + reply_icmp_request(icmphdr, src_ip, packet); // 如果是ECHO请求,发送ECHO回复 + } + } + ``` + ] + + 该函数的主要功能是: + 1. 检查接收到的ICMP数据报是否完整。 + 2. 如果ICMP消息类型为回显请求(`XICMP_CODE_ECHO_REQUEST`),则调用 `reply_icmp_request` 函数发送回显响应。 +] + +=== 实现ICMP-ping响应 +#para[ + ICMP-ping响应函数 `reply_icmp_request` 负责生成并发送ICMP回显响应。在 `xnet_tiny.c` 中,我们实现了该函数: + + #raw(block: true, lang: "c")[ + ```c + static xnet_err_t reply_icmp_request(xicmp_hdr_t * icmp_hdr, xipaddr_t* src_ip, xnet_packet_t * packet) { + xicmp_hdr_t * replay_hdr; + xnet_packet_t * tx = xnet_alloc_for_send(packet->size); + + replay_hdr = (xicmp_hdr_t *)tx->data; // 获取ICMP头部指针 + replay_hdr->type = XICMP_CODE_ECHO_REPLY; // 设置ICMP类型为ECHO回复 + replay_hdr->code = 0; // 设置代码为0 + replay_hdr->id = icmp_hdr->id; // 复制ID + replay_hdr->seq = icmp_hdr->seq; // 复制序列号 + replay_hdr->checksum = 0; // 初始化校验和字段 + memcpy(((uint8_t *)replay_hdr) + sizeof(xicmp_hdr_t), ((uint8_t *)icmp_hdr) + sizeof(xicmp_hdr_t), + packet->size - sizeof(xicmp_hdr_t)); // 复制数据部分 + replay_hdr->checksum = checksum16((uint16_t*)replay_hdr, tx->size, 0, 1); // 计算校验和 + return xip_out(XNET_PROTOCOL_ICMP, src_ip, tx); // 发送ICMP回复包 + } + ``` + ] + + 该函数的主要功能是: + 1. 分配一个新的数据包用于发送ICMP回显响应。 + 2. 设置ICMP回显响应的各个字段,包括类型、代码、ID、序列号和校验和。 + 3. 复制原始ICMP请求的数据部分到响应中。 + 4. 计算并设置ICMP回显响应的校验和。 + 5. 通过IP层发送ICMP回显响应。 + + 通过该函数,我们可以实现对ICMP-ping请求的响应,从而支持基本的网络连通性测试。 +] +``` + +### 说明: +1. 代码块:使用 `#raw(block: true, lang: "c")` 插入代码块,并指定语言为 C。 +2. 标题:使用 `===` 表示三级标题。 +3. 段落:使用 `#para[]` 包裹段落内容。 + +将此代码插入到 `main.txt` 文件的适当位置即可。 + + + + +6 实验原理及方案 + +ARP(地址解析协议)是 TCP/IP 协议族中用于将 IP 地址解析为 MAC 地址的重要协议。IP 通信依赖于数据链路层的硬件地址(MAC 地址),而 ARP 负责动态地将网络层的 IP 地址转换为对应的数据链路层 MAC 地址,从而实现设备间的通信。ARP 协议的实现主要包括发送 ARP 请求、接收并处理 ARP 响应、更新 ARP 缓存、以及缓存超时机制。 + +本次实验围绕 TCP/IP 协议栈的 ARP 协议的实现这一问题展开,要求学员在理解 ARP 协议原理的基础上,深入探究 ARP 的技术细节,动手实现 ARP 协议的 Python 程序。 + +### 1)ARP 的初始化 + +在一个典型的局域网中,设备通过 IP 地址进行网络层通信,但 IP 地址并不能直接用于数据链路层传输。以太网等数据链路层协议使用 MAC 地址进行通信,因此,发送设备需要将目标 IP 地址解析为 MAC 地址才能发送数据帧。 + +如果该设备的 ARP 缓存中没有目标设备的 MAC 地址映射,它会广播 ARP 请求,询问网络上哪个设备持有特定的 IP 地址。ARP 请求是一个以太网层的广播包,发送到子网内所有设备,只有持有目标 IP 地址的设备才会进行响应。 + +ARP 初始化的过程是设备发现并解析网络中其他设备的关键步骤。ARP 请求包含源设备的 IP 地址和 MAC 地址,而目标设备通过 ARP 响应提供其对应的 MAC 地址。这个机制确保设备能够通过网络层(IP 地址)和链路层(MAC 地址)之间建立正确的映射关系。 + +### 2)无回报 ARP 的生成 + +无回报 ARP(Gratuitous ARP),又称为“主动 ARP”或“自愿 ARP”,是一种特殊的 ARP 操作。与典型的 ARP 请求不同,无回报 ARP 并不是为了解析目标设备的 MAC 地址,而是设备主动向网络发送广播 ARP 包,通常用于更新网络中的 IP-MAC 映射关系、检测 IP 地址冲突等。 + +无回报 ARP 是设备主动广播自身的 IP 地址和 MAC 地址,不带有显式的 ARP 请求和响应互动。其主要目的是通知网络中其他设备更新其 ARP 缓存表中的信息。这种情况下,设备并不期待其他设备回应。它是单向广播的,通常被用于下列几种情况: + +- 更新网络中的 ARP 表:当设备的 MAC 地址或 IP 地址发生变动时,可以主动发送无回报 ARP,以便通知网络中其他设备更新其 ARP 缓存。 +- IP 冲突检测:设备在启动时,通过发送无回报 ARP 来检测是否有其他设备占用了相同的 IP 地址。如果另一台设备使用了相同的 IP 地址,它会回应此 ARP 广播,从而帮助设备检测到 IP 冲突。 +- 负载均衡器和高可用性系统:当系统切换主备设备时,备设备通常会发送无回报 ARP 来通知网络中的所有节点其 IP-MAC 映射已经改变,避免继续向已下线的设备发送数据。 + +无回报 ARP 的生成过程如下: + +1. 生成 ARP 广播包:设备在确定需要广播自身 IP-MAC 映射时,会生成一个 ARP 广播包。该包包含设备自身的 IP 地址和 MAC 地址,并且目标硬件地址设置为全 0,因为无回报 ARP 并不是请求对方设备的 MAC 地址,而是向网络中的所有设备广播自身的信息。 +2. 设置操作码为 ARP 请求:尽管无回报 ARP 是主动广播,但它在帧结构中被标记为 ARP 请求(操作码为 1),这使得网络中的其他设备会将其视为一种信息广播,用于更新 ARP 缓存。 +3. 发送广播:ARP 广播包通过以太网层进行传输,目标 MAC 地址为 FF:FF:FF:FF:FF:FF,即局域网内的所有设备都可以接收到此广播。 +4. 网络中的设备处理:网络中所有收到此广播的设备会检查 ARP 包中的发送方 IP 地址和 MAC 地址,并将其更新到本地的 ARP 缓存表中。这样,即使该 IP 地址之前未出现在这些设备的 ARP 表中,它们也会记录并更新新的映射。 + +### 3)ARP 的输入处理 + +ARP(地址解析协议)的输入处理指的是设备在接收到 ARP 请求或响应时,如何对该 ARP 报文进行解析和处理,并据此更新设备的 ARP 缓存,或进一步采取必要的网络行为。ARP 输入处理的核心任务是解析报文,更新 ARP 缓存,并根据报文类型采取不同的操作。 + +在这部分有以下步骤: + +- 接收 ARP 报文:设备通过网络接口接收到 ARP 报文,无论是广播还是单播形式。这些 ARP 报文可以是 ARP 请求、ARP 响应,或者是无回报 ARP。 +- 解析 ARP 报文:设备对 ARP 报文进行解析,提取其中的关键信息。 +- 检查报文有效性:设备检查 ARP 报文的有效性,包括检查硬件类型是否为以太网、协议类型是否为 IPv4、操作码是否为合法的请求或响应。如果报文不符合 ARP 协议规定,设备将丢弃该报文。 +- 更新 ARP 缓存:根据 ARP 报文中的信息,设备更新自己的 ARP 缓存表。设备通常会把报文中的发送方 IP 地址和发送方 MAC 地址映射记录下来,以便将来进行快速的 IP 到 MAC 地址解析。 +- 据操作码进行处理:不同类型的 ARP 报文有不同的处理方式: + - 如果接收到的是 ARP 请求,设备需要检查目标 IP 地址是否与自身的 IP 地址匹配,如果匹配,则需要发送一个 ARP 响应包,告知请求设备自己的 MAC 地址。 + - 如果接收到的是 ARP 响应,设备会根据响应包中的信息,更新或添加到 ARP 缓存表,并不再发送进一步的响应。 + - 如果接收到的是无回报 ARP,设备会将报文中的 IP-MAC 映射记录下来,以更新其 ARP 缓存。 + +### 4)ARP 的超时重新请求机制 + +ARP(地址解析协议)的超时重新请求机制指的是设备在尝试解析某个 IP 地址到 MAC 地址时,若未能在设定的时间内收到响应,会采取的重发 ARP 请求的策略。这种机制旨在保证网络设备在通信中能够及时获取目标设备的 MAC 地址,并维持 ARP 缓存的准确性。 + +ARP 缓存存储的是 IP 地址与 MAC 地址之间的映射关系。在通信过程中,网络设备通常会先查询 ARP 缓存以查找目标设备的 MAC 地址。如果缓存中存在该 IP 地址的记录,设备会直接使用缓存中的 MAC 地址进行通信;如果没有找到相应记录,设备会发出 ARP 请求,广播请求目标 IP 地址对应的 MAC 地址。 + +如果设备在发送 ARP 请求后,未能在指定的时间内收到 ARP 响应,它会认为该 ARP 请求失败。这时,设备会重新发送 ARP 请求,通常会进行一定次数的重发,以确保能够成功解析目标设备的 MAC 地址。 + +步骤如下: + +1. 发送 ARP 请求:当设备需要与一个目标 IP 地址进行通信时,它首先会查询 ARP 缓存表。如果缓存中没有该 IP 地址的对应条目,设备会发出一个 ARP 请求,以广播方式在本地网络中请求目标设备的 MAC 地址。 +2. 等待响应:设备在发送 ARP 请求后,进入等待状态。在这个状态下,设备会等待目标设备的 ARP 响应,通常是几百毫秒到几秒的时间(具体取决于设备的实现和网络情况)。 +3. 超时判断:如果在规定的时间内设备没有收到目标设备的 ARP 响应,它会触发超时事件,认为该请求失败。此时,设备进入重新请求机制,准备发出新的 ARP 请求。 +4. 重发 ARP 请求:超时后,设备会重新发送 ARP 请求,再次请求目标 IP 地址的 MAC 地址。这个过程通常会重复数次,直到收到响应或者达到最大重试次数为止。设备之间的重试次数和重试间隔时间是预先设定的,例如,设备可能设置为重试 3 到 5 次,每次间隔 1 秒。 +5. 处理无响应的情况:如果设备在多次重发后,依然没有收到 ARP 响应,它将放弃请求,并在上层协议(如 IP、TCP 或 UDP)层上返回错误,表明目标设备不可达。这通常会导致应用层超时或连接失败。设备可能会记录这一信息,并在稍后再尝试通信时重新发起 ARP 请求。 +6. ARP 缓存条目的超时:即使设备成功解析了目标设备的 MAC 地址,ARP 缓存中的条目也并非永久有效。每个 ARP 条目都有一个生存时间(TTL),通常为几分钟到几十分钟。超过这个时间后,如果该条目未被更新,设备会将其删除。当设备再次需要该目标设备的 MAC 地址时,会重新发出 ARP 请求。 + + + += 实验总结 +== 内容总结 + +本次实验主要围绕ARP协议的实现展开,通过编写程序完善了TCP/IP协议栈的ARP协议部分。实验内容包括ARP的初始化、无回报ARP的生成、ARP的输入处理以及ARP的超时重新请求机制。在基础任务中,成功实现了ARP协议的核心功能,包括ARP请求与响应的构建与解析、ARP缓存表的管理等。此外,还完成了拓展任务,实现了多个ARP表项的管理以及IP层的输入输出处理。 + +在实验过程中,首先通过Wireshark抓包分析了ARP报文的结构,并基于此定义了ARP报文的数据结构和相关函数。接着,实现了ARP报文的发送与接收功能,包括ARP请求的生成与广播、ARP响应的处理以及ARP缓存表的更新。通过定时器机制,实现了ARP表项的超时重传功能,确保了ARP缓存的准确性和及时性。 + +在完成ARP协议的基础上,进一步实现了IP协议和ICMP协议。通过定义IP数据报和ICMP数据报的结构,实现了IP层的输入输出功能,并成功实现了ICMP的ping响应功能。实验结果表明,ARP、IP和ICMP协议的功能均得到了正确实现,能够有效支持网络设备之间的通信。 + +== 心得感悟 + +通过本次实验,我深刻理解了ARP协议的工作原理及其在网络通信中的重要作用。ARP协议作为TCP/IP协议栈中的重要组成部分,负责将IP地址解析为MAC地址,是网络设备之间通信的基础。通过亲手实现ARP协议的核心功能,我不仅加深了对ARP协议的理解,还掌握了网络协议栈的实现方法。 + +在实验过程中,我遇到了一些挑战,例如如何正确解析ARP报文、如何管理ARP缓存表以及如何处理ARP超时重传等。通过查阅资料、分析抓包数据以及反复调试代码,我逐步解决了这些问题,并成功实现了ARP协议的功能。这让我认识到,网络协议的实现不仅需要扎实的理论基础,还需要细致的调试和问题解决能力。 + +此外,通过实现IP和ICMP协议,我进一步了解了网络层协议的工作原理。IP协议负责数据包的传输,而ICMP协议则用于传递控制消息。通过实现ICMP的ping响应功能,我掌握了ICMP协议的基本实现方法,并理解了其在网络连通性测试中的应用。 + +总的来说,本次实验让我对TCP/IP协议栈有了更深入的理解,并提升了我的编程能力和网络协议分析能力。这些知识和技能对我今后学习更复杂的网络协议以及从事网络相关工作具有重要意义。 \ No newline at end of file diff --git a/network/arp/一秒一个.png b/network/arp/一秒一个.png new file mode 100755 index 0000000..3fb1b75 Binary files /dev/null and b/network/arp/一秒一个.png differ diff --git a/network/arp/分析结构2.png b/network/arp/分析结构2.png new file mode 100755 index 0000000..9eaf4b6 Binary files /dev/null and b/network/arp/分析结构2.png differ diff --git a/network/arp/十秒一个.png b/network/arp/十秒一个.png new file mode 100755 index 0000000..3ea7608 Binary files /dev/null and b/network/arp/十秒一个.png differ diff --git a/network/arp/十秒一个2.png b/network/arp/十秒一个2.png new file mode 100755 index 0000000..dfc2b14 Binary files /dev/null and b/network/arp/十秒一个2.png differ diff --git a/network/arp/启动ARP.png b/network/arp/启动ARP.png new file mode 100755 index 0000000..b5ce892 Binary files /dev/null and b/network/arp/启动ARP.png differ diff --git a/network/arp/启动ARP2.png b/network/arp/启动ARP2.png new file mode 100755 index 0000000..17a2185 Binary files /dev/null and b/network/arp/启动ARP2.png differ diff --git a/network/arp/抓一个arp分析结构.png b/network/arp/抓一个arp分析结构.png new file mode 100755 index 0000000..70221ec Binary files /dev/null and b/network/arp/抓一个arp分析结构.png differ diff --git a/network/arp/物理机虚拟机IP配置.png b/network/arp/物理机虚拟机IP配置.png new file mode 100755 index 0000000..4c35e7f Binary files /dev/null and b/network/arp/物理机虚拟机IP配置.png differ diff --git a/network/arp/环境配置ping测试.png b/network/arp/环境配置ping测试.png new file mode 100755 index 0000000..d284a38 Binary files /dev/null and b/network/arp/环境配置ping测试.png differ diff --git a/network/check.md b/network/check.md new file mode 100644 index 0000000..788695f --- /dev/null +++ b/network/check.md @@ -0,0 +1,61 @@ +以下是具体的验证步骤: + + 1. 环境准备 + + 1. 配置 IP 地址: + * 确保你的物理机(运行你程序的主机)有一个网络接口的 IP 地址在 192.168.254.0/24 网段,例如 192.168.254.1。 + * 设置一台虚拟机(如 VirtualBox 或 VMWare),将其网络模式设置为“桥接模式”并桥接到你物理机上一步设置的网卡。 + * 在虚拟机中,手动配置 IP 地址,使其与你的物理机在同一网段,例如 192.168.254.3。 █ + █ + 2. 测试连通性: █ + * 在物理机上 ping 虚拟机的 IP (ping 192.168.254.3)。 █ + * 在虚拟机上 ping 物理机的 IP (ping 192.168.254.1)。 █ + * 确保两者可以互相 ping 通。 █ + █ + 3. 编译并准备运行: █ + * 确保你的代码已经编译,并且可执行文件位于 start/xnet_tiny/build/xnet。 █ + █ + 2. 验证 ARP 协议 ▀ + + ARP 协议负责将 IP 地址解析为 MAC 硬件地址。 + + 1. 启动抓包: 在你的物理机上打开 Wireshark,选择连接虚拟机的那个网络接口,开始抓包。你可以使用过滤条件 arp 来只看 ARP 包。 + + 2. 运行你的程序: 打开一个终端,进入 network 目录,然后运行你的可执行文件: + 1 ./start/xnet_tiny/build/xnet + + 3. 验证无回报 ARP (Gratuitous ARP): + * 预期行为: 程序启动时,会立刻发送一个 ARP 请求来宣告自己的 IP 地址 (192.168.254.2)。 + * 验证方法: 在 Wireshark 中,你应该能立刻看到一个源地址是你本机 MAC、内容为 "Who has 192.168.254.2? Tell 192.168.254.2" 的 ARP 包。 + +4. 验证 ARP 响应: + * 预期行为: 当其他设备请求你程序的 IP 地址时,你的程序应该回复其 MAC 地址。 + * 验证方法: 在虚拟机中,ping 你程序模拟的 IP 地址: + 1 ping 192.168.254.2 + * 在 Wireshark 中,你应该能看到: + 1. 一个来自虚拟机的 ARP 请求:"Who has 192.168.254.2? Tell 192.168.254.3"。 + 2. 一个来自你程序的 ARP 响应:"192.168.254.2 is at [你的MAC地址]"。 + * 同时,检查你程序的终端输出,看是否打印出了 "learned mac addr" 的信息,表示它学习到了虚拟机的 MAC 地址。 + + 5. 验证 ARP 超时重传: + * 预期行为: 文档中设置的 ARP 缓存条目超时时间为 10 秒 (XARP_CFG_ENTRY_OK_TMO)。超时后,程序会重新发送 ARP 请求来确认对方是否还在。 + * 验证方法: 完成上一步后,让你和虚拟机的程序都保持运行。在 Wireshark 中,你应该能观察到你的程序大约每隔 10 秒就会发送一个 ARP + 请求到虚拟机的 IP (192.168.254.3)。 + + 3. 验证 ICMP (Ping) 协议 + + ICMP 协议用于网络控制和诊断,ping 就是基于 ICMP 的。 + + 1. 启动抓包: 在 Wireshark 中,使用过滤条件 icmp。 ▄ + █ + 2. 运行程序并 Ping: 保持你的 xnet 程序运行。在虚拟机中,ping 你程序的 IP 地址: █ + █ + 1 ping 192.168.254.2 █ + █ + 3. 验证 ICMP 响应: █ + * 预期行为: 你的程序应该能响应来自虚拟机的 ICMP Echo Request (ping 请求)。 █ + * 验证方法: █ + 1. 在虚拟机的终端里,你应该能看到 ping 命令成功接收到回复,没有丢包。 █ + 2. 在 Wireshark 中,你应该能看到成对的 ICMP 包: █ + * Echo (ping) request 从虚拟机 (192.168.254.3) 发往你的程序 (192.168.254.2)。 +* Echo (ping) reply 从你的程序 (192.168.254.2) 回复给虚拟机 (192.168.254.3)。 diff --git a/network/implementation_report.md b/network/implementation_report.md new file mode 100644 index 0000000..3f43bc5 --- /dev/null +++ b/network/implementation_report.md @@ -0,0 +1,130 @@ +# ARP及ICMP协议实现报告 + +本文档详细记录了在一个C语言网络协议栈项目中,从零开始实现地址解析协议(ARP)和Internet控制报文协议(ICMP)的完整过程。项目基于一个为Windows环境设计的初始模板,整个过程不仅包括了协议逻辑的实现,还涉及了代码的Linux兼容性改造和整体架构的模块化重构。 + +## 1. 初始代码分析 + +项目开始于一个名为`start`的目录,其中包含一个简化的网络协议栈框架。 + +### 1.1. 项目结构勘探 + +首先,我们分析了`start`目录下的源代码,特别是`xnet_tiny/src`子目录。我们识别出以下几个核心文件: + +- `xnet_tiny.h`: 定义了协议栈的基本数据结构,如以太网帧头`xether_hdr_t`和网络数据包`xnet_packet_t`。 +- `xnet_tiny.c`: 包含了协议栈的核心驱动逻辑,如`xnet_init()`(初始化)和`xnet_poll()`(轮询)。 +- `app.c`: 项目的主入口,调用`xnet_init()`和`xnet_poll()`来启动和运行协议栈。 +- `xnet_app/port_pcap.c`: 负责与`pcap`库交互,进行底层网络数据包的收发。 + +### 1.2. 关键实现点定位 + +在`xnet_tiny.c`中,我们发现了`ethernet_in`函数,它负责处理接收到的以太网数据帧。函数内部的`switch`语句根据以太网帧头的协议类型字段来分发数据包: + +```c +switch (swap_order16(hdr->protocol)) { + case XNET_PROTOCOL_ARP: + // 此处为空,是ARP实现入口 + break; + case XNET_PROTOCOL_IP: { + // 此处为空,是IP及ICMP实现入口 + break; + } +} +``` + +这两个`case`分支是空的,这正是我们需要插入ARP和IP/ICMP处理逻辑的地方。 + +## 2. ARP协议实现 + +为了保持代码的模块化,我们将ARP相关的逻辑实现在单独的文件中。 + +### 2.1. 创建ARP模块 + +我们创建了以下两个文件: + +- `xarp.h`: 定义ARP协议包结构`xarp_packet_t`和ARP缓存条目`xarp_entry_t`,并声明了外部接口`xarp_init()`和`xarp_in()`。 +- `xarp.c`: 实现ARP的具体逻辑。 + +### 2.2. 实现ARP核心逻辑 + +在`xarp.c`中,我们完成了以下工作: + +1. **ARP缓存(ARP Table)**: 定义了一个静态数组`arp_table[]`作为ARP缓存,用于存储IP地址到MAC地址的映射。 +2. **`xarp_init()`**: 此函数在协议栈初始化时被调用,负责清空ARP缓存中的所有条目。 +3. **`xarp_in()`**: 这是处理ARP报文的核心。 + - 当接收到一个ARP请求报文时,检查其请求的目标IP地址是否为本机IP。如果是,则构建一个ARP响应报文,填入本机的MAC地址,然后通过`ethernet_out_to()`函数发送出去。 + - 无论是请求还是响应,都会从报文中提取发送方的IP和MAC地址,并更新到ARP缓存中(`update_entry`函数)。 +4. **`xarp_resolve()`**: 为了让上层协议(如IP)能够通过IP地址查询MAC地址,我们添加了此函数。它会首先查询ARP缓存。如果找到匹配的条目,则返回对应的MAC地址;如果未找到,则调用`send_arp_request()`广播一个ARP请求,并返回`NULL`,由上层决定是否重试。 + +### 2.3. 集成到协议栈 + +我们将ARP模块集成到主协议栈中: + +1. 在`xnet_tiny.c`中包含了`xarp.h`。 +2. 在`xnet_init()`函数的末尾调用`xarp_init()`。 +3. 在`ethernet_in()`的`switch`语句中,为`XNET_PROTOCOL_ARP`添加了对`xarp_in(packet)`的调用。 + +为了让`xarp.c`能够调用`xnet_tiny.c`中的`ethernet_out_to`等函数,我们将这些函数的`static`关键字移除,并在`xnet_tiny.h`中添加了它们的声明,使其成为公共接口。 + +## 3. ICMP及IP层实现 + +与ARP类似,我们为ICMP和IP创建了独立的模块。 + +### 3.1. 创建ICMP和IP模块 + +- `xicmp.h`: 定义了IP报头`xip_hdr_t`和ICMP报文结构`xicmp_packet_t`。 +- `xicmp.c`: 实现了`xicmp_in()`函数,用于处理传入的ICMP报文。 +- `xip.h` / `xip.c`: 创建了一个简单的IP输出模块,核心是`xip_out()`函数,用于发送IP包。 + +### 3.2. 实现ICMP Echo Reply + +`xicmp_in()`是ICMP实现的核心,其工作流程如下: + +1. **IP报头解析**: 首先,剥离以太网头部,解析IP报头。验证版本号、头部长度和头部校验和。 +2. **目标IP检查**: 确认该IP包的目标地址是本机。 +3. **ICMP报文处理**: + - 剥离IP头部,解析ICMP报文。 + - 检查ICMP类型是否为**Echo Request**(Ping请求)。 + - 如果是,则准备一个**Echo Reply**(Ping应答)报文。大部分数据(如ID、序列号和数据负载)可以直接从请求报文中复制。 + - 将ICMP类型设置为`ICMP_TYPE_ECHO_REPLY`,然后重新计算ICMP校验和。 +4. **构建IP响应包**: + - 构建IP头部,源和目的IP地址与收到的请求包相反。 + - 重新计算IP头部校验和。 +5. **发送响应**: 调用`xip_out()`函数将响应包发送出去。`xip_out`内部会使用`xarp_resolve`来查找下一跳的MAC地址。 + +### 3.3. 集成到协议栈 + +1. 在`xnet_tiny.c`中包含了`xicmp.h`。 +2. 在`ethernet_in()`的`switch`语句中,为`XNET_PROTOCOL_IP`添加了对`xicmp_in(packet)`的调用。 +3. 在`xicmp.c`中,使用新创建的`xip_out()`函数来发送响应包,而不是直接调用底层的`ethernet_out_to()`,实现了更好的分层。 + +## 4. Linux兼容性改造与重构 + +原始代码是为Windows设计的,为了在Linux上运行,我们进行了以下关键修改: + +1. **修正`pcap_device.c`**: + - 该文件包含了大量`#if defined(WIN32)`的条件编译块,用于加载`npcap`动态库。 + - 我们删除了所有Windows特定的代码(如`#pragma comment`, `GetSystemDirectory`, `MessageBox`等),只保留了`#else`分支下的标准`pcap`实现,使其在Linux下能够直接编译通过。 +2. **修正`port_pcap.c`**: + - 原始代码中的`my_mac_addr`数组长度为8字节,这是错误的。我们将其修正为标准的6字节以太网MAC地址。 + - 将硬编码的pcap设备IP地址从`192.168.254.1`修改为`192.168.254.2`,与我们协议栈配置的IP保持一致。 +3. **IP地址集中管理**: + - 最初,本机IP地址在`xarp.c`和`xicmp.c`中都有硬编码定义。 + - 我们将其移至`xnet_tiny.c`中定义,并在`xnet_tiny.h`中通过`extern`声明,实现了全局统一配置。 + +## 5. 编译与测试 + +完成编码后,即可进行编译测试: + +1. **安装依赖**: 确保Linux系统上已安装`libpcap`的开发库(如`sudo apt install libpcap-dev`)。 +2. **编译**: + - 进入`start/build`目录。 + - 运行`cmake ..`来生成Makefile。 + - 运行`make`进行编译。 +3. **运行与测试**: + - 编译成功后,会在`build`目录下生成可执行文件`xnet.exe`。 + - 使用`sudo ./xnet.exe`运行(需要root权限以访问网络接口)。 + - 在另一台处于同一局域网的主机上,执行`ping 192.168.254.2`,即可测试ICMP Echo功能。同时,可以通过`tcpdump`或`Wireshark`抓包观察ARP请求和响应过程。 + +## 6. 总结 + +通过以上步骤,我们成功地在一个基础网络框架上,完整地实现了ARP和ICMP Echo功能。整个过程不仅加深了对网络协议底层工作原理的理解,也锻炼了在现有代码基础上进行功能扩展、重构和跨平台移植的能力。最终的代码结构清晰,模块化程度高,易于理解和进一步扩展。 diff --git a/network/start/.idea/.gitignore b/network/start/.idea/.gitignore new file mode 100644 index 0000000..1c2fda5 --- /dev/null +++ b/network/start/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/network/start/.idea/deployment.xml b/network/start/.idea/deployment.xml new file mode 100644 index 0000000..09c0d94 --- /dev/null +++ b/network/start/.idea/deployment.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/network/start/.idea/inspectionProfiles/Project_Default.xml b/network/start/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..e86b8d3 --- /dev/null +++ b/network/start/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,25 @@ + + + + \ No newline at end of file diff --git a/network/start/.idea/misc.xml b/network/start/.idea/misc.xml new file mode 100644 index 0000000..8822db8 --- /dev/null +++ b/network/start/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/network/start/.idea/modules.xml b/network/start/.idea/modules.xml new file mode 100644 index 0000000..2e3ce50 --- /dev/null +++ b/network/start/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/network/start/.idea/vcs.xml b/network/start/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/network/start/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/network/start/.idea/xnet-tiny.iml b/network/start/.idea/xnet-tiny.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/network/start/.idea/xnet-tiny.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/network/start/build_bak/.cmake/api/v1/query/client-vscode/query.json b/network/start/build_bak/.cmake/api/v1/query/client-vscode/query.json new file mode 100644 index 0000000..82bb964 --- /dev/null +++ b/network/start/build_bak/.cmake/api/v1/query/client-vscode/query.json @@ -0,0 +1 @@ +{"requests":[{"kind":"cache","version":2},{"kind":"codemodel","version":2},{"kind":"toolchains","version":1},{"kind":"cmakeFiles","version":1}]} \ No newline at end of file diff --git a/network/start/build_bak/.cmake/api/v1/reply/cache-v2-85c8c8b4b757524c1070.json b/network/start/build_bak/.cmake/api/v1/reply/cache-v2-85c8c8b4b757524c1070.json new file mode 100644 index 0000000..9885ee5 --- /dev/null +++ b/network/start/build_bak/.cmake/api/v1/reply/cache-v2-85c8c8b4b757524c1070.json @@ -0,0 +1,1343 @@ +{ + "entries" : + [ + { + "name" : "CMAKE_ADDR2LINE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/addr2line.exe" + }, + { + "name" : "CMAKE_AR", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/ar.exe" + }, + { + "name" : "CMAKE_BUILD_TYPE", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "No help, variable specified on the command line." + } + ], + "type" : "STRING", + "value" : "Debug" + }, + { + "name" : "CMAKE_CACHEFILE_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "This is the directory where this CMakeCache.txt was created" + } + ], + "type" : "INTERNAL", + "value" : "d:/c_work/start/build" + }, + { + "name" : "CMAKE_CACHE_MAJOR_VERSION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Major version of cmake used to create the current loaded cache" + } + ], + "type" : "INTERNAL", + "value" : "3" + }, + { + "name" : "CMAKE_CACHE_MINOR_VERSION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Minor version of cmake used to create the current loaded cache" + } + ], + "type" : "INTERNAL", + "value" : "30" + }, + { + "name" : "CMAKE_CACHE_PATCH_VERSION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Patch version of cmake used to create the current loaded cache" + } + ], + "type" : "INTERNAL", + "value" : "3" + }, + { + "name" : "CMAKE_COLOR_MAKEFILE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Enable/Disable color output during build." + } + ], + "type" : "BOOL", + "value" : "ON" + }, + { + "name" : "CMAKE_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to CMake executable." + } + ], + "type" : "INTERNAL", + "value" : "D:/cmake/bin/cmake.exe" + }, + { + "name" : "CMAKE_CPACK_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to cpack program executable." + } + ], + "type" : "INTERNAL", + "value" : "D:/cmake/bin/cpack.exe" + }, + { + "name" : "CMAKE_CTEST_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to ctest program executable." + } + ], + "type" : "INTERNAL", + "value" : "D:/cmake/bin/ctest.exe" + }, + { + "name" : "CMAKE_CXX_COMPILER", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "No help, variable specified on the command line." + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/g++.exe" + }, + { + "name" : "CMAKE_CXX_COMPILER_AR", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/gcc-ar.exe" + }, + { + "name" : "CMAKE_CXX_COMPILER_RANLIB", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/gcc-ranlib.exe" + }, + { + "name" : "CMAKE_CXX_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_CXX_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "-g" + }, + { + "name" : "CMAKE_CXX_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "-Os -DNDEBUG" + }, + { + "name" : "CMAKE_CXX_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "-O3 -DNDEBUG" + }, + { + "name" : "CMAKE_CXX_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "-O2 -g -DNDEBUG" + }, + { + "name" : "CMAKE_CXX_STANDARD_LIBRARIES", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Libraries linked by default with all C++ applications." + } + ], + "type" : "STRING", + "value" : "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32" + }, + { + "name" : "CMAKE_C_COMPILER", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "No help, variable specified on the command line." + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/gcc.exe" + }, + { + "name" : "CMAKE_C_COMPILER_AR", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/gcc-ar.exe" + }, + { + "name" : "CMAKE_C_COMPILER_RANLIB", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/gcc-ranlib.exe" + }, + { + "name" : "CMAKE_C_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_C_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "-g" + }, + { + "name" : "CMAKE_C_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "-Os -DNDEBUG" + }, + { + "name" : "CMAKE_C_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "-O3 -DNDEBUG" + }, + { + "name" : "CMAKE_C_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "-O2 -g -DNDEBUG" + }, + { + "name" : "CMAKE_C_STANDARD_LIBRARIES", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Libraries linked by default with all C applications." + } + ], + "type" : "STRING", + "value" : "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32" + }, + { + "name" : "CMAKE_DLLTOOL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/dlltool.exe" + }, + { + "name" : "CMAKE_EDIT_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to cache edit program executable." + } + ], + "type" : "INTERNAL", + "value" : "D:/cmake/bin/cmake-gui.exe" + }, + { + "name" : "CMAKE_EXECUTABLE_FORMAT", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Executable file format" + } + ], + "type" : "INTERNAL", + "value" : "Unknown" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXPORT_COMPILE_COMMANDS", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "No help, variable specified on the command line." + } + ], + "type" : "BOOL", + "value" : "TRUE" + }, + { + "name" : "CMAKE_EXTRA_GENERATOR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of external makefile project generator." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_FIND_PACKAGE_REDIRECTS_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake." + } + ], + "type" : "STATIC", + "value" : "D:/c_work/start/build/CMakeFiles/pkgRedirects" + }, + { + "name" : "CMAKE_GENERATOR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of generator." + } + ], + "type" : "INTERNAL", + "value" : "MinGW Makefiles" + }, + { + "name" : "CMAKE_GENERATOR_INSTANCE", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Generator instance identifier." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_GENERATOR_PLATFORM", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of generator platform." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_GENERATOR_TOOLSET", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of generator toolset." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_GNUtoMS", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Convert GNU import libraries to MS format (requires Visual Studio)" + } + ], + "type" : "BOOL", + "value" : "OFF" + }, + { + "name" : "CMAKE_HOME_DIRECTORY", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Source directory with the top level CMakeLists.txt file for this project" + } + ], + "type" : "INTERNAL", + "value" : "D:/c_work/start/xnet_tiny_c0101" + }, + { + "name" : "CMAKE_INSTALL_PREFIX", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Install path prefix, prepended onto install directories." + } + ], + "type" : "PATH", + "value" : "C:/Program Files (x86)/xnet" + }, + { + "name" : "CMAKE_LINKER", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/ld.exe" + }, + { + "name" : "CMAKE_MAKE_PROGRAM", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/mingw32-make.exe" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_NM", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/nm.exe" + }, + { + "name" : "CMAKE_NUMBER_OF_MAKEFILES", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "number of local generators" + } + ], + "type" : "INTERNAL", + "value" : "3" + }, + { + "name" : "CMAKE_OBJCOPY", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/objcopy.exe" + }, + { + "name" : "CMAKE_OBJDUMP", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/objdump.exe" + }, + { + "name" : "CMAKE_PLATFORM_INFO_INITIALIZED", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Platform information initialized" + } + ], + "type" : "INTERNAL", + "value" : "1" + }, + { + "name" : "CMAKE_PROJECT_DESCRIPTION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "" + }, + { + "name" : "CMAKE_PROJECT_HOMEPAGE_URL", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "" + }, + { + "name" : "CMAKE_PROJECT_NAME", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "xnet" + }, + { + "name" : "CMAKE_RANLIB", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/ranlib.exe" + }, + { + "name" : "CMAKE_RC_COMPILER", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "RC compiler" + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/windres.exe" + }, + { + "name" : "CMAKE_RC_COMPILER_WORKS", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "" + } + ], + "type" : "INTERNAL", + "value" : "1" + }, + { + "name" : "CMAKE_RC_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags for Windows Resource Compiler during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_RC_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags for Windows Resource Compiler during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_RC_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags for Windows Resource Compiler during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_RC_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags for Windows Resource Compiler during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_RC_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags for Windows Resource Compiler during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_READELF", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/readelf.exe" + }, + { + "name" : "CMAKE_ROOT", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to CMake installation." + } + ], + "type" : "INTERNAL", + "value" : "D:/cmake/share/cmake-3.30" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SKIP_INSTALL_RPATH", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "If set, runtime paths are not added when installing shared libraries, but are added when building." + } + ], + "type" : "BOOL", + "value" : "NO" + }, + { + "name" : "CMAKE_SKIP_RPATH", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "If set, runtime paths are not added when using shared libraries." + } + ], + "type" : "BOOL", + "value" : "NO" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STRIP", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "D:/c/mingw64/bin/strip.exe" + }, + { + "name" : "CMAKE_TAPI", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "CMAKE_TAPI-NOTFOUND" + }, + { + "name" : "CMAKE_VERBOSE_MAKEFILE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo." + } + ], + "type" : "BOOL", + "value" : "FALSE" + }, + { + "name" : "_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "linker supports push/pop state" + } + ], + "type" : "INTERNAL", + "value" : "TRUE" + }, + { + "name" : "xnet_BINARY_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "D:/c_work/start/build" + }, + { + "name" : "xnet_IS_TOP_LEVEL", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "ON" + }, + { + "name" : "xnet_SOURCE_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "D:/c_work/start/xnet_tiny_c0101" + } + ], + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } +} diff --git a/network/start/build_bak/.cmake/api/v1/reply/cmakeFiles-v1-0a429aa47da5e5edf8a5.json b/network/start/build_bak/.cmake/api/v1/reply/cmakeFiles-v1-0a429aa47da5e5edf8a5.json new file mode 100644 index 0000000..026e8e7 --- /dev/null +++ b/network/start/build_bak/.cmake/api/v1/reply/cmakeFiles-v1-0a429aa47da5e5edf8a5.json @@ -0,0 +1,171 @@ +{ + "inputs" : + [ + { + "path" : "CMakeLists.txt" + }, + { + "isGenerated" : true, + "path" : "D:/c_work/start/build/CMakeFiles/3.30.3/CMakeSystem.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/CMakeSystemSpecificInitialize.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-Initialize.cmake" + }, + { + "isGenerated" : true, + "path" : "D:/c_work/start/build/CMakeFiles/3.30.3/CMakeCCompiler.cmake" + }, + { + "isGenerated" : true, + "path" : "D:/c_work/start/build/CMakeFiles/3.30.3/CMakeCXXCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/CMakeSystemSpecificInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/CMakeGenericSystem.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/CMakeInitializeConfigs.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Platform/Windows.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Platform/WindowsPaths.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/CMakeCInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/CMakeLanguageInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Compiler/GNU-C.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Compiler/GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Compiler/CMakeCommonCompilerMacros.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-GNU-C.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-GNU.cmake" + }, + { + "isGenerated" : true, + "path" : "D:/c_work/start/build/CMakeFiles/3.30.3/CMakeRCCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/CMakeRCInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-windres.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-GNU-C-ABI.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/CMakeCommonLanguageInclude.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/CMakeCXXInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/CMakeLanguageInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Compiler/GNU-CXX.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Compiler/GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-GNU-CXX.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-GNU-CXX-ABI.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "D:/cmake/share/cmake-3.30/Modules/CMakeCommonLanguageInclude.cmake" + }, + { + "path" : "src/xnet_tiny/CMakeLists.txt" + }, + { + "path" : "src/xnet_app/CMakeLists.txt" + } + ], + "kind" : "cmakeFiles", + "paths" : + { + "build" : "D:/c_work/start/build", + "source" : "D:/c_work/start/xnet_tiny_c0101" + }, + "version" : + { + "major" : 1, + "minor" : 1 + } +} diff --git a/network/start/build_bak/.cmake/api/v1/reply/codemodel-v2-26e095933dd6160a6495.json b/network/start/build_bak/.cmake/api/v1/reply/codemodel-v2-26e095933dd6160a6495.json new file mode 100644 index 0000000..3e83ade --- /dev/null +++ b/network/start/build_bak/.cmake/api/v1/reply/codemodel-v2-26e095933dd6160a6495.json @@ -0,0 +1,113 @@ +{ + "configurations" : + [ + { + "directories" : + [ + { + "build" : ".", + "childIndexes" : + [ + 1, + 2 + ], + "jsonFile" : "directory-.-Debug-d0094a50bb2071803777.json", + "minimumCMakeVersion" : + { + "string" : "3.7" + }, + "projectIndex" : 0, + "source" : ".", + "targetIndexes" : + [ + 0 + ] + }, + { + "build" : "src/xnet_tiny", + "jsonFile" : "directory-src.xnet_tiny-Debug-4578e9ca0e0117847dde.json", + "minimumCMakeVersion" : + { + "string" : "3.7" + }, + "parentIndex" : 0, + "projectIndex" : 0, + "source" : "src/xnet_tiny", + "targetIndexes" : + [ + 2 + ] + }, + { + "build" : "src/xnet_app", + "jsonFile" : "directory-src.xnet_app-Debug-25a699856ccc8073c2c5.json", + "minimumCMakeVersion" : + { + "string" : "3.7" + }, + "parentIndex" : 0, + "projectIndex" : 0, + "source" : "src/xnet_app", + "targetIndexes" : + [ + 1 + ] + } + ], + "name" : "Debug", + "projects" : + [ + { + "directoryIndexes" : + [ + 0, + 1, + 2 + ], + "name" : "xnet", + "targetIndexes" : + [ + 0, + 1, + 2 + ] + } + ], + "targets" : + [ + { + "directoryIndex" : 0, + "id" : "xnet::@6890427a1f51a3e7e1df", + "jsonFile" : "target-xnet-Debug-771d309b0cef52622588.json", + "name" : "xnet", + "projectIndex" : 0 + }, + { + "directoryIndex" : 2, + "id" : "xnet_app::@59b125fae35e6df3589a", + "jsonFile" : "target-xnet_app-Debug-b2ab4605d66a83b6a590.json", + "name" : "xnet_app", + "projectIndex" : 0 + }, + { + "directoryIndex" : 1, + "id" : "xnet_tiny::@746c93521a1b098f3dd3", + "jsonFile" : "target-xnet_tiny-Debug-a1849f5457373dbea433.json", + "name" : "xnet_tiny", + "projectIndex" : 0 + } + ] + } + ], + "kind" : "codemodel", + "paths" : + { + "build" : "D:/c_work/start/build", + "source" : "D:/c_work/start/xnet_tiny_c0101" + }, + "version" : + { + "major" : 2, + "minor" : 7 + } +} diff --git a/network/start/build_bak/.cmake/api/v1/reply/directory-.-Debug-d0094a50bb2071803777.json b/network/start/build_bak/.cmake/api/v1/reply/directory-.-Debug-d0094a50bb2071803777.json new file mode 100644 index 0000000..f056bd1 --- /dev/null +++ b/network/start/build_bak/.cmake/api/v1/reply/directory-.-Debug-d0094a50bb2071803777.json @@ -0,0 +1,14 @@ +{ + "backtraceGraph" : + { + "commands" : [], + "files" : [], + "nodes" : [] + }, + "installers" : [], + "paths" : + { + "build" : ".", + "source" : "." + } +} diff --git a/network/start/build_bak/.cmake/api/v1/reply/directory-src.xnet_app-Debug-25a699856ccc8073c2c5.json b/network/start/build_bak/.cmake/api/v1/reply/directory-src.xnet_app-Debug-25a699856ccc8073c2c5.json new file mode 100644 index 0000000..9627cdc --- /dev/null +++ b/network/start/build_bak/.cmake/api/v1/reply/directory-src.xnet_app-Debug-25a699856ccc8073c2c5.json @@ -0,0 +1,14 @@ +{ + "backtraceGraph" : + { + "commands" : [], + "files" : [], + "nodes" : [] + }, + "installers" : [], + "paths" : + { + "build" : "src/xnet_app", + "source" : "src/xnet_app" + } +} diff --git a/network/start/build_bak/.cmake/api/v1/reply/directory-src.xnet_tiny-Debug-4578e9ca0e0117847dde.json b/network/start/build_bak/.cmake/api/v1/reply/directory-src.xnet_tiny-Debug-4578e9ca0e0117847dde.json new file mode 100644 index 0000000..df35db5 --- /dev/null +++ b/network/start/build_bak/.cmake/api/v1/reply/directory-src.xnet_tiny-Debug-4578e9ca0e0117847dde.json @@ -0,0 +1,14 @@ +{ + "backtraceGraph" : + { + "commands" : [], + "files" : [], + "nodes" : [] + }, + "installers" : [], + "paths" : + { + "build" : "src/xnet_tiny", + "source" : "src/xnet_tiny" + } +} diff --git a/network/start/build_bak/.cmake/api/v1/reply/index-2024-10-18T14-58-04-0502.json b/network/start/build_bak/.cmake/api/v1/reply/index-2024-10-18T14-58-04-0502.json new file mode 100644 index 0000000..9bcbeb1 --- /dev/null +++ b/network/start/build_bak/.cmake/api/v1/reply/index-2024-10-18T14-58-04-0502.json @@ -0,0 +1,132 @@ +{ + "cmake" : + { + "generator" : + { + "multiConfig" : false, + "name" : "MinGW Makefiles" + }, + "paths" : + { + "cmake" : "D:/cmake/bin/cmake.exe", + "cpack" : "D:/cmake/bin/cpack.exe", + "ctest" : "D:/cmake/bin/ctest.exe", + "root" : "D:/cmake/share/cmake-3.30" + }, + "version" : + { + "isDirty" : false, + "major" : 3, + "minor" : 30, + "patch" : 3, + "string" : "3.30.3", + "suffix" : "" + } + }, + "objects" : + [ + { + "jsonFile" : "codemodel-v2-26e095933dd6160a6495.json", + "kind" : "codemodel", + "version" : + { + "major" : 2, + "minor" : 7 + } + }, + { + "jsonFile" : "cache-v2-85c8c8b4b757524c1070.json", + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } + }, + { + "jsonFile" : "cmakeFiles-v1-0a429aa47da5e5edf8a5.json", + "kind" : "cmakeFiles", + "version" : + { + "major" : 1, + "minor" : 1 + } + }, + { + "jsonFile" : "toolchains-v1-4e4f3158ee096c2b8391.json", + "kind" : "toolchains", + "version" : + { + "major" : 1, + "minor" : 0 + } + } + ], + "reply" : + { + "client-vscode" : + { + "query.json" : + { + "requests" : + [ + { + "kind" : "cache", + "version" : 2 + }, + { + "kind" : "codemodel", + "version" : 2 + }, + { + "kind" : "toolchains", + "version" : 1 + }, + { + "kind" : "cmakeFiles", + "version" : 1 + } + ], + "responses" : + [ + { + "jsonFile" : "cache-v2-85c8c8b4b757524c1070.json", + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } + }, + { + "jsonFile" : "codemodel-v2-26e095933dd6160a6495.json", + "kind" : "codemodel", + "version" : + { + "major" : 2, + "minor" : 7 + } + }, + { + "jsonFile" : "toolchains-v1-4e4f3158ee096c2b8391.json", + "kind" : "toolchains", + "version" : + { + "major" : 1, + "minor" : 0 + } + }, + { + "jsonFile" : "cmakeFiles-v1-0a429aa47da5e5edf8a5.json", + "kind" : "cmakeFiles", + "version" : + { + "major" : 1, + "minor" : 1 + } + } + ] + } + } + } +} diff --git a/network/start/build_bak/.cmake/api/v1/reply/target-xnet-Debug-771d309b0cef52622588.json b/network/start/build_bak/.cmake/api/v1/reply/target-xnet-Debug-771d309b0cef52622588.json new file mode 100644 index 0000000..05681b2 --- /dev/null +++ b/network/start/build_bak/.cmake/api/v1/reply/target-xnet-Debug-771d309b0cef52622588.json @@ -0,0 +1,221 @@ +{ + "artifacts" : + [ + { + "path" : "xnet.exe" + }, + { + "path" : "xnet.pdb" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "LINK_DIRECTORIES", + "target_link_libraries", + "add_compile_options", + "add_definitions", + "include_directories" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 22, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 4, + "parent" : 0 + }, + { + "command" : 2, + "file" : 0, + "line" : 28, + "parent" : 0 + }, + { + "command" : 3, + "file" : 0, + "line" : 12, + "parent" : 0 + }, + { + "command" : 4, + "file" : 0, + "line" : 26, + "parent" : 0 + }, + { + "command" : 4, + "file" : 0, + "line" : 11, + "parent" : 0 + }, + { + "command" : 5, + "file" : 0, + "line" : 14, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-g" + }, + { + "backtrace" : 4, + "fragment" : "-g" + } + ], + "defines" : + [ + { + "backtrace" : 5, + "define" : "NET_DRIVER_PCAP" + }, + { + "backtrace" : 6, + "define" : "_CRT_SECURE_NO_WARNINGS" + } + ], + "includes" : + [ + { + "backtrace" : 7, + "path" : "D:/c_work/start/xnet_tiny_c0101" + }, + { + "backtrace" : 7, + "path" : "D:/c_work/start/xnet_tiny_c0101/../lib/npcap/Include" + }, + { + "backtrace" : 7, + "path" : "D:/c_work/start/xnet_tiny_c0101/src/xnet_app" + }, + { + "backtrace" : 7, + "path" : "D:/c_work/start/xnet_tiny_c0101/src/xnet_tiny" + }, + { + "backtrace" : 7, + "path" : "D:/c_work/start/xnet_tiny_c0101/../lib/xnet" + } + ], + "language" : "C", + "sourceIndexes" : + [ + 0, + 1 + ] + } + ], + "dependencies" : + [ + { + "backtrace" : 3, + "id" : "xnet_tiny::@746c93521a1b098f3dd3" + }, + { + "backtrace" : 3, + "id" : "xnet_app::@59b125fae35e6df3589a" + } + ], + "id" : "xnet::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + }, + { + "backtrace" : 2, + "fragment" : "-LD:\\c_work\\start\\xnet_tiny_c0101\\..\\lib\\npcap\\Lib\\x64", + "role" : "libraryPath" + }, + { + "backtrace" : 3, + "fragment" : "src\\xnet_tiny\\libxnet_tiny.a", + "role" : "libraries" + }, + { + "backtrace" : 3, + "fragment" : "src\\xnet_app\\libxnet_app.a", + "role" : "libraries" + }, + { + "backtrace" : 3, + "fragment" : "D:\\c_work\\start\\xnet_tiny_c0101\\..\\lib\\npcap\\Lib\\x64\\wpcap.lib", + "role" : "libraries" + }, + { + "backtrace" : 3, + "fragment" : "-lWs2_32", + "role" : "libraries" + }, + { + "fragment" : "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32", + "role" : "libraries" + } + ], + "language" : "C" + }, + "name" : "xnet", + "nameOnDisk" : "xnet.exe", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Source Files", + "sourceIndexes" : + [ + 0, + 1 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "D:/c_work/start/lib/xnet/pcap_device.c", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/app.c", + "sourceGroupIndex" : 0 + } + ], + "type" : "EXECUTABLE" +} diff --git a/network/start/build_bak/.cmake/api/v1/reply/target-xnet_app-Debug-b2ab4605d66a83b6a590.json b/network/start/build_bak/.cmake/api/v1/reply/target-xnet_app-Debug-b2ab4605d66a83b6a590.json new file mode 100644 index 0000000..35494d4 --- /dev/null +++ b/network/start/build_bak/.cmake/api/v1/reply/target-xnet_app-Debug-b2ab4605d66a83b6a590.json @@ -0,0 +1,152 @@ +{ + "archive" : {}, + "artifacts" : + [ + { + "path" : "src/xnet_app/libxnet_app.a" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_library", + "add_compile_options", + "add_definitions", + "include_directories" + ], + "files" : + [ + "src/xnet_app/CMakeLists.txt", + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 2, + "parent" : 0 + }, + { + "file" : 1 + }, + { + "command" : 1, + "file" : 1, + "line" : 12, + "parent" : 2 + }, + { + "command" : 2, + "file" : 1, + "line" : 11, + "parent" : 2 + }, + { + "command" : 3, + "file" : 1, + "line" : 14, + "parent" : 2 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-g" + }, + { + "backtrace" : 3, + "fragment" : "-g" + } + ], + "defines" : + [ + { + "backtrace" : 4, + "define" : "_CRT_SECURE_NO_WARNINGS" + } + ], + "includes" : + [ + { + "backtrace" : 5, + "path" : "D:/c_work/start/xnet_tiny_c0101" + }, + { + "backtrace" : 5, + "path" : "D:/c_work/start/xnet_tiny_c0101/../lib/npcap/Include" + }, + { + "backtrace" : 5, + "path" : "D:/c_work/start/xnet_tiny_c0101/src/xnet_app" + }, + { + "backtrace" : 5, + "path" : "D:/c_work/start/xnet_tiny_c0101/src/xnet_tiny" + }, + { + "backtrace" : 5, + "path" : "D:/c_work/start/xnet_tiny_c0101/../lib/xnet" + } + ], + "language" : "C", + "sourceIndexes" : + [ + 0, + 1, + 2 + ] + } + ], + "id" : "xnet_app::@59b125fae35e6df3589a", + "name" : "xnet_app", + "nameOnDisk" : "libxnet_app.a", + "paths" : + { + "build" : "src/xnet_app", + "source" : "src/xnet_app" + }, + "sourceGroups" : + [ + { + "name" : "Source Files", + "sourceIndexes" : + [ + 0, + 1, + 2 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/xnet_app/port_pcap.c", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/xnet_app/xserver_datetime.c", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/xnet_app/xserver_http.c", + "sourceGroupIndex" : 0 + } + ], + "type" : "STATIC_LIBRARY" +} diff --git a/network/start/build_bak/.cmake/api/v1/reply/target-xnet_tiny-Debug-a1849f5457373dbea433.json b/network/start/build_bak/.cmake/api/v1/reply/target-xnet_tiny-Debug-a1849f5457373dbea433.json new file mode 100644 index 0000000..80b1133 --- /dev/null +++ b/network/start/build_bak/.cmake/api/v1/reply/target-xnet_tiny-Debug-a1849f5457373dbea433.json @@ -0,0 +1,136 @@ +{ + "archive" : {}, + "artifacts" : + [ + { + "path" : "src/xnet_tiny/libxnet_tiny.a" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_library", + "add_compile_options", + "add_definitions", + "include_directories" + ], + "files" : + [ + "src/xnet_tiny/CMakeLists.txt", + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 2, + "parent" : 0 + }, + { + "file" : 1 + }, + { + "command" : 1, + "file" : 1, + "line" : 12, + "parent" : 2 + }, + { + "command" : 2, + "file" : 1, + "line" : 11, + "parent" : 2 + }, + { + "command" : 3, + "file" : 1, + "line" : 14, + "parent" : 2 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-g" + }, + { + "backtrace" : 3, + "fragment" : "-g" + } + ], + "defines" : + [ + { + "backtrace" : 4, + "define" : "_CRT_SECURE_NO_WARNINGS" + } + ], + "includes" : + [ + { + "backtrace" : 5, + "path" : "D:/c_work/start/xnet_tiny_c0101" + }, + { + "backtrace" : 5, + "path" : "D:/c_work/start/xnet_tiny_c0101/../lib/npcap/Include" + }, + { + "backtrace" : 5, + "path" : "D:/c_work/start/xnet_tiny_c0101/src/xnet_app" + }, + { + "backtrace" : 5, + "path" : "D:/c_work/start/xnet_tiny_c0101/src/xnet_tiny" + }, + { + "backtrace" : 5, + "path" : "D:/c_work/start/xnet_tiny_c0101/../lib/xnet" + } + ], + "language" : "C", + "sourceIndexes" : + [ + 0 + ] + } + ], + "id" : "xnet_tiny::@746c93521a1b098f3dd3", + "name" : "xnet_tiny", + "nameOnDisk" : "libxnet_tiny.a", + "paths" : + { + "build" : "src/xnet_tiny", + "source" : "src/xnet_tiny" + }, + "sourceGroups" : + [ + { + "name" : "Source Files", + "sourceIndexes" : + [ + 0 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/xnet_tiny/xnet_tiny.c", + "sourceGroupIndex" : 0 + } + ], + "type" : "STATIC_LIBRARY" +} diff --git a/network/start/build_bak/.cmake/api/v1/reply/toolchains-v1-4e4f3158ee096c2b8391.json b/network/start/build_bak/.cmake/api/v1/reply/toolchains-v1-4e4f3158ee096c2b8391.json new file mode 100644 index 0000000..3a4e14f --- /dev/null +++ b/network/start/build_bak/.cmake/api/v1/reply/toolchains-v1-4e4f3158ee096c2b8391.json @@ -0,0 +1,136 @@ +{ + "kind" : "toolchains", + "toolchains" : + [ + { + "compiler" : + { + "id" : "GNU", + "implicit" : + { + "includeDirectories" : + [ + "D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include", + "D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed", + "D:/c/mingw64/x86_64-w64-mingw32/include" + ], + "linkDirectories" : + [ + "D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0", + "D:/c/mingw64/lib/gcc", + "D:/c/mingw64/x86_64-w64-mingw32/lib", + "D:/c/mingw64/lib" + ], + "linkFrameworkDirectories" : [], + "linkLibraries" : + [ + "mingw32", + "gcc", + "moldname", + "mingwex", + "advapi32", + "shell32", + "user32", + "kernel32", + "iconv", + "mingw32", + "gcc", + "moldname", + "mingwex" + ] + }, + "path" : "D:/c/mingw64/bin/gcc.exe", + "version" : "8.1.0" + }, + "language" : "C", + "sourceFileExtensions" : + [ + "c", + "m" + ] + }, + { + "compiler" : + { + "id" : "GNU", + "implicit" : + { + "includeDirectories" : + [ + "D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++", + "D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32", + "D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward", + "D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include", + "D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed", + "D:/c/mingw64/x86_64-w64-mingw32/include" + ], + "linkDirectories" : + [ + "D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0", + "D:/c/mingw64/lib/gcc", + "D:/c/mingw64/x86_64-w64-mingw32/lib", + "D:/c/mingw64/lib" + ], + "linkFrameworkDirectories" : [], + "linkLibraries" : + [ + "stdc++", + "mingw32", + "gcc_s", + "gcc", + "moldname", + "mingwex", + "advapi32", + "shell32", + "user32", + "kernel32", + "iconv", + "mingw32", + "gcc_s", + "gcc", + "moldname", + "mingwex" + ] + }, + "path" : "D:/c/mingw64/bin/g++.exe", + "version" : "8.1.0" + }, + "language" : "CXX", + "sourceFileExtensions" : + [ + "C", + "M", + "c++", + "cc", + "cpp", + "cxx", + "mm", + "mpp", + "CPP", + "ixx", + "cppm", + "ccm", + "cxxm", + "c++m" + ] + }, + { + "compiler" : + { + "implicit" : {}, + "path" : "D:/c/mingw64/bin/windres.exe" + }, + "language" : "RC", + "sourceFileExtensions" : + [ + "rc", + "RC" + ] + } + ], + "version" : + { + "major" : 1, + "minor" : 0 + } +} diff --git a/network/start/build_bak/CMakeCache.txt b/network/start/build_bak/CMakeCache.txt new file mode 100644 index 0000000..ad7d364 --- /dev/null +++ b/network/start/build_bak/CMakeCache.txt @@ -0,0 +1,418 @@ +# This is the CMakeCache file. +# For build in directory: d:/c_work/start/build +# It was generated by CMake: D:/cmake/bin/cmake.exe +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Path to a program. +CMAKE_ADDR2LINE:FILEPATH=D:/c/mingw64/bin/addr2line.exe + +//Path to a program. +CMAKE_AR:FILEPATH=D:/c/mingw64/bin/ar.exe + +//No help, variable specified on the command line. +CMAKE_BUILD_TYPE:STRING=Debug + +//Enable/Disable color output during build. +CMAKE_COLOR_MAKEFILE:BOOL=ON + +//No help, variable specified on the command line. +CMAKE_CXX_COMPILER:FILEPATH=D:/c/mingw64/bin/g++.exe + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=D:/c/mingw64/bin/gcc-ar.exe + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=D:/c/mingw64/bin/gcc-ranlib.exe + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Libraries linked by default with all C++ applications. +CMAKE_CXX_STANDARD_LIBRARIES:STRING=-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 + +//No help, variable specified on the command line. +CMAKE_C_COMPILER:FILEPATH=D:/c/mingw64/bin/gcc.exe + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=D:/c/mingw64/bin/gcc-ar.exe + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=D:/c/mingw64/bin/gcc-ranlib.exe + +//Flags used by the C compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the C compiler during DEBUG builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the C compiler during MINSIZEREL builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the C compiler during RELEASE builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the C compiler during RELWITHDEBINFO builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Libraries linked by default with all C applications. +CMAKE_C_STANDARD_LIBRARIES:STRING=-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 + +//Path to a program. +CMAKE_DLLTOOL:FILEPATH=D:/c/mingw64/bin/dlltool.exe + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//No help, variable specified on the command line. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE + +//Value Computed by CMake. +CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=D:/c_work/start/build/CMakeFiles/pkgRedirects + +//Convert GNU import libraries to MS format (requires Visual Studio) +CMAKE_GNUtoMS:BOOL=OFF + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=C:/Program Files (x86)/xnet + +//Path to a program. +CMAKE_LINKER:FILEPATH=D:/c/mingw64/bin/ld.exe + +//Path to a program. +CMAKE_MAKE_PROGRAM:FILEPATH=D:/c/mingw64/bin/mingw32-make.exe + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=D:/c/mingw64/bin/nm.exe + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=D:/c/mingw64/bin/objcopy.exe + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=D:/c/mingw64/bin/objdump.exe + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=xnet + +//Path to a program. +CMAKE_RANLIB:FILEPATH=D:/c/mingw64/bin/ranlib.exe + +//RC compiler +CMAKE_RC_COMPILER:FILEPATH=D:/c/mingw64/bin/windres.exe + +//Flags for Windows Resource Compiler during all build types. +CMAKE_RC_FLAGS:STRING= + +//Flags for Windows Resource Compiler during DEBUG builds. +CMAKE_RC_FLAGS_DEBUG:STRING= + +//Flags for Windows Resource Compiler during MINSIZEREL builds. +CMAKE_RC_FLAGS_MINSIZEREL:STRING= + +//Flags for Windows Resource Compiler during RELEASE builds. +CMAKE_RC_FLAGS_RELEASE:STRING= + +//Flags for Windows Resource Compiler during RELWITHDEBINFO builds. +CMAKE_RC_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_READELF:FILEPATH=D:/c/mingw64/bin/readelf.exe + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=D:/c/mingw64/bin/strip.exe + +//Path to a program. +CMAKE_TAPI:FILEPATH=CMAKE_TAPI-NOTFOUND + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//Value Computed by CMake +xnet_BINARY_DIR:STATIC=D:/c_work/start/build + +//Value Computed by CMake +xnet_IS_TOP_LEVEL:STATIC=ON + +//Value Computed by CMake +xnet_SOURCE_DIR:STATIC=D:/c_work/start/xnet_tiny_c0101 + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_ADDR2LINE +CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=d:/c_work/start/build +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=30 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=3 +//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE +CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=D:/cmake/bin/cmake.exe +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=D:/cmake/bin/cpack.exe +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=D:/cmake/bin/ctest.exe +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_STANDARD_LIBRARIES +CMAKE_CXX_STANDARD_LIBRARIES-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_STANDARD_LIBRARIES +CMAKE_C_STANDARD_LIBRARIES-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_DLLTOOL +CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 +//Path to cache edit program executable. +CMAKE_EDIT_COMMAND:INTERNAL=D:/cmake/bin/cmake-gui.exe +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=Unknown +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=MinGW Makefiles +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=D:/c_work/start/xnet_tiny_c0101 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=3 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RC_COMPILER +CMAKE_RC_COMPILER-ADVANCED:INTERNAL=1 +CMAKE_RC_COMPILER_WORKS:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RC_FLAGS +CMAKE_RC_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RC_FLAGS_DEBUG +CMAKE_RC_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RC_FLAGS_MINSIZEREL +CMAKE_RC_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RC_FLAGS_RELEASE +CMAKE_RC_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RC_FLAGS_RELWITHDEBINFO +CMAKE_RC_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_READELF +CMAKE_READELF-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=D:/cmake/share/cmake-3.30 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_TAPI +CMAKE_TAPI-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 +//linker supports push/pop state +_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED:INTERNAL=TRUE + diff --git a/network/start/build_bak/CMakeFiles/3.30.3/CMakeCCompiler.cmake b/network/start/build_bak/CMakeFiles/3.30.3/CMakeCCompiler.cmake new file mode 100644 index 0000000..4c3ba4a --- /dev/null +++ b/network/start/build_bak/CMakeFiles/3.30.3/CMakeCCompiler.cmake @@ -0,0 +1,81 @@ +set(CMAKE_C_COMPILER "D:/c/mingw64/bin/gcc.exe") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "8.1.0") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_C_STANDARD_LATEST "17") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") +set(CMAKE_C17_COMPILE_FEATURES "c_std_17") +set(CMAKE_C23_COMPILE_FEATURES "") + +set(CMAKE_C_PLATFORM_ID "MinGW") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_C_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "D:/c/mingw64/bin/ar.exe") +set(CMAKE_C_COMPILER_AR "D:/c/mingw64/bin/gcc-ar.exe") +set(CMAKE_RANLIB "D:/c/mingw64/bin/ranlib.exe") +set(CMAKE_C_COMPILER_RANLIB "D:/c/mingw64/bin/gcc-ranlib.exe") +set(CMAKE_LINKER "D:/c/mingw64/bin/ld.exe") +set(CMAKE_LINKER_LINK "") +set(CMAKE_LINKER_LLD "") +set(CMAKE_C_COMPILER_LINKER "D:/c/mingw64/x86_64-w64-mingw32/bin/ld.exe") +set(CMAKE_C_COMPILER_LINKER_ID "GNU") +set(CMAKE_C_COMPILER_LINKER_VERSION 2.30) +set(CMAKE_C_COMPILER_LINKER_FRONTEND_VARIANT GNU) +set(CMAKE_MT "") +set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) +set(CMAKE_C_LINKER_DEPFILE_SUPPORTED FALSE) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "") +set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_C_LIBRARY_ARCHITECTURE "") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed;D:/c/mingw64/x86_64-w64-mingw32/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "mingw32;gcc;moldname;mingwex;advapi32;shell32;user32;kernel32;iconv;mingw32;gcc;moldname;mingwex") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0;D:/c/mingw64/lib/gcc;D:/c/mingw64/x86_64-w64-mingw32/lib;D:/c/mingw64/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/network/start/build_bak/CMakeFiles/3.30.3/CMakeCXXCompiler.cmake b/network/start/build_bak/CMakeFiles/3.30.3/CMakeCXXCompiler.cmake new file mode 100644 index 0000000..681dcb4 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/3.30.3/CMakeCXXCompiler.cmake @@ -0,0 +1,97 @@ +set(CMAKE_CXX_COMPILER "D:/c/mingw64/bin/g++.exe") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "8.1.0") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14") +set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_CXX_STANDARD_LATEST "20") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") +set(CMAKE_CXX23_COMPILE_FEATURES "") +set(CMAKE_CXX26_COMPILE_FEATURES "") + +set(CMAKE_CXX_PLATFORM_ID "MinGW") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "D:/c/mingw64/bin/ar.exe") +set(CMAKE_CXX_COMPILER_AR "D:/c/mingw64/bin/gcc-ar.exe") +set(CMAKE_RANLIB "D:/c/mingw64/bin/ranlib.exe") +set(CMAKE_CXX_COMPILER_RANLIB "D:/c/mingw64/bin/gcc-ranlib.exe") +set(CMAKE_LINKER "D:/c/mingw64/bin/ld.exe") +set(CMAKE_LINKER_LINK "") +set(CMAKE_LINKER_LLD "") +set(CMAKE_CXX_COMPILER_LINKER "D:/c/mingw64/x86_64-w64-mingw32/bin/ld.exe") +set(CMAKE_CXX_COMPILER_LINKER_ID "GNU") +set(CMAKE_CXX_COMPILER_LINKER_VERSION 2.30) +set(CMAKE_CXX_COMPILER_LINKER_FRONTEND_VARIANT GNU) +set(CMAKE_MT "") +set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm;ccm;cxxm;c++m) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang IN ITEMS C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) +set(CMAKE_CXX_LINKER_DEPFILE_SUPPORTED FALSE) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "") +set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed;D:/c/mingw64/x86_64-w64-mingw32/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;mingw32;gcc_s;gcc;moldname;mingwex;advapi32;shell32;user32;kernel32;iconv;mingw32;gcc_s;gcc;moldname;mingwex") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0;D:/c/mingw64/lib/gcc;D:/c/mingw64/x86_64-w64-mingw32/lib;D:/c/mingw64/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") +set(CMAKE_CXX_COMPILER_CLANG_RESOURCE_DIR "") + +set(CMAKE_CXX_COMPILER_IMPORT_STD "") + diff --git a/network/start/build_bak/CMakeFiles/3.30.3/CMakeDetermineCompilerABI_C.bin b/network/start/build_bak/CMakeFiles/3.30.3/CMakeDetermineCompilerABI_C.bin new file mode 100644 index 0000000..fc5ef93 Binary files /dev/null and b/network/start/build_bak/CMakeFiles/3.30.3/CMakeDetermineCompilerABI_C.bin differ diff --git a/network/start/build_bak/CMakeFiles/3.30.3/CMakeDetermineCompilerABI_CXX.bin b/network/start/build_bak/CMakeFiles/3.30.3/CMakeDetermineCompilerABI_CXX.bin new file mode 100644 index 0000000..2f26816 Binary files /dev/null and b/network/start/build_bak/CMakeFiles/3.30.3/CMakeDetermineCompilerABI_CXX.bin differ diff --git a/network/start/build_bak/CMakeFiles/3.30.3/CMakeRCCompiler.cmake b/network/start/build_bak/CMakeFiles/3.30.3/CMakeRCCompiler.cmake new file mode 100644 index 0000000..6f95a42 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/3.30.3/CMakeRCCompiler.cmake @@ -0,0 +1,6 @@ +set(CMAKE_RC_COMPILER "D:/c/mingw64/bin/windres.exe") +set(CMAKE_RC_COMPILER_ARG1 "") +set(CMAKE_RC_COMPILER_LOADED 1) +set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc;RC) +set(CMAKE_RC_OUTPUT_EXTENSION .obj) +set(CMAKE_RC_COMPILER_ENV_VAR "RC") diff --git a/network/start/build_bak/CMakeFiles/3.30.3/CMakeSystem.cmake b/network/start/build_bak/CMakeFiles/3.30.3/CMakeSystem.cmake new file mode 100644 index 0000000..306e632 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/3.30.3/CMakeSystem.cmake @@ -0,0 +1,15 @@ +set(CMAKE_HOST_SYSTEM "Windows-10.0.22631") +set(CMAKE_HOST_SYSTEM_NAME "Windows") +set(CMAKE_HOST_SYSTEM_VERSION "10.0.22631") +set(CMAKE_HOST_SYSTEM_PROCESSOR "AMD64") + + + +set(CMAKE_SYSTEM "Windows-10.0.22631") +set(CMAKE_SYSTEM_NAME "Windows") +set(CMAKE_SYSTEM_VERSION "10.0.22631") +set(CMAKE_SYSTEM_PROCESSOR "AMD64") + +set(CMAKE_CROSSCOMPILING "FALSE") + +set(CMAKE_SYSTEM_LOADED 1) diff --git a/network/start/build_bak/CMakeFiles/3.30.3/CompilerIdC/CMakeCCompilerId.c b/network/start/build_bak/CMakeFiles/3.30.3/CompilerIdC/CMakeCCompilerId.c new file mode 100644 index 0000000..f51efc3 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/3.30.3/CompilerIdC/CMakeCCompilerId.c @@ -0,0 +1,904 @@ +#ifdef __cplusplus +# error "A C++ compiler has been selected for C." +#endif + +#if defined(__18CXX) +# define ID_VOID_MAIN +#endif +#if defined(__CLASSIC_C__) +/* cv-qualifiers did not exist in K&R C */ +# define const +# define volatile +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__open_xl__) && defined(__clang__) +# define COMPILER_ID "IBMClang" +# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__) +# define COMPILER_VERSION_MINOR DEC(__open_xl_release__) +# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__) + + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(__clang__) && defined(__cray__) +# define COMPILER_ID "CrayClang" +# define COMPILER_VERSION_MAJOR DEC(__cray_major__) +# define COMPILER_VERSION_MINOR DEC(__cray_minor__) +# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TASKING__) +# define COMPILER_ID "Tasking" + # define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000) + # define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100) +# define COMPILER_VERSION_INTERNAL DEC(__VERSION__) + +#elif defined(__ORANGEC__) +# define COMPILER_ID "OrangeC" +# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__) + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) && defined(__ti__) +# define COMPILER_ID "TIClang" + # define COMPILER_VERSION_MAJOR DEC(__ti_major__) + # define COMPILER_VERSION_MINOR DEC(__ti_minor__) + # define COMPILER_VERSION_PATCH DEC(__ti_patchlevel__) +# define COMPILER_VERSION_INTERNAL DEC(__ti_version__) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) +# define COMPILER_ID "LCC" +# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100) +# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100) +# if defined(__LCC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define SIMULATE_ID "GNU" +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(_ADI_COMPILER) +# define COMPILER_ID "ADSP" +#if defined(__VERSIONNUM__) + /* __VERSIONNUM__ = 0xVVRRPPTT */ +# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF) +# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF) +# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF) +# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +# elif defined(_ADI_COMPILER) +# define PLATFORM_ID "ADSP" + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__clang__) && defined(__ti__) +# if defined(__ARM_ARCH) +# define ARCHITECTURE_ID "Arm" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +# elif defined(__ADSPSHARC__) +# define ARCHITECTURE_ID "SHARC" + +# elif defined(__ADSPBLACKFIN__) +# define ARCHITECTURE_ID "Blackfin" + +#elif defined(__TASKING__) + +# if defined(__CTC__) || defined(__CPTC__) +# define ARCHITECTURE_ID "TriCore" + +# elif defined(__CMCS__) +# define ARCHITECTURE_ID "MCS" + +# elif defined(__CARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__CARC__) +# define ARCHITECTURE_ID "ARC" + +# elif defined(__C51__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__CPCP__) +# define ARCHITECTURE_ID "PCP" + +# else +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#define C_STD_99 199901L +#define C_STD_11 201112L +#define C_STD_17 201710L +#define C_STD_23 202311L + +#ifdef __STDC_VERSION__ +# define C_STD __STDC_VERSION__ +#endif + +#if !defined(__STDC__) && !defined(__clang__) +# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) +# define C_VERSION "90" +# else +# define C_VERSION +# endif +#elif C_STD > C_STD_17 +# define C_VERSION "23" +#elif C_STD > C_STD_11 +# define C_VERSION "17" +#elif C_STD > C_STD_99 +# define C_VERSION "11" +#elif C_STD >= C_STD_99 +# define C_VERSION "99" +#else +# define C_VERSION "90" +#endif +const char* info_language_standard_default = + "INFO" ":" "standard_default[" C_VERSION "]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/network/start/build_bak/CMakeFiles/3.30.3/CompilerIdC/a.exe b/network/start/build_bak/CMakeFiles/3.30.3/CompilerIdC/a.exe new file mode 100644 index 0000000..48cab5c Binary files /dev/null and b/network/start/build_bak/CMakeFiles/3.30.3/CompilerIdC/a.exe differ diff --git a/network/start/build_bak/CMakeFiles/3.30.3/CompilerIdCXX/CMakeCXXCompilerId.cpp b/network/start/build_bak/CMakeFiles/3.30.3/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 0000000..bfb90d1 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/3.30.3/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,919 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__open_xl__) && defined(__clang__) +# define COMPILER_ID "IBMClang" +# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__) +# define COMPILER_VERSION_MINOR DEC(__open_xl_release__) +# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__) + + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(__clang__) && defined(__cray__) +# define COMPILER_ID "CrayClang" +# define COMPILER_VERSION_MAJOR DEC(__cray_major__) +# define COMPILER_VERSION_MINOR DEC(__cray_minor__) +# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TASKING__) +# define COMPILER_ID "Tasking" + # define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000) + # define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100) +# define COMPILER_VERSION_INTERNAL DEC(__VERSION__) + +#elif defined(__ORANGEC__) +# define COMPILER_ID "OrangeC" +# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__) + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) && defined(__ti__) +# define COMPILER_ID "TIClang" + # define COMPILER_VERSION_MAJOR DEC(__ti_major__) + # define COMPILER_VERSION_MINOR DEC(__ti_minor__) + # define COMPILER_VERSION_PATCH DEC(__ti_patchlevel__) +# define COMPILER_VERSION_INTERNAL DEC(__ti_version__) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) +# define COMPILER_ID "LCC" +# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100) +# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100) +# if defined(__LCC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define SIMULATE_ID "GNU" +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(_ADI_COMPILER) +# define COMPILER_ID "ADSP" +#if defined(__VERSIONNUM__) + /* __VERSIONNUM__ = 0xVVRRPPTT */ +# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF) +# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF) +# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF) +# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +# elif defined(_ADI_COMPILER) +# define PLATFORM_ID "ADSP" + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__clang__) && defined(__ti__) +# if defined(__ARM_ARCH) +# define ARCHITECTURE_ID "Arm" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +# elif defined(__ADSPSHARC__) +# define ARCHITECTURE_ID "SHARC" + +# elif defined(__ADSPBLACKFIN__) +# define ARCHITECTURE_ID "Blackfin" + +#elif defined(__TASKING__) + +# if defined(__CTC__) || defined(__CPTC__) +# define ARCHITECTURE_ID "TriCore" + +# elif defined(__CMCS__) +# define ARCHITECTURE_ID "MCS" + +# elif defined(__CARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__CARC__) +# define ARCHITECTURE_ID "ARC" + +# elif defined(__C51__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__CPCP__) +# define ARCHITECTURE_ID "PCP" + +# else +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#define CXX_STD_98 199711L +#define CXX_STD_11 201103L +#define CXX_STD_14 201402L +#define CXX_STD_17 201703L +#define CXX_STD_20 202002L +#define CXX_STD_23 202302L + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) +# if _MSVC_LANG > CXX_STD_17 +# define CXX_STD _MSVC_LANG +# elif _MSVC_LANG == CXX_STD_17 && defined(__cpp_aggregate_paren_init) +# define CXX_STD CXX_STD_20 +# elif _MSVC_LANG > CXX_STD_14 && __cplusplus > CXX_STD_17 +# define CXX_STD CXX_STD_20 +# elif _MSVC_LANG > CXX_STD_14 +# define CXX_STD CXX_STD_17 +# elif defined(__INTEL_CXX11_MODE__) && defined(__cpp_aggregate_nsdmi) +# define CXX_STD CXX_STD_14 +# elif defined(__INTEL_CXX11_MODE__) +# define CXX_STD CXX_STD_11 +# else +# define CXX_STD CXX_STD_98 +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# if _MSVC_LANG > __cplusplus +# define CXX_STD _MSVC_LANG +# else +# define CXX_STD __cplusplus +# endif +#elif defined(__NVCOMPILER) +# if __cplusplus == CXX_STD_17 && defined(__cpp_aggregate_paren_init) +# define CXX_STD CXX_STD_20 +# else +# define CXX_STD __cplusplus +# endif +#elif defined(__INTEL_COMPILER) || defined(__PGI) +# if __cplusplus == CXX_STD_11 && defined(__cpp_namespace_attributes) +# define CXX_STD CXX_STD_17 +# elif __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi) +# define CXX_STD CXX_STD_14 +# else +# define CXX_STD __cplusplus +# endif +#elif (defined(__IBMCPP__) || defined(__ibmxl__)) && defined(__linux__) +# if __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi) +# define CXX_STD CXX_STD_14 +# else +# define CXX_STD __cplusplus +# endif +#elif __cplusplus == 1 && defined(__GXX_EXPERIMENTAL_CXX0X__) +# define CXX_STD CXX_STD_11 +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_standard_default = "INFO" ":" "standard_default[" +#if CXX_STD > CXX_STD_23 + "26" +#elif CXX_STD > CXX_STD_20 + "23" +#elif CXX_STD > CXX_STD_17 + "20" +#elif CXX_STD > CXX_STD_14 + "17" +#elif CXX_STD > CXX_STD_11 + "14" +#elif CXX_STD >= CXX_STD_11 + "11" +#else + "98" +#endif +"]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} diff --git a/network/start/build_bak/CMakeFiles/3.30.3/CompilerIdCXX/a.exe b/network/start/build_bak/CMakeFiles/3.30.3/CompilerIdCXX/a.exe new file mode 100644 index 0000000..a2c7530 Binary files /dev/null and b/network/start/build_bak/CMakeFiles/3.30.3/CompilerIdCXX/a.exe differ diff --git a/network/start/build_bak/CMakeFiles/CMakeConfigureLog.yaml b/network/start/build_bak/CMakeFiles/CMakeConfigureLog.yaml new file mode 100644 index 0000000..df2728d --- /dev/null +++ b/network/start/build_bak/CMakeFiles/CMakeConfigureLog.yaml @@ -0,0 +1,633 @@ + +--- +events: + - + kind: "message-v1" + backtrace: + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineSystem.cmake:205 (message)" + - "CMakeLists.txt:2 (project)" + message: | + The system is: Windows - 10.0.22631 - AMD64 + - + kind: "message-v1" + backtrace: + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCompilerId.cmake:17 (message)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)" + - "CMakeLists.txt:2 (project)" + message: | + Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. + Compiler: D:/c/mingw64/bin/gcc.exe + Build flags: + Id flags: + + The output was: + 0 + + + Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.exe" + + The C compiler identification is GNU, found in: + D:/c_work/start/build/CMakeFiles/3.30.3/CompilerIdC/a.exe + + - + kind: "message-v1" + backtrace: + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCompilerId.cmake:17 (message)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)" + - "CMakeLists.txt:2 (project)" + message: | + Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. + Compiler: D:/c/mingw64/bin/g++.exe + Build flags: + Id flags: + + The output was: + 0 + + + Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.exe" + + The CXX compiler identification is GNU, found in: + D:/c_work/start/build/CMakeFiles/3.30.3/CompilerIdCXX/a.exe + + - + kind: "try_compile-v1" + backtrace: + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCompilerABI.cmake:74 (try_compile)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:2 (project)" + checks: + - "Detecting C compiler ABI info" + directories: + source: "D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-r96baa" + binary: "D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-r96baa" + cmakeVariables: + CMAKE_C_FLAGS: "" + CMAKE_C_FLAGS_DEBUG: "-g" + CMAKE_EXE_LINKER_FLAGS: "" + buildResult: + variable: "CMAKE_C_ABI_COMPILED" + cached: true + stdout: | + Change Dir: 'D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-r96baa' + + Run Build Command(s): D:/cmake/bin/cmake.exe -E env VERBOSE=1 D:/c/mingw64/bin/mingw32-make.exe -f Makefile cmTC_c4c09/fast + D:/c/mingw64/bin/mingw32-make.exe -f CMakeFiles\\cmTC_c4c09.dir\\build.make CMakeFiles/cmTC_c4c09.dir/build + mingw32-make.exe[1]: Entering directory 'D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-r96baa' + Building C object CMakeFiles/cmTC_c4c09.dir/CMakeCCompilerABI.c.obj + D:\\c\\mingw64\\bin\\gcc.exe -v -o CMakeFiles\\cmTC_c4c09.dir\\CMakeCCompilerABI.c.obj -c D:\\cmake\\share\\cmake-3.30\\Modules\\CMakeCCompilerABI.c + Using built-in specs. + COLLECT_GCC=D:\\c\\mingw64\\bin\\gcc.exe + Target: x86_64-w64-mingw32 + Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-win32-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib ' + Thread model: win32 + gcc version 8.1.0 (x86_64-win32-seh-rev0, Built by MinGW-W64 project) + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\\cmTC_c4c09.dir\\CMakeCCompilerABI.c.obj' '-c' '-mtune=core2' '-march=nocona' + D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/cc1.exe -quiet -v -iprefix D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/ -U_REENTRANT D:\\cmake\\share\\cmake-3.30\\Modules\\CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=core2 -march=nocona -auxbase-strip CMakeFiles\\cmTC_c4c09.dir\\CMakeCCompilerABI.c.obj -version -o C:\\Users\\OMEN\\AppData\\Local\\Temp\\ccPiSQIT.s + GNU C17 (x86_64-win32-seh-rev0, Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32) + compiled by GNU C version 8.1.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP + + GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 + ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include" + ignoring nonexistent directory "C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../include" + ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed" + ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include" + ignoring nonexistent directory "C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/mingw/include" + #include "..." search starts here: + #include <...> search starts here: + D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include + D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed + D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include + End of search list. + GNU C17 (x86_64-win32-seh-rev0, Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32) + compiled by GNU C version 8.1.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP + + GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 + Compiler executable checksum: bb117049c51d03d971e874cfcb35cac9 + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\\cmTC_c4c09.dir\\CMakeCCompilerABI.c.obj' '-c' '-mtune=core2' '-march=nocona' + D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe -v -o CMakeFiles\\cmTC_c4c09.dir\\CMakeCCompilerABI.c.obj C:\\Users\\OMEN\\AppData\\Local\\Temp\\ccPiSQIT.s + GNU assembler version 2.30 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.30 + COMPILER_PATH=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/;D:/c/mingw64/bin/../libexec/gcc/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ + LIBRARY_PATH=D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/;D:/c/mingw64/bin/../lib/gcc/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../ + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\\cmTC_c4c09.dir\\CMakeCCompilerABI.c.obj' '-c' '-mtune=core2' '-march=nocona' + Linking C executable cmTC_c4c09.exe + D:\\cmake\\bin\\cmake.exe -E cmake_link_script CMakeFiles\\cmTC_c4c09.dir\\link.txt --verbose=1 + D:\\cmake\\bin\\cmake.exe -E rm -f CMakeFiles\\cmTC_c4c09.dir/objects.a + D:\\c\\mingw64\\bin\\ar.exe qc CMakeFiles\\cmTC_c4c09.dir/objects.a @CMakeFiles\\cmTC_c4c09.dir\\objects1.rsp + D:\\c\\mingw64\\bin\\gcc.exe -v -Wl,-v -Wl,--whole-archive CMakeFiles\\cmTC_c4c09.dir/objects.a -Wl,--no-whole-archive -o cmTC_c4c09.exe -Wl,--out-implib,libcmTC_c4c09.dll.a -Wl,--major-image-version,0,--minor-image-version,0 + Using built-in specs. + COLLECT_GCC=D:\\c\\mingw64\\bin\\gcc.exe + COLLECT_LTO_WRAPPER=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe + Target: x86_64-w64-mingw32 + Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-win32-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib ' + Thread model: win32 + gcc version 8.1.0 (x86_64-win32-seh-rev0, Built by MinGW-W64 project) + COMPILER_PATH=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/;D:/c/mingw64/bin/../libexec/gcc/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ + LIBRARY_PATH=D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/;D:/c/mingw64/bin/../lib/gcc/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../ + COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_c4c09.exe' '-mtune=core2' '-march=nocona' + D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/collect2.exe -plugin D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/liblto_plugin-0.dll -plugin-opt=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe -plugin-opt=-fresolution=C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc9S4M14.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-liconv -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt --sysroot=C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 -m i386pep -Bdynamic -o cmTC_c4c09.exe D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0 -LD:/c/mingw64/bin/../lib/gcc -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../.. -v --whole-archive CMakeFiles\\cmTC_c4c09.dir/objects.a --no-whole-archive --out-implib libcmTC_c4c09.dll.a --major-image-version 0 --minor-image-version 0 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -liconv -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o + collect2 version 8.1.0 + D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe -plugin D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/liblto_plugin-0.dll -plugin-opt=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe -plugin-opt=-fresolution=C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc9S4M14.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-liconv -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt --sysroot=C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 -m i386pep -Bdynamic -o cmTC_c4c09.exe D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0 -LD:/c/mingw64/bin/../lib/gcc -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../.. -v --whole-archive CMakeFiles\\cmTC_c4c09.dir/objects.a --no-whole-archive --out-implib libcmTC_c4c09.dll.a --major-image-version 0 --minor-image-version 0 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -liconv -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o + GNU ld (GNU Binutils) 2.30 + COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_c4c09.exe' '-mtune=core2' '-march=nocona' + mingw32-make.exe[1]: Leaving directory 'D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-r96baa' + + exitCode: 0 + - + kind: "message-v1" + backtrace: + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCompilerABI.cmake:182 (message)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:2 (project)" + message: | + Parsed C implicit include dir info: rv=done + found start of include info + found start of implicit include info + add: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include] + add: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed] + add: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include] + end of search list found + collapse include dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include] ==> [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include] + collapse include dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed] ==> [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed] + collapse include dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include] ==> [D:/c/mingw64/x86_64-w64-mingw32/include] + implicit include dirs: [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed;D:/c/mingw64/x86_64-w64-mingw32/include] + + + - + kind: "message-v1" + backtrace: + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCompilerABI.cmake:218 (message)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:2 (project)" + message: | + Parsed C implicit link information: + link line regex: [^( *|.*[/\\])(ld[0-9]*(\\.[a-z]+)?|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)] + linker tool regex: [^[ ]*(->|")?[ ]*(([^"]*[/\\])?(ld[0-9]*(\\.[a-z]+)?))("|,| |$)] + ignore line: [Change Dir: 'D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-r96baa'] + ignore line: [] + ignore line: [Run Build Command(s): D:/cmake/bin/cmake.exe -E env VERBOSE=1 D:/c/mingw64/bin/mingw32-make.exe -f Makefile cmTC_c4c09/fast] + ignore line: [D:/c/mingw64/bin/mingw32-make.exe -f CMakeFiles\\cmTC_c4c09.dir\\build.make CMakeFiles/cmTC_c4c09.dir/build] + ignore line: [mingw32-make.exe[1]: Entering directory 'D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-r96baa'] + ignore line: [Building C object CMakeFiles/cmTC_c4c09.dir/CMakeCCompilerABI.c.obj] + ignore line: [D:\\c\\mingw64\\bin\\gcc.exe -v -o CMakeFiles\\cmTC_c4c09.dir\\CMakeCCompilerABI.c.obj -c D:\\cmake\\share\\cmake-3.30\\Modules\\CMakeCCompilerABI.c] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=D:\\c\\mingw64\\bin\\gcc.exe] + ignore line: [Target: x86_64-w64-mingw32] + ignore line: [Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-win32-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib '] + ignore line: [Thread model: win32] + ignore line: [gcc version 8.1.0 (x86_64-win32-seh-rev0 Built by MinGW-W64 project) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\\cmTC_c4c09.dir\\CMakeCCompilerABI.c.obj' '-c' '-mtune=core2' '-march=nocona'] + ignore line: [ D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/cc1.exe -quiet -v -iprefix D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/ -U_REENTRANT D:\\cmake\\share\\cmake-3.30\\Modules\\CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=core2 -march=nocona -auxbase-strip CMakeFiles\\cmTC_c4c09.dir\\CMakeCCompilerABI.c.obj -version -o C:\\Users\\OMEN\\AppData\\Local\\Temp\\ccPiSQIT.s] + ignore line: [GNU C17 (x86_64-win32-seh-rev0 Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32)] + ignore line: [ compiled by GNU C version 8.1.0 GMP version 6.1.2 MPFR version 4.0.1 MPC version 1.1.0 isl version isl-0.18-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include"] + ignore line: [ignoring nonexistent directory "C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../include"] + ignore line: [ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed"] + ignore line: [ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include"] + ignore line: [ignoring nonexistent directory "C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/mingw/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include] + ignore line: [ D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed] + ignore line: [ D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include] + ignore line: [End of search list.] + ignore line: [GNU C17 (x86_64-win32-seh-rev0 Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32)] + ignore line: [ compiled by GNU C version 8.1.0 GMP version 6.1.2 MPFR version 4.0.1 MPC version 1.1.0 isl version isl-0.18-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: bb117049c51d03d971e874cfcb35cac9] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\\cmTC_c4c09.dir\\CMakeCCompilerABI.c.obj' '-c' '-mtune=core2' '-march=nocona'] + ignore line: [ D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe -v -o CMakeFiles\\cmTC_c4c09.dir\\CMakeCCompilerABI.c.obj C:\\Users\\OMEN\\AppData\\Local\\Temp\\ccPiSQIT.s] + ignore line: [GNU assembler version 2.30 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.30] + ignore line: [COMPILER_PATH=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/] + ignore line: [D:/c/mingw64/bin/../libexec/gcc/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/] + ignore line: [LIBRARY_PATH=D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\\cmTC_c4c09.dir\\CMakeCCompilerABI.c.obj' '-c' '-mtune=core2' '-march=nocona'] + ignore line: [Linking C executable cmTC_c4c09.exe] + ignore line: [D:\\cmake\\bin\\cmake.exe -E cmake_link_script CMakeFiles\\cmTC_c4c09.dir\\link.txt --verbose=1] + ignore line: [D:\\cmake\\bin\\cmake.exe -E rm -f CMakeFiles\\cmTC_c4c09.dir/objects.a] + ignore line: [D:\\c\\mingw64\\bin\\ar.exe qc CMakeFiles\\cmTC_c4c09.dir/objects.a @CMakeFiles\\cmTC_c4c09.dir\\objects1.rsp] + ignore line: [D:\\c\\mingw64\\bin\\gcc.exe -v -Wl -v -Wl --whole-archive CMakeFiles\\cmTC_c4c09.dir/objects.a -Wl --no-whole-archive -o cmTC_c4c09.exe -Wl --out-implib libcmTC_c4c09.dll.a -Wl --major-image-version 0 --minor-image-version 0] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=D:\\c\\mingw64\\bin\\gcc.exe] + ignore line: [COLLECT_LTO_WRAPPER=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe] + ignore line: [Target: x86_64-w64-mingw32] + ignore line: [Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-win32-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib '] + ignore line: [Thread model: win32] + ignore line: [gcc version 8.1.0 (x86_64-win32-seh-rev0 Built by MinGW-W64 project) ] + ignore line: [COMPILER_PATH=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/] + ignore line: [D:/c/mingw64/bin/../libexec/gcc/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/] + ignore line: [LIBRARY_PATH=D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_c4c09.exe' '-mtune=core2' '-march=nocona'] + link line: [ D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/collect2.exe -plugin D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/liblto_plugin-0.dll -plugin-opt=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe -plugin-opt=-fresolution=C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc9S4M14.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-liconv -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt --sysroot=C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 -m i386pep -Bdynamic -o cmTC_c4c09.exe D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0 -LD:/c/mingw64/bin/../lib/gcc -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../.. -v --whole-archive CMakeFiles\\cmTC_c4c09.dir/objects.a --no-whole-archive --out-implib libcmTC_c4c09.dll.a --major-image-version 0 --minor-image-version 0 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -liconv -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] + arg [D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/collect2.exe] ==> ignore + arg [-plugin] ==> ignore + arg [D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/liblto_plugin-0.dll] ==> ignore + arg [-plugin-opt=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe] ==> ignore + arg [-plugin-opt=-fresolution=C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc9S4M14.res] ==> ignore + arg [-plugin-opt=-pass-through=-lmingw32] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_eh] ==> ignore + arg [-plugin-opt=-pass-through=-lmoldname] ==> ignore + arg [-plugin-opt=-pass-through=-lmingwex] ==> ignore + arg [-plugin-opt=-pass-through=-lmsvcrt] ==> ignore + arg [-plugin-opt=-pass-through=-ladvapi32] ==> ignore + arg [-plugin-opt=-pass-through=-lshell32] ==> ignore + arg [-plugin-opt=-pass-through=-luser32] ==> ignore + arg [-plugin-opt=-pass-through=-lkernel32] ==> ignore + arg [-plugin-opt=-pass-through=-liconv] ==> ignore + arg [-plugin-opt=-pass-through=-lmingw32] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_eh] ==> ignore + arg [-plugin-opt=-pass-through=-lmoldname] ==> ignore + arg [-plugin-opt=-pass-through=-lmingwex] ==> ignore + arg [-plugin-opt=-pass-through=-lmsvcrt] ==> ignore + arg [--sysroot=C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64] ==> ignore + arg [-m] ==> ignore + arg [i386pep] ==> ignore + arg [-Bdynamic] ==> search dynamic + arg [-o] ==> ignore + arg [cmTC_c4c09.exe] ==> ignore + arg [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o] ==> obj [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o] + arg [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o] ==> obj [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o] + arg [-LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0] ==> dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0] + arg [-LD:/c/mingw64/bin/../lib/gcc] ==> dir [D:/c/mingw64/bin/../lib/gcc] + arg [-LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib] ==> dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib] + arg [-LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib] ==> dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib] + arg [-LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib] ==> dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib] + arg [-LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../..] ==> dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../..] + arg [-v] ==> ignore + arg [--whole-archive] ==> ignore + arg [CMakeFiles\\cmTC_c4c09.dir/objects.a] ==> ignore + arg [--no-whole-archive] ==> ignore + arg [--out-implib] ==> ignore + arg [libcmTC_c4c09.dll.a] ==> ignore + arg [--major-image-version] ==> ignore + arg [0] ==> ignore + arg [--minor-image-version] ==> ignore + arg [0] ==> ignore + arg [-lmingw32] ==> lib [mingw32] + arg [-lgcc] ==> lib [gcc] + arg [-lgcc_eh] ==> lib [gcc_eh] + arg [-lmoldname] ==> lib [moldname] + arg [-lmingwex] ==> lib [mingwex] + arg [-lmsvcrt] ==> lib [msvcrt] + arg [-ladvapi32] ==> lib [advapi32] + arg [-lshell32] ==> lib [shell32] + arg [-luser32] ==> lib [user32] + arg [-lkernel32] ==> lib [kernel32] + arg [-liconv] ==> lib [iconv] + arg [-lmingw32] ==> lib [mingw32] + arg [-lgcc] ==> lib [gcc] + arg [-lgcc_eh] ==> lib [gcc_eh] + arg [-lmoldname] ==> lib [moldname] + arg [-lmingwex] ==> lib [mingwex] + arg [-lmsvcrt] ==> lib [msvcrt] + arg [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] ==> obj [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] + ignore line: [collect2 version 8.1.0] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe -plugin D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/liblto_plugin-0.dll -plugin-opt=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe -plugin-opt=-fresolution=C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc9S4M14.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-liconv -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt --sysroot=C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 -m i386pep -Bdynamic -o cmTC_c4c09.exe D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0 -LD:/c/mingw64/bin/../lib/gcc -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../.. -v --whole-archive CMakeFiles\\cmTC_c4c09.dir/objects.a --no-whole-archive --out-implib libcmTC_c4c09.dll.a --major-image-version 0 --minor-image-version 0 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -liconv -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] + linker tool for 'C': D:/c/mingw64/x86_64-w64-mingw32/bin/ld.exe + remove lib [gcc_eh] + remove lib [msvcrt] + remove lib [gcc_eh] + remove lib [msvcrt] + collapse obj [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o] ==> [D:/c/mingw64/x86_64-w64-mingw32/lib/crt2.o] + collapse obj [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o] ==> [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o] + collapse obj [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] ==> [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] + collapse library dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0] ==> [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0] + collapse library dir [D:/c/mingw64/bin/../lib/gcc] ==> [D:/c/mingw64/lib/gcc] + collapse library dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib] ==> [D:/c/mingw64/x86_64-w64-mingw32/lib] + collapse library dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib] ==> [D:/c/mingw64/lib] + collapse library dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib] ==> [D:/c/mingw64/x86_64-w64-mingw32/lib] + collapse library dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../..] ==> [D:/c/mingw64/lib] + implicit libs: [mingw32;gcc;moldname;mingwex;advapi32;shell32;user32;kernel32;iconv;mingw32;gcc;moldname;mingwex] + implicit objs: [D:/c/mingw64/x86_64-w64-mingw32/lib/crt2.o;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] + implicit dirs: [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0;D:/c/mingw64/lib/gcc;D:/c/mingw64/x86_64-w64-mingw32/lib;D:/c/mingw64/lib] + implicit fwks: [] + + + - + kind: "message-v1" + backtrace: + - "D:/cmake/share/cmake-3.30/Modules/Internal/CMakeDetermineLinkerId.cmake:40 (message)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCompilerABI.cmake:255 (cmake_determine_linker_id)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:2 (project)" + message: | + Running the C compiler's linker: "D:/c/mingw64/x86_64-w64-mingw32/bin/ld.exe" "-v" + GNU ld (GNU Binutils) 2.30 + - + kind: "try_compile-v1" + backtrace: + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCompilerABI.cmake:74 (try_compile)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:2 (project)" + checks: + - "Detecting CXX compiler ABI info" + directories: + source: "D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-ejot5b" + binary: "D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-ejot5b" + cmakeVariables: + CMAKE_CXX_FLAGS: "" + CMAKE_CXX_FLAGS_DEBUG: "-g" + CMAKE_CXX_SCAN_FOR_MODULES: "OFF" + CMAKE_EXE_LINKER_FLAGS: "" + buildResult: + variable: "CMAKE_CXX_ABI_COMPILED" + cached: true + stdout: | + Change Dir: 'D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-ejot5b' + + Run Build Command(s): D:/cmake/bin/cmake.exe -E env VERBOSE=1 D:/c/mingw64/bin/mingw32-make.exe -f Makefile cmTC_5c3f4/fast + D:/c/mingw64/bin/mingw32-make.exe -f CMakeFiles\\cmTC_5c3f4.dir\\build.make CMakeFiles/cmTC_5c3f4.dir/build + mingw32-make.exe[1]: Entering directory 'D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-ejot5b' + Building CXX object CMakeFiles/cmTC_5c3f4.dir/CMakeCXXCompilerABI.cpp.obj + D:\\c\\mingw64\\bin\\g++.exe -v -o CMakeFiles\\cmTC_5c3f4.dir\\CMakeCXXCompilerABI.cpp.obj -c D:\\cmake\\share\\cmake-3.30\\Modules\\CMakeCXXCompilerABI.cpp + Using built-in specs. + COLLECT_GCC=D:\\c\\mingw64\\bin\\g++.exe + Target: x86_64-w64-mingw32 + Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-win32-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib ' + Thread model: win32 + gcc version 8.1.0 (x86_64-win32-seh-rev0, Built by MinGW-W64 project) + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\\cmTC_5c3f4.dir\\CMakeCXXCompilerABI.cpp.obj' '-c' '-shared-libgcc' '-mtune=core2' '-march=nocona' + D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/cc1plus.exe -quiet -v -iprefix D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/ -U_REENTRANT D:\\cmake\\share\\cmake-3.30\\Modules\\CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=core2 -march=nocona -auxbase-strip CMakeFiles\\cmTC_5c3f4.dir\\CMakeCXXCompilerABI.cpp.obj -version -o C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc4jQ2pe.s + GNU C++14 (x86_64-win32-seh-rev0, Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32) + compiled by GNU C version 8.1.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP + + GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 + ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++" + ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32" + ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward" + ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include" + ignoring nonexistent directory "C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../include" + ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed" + ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include" + ignoring nonexistent directory "C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/mingw/include" + #include "..." search starts here: + #include <...> search starts here: + D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++ + D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32 + D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward + D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include + D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed + D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include + End of search list. + GNU C++14 (x86_64-win32-seh-rev0, Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32) + compiled by GNU C version 8.1.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP + + GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 + Compiler executable checksum: 768151575aea5e2fb63ae2dd7f500530 + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\\cmTC_5c3f4.dir\\CMakeCXXCompilerABI.cpp.obj' '-c' '-shared-libgcc' '-mtune=core2' '-march=nocona' + D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe -v -o CMakeFiles\\cmTC_5c3f4.dir\\CMakeCXXCompilerABI.cpp.obj C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc4jQ2pe.s + GNU assembler version 2.30 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.30 + COMPILER_PATH=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/;D:/c/mingw64/bin/../libexec/gcc/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ + LIBRARY_PATH=D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/;D:/c/mingw64/bin/../lib/gcc/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../ + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\\cmTC_5c3f4.dir\\CMakeCXXCompilerABI.cpp.obj' '-c' '-shared-libgcc' '-mtune=core2' '-march=nocona' + Linking CXX executable cmTC_5c3f4.exe + D:\\cmake\\bin\\cmake.exe -E cmake_link_script CMakeFiles\\cmTC_5c3f4.dir\\link.txt --verbose=1 + D:\\cmake\\bin\\cmake.exe -E rm -f CMakeFiles\\cmTC_5c3f4.dir/objects.a + D:\\c\\mingw64\\bin\\ar.exe qc CMakeFiles\\cmTC_5c3f4.dir/objects.a @CMakeFiles\\cmTC_5c3f4.dir\\objects1.rsp + D:\\c\\mingw64\\bin\\g++.exe -v -Wl,-v -Wl,--whole-archive CMakeFiles\\cmTC_5c3f4.dir/objects.a -Wl,--no-whole-archive -o cmTC_5c3f4.exe -Wl,--out-implib,libcmTC_5c3f4.dll.a -Wl,--major-image-version,0,--minor-image-version,0 + Using built-in specs. + COLLECT_GCC=D:\\c\\mingw64\\bin\\g++.exe + COLLECT_LTO_WRAPPER=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe + Target: x86_64-w64-mingw32 + Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-win32-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib ' + Thread model: win32 + gcc version 8.1.0 (x86_64-win32-seh-rev0, Built by MinGW-W64 project) + COMPILER_PATH=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/;D:/c/mingw64/bin/../libexec/gcc/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ + LIBRARY_PATH=D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/;D:/c/mingw64/bin/../lib/gcc/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/;D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../ + COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_5c3f4.exe' '-shared-libgcc' '-mtune=core2' '-march=nocona' + D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/collect2.exe -plugin D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/liblto_plugin-0.dll -plugin-opt=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe -plugin-opt=-fresolution=C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc2y9LGp.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-liconv -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt --sysroot=C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 -m i386pep -Bdynamic -o cmTC_5c3f4.exe D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0 -LD:/c/mingw64/bin/../lib/gcc -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../.. -v --whole-archive CMakeFiles\\cmTC_5c3f4.dir/objects.a --no-whole-archive --out-implib libcmTC_5c3f4.dll.a --major-image-version 0 --minor-image-version 0 -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -liconv -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o + collect2 version 8.1.0 + D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe -plugin D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/liblto_plugin-0.dll -plugin-opt=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe -plugin-opt=-fresolution=C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc2y9LGp.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-liconv -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt --sysroot=C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 -m i386pep -Bdynamic -o cmTC_5c3f4.exe D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0 -LD:/c/mingw64/bin/../lib/gcc -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../.. -v --whole-archive CMakeFiles\\cmTC_5c3f4.dir/objects.a --no-whole-archive --out-implib libcmTC_5c3f4.dll.a --major-image-version 0 --minor-image-version 0 -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -liconv -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o + GNU ld (GNU Binutils) 2.30 + COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_5c3f4.exe' '-shared-libgcc' '-mtune=core2' '-march=nocona' + mingw32-make.exe[1]: Leaving directory 'D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-ejot5b' + + exitCode: 0 + - + kind: "message-v1" + backtrace: + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCompilerABI.cmake:182 (message)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:2 (project)" + message: | + Parsed CXX implicit include dir info: rv=done + found start of include info + found start of implicit include info + add: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++] + add: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32] + add: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward] + add: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include] + add: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed] + add: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include] + end of search list found + collapse include dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++] ==> [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++] + collapse include dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32] ==> [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32] + collapse include dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward] ==> [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward] + collapse include dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include] ==> [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include] + collapse include dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed] ==> [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed] + collapse include dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include] ==> [D:/c/mingw64/x86_64-w64-mingw32/include] + implicit include dirs: [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed;D:/c/mingw64/x86_64-w64-mingw32/include] + + + - + kind: "message-v1" + backtrace: + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCompilerABI.cmake:218 (message)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:2 (project)" + message: | + Parsed CXX implicit link information: + link line regex: [^( *|.*[/\\])(ld[0-9]*(\\.[a-z]+)?|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)] + linker tool regex: [^[ ]*(->|")?[ ]*(([^"]*[/\\])?(ld[0-9]*(\\.[a-z]+)?))("|,| |$)] + ignore line: [Change Dir: 'D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-ejot5b'] + ignore line: [] + ignore line: [Run Build Command(s): D:/cmake/bin/cmake.exe -E env VERBOSE=1 D:/c/mingw64/bin/mingw32-make.exe -f Makefile cmTC_5c3f4/fast] + ignore line: [D:/c/mingw64/bin/mingw32-make.exe -f CMakeFiles\\cmTC_5c3f4.dir\\build.make CMakeFiles/cmTC_5c3f4.dir/build] + ignore line: [mingw32-make.exe[1]: Entering directory 'D:/c_work/start/build/CMakeFiles/CMakeScratch/TryCompile-ejot5b'] + ignore line: [Building CXX object CMakeFiles/cmTC_5c3f4.dir/CMakeCXXCompilerABI.cpp.obj] + ignore line: [D:\\c\\mingw64\\bin\\g++.exe -v -o CMakeFiles\\cmTC_5c3f4.dir\\CMakeCXXCompilerABI.cpp.obj -c D:\\cmake\\share\\cmake-3.30\\Modules\\CMakeCXXCompilerABI.cpp] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=D:\\c\\mingw64\\bin\\g++.exe] + ignore line: [Target: x86_64-w64-mingw32] + ignore line: [Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-win32-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib '] + ignore line: [Thread model: win32] + ignore line: [gcc version 8.1.0 (x86_64-win32-seh-rev0 Built by MinGW-W64 project) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\\cmTC_5c3f4.dir\\CMakeCXXCompilerABI.cpp.obj' '-c' '-shared-libgcc' '-mtune=core2' '-march=nocona'] + ignore line: [ D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/cc1plus.exe -quiet -v -iprefix D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/ -U_REENTRANT D:\\cmake\\share\\cmake-3.30\\Modules\\CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=core2 -march=nocona -auxbase-strip CMakeFiles\\cmTC_5c3f4.dir\\CMakeCXXCompilerABI.cpp.obj -version -o C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc4jQ2pe.s] + ignore line: [GNU C++14 (x86_64-win32-seh-rev0 Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32)] + ignore line: [ compiled by GNU C version 8.1.0 GMP version 6.1.2 MPFR version 4.0.1 MPC version 1.1.0 isl version isl-0.18-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++"] + ignore line: [ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32"] + ignore line: [ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward"] + ignore line: [ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include"] + ignore line: [ignoring nonexistent directory "C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../include"] + ignore line: [ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed"] + ignore line: [ignoring duplicate directory "D:/c/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include"] + ignore line: [ignoring nonexistent directory "C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/mingw/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++] + ignore line: [ D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32] + ignore line: [ D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward] + ignore line: [ D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include] + ignore line: [ D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed] + ignore line: [ D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include] + ignore line: [End of search list.] + ignore line: [GNU C++14 (x86_64-win32-seh-rev0 Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32)] + ignore line: [ compiled by GNU C version 8.1.0 GMP version 6.1.2 MPFR version 4.0.1 MPC version 1.1.0 isl version isl-0.18-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: 768151575aea5e2fb63ae2dd7f500530] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\\cmTC_5c3f4.dir\\CMakeCXXCompilerABI.cpp.obj' '-c' '-shared-libgcc' '-mtune=core2' '-march=nocona'] + ignore line: [ D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe -v -o CMakeFiles\\cmTC_5c3f4.dir\\CMakeCXXCompilerABI.cpp.obj C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc4jQ2pe.s] + ignore line: [GNU assembler version 2.30 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.30] + ignore line: [COMPILER_PATH=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/] + ignore line: [D:/c/mingw64/bin/../libexec/gcc/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/] + ignore line: [LIBRARY_PATH=D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\\cmTC_5c3f4.dir\\CMakeCXXCompilerABI.cpp.obj' '-c' '-shared-libgcc' '-mtune=core2' '-march=nocona'] + ignore line: [Linking CXX executable cmTC_5c3f4.exe] + ignore line: [D:\\cmake\\bin\\cmake.exe -E cmake_link_script CMakeFiles\\cmTC_5c3f4.dir\\link.txt --verbose=1] + ignore line: [D:\\cmake\\bin\\cmake.exe -E rm -f CMakeFiles\\cmTC_5c3f4.dir/objects.a] + ignore line: [D:\\c\\mingw64\\bin\\ar.exe qc CMakeFiles\\cmTC_5c3f4.dir/objects.a @CMakeFiles\\cmTC_5c3f4.dir\\objects1.rsp] + ignore line: [D:\\c\\mingw64\\bin\\g++.exe -v -Wl -v -Wl --whole-archive CMakeFiles\\cmTC_5c3f4.dir/objects.a -Wl --no-whole-archive -o cmTC_5c3f4.exe -Wl --out-implib libcmTC_5c3f4.dll.a -Wl --major-image-version 0 --minor-image-version 0] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=D:\\c\\mingw64\\bin\\g++.exe] + ignore line: [COLLECT_LTO_WRAPPER=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe] + ignore line: [Target: x86_64-w64-mingw32] + ignore line: [Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-win32-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib '] + ignore line: [Thread model: win32] + ignore line: [gcc version 8.1.0 (x86_64-win32-seh-rev0 Built by MinGW-W64 project) ] + ignore line: [COMPILER_PATH=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/] + ignore line: [D:/c/mingw64/bin/../libexec/gcc/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/] + ignore line: [LIBRARY_PATH=D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_5c3f4.exe' '-shared-libgcc' '-mtune=core2' '-march=nocona'] + link line: [ D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/collect2.exe -plugin D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/liblto_plugin-0.dll -plugin-opt=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe -plugin-opt=-fresolution=C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc2y9LGp.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-liconv -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt --sysroot=C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 -m i386pep -Bdynamic -o cmTC_5c3f4.exe D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0 -LD:/c/mingw64/bin/../lib/gcc -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../.. -v --whole-archive CMakeFiles\\cmTC_5c3f4.dir/objects.a --no-whole-archive --out-implib libcmTC_5c3f4.dll.a --major-image-version 0 --minor-image-version 0 -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -liconv -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] + arg [D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/collect2.exe] ==> ignore + arg [-plugin] ==> ignore + arg [D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/liblto_plugin-0.dll] ==> ignore + arg [-plugin-opt=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe] ==> ignore + arg [-plugin-opt=-fresolution=C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc2y9LGp.res] ==> ignore + arg [-plugin-opt=-pass-through=-lmingw32] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lmoldname] ==> ignore + arg [-plugin-opt=-pass-through=-lmingwex] ==> ignore + arg [-plugin-opt=-pass-through=-lmsvcrt] ==> ignore + arg [-plugin-opt=-pass-through=-ladvapi32] ==> ignore + arg [-plugin-opt=-pass-through=-lshell32] ==> ignore + arg [-plugin-opt=-pass-through=-luser32] ==> ignore + arg [-plugin-opt=-pass-through=-lkernel32] ==> ignore + arg [-plugin-opt=-pass-through=-liconv] ==> ignore + arg [-plugin-opt=-pass-through=-lmingw32] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lmoldname] ==> ignore + arg [-plugin-opt=-pass-through=-lmingwex] ==> ignore + arg [-plugin-opt=-pass-through=-lmsvcrt] ==> ignore + arg [--sysroot=C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64] ==> ignore + arg [-m] ==> ignore + arg [i386pep] ==> ignore + arg [-Bdynamic] ==> search dynamic + arg [-o] ==> ignore + arg [cmTC_5c3f4.exe] ==> ignore + arg [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o] ==> obj [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o] + arg [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o] ==> obj [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o] + arg [-LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0] ==> dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0] + arg [-LD:/c/mingw64/bin/../lib/gcc] ==> dir [D:/c/mingw64/bin/../lib/gcc] + arg [-LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib] ==> dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib] + arg [-LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib] ==> dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib] + arg [-LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib] ==> dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib] + arg [-LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../..] ==> dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../..] + arg [-v] ==> ignore + arg [--whole-archive] ==> ignore + arg [CMakeFiles\\cmTC_5c3f4.dir/objects.a] ==> ignore + arg [--no-whole-archive] ==> ignore + arg [--out-implib] ==> ignore + arg [libcmTC_5c3f4.dll.a] ==> ignore + arg [--major-image-version] ==> ignore + arg [0] ==> ignore + arg [--minor-image-version] ==> ignore + arg [0] ==> ignore + arg [-lstdc++] ==> lib [stdc++] + arg [-lmingw32] ==> lib [mingw32] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-lmoldname] ==> lib [moldname] + arg [-lmingwex] ==> lib [mingwex] + arg [-lmsvcrt] ==> lib [msvcrt] + arg [-ladvapi32] ==> lib [advapi32] + arg [-lshell32] ==> lib [shell32] + arg [-luser32] ==> lib [user32] + arg [-lkernel32] ==> lib [kernel32] + arg [-liconv] ==> lib [iconv] + arg [-lmingw32] ==> lib [mingw32] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-lmoldname] ==> lib [moldname] + arg [-lmingwex] ==> lib [mingwex] + arg [-lmsvcrt] ==> lib [msvcrt] + arg [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] ==> obj [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] + ignore line: [collect2 version 8.1.0] + ignore line: [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe -plugin D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/liblto_plugin-0.dll -plugin-opt=D:/c/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe -plugin-opt=-fresolution=C:\\Users\\OMEN\\AppData\\Local\\Temp\\cc2y9LGp.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-liconv -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt --sysroot=C:/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 -m i386pep -Bdynamic -o cmTC_5c3f4.exe D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0 -LD:/c/mingw64/bin/../lib/gcc -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib -LD:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../.. -v --whole-archive CMakeFiles\\cmTC_5c3f4.dir/objects.a --no-whole-archive --out-implib libcmTC_5c3f4.dll.a --major-image-version 0 --minor-image-version 0 -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -liconv -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] + linker tool for 'CXX': D:/c/mingw64/x86_64-w64-mingw32/bin/ld.exe + remove lib [msvcrt] + remove lib [msvcrt] + collapse obj [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o] ==> [D:/c/mingw64/x86_64-w64-mingw32/lib/crt2.o] + collapse obj [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o] ==> [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o] + collapse obj [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] ==> [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] + collapse library dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0] ==> [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0] + collapse library dir [D:/c/mingw64/bin/../lib/gcc] ==> [D:/c/mingw64/lib/gcc] + collapse library dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib] ==> [D:/c/mingw64/x86_64-w64-mingw32/lib] + collapse library dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib] ==> [D:/c/mingw64/lib] + collapse library dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib] ==> [D:/c/mingw64/x86_64-w64-mingw32/lib] + collapse library dir [D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../..] ==> [D:/c/mingw64/lib] + implicit libs: [stdc++;mingw32;gcc_s;gcc;moldname;mingwex;advapi32;shell32;user32;kernel32;iconv;mingw32;gcc_s;gcc;moldname;mingwex] + implicit objs: [D:/c/mingw64/x86_64-w64-mingw32/lib/crt2.o;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o;D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o] + implicit dirs: [D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0;D:/c/mingw64/lib/gcc;D:/c/mingw64/x86_64-w64-mingw32/lib;D:/c/mingw64/lib] + implicit fwks: [] + + + - + kind: "message-v1" + backtrace: + - "D:/cmake/share/cmake-3.30/Modules/Internal/CMakeDetermineLinkerId.cmake:40 (message)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeDetermineCompilerABI.cmake:255 (cmake_determine_linker_id)" + - "D:/cmake/share/cmake-3.30/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:2 (project)" + message: | + Running the CXX compiler's linker: "D:/c/mingw64/x86_64-w64-mingw32/bin/ld.exe" "-v" + GNU ld (GNU Binutils) 2.30 +... diff --git a/network/start/build_bak/CMakeFiles/CMakeDirectoryInformation.cmake b/network/start/build_bak/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..0738917 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "D:/c_work/start/xnet_tiny_c0101") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "D:/c_work/start/build") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/network/start/build_bak/CMakeFiles/Makefile.cmake b/network/start/build_bak/CMakeFiles/Makefile.cmake new file mode 100644 index 0000000..386bce1 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/Makefile.cmake @@ -0,0 +1,59 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# The generator used is: +set(CMAKE_DEPENDS_GENERATOR "MinGW Makefiles") + +# The top level Makefile was generated from the following files: +set(CMAKE_MAKEFILE_DEPENDS + "CMakeCache.txt" + "CMakeFiles/3.30.3/CMakeCCompiler.cmake" + "CMakeFiles/3.30.3/CMakeCXXCompiler.cmake" + "CMakeFiles/3.30.3/CMakeRCCompiler.cmake" + "CMakeFiles/3.30.3/CMakeSystem.cmake" + "D:/c_work/start/xnet_tiny_c0101/CMakeLists.txt" + "D:/c_work/start/xnet_tiny_c0101/src/xnet_app/CMakeLists.txt" + "D:/c_work/start/xnet_tiny_c0101/src/xnet_tiny/CMakeLists.txt" + "D:/cmake/share/cmake-3.30/Modules/CMakeCInformation.cmake" + "D:/cmake/share/cmake-3.30/Modules/CMakeCXXInformation.cmake" + "D:/cmake/share/cmake-3.30/Modules/CMakeCommonLanguageInclude.cmake" + "D:/cmake/share/cmake-3.30/Modules/CMakeGenericSystem.cmake" + "D:/cmake/share/cmake-3.30/Modules/CMakeInitializeConfigs.cmake" + "D:/cmake/share/cmake-3.30/Modules/CMakeLanguageInformation.cmake" + "D:/cmake/share/cmake-3.30/Modules/CMakeRCInformation.cmake" + "D:/cmake/share/cmake-3.30/Modules/CMakeSystemSpecificInformation.cmake" + "D:/cmake/share/cmake-3.30/Modules/CMakeSystemSpecificInitialize.cmake" + "D:/cmake/share/cmake-3.30/Modules/Compiler/CMakeCommonCompilerMacros.cmake" + "D:/cmake/share/cmake-3.30/Modules/Compiler/GNU-C.cmake" + "D:/cmake/share/cmake-3.30/Modules/Compiler/GNU-CXX.cmake" + "D:/cmake/share/cmake-3.30/Modules/Compiler/GNU.cmake" + "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-GNU-C-ABI.cmake" + "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-GNU-C.cmake" + "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-GNU-CXX-ABI.cmake" + "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-GNU-CXX.cmake" + "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-GNU.cmake" + "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-Initialize.cmake" + "D:/cmake/share/cmake-3.30/Modules/Platform/Windows-windres.cmake" + "D:/cmake/share/cmake-3.30/Modules/Platform/Windows.cmake" + "D:/cmake/share/cmake-3.30/Modules/Platform/WindowsPaths.cmake" + ) + +# The corresponding makefile is: +set(CMAKE_MAKEFILE_OUTPUTS + "Makefile" + "CMakeFiles/cmake.check_cache" + ) + +# Byproducts of CMake generate step: +set(CMAKE_MAKEFILE_PRODUCTS + "CMakeFiles/CMakeDirectoryInformation.cmake" + "src/xnet_tiny/CMakeFiles/CMakeDirectoryInformation.cmake" + "src/xnet_app/CMakeFiles/CMakeDirectoryInformation.cmake" + ) + +# Dependency information for all targets: +set(CMAKE_DEPEND_INFO_FILES + "CMakeFiles/xnet.dir/DependInfo.cmake" + "src/xnet_tiny/CMakeFiles/xnet_tiny.dir/DependInfo.cmake" + "src/xnet_app/CMakeFiles/xnet_app.dir/DependInfo.cmake" + ) diff --git a/network/start/build_bak/CMakeFiles/Makefile2 b/network/start/build_bak/CMakeFiles/Makefile2 new file mode 100644 index 0000000..bc3baed --- /dev/null +++ b/network/start/build_bak/CMakeFiles/Makefile2 @@ -0,0 +1,199 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +SHELL = cmd.exe + +# The CMake executable. +CMAKE_COMMAND = D:\cmake\bin\cmake.exe + +# The command to remove a file. +RM = D:\cmake\bin\cmake.exe -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = D:\c_work\start\xnet_tiny_c0101 + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = D:\c_work\start\build + +#============================================================================= +# Directory level rules for the build root directory + +# The main recursive "all" target. +all: CMakeFiles/xnet.dir/all +all: src/xnet_tiny/all +all: src/xnet_app/all +.PHONY : all + +# The main recursive "preinstall" target. +preinstall: src/xnet_tiny/preinstall +preinstall: src/xnet_app/preinstall +.PHONY : preinstall + +# The main recursive "clean" target. +clean: CMakeFiles/xnet.dir/clean +clean: src/xnet_tiny/clean +clean: src/xnet_app/clean +.PHONY : clean + +#============================================================================= +# Directory level rules for directory src/xnet_app + +# Recursive "all" directory target. +src/xnet_app/all: src/xnet_app/CMakeFiles/xnet_app.dir/all +.PHONY : src/xnet_app/all + +# Recursive "preinstall" directory target. +src/xnet_app/preinstall: +.PHONY : src/xnet_app/preinstall + +# Recursive "clean" directory target. +src/xnet_app/clean: src/xnet_app/CMakeFiles/xnet_app.dir/clean +.PHONY : src/xnet_app/clean + +#============================================================================= +# Directory level rules for directory src/xnet_tiny + +# Recursive "all" directory target. +src/xnet_tiny/all: src/xnet_tiny/CMakeFiles/xnet_tiny.dir/all +.PHONY : src/xnet_tiny/all + +# Recursive "preinstall" directory target. +src/xnet_tiny/preinstall: +.PHONY : src/xnet_tiny/preinstall + +# Recursive "clean" directory target. +src/xnet_tiny/clean: src/xnet_tiny/CMakeFiles/xnet_tiny.dir/clean +.PHONY : src/xnet_tiny/clean + +#============================================================================= +# Target rules for target CMakeFiles/xnet.dir + +# All Build rule for target. +CMakeFiles/xnet.dir/all: src/xnet_tiny/CMakeFiles/xnet_tiny.dir/all +CMakeFiles/xnet.dir/all: src/xnet_app/CMakeFiles/xnet_app.dir/all + $(MAKE) $(MAKESILENT) -f CMakeFiles\xnet.dir\build.make CMakeFiles/xnet.dir/depend + $(MAKE) $(MAKESILENT) -f CMakeFiles\xnet.dir\build.make CMakeFiles/xnet.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=D:\c_work\start\build\CMakeFiles --progress-num=1,2,3 "Built target xnet" +.PHONY : CMakeFiles/xnet.dir/all + +# Build rule for subdir invocation for target. +CMakeFiles/xnet.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start D:\c_work\start\build\CMakeFiles 9 + $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 CMakeFiles/xnet.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start D:\c_work\start\build\CMakeFiles 0 +.PHONY : CMakeFiles/xnet.dir/rule + +# Convenience name for target. +xnet: CMakeFiles/xnet.dir/rule +.PHONY : xnet + +# clean rule for target. +CMakeFiles/xnet.dir/clean: + $(MAKE) $(MAKESILENT) -f CMakeFiles\xnet.dir\build.make CMakeFiles/xnet.dir/clean +.PHONY : CMakeFiles/xnet.dir/clean + +#============================================================================= +# Target rules for target src/xnet_tiny/CMakeFiles/xnet_tiny.dir + +# All Build rule for target. +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/all: + $(MAKE) $(MAKESILENT) -f src\xnet_tiny\CMakeFiles\xnet_tiny.dir\build.make src/xnet_tiny/CMakeFiles/xnet_tiny.dir/depend + $(MAKE) $(MAKESILENT) -f src\xnet_tiny\CMakeFiles\xnet_tiny.dir\build.make src/xnet_tiny/CMakeFiles/xnet_tiny.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=D:\c_work\start\build\CMakeFiles --progress-num=8,9 "Built target xnet_tiny" +.PHONY : src/xnet_tiny/CMakeFiles/xnet_tiny.dir/all + +# Build rule for subdir invocation for target. +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start D:\c_work\start\build\CMakeFiles 2 + $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 src/xnet_tiny/CMakeFiles/xnet_tiny.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start D:\c_work\start\build\CMakeFiles 0 +.PHONY : src/xnet_tiny/CMakeFiles/xnet_tiny.dir/rule + +# Convenience name for target. +xnet_tiny: src/xnet_tiny/CMakeFiles/xnet_tiny.dir/rule +.PHONY : xnet_tiny + +# clean rule for target. +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/clean: + $(MAKE) $(MAKESILENT) -f src\xnet_tiny\CMakeFiles\xnet_tiny.dir\build.make src/xnet_tiny/CMakeFiles/xnet_tiny.dir/clean +.PHONY : src/xnet_tiny/CMakeFiles/xnet_tiny.dir/clean + +#============================================================================= +# Target rules for target src/xnet_app/CMakeFiles/xnet_app.dir + +# All Build rule for target. +src/xnet_app/CMakeFiles/xnet_app.dir/all: + $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/depend + $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=D:\c_work\start\build\CMakeFiles --progress-num=4,5,6,7 "Built target xnet_app" +.PHONY : src/xnet_app/CMakeFiles/xnet_app.dir/all + +# Build rule for subdir invocation for target. +src/xnet_app/CMakeFiles/xnet_app.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start D:\c_work\start\build\CMakeFiles 4 + $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 src/xnet_app/CMakeFiles/xnet_app.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start D:\c_work\start\build\CMakeFiles 0 +.PHONY : src/xnet_app/CMakeFiles/xnet_app.dir/rule + +# Convenience name for target. +xnet_app: src/xnet_app/CMakeFiles/xnet_app.dir/rule +.PHONY : xnet_app + +# clean rule for target. +src/xnet_app/CMakeFiles/xnet_app.dir/clean: + $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/clean +.PHONY : src/xnet_app/CMakeFiles/xnet_app.dir/clean + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/network/start/build_bak/CMakeFiles/TargetDirectories.txt b/network/start/build_bak/CMakeFiles/TargetDirectories.txt new file mode 100644 index 0000000..63ecc9d --- /dev/null +++ b/network/start/build_bak/CMakeFiles/TargetDirectories.txt @@ -0,0 +1,9 @@ +D:/c_work/start/build/CMakeFiles/xnet.dir +D:/c_work/start/build/CMakeFiles/edit_cache.dir +D:/c_work/start/build/CMakeFiles/rebuild_cache.dir +D:/c_work/start/build/src/xnet_tiny/CMakeFiles/xnet_tiny.dir +D:/c_work/start/build/src/xnet_tiny/CMakeFiles/edit_cache.dir +D:/c_work/start/build/src/xnet_tiny/CMakeFiles/rebuild_cache.dir +D:/c_work/start/build/src/xnet_app/CMakeFiles/xnet_app.dir +D:/c_work/start/build/src/xnet_app/CMakeFiles/edit_cache.dir +D:/c_work/start/build/src/xnet_app/CMakeFiles/rebuild_cache.dir diff --git a/network/start/build_bak/CMakeFiles/cmake.check_cache b/network/start/build_bak/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000..56c437b --- /dev/null +++ b/network/start/build_bak/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/network/start/build_bak/CMakeFiles/progress.marks b/network/start/build_bak/CMakeFiles/progress.marks new file mode 100644 index 0000000..3b0923b --- /dev/null +++ b/network/start/build_bak/CMakeFiles/progress.marks @@ -0,0 +1 @@ +9 diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj b/network/start/build_bak/CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj new file mode 100644 index 0000000..6f26d41 Binary files /dev/null and b/network/start/build_bak/CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj differ diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj.d b/network/start/build_bak/CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj.d new file mode 100644 index 0000000..897c1e4 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj.d @@ -0,0 +1,262 @@ +CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj: \ + D:\c_work\start\lib\xnet\pcap_device.c \ + D:/c/mingw64/x86_64-w64-mingw32/include/memory.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/crtdefs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_mac.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_secapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/vadefs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sdks/_mingw_directx.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sdks/_mingw_ddk.h \ + D:\c_work\start\lib\xnet\pcap_device.h \ + D:/c_work/start/lib/npcap/Include/pcap.h \ + D:/c_work/start/lib/npcap/Include/pcap/pcap.h \ + D:/c_work/start/lib/npcap/Include/pcap/funcattrs.h \ + D:/c_work/start/lib/npcap/Include/pcap/compiler-tests.h \ + D:/c_work/start/lib/npcap/Include/pcap/pcap-inttypes.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/inttypes.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/stdint.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stdint.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/stddef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stddef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_print_push.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_print_pop.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winsock2.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_unicode.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/windows.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sdkddkver.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/excpt.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/stdarg.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stdarg.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_stdarg.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/windef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/minwindef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winapifamily.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/specstrings.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sal.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/driverspecs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winnt.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ctype.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/apiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/intrin-impl.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/basetsd.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/guiddef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/string.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sec_api/string_s.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/x86intrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/ia32intrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/mmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xmmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/mm_malloc.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stdlib.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed/limits.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed/syslimits.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/limits.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sec_api/stdlib_s.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/malloc.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/errno.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/emmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/pmmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/ammintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/smmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/popcntintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/wmmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/immintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avxintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx2intrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512fintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512erintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512pfintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512cdintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vlintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512bwintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512dqintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vlbwintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vldqintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512ifmaintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512ifmavlintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vbmiintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vbmivlintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx5124fmapsintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx5124vnniwintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vpopcntdqintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vbmi2intrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vbmi2vlintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vnniintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vnnivlintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vpopcntdqvlintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512bitalgintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/shaintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/lzcntintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/bmiintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/bmi2intrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/fmaintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/f16cintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/rtmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xtestintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/cetintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/gfniintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/vaesintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/vpclmulqdqintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/movdirintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/mm3dnow.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/prfchwintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/fma4intrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xopintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/lwpintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tbmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/rdseedintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/fxsrintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xsaveintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xsaveoptintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/sgxintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/pconfigintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/adxintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/clwbintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/clflushoptintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xsavesintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xsavecintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/mwaitxintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/clzerointrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/wbnoinvdintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/pkuintrin.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack4.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/poppack.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack4.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack2.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/poppack.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack2.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack8.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack8.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ktmtypes.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winbase.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/apisetcconv.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/minwinbase.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/bemapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/debugapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/errhandlingapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/fibersapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/fileapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/handleapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/heapapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ioapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/interlockedapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/jobapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/libloaderapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/memoryapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/namedpipeapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/namespaceapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/processenv.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/processthreadsapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/processtopologyapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/profileapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/realtimeapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/securityappcontainer.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/securitybaseapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/synchapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sysinfoapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/systemtopologyapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/threadpoolapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/threadpoollegacyapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/utilapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wow64apiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winerror.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/fltwinerror.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/timezoneapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wingdi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack1.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winuser.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/tvout.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winnls.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/datetimeapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stringapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wincon.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winver.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winreg.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/reason.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winnetwk.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wnnc.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/virtdisk.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/cderr.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/dde.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ddeml.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/dlgs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/lzexpand.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/mmsystem.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/nb30.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpc.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcdce.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcdcep.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcnsi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcnterr.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcasync.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/shellapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winperf.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winsock.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wincrypt.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/bcrypt.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ncrypt.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/dpapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winefs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winscard.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wtypes.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcndr.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcnsip.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcsal.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ole2.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/objbase.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/combaseapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wtypesbase.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/unknwnbase.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/objidlbase.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/cguid.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/objidl.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/unknwn.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/urlmon.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/oleidl.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/servprov.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/msxml.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/oaidl.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/propidl.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/oleauto.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winioctl.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winsmcrd.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winspool.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/prsht.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/commdlg.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stralign.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sec_api/stralign_s.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winsvc.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/mcx.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/imm.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_ws1_undef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_timeval.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_bsd_types.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/inaddr.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_socket_types.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_fd_types.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_ip_types.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_wsadata.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ws2def.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_wsa_errnos.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/qos.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/io.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_off_t.h \ + D:/c_work/start/lib/npcap/Include/pcap/socket.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ws2tcpip.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ws2ipdef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/in6addr.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_ip_mreq1.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/mstcpip.h \ + D:/c_work/start/lib/npcap/Include/pcap/bpf.h \ + D:/c_work/start/lib/npcap/Include/pcap/dlt.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stdio.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/swprintf.inl \ + D:/c/mingw64/x86_64-w64-mingw32/include/sec_api/stdio_s.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/tchar.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sec_api/tchar_s.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/time.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sys/timeb.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sec_api/sys/timeb_s.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pthread_time.h diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/DependInfo.cmake b/network/start/build_bak/CMakeFiles/xnet.dir/DependInfo.cmake new file mode 100644 index 0000000..075c9fc --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/DependInfo.cmake @@ -0,0 +1,24 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "D:/c_work/start/lib/xnet/pcap_device.c" "CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj" "gcc" "CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj.d" + "D:/c_work/start/xnet_tiny_c0101/src/app.c" "CMakeFiles/xnet.dir/src/app.c.obj" "gcc" "CMakeFiles/xnet.dir/src/app.c.obj.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/build.make b/network/start/build_bak/CMakeFiles/xnet.dir/build.make new file mode 100644 index 0000000..e304797 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/build.make @@ -0,0 +1,132 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +SHELL = cmd.exe + +# The CMake executable. +CMAKE_COMMAND = D:\cmake\bin\cmake.exe + +# The command to remove a file. +RM = D:\cmake\bin\cmake.exe -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = D:\c_work\start\xnet_tiny_c0101 + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = D:\c_work\start\build + +# Include any dependencies generated for this target. +include CMakeFiles/xnet.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include CMakeFiles/xnet.dir/compiler_depend.make + +# Include the progress variables for this target. +include CMakeFiles/xnet.dir/progress.make + +# Include the compile flags for this target's objects. +include CMakeFiles/xnet.dir/flags.make + +CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj: CMakeFiles/xnet.dir/flags.make +CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj: CMakeFiles/xnet.dir/includes_C.rsp +CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj: D:/c_work/start/lib/xnet/pcap_device.c +CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj: CMakeFiles/xnet.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=D:\c_work\start\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj" + D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj -MF CMakeFiles\xnet.dir\D_\c_work\start\lib\xnet\pcap_device.c.obj.d -o CMakeFiles\xnet.dir\D_\c_work\start\lib\xnet\pcap_device.c.obj -c D:\c_work\start\lib\xnet\pcap_device.c + +CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing C source to CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.i" + D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E D:\c_work\start\lib\xnet\pcap_device.c > CMakeFiles\xnet.dir\D_\c_work\start\lib\xnet\pcap_device.c.i + +CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling C source to assembly CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.s" + D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S D:\c_work\start\lib\xnet\pcap_device.c -o CMakeFiles\xnet.dir\D_\c_work\start\lib\xnet\pcap_device.c.s + +CMakeFiles/xnet.dir/src/app.c.obj: CMakeFiles/xnet.dir/flags.make +CMakeFiles/xnet.dir/src/app.c.obj: CMakeFiles/xnet.dir/includes_C.rsp +CMakeFiles/xnet.dir/src/app.c.obj: D:/c_work/start/xnet_tiny_c0101/src/app.c +CMakeFiles/xnet.dir/src/app.c.obj: CMakeFiles/xnet.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=D:\c_work\start\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building C object CMakeFiles/xnet.dir/src/app.c.obj" + D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/xnet.dir/src/app.c.obj -MF CMakeFiles\xnet.dir\src\app.c.obj.d -o CMakeFiles\xnet.dir\src\app.c.obj -c D:\c_work\start\xnet_tiny_c0101\src\app.c + +CMakeFiles/xnet.dir/src/app.c.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing C source to CMakeFiles/xnet.dir/src/app.c.i" + D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E D:\c_work\start\xnet_tiny_c0101\src\app.c > CMakeFiles\xnet.dir\src\app.c.i + +CMakeFiles/xnet.dir/src/app.c.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling C source to assembly CMakeFiles/xnet.dir/src/app.c.s" + D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S D:\c_work\start\xnet_tiny_c0101\src\app.c -o CMakeFiles\xnet.dir\src\app.c.s + +# Object files for target xnet +xnet_OBJECTS = \ +"CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj" \ +"CMakeFiles/xnet.dir/src/app.c.obj" + +# External object files for target xnet +xnet_EXTERNAL_OBJECTS = + +xnet.exe: CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj +xnet.exe: CMakeFiles/xnet.dir/src/app.c.obj +xnet.exe: CMakeFiles/xnet.dir/build.make +xnet.exe: src/xnet_tiny/libxnet_tiny.a +xnet.exe: src/xnet_app/libxnet_app.a +xnet.exe: D:/c_work/start/xnet_tiny_c0101/../lib/npcap/Lib/x64/wpcap.lib +xnet.exe: CMakeFiles/xnet.dir/linkLibs.rsp +xnet.exe: CMakeFiles/xnet.dir/objects1.rsp +xnet.exe: CMakeFiles/xnet.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=D:\c_work\start\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Linking C executable xnet.exe" + $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles\xnet.dir\link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +CMakeFiles/xnet.dir/build: xnet.exe +.PHONY : CMakeFiles/xnet.dir/build + +CMakeFiles/xnet.dir/clean: + $(CMAKE_COMMAND) -P CMakeFiles\xnet.dir\cmake_clean.cmake +.PHONY : CMakeFiles/xnet.dir/clean + +CMakeFiles/xnet.dir/depend: + $(CMAKE_COMMAND) -E cmake_depends "MinGW Makefiles" D:\c_work\start\xnet_tiny_c0101 D:\c_work\start\xnet_tiny_c0101 D:\c_work\start\build D:\c_work\start\build D:\c_work\start\build\CMakeFiles\xnet.dir\DependInfo.cmake "--color=$(COLOR)" +.PHONY : CMakeFiles/xnet.dir/depend + diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/cmake_clean.cmake b/network/start/build_bak/CMakeFiles/xnet.dir/cmake_clean.cmake new file mode 100644 index 0000000..898a505 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/cmake_clean.cmake @@ -0,0 +1,15 @@ +file(REMOVE_RECURSE + "CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj" + "CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj.d" + "CMakeFiles/xnet.dir/src/app.c.obj" + "CMakeFiles/xnet.dir/src/app.c.obj.d" + "libxnet.dll.a" + "xnet.exe" + "xnet.exe.manifest" + "xnet.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang C) + include(CMakeFiles/xnet.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/compiler_depend.make b/network/start/build_bak/CMakeFiles/xnet.dir/compiler_depend.make new file mode 100644 index 0000000..72ceb60 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for xnet. +# This may be replaced when dependencies are built. diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/compiler_depend.ts b/network/start/build_bak/CMakeFiles/xnet.dir/compiler_depend.ts new file mode 100644 index 0000000..55187f6 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for xnet. diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/depend.make b/network/start/build_bak/CMakeFiles/xnet.dir/depend.make new file mode 100644 index 0000000..e7685e2 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for xnet. +# This may be replaced when dependencies are built. diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/flags.make b/network/start/build_bak/CMakeFiles/xnet.dir/flags.make new file mode 100644 index 0000000..8629850 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# compile C with D:/c/mingw64/bin/gcc.exe +C_DEFINES = -DNET_DRIVER_PCAP -D_CRT_SECURE_NO_WARNINGS + +C_INCLUDES = @CMakeFiles/xnet.dir/includes_C.rsp + +C_FLAGS = -g -g + diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/includes_C.rsp b/network/start/build_bak/CMakeFiles/xnet.dir/includes_C.rsp new file mode 100644 index 0000000..125d588 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/includes_C.rsp @@ -0,0 +1 @@ +-ID:/c_work/start/xnet_tiny_c0101 -ID:/c_work/start/xnet_tiny_c0101/../lib/npcap/Include -ID:/c_work/start/xnet_tiny_c0101/src/xnet_app -ID:/c_work/start/xnet_tiny_c0101/src/xnet_tiny -ID:/c_work/start/xnet_tiny_c0101/../lib/xnet diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/link.txt b/network/start/build_bak/CMakeFiles/xnet.dir/link.txt new file mode 100644 index 0000000..b32edee --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/link.txt @@ -0,0 +1,3 @@ +D:\cmake\bin\cmake.exe -E rm -f CMakeFiles\xnet.dir/objects.a +D:\c\mingw64\bin\ar.exe qc CMakeFiles\xnet.dir/objects.a @CMakeFiles\xnet.dir\objects1.rsp +D:\c\mingw64\bin\gcc.exe -g -Wl,--whole-archive CMakeFiles\xnet.dir/objects.a -Wl,--no-whole-archive -o xnet.exe -Wl,--out-implib,libxnet.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\xnet.dir\linkLibs.rsp diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/linkLibs.rsp b/network/start/build_bak/CMakeFiles/xnet.dir/linkLibs.rsp new file mode 100644 index 0000000..f81a4ad --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/linkLibs.rsp @@ -0,0 +1 @@ + -LD:/c_work/start/xnet_tiny_c0101/../lib/npcap/Lib/x64 src/xnet_tiny/libxnet_tiny.a src/xnet_app/libxnet_app.a D:/c_work/start/xnet_tiny_c0101/../lib/npcap/Lib/x64/wpcap.lib -lWs2_32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/objects.a b/network/start/build_bak/CMakeFiles/xnet.dir/objects.a new file mode 100644 index 0000000..b031693 Binary files /dev/null and b/network/start/build_bak/CMakeFiles/xnet.dir/objects.a differ diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/objects1.rsp b/network/start/build_bak/CMakeFiles/xnet.dir/objects1.rsp new file mode 100644 index 0000000..426a35f --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/objects1.rsp @@ -0,0 +1 @@ +CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj CMakeFiles/xnet.dir/src/app.c.obj diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/progress.make b/network/start/build_bak/CMakeFiles/xnet.dir/progress.make new file mode 100644 index 0000000..59d2674 --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/progress.make @@ -0,0 +1,4 @@ +CMAKE_PROGRESS_1 = 1 +CMAKE_PROGRESS_2 = 2 +CMAKE_PROGRESS_3 = 3 + diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/src/app.c.obj b/network/start/build_bak/CMakeFiles/xnet.dir/src/app.c.obj new file mode 100644 index 0000000..76d0b25 Binary files /dev/null and b/network/start/build_bak/CMakeFiles/xnet.dir/src/app.c.obj differ diff --git a/network/start/build_bak/CMakeFiles/xnet.dir/src/app.c.obj.d b/network/start/build_bak/CMakeFiles/xnet.dir/src/app.c.obj.d new file mode 100644 index 0000000..1ce5c8f --- /dev/null +++ b/network/start/build_bak/CMakeFiles/xnet.dir/src/app.c.obj.d @@ -0,0 +1,20 @@ +CMakeFiles/xnet.dir/src/app.c.obj: \ + D:\c_work\start\xnet_tiny_c0101\src\app.c \ + D:/c/mingw64/x86_64-w64-mingw32/include/stdio.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/crtdefs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_mac.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_secapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/vadefs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sdks/_mingw_directx.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sdks/_mingw_ddk.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_print_push.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_off_t.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/swprintf.inl \ + D:/c/mingw64/x86_64-w64-mingw32/include/sec_api/stdio_s.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_print_pop.h \ + D:/c_work/start/xnet_tiny_c0101/src/xnet_tiny/xnet_tiny.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/stdint.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stdint.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/stddef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stddef.h diff --git a/network/start/build_bak/Makefile b/network/start/build_bak/Makefile new file mode 100644 index 0000000..af94b43 --- /dev/null +++ b/network/start/build_bak/Makefile @@ -0,0 +1,235 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +SHELL = cmd.exe + +# The CMake executable. +CMAKE_COMMAND = D:\cmake\bin\cmake.exe + +# The command to remove a file. +RM = D:\cmake\bin\cmake.exe -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = D:\c_work\start\xnet_tiny_c0101 + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = D:\c_work\start\build + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake cache editor..." + D:\cmake\bin\cmake-gui.exe -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + D:\cmake\bin\cmake.exe --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# The main all target +all: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start D:\c_work\start\build\CMakeFiles D:\c_work\start\build\\CMakeFiles\progress.marks + $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 all + $(CMAKE_COMMAND) -E cmake_progress_start D:\c_work\start\build\CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 1 +.PHONY : depend + +#============================================================================= +# Target rules for targets named xnet + +# Build rule for target. +xnet: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 xnet +.PHONY : xnet + +# fast build rule for target. +xnet/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles\xnet.dir\build.make CMakeFiles/xnet.dir/build +.PHONY : xnet/fast + +#============================================================================= +# Target rules for targets named xnet_tiny + +# Build rule for target. +xnet_tiny: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 xnet_tiny +.PHONY : xnet_tiny + +# fast build rule for target. +xnet_tiny/fast: + $(MAKE) $(MAKESILENT) -f src\xnet_tiny\CMakeFiles\xnet_tiny.dir\build.make src/xnet_tiny/CMakeFiles/xnet_tiny.dir/build +.PHONY : xnet_tiny/fast + +#============================================================================= +# Target rules for targets named xnet_app + +# Build rule for target. +xnet_app: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 xnet_app +.PHONY : xnet_app + +# fast build rule for target. +xnet_app/fast: + $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/build +.PHONY : xnet_app/fast + +D_/c_work/start/lib/xnet/pcap_device.obj: D_/c_work/start/lib/xnet/pcap_device.c.obj +.PHONY : D_/c_work/start/lib/xnet/pcap_device.obj + +# target to build an object file +D_/c_work/start/lib/xnet/pcap_device.c.obj: + $(MAKE) $(MAKESILENT) -f CMakeFiles\xnet.dir\build.make CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj +.PHONY : D_/c_work/start/lib/xnet/pcap_device.c.obj + +D_/c_work/start/lib/xnet/pcap_device.i: D_/c_work/start/lib/xnet/pcap_device.c.i +.PHONY : D_/c_work/start/lib/xnet/pcap_device.i + +# target to preprocess a source file +D_/c_work/start/lib/xnet/pcap_device.c.i: + $(MAKE) $(MAKESILENT) -f CMakeFiles\xnet.dir\build.make CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.i +.PHONY : D_/c_work/start/lib/xnet/pcap_device.c.i + +D_/c_work/start/lib/xnet/pcap_device.s: D_/c_work/start/lib/xnet/pcap_device.c.s +.PHONY : D_/c_work/start/lib/xnet/pcap_device.s + +# target to generate assembly for a file +D_/c_work/start/lib/xnet/pcap_device.c.s: + $(MAKE) $(MAKESILENT) -f CMakeFiles\xnet.dir\build.make CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.s +.PHONY : D_/c_work/start/lib/xnet/pcap_device.c.s + +src/app.obj: src/app.c.obj +.PHONY : src/app.obj + +# target to build an object file +src/app.c.obj: + $(MAKE) $(MAKESILENT) -f CMakeFiles\xnet.dir\build.make CMakeFiles/xnet.dir/src/app.c.obj +.PHONY : src/app.c.obj + +src/app.i: src/app.c.i +.PHONY : src/app.i + +# target to preprocess a source file +src/app.c.i: + $(MAKE) $(MAKESILENT) -f CMakeFiles\xnet.dir\build.make CMakeFiles/xnet.dir/src/app.c.i +.PHONY : src/app.c.i + +src/app.s: src/app.c.s +.PHONY : src/app.s + +# target to generate assembly for a file +src/app.c.s: + $(MAKE) $(MAKESILENT) -f CMakeFiles\xnet.dir\build.make CMakeFiles/xnet.dir/src/app.c.s +.PHONY : src/app.c.s + +# Help Target +help: + @echo The following are some of the valid targets for this Makefile: + @echo ... all (the default if no target is provided) + @echo ... clean + @echo ... depend + @echo ... edit_cache + @echo ... rebuild_cache + @echo ... xnet + @echo ... xnet_app + @echo ... xnet_tiny + @echo ... D_/c_work/start/lib/xnet/pcap_device.obj + @echo ... D_/c_work/start/lib/xnet/pcap_device.i + @echo ... D_/c_work/start/lib/xnet/pcap_device.s + @echo ... src/app.obj + @echo ... src/app.i + @echo ... src/app.s +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/network/start/build_bak/cmake_install.cmake b/network/start/build_bak/cmake_install.cmake new file mode 100644 index 0000000..bae73f2 --- /dev/null +++ b/network/start/build_bak/cmake_install.cmake @@ -0,0 +1,64 @@ +# Install script for directory: D:/c_work/start/xnet_tiny_c0101 + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/xnet") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "Debug") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set path to fallback-tool for dependency-resolution. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "D:/c/mingw64/bin/objdump.exe") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for each subdirectory. + include("D:/c_work/start/build/src/xnet_tiny/cmake_install.cmake") + include("D:/c_work/start/build/src/xnet_app/cmake_install.cmake") + +endif() + +if(CMAKE_INSTALL_COMPONENT) + if(CMAKE_INSTALL_COMPONENT MATCHES "^[a-zA-Z0-9_.+-]+$") + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") + else() + string(MD5 CMAKE_INST_COMP_HASH "${CMAKE_INSTALL_COMPONENT}") + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INST_COMP_HASH}.txt") + unset(CMAKE_INST_COMP_HASH) + endif() +else() + set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT + "${CMAKE_INSTALL_MANIFEST_FILES}") + file(WRITE "D:/c_work/start/build/${CMAKE_INSTALL_MANIFEST}" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") +endif() diff --git a/network/start/build_bak/compile_commands.json b/network/start/build_bak/compile_commands.json new file mode 100644 index 0000000..618b3a2 --- /dev/null +++ b/network/start/build_bak/compile_commands.json @@ -0,0 +1,38 @@ +[ +{ + "directory": "D:/c_work/start/build", + "command": "D:\\c\\mingw64\\bin\\gcc.exe -DNET_DRIVER_PCAP -D_CRT_SECURE_NO_WARNINGS @CMakeFiles/xnet.dir/includes_C.rsp -g -g -o CMakeFiles\\xnet.dir\\D_\\c_work\\start\\lib\\xnet\\pcap_device.c.obj -c D:\\c_work\\start\\lib\\xnet\\pcap_device.c", + "file": "D:/c_work/start/lib/xnet/pcap_device.c", + "output": "CMakeFiles/xnet.dir/D_/c_work/start/lib/xnet/pcap_device.c.obj" +}, +{ + "directory": "D:/c_work/start/build", + "command": "D:\\c\\mingw64\\bin\\gcc.exe -DNET_DRIVER_PCAP -D_CRT_SECURE_NO_WARNINGS @CMakeFiles/xnet.dir/includes_C.rsp -g -g -o CMakeFiles\\xnet.dir\\src\\app.c.obj -c D:\\c_work\\start\\xnet_tiny_c0101\\src\\app.c", + "file": "D:/c_work/start/xnet_tiny_c0101/src/app.c", + "output": "CMakeFiles/xnet.dir/src/app.c.obj" +}, +{ + "directory": "D:/c_work/start/build/src/xnet_tiny", + "command": "D:\\c\\mingw64\\bin\\gcc.exe -D_CRT_SECURE_NO_WARNINGS @CMakeFiles/xnet_tiny.dir/includes_C.rsp -g -g -o CMakeFiles\\xnet_tiny.dir\\xnet_tiny.c.obj -c D:\\c_work\\start\\xnet_tiny_c0101\\src\\xnet_tiny\\xnet_tiny.c", + "file": "D:/c_work/start/xnet_tiny_c0101/src/xnet_tiny/xnet_tiny.c", + "output": "src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj" +}, +{ + "directory": "D:/c_work/start/build/src/xnet_app", + "command": "D:\\c\\mingw64\\bin\\gcc.exe -D_CRT_SECURE_NO_WARNINGS @CMakeFiles/xnet_app.dir/includes_C.rsp -g -g -o CMakeFiles\\xnet_app.dir\\port_pcap.c.obj -c D:\\c_work\\start\\xnet_tiny_c0101\\src\\xnet_app\\port_pcap.c", + "file": "D:/c_work/start/xnet_tiny_c0101/src/xnet_app/port_pcap.c", + "output": "src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj" +}, +{ + "directory": "D:/c_work/start/build/src/xnet_app", + "command": "D:\\c\\mingw64\\bin\\gcc.exe -D_CRT_SECURE_NO_WARNINGS @CMakeFiles/xnet_app.dir/includes_C.rsp -g -g -o CMakeFiles\\xnet_app.dir\\xserver_datetime.c.obj -c D:\\c_work\\start\\xnet_tiny_c0101\\src\\xnet_app\\xserver_datetime.c", + "file": "D:/c_work/start/xnet_tiny_c0101/src/xnet_app/xserver_datetime.c", + "output": "src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj" +}, +{ + "directory": "D:/c_work/start/build/src/xnet_app", + "command": "D:\\c\\mingw64\\bin\\gcc.exe -D_CRT_SECURE_NO_WARNINGS @CMakeFiles/xnet_app.dir/includes_C.rsp -g -g -o CMakeFiles\\xnet_app.dir\\xserver_http.c.obj -c D:\\c_work\\start\\xnet_tiny_c0101\\src\\xnet_app\\xserver_http.c", + "file": "D:/c_work/start/xnet_tiny_c0101/src/xnet_app/xserver_http.c", + "output": "src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj" +} +] \ No newline at end of file diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/CMakeDirectoryInformation.cmake b/network/start/build_bak/src/xnet_app/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..0738917 --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "D:/c_work/start/xnet_tiny_c0101") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "D:/c_work/start/build") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/progress.marks b/network/start/build_bak/src/xnet_app/CMakeFiles/progress.marks new file mode 100644 index 0000000..e0e1028 --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/progress.marks @@ -0,0 +1 @@ +4 diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/DependInfo.cmake b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/DependInfo.cmake new file mode 100644 index 0000000..3c675db --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/DependInfo.cmake @@ -0,0 +1,25 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "D:/c_work/start/xnet_tiny_c0101/src/xnet_app/port_pcap.c" "src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj" "gcc" "src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj.d" + "D:/c_work/start/xnet_tiny_c0101/src/xnet_app/xserver_datetime.c" "src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj" "gcc" "src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj.d" + "D:/c_work/start/xnet_tiny_c0101/src/xnet_app/xserver_http.c" "src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj" "gcc" "src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/build.make b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/build.make new file mode 100644 index 0000000..d26c2d2 --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/build.make @@ -0,0 +1,145 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +SHELL = cmd.exe + +# The CMake executable. +CMAKE_COMMAND = D:\cmake\bin\cmake.exe + +# The command to remove a file. +RM = D:\cmake\bin\cmake.exe -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = D:\c_work\start\xnet_tiny_c0101 + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = D:\c_work\start\build + +# Include any dependencies generated for this target. +include src/xnet_app/CMakeFiles/xnet_app.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include src/xnet_app/CMakeFiles/xnet_app.dir/compiler_depend.make + +# Include the progress variables for this target. +include src/xnet_app/CMakeFiles/xnet_app.dir/progress.make + +# Include the compile flags for this target's objects. +include src/xnet_app/CMakeFiles/xnet_app.dir/flags.make + +src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj: src/xnet_app/CMakeFiles/xnet_app.dir/flags.make +src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj: src/xnet_app/CMakeFiles/xnet_app.dir/includes_C.rsp +src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj: D:/c_work/start/xnet_tiny_c0101/src/xnet_app/port_pcap.c +src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj: src/xnet_app/CMakeFiles/xnet_app.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=D:\c_work\start\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj" + cd /d D:\c_work\start\build\src\xnet_app && D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj -MF CMakeFiles\xnet_app.dir\port_pcap.c.obj.d -o CMakeFiles\xnet_app.dir\port_pcap.c.obj -c D:\c_work\start\xnet_tiny_c0101\src\xnet_app\port_pcap.c + +src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing C source to CMakeFiles/xnet_app.dir/port_pcap.c.i" + cd /d D:\c_work\start\build\src\xnet_app && D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E D:\c_work\start\xnet_tiny_c0101\src\xnet_app\port_pcap.c > CMakeFiles\xnet_app.dir\port_pcap.c.i + +src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling C source to assembly CMakeFiles/xnet_app.dir/port_pcap.c.s" + cd /d D:\c_work\start\build\src\xnet_app && D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S D:\c_work\start\xnet_tiny_c0101\src\xnet_app\port_pcap.c -o CMakeFiles\xnet_app.dir\port_pcap.c.s + +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj: src/xnet_app/CMakeFiles/xnet_app.dir/flags.make +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj: src/xnet_app/CMakeFiles/xnet_app.dir/includes_C.rsp +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj: D:/c_work/start/xnet_tiny_c0101/src/xnet_app/xserver_datetime.c +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj: src/xnet_app/CMakeFiles/xnet_app.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=D:\c_work\start\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building C object src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj" + cd /d D:\c_work\start\build\src\xnet_app && D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj -MF CMakeFiles\xnet_app.dir\xserver_datetime.c.obj.d -o CMakeFiles\xnet_app.dir\xserver_datetime.c.obj -c D:\c_work\start\xnet_tiny_c0101\src\xnet_app\xserver_datetime.c + +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing C source to CMakeFiles/xnet_app.dir/xserver_datetime.c.i" + cd /d D:\c_work\start\build\src\xnet_app && D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E D:\c_work\start\xnet_tiny_c0101\src\xnet_app\xserver_datetime.c > CMakeFiles\xnet_app.dir\xserver_datetime.c.i + +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling C source to assembly CMakeFiles/xnet_app.dir/xserver_datetime.c.s" + cd /d D:\c_work\start\build\src\xnet_app && D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S D:\c_work\start\xnet_tiny_c0101\src\xnet_app\xserver_datetime.c -o CMakeFiles\xnet_app.dir\xserver_datetime.c.s + +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj: src/xnet_app/CMakeFiles/xnet_app.dir/flags.make +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj: src/xnet_app/CMakeFiles/xnet_app.dir/includes_C.rsp +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj: D:/c_work/start/xnet_tiny_c0101/src/xnet_app/xserver_http.c +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj: src/xnet_app/CMakeFiles/xnet_app.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=D:\c_work\start\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Building C object src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj" + cd /d D:\c_work\start\build\src\xnet_app && D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj -MF CMakeFiles\xnet_app.dir\xserver_http.c.obj.d -o CMakeFiles\xnet_app.dir\xserver_http.c.obj -c D:\c_work\start\xnet_tiny_c0101\src\xnet_app\xserver_http.c + +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing C source to CMakeFiles/xnet_app.dir/xserver_http.c.i" + cd /d D:\c_work\start\build\src\xnet_app && D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E D:\c_work\start\xnet_tiny_c0101\src\xnet_app\xserver_http.c > CMakeFiles\xnet_app.dir\xserver_http.c.i + +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling C source to assembly CMakeFiles/xnet_app.dir/xserver_http.c.s" + cd /d D:\c_work\start\build\src\xnet_app && D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S D:\c_work\start\xnet_tiny_c0101\src\xnet_app\xserver_http.c -o CMakeFiles\xnet_app.dir\xserver_http.c.s + +# Object files for target xnet_app +xnet_app_OBJECTS = \ +"CMakeFiles/xnet_app.dir/port_pcap.c.obj" \ +"CMakeFiles/xnet_app.dir/xserver_datetime.c.obj" \ +"CMakeFiles/xnet_app.dir/xserver_http.c.obj" + +# External object files for target xnet_app +xnet_app_EXTERNAL_OBJECTS = + +src/xnet_app/libxnet_app.a: src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj +src/xnet_app/libxnet_app.a: src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj +src/xnet_app/libxnet_app.a: src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj +src/xnet_app/libxnet_app.a: src/xnet_app/CMakeFiles/xnet_app.dir/build.make +src/xnet_app/libxnet_app.a: src/xnet_app/CMakeFiles/xnet_app.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=D:\c_work\start\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_4) "Linking C static library libxnet_app.a" + cd /d D:\c_work\start\build\src\xnet_app && $(CMAKE_COMMAND) -P CMakeFiles\xnet_app.dir\cmake_clean_target.cmake + cd /d D:\c_work\start\build\src\xnet_app && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles\xnet_app.dir\link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +src/xnet_app/CMakeFiles/xnet_app.dir/build: src/xnet_app/libxnet_app.a +.PHONY : src/xnet_app/CMakeFiles/xnet_app.dir/build + +src/xnet_app/CMakeFiles/xnet_app.dir/clean: + cd /d D:\c_work\start\build\src\xnet_app && $(CMAKE_COMMAND) -P CMakeFiles\xnet_app.dir\cmake_clean.cmake +.PHONY : src/xnet_app/CMakeFiles/xnet_app.dir/clean + +src/xnet_app/CMakeFiles/xnet_app.dir/depend: + $(CMAKE_COMMAND) -E cmake_depends "MinGW Makefiles" D:\c_work\start\xnet_tiny_c0101 D:\c_work\start\xnet_tiny_c0101\src\xnet_app D:\c_work\start\build D:\c_work\start\build\src\xnet_app D:\c_work\start\build\src\xnet_app\CMakeFiles\xnet_app.dir\DependInfo.cmake "--color=$(COLOR)" +.PHONY : src/xnet_app/CMakeFiles/xnet_app.dir/depend + diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/cmake_clean.cmake b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/cmake_clean.cmake new file mode 100644 index 0000000..e5643b1 --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/cmake_clean.cmake @@ -0,0 +1,15 @@ +file(REMOVE_RECURSE + "CMakeFiles/xnet_app.dir/port_pcap.c.obj" + "CMakeFiles/xnet_app.dir/port_pcap.c.obj.d" + "CMakeFiles/xnet_app.dir/xserver_datetime.c.obj" + "CMakeFiles/xnet_app.dir/xserver_datetime.c.obj.d" + "CMakeFiles/xnet_app.dir/xserver_http.c.obj" + "CMakeFiles/xnet_app.dir/xserver_http.c.obj.d" + "libxnet_app.a" + "libxnet_app.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang C) + include(CMakeFiles/xnet_app.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/cmake_clean_target.cmake b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/cmake_clean_target.cmake new file mode 100644 index 0000000..841a0b2 --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/cmake_clean_target.cmake @@ -0,0 +1,3 @@ +file(REMOVE_RECURSE + "libxnet_app.a" +) diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/compiler_depend.make b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/compiler_depend.make new file mode 100644 index 0000000..2ac752f --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for xnet_app. +# This may be replaced when dependencies are built. diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/compiler_depend.ts b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/compiler_depend.ts new file mode 100644 index 0000000..76f965d --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for xnet_app. diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/depend.make b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/depend.make new file mode 100644 index 0000000..1456f42 --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for xnet_app. +# This may be replaced when dependencies are built. diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/flags.make b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/flags.make new file mode 100644 index 0000000..795d65c --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# compile C with D:/c/mingw64/bin/gcc.exe +C_DEFINES = -D_CRT_SECURE_NO_WARNINGS + +C_INCLUDES = @CMakeFiles/xnet_app.dir/includes_C.rsp + +C_FLAGS = -g -g + diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/includes_C.rsp b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/includes_C.rsp new file mode 100644 index 0000000..125d588 --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/includes_C.rsp @@ -0,0 +1 @@ +-ID:/c_work/start/xnet_tiny_c0101 -ID:/c_work/start/xnet_tiny_c0101/../lib/npcap/Include -ID:/c_work/start/xnet_tiny_c0101/src/xnet_app -ID:/c_work/start/xnet_tiny_c0101/src/xnet_tiny -ID:/c_work/start/xnet_tiny_c0101/../lib/xnet diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/link.txt b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/link.txt new file mode 100644 index 0000000..a1fbc75 --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/link.txt @@ -0,0 +1,2 @@ +D:\c\mingw64\bin\ar.exe qc libxnet_app.a CMakeFiles/xnet_app.dir/port_pcap.c.obj CMakeFiles/xnet_app.dir/xserver_datetime.c.obj CMakeFiles/xnet_app.dir/xserver_http.c.obj +D:\c\mingw64\bin\ranlib.exe libxnet_app.a diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj new file mode 100644 index 0000000..0736c52 Binary files /dev/null and b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj differ diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj.d b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj.d new file mode 100644 index 0000000..f9471f1 --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj.d @@ -0,0 +1,255 @@ +src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj: \ + D:\c_work\start\xnet_tiny_c0101\src\xnet_app\port_pcap.c \ + D:/c/mingw64/x86_64-w64-mingw32/include/string.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/crtdefs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_mac.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_secapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/vadefs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sdks/_mingw_directx.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sdks/_mingw_ddk.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sec_api/string_s.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stdlib.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed/limits.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed/syslimits.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/limits.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sec_api/stdlib_s.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/malloc.h \ + D:/c_work/start/lib/xnet/pcap_device.h \ + D:/c_work/start/lib/npcap/Include/pcap.h \ + D:/c_work/start/lib/npcap/Include/pcap/pcap.h \ + D:/c_work/start/lib/npcap/Include/pcap/funcattrs.h \ + D:/c_work/start/lib/npcap/Include/pcap/compiler-tests.h \ + D:/c_work/start/lib/npcap/Include/pcap/pcap-inttypes.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/inttypes.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/stdint.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stdint.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/stddef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stddef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_print_push.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_print_pop.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winsock2.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_unicode.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/windows.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sdkddkver.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/excpt.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/stdarg.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stdarg.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_stdarg.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/windef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/minwindef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winapifamily.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/specstrings.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sal.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/driverspecs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winnt.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ctype.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/apiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/intrin-impl.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/basetsd.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/guiddef.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/x86intrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/ia32intrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/mmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xmmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/mm_malloc.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/emmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/pmmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/ammintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/smmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/popcntintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/wmmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/immintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avxintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx2intrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512fintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512erintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512pfintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512cdintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vlintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512bwintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512dqintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vlbwintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vldqintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512ifmaintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512ifmavlintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vbmiintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vbmivlintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx5124fmapsintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx5124vnniwintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vpopcntdqintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vbmi2intrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vbmi2vlintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vnniintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vnnivlintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512vpopcntdqvlintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/avx512bitalgintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/shaintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/lzcntintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/bmiintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/bmi2intrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/fmaintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/f16cintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/rtmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xtestintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/cetintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/gfniintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/vaesintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/vpclmulqdqintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/movdirintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/mm3dnow.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/prfchwintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/fma4intrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xopintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/lwpintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tbmintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/rdseedintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/fxsrintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xsaveintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xsaveoptintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/sgxintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/pconfigintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/adxintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/clwbintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/clflushoptintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xsavesintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/xsavecintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/mwaitxintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/clzerointrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/wbnoinvdintrin.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/pkuintrin.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack4.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/poppack.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack4.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack2.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/poppack.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack2.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack8.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack8.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ktmtypes.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winbase.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/apisetcconv.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/minwinbase.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/bemapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/debugapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/errhandlingapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/fibersapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/fileapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/handleapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/heapapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ioapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/interlockedapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/jobapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/libloaderapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/memoryapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/namedpipeapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/namespaceapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/processenv.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/processthreadsapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/processtopologyapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/profileapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/realtimeapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/securityappcontainer.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/securitybaseapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/synchapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sysinfoapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/systemtopologyapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/threadpoolapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/threadpoollegacyapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/utilapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wow64apiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winerror.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/fltwinerror.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/timezoneapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wingdi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/pshpack1.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winuser.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/tvout.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winnls.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/datetimeapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stringapiset.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wincon.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winver.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winreg.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/reason.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winnetwk.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wnnc.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/virtdisk.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/cderr.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/dde.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ddeml.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/dlgs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/lzexpand.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/mmsystem.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/nb30.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpc.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcdce.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcdcep.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcnsi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcnterr.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcasync.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/shellapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winperf.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winsock.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wincrypt.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/bcrypt.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ncrypt.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/dpapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winefs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winscard.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wtypes.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcndr.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcnsip.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/rpcsal.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ole2.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/objbase.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/combaseapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/wtypesbase.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/unknwnbase.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/objidlbase.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/cguid.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/objidl.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/unknwn.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/urlmon.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/oleidl.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/servprov.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/msxml.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/oaidl.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/propidl.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/oleauto.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winioctl.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winsmcrd.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winspool.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/prsht.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/commdlg.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stralign.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sec_api/stralign_s.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/winsvc.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/mcx.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/imm.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_ws1_undef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_timeval.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_bsd_types.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/inaddr.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_socket_types.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_fd_types.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_ip_types.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_wsadata.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ws2def.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_wsa_errnos.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/qos.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/io.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_off_t.h \ + D:/c_work/start/lib/npcap/Include/pcap/socket.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ws2tcpip.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/ws2ipdef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/in6addr.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/psdk_inc/_ip_mreq1.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/mstcpip.h \ + D:/c_work/start/lib/npcap/Include/pcap/bpf.h \ + D:/c_work/start/lib/npcap/Include/pcap/dlt.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stdio.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/swprintf.inl \ + D:/c/mingw64/x86_64-w64-mingw32/include/sec_api/stdio_s.h \ + D:/c_work/start/xnet_tiny_c0101/src/xnet_tiny/xnet_tiny.h diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/progress.make b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/progress.make new file mode 100644 index 0000000..39d3499 --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/progress.make @@ -0,0 +1,5 @@ +CMAKE_PROGRESS_1 = 4 +CMAKE_PROGRESS_2 = 5 +CMAKE_PROGRESS_3 = 6 +CMAKE_PROGRESS_4 = 7 + diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj new file mode 100644 index 0000000..89cb462 Binary files /dev/null and b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj differ diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj.d b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj.d new file mode 100644 index 0000000..552005c --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj.d @@ -0,0 +1,2 @@ +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj: \ + D:\c_work\start\xnet_tiny_c0101\src\xnet_app\xserver_datetime.c diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj new file mode 100644 index 0000000..3527a74 Binary files /dev/null and b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj differ diff --git a/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj.d b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj.d new file mode 100644 index 0000000..8eef2d0 --- /dev/null +++ b/network/start/build_bak/src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj.d @@ -0,0 +1,2 @@ +src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj: \ + D:\c_work\start\xnet_tiny_c0101\src\xnet_app\xserver_http.c diff --git a/network/start/build_bak/src/xnet_app/Makefile b/network/start/build_bak/src/xnet_app/Makefile new file mode 100644 index 0000000..8a1e6f6 --- /dev/null +++ b/network/start/build_bak/src/xnet_app/Makefile @@ -0,0 +1,235 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +SHELL = cmd.exe + +# The CMake executable. +CMAKE_COMMAND = D:\cmake\bin\cmake.exe + +# The command to remove a file. +RM = D:\cmake\bin\cmake.exe -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = D:\c_work\start\xnet_tiny_c0101 + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = D:\c_work\start\build + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake cache editor..." + D:\cmake\bin\cmake-gui.exe -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + D:\cmake\bin\cmake.exe --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# The main all target +all: cmake_check_build_system + cd /d D:\c_work\start\build && $(CMAKE_COMMAND) -E cmake_progress_start D:\c_work\start\build\CMakeFiles D:\c_work\start\build\src\xnet_app\\CMakeFiles\progress.marks + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 src/xnet_app/all + $(CMAKE_COMMAND) -E cmake_progress_start D:\c_work\start\build\CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 src/xnet_app/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 src/xnet_app/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 src/xnet_app/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /d D:\c_work\start\build && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 1 +.PHONY : depend + +# Convenience name for target. +src/xnet_app/CMakeFiles/xnet_app.dir/rule: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 src/xnet_app/CMakeFiles/xnet_app.dir/rule +.PHONY : src/xnet_app/CMakeFiles/xnet_app.dir/rule + +# Convenience name for target. +xnet_app: src/xnet_app/CMakeFiles/xnet_app.dir/rule +.PHONY : xnet_app + +# fast build rule for target. +xnet_app/fast: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/build +.PHONY : xnet_app/fast + +port_pcap.obj: port_pcap.c.obj +.PHONY : port_pcap.obj + +# target to build an object file +port_pcap.c.obj: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.obj +.PHONY : port_pcap.c.obj + +port_pcap.i: port_pcap.c.i +.PHONY : port_pcap.i + +# target to preprocess a source file +port_pcap.c.i: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.i +.PHONY : port_pcap.c.i + +port_pcap.s: port_pcap.c.s +.PHONY : port_pcap.s + +# target to generate assembly for a file +port_pcap.c.s: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/port_pcap.c.s +.PHONY : port_pcap.c.s + +xserver_datetime.obj: xserver_datetime.c.obj +.PHONY : xserver_datetime.obj + +# target to build an object file +xserver_datetime.c.obj: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.obj +.PHONY : xserver_datetime.c.obj + +xserver_datetime.i: xserver_datetime.c.i +.PHONY : xserver_datetime.i + +# target to preprocess a source file +xserver_datetime.c.i: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.i +.PHONY : xserver_datetime.c.i + +xserver_datetime.s: xserver_datetime.c.s +.PHONY : xserver_datetime.s + +# target to generate assembly for a file +xserver_datetime.c.s: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/xserver_datetime.c.s +.PHONY : xserver_datetime.c.s + +xserver_http.obj: xserver_http.c.obj +.PHONY : xserver_http.obj + +# target to build an object file +xserver_http.c.obj: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.obj +.PHONY : xserver_http.c.obj + +xserver_http.i: xserver_http.c.i +.PHONY : xserver_http.i + +# target to preprocess a source file +xserver_http.c.i: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.i +.PHONY : xserver_http.c.i + +xserver_http.s: xserver_http.c.s +.PHONY : xserver_http.s + +# target to generate assembly for a file +xserver_http.c.s: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_app\CMakeFiles\xnet_app.dir\build.make src/xnet_app/CMakeFiles/xnet_app.dir/xserver_http.c.s +.PHONY : xserver_http.c.s + +# Help Target +help: + @echo The following are some of the valid targets for this Makefile: + @echo ... all (the default if no target is provided) + @echo ... clean + @echo ... depend + @echo ... edit_cache + @echo ... rebuild_cache + @echo ... xnet_app + @echo ... port_pcap.obj + @echo ... port_pcap.i + @echo ... port_pcap.s + @echo ... xserver_datetime.obj + @echo ... xserver_datetime.i + @echo ... xserver_datetime.s + @echo ... xserver_http.obj + @echo ... xserver_http.i + @echo ... xserver_http.s +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /d D:\c_work\start\build && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/network/start/build_bak/src/xnet_app/cmake_install.cmake b/network/start/build_bak/src/xnet_app/cmake_install.cmake new file mode 100644 index 0000000..01ba90a --- /dev/null +++ b/network/start/build_bak/src/xnet_app/cmake_install.cmake @@ -0,0 +1,39 @@ +# Install script for directory: D:/c_work/start/xnet_tiny_c0101/src/xnet_app + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/xnet") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "Debug") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set path to fallback-tool for dependency-resolution. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "D:/c/mingw64/bin/objdump.exe") +endif() + diff --git a/network/start/build_bak/src/xnet_app/libxnet_app.a b/network/start/build_bak/src/xnet_app/libxnet_app.a new file mode 100644 index 0000000..c348ce3 Binary files /dev/null and b/network/start/build_bak/src/xnet_app/libxnet_app.a differ diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/CMakeDirectoryInformation.cmake b/network/start/build_bak/src/xnet_tiny/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..0738917 --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "D:/c_work/start/xnet_tiny_c0101") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "D:/c_work/start/build") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/progress.marks b/network/start/build_bak/src/xnet_tiny/CMakeFiles/progress.marks new file mode 100644 index 0000000..78c6bae --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/progress.marks @@ -0,0 +1 @@ +2 diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/DependInfo.cmake b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/DependInfo.cmake new file mode 100644 index 0000000..53fae15 --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/DependInfo.cmake @@ -0,0 +1,23 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "D:/c_work/start/xnet_tiny_c0101/src/xnet_tiny/xnet_tiny.c" "src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj" "gcc" "src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/build.make b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/build.make new file mode 100644 index 0000000..79270c8 --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/build.make @@ -0,0 +1,111 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +SHELL = cmd.exe + +# The CMake executable. +CMAKE_COMMAND = D:\cmake\bin\cmake.exe + +# The command to remove a file. +RM = D:\cmake\bin\cmake.exe -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = D:\c_work\start\xnet_tiny_c0101 + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = D:\c_work\start\build + +# Include any dependencies generated for this target. +include src/xnet_tiny/CMakeFiles/xnet_tiny.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include src/xnet_tiny/CMakeFiles/xnet_tiny.dir/compiler_depend.make + +# Include the progress variables for this target. +include src/xnet_tiny/CMakeFiles/xnet_tiny.dir/progress.make + +# Include the compile flags for this target's objects. +include src/xnet_tiny/CMakeFiles/xnet_tiny.dir/flags.make + +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj: src/xnet_tiny/CMakeFiles/xnet_tiny.dir/flags.make +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj: src/xnet_tiny/CMakeFiles/xnet_tiny.dir/includes_C.rsp +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj: D:/c_work/start/xnet_tiny_c0101/src/xnet_tiny/xnet_tiny.c +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj: src/xnet_tiny/CMakeFiles/xnet_tiny.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=D:\c_work\start\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj" + cd /d D:\c_work\start\build\src\xnet_tiny && D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj -MF CMakeFiles\xnet_tiny.dir\xnet_tiny.c.obj.d -o CMakeFiles\xnet_tiny.dir\xnet_tiny.c.obj -c D:\c_work\start\xnet_tiny_c0101\src\xnet_tiny\xnet_tiny.c + +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing C source to CMakeFiles/xnet_tiny.dir/xnet_tiny.c.i" + cd /d D:\c_work\start\build\src\xnet_tiny && D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E D:\c_work\start\xnet_tiny_c0101\src\xnet_tiny\xnet_tiny.c > CMakeFiles\xnet_tiny.dir\xnet_tiny.c.i + +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling C source to assembly CMakeFiles/xnet_tiny.dir/xnet_tiny.c.s" + cd /d D:\c_work\start\build\src\xnet_tiny && D:\c\mingw64\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S D:\c_work\start\xnet_tiny_c0101\src\xnet_tiny\xnet_tiny.c -o CMakeFiles\xnet_tiny.dir\xnet_tiny.c.s + +# Object files for target xnet_tiny +xnet_tiny_OBJECTS = \ +"CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj" + +# External object files for target xnet_tiny +xnet_tiny_EXTERNAL_OBJECTS = + +src/xnet_tiny/libxnet_tiny.a: src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj +src/xnet_tiny/libxnet_tiny.a: src/xnet_tiny/CMakeFiles/xnet_tiny.dir/build.make +src/xnet_tiny/libxnet_tiny.a: src/xnet_tiny/CMakeFiles/xnet_tiny.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=D:\c_work\start\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking C static library libxnet_tiny.a" + cd /d D:\c_work\start\build\src\xnet_tiny && $(CMAKE_COMMAND) -P CMakeFiles\xnet_tiny.dir\cmake_clean_target.cmake + cd /d D:\c_work\start\build\src\xnet_tiny && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles\xnet_tiny.dir\link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/build: src/xnet_tiny/libxnet_tiny.a +.PHONY : src/xnet_tiny/CMakeFiles/xnet_tiny.dir/build + +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/clean: + cd /d D:\c_work\start\build\src\xnet_tiny && $(CMAKE_COMMAND) -P CMakeFiles\xnet_tiny.dir\cmake_clean.cmake +.PHONY : src/xnet_tiny/CMakeFiles/xnet_tiny.dir/clean + +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/depend: + $(CMAKE_COMMAND) -E cmake_depends "MinGW Makefiles" D:\c_work\start\xnet_tiny_c0101 D:\c_work\start\xnet_tiny_c0101\src\xnet_tiny D:\c_work\start\build D:\c_work\start\build\src\xnet_tiny D:\c_work\start\build\src\xnet_tiny\CMakeFiles\xnet_tiny.dir\DependInfo.cmake "--color=$(COLOR)" +.PHONY : src/xnet_tiny/CMakeFiles/xnet_tiny.dir/depend + diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/cmake_clean.cmake b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/cmake_clean.cmake new file mode 100644 index 0000000..7556306 --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj" + "CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj.d" + "libxnet_tiny.a" + "libxnet_tiny.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang C) + include(CMakeFiles/xnet_tiny.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/cmake_clean_target.cmake b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/cmake_clean_target.cmake new file mode 100644 index 0000000..657a0a1 --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/cmake_clean_target.cmake @@ -0,0 +1,3 @@ +file(REMOVE_RECURSE + "libxnet_tiny.a" +) diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/compiler_depend.make b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/compiler_depend.make new file mode 100644 index 0000000..81a5e23 --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for xnet_tiny. +# This may be replaced when dependencies are built. diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/compiler_depend.ts b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/compiler_depend.ts new file mode 100644 index 0000000..bce7152 --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for xnet_tiny. diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/depend.make b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/depend.make new file mode 100644 index 0000000..9d7217a --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for xnet_tiny. +# This may be replaced when dependencies are built. diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/flags.make b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/flags.make new file mode 100644 index 0000000..380a7f6 --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# compile C with D:/c/mingw64/bin/gcc.exe +C_DEFINES = -D_CRT_SECURE_NO_WARNINGS + +C_INCLUDES = @CMakeFiles/xnet_tiny.dir/includes_C.rsp + +C_FLAGS = -g -g + diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/includes_C.rsp b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/includes_C.rsp new file mode 100644 index 0000000..125d588 --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/includes_C.rsp @@ -0,0 +1 @@ +-ID:/c_work/start/xnet_tiny_c0101 -ID:/c_work/start/xnet_tiny_c0101/../lib/npcap/Include -ID:/c_work/start/xnet_tiny_c0101/src/xnet_app -ID:/c_work/start/xnet_tiny_c0101/src/xnet_tiny -ID:/c_work/start/xnet_tiny_c0101/../lib/xnet diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/link.txt b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/link.txt new file mode 100644 index 0000000..67f22c9 --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/link.txt @@ -0,0 +1,2 @@ +D:\c\mingw64\bin\ar.exe qc libxnet_tiny.a CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj +D:\c\mingw64\bin\ranlib.exe libxnet_tiny.a diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/progress.make b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/progress.make new file mode 100644 index 0000000..d772dad --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 8 +CMAKE_PROGRESS_2 = 9 + diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj new file mode 100644 index 0000000..385584d Binary files /dev/null and b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj differ diff --git a/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj.d b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj.d new file mode 100644 index 0000000..84c8a77 --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj.d @@ -0,0 +1,14 @@ +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj: \ + D:\c_work\start\xnet_tiny_c0101\src\xnet_tiny\xnet_tiny.c \ + D:\c_work\start\xnet_tiny_c0101\src\xnet_tiny\xnet_tiny.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/stdint.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stdint.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/crtdefs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_mac.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/_mingw_secapi.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/vadefs.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sdks/_mingw_directx.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/sdks/_mingw_ddk.h \ + D:/c/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/stddef.h \ + D:/c/mingw64/x86_64-w64-mingw32/include/stddef.h diff --git a/network/start/build_bak/src/xnet_tiny/Makefile b/network/start/build_bak/src/xnet_tiny/Makefile new file mode 100644 index 0000000..56306e0 --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/Makefile @@ -0,0 +1,181 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.30 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +SHELL = cmd.exe + +# The CMake executable. +CMAKE_COMMAND = D:\cmake\bin\cmake.exe + +# The command to remove a file. +RM = D:\cmake\bin\cmake.exe -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = D:\c_work\start\xnet_tiny_c0101 + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = D:\c_work\start\build + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake cache editor..." + D:\cmake\bin\cmake-gui.exe -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + D:\cmake\bin\cmake.exe --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# The main all target +all: cmake_check_build_system + cd /d D:\c_work\start\build && $(CMAKE_COMMAND) -E cmake_progress_start D:\c_work\start\build\CMakeFiles D:\c_work\start\build\src\xnet_tiny\\CMakeFiles\progress.marks + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 src/xnet_tiny/all + $(CMAKE_COMMAND) -E cmake_progress_start D:\c_work\start\build\CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 src/xnet_tiny/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 src/xnet_tiny/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 src/xnet_tiny/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /d D:\c_work\start\build && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 1 +.PHONY : depend + +# Convenience name for target. +src/xnet_tiny/CMakeFiles/xnet_tiny.dir/rule: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 src/xnet_tiny/CMakeFiles/xnet_tiny.dir/rule +.PHONY : src/xnet_tiny/CMakeFiles/xnet_tiny.dir/rule + +# Convenience name for target. +xnet_tiny: src/xnet_tiny/CMakeFiles/xnet_tiny.dir/rule +.PHONY : xnet_tiny + +# fast build rule for target. +xnet_tiny/fast: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_tiny\CMakeFiles\xnet_tiny.dir\build.make src/xnet_tiny/CMakeFiles/xnet_tiny.dir/build +.PHONY : xnet_tiny/fast + +xnet_tiny.obj: xnet_tiny.c.obj +.PHONY : xnet_tiny.obj + +# target to build an object file +xnet_tiny.c.obj: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_tiny\CMakeFiles\xnet_tiny.dir\build.make src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.obj +.PHONY : xnet_tiny.c.obj + +xnet_tiny.i: xnet_tiny.c.i +.PHONY : xnet_tiny.i + +# target to preprocess a source file +xnet_tiny.c.i: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_tiny\CMakeFiles\xnet_tiny.dir\build.make src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.i +.PHONY : xnet_tiny.c.i + +xnet_tiny.s: xnet_tiny.c.s +.PHONY : xnet_tiny.s + +# target to generate assembly for a file +xnet_tiny.c.s: + cd /d D:\c_work\start\build && $(MAKE) $(MAKESILENT) -f src\xnet_tiny\CMakeFiles\xnet_tiny.dir\build.make src/xnet_tiny/CMakeFiles/xnet_tiny.dir/xnet_tiny.c.s +.PHONY : xnet_tiny.c.s + +# Help Target +help: + @echo The following are some of the valid targets for this Makefile: + @echo ... all (the default if no target is provided) + @echo ... clean + @echo ... depend + @echo ... edit_cache + @echo ... rebuild_cache + @echo ... xnet_tiny + @echo ... xnet_tiny.obj + @echo ... xnet_tiny.i + @echo ... xnet_tiny.s +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /d D:\c_work\start\build && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/network/start/build_bak/src/xnet_tiny/cmake_install.cmake b/network/start/build_bak/src/xnet_tiny/cmake_install.cmake new file mode 100644 index 0000000..93c817d --- /dev/null +++ b/network/start/build_bak/src/xnet_tiny/cmake_install.cmake @@ -0,0 +1,39 @@ +# Install script for directory: D:/c_work/start/xnet_tiny_c0101/src/xnet_tiny + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/xnet") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "Debug") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set path to fallback-tool for dependency-resolution. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "D:/c/mingw64/bin/objdump.exe") +endif() + diff --git a/network/start/build_bak/src/xnet_tiny/libxnet_tiny.a b/network/start/build_bak/src/xnet_tiny/libxnet_tiny.a new file mode 100644 index 0000000..8dd96d9 Binary files /dev/null and b/network/start/build_bak/src/xnet_tiny/libxnet_tiny.a differ diff --git a/network/start/build_bak/xnet.exe b/network/start/build_bak/xnet.exe new file mode 100644 index 0000000..3faeff1 Binary files /dev/null and b/network/start/build_bak/xnet.exe differ diff --git a/network/start/htdocs/1.jpg b/network/start/htdocs/1.jpg new file mode 100644 index 0000000..0c9b4ce Binary files /dev/null and b/network/start/htdocs/1.jpg differ diff --git a/network/start/htdocs/2.jpg b/network/start/htdocs/2.jpg new file mode 100644 index 0000000..0c3ab8f Binary files /dev/null and b/network/start/htdocs/2.jpg differ diff --git a/network/start/htdocs/3.jpg b/network/start/htdocs/3.jpg new file mode 100644 index 0000000..7aa7c6e Binary files /dev/null and b/network/start/htdocs/3.jpg differ diff --git a/network/start/htdocs/4.jpg b/network/start/htdocs/4.jpg new file mode 100644 index 0000000..283eb7d Binary files /dev/null and b/network/start/htdocs/4.jpg differ diff --git a/network/start/htdocs/5.jpg b/network/start/htdocs/5.jpg new file mode 100644 index 0000000..5c8f6c1 Binary files /dev/null and b/network/start/htdocs/5.jpg differ diff --git a/network/start/htdocs/6.jpg b/network/start/htdocs/6.jpg new file mode 100644 index 0000000..e660d92 Binary files /dev/null and b/network/start/htdocs/6.jpg differ diff --git a/network/start/htdocs/7.jpg b/network/start/htdocs/7.jpg new file mode 100644 index 0000000..fb480c4 Binary files /dev/null and b/network/start/htdocs/7.jpg differ diff --git a/network/start/htdocs/index.html b/network/start/htdocs/index.html new file mode 100644 index 0000000..f69b12e --- /dev/null +++ b/network/start/htdocs/index.html @@ -0,0 +1,32 @@ + + + 首页|01课堂 + + + + +

注意!!!如果网页加载很慢,请将XTCP_CFG_RTX_BUF_SIZE改大,比如2048

+

此外,如果网页加载中间出现问题,属于正常现像,不要意外。因本工程tcp处理很简单,bug肯定很多。

+

恭喜,您的Web服务器成功运行。太棒了!

+ + + + \ No newline at end of file diff --git a/network/start/htdocs/javascript.js b/network/start/htdocs/javascript.js new file mode 100644 index 0000000..056ac97 --- /dev/null +++ b/network/start/htdocs/javascript.js @@ -0,0 +1,6 @@ +var i = 0; + +function button_click() { + i = i + 1; + document.getElementById("replace_p").innerHTML= i + ""; +} \ No newline at end of file diff --git a/network/start/htdocs/page1.html b/network/start/htdocs/page1.html new file mode 100644 index 0000000..7d4e68a --- /dev/null +++ b/network/start/htdocs/page1.html @@ -0,0 +1,18 @@ + + + 师哥美女|01课堂 + + + +

恭喜,欢迎欣赏师哥美女图片。

+
+

图片很多,慢慢欣赏.

+
    +
  • 图片加载失败
  • +
  • 图片加载失败
  • +
  • 图片加载失败
  • +
  • 图片加载失败
  • +
+
+ + \ No newline at end of file diff --git a/network/start/htdocs/page2.html b/network/start/htdocs/page2.html new file mode 100644 index 0000000..30f6186 --- /dev/null +++ b/network/start/htdocs/page2.html @@ -0,0 +1,17 @@ + + + 带css的页面|01课堂 + + + + + +

有没有发现,下面的显示有点特别的?有颜色,有框框~~~

+
+

这是一个显示加大加粗的红色标题

+

这是标题的内容,我们用蓝框框把他给框起来

+ +

快点上面的按钮

> +
+ + \ No newline at end of file diff --git a/network/start/htdocs/page3.html b/network/start/htdocs/page3.html new file mode 100644 index 0000000..2544d04 --- /dev/null +++ b/network/start/htdocs/page3.html @@ -0,0 +1,11 @@ + + + 简单的文本页面|01课堂 + + + + + +

恭喜,你成功了

+ + \ No newline at end of file diff --git a/network/start/htdocs/style.css b/network/start/htdocs/style.css new file mode 100644 index 0000000..223b2da --- /dev/null +++ b/network/start/htdocs/style.css @@ -0,0 +1,9 @@ +h1 { + color: red; + font-size: 50px; + font-style: bold; +} + +.content { + border:5px solid blue; +} \ No newline at end of file diff --git a/network/start/lib/npcap/Examples-pcap/GNUmakefile b/network/start/lib/npcap/Examples-pcap/GNUmakefile new file mode 100644 index 0000000..9bf8252 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/GNUmakefile @@ -0,0 +1,10 @@ +# Makefile for cygwin gcc +# Nate Lawson + +SUBDIRS = basic_dump basic_dump_ex iflist pcap_filter pktdump_ex readfile readfile_ex savedump sendpack UDPdump + +all clean install uninstall: ${SUBDIRS} + for subdir in ${SUBDIRS}; do \ + echo "Entering $$subdir"; \ + (cd $$subdir && ${MAKE} $@) \ + done; diff --git a/network/start/lib/npcap/Examples-pcap/MakeAll.sln b/network/start/lib/npcap/Examples-pcap/MakeAll.sln new file mode 100644 index 0000000..51dd3ce --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/MakeAll.sln @@ -0,0 +1,118 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basic_dump", "basic_dump\basic_dump.vcxproj", "{66297062-96A0-4F0E-B147-3C8384031232}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basic_dump_ex", "basic_dump_ex\basic_dump_ex.vcxproj", "{92849630-6B09-409C-A7AD-E91E682558B1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iflist", "iflist\iflist.vcxproj", "{0B27B213-4BF3-4611-B412-A2D09CDE8632}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcap_filter", "pcap_filter\pcap_filter.vcxproj", "{B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pktdump_ex", "pktdump_ex\pktdump_ex.vcxproj", "{3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "readfile", "readfile\readfile.vcxproj", "{161E7606-F4CD-4A04-AB6B-5837F7818EE1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "readfile_ex", "readfile_ex\readfile_ex.vcxproj", "{3071DFB6-68F8-41EF-A56C-0C7A71B6967C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "savedump", "savedump\savedump.vcxproj", "{1B8791CB-DD15-46BF-B0A2-879892085538}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sendpack", "sendpack\sendpack.vcxproj", "{1C376689-5F61-48E7-AE83-0DED9EE9E458}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UDPdump", "UDPdump\UDPdump.vcxproj", "{42E5F1D6-6E83-4C13-83CC-C6CD83478C58}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {66297062-96A0-4F0E-B147-3C8384031232}.Debug|x64.ActiveCfg = Debug|x64 + {66297062-96A0-4F0E-B147-3C8384031232}.Debug|x64.Build.0 = Debug|x64 + {66297062-96A0-4F0E-B147-3C8384031232}.Debug|x86.ActiveCfg = Debug|Win32 + {66297062-96A0-4F0E-B147-3C8384031232}.Debug|x86.Build.0 = Debug|Win32 + {66297062-96A0-4F0E-B147-3C8384031232}.Release|x64.ActiveCfg = Release|x64 + {66297062-96A0-4F0E-B147-3C8384031232}.Release|x64.Build.0 = Release|x64 + {66297062-96A0-4F0E-B147-3C8384031232}.Release|x86.ActiveCfg = Release|Win32 + {66297062-96A0-4F0E-B147-3C8384031232}.Release|x86.Build.0 = Release|Win32 + {92849630-6B09-409C-A7AD-E91E682558B1}.Debug|x64.ActiveCfg = Debug|x64 + {92849630-6B09-409C-A7AD-E91E682558B1}.Debug|x64.Build.0 = Debug|x64 + {92849630-6B09-409C-A7AD-E91E682558B1}.Debug|x86.ActiveCfg = Debug|Win32 + {92849630-6B09-409C-A7AD-E91E682558B1}.Debug|x86.Build.0 = Debug|Win32 + {92849630-6B09-409C-A7AD-E91E682558B1}.Release|x64.ActiveCfg = Release|x64 + {92849630-6B09-409C-A7AD-E91E682558B1}.Release|x64.Build.0 = Release|x64 + {92849630-6B09-409C-A7AD-E91E682558B1}.Release|x86.ActiveCfg = Release|Win32 + {92849630-6B09-409C-A7AD-E91E682558B1}.Release|x86.Build.0 = Release|Win32 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Debug|x64.ActiveCfg = Debug|x64 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Debug|x64.Build.0 = Debug|x64 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Debug|x86.ActiveCfg = Debug|Win32 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Debug|x86.Build.0 = Debug|Win32 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Release|x64.ActiveCfg = Release|x64 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Release|x64.Build.0 = Release|x64 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Release|x86.ActiveCfg = Release|Win32 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Release|x86.Build.0 = Release|Win32 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Debug|x64.ActiveCfg = Debug|x64 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Debug|x64.Build.0 = Debug|x64 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Debug|x86.ActiveCfg = Debug|Win32 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Debug|x86.Build.0 = Debug|Win32 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Release|x64.ActiveCfg = Release|x64 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Release|x64.Build.0 = Release|x64 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Release|x86.ActiveCfg = Release|Win32 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Release|x86.Build.0 = Release|Win32 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Debug|x64.ActiveCfg = Debug|x64 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Debug|x64.Build.0 = Debug|x64 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Debug|x86.ActiveCfg = Debug|Win32 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Debug|x86.Build.0 = Debug|Win32 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Release|x64.ActiveCfg = Release|x64 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Release|x64.Build.0 = Release|x64 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Release|x86.ActiveCfg = Release|Win32 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Release|x86.Build.0 = Release|Win32 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Debug|x64.ActiveCfg = Debug|x64 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Debug|x64.Build.0 = Debug|x64 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Debug|x86.ActiveCfg = Debug|Win32 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Debug|x86.Build.0 = Debug|Win32 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Release|x64.ActiveCfg = Release|x64 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Release|x64.Build.0 = Release|x64 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Release|x86.ActiveCfg = Release|Win32 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Release|x86.Build.0 = Release|Win32 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Debug|x64.ActiveCfg = Debug|x64 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Debug|x64.Build.0 = Debug|x64 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Debug|x86.ActiveCfg = Debug|Win32 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Debug|x86.Build.0 = Debug|Win32 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Release|x64.ActiveCfg = Release|x64 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Release|x64.Build.0 = Release|x64 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Release|x86.ActiveCfg = Release|Win32 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Release|x86.Build.0 = Release|Win32 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Debug|x64.ActiveCfg = Debug|x64 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Debug|x64.Build.0 = Debug|x64 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Debug|x86.ActiveCfg = Debug|Win32 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Debug|x86.Build.0 = Debug|Win32 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Release|x64.ActiveCfg = Release|x64 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Release|x64.Build.0 = Release|x64 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Release|x86.ActiveCfg = Release|Win32 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Release|x86.Build.0 = Release|Win32 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Debug|x64.ActiveCfg = Debug|x64 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Debug|x64.Build.0 = Debug|x64 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Debug|x86.ActiveCfg = Debug|Win32 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Debug|x86.Build.0 = Debug|Win32 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Release|x64.ActiveCfg = Release|x64 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Release|x64.Build.0 = Release|x64 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Release|x86.ActiveCfg = Release|Win32 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Release|x86.Build.0 = Release|Win32 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Debug|x64.ActiveCfg = Debug|x64 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Debug|x64.Build.0 = Debug|x64 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Debug|x86.ActiveCfg = Debug|Win32 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Debug|x86.Build.0 = Debug|Win32 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Release|x64.ActiveCfg = Release|x64 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Release|x64.Build.0 = Release|x64 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Release|x86.ActiveCfg = Release|Win32 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/network/start/lib/npcap/Examples-pcap/UDPdump/GNUmakefile b/network/start/lib/npcap/Examples-pcap/UDPdump/GNUmakefile new file mode 100644 index 0000000..d9e75f0 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/UDPdump/GNUmakefile @@ -0,0 +1,17 @@ +# Makefile for cygwin gcc +# Loris Degioanni + +PCAP_PATH = ../../lib +CFLAGS = -g -O -mno-cygwin -I ../../include + +OBJS = udpdump.o +LIBS = -L ${PCAP_PATH} -lwpcap -lwsock32 + +all: ${OBJS} + ${CC} ${CFLAGS} -o udpdump.exe ${OBJS} ${LIBS} + +clean: + rm -f ${OBJS} udpdump.exe + +.c.o: + ${CC} ${CFLAGS} -c -o $*.o $< diff --git a/network/start/lib/npcap/Examples-pcap/UDPdump/UDPdump.vcxproj b/network/start/lib/npcap/Examples-pcap/UDPdump/UDPdump.vcxproj new file mode 100644 index 0000000..3de6f20 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/UDPdump/UDPdump.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-pcap/UDPdump/udpdump.c b/network/start/lib/npcap/Examples-pcap/UDPdump/udpdump.c new file mode 100644 index 0000000..173ab73 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/UDPdump/udpdump.c @@ -0,0 +1,271 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + +#ifdef _MSC_VER +/* + * we do not want the warnings about the old deprecated and unsecure CRT functions + * since these examples can be compiled under *nix as well + */ +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include + +#ifdef WIN32 +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +#endif + +/* 4 bytes IP address */ +typedef struct ip_address +{ + u_char byte1; + u_char byte2; + u_char byte3; + u_char byte4; +}ip_address; + +/* IPv4 header */ +typedef struct ip_header +{ + u_char ver_ihl; // Version (4 bits) + Internet header length (4 bits) + u_char tos; // Type of service + u_short tlen; // Total length + u_short identification; // Identification + u_short flags_fo; // Flags (3 bits) + Fragment offset (13 bits) + u_char ttl; // Time to live + u_char proto; // Protocol + u_short crc; // Header checksum + ip_address saddr; // Source address + ip_address daddr; // Destination address + u_int op_pad; // Option + Padding +}ip_header; + +/* UDP header*/ +typedef struct udp_header +{ + u_short sport; // Source port + u_short dport; // Destination port + u_short len; // Datagram length + u_short crc; // Checksum +}udp_header; + +/* prototype of the packet handler */ +void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data); + + +int main() +{ + pcap_if_t *alldevs; + pcap_if_t *d; + int inum; + int i=0; + pcap_t *adhandle; + char errbuf[PCAP_ERRBUF_SIZE]; + u_int netmask; + char packet_filter[] = "ip and udp"; + struct bpf_program fcode; + +#ifdef WIN32 + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } +#endif + + /* Retrieve the device list */ + if(pcap_findalldevs(&alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf); + exit(1); + } + + /* Print the list */ + for(d=alldevs; d; d=d->next) + { + printf("%d. %s", ++i, d->name); + if (d->description) + printf(" (%s)\n", d->description); + else + printf(" (No description available)\n"); + } + + if(i==0) + { + printf("\nNo interfaces found! Make sure Npcap is installed.\n"); + return -1; + } + + printf("Enter the interface number (1-%d):",i); + scanf("%d", &inum); + + /* Check if the user specified a valid adapter */ + if(inum < 1 || inum > i) + { + printf("\nAdapter number out of range.\n"); + + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Jump to the selected adapter */ + for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++); + + /* Open the adapter */ + if ((adhandle= pcap_open_live(d->name, // name of the device + 65536, // portion of the packet to capture. + // 65536 grants that the whole packet will be captured on all the MACs. + 1, // promiscuous mode (nonzero means promiscuous) + 1000, // read timeout + errbuf // error buffer + )) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter: %s\n", errbuf); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Check the link layer. We support only Ethernet for simplicity. */ + if(pcap_datalink(adhandle) != DLT_EN10MB) + { + fprintf(stderr,"\nThis program works only on Ethernet networks.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + if(d->addresses != NULL) + /* Retrieve the mask of the first address of the interface */ + netmask=((struct sockaddr_in *)(d->addresses->netmask))->sin_addr.S_un.S_addr; + else + /* If the interface is without addresses we suppose to be in a C class network */ + netmask=0xffffff; + + + //compile the filter + if (pcap_compile(adhandle, &fcode, packet_filter, 1, netmask) <0 ) + { + fprintf(stderr,"\nUnable to compile the packet filter. Check the syntax.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + //set the filter + if (pcap_setfilter(adhandle, &fcode)<0) + { + fprintf(stderr,"\nError setting the filter.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + printf("\nlistening on %s...\n", d->description); + + /* At this point, we don't need any more the device list. Free it */ + pcap_freealldevs(alldevs); + + /* start the capture */ + pcap_loop(adhandle, 0, packet_handler, NULL); + + return 0; +} + +/* Callback function invoked by libpcap for every incoming packet */ +void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data) +{ + struct tm *ltime; + char timestr[16]; + ip_header *ih; + udp_header *uh; + u_int ip_len; + u_short sport,dport; + time_t local_tv_sec; + + /* + * unused parameter + */ + (VOID)(param); + + /* convert the timestamp to readable format */ + local_tv_sec = header->ts.tv_sec; + ltime=localtime(&local_tv_sec); + strftime( timestr, sizeof timestr, "%H:%M:%S", ltime); + + /* print timestamp and length of the packet */ + printf("%s.%.6d len:%d ", timestr, header->ts.tv_usec, header->len); + + /* retireve the position of the ip header */ + ih = (ip_header *) (pkt_data + + 14); //length of ethernet header + + /* retireve the position of the udp header */ + ip_len = (ih->ver_ihl & 0xf) * 4; + uh = (udp_header *) ((u_char*)ih + ip_len); + + /* convert from network byte order to host byte order */ + sport = ntohs( uh->sport ); + dport = ntohs( uh->dport ); + + /* print ip addresses and udp ports */ + printf("%d.%d.%d.%d.%d -> %d.%d.%d.%d.%d\n", + ih->saddr.byte1, + ih->saddr.byte2, + ih->saddr.byte3, + ih->saddr.byte4, + sport, + ih->daddr.byte1, + ih->daddr.byte2, + ih->daddr.byte3, + ih->daddr.byte4, + dport); +} diff --git a/network/start/lib/npcap/Examples-pcap/basic_dump/GNUmakefile b/network/start/lib/npcap/Examples-pcap/basic_dump/GNUmakefile new file mode 100644 index 0000000..11951f4 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/basic_dump/GNUmakefile @@ -0,0 +1,17 @@ +# Makefile for cygwin gcc +# Nate Lawson + +PCAP_PATH = ../../lib +CFLAGS = -g -O -mno-cygwin -I ../../include + +OBJS = basic_dump.o +LIBS = -L ${PCAP_PATH} -lwpcap + +all: ${OBJS} + ${CC} ${CFLAGS} -o basic_dump.exe ${OBJS} ${LIBS} + +clean: + rm -f ${OBJS} basic_dump.exe + +.c.o: + ${CC} ${CFLAGS} -c -o $*.o $< diff --git a/network/start/lib/npcap/Examples-pcap/basic_dump/basic_dump.c b/network/start/lib/npcap/Examples-pcap/basic_dump/basic_dump.c new file mode 100644 index 0000000..7dc4242 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/basic_dump/basic_dump.c @@ -0,0 +1,138 @@ +#ifdef _MSC_VER +/* + * we do not want the warnings about the old deprecated and unsecure CRT functions + * since these examples can be compiled under *nix as well + */ +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include +#include +#ifdef WIN32 +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +#endif + +/* prototype of the packet handler */ +void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data); + +int main() +{ + pcap_if_t *alldevs; + pcap_if_t *d; + int inum; + int i=0; + pcap_t *adhandle; + char errbuf[PCAP_ERRBUF_SIZE]; + +#ifdef WIN32 + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } +#endif + + /* Retrieve the device list */ + if(pcap_findalldevs(&alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf); + exit(1); + } + + /* Print the list */ + for(d=alldevs; d; d=d->next) + { + printf("%d. %s", ++i, d->name); + if (d->description) + printf(" (%s)\n", d->description); + else + printf(" (No description available)\n"); + } + + if(i==0) + { + printf("\nNo interfaces found! Make sure Npcap is installed.\n"); + return -1; + } + + printf("Enter the interface number (1-%d):",i); + scanf("%d", &inum); + + if(inum < 1 || inum > i) + { + printf("\nInterface number out of range.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Jump to the selected adapter */ + for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++); + + /* Open the device */ + /* Open the adapter */ + if ((adhandle= pcap_open_live(d->name, // name of the device + 65536, // portion of the packet to capture. + // 65536 grants that the whole packet will be captured on all the MACs. + 1, // promiscuous mode (nonzero means promiscuous) + 1000, // read timeout + errbuf // error buffer + )) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->name); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + printf("\nlistening on %s...\n", d->description); + + /* At this point, we don't need any more the device list. Free it */ + pcap_freealldevs(alldevs); + + /* start the capture */ + pcap_loop(adhandle, 0, packet_handler, NULL); + + pcap_close(adhandle); + return 0; +} + + +/* Callback function invoked by libpcap for every incoming packet */ +void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data) +{ + struct tm *ltime; + char timestr[16]; + time_t local_tv_sec; + + /* + * unused parameters + */ + (VOID)(param); + (VOID)(pkt_data); + + /* convert the timestamp to readable format */ + local_tv_sec = header->ts.tv_sec; + ltime=localtime(&local_tv_sec); + strftime( timestr, sizeof timestr, "%H:%M:%S", ltime); + + printf("%s,%.6d len:%d\n", timestr, header->ts.tv_usec, header->len); + +} diff --git a/network/start/lib/npcap/Examples-pcap/basic_dump/basic_dump.vcxproj b/network/start/lib/npcap/Examples-pcap/basic_dump/basic_dump.vcxproj new file mode 100644 index 0000000..def8b7d --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/basic_dump/basic_dump.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {66297062-96A0-4F0E-B147-3C8384031232} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-pcap/basic_dump_ex/GNUmakefile b/network/start/lib/npcap/Examples-pcap/basic_dump_ex/GNUmakefile new file mode 100644 index 0000000..aeeeea6 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/basic_dump_ex/GNUmakefile @@ -0,0 +1,17 @@ +# Makefile for cygwin gcc +# Nate Lawson + +PCAP_PATH = ../../lib +CFLAGS = -g -O -mno-cygwin -I ../../include + +OBJS = basic_dump_ex.o +LIBS = -L ${PCAP_PATH} -lwpcap + +all: ${OBJS} + ${CC} ${CFLAGS} -o basic_dump_ex.exe ${OBJS} ${LIBS} + +clean: + rm -f ${OBJS} basic_dump_ex.exe + +.c.o: + ${CC} ${CFLAGS} -c -o $*.o $< diff --git a/network/start/lib/npcap/Examples-pcap/basic_dump_ex/basic_dump_ex.c b/network/start/lib/npcap/Examples-pcap/basic_dump_ex/basic_dump_ex.c new file mode 100644 index 0000000..3fe137a --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/basic_dump_ex/basic_dump_ex.c @@ -0,0 +1,134 @@ +#ifdef _MSC_VER +/* + * we do not want the warnings about the old deprecated and unsecure CRT functions + * since these examples can be compiled under *nix as well + */ +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include +#include +#ifdef WIN32 +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +#endif + +int main() +{ + pcap_if_t *alldevs; + pcap_if_t *d; + int inum; + int i=0; + pcap_t *adhandle; + int res; + char errbuf[PCAP_ERRBUF_SIZE]; + struct tm *ltime; + char timestr[16]; + struct pcap_pkthdr *header; + const u_char *pkt_data; + time_t local_tv_sec; + +#ifdef WIN32 + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } +#endif + + /* Retrieve the device list */ + if(pcap_findalldevs(&alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf); + return -1; + } + + /* Print the list */ + for(d=alldevs; d; d=d->next) + { + printf("%d. %s", ++i, d->name); + if (d->description) + printf(" (%s)\n", d->description); + else + printf(" (No description available)\n"); + } + + if(i==0) + { + printf("\nNo interfaces found! Make sure Npcap is installed.\n"); + return -1; + } + + printf("Enter the interface number (1-%d):",i); + scanf("%d", &inum); + + if(inum < 1 || inum > i) + { + printf("\nInterface number out of range.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Jump to the selected adapter */ + for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++); + + /* Open the adapter */ + if ((adhandle= pcap_open_live(d->name, // name of the device + 65536, // portion of the packet to capture. + // 65536 grants that the whole packet will be captured on all the MACs. + 1, // promiscuous mode (nonzero means promiscuous) + 1000, // read timeout + errbuf // error buffer + )) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->name); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + printf("\nlistening on %s...\n", d->description); + + /* At this point, we don't need any more the device list. Free it */ + pcap_freealldevs(alldevs); + + /* Retrieve the packets */ + while((res = pcap_next_ex( adhandle, &header, &pkt_data)) >= 0){ + + if(res == 0) + /* Timeout elapsed */ + continue; + + /* convert the timestamp to readable format */ + local_tv_sec = header->ts.tv_sec; + ltime=localtime(&local_tv_sec); + strftime( timestr, sizeof timestr, "%H:%M:%S", ltime); + + printf("%s,%.6d len:%d\n", timestr, header->ts.tv_usec, header->len); + } + + if(res == -1){ + printf("Error reading the packets: %s\n", pcap_geterr(adhandle)); + return -1; + } + + pcap_close(adhandle); + return 0; +} diff --git a/network/start/lib/npcap/Examples-pcap/basic_dump_ex/basic_dump_ex.vcxproj b/network/start/lib/npcap/Examples-pcap/basic_dump_ex/basic_dump_ex.vcxproj new file mode 100644 index 0000000..6128a07 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/basic_dump_ex/basic_dump_ex.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {92849630-6B09-409C-A7AD-E91E682558B1} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-pcap/iflist/GNUmakefile b/network/start/lib/npcap/Examples-pcap/iflist/GNUmakefile new file mode 100644 index 0000000..01766bd --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/iflist/GNUmakefile @@ -0,0 +1,17 @@ +# Makefile for cygwin gcc +# Nate Lawson + +PCAP_PATH = ../../lib +CFLAGS = -g -O -mno-cygwin -I ../../include + +OBJS = iflist.o +LIBS = -L ${PCAP_PATH} -lwpcap + +all: ${OBJS} + ${CC} ${CFLAGS} -o iflist.exe ${OBJS} ${LIBS} + +clean: + rm -f ${OBJS} iflist.exe + +.c.o: + ${CC} ${CFLAGS} -c -o $*.o $< diff --git a/network/start/lib/npcap/Examples-pcap/iflist/iflist.c b/network/start/lib/npcap/Examples-pcap/iflist/iflist.c new file mode 100644 index 0000000..ff0e13c --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/iflist/iflist.c @@ -0,0 +1,202 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + +#ifdef _MSC_VER +/* + * we do not want the warnings about the old deprecated and unsecure CRT functions + * since these examples can be compiled under *nix as well + */ +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include +#include + +#ifndef WIN32 + #include + #include +#else + #include +#endif + +#ifdef WIN32 +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +#endif + + +// Function prototypes +void ifprint(pcap_if_t *d); +char *iptos(u_long in); +char* ip6tos(struct sockaddr *sockaddr, char *address, int addrlen); + + +int main() +{ + pcap_if_t *alldevs; + pcap_if_t *d; + char errbuf[PCAP_ERRBUF_SIZE+1]; + +#ifdef WIN32 + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } +#endif + + /* Retrieve the device list */ + if(pcap_findalldevs(&alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf); + exit(1); + } + + /* Scan the list printing every entry */ + for(d=alldevs;d;d=d->next) + { + ifprint(d); + } + + /* Free the device list */ + pcap_freealldevs(alldevs); + + return 0; +} + + + +/* Print all the available information on the given interface */ +void ifprint(pcap_if_t *d) +{ + pcap_addr_t *a; + char ip6str[128]; + + /* Name */ + printf("%s\n",d->name); + + /* Description */ + if (d->description) + printf("\tDescription: %s\n",d->description); + + /* Loopback Address*/ + printf("\tLoopback: %s\n",(d->flags & PCAP_IF_LOOPBACK)?"yes":"no"); + + /* IP addresses */ + for(a=d->addresses;a;a=a->next) { + printf("\tAddress Family: #%d\n",a->addr->sa_family); + + switch(a->addr->sa_family) + { + case AF_INET: + printf("\tAddress Family Name: AF_INET\n"); + if (a->addr) + printf("\tAddress: %s\n",iptos(((struct sockaddr_in *)a->addr)->sin_addr.s_addr)); + if (a->netmask) + printf("\tNetmask: %s\n",iptos(((struct sockaddr_in *)a->netmask)->sin_addr.s_addr)); + if (a->broadaddr) + printf("\tBroadcast Address: %s\n",iptos(((struct sockaddr_in *)a->broadaddr)->sin_addr.s_addr)); + if (a->dstaddr) + printf("\tDestination Address: %s\n",iptos(((struct sockaddr_in *)a->dstaddr)->sin_addr.s_addr)); + break; + + case AF_INET6: + printf("\tAddress Family Name: AF_INET6\n"); +#ifndef __MINGW32__ /* Cygnus doesn't have IPv6 */ + if (a->addr) + printf("\tAddress: %s\n", ip6tos(a->addr, ip6str, sizeof(ip6str))); +#endif + break; + + default: + printf("\tAddress Family Name: Unknown\n"); + break; + } + } + printf("\n"); +} + +/* From tcptraceroute, convert a numeric IP address to a string */ +#define IPTOSBUFFERS 12 +char *iptos(u_long in) +{ + static char output[IPTOSBUFFERS][3*4+3+1]; + static short which; + u_char *p; + + p = (u_char *)∈ + which = (which + 1 == IPTOSBUFFERS ? 0 : which + 1); + sprintf(output[which], "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); + return output[which]; +} + +#ifndef __MINGW32__ /* Cygnus doesn't have IPv6 */ +char* ip6tos(struct sockaddr *sockaddr, char *address, int addrlen) +{ + socklen_t sockaddrlen; + + #ifdef WIN32 + sockaddrlen = sizeof(struct sockaddr_in6); + #else + sockaddrlen = sizeof(struct sockaddr_storage); + #endif + + + if(getnameinfo(sockaddr, + sockaddrlen, + address, + addrlen, + NULL, + 0, + NI_NUMERICHOST) != 0) address = NULL; + + return address; +} +#endif /* __MINGW32__ */ + diff --git a/network/start/lib/npcap/Examples-pcap/iflist/iflist.vcxproj b/network/start/lib/npcap/Examples-pcap/iflist/iflist.vcxproj new file mode 100644 index 0000000..1996bbc --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/iflist/iflist.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {0B27B213-4BF3-4611-B412-A2D09CDE8632} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + \ No newline at end of file diff --git a/network/start/lib/npcap/Examples-pcap/pcap_filter/GNUmakefile b/network/start/lib/npcap/Examples-pcap/pcap_filter/GNUmakefile new file mode 100644 index 0000000..2252393 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/pcap_filter/GNUmakefile @@ -0,0 +1,17 @@ +# Makefile for cygwin gcc +# Nate Lawson + +PCAP_PATH = ../../lib +CFLAGS = -g -O -mno-cygwin -I ../../include + +OBJS = pcap_filter.o +LIBS = -L ${PCAP_PATH} -lwpcap + +all: ${OBJS} + ${CC} ${CFLAGS} -o pf.exe ${OBJS} ${LIBS} + +clean: + rm -f ${OBJS} pf.exe + +.c.o: + ${CC} ${CFLAGS} -c -o $*.o $< diff --git a/network/start/lib/npcap/Examples-pcap/pcap_filter/Makefile.unix b/network/start/lib/npcap/Examples-pcap/pcap_filter/Makefile.unix new file mode 100644 index 0000000..f199788 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/pcap_filter/Makefile.unix @@ -0,0 +1,9 @@ + +CC = gcc +INCLDIR = -I /usr/src/sys +LIBS = -lpcap + +pktdump: pcap_filter.o + $(CC) $(INCLDIR) pcap_filter.o $(LIBS) -o pf + rm *.o + diff --git a/network/start/lib/npcap/Examples-pcap/pcap_filter/pcap_filter.c b/network/start/lib/npcap/Examples-pcap/pcap_filter/pcap_filter.c new file mode 100644 index 0000000..95c572a --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/pcap_filter/pcap_filter.c @@ -0,0 +1,208 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + + +#include +#include + +#include + +#define MAX_PRINT 80 +#define MAX_LINE 16 + +#ifdef WIN32 +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +#endif + + +void usage(); + + +int main(int argc, char **argv) +{ + pcap_t *fp; + char errbuf[PCAP_ERRBUF_SIZE]; + char *source = NULL; + char *ofilename = NULL; + char *filter = NULL; + int i; + pcap_dumper_t *dumpfile; + struct bpf_program fcode; + bpf_u_int32 NetMask; + int res; + struct pcap_pkthdr *header; + const u_char *pkt_data; + +#ifdef WIN32 + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } +#endif + + if (argc == 1) + { + usage(); + return -1; + } + + /* Parse parameters */ + for(i=1;i < argc; i+= 2) + { + switch (argv[i] [1]) + { + case 's': + { + source=argv[i+1]; + }; + break; + + case 'o': + { + ofilename=argv[i+1]; + }; + break; + + case 'f': + { + filter=argv[i+1]; + }; + break; + } + } + + // open a capture from the network + if (source != NULL) + { + if ((fp = pcap_open_live(source, // name of the device + 65536, // portion of the packet to capture. + // 65536 grants that the whole packet will be captured on all the MACs. + 1, // promiscuous mode (nonzero means promiscuous) + 1000, // read timeout + errbuf // error buffer + )) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter.\n"); + return -2; + } + } + else usage(); + + if (filter != NULL) + { + // We should loop through the adapters returned by the pcap_findalldevs_ex() + // in order to locate the correct one. + // + // Let's do things simpler: we suppose to be in a C class network ;-) + NetMask=0xffffff; + + //compile the filter + if(pcap_compile(fp, &fcode, filter, 1, NetMask) < 0) + { + fprintf(stderr,"\nError compiling filter: wrong syntax.\n"); + + pcap_close(fp); + return -3; + } + + //set the filter + if(pcap_setfilter(fp, &fcode)<0) + { + fprintf(stderr,"\nError setting the filter\n"); + + pcap_close(fp); + return -4; + } + + } + + //open the dump file + if (ofilename != NULL) + { + dumpfile= pcap_dump_open(fp, ofilename); + + if (dumpfile == NULL) + { + fprintf(stderr,"\nError opening output file\n"); + + pcap_close(fp); + return -5; + } + } + else usage(); + + //start the capture + while((res = pcap_next_ex( fp, &header, &pkt_data)) >= 0) + { + + if(res == 0) + /* Timeout elapsed */ + continue; + + //save the packet on the dump file + pcap_dump((unsigned char *) dumpfile, header, pkt_data); + + } + + pcap_close(fp); + pcap_dump_close(dumpfile); + + return 0; +} + + +void usage() +{ + + printf("\npf - Generic Packet Filter.\n"); + printf("\nUsage:\npf -s source -o output_file_name [-f filter_string]\n\n"); + exit(0); +} diff --git a/network/start/lib/npcap/Examples-pcap/pcap_filter/pcap_filter.vcxproj b/network/start/lib/npcap/Examples-pcap/pcap_filter/pcap_filter.vcxproj new file mode 100644 index 0000000..95e021c --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/pcap_filter/pcap_filter.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-pcap/pktdump_ex/GNUmakefile b/network/start/lib/npcap/Examples-pcap/pktdump_ex/GNUmakefile new file mode 100644 index 0000000..db276c5 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/pktdump_ex/GNUmakefile @@ -0,0 +1,14 @@ +PCAP_PATH = ../../lib +CFLAGS = -g -O -mno-cygwin -I ../../include + +OBJS = pktdump_ex.o +LIBS = -L ${PCAP_PATH} -lwpcap + +all: ${OBJS} + ${CC} ${CFLAGS} -o pktdump_ex.exe ${OBJS} ${LIBS} + +clean: + rm -f ${OBJS} pktdump_ex.exe + +.c.o: + ${CC} ${CFLAGS} -c -o $*.o $< diff --git a/network/start/lib/npcap/Examples-pcap/pktdump_ex/pktdump_ex.c b/network/start/lib/npcap/Examples-pcap/pktdump_ex/pktdump_ex.c new file mode 100644 index 0000000..6b06519 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/pktdump_ex/pktdump_ex.c @@ -0,0 +1,195 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + +#ifdef _MSC_VER +/* + * we do not want the warnings about the old deprecated and unsecure CRT functions + * since these examples can be compiled under *nix as well + */ +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include +#include + +#include + +#define LINE_LEN 16 + +#ifdef WIN32 +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +#endif + + +int main(int argc, char **argv) +{ + pcap_if_t *alldevs, *d; + pcap_t *fp; + u_int inum, i=0; + char errbuf[PCAP_ERRBUF_SIZE]; + int res; + struct pcap_pkthdr *header; + const u_char *pkt_data; + +#ifdef WIN32 + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } +#endif + + printf("pktdump_ex: prints the packets of the network using Npcap.\n"); + printf(" Usage: pktdump_ex [-s source]\n\n" + " Examples:\n" + " pktdump_ex -s file.acp\n" + " pktdump_ex -s \\Device\\NPF_{C8736017-F3C3-4373-94AC-9A34B7DAD998}\n\n"); + + if(argc < 3) + { + printf("\nNo adapter selected: printing the device list:\n"); + /* The user didn't provide a packet source: Retrieve the local device list */ + if(pcap_findalldevs(&alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs_ex: %s\n", errbuf); + exit(1); + } + + /* Print the list */ + for(d=alldevs; d; d=d->next) + { + printf("%d. %s\n ", ++i, d->name); + + if (d->description) + printf(" (%s)\n", d->description); + else + printf(" (No description available)\n"); + } + + if (i==0) + { + printf("\nNo interfaces found! Make sure Npcap is installed.\n"); + return -1; + } + + printf("Enter the interface number (1-%d):",i); + scanf("%d", &inum); + + if (inum < 1 || inum > i) + { + printf("\nInterface number out of range.\n"); + + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Jump to the selected adapter */ + for (d=alldevs, i=0; i< inum-1 ;d=d->next, i++); + + /* Open the adapter */ + if ((fp = pcap_open_live(d->name, // name of the device + 65536, // portion of the packet to capture. + // 65536 grants that the whole packet will be captured on all the MACs. + 1, // promiscuous mode (nonzero means promiscuous) + 1000, // read timeout + errbuf // error buffer + )) == NULL) + { + fprintf(stderr,"\nError opening adapter\n"); + return -1; + } + } + else + { + /* Do not check for the switch type ('-s') */ + if ((fp = pcap_open_live(argv[2], // name of the device + 65536, // portion of the packet to capture. + // 65536 grants that the whole packet will be captured on all the MACs. + 1, // promiscuous mode (nonzero means promiscuous) + 1000, // read timeout + errbuf // error buffer + )) == NULL) + { + fprintf(stderr,"\nError opening adapter\n"); + return -1; + } + } + + /* Read the packets */ + while((res = pcap_next_ex( fp, &header, &pkt_data)) >= 0) + { + + if(res == 0) + /* Timeout elapsed */ + continue; + + /* print pkt timestamp and pkt len */ + printf("%ld:%ld (%ld)\n", header->ts.tv_sec, header->ts.tv_usec, header->len); + + /* Print the packet */ + for (i=1; (i < header->caplen + 1 ) ; i++) + { + printf("%.2x ", pkt_data[i-1]); + if ( (i % LINE_LEN) == 0) printf("\n"); + } + + printf("\n\n"); + } + + if(res == -1) + { + printf("Error reading the packets: %s\n", pcap_geterr(fp)); + return -1; + } + + pcap_close(fp); + return 0; +} diff --git a/network/start/lib/npcap/Examples-pcap/pktdump_ex/pktdump_ex.vcxproj b/network/start/lib/npcap/Examples-pcap/pktdump_ex/pktdump_ex.vcxproj new file mode 100644 index 0000000..752e2fc --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/pktdump_ex/pktdump_ex.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-pcap/readfile/GNUmakefile b/network/start/lib/npcap/Examples-pcap/readfile/GNUmakefile new file mode 100644 index 0000000..967bc18 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/readfile/GNUmakefile @@ -0,0 +1,17 @@ +# Makefile for cygwin gcc +# Nate Lawson + +PCAP_PATH = ../../lib +CFLAGS = -g -O -mno-cygwin -I ../../include + +OBJS = readfile.o +LIBS = -L ${PCAP_PATH} -lwpcap + +all: ${OBJS} + ${CC} ${CFLAGS} -o readfile.exe ${OBJS} ${LIBS} + +clean: + rm -f ${OBJS} readfile.exe + +.c.o: + ${CC} ${CFLAGS} -c -o $*.o $< diff --git a/network/start/lib/npcap/Examples-pcap/readfile/readfile.c b/network/start/lib/npcap/Examples-pcap/readfile/readfile.c new file mode 100644 index 0000000..1a3a1b8 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/readfile/readfile.c @@ -0,0 +1,90 @@ +#include +#include + +#define LINE_LEN 16 + +#ifdef WIN32 +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +#endif + +void dispatcher_handler(u_char *, const struct pcap_pkthdr *, const u_char *); + +int main(int argc, char **argv) +{ + pcap_t *fp; + char errbuf[PCAP_ERRBUF_SIZE]; + +#ifdef WIN32 + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } +#endif + + if(argc != 2) + { + printf("usage: %s filename", argv[0]); + return -1; + + } + + /* Open the capture file */ + if ((fp = pcap_open_offline(argv[1], // name of the device + errbuf // error buffer + )) == NULL) + { + fprintf(stderr,"\nUnable to open the file %s.\n", argv[1]); + return -1; + } + + /* read and dispatch packets until EOF is reached */ + pcap_loop(fp, 0, dispatcher_handler, NULL); + + pcap_close(fp); + return 0; +} + + + +void dispatcher_handler(u_char *temp1, + const struct pcap_pkthdr *header, + const u_char *pkt_data) +{ + u_int i=0; + + /* + * unused variable + */ + (VOID*)temp1; + + /* print pkt timestamp and pkt len */ + printf("%ld:%ld (%ld)\n", header->ts.tv_sec, header->ts.tv_usec, header->len); + + /* Print the packet */ + for (i=1; (i < header->caplen + 1 ) ; i++) + { + printf("%.2x ", pkt_data[i-1]); + if ( (i % LINE_LEN) == 0) printf("\n"); + } + + printf("\n\n"); + +} diff --git a/network/start/lib/npcap/Examples-pcap/readfile/readfile.vcxproj b/network/start/lib/npcap/Examples-pcap/readfile/readfile.vcxproj new file mode 100644 index 0000000..0985fcc --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/readfile/readfile.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {161E7606-F4CD-4A04-AB6B-5837F7818EE1} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-pcap/readfile_ex/GNUmakefile b/network/start/lib/npcap/Examples-pcap/readfile_ex/GNUmakefile new file mode 100644 index 0000000..3eaba96 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/readfile_ex/GNUmakefile @@ -0,0 +1,17 @@ +# Makefile for cygwin gcc +# Nate Lawson + +PCAP_PATH = ../../lib +CFLAGS = -g -O -mno-cygwin -I ../../include + +OBJS = readfile_ex.o +LIBS = -L ${PCAP_PATH} -lwpcap + +all: ${OBJS} + ${CC} ${CFLAGS} -o readfile_ex.exe ${OBJS} ${LIBS} + +clean: + rm -f ${OBJS} readfile_ex.exe + +.c.o: + ${CC} ${CFLAGS} -c -o $*.o $< diff --git a/network/start/lib/npcap/Examples-pcap/readfile_ex/readfile_ex.c b/network/start/lib/npcap/Examples-pcap/readfile_ex/readfile_ex.c new file mode 100644 index 0000000..9b3ce30 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/readfile_ex/readfile_ex.c @@ -0,0 +1,85 @@ +#include +#include + +#define LINE_LEN 16 + +#ifdef WIN32 +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +#endif + +int main(int argc, char **argv) +{ + pcap_t *fp; + char errbuf[PCAP_ERRBUF_SIZE]; + struct pcap_pkthdr *header; + const u_char *pkt_data; + u_int i=0; + int res; + +#ifdef WIN32 + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } +#endif + + if(argc != 2) + { + printf("usage: %s filename", argv[0]); + return -1; + + } + + /* Open the capture file */ + if ((fp = pcap_open_offline(argv[1], // name of the device + errbuf // error buffer + )) == NULL) + { + fprintf(stderr,"\nUnable to open the file %s.\n", argv[1]); + return -1; + } + + /* Retrieve the packets from the file */ + while((res = pcap_next_ex(fp, &header, &pkt_data)) >= 0) + { + /* print pkt timestamp and pkt len */ + printf("%ld:%ld (%ld)\n", header->ts.tv_sec, header->ts.tv_usec, header->len); + + /* Print the packet */ + for (i=1; (i < header->caplen + 1 ) ; i++) + { + printf("%.2x ", pkt_data[i-1]); + if ( (i % LINE_LEN) == 0) printf("\n"); + } + + printf("\n\n"); + } + + + if (res == -1) + { + printf("Error reading the packets: %s\n", pcap_geterr(fp)); + } + + pcap_close(fp); + return 0; +} + diff --git a/network/start/lib/npcap/Examples-pcap/readfile_ex/readfile_ex.vcxproj b/network/start/lib/npcap/Examples-pcap/readfile_ex/readfile_ex.vcxproj new file mode 100644 index 0000000..6f44997 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/readfile_ex/readfile_ex.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-pcap/savedump/GNUmakefile b/network/start/lib/npcap/Examples-pcap/savedump/GNUmakefile new file mode 100644 index 0000000..86bbaa0 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/savedump/GNUmakefile @@ -0,0 +1,17 @@ +# Makefile for cygwin gcc +# Nate Lawson + +PCAP_PATH = ../../lib +CFLAGS = -g -O -mno-cygwin -I ../../include + +OBJS = savedump.o +LIBS = -L ${PCAP_PATH} -lwpcap + +all: ${OBJS} + ${CC} ${CFLAGS} -o savedump.exe ${OBJS} ${LIBS} + +clean: + rm -f ${OBJS} savedump.exe + +.c.o: + ${CC} ${CFLAGS} -c -o $*.o $< diff --git a/network/start/lib/npcap/Examples-pcap/savedump/savedump.c b/network/start/lib/npcap/Examples-pcap/savedump/savedump.c new file mode 100644 index 0000000..97bfd10 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/savedump/savedump.c @@ -0,0 +1,140 @@ +#ifdef _MSC_VER +/* + * we do not want the warnings about the old deprecated and unsecure CRT functions + * since these examples can be compiled under *nix as well + */ +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include + +#ifdef WIN32 +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +#endif + +/* prototype of the packet handler */ +void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data); + +int main(int argc, char **argv) +{ + pcap_if_t *alldevs; + pcap_if_t *d; + int inum; + int i=0; + pcap_t *adhandle; + char errbuf[PCAP_ERRBUF_SIZE]; + pcap_dumper_t *dumpfile; + +#ifdef WIN32 + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } +#endif + + + /* Check command line */ + if(argc != 2) + { + printf("usage: %s filename", argv[0]); + return -1; + } + + /* Retrieve the device list on the local machine */ + if (pcap_findalldevs(&alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf); + exit(1); + } + + /* Print the list */ + for(d=alldevs; d; d=d->next) + { + printf("%d. %s", ++i, d->name); + if (d->description) + printf(" (%s)\n", d->description); + else + printf(" (No description available)\n"); + } + + if(i==0) + { + printf("\nNo interfaces found! Make sure Npcap is installed.\n"); + return -1; + } + + printf("Enter the interface number (1-%d):",i); + scanf("%d", &inum); + + if(inum < 1 || inum > i) + { + printf("\nInterface number out of range.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Jump to the selected adapter */ + for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++); + + + /* Open the adapter */ + if ((adhandle= pcap_open_live(d->name, // name of the device + 65536, // portion of the packet to capture. + // 65536 grants that the whole packet will be captured on all the MACs. + 1, // promiscuous mode (nonzero means promiscuous) + 1000, // read timeout + errbuf // error buffer + )) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->name); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Open the dump file */ + dumpfile = pcap_dump_open(adhandle, argv[1]); + + if(dumpfile==NULL) + { + fprintf(stderr,"\nError opening output file\n"); + return -1; + } + + printf("\nlistening on %s... Press Ctrl+C to stop...\n", d->description); + + /* At this point, we no longer need the device list. Free it */ + pcap_freealldevs(alldevs); + + /* start the capture */ + pcap_loop(adhandle, 0, packet_handler, (unsigned char *)dumpfile); + + pcap_close(adhandle); + return 0; +} + +/* Callback function invoked by libpcap for every incoming packet */ +void packet_handler(u_char *dumpfile, const struct pcap_pkthdr *header, const u_char *pkt_data) +{ + /* save the packet on the dump file */ + pcap_dump(dumpfile, header, pkt_data); +} diff --git a/network/start/lib/npcap/Examples-pcap/savedump/savedump.vcxproj b/network/start/lib/npcap/Examples-pcap/savedump/savedump.vcxproj new file mode 100644 index 0000000..5af37b3 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/savedump/savedump.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {1B8791CB-DD15-46BF-B0A2-879892085538} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-pcap/sendpack/GNUmakefile b/network/start/lib/npcap/Examples-pcap/sendpack/GNUmakefile new file mode 100644 index 0000000..60fd211 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/sendpack/GNUmakefile @@ -0,0 +1,17 @@ +# Makefile for cygwin gcc +# Nate Lawson + +PCAP_PATH = ../../lib +CFLAGS = -g -O -mno-cygwin -I ../../include + +OBJS = sendpack.o +LIBS = -L ${PCAP_PATH} -lwpcap + +all: ${OBJS} + ${CC} ${CFLAGS} -o sendpack.exe ${OBJS} ${LIBS} + +clean: + rm -f ${OBJS} sendpack.exe + +.c.o: + ${CC} ${CFLAGS} -c -o $*.o $< diff --git a/network/start/lib/npcap/Examples-pcap/sendpack/sendpack.c b/network/start/lib/npcap/Examples-pcap/sendpack/sendpack.c new file mode 100644 index 0000000..90e6641 --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/sendpack/sendpack.c @@ -0,0 +1,97 @@ +#include +#include + +#include + +#ifdef WIN32 +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +#endif + + +int main(int argc, char **argv) +{ + pcap_t *fp; + char errbuf[PCAP_ERRBUF_SIZE]; + u_char packet[100]; + int i; + +#ifdef WIN32 + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } +#endif + + /* Check the validity of the command line */ + if (argc != 2) + { + printf("usage: %s interface", argv[0]); + return 1; + } + + /* Open the adapter */ + if ((fp = pcap_open_live(argv[1], // name of the device + 65536, // portion of the packet to capture. It doesn't matter in this case + 1, // promiscuous mode (nonzero means promiscuous) + 1000, // read timeout + errbuf // error buffer + )) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", argv[1]); + return 2; + } + + /* Supposing to be on ethernet, set mac destination to 1:1:1:1:1:1 */ + packet[0]=1; + packet[1]=1; + packet[2]=1; + packet[3]=1; + packet[4]=1; + packet[5]=1; + + /* set mac source to 2:2:2:2:2:2 */ + packet[6]=2; + packet[7]=2; + packet[8]=2; + packet[9]=2; + packet[10]=2; + packet[11]=2; + + /* Fill the rest of the packet */ + for(i=12;i<100;i++) + { + packet[i]= (u_char)i; + } + + /* Send down the packet */ + if (pcap_sendpacket(fp, // Adapter + packet, // buffer with the packet + 100 // size + ) != 0) + { + fprintf(stderr,"\nError sending the packet: %s\n", pcap_geterr(fp)); + return 3; + } + + pcap_close(fp); + return 0; +} + diff --git a/network/start/lib/npcap/Examples-pcap/sendpack/sendpack.vcxproj b/network/start/lib/npcap/Examples-pcap/sendpack/sendpack.vcxproj new file mode 100644 index 0000000..ddffe3c --- /dev/null +++ b/network/start/lib/npcap/Examples-pcap/sendpack/sendpack.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {1C376689-5F61-48E7-AE83-0DED9EE9E458} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/MakeAll.sln b/network/start/lib/npcap/Examples-remote/MakeAll.sln new file mode 100644 index 0000000..a330378 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/MakeAll.sln @@ -0,0 +1,198 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iflist", "iflist\iflist.vcxproj", "{0B27B213-4BF3-4611-B412-A2D09CDE8632}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sendcap", "sendcap\sendcap.vcxproj", "{D6B93A03-446A-4B13-87B8-9AA752A5CC8C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GetMacAddress", "PacketDriver\GetMacAddress\GetMacAddress.vcxproj", "{1ED069D6-3B12-4175-A97D-7FFEBEA26628}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestPacketCapture", "PacketDriver\TestPacketCapture\TestPacketCapture.vcxproj", "{79942922-E02C-486D-9EE3-A13C0876C4C2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestPacketSend", "PacketDriver\TestPacketSend\TestPacketSend.vcxproj", "{1E3BED58-2F2C-463A-B9FD-9A55235C6840}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcap_filter", "pcap_filter\pcap_filter.vcxproj", "{B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcap_fopen", "pcap_fopen\pcap_fopen.vcxproj", "{DD317CB5-6337-498F-A560-553B5558E133}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pktdump_ex", "pktdump_ex\pktdump_ex.vcxproj", "{3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smp_1", "smp_1\smp_1.vcxproj", "{21F49E7F-6C58-4DA5-ABE5-A9DFB6165C83}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcptop", "tcptop\tcptop.vcxproj", "{B671D5DF-3A80-4A21-BC01-79E3FB73D372}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UDPdump", "UDPdump\UDPdump.vcxproj", "{42E5F1D6-6E83-4C13-83CC-C6CD83478C58}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UserBridge", "UserLevelBridge\UserBridge.vcxproj", "{BB73BFD4-454F-42C8-AFE6-FA890A8BD8FC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basic_dump", "misc\basic_dump.vcxproj", "{66297062-96A0-4F0E-B147-3C8384031232}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basic_dump_ex", "misc\basic_dump_ex.vcxproj", "{92849630-6B09-409C-A7AD-E91E682558B1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "readfile", "misc\readfile.vcxproj", "{161E7606-F4CD-4A04-AB6B-5837F7818EE1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "readfile_ex", "misc\readfile_ex.vcxproj", "{3071DFB6-68F8-41EF-A56C-0C7A71B6967C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "savedump", "misc\savedump.vcxproj", "{1B8791CB-DD15-46BF-B0A2-879892085538}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sendpack", "misc\sendpack.vcxproj", "{1C376689-5F61-48E7-AE83-0DED9EE9E458}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Debug|x64.ActiveCfg = Debug|x64 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Debug|x64.Build.0 = Debug|x64 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Debug|x86.ActiveCfg = Debug|Win32 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Debug|x86.Build.0 = Debug|Win32 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Release|x64.ActiveCfg = Release|x64 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Release|x64.Build.0 = Release|x64 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Release|x86.ActiveCfg = Release|Win32 + {0B27B213-4BF3-4611-B412-A2D09CDE8632}.Release|x86.Build.0 = Release|Win32 + {D6B93A03-446A-4B13-87B8-9AA752A5CC8C}.Debug|x64.ActiveCfg = Debug|x64 + {D6B93A03-446A-4B13-87B8-9AA752A5CC8C}.Debug|x64.Build.0 = Debug|x64 + {D6B93A03-446A-4B13-87B8-9AA752A5CC8C}.Debug|x86.ActiveCfg = Debug|Win32 + {D6B93A03-446A-4B13-87B8-9AA752A5CC8C}.Debug|x86.Build.0 = Debug|Win32 + {D6B93A03-446A-4B13-87B8-9AA752A5CC8C}.Release|x64.ActiveCfg = Release|x64 + {D6B93A03-446A-4B13-87B8-9AA752A5CC8C}.Release|x64.Build.0 = Release|x64 + {D6B93A03-446A-4B13-87B8-9AA752A5CC8C}.Release|x86.ActiveCfg = Release|Win32 + {D6B93A03-446A-4B13-87B8-9AA752A5CC8C}.Release|x86.Build.0 = Release|Win32 + {1ED069D6-3B12-4175-A97D-7FFEBEA26628}.Debug|x64.ActiveCfg = Debug|x64 + {1ED069D6-3B12-4175-A97D-7FFEBEA26628}.Debug|x64.Build.0 = Debug|x64 + {1ED069D6-3B12-4175-A97D-7FFEBEA26628}.Debug|x86.ActiveCfg = Debug|Win32 + {1ED069D6-3B12-4175-A97D-7FFEBEA26628}.Debug|x86.Build.0 = Debug|Win32 + {1ED069D6-3B12-4175-A97D-7FFEBEA26628}.Release|x64.ActiveCfg = Release|x64 + {1ED069D6-3B12-4175-A97D-7FFEBEA26628}.Release|x64.Build.0 = Release|x64 + {1ED069D6-3B12-4175-A97D-7FFEBEA26628}.Release|x86.ActiveCfg = Release|Win32 + {1ED069D6-3B12-4175-A97D-7FFEBEA26628}.Release|x86.Build.0 = Release|Win32 + {79942922-E02C-486D-9EE3-A13C0876C4C2}.Debug|x64.ActiveCfg = Debug|x64 + {79942922-E02C-486D-9EE3-A13C0876C4C2}.Debug|x64.Build.0 = Debug|x64 + {79942922-E02C-486D-9EE3-A13C0876C4C2}.Debug|x86.ActiveCfg = Debug|Win32 + {79942922-E02C-486D-9EE3-A13C0876C4C2}.Debug|x86.Build.0 = Debug|Win32 + {79942922-E02C-486D-9EE3-A13C0876C4C2}.Release|x64.ActiveCfg = Release|x64 + {79942922-E02C-486D-9EE3-A13C0876C4C2}.Release|x64.Build.0 = Release|x64 + {79942922-E02C-486D-9EE3-A13C0876C4C2}.Release|x86.ActiveCfg = Release|Win32 + {79942922-E02C-486D-9EE3-A13C0876C4C2}.Release|x86.Build.0 = Release|Win32 + {1E3BED58-2F2C-463A-B9FD-9A55235C6840}.Debug|x64.ActiveCfg = Debug|x64 + {1E3BED58-2F2C-463A-B9FD-9A55235C6840}.Debug|x64.Build.0 = Debug|x64 + {1E3BED58-2F2C-463A-B9FD-9A55235C6840}.Debug|x86.ActiveCfg = Debug|Win32 + {1E3BED58-2F2C-463A-B9FD-9A55235C6840}.Debug|x86.Build.0 = Debug|Win32 + {1E3BED58-2F2C-463A-B9FD-9A55235C6840}.Release|x64.ActiveCfg = Release|x64 + {1E3BED58-2F2C-463A-B9FD-9A55235C6840}.Release|x64.Build.0 = Release|x64 + {1E3BED58-2F2C-463A-B9FD-9A55235C6840}.Release|x86.ActiveCfg = Release|Win32 + {1E3BED58-2F2C-463A-B9FD-9A55235C6840}.Release|x86.Build.0 = Release|Win32 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Debug|x64.ActiveCfg = Debug|x64 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Debug|x64.Build.0 = Debug|x64 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Debug|x86.ActiveCfg = Debug|Win32 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Debug|x86.Build.0 = Debug|Win32 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Release|x64.ActiveCfg = Release|x64 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Release|x64.Build.0 = Release|x64 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Release|x86.ActiveCfg = Release|Win32 + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF}.Release|x86.Build.0 = Release|Win32 + {DD317CB5-6337-498F-A560-553B5558E133}.Debug|x64.ActiveCfg = Debug|x64 + {DD317CB5-6337-498F-A560-553B5558E133}.Debug|x64.Build.0 = Debug|x64 + {DD317CB5-6337-498F-A560-553B5558E133}.Debug|x86.ActiveCfg = Debug|Win32 + {DD317CB5-6337-498F-A560-553B5558E133}.Debug|x86.Build.0 = Debug|Win32 + {DD317CB5-6337-498F-A560-553B5558E133}.Release|x64.ActiveCfg = Release|x64 + {DD317CB5-6337-498F-A560-553B5558E133}.Release|x64.Build.0 = Release|x64 + {DD317CB5-6337-498F-A560-553B5558E133}.Release|x86.ActiveCfg = Release|Win32 + {DD317CB5-6337-498F-A560-553B5558E133}.Release|x86.Build.0 = Release|Win32 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Debug|x64.ActiveCfg = Debug|x64 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Debug|x64.Build.0 = Debug|x64 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Debug|x86.ActiveCfg = Debug|Win32 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Debug|x86.Build.0 = Debug|Win32 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Release|x64.ActiveCfg = Release|x64 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Release|x64.Build.0 = Release|x64 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Release|x86.ActiveCfg = Release|Win32 + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E}.Release|x86.Build.0 = Release|Win32 + {21F49E7F-6C58-4DA5-ABE5-A9DFB6165C83}.Debug|x64.ActiveCfg = Debug|x64 + {21F49E7F-6C58-4DA5-ABE5-A9DFB6165C83}.Debug|x64.Build.0 = Debug|x64 + {21F49E7F-6C58-4DA5-ABE5-A9DFB6165C83}.Debug|x86.ActiveCfg = Debug|Win32 + {21F49E7F-6C58-4DA5-ABE5-A9DFB6165C83}.Debug|x86.Build.0 = Debug|Win32 + {21F49E7F-6C58-4DA5-ABE5-A9DFB6165C83}.Release|x64.ActiveCfg = Release|x64 + {21F49E7F-6C58-4DA5-ABE5-A9DFB6165C83}.Release|x64.Build.0 = Release|x64 + {21F49E7F-6C58-4DA5-ABE5-A9DFB6165C83}.Release|x86.ActiveCfg = Release|Win32 + {21F49E7F-6C58-4DA5-ABE5-A9DFB6165C83}.Release|x86.Build.0 = Release|Win32 + {B671D5DF-3A80-4A21-BC01-79E3FB73D372}.Debug|x64.ActiveCfg = Debug|x64 + {B671D5DF-3A80-4A21-BC01-79E3FB73D372}.Debug|x64.Build.0 = Debug|x64 + {B671D5DF-3A80-4A21-BC01-79E3FB73D372}.Debug|x86.ActiveCfg = Debug|Win32 + {B671D5DF-3A80-4A21-BC01-79E3FB73D372}.Debug|x86.Build.0 = Debug|Win32 + {B671D5DF-3A80-4A21-BC01-79E3FB73D372}.Release|x64.ActiveCfg = Release|x64 + {B671D5DF-3A80-4A21-BC01-79E3FB73D372}.Release|x64.Build.0 = Release|x64 + {B671D5DF-3A80-4A21-BC01-79E3FB73D372}.Release|x86.ActiveCfg = Release|Win32 + {B671D5DF-3A80-4A21-BC01-79E3FB73D372}.Release|x86.Build.0 = Release|Win32 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Debug|x64.ActiveCfg = Debug|x64 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Debug|x64.Build.0 = Debug|x64 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Debug|x86.ActiveCfg = Debug|Win32 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Debug|x86.Build.0 = Debug|Win32 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Release|x64.ActiveCfg = Release|x64 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Release|x64.Build.0 = Release|x64 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Release|x86.ActiveCfg = Release|Win32 + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58}.Release|x86.Build.0 = Release|Win32 + {BB73BFD4-454F-42C8-AFE6-FA890A8BD8FC}.Debug|x64.ActiveCfg = Debug|x64 + {BB73BFD4-454F-42C8-AFE6-FA890A8BD8FC}.Debug|x64.Build.0 = Debug|x64 + {BB73BFD4-454F-42C8-AFE6-FA890A8BD8FC}.Debug|x86.ActiveCfg = Debug|Win32 + {BB73BFD4-454F-42C8-AFE6-FA890A8BD8FC}.Debug|x86.Build.0 = Debug|Win32 + {BB73BFD4-454F-42C8-AFE6-FA890A8BD8FC}.Release|x64.ActiveCfg = Release|x64 + {BB73BFD4-454F-42C8-AFE6-FA890A8BD8FC}.Release|x64.Build.0 = Release|x64 + {BB73BFD4-454F-42C8-AFE6-FA890A8BD8FC}.Release|x86.ActiveCfg = Release|Win32 + {BB73BFD4-454F-42C8-AFE6-FA890A8BD8FC}.Release|x86.Build.0 = Release|Win32 + {66297062-96A0-4F0E-B147-3C8384031232}.Debug|x64.ActiveCfg = Debug|x64 + {66297062-96A0-4F0E-B147-3C8384031232}.Debug|x64.Build.0 = Debug|x64 + {66297062-96A0-4F0E-B147-3C8384031232}.Debug|x86.ActiveCfg = Debug|Win32 + {66297062-96A0-4F0E-B147-3C8384031232}.Debug|x86.Build.0 = Debug|Win32 + {66297062-96A0-4F0E-B147-3C8384031232}.Release|x64.ActiveCfg = Release|x64 + {66297062-96A0-4F0E-B147-3C8384031232}.Release|x64.Build.0 = Release|x64 + {66297062-96A0-4F0E-B147-3C8384031232}.Release|x86.ActiveCfg = Release|Win32 + {66297062-96A0-4F0E-B147-3C8384031232}.Release|x86.Build.0 = Release|Win32 + {92849630-6B09-409C-A7AD-E91E682558B1}.Debug|x64.ActiveCfg = Debug|x64 + {92849630-6B09-409C-A7AD-E91E682558B1}.Debug|x64.Build.0 = Debug|x64 + {92849630-6B09-409C-A7AD-E91E682558B1}.Debug|x86.ActiveCfg = Debug|Win32 + {92849630-6B09-409C-A7AD-E91E682558B1}.Debug|x86.Build.0 = Debug|Win32 + {92849630-6B09-409C-A7AD-E91E682558B1}.Release|x64.ActiveCfg = Release|x64 + {92849630-6B09-409C-A7AD-E91E682558B1}.Release|x64.Build.0 = Release|x64 + {92849630-6B09-409C-A7AD-E91E682558B1}.Release|x86.ActiveCfg = Release|Win32 + {92849630-6B09-409C-A7AD-E91E682558B1}.Release|x86.Build.0 = Release|Win32 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Debug|x64.ActiveCfg = Debug|x64 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Debug|x64.Build.0 = Debug|x64 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Debug|x86.ActiveCfg = Debug|Win32 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Debug|x86.Build.0 = Debug|Win32 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Release|x64.ActiveCfg = Release|x64 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Release|x64.Build.0 = Release|x64 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Release|x86.ActiveCfg = Release|Win32 + {161E7606-F4CD-4A04-AB6B-5837F7818EE1}.Release|x86.Build.0 = Release|Win32 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Debug|x64.ActiveCfg = Debug|x64 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Debug|x64.Build.0 = Debug|x64 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Debug|x86.ActiveCfg = Debug|Win32 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Debug|x86.Build.0 = Debug|Win32 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Release|x64.ActiveCfg = Release|x64 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Release|x64.Build.0 = Release|x64 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Release|x86.ActiveCfg = Release|Win32 + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C}.Release|x86.Build.0 = Release|Win32 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Debug|x64.ActiveCfg = Debug|x64 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Debug|x64.Build.0 = Debug|x64 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Debug|x86.ActiveCfg = Debug|Win32 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Debug|x86.Build.0 = Debug|Win32 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Release|x64.ActiveCfg = Release|x64 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Release|x64.Build.0 = Release|x64 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Release|x86.ActiveCfg = Release|Win32 + {1B8791CB-DD15-46BF-B0A2-879892085538}.Release|x86.Build.0 = Release|Win32 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Debug|x64.ActiveCfg = Debug|x64 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Debug|x64.Build.0 = Debug|x64 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Debug|x86.ActiveCfg = Debug|Win32 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Debug|x86.Build.0 = Debug|Win32 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Release|x64.ActiveCfg = Release|x64 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Release|x64.Build.0 = Release|x64 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Release|x86.ActiveCfg = Release|Win32 + {1C376689-5F61-48E7-AE83-0DED9EE9E458}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/network/start/lib/npcap/Examples-remote/PacketDriver/GetMacAddress/GetMacAddress.c b/network/start/lib/npcap/Examples-remote/PacketDriver/GetMacAddress/GetMacAddress.c new file mode 100644 index 0000000..2cf046b --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/PacketDriver/GetMacAddress/GetMacAddress.c @@ -0,0 +1,177 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + +#include +#include +#include +#include + +#define Max_Num_Adapter 10 +char AdapterList[Max_Num_Adapter][1024]; + +#include +BOOL LoadNpcapDlls() +{ + TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, TEXT("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} + +int main() +{ + LPADAPTER lpAdapter = 0; + int i; + DWORD dwErrorCode; + char AdapterName[8192]; + char *temp,*temp1; + int AdapterNum=0,Open; + ULONG AdapterLength; + PPACKET_OID_DATA OidData; + BOOLEAN Status; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + // + // Obtain the name of the adapters installed on this machine + // + + printf("Packet.dll test application. Library version:%s\n", PacketGetVersion()); + + printf("Adapters installed:\n"); + i=0; + + AdapterLength = sizeof(AdapterName); + + if(PacketGetAdapterNames(AdapterName,&AdapterLength)==FALSE){ + printf("Unable to retrieve the list of the adapters!\n"); + return -1; + } + temp=AdapterName; + temp1=AdapterName; + + while ((*temp!='\0')||(*(temp-1)!='\0')) + { + if (*temp=='\0') + { + memcpy(AdapterList[i],temp1,temp-temp1); + temp1=temp+1; + i++; + } + temp++; + } + + AdapterNum=i; + for (i=0;iAdapterNum) printf("\nThe number must be smaller than %d",AdapterNum); + } while (Open>AdapterNum); + + + // + // Open the selected adapter + // + + lpAdapter = PacketOpenAdapter(AdapterList[Open-1]); + + if (!lpAdapter || (lpAdapter->hFile == INVALID_HANDLE_VALUE)) + { + dwErrorCode=GetLastError(); + printf("Unable to open the adapter, Error Code : %lx\n",dwErrorCode); + + return -1; + } + + // + // Allocate a buffer to get the MAC adress + // + + OidData = malloc(6 + sizeof(PACKET_OID_DATA)); + if (OidData == NULL) + { + printf("error allocating memory!\n"); + PacketCloseAdapter(lpAdapter); + return -1; + } + + // + // Retrieve the adapter MAC querying the NIC driver + // + + OidData->Oid = OID_802_3_CURRENT_ADDRESS; + + OidData->Length = 6; + ZeroMemory(OidData->Data, 6); + + Status = PacketRequest(lpAdapter, FALSE, OidData); + if(Status) + { + printf("The MAC address of the adapter is %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", + (OidData->Data)[0], + (OidData->Data)[1], + (OidData->Data)[2], + (OidData->Data)[3], + (OidData->Data)[4], + (OidData->Data)[5]); + } + else + { + printf("error retrieving the MAC address of the adapter!\n"); + } + + free(OidData); + PacketCloseAdapter(lpAdapter); + return (0); +} + diff --git a/network/start/lib/npcap/Examples-remote/PacketDriver/GetMacAddress/GetMacAddress.vcxproj b/network/start/lib/npcap/Examples-remote/PacketDriver/GetMacAddress/GetMacAddress.vcxproj new file mode 100644 index 0000000..f77fc68 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/PacketDriver/GetMacAddress/GetMacAddress.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {1ED069D6-3B12-4175-A97D-7FFEBEA26628} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + Packet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + Packet.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + Packet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + Packet.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + Packet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Packet.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + Packet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Packet.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/PacketDriver/TestPacketCapture/TestPacketCapture.c b/network/start/lib/npcap/Examples-remote/PacketDriver/TestPacketCapture/TestPacketCapture.c new file mode 100644 index 0000000..f6686ba --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/PacketDriver/TestPacketCapture/TestPacketCapture.c @@ -0,0 +1,268 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + + +#include +#include + + +#include +#include + +#define Max_Num_Adapter 10 + +#include +BOOL LoadNpcapDlls() +{ + TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, TEXT("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +// Prototypes + +void PrintPackets(LPPACKET lpPacket); + +char AdapterList[Max_Num_Adapter][1024]; + +int main() +{ +//define a pointer to an ADAPTER structure + +LPADAPTER lpAdapter = 0; + +//define a pointer to a PACKET structure + +LPPACKET lpPacket; + +int i; +DWORD dwErrorCode; + +//ascii strings +char AdapterName[8192]; // string that contains a list of the network adapters +char *temp,*temp1; + + +int AdapterNum=0,Open; +ULONG AdapterLength; + +char buffer[256000]; // buffer to hold the data coming from the driver + +struct bpf_stat stat; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + // + // Obtain the name of the adapters installed on this machine + // + printf("Packet.dll test application. Library version:%s\n", PacketGetVersion()); + + printf("Adapters installed:\n"); + i=0; + + AdapterLength = sizeof(AdapterName); + + if(PacketGetAdapterNames(AdapterName,&AdapterLength)==FALSE){ + printf("Unable to retrieve the list of the adapters!\n"); + return -1; + } + temp=AdapterName; + temp1=AdapterName; + + while ((*temp!='\0')||(*(temp-1)!='\0')) + { + if (*temp=='\0') + { + memcpy(AdapterList[i],temp1,temp-temp1); + temp1=temp+1; + i++; + } + temp++; + } + + AdapterNum=i; + for (i=0;iAdapterNum) printf("\nThe number must be smaller than %d",AdapterNum); + } while (Open>AdapterNum); + + + + + lpAdapter = PacketOpenAdapter(AdapterList[Open-1]); + + if (!lpAdapter || (lpAdapter->hFile == INVALID_HANDLE_VALUE)) + { + dwErrorCode=GetLastError(); + printf("Unable to open the adapter, Error Code : %lx\n",dwErrorCode); + + return -1; + } + + // set the network adapter in promiscuous mode + + if(PacketSetHwFilter(lpAdapter,NDIS_PACKET_TYPE_PROMISCUOUS)==FALSE){ + printf("Warning: unable to set promiscuous mode!\n"); + } + + // set a 512K buffer in the driver + if(PacketSetBuff(lpAdapter,512000)==FALSE){ + printf("Unable to set the kernel buffer!\n"); + return -1; + } + + // set a 1 second read timeout + if(PacketSetReadTimeout(lpAdapter,1000)==FALSE){ + printf("Warning: unable to set the read tiemout!\n"); + } + + //allocate and initialize a packet structure that will be used to + //receive the packets. + if((lpPacket = PacketAllocatePacket())==NULL){ + printf("\nError: failed to allocate the LPPACKET structure."); + return (-1); + } + PacketInitPacket(lpPacket,(char*)buffer,256000); + + //main capture loop + while(!_kbhit()) + { + // capture the packets + if(PacketReceivePacket(lpAdapter,lpPacket,TRUE)==FALSE){ + printf("Error: PacketReceivePacket failed"); + return (-1); + } + + PrintPackets(lpPacket); + } + + + //print the capture statistics + if(PacketGetStats(lpAdapter,&stat)==FALSE){ + printf("Warning: unable to get stats from the kernel!\n"); + } + else + printf("\n\n%d packets received.\n%d Packets lost",stat.bs_recv,stat.bs_drop); + + PacketFreePacket(lpPacket); + + // close the adapter and exit + + PacketCloseAdapter(lpAdapter); + return (0); +} + +// this function prints the content of a block of packets received from the driver + +void PrintPackets(LPPACKET lpPacket) +{ + + ULONG i, j, ulLines, ulen, ulBytesReceived; + char *pChar, *pLine, *base; + char *buf; + u_int off=0; + u_int tlen,tlen1; + struct bpf_hdr *hdr; + + ulBytesReceived = lpPacket->ulBytesReceived; + + + buf = lpPacket->Buffer; + + off=0; + + while(offbh_datalen; + tlen=hdr->bh_caplen; + printf("Packet length, captured portion: %ld, %ld\n", tlen1, tlen); + off+=hdr->bh_hdrlen; + + ulLines = (tlen + 15) / 16; + + pChar =(char*)(buf+off); + base=pChar; + off=Packet_WORDALIGN(off+tlen); + + for ( i=0; i 16 ) ? 16 : ulen; + tlen -= ulen; + + for ( j=0; j + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {79942922-E02C-486D-9EE3-A13C0876C4C2} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + Packet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + Packet.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + Packet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + Packet.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + Packet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Packet.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + Packet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Packet.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/PacketDriver/TestPacketSend/TestPacketSend.c b/network/start/lib/npcap/Examples-remote/PacketDriver/TestPacketSend/TestPacketSend.c new file mode 100644 index 0000000..1390a61 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/PacketDriver/TestPacketSend/TestPacketSend.c @@ -0,0 +1,260 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + +#include +#include +#include + +#include + + +#define Max_Num_Adapter 10 + +#include +BOOL LoadNpcapDlls() +{ + TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, TEXT("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} + +// Prototypes + +void PrintPackets(LPPACKET lpPacket); + +char AdapterList[Max_Num_Adapter][8192]; + + + +int main(int argc, char **argv) +{ +char packetbuff[5000]; + +// define a pointer to a ADAPTER structure + +LPADAPTER lpAdapter = 0; + +// define a pointer to a PACKET structure + +LPPACKET lpPacket; + +int i,npacks,Snaplen; +DWORD dwErrorCode; + +//ascii strings +char AdapterName[8192]; // string that contains a list of the network adapters +char *temp,*temp1; + +int AdapterNum=0,Open; +ULONG AdapterLength; + +float cpu_time; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + printf("Traffic Generator v 0.9999\nCopyright 1999 Loris Degioanni (loris@netgroup-serv.polito.it)"); + printf("\nSends a set of packets to the network using packet.dll API.\n"); + + if (argc == 1){ + printf("\n\n Usage: TestpacketSend [-i adapter] -n npacks -s size"); + printf("\n size is between 60 and 1514\n\n"); + return -1; + } + + + AdapterName[0]=0; + + //get the command line parameters + for(i=1;iAdapterNum) printf("\nThe number must be smaller than %d",AdapterNum); + } while (Open>AdapterNum); + + + + + lpAdapter = PacketOpenAdapter(AdapterList[Open-1]); + + if (!lpAdapter || (lpAdapter->hFile == INVALID_HANDLE_VALUE)) + { + dwErrorCode=GetLastError(); + printf("Unable to open the driver, Error Code : %lx\n",dwErrorCode); + + return(-1); + } + + } + else{ + + lpAdapter = PacketOpenAdapter(AdapterName); + + if (!lpAdapter || (lpAdapter->hFile == INVALID_HANDLE_VALUE)) + { + dwErrorCode=GetLastError(); + printf("Unable to open the driver, Error Code : %lx\n",dwErrorCode); + + return(-1); + } + + } + + if((lpPacket = PacketAllocatePacket())==NULL){ + printf("\nError:failed to allocate the LPPACKET structure."); + return (-1); + } + + packetbuff[0]=1; + packetbuff[1]=1; + packetbuff[2]=1; + packetbuff[3]=1; + packetbuff[4]=1; + packetbuff[5]=1; + + packetbuff[6]=2; + packetbuff[7]=2; + packetbuff[8]=2; + packetbuff[9]=2; + packetbuff[10]=2; + packetbuff[11]=2; + + for(i=12;i<1514;i++){ + packetbuff[i]= (char)i; + } + + PacketInitPacket(lpPacket,packetbuff,Snaplen); + // capture the packet + + + if(PacketSetNumWrites(lpAdapter,npacks)==FALSE){ + printf("warning: Unable to send more than one packet in a single write!\n"); + } + + printf("\n\nGenerating %d packets...",npacks); + + cpu_time = (float)clock (); + + if(PacketSendPacket(lpAdapter,lpPacket,TRUE)==FALSE){ + printf("Error sending the packets!\n"); + return -1; + } + + cpu_time = (clock() - cpu_time)/CLK_TCK; + + printf ("\n\nElapsed time: %5.3f\n", cpu_time); + printf ("\nTotal packets generated = %d", npacks); + printf ("\nTotal bytes generated = %d", (Snaplen+24)*npacks); + printf ("\nTotal bits generated = %d", (Snaplen+24)*npacks*8); + printf ("\nAverage packets per second = %d", (int)((double)npacks/cpu_time)); + printf ("\nAverage bytes per second = %d", (int)((double)((Snaplen+24)*npacks)/cpu_time)); + printf ("\nAverage bits per second = %d", (int)((double)((Snaplen+24)*npacks*8)/cpu_time)); + printf ("\n"); + + PacketFreePacket(lpPacket); + + // close the adapter and exit + + PacketCloseAdapter(lpAdapter); + return (0); +} diff --git a/network/start/lib/npcap/Examples-remote/PacketDriver/TestPacketSend/TestPacketSend.vcxproj b/network/start/lib/npcap/Examples-remote/PacketDriver/TestPacketSend/TestPacketSend.vcxproj new file mode 100644 index 0000000..38ff49f --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/PacketDriver/TestPacketSend/TestPacketSend.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {1E3BED58-2F2C-463A-B9FD-9A55235C6840} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + Packet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + Packet.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + Packet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + Packet.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + Packet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Packet.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + Packet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Packet.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/PacketDriver/readme.txt b/network/start/lib/npcap/Examples-remote/PacketDriver/readme.txt new file mode 100644 index 0000000..e64371e --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/PacketDriver/readme.txt @@ -0,0 +1,2 @@ +These files use the packet.dll API instead of wpcap.dll. +The use of packet.dll API is strongly discouraged. diff --git a/network/start/lib/npcap/Examples-remote/UDPdump/UDPdump.vcxproj b/network/start/lib/npcap/Examples-remote/UDPdump/UDPdump.vcxproj new file mode 100644 index 0000000..3de6f20 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/UDPdump/UDPdump.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {42E5F1D6-6E83-4C13-83CC-C6CD83478C58} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/UDPdump/udpdump.c b/network/start/lib/npcap/Examples-remote/UDPdump/udpdump.c new file mode 100644 index 0000000..81242a4 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/UDPdump/udpdump.c @@ -0,0 +1,256 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + +#include +#include +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} + + +/* 4 bytes IP address */ +typedef struct ip_address{ + u_char byte1; + u_char byte2; + u_char byte3; + u_char byte4; +}ip_address; + +/* IPv4 header */ +typedef struct ip_header{ + u_char ver_ihl; // Version (4 bits) + Internet header length (4 bits) + u_char tos; // Type of service + u_short tlen; // Total length + u_short identification; // Identification + u_short flags_fo; // Flags (3 bits) + Fragment offset (13 bits) + u_char ttl; // Time to live + u_char proto; // Protocol + u_short crc; // Header checksum + ip_address saddr; // Source address + ip_address daddr; // Destination address + u_int op_pad; // Option + Padding +}ip_header; + +/* UDP header*/ +typedef struct udp_header{ + u_short sport; // Source port + u_short dport; // Destination port + u_short len; // Datagram length + u_short crc; // Checksum +}udp_header; + +/* prototype of the packet handler */ +void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data); + + +int main() +{ +pcap_if_t *alldevs; +pcap_if_t *d; +int inum; +int i=0; +pcap_t *adhandle; +char errbuf[PCAP_ERRBUF_SIZE]; +u_int netmask; +char packet_filter[] = "ip and udp"; +struct bpf_program fcode; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + /* Retrieve the device list */ + if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf); + exit(1); + } + + /* Print the list */ + for(d=alldevs; d; d=d->next) + { + printf("%d. %s", ++i, d->name); + if (d->description) + printf(" (%s)\n", d->description); + else + printf(" (No description available)\n"); + } + + if(i==0) + { + printf("\nNo interfaces found! Make sure Npcap is installed.\n"); + return -1; + } + + printf("Enter the interface number (1-%d):",i); + scanf_s("%d", &inum); + + if(inum < 1 || inum > i) + { + printf("\nInterface number out of range.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Jump to the selected adapter */ + for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++); + + /* Open the adapter */ + if ( (adhandle= pcap_open(d->name, // name of the device + 65536, // portion of the packet to capture. + // 65536 grants that the whole packet will be captured on all the MACs. + PCAP_OPENFLAG_PROMISCUOUS, // promiscuous mode + 1000, // read timeout + NULL, // remote authentication + errbuf // error buffer + ) ) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->name); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Check the link layer. We support only Ethernet for simplicity. */ + if(pcap_datalink(adhandle) != DLT_EN10MB) + { + fprintf(stderr,"\nThis program works only on Ethernet networks.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + if(d->addresses != NULL) + /* Retrieve the mask of the first address of the interface */ + netmask=((struct sockaddr_in *)(d->addresses->netmask))->sin_addr.S_un.S_addr; + else + /* If the interface is without addresses we suppose to be in a C class network */ + netmask=0xffffff; + + + //compile the filter + if (pcap_compile(adhandle, &fcode, packet_filter, 1, netmask) <0 ) + { + fprintf(stderr,"\nUnable to compile the packet filter. Check the syntax.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + //set the filter + if (pcap_setfilter(adhandle, &fcode)<0) + { + fprintf(stderr,"\nError setting the filter.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + printf("\nlistening on %s...\n", d->description); + + /* At this point, we don't need any more the device list. Free it */ + pcap_freealldevs(alldevs); + + /* start the capture */ + pcap_loop(adhandle, 0, packet_handler, NULL); + + return 0; +} + +/* Callback function invoked by libpcap for every incoming packet */ +void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data) +{ + struct tm ltime; + char timestr[16]; + ip_header *ih; + udp_header *uh; + u_int ip_len; + u_short sport,dport; + time_t local_tv_sec; + + /* + * Unused variable + */ + (VOID)(param); + + /* convert the timestamp to readable format */ + local_tv_sec = header->ts.tv_sec; + localtime_s(<ime, &local_tv_sec); + strftime( timestr, sizeof timestr, "%H:%M:%S", <ime); + + /* print timestamp and length of the packet */ + printf("%s.%.6d len:%d ", timestr, header->ts.tv_usec, header->len); + + /* retireve the position of the ip header */ + ih = (ip_header *) (pkt_data + + 14); //length of ethernet header + + /* retireve the position of the udp header */ + ip_len = (ih->ver_ihl & 0xf) * 4; + uh = (udp_header *) ((u_char*)ih + ip_len); + + /* convert from network byte order to host byte order */ + sport = ntohs( uh->sport ); + dport = ntohs( uh->dport ); + + /* print ip addresses and udp ports */ + printf("%d.%d.%d.%d.%d -> %d.%d.%d.%d.%d\n", + ih->saddr.byte1, + ih->saddr.byte2, + ih->saddr.byte3, + ih->saddr.byte4, + sport, + ih->daddr.byte1, + ih->daddr.byte2, + ih->daddr.byte3, + ih->daddr.byte4, + dport); +} diff --git a/network/start/lib/npcap/Examples-remote/UserLevelBridge/UserBridge.c b/network/start/lib/npcap/Examples-remote/UserLevelBridge/UserBridge.c new file mode 100644 index 0000000..15eb0f1 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/UserLevelBridge/UserBridge.c @@ -0,0 +1,492 @@ +/* + * Copyright (c) 2005 - 2006 + * CACE Technologies, Davis, CA + * 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. + * 3. Neither the name of CACE Technologies nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + +/* + * This simple program implements a user-level bridge. + * It opens two adapters specified by the user and starts two threads. + * The first thread receives packets from adapter 1 and sends them down to + * adapter 2. The second thread does the same, but in the opposite + * direction. + */ + +#include +#include +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} + + +/* Storage data structure used to pass parameters to the threads */ +typedef struct _in_out_adapters +{ + unsigned int state; /* Some simple state information */ + pcap_t *input_adapter; + pcap_t *output_adapter; +}in_out_adapters; + +/* Prototypes */ +DWORD WINAPI CaptureAndForwardThread(LPVOID lpParameter); +void ctrlc_handler(int sig); + +/* This prevents the two threads to mess-up when they do printfs */ +CRITICAL_SECTION print_cs; + +/* Thread handlers. Global because we wait on the threads from the CTRL+C handler */ +HANDLE threads[2]; + +/* This global variable tells the forwarder threads they must terminate */ +volatile int kill_forwaders = 0; + + +/*******************************************************************/ + +int main() +{ + pcap_if_t *alldevs; + pcap_if_t *d; + int inum1, inum2; + int i=0; + pcap_t *adhandle1, *adhandle2; + char errbuf[PCAP_ERRBUF_SIZE]; + u_int netmask1, netmask2; + char packet_filter[256]; + struct bpf_program fcode; + in_out_adapters couple0, couple1; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + /* + * Retrieve the device list + */ + + if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf); + exit(1); + } + + /* Print the list */ + for(d=alldevs; d; d=d->next) + { + printf("%d. ", ++i); + if (d->description) + printf("%s\n", d->description); + else + printf("\n"); + } + + if(i==0) + { + printf("\nNo interfaces found! Make sure Npcap is installed.\n"); + return -1; + } + + + /* + * Get input from the user + */ + + /* Get the filter*/ + printf("\nSpecify filter (hit return for no filter):"); + + fgets(packet_filter, sizeof(packet_filter), stdin); + + /* Get the first interface number*/ + printf("\nEnter the number of the first interface to use (1-%d):",i); + scanf_s("%d", &inum1); + + if(inum1 < 1 || inum1 > i) + { + printf("\nInterface number out of range.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Get the second interface number*/ + printf("Enter the number of the first interface to use (1-%d):",i); + scanf_s("%d", &inum2); + + if(inum2 < 1 || inum2 > i) + { + printf("\nInterface number out of range.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + if(inum1 == inum2 ) + { + printf("\nCannot bridge packets on the same interface.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + + /* + * Open the specified couple of adapters + */ + + /* Jump to the first selected adapter */ + for(d = alldevs, i = 0; i< inum1 - 1 ;d = d->next, i++); + + /* + * Open the first adapter. + * *NOTICE* the flags we are using, they are important for the behavior of the prgram: + * - PCAP_OPENFLAG_PROMISCUOUS: tells the adapter to go in promiscuous mode. + * This means that we are capturing all the traffic, not only the one to or from + * this machine. + * - PCAP_OPENFLAG_NOCAPTURE_LOCAL: prevents the adapter from capturing again the packets + * transmitted by itself. This avoids annoying loops. + * - PCAP_OPENFLAG_MAX_RESPONSIVENESS: configures the adapter to provide minimum latency, + * at the cost of higher CPU usage. + */ + if((adhandle1 = pcap_open(d->name, // name of the device + 65536, // portion of the packet to capture. + // 65536 grants that the whole packet will be captured on every link layer. + PCAP_OPENFLAG_PROMISCUOUS | // flags. We specify that we don't want to capture loopback packets, and that the driver should deliver us the packets as fast as possible + PCAP_OPENFLAG_NOCAPTURE_LOCAL | + PCAP_OPENFLAG_MAX_RESPONSIVENESS, + 500, // read timeout + NULL, // remote authentication + errbuf // error buffer + )) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->description); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + if(d->addresses != NULL) + { + /* Retrieve the mask of the first address of the interface */ + netmask1 = ((struct sockaddr_in *)(d->addresses->netmask))->sin_addr.S_un.S_addr; + } + else + { + /* If the interface is without addresses we suppose to be in a C class network */ + netmask1 = 0xffffff; + } + + /* Jump to the second selected adapter */ + for(d = alldevs, i = 0; i< inum2 - 1 ;d = d->next, i++); + + /* Open the second adapter */ + if((adhandle2 = pcap_open(d->name, // name of the device + 65536, // portion of the packet to capture. + // 65536 grants that the whole packet will be captured on every link layer. + PCAP_OPENFLAG_PROMISCUOUS | // flags. We specify that we don't want to capture loopback packets, and that the driver should deliver us the packets as fast as possible + PCAP_OPENFLAG_NOCAPTURE_LOCAL | + PCAP_OPENFLAG_MAX_RESPONSIVENESS, + 500, // read timeout + NULL, // remote authentication + errbuf // error buffer + )) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->description); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + if(d->addresses != NULL) + { + /* Retrieve the mask of the first address of the interface */ + netmask2 = ((struct sockaddr_in *)(d->addresses->netmask))->sin_addr.S_un.S_addr; + } + else + { + /* If the interface is without addresses we suppose to be in a C class network */ + netmask2 = 0xffffff; + } + + + /* + * Compile and set the filters + */ + + /* compile the filter for the first adapter */ + if (pcap_compile(adhandle1, &fcode, packet_filter, 1, netmask1) <0 ) + { + fprintf(stderr,"\nUnable to compile the packet filter. Check the syntax.\n"); + + /* Close the adapters */ + pcap_close(adhandle1); + pcap_close(adhandle2); + + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* set the filter for the first adapter*/ + if (pcap_setfilter(adhandle1, &fcode)<0) + { + fprintf(stderr,"\nError setting the filter.\n"); + + /* Close the adapters */ + pcap_close(adhandle1); + pcap_close(adhandle2); + + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* compile the filter for the second adapter */ + if (pcap_compile(adhandle2, &fcode, packet_filter, 1, netmask2) <0 ) + { + fprintf(stderr,"\nUnable to compile the packet filter. Check the syntax.\n"); + + /* Close the adapters */ + pcap_close(adhandle1); + pcap_close(adhandle2); + + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* set the filter for the second adapter*/ + if (pcap_setfilter(adhandle2, &fcode)<0) + { + fprintf(stderr,"\nError setting the filter.\n"); + + /* Close the adapters */ + pcap_close(adhandle1); + pcap_close(adhandle2); + + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* At this point, we don't need the device list any more. Free it */ + pcap_freealldevs(alldevs); + + /* + * Start the threads that will forward the packets + */ + + /* Initialize the critical section that will be used by the threads for console output */ + InitializeCriticalSection(&print_cs); + + /* Init input parameters of the threads */ + couple0.state = 0; + couple0.input_adapter = adhandle1; + couple0.output_adapter = adhandle2; + couple1.state = 1; + couple1.input_adapter = adhandle2; + couple1.output_adapter = adhandle1; + + /* Start first thread */ + if((threads[0] = CreateThread( + NULL, + 0, + CaptureAndForwardThread, + &couple0, + 0, + NULL)) == NULL) + { + fprintf(stderr, "error creating the first forward thread"); + + /* Close the adapters */ + pcap_close(adhandle1); + pcap_close(adhandle2); + + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Start second thread */ + if((threads[1] = CreateThread( + NULL, + 0, + CaptureAndForwardThread, + &couple1, + 0, + NULL)) == NULL) + { + fprintf(stderr, "error creating the second forward thread"); + + /* Kill the first thread. Not very gentle at all...*/ + TerminateThread(threads[0], 0); + + /* Close the adapters */ + pcap_close(adhandle1); + pcap_close(adhandle2); + + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* + * Install a CTRL+C handler that will do the cleanups on exit + */ + signal(SIGINT, ctrlc_handler); + + /* + * Done! + * Wait for the Greek calends... + */ + printf("\nStart bridging the two adapters...\n", d->description); + Sleep(INFINITE); + return 0; +} + +/******************************************************************* + * Forwarding thread. + * Gets the packets from the input adapter and sends them to the output one. + *******************************************************************/ +DWORD WINAPI CaptureAndForwardThread(LPVOID lpParameter) +{ + struct pcap_pkthdr *header; + const u_char *pkt_data; + int res = 0; + in_out_adapters* ad_couple = lpParameter; + unsigned int n_fwd = 0; + + /* + * Loop receiving packets from the first input adapter + */ + + while((!kill_forwaders) && (res = pcap_next_ex(ad_couple->input_adapter, &header, &pkt_data)) >= 0) + { + if(res != 0) /* Note: res=0 means "read timeout elapsed"*/ + { + /* + * Print something, just to show when we have activity. + * BEWARE: acquiring a critical section and printing strings with printf + * is something inefficient that you seriously want to avoid in your packet loop! + * However, since this is a *sample program*, we privilege visual output to efficiency. + */ + EnterCriticalSection(&print_cs); + + if(ad_couple->state == 0) + printf(">> Len: %u\n", header->caplen); + else + printf("<< Len: %u\n", header->caplen); + + LeaveCriticalSection(&print_cs); + + /* + * Send the just received packet to the output adaper + */ + if(pcap_sendpacket(ad_couple->output_adapter, pkt_data, header->caplen) != 0) + { + EnterCriticalSection(&print_cs); + + printf("Error sending a %u bytes packets on interface %u: %s\n", + header->caplen, + ad_couple->state, + pcap_geterr(ad_couple->output_adapter)); + + LeaveCriticalSection(&print_cs); + } + else + { + n_fwd++; + } + } + } + + /* + * We're out of the main loop. Check the reason. + */ + if(res < 0) + { + EnterCriticalSection(&print_cs); + + printf("Error capturing the packets: %s\n", pcap_geterr(ad_couple->input_adapter)); + fflush(stdout); + + LeaveCriticalSection(&print_cs); + } + else + { + EnterCriticalSection(&print_cs); + + printf("End of bridging on interface %u. Forwarded packets:%u\n", + ad_couple->state, + n_fwd); + fflush(stdout); + + LeaveCriticalSection(&print_cs); + } + + return 0; +} + +/******************************************************************* + * CTRL+C hanlder. + * We order the threads to die and then we patiently wait for their + * suicide. + *******************************************************************/ +void ctrlc_handler(int sig) +{ + /* + * unused variable + */ + (VOID)(sig); + + kill_forwaders = 1; + + WaitForMultipleObjects(2, + threads, + TRUE, /* Wait for all the handles */ + 5000); /* Timeout */ + + exit(0); +} diff --git a/network/start/lib/npcap/Examples-remote/UserLevelBridge/UserBridge.vcxproj b/network/start/lib/npcap/Examples-remote/UserLevelBridge/UserBridge.vcxproj new file mode 100644 index 0000000..71247dd --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/UserLevelBridge/UserBridge.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {BB73BFD4-454F-42C8-AFE6-FA890A8BD8FC} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/iflist/iflist.c b/network/start/lib/npcap/Examples-remote/iflist/iflist.c new file mode 100644 index 0000000..fcf59ae --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/iflist/iflist.c @@ -0,0 +1,200 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + +#include + +#include "pcap.h" + +#ifndef WIN32 + #include + #include +#else + #include + #include +BOOL LoadNpcapDlls() +{ + TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, TEXT("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +#endif + + +// Function prototypes +void ifprint(pcap_if_t *d); +char *iptos(u_long in); +char* ip6tos(struct sockaddr *sockaddr, char *address, int addrlen); + + +int main() +{ + pcap_if_t *alldevs; + pcap_if_t *d; + char errbuf[PCAP_ERRBUF_SIZE+1]; + char source[PCAP_ERRBUF_SIZE+1]; +#ifdef WIN32 + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } +#endif + printf("Enter the device you want to list:\n" + "rpcap:// ==> lists interfaces in the local machine\n" + "rpcap://hostname:port ==> lists interfaces in a remote machine\n" + " (rpcapd daemon must be up and running\n" + " and it must accept 'null' authentication)\n" + "file://foldername ==> lists all pcap files in the give folder\n\n" + "Enter your choice: "); + + fgets(source, PCAP_ERRBUF_SIZE, stdin); + source[PCAP_ERRBUF_SIZE] = '\0'; + + /* Retrieve the interfaces list */ + if (pcap_findalldevs_ex(source, NULL, &alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs: %s\n",errbuf); + exit(1); + } + + /* Scan the list printing every entry */ + for(d=alldevs;d;d=d->next) + { + ifprint(d); + } + + pcap_freealldevs(alldevs); + + return 1; +} + + + +/* Print all the available information on the given interface */ +void ifprint(pcap_if_t *d) +{ + pcap_addr_t *a; + char ip6str[128]; + + /* Name */ + printf("%s\n",d->name); + + /* Description */ + if (d->description) + printf("\tDescription: %s\n",d->description); + + /* Loopback Address*/ + printf("\tLoopback: %s\n",(d->flags & PCAP_IF_LOOPBACK)?"yes":"no"); + + /* IP addresses */ + for(a=d->addresses;a;a=a->next) { + printf("\tAddress Family: #%d\n",a->addr->sa_family); + + switch(a->addr->sa_family) + { + case AF_INET: + printf("\tAddress Family Name: AF_INET\n"); + if (a->addr) + printf("\tAddress: %s\n",iptos(((struct sockaddr_in *)a->addr)->sin_addr.s_addr)); + if (a->netmask) + printf("\tNetmask: %s\n",iptos(((struct sockaddr_in *)a->netmask)->sin_addr.s_addr)); + if (a->broadaddr) + printf("\tBroadcast Address: %s\n",iptos(((struct sockaddr_in *)a->broadaddr)->sin_addr.s_addr)); + if (a->dstaddr) + printf("\tDestination Address: %s\n",iptos(((struct sockaddr_in *)a->dstaddr)->sin_addr.s_addr)); + break; + + case AF_INET6: + printf("\tAddress Family Name: AF_INET6\n"); + if (a->addr) + printf("\tAddress: %s\n", ip6tos(a->addr, ip6str, sizeof(ip6str))); + break; + + default: + printf("\tAddress Family Name: Unknown\n"); + break; + } + } + printf("\n"); +} + + + +/* From tcptraceroute, convert a numeric IP address to a string */ +#define IPTOSBUFFERS 12 +char *iptos(u_long in) +{ + static char output[IPTOSBUFFERS][3*4+3+1]; + static short which; + u_char *p; + + p = (u_char *)∈ + which = (which + 1 == IPTOSBUFFERS ? 0 : which + 1); + _snprintf_s(output[which], sizeof(output[which]), sizeof(output[which]),"%d.%d.%d.%d", p[0], p[1], p[2], p[3]); + return output[which]; +} + +char* ip6tos(struct sockaddr *sockaddr, char *address, int addrlen) +{ + socklen_t sockaddrlen; + + #ifdef WIN32 + sockaddrlen = sizeof(struct sockaddr_in6); + #else + sockaddrlen = sizeof(struct sockaddr_storage); + #endif + + + if(getnameinfo(sockaddr, + sockaddrlen, + address, + addrlen, + NULL, + 0, + NI_NUMERICHOST) != 0) address = NULL; + + return address; +} + + diff --git a/network/start/lib/npcap/Examples-remote/iflist/iflist.vcxproj b/network/start/lib/npcap/Examples-remote/iflist/iflist.vcxproj new file mode 100644 index 0000000..1996bbc --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/iflist/iflist.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {0B27B213-4BF3-4611-B412-A2D09CDE8632} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + \ No newline at end of file diff --git a/network/start/lib/npcap/Examples-remote/iflist/iflist.vcxproj.filters b/network/start/lib/npcap/Examples-remote/iflist/iflist.vcxproj.filters new file mode 100644 index 0000000..cd39ae5 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/iflist/iflist.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + \ No newline at end of file diff --git a/network/start/lib/npcap/Examples-remote/misc/basic_dump.c b/network/start/lib/npcap/Examples-remote/misc/basic_dump.c new file mode 100644 index 0000000..bf9d46b --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/misc/basic_dump.c @@ -0,0 +1,108 @@ +#include +#include "misc.h" + +/* prototype of the packet handler */ +void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data); + +int main() +{ +pcap_if_t *alldevs; +pcap_if_t *d; +int inum; +int i=0; +pcap_t *adhandle; +char errbuf[PCAP_ERRBUF_SIZE]; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + /* Retrieve the device list on the local machine */ + if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf); + exit(1); + } + + /* Print the list */ + for(d=alldevs; d; d=d->next) + { + printf("%d. %s", ++i, d->name); + if (d->description) + printf(" (%s)\n", d->description); + else + printf(" (No description available)\n"); + } + + if(i==0) + { + printf("\nNo interfaces found! Make sure Npcap is installed.\n"); + return -1; + } + + printf("Enter the interface number (1-%d):",i); + scanf_s("%d", &inum); + + if(inum < 1 || inum > i) + { + printf("\nInterface number out of range.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Jump to the selected adapter */ + for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++); + + /* Open the device */ + if ( (adhandle= pcap_open(d->name, // name of the device + 65536, // portion of the packet to capture + // 65536 guarantees that the whole packet will be captured on all the link layers + PCAP_OPENFLAG_PROMISCUOUS, // promiscuous mode + 1000, // read timeout + NULL, // authentication on the remote machine + errbuf // error buffer + ) ) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->name); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + printf("\nlistening on %s...\n", d->description); + + /* At this point, we don't need any more the device list. Free it */ + pcap_freealldevs(alldevs); + + /* start the capture */ + pcap_loop(adhandle, 0, packet_handler, NULL); + + return 0; +} + + +/* Callback function invoked by libpcap for every incoming packet */ +void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data) +{ + struct tm ltime; + char timestr[16]; + time_t local_tv_sec; + + /* + * unused variables + */ + (VOID)(param); + (VOID)(pkt_data); + + /* convert the timestamp to readable format */ + local_tv_sec = header->ts.tv_sec; + localtime_s(<ime, &local_tv_sec); + strftime( timestr, sizeof timestr, "%H:%M:%S", <ime); + + printf("%s,%.6d len:%d\n", timestr, header->ts.tv_usec, header->len); + +} diff --git a/network/start/lib/npcap/Examples-remote/misc/basic_dump.vcxproj b/network/start/lib/npcap/Examples-remote/misc/basic_dump.vcxproj new file mode 100644 index 0000000..37f7f55 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/misc/basic_dump.vcxproj @@ -0,0 +1,147 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {66297062-96A0-4F0E-B147-3C8384031232} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/misc/basic_dump_ex.c b/network/start/lib/npcap/Examples-remote/misc/basic_dump_ex.c new file mode 100644 index 0000000..d4db2fe --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/misc/basic_dump_ex.c @@ -0,0 +1,99 @@ +#include "pcap.h" + + +int main() +{ +pcap_if_t *alldevs; +pcap_if_t *d; +int inum; +int i=0; +pcap_t *adhandle; +int res; +char errbuf[PCAP_ERRBUF_SIZE]; +struct tm ltime; +char timestr[16]; +struct pcap_pkthdr *header; +const u_char *pkt_data; +time_t local_tv_sec; + + + /* Retrieve the device list on the local machine */ + if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf); + exit(1); + } + + /* Print the list */ + for(d=alldevs; d; d=d->next) + { + printf("%d. %s", ++i, d->name); + if (d->description) + printf(" (%s)\n", d->description); + else + printf(" (No description available)\n"); + } + + if(i==0) + { + printf("\nNo interfaces found! Make sure Npcap is installed.\n"); + return -1; + } + + printf("Enter the interface number (1-%d):",i); + scanf_s("%d", &inum); + + if(inum < 1 || inum > i) + { + printf("\nInterface number out of range.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Jump to the selected adapter */ + for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++); + + /* Open the device */ + if ( (adhandle= pcap_open(d->name, // name of the device + 65536, // portion of the packet to capture. + // 65536 guarantees that the whole packet will be captured on all the link layers + PCAP_OPENFLAG_PROMISCUOUS, // promiscuous mode + 1000, // read timeout + NULL, // authentication on the remote machine + errbuf // error buffer + ) ) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->name); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + printf("\nlistening on %s...\n", d->description); + + /* At this point, we don't need any more the device list. Free it */ + pcap_freealldevs(alldevs); + + /* Retrieve the packets */ + while((res = pcap_next_ex( adhandle, &header, &pkt_data)) >= 0){ + + if(res == 0) + /* Timeout elapsed */ + continue; + + /* convert the timestamp to readable format */ + local_tv_sec = header->ts.tv_sec; + localtime_s(<ime, &local_tv_sec); + strftime( timestr, sizeof timestr, "%H:%M:%S", <ime); + + printf("%s,%.6d len:%d\n", timestr, header->ts.tv_usec, header->len); + } + + if(res == -1){ + printf("Error reading the packets: %s\n", pcap_geterr(adhandle)); + return -1; + } + + return 0; +} diff --git a/network/start/lib/npcap/Examples-remote/misc/basic_dump_ex.vcxproj b/network/start/lib/npcap/Examples-remote/misc/basic_dump_ex.vcxproj new file mode 100644 index 0000000..6851dd2 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/misc/basic_dump_ex.vcxproj @@ -0,0 +1,147 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {92849630-6B09-409C-A7AD-E91E682558B1} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/misc/misc.h b/network/start/lib/npcap/Examples-remote/misc/misc.h new file mode 100644 index 0000000..ce96396 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/misc/misc.h @@ -0,0 +1,19 @@ +#include +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} + diff --git a/network/start/lib/npcap/Examples-remote/misc/readfile.c b/network/start/lib/npcap/Examples-remote/misc/readfile.c new file mode 100644 index 0000000..8a04a73 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/misc/readfile.c @@ -0,0 +1,86 @@ +#include +#include +#include "misc.h" + +#define LINE_LEN 16 + +void dispatcher_handler(u_char *, const struct pcap_pkthdr *, const u_char *); + +int main(int argc, char **argv) +{ +pcap_t *fp; +char errbuf[PCAP_ERRBUF_SIZE]; +char source[PCAP_BUF_SIZE]; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + if(argc != 2){ + + printf("usage: %s filename", argv[0]); + return -1; + + } + + /* Create the source string according to the new WinPcap syntax */ + if ( pcap_createsrcstr( source, // variable that will keep the source string + PCAP_SRC_FILE, // we want to open a file + NULL, // remote host + NULL, // port on the remote host + argv[1], // name of the file we want to open + errbuf // error buffer + ) != 0) + { + fprintf(stderr,"\nError creating a source string\n"); + return -1; + } + + /* Open the capture file */ + if ( (fp= pcap_open(source, // name of the device + 65536, // portion of the packet to capture + // 65536 guarantees that the whole packet will be captured on all the link layers + PCAP_OPENFLAG_PROMISCUOUS, // promiscuous mode + 1000, // read timeout + NULL, // authentication on the remote machine + errbuf // error buffer + ) ) == NULL) + { + fprintf(stderr,"\nUnable to open the file %s.\n", source); + return -1; + } + + // read and dispatch packets until EOF is reached + pcap_loop(fp, 0, dispatcher_handler, NULL); + + return 0; +} + + + +void dispatcher_handler(u_char *temp1, + const struct pcap_pkthdr *header, const u_char *pkt_data) +{ + u_int i=0; + + /* + * Unused variable + */ + (VOID)temp1; + + /* print pkt timestamp and pkt len */ + printf("%ld:%ld (%ld)\n", header->ts.tv_sec, header->ts.tv_usec, header->len); + + /* Print the packet */ + for (i=1; (i < header->caplen + 1 ) ; i++) + { + printf("%.2x ", pkt_data[i-1]); + if ( (i % LINE_LEN) == 0) printf("\n"); + } + + printf("\n\n"); + +} diff --git a/network/start/lib/npcap/Examples-remote/misc/readfile.vcxproj b/network/start/lib/npcap/Examples-remote/misc/readfile.vcxproj new file mode 100644 index 0000000..72060be --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/misc/readfile.vcxproj @@ -0,0 +1,147 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {161E7606-F4CD-4A04-AB6B-5837F7818EE1} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/misc/readfile_ex.c b/network/start/lib/npcap/Examples-remote/misc/readfile_ex.c new file mode 100644 index 0000000..4533d70 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/misc/readfile_ex.c @@ -0,0 +1,81 @@ +#include +#include +#include "misc.h" + +#define LINE_LEN 16 + +int main(int argc, char **argv) +{ +pcap_t *fp; +char errbuf[PCAP_ERRBUF_SIZE]; +char source[PCAP_BUF_SIZE]; +struct pcap_pkthdr *header; +const u_char *pkt_data; +u_int i=0; +int res; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + if(argc != 2) + { + printf("usage: %s filename", argv[0]); + return -1; + } + + /* Create the source string according to the new WinPcap syntax */ + if ( pcap_createsrcstr( source, // variable that will keep the source string + PCAP_SRC_FILE, // we want to open a file + NULL, // remote host + NULL, // port on the remote host + argv[1], // name of the file we want to open + errbuf // error buffer + ) != 0) + { + fprintf(stderr,"\nError creating a source string\n"); + return -1; + } + + /* Open the capture file */ + if ( (fp= pcap_open(source, // name of the device + 65536, // portion of the packet to capture + // 65536 guarantees that the whole packet will be captured on all the link layers + PCAP_OPENFLAG_PROMISCUOUS, // promiscuous mode + 1000, // read timeout + NULL, // authentication on the remote machine + errbuf // error buffer + ) ) == NULL) + { + fprintf(stderr,"\nUnable to open the file %s.\n", source); + return -1; + } + + /* Retrieve the packets from the file */ + while((res = pcap_next_ex( fp, &header, &pkt_data)) >= 0) + { + /* print pkt timestamp and pkt len */ + printf("%ld:%ld (%ld)\n", header->ts.tv_sec, header->ts.tv_usec, header->len); + + /* Print the packet */ + for (i=1; (i < header->caplen + 1 ) ; i++) + { + printf("%.2x ", pkt_data[i-1]); + if ( (i % LINE_LEN) == 0) printf("\n"); + } + + printf("\n\n"); + } + + + if (res == -1) + { + printf("Error reading the packets: %s\n", pcap_geterr(fp)); + } + + return 0; +} + diff --git a/network/start/lib/npcap/Examples-remote/misc/readfile_ex.vcxproj b/network/start/lib/npcap/Examples-remote/misc/readfile_ex.vcxproj new file mode 100644 index 0000000..b1c4002 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/misc/readfile_ex.vcxproj @@ -0,0 +1,147 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {3071DFB6-68F8-41EF-A56C-0C7A71B6967C} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/misc/savedump.c b/network/start/lib/npcap/Examples-remote/misc/savedump.c new file mode 100644 index 0000000..7ba099b --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/misc/savedump.c @@ -0,0 +1,110 @@ +#include +#include "misc.h" + +/* prototype of the packet handler */ +void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data); + +int main(int argc, char **argv) +{ +pcap_if_t *alldevs; +pcap_if_t *d; +int inum; +int i=0; +pcap_t *adhandle; +char errbuf[PCAP_ERRBUF_SIZE]; +pcap_dumper_t *dumpfile; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + /* Check command line */ + if(argc != 2) + { + printf("usage: %s filename", argv[0]); + return -1; + } + + /* Retrieve the device list on the local machine */ + if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf); + exit(1); + } + + /* Print the list */ + for(d=alldevs; d; d=d->next) + { + printf("%d. %s", ++i, d->name); + if (d->description) + printf(" (%s)\n", d->description); + else + printf(" (No description available)\n"); + } + + if(i==0) + { + printf("\nNo interfaces found! Make sure Npcap is installed.\n"); + return -1; + } + + printf("Enter the interface number (1-%d):",i); + scanf_s("%d", &inum); + + if(inum < 1 || inum > i) + { + printf("\nInterface number out of range.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Jump to the selected adapter */ + for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++); + + + /* Open the device */ + if ( (adhandle= pcap_open(d->name, // name of the device + 65536, // portion of the packet to capture + // 65536 guarantees that the whole packet will be captured on all the link layers + PCAP_OPENFLAG_PROMISCUOUS, // promiscuous mode + 1000, // read timeout + NULL, // authentication on the remote machine + errbuf // error buffer + ) ) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->name); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Open the dump file */ + dumpfile = pcap_dump_open(adhandle, argv[1]); + + if(dumpfile==NULL) + { + fprintf(stderr,"\nError opening output file\n"); + return -1; + } + + printf("\nlistening on %s... Press Ctrl+C to stop...\n", d->description); + + /* At this point, we no longer need the device list. Free it */ + pcap_freealldevs(alldevs); + + /* start the capture */ + pcap_loop(adhandle, 0, packet_handler, (unsigned char *)dumpfile); + + return 0; +} + +/* Callback function invoked by libpcap for every incoming packet */ +void packet_handler(u_char *dumpfile, const struct pcap_pkthdr *header, const u_char *pkt_data) +{ + /* save the packet on the dump file */ + pcap_dump(dumpfile, header, pkt_data); +} diff --git a/network/start/lib/npcap/Examples-remote/misc/savedump.vcxproj b/network/start/lib/npcap/Examples-remote/misc/savedump.vcxproj new file mode 100644 index 0000000..7e2210f --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/misc/savedump.vcxproj @@ -0,0 +1,147 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {1B8791CB-DD15-46BF-B0A2-879892085538} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/misc/sendpack.c b/network/start/lib/npcap/Examples-remote/misc/sendpack.c new file mode 100644 index 0000000..bf819b9 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/misc/sendpack.c @@ -0,0 +1,72 @@ +#include +#include + +#include +#include "misc.h" + + +void main(int argc, char **argv) +{ +pcap_t *fp; +char errbuf[PCAP_ERRBUF_SIZE]; +u_char packet[100]; +int i; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + /* Check the validity of the command line */ + if (argc != 2) + { + printf("usage: %s interface (e.g. 'rpcap://eth0')", argv[0]); + return; + } + + /* Open the output device */ + if ( (fp= pcap_open(argv[1], // name of the device + 100, // portion of the packet to capture (only the first 100 bytes) + PCAP_OPENFLAG_PROMISCUOUS, // promiscuous mode + 1000, // read timeout + NULL, // authentication on the remote machine + errbuf // error buffer + ) ) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", argv[1]); + return; + } + + /* Supposing to be on ethernet, set mac destination to 1:1:1:1:1:1 */ + packet[0]=1; + packet[1]=1; + packet[2]=1; + packet[3]=1; + packet[4]=1; + packet[5]=1; + + /* set mac source to 2:2:2:2:2:2 */ + packet[6]=2; + packet[7]=2; + packet[8]=2; + packet[9]=2; + packet[10]=2; + packet[11]=2; + + /* Fill the rest of the packet */ + for(i=12;i<100;i++) + { + packet[i]=(u_char)i; + } + + /* Send down the packet */ + if (pcap_sendpacket(fp, packet, 100 /* size */) != 0) + { + fprintf(stderr,"\nError sending the packet: %s\n", pcap_geterr(fp)); + return; + } + + return; +} diff --git a/network/start/lib/npcap/Examples-remote/misc/sendpack.vcxproj b/network/start/lib/npcap/Examples-remote/misc/sendpack.vcxproj new file mode 100644 index 0000000..58249e2 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/misc/sendpack.vcxproj @@ -0,0 +1,147 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {1C376689-5F61-48E7-AE83-0DED9EE9E458} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + /FS %(AdditionalOptions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/pcap_filter/pcap_filter.c b/network/start/lib/npcap/Examples-remote/pcap_filter/pcap_filter.c new file mode 100644 index 0000000..ec6435d --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/pcap_filter/pcap_filter.c @@ -0,0 +1,197 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + + +#include +#include + +#include + +#define MAX_PRINT 80 +#define MAX_LINE 16 + +#ifdef WIN32 +#include +BOOL LoadNpcapDlls() +{ + TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, TEXT("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +#endif + +void usage(); + + +void main(int argc, char **argv) +{ +pcap_t *fp; +char errbuf[PCAP_ERRBUF_SIZE]; +char *source=NULL; +char *ofilename=NULL; +char *filter=NULL; +int i; +pcap_dumper_t *dumpfile; +struct bpf_program fcode; +bpf_u_int32 NetMask; +int res; +struct pcap_pkthdr *header; +const u_char *pkt_data; + +#ifdef WIN32 + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } +#endif + + if (argc == 1) + { + usage(); + return; + } + + for(i=1;i < argc; i+= 2) + { + + switch (argv[i] [1]) + { + case 's': + { + source=argv[i+1]; + }; + break; + + case 'o': + { + ofilename=argv[i+1]; + }; + break; + + case 'f': + { + filter=argv[i+1]; + }; + break; + } + } + + // open a capture from the network + if (source != NULL) + { + if ( (fp= pcap_open(source, + 1514 /*snaplen*/, + PCAP_OPENFLAG_PROMISCUOUS /*flags*/, + 20 /*read timeout*/, + NULL /* remote authentication */, + errbuf) + ) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter.\n"); + return; + } + } + + else usage(); + + if (filter != NULL) + { + // We should loop through the adapters returned by the pcap_findalldevs_ex() + // in order to locate the correct one. + // + // Let's do things simpler: we suppose to be in a C class network ;-) + NetMask=0xffffff; + + //compile the filter + if(pcap_compile(fp, &fcode, filter, 1, NetMask) < 0) + { + fprintf(stderr,"\nError compiling filter: wrong syntax.\n"); + return; + } + + //set the filter + if(pcap_setfilter(fp, &fcode)<0) + { + fprintf(stderr,"\nError setting the filter\n"); + return; + } + + } + + //open the dump file + if (ofilename != NULL) + { + dumpfile= pcap_dump_open(fp, ofilename); + + if (dumpfile == NULL) + { + fprintf(stderr,"\nError opening output file\n"); + return; + } + } + else usage(); + + //start the capture + while((res = pcap_next_ex( fp, &header, &pkt_data)) >= 0) + { + + if(res == 0) + /* Timeout elapsed */ + continue; + + //save the packet on the dump file + pcap_dump((unsigned char *) dumpfile, header, pkt_data); + + } +} + + +void usage() +{ + + printf("\npf - Generic Packet Filter.\n"); + printf("\nUsage:\npf -s source -o output_file_name [-f filter_string]\n\n"); + exit(0); +} diff --git a/network/start/lib/npcap/Examples-remote/pcap_filter/pcap_filter.vcxproj b/network/start/lib/npcap/Examples-remote/pcap_filter/pcap_filter.vcxproj new file mode 100644 index 0000000..95e021c --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/pcap_filter/pcap_filter.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {B9F68F6F-22AE-47A2-A3A3-1212831AF9FF} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/pcap_fopen/pcap_fopen.cpp b/network/start/lib/npcap/Examples-remote/pcap_fopen/pcap_fopen.cpp new file mode 100644 index 0000000..dd4cad3 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/pcap_fopen/pcap_fopen.cpp @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2008 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of CACE Technologies nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + * This sample was contributed by + * Marcin Okraszewski (Marcin.OkraszewskiATpl.compuware.com) + * + */ + +#include +#include +#include + +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} + +/** Prints packet timestaps regardless of format*/ +int _tmain(int argc, _TCHAR* argv[]) +{ + char errbuf[PCAP_ERRBUF_SIZE]; + _TCHAR cmd[1024]; + _TCHAR tshark_path[MAX_PATH]; + _TCHAR file_path[MAX_PATH]; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + if ( argc != 3 ) { + _tprintf(_T("Prints packet timestaps regardless of format.\n")); + _tprintf(_T("Usage:\n\t%s \n"), argv[0]); + return 1; + } + + // conversion to short path name in case there are spaces + if ( ! GetShortPathName(argv[1], tshark_path, MAX_PATH) || + ! GetShortPathName(argv[2], file_path, MAX_PATH) ) + { + _tprintf(_T("Failed to convert paths to short form.")); + return 1; + } + + // create tshark command, which will make the trace conversion and print in libpcap format to stdout + if ( _stprintf_s(cmd, 1024, _T("%s -r %s -w - -F libpcap"), tshark_path, file_path) < 0 ) { + _tprintf(_T("Failed to create command\n")); + return 1; + } + + // start tshark + FILE *tshark_out = _tpopen(cmd, _T("rb")); + if ( tshark_out == NULL ) { + strerror_s(errbuf, PCAP_ERRBUF_SIZE, errno); + printf("Failed run tshark: %s\n", errbuf); + _tprintf(_T("Command: %s"), cmd); + return 1; + } + + // open stdout from tshark + pcap_t *pcap = pcap_fopen_offline(tshark_out, errbuf); + if ( pcap == NULL ) { + printf("Error opening stream from tshark: %s\n", errbuf); + return 1; + } + + // print information about every packet int trace + struct pcap_pkthdr hdr; + while ( pcap_next(pcap, &hdr) ) { + printf("packet: ts: %u.%06u, len: %4u, caplen: %4u\n", hdr.ts.tv_sec, hdr.ts.tv_usec, hdr.len, hdr.caplen); + } + + // clean up + pcap_close(pcap); + _pclose(tshark_out); + return 0; +} + diff --git a/network/start/lib/npcap/Examples-remote/pcap_fopen/pcap_fopen.vcxproj b/network/start/lib/npcap/Examples-remote/pcap_fopen/pcap_fopen.vcxproj new file mode 100644 index 0000000..8b84468 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/pcap_fopen/pcap_fopen.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {DD317CB5-6337-498F-A560-553B5558E133} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + _UNICODE;UNICODE;WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + _UNICODE;UNICODE;WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + _UNICODE;UNICODE;WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + _UNICODE;UNICODE;WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/pktdump_ex/pktdump_ex.c b/network/start/lib/npcap/Examples-remote/pktdump_ex/pktdump_ex.c new file mode 100644 index 0000000..82a94a3 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/pktdump_ex/pktdump_ex.c @@ -0,0 +1,188 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + + +#include +#include + +// +// NOTE: remember to include WPCAP and HAVE_REMOTE among your +// preprocessor definitions. +// + +#include + +#define LINE_LEN 16 + +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} + +int main(int argc, char **argv) +{ +pcap_if_t *alldevs, *d; +pcap_t *fp; +u_int inum, i=0; +char errbuf[PCAP_ERRBUF_SIZE]; +int res; +struct pcap_pkthdr *header; +const u_char *pkt_data; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + printf("pktdump_ex: prints the packets of the network using Npcap.\n"); + printf(" Usage: pktdump_ex [-s source]\n\n" + " Examples:\n" + " pktdump_ex -s file://c:/temp/file.acp\n" + " pktdump_ex -s rpcap://\\Device\\NPF_{C8736017-F3C3-4373-94AC-9A34B7DAD998}\n\n"); + + if(argc < 3) + { + + printf("\nNo adapter selected: printing the device list:\n"); + /* The user didn't provide a packet source: Retrieve the local device list */ + if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs_ex: %s\n", errbuf); + return -1; + } + + /* Print the list */ + for(d=alldevs; d; d=d->next) + { + printf("%d. %s\n ", ++i, d->name); + + if (d->description) + printf(" (%s)\n", d->description); + else + printf(" (No description available)\n"); + } + + if (i==0) + { + fprintf(stderr,"No interfaces found! Exiting.\n"); + return -1; + } + + printf("Enter the interface number (1-%d):",i); + scanf_s("%d", &inum); + + if (inum < 1 || inum > i) + { + printf("\nInterface number out of range.\n"); + + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Jump to the selected adapter */ + for (d=alldevs, i=0; i< inum-1 ;d=d->next, i++); + + /* Open the device */ + if ( (fp= pcap_open(d->name, + 100 /*snaplen*/, + PCAP_OPENFLAG_PROMISCUOUS /*flags*/, + 20 /*read timeout*/, + NULL /* remote authentication */, + errbuf) + ) == NULL) + { + fprintf(stderr,"\nError opening adapter\n"); + return -1; + } + } + else + { + // Do not check for the switch type ('-s') + if ( (fp= pcap_open(argv[2], + 100 /*snaplen*/, + PCAP_OPENFLAG_PROMISCUOUS /*flags*/, + 20 /*read timeout*/, + NULL /* remote authentication */, + errbuf) + ) == NULL) + { + fprintf(stderr,"\nError opening source: %s\n", errbuf); + return -1; + } + } + + /* Read the packets */ + while((res = pcap_next_ex( fp, &header, &pkt_data)) >= 0) + { + + if(res == 0) + /* Timeout elapsed */ + continue; + + /* print pkt timestamp and pkt len */ + printf("%ld:%ld (%ld)\n", header->ts.tv_sec, header->ts.tv_usec, header->len); + + /* Print the packet */ + for (i=1; (i < header->caplen + 1 ) ; i++) + { + printf("%.2x ", pkt_data[i-1]); + if ( (i % LINE_LEN) == 0) printf("\n"); + } + + printf("\n\n"); + } + + if(res == -1) + { + fprintf(stderr, "Error reading the packets: %s\n", pcap_geterr(fp)); + return -1; + } + + return 0; +} diff --git a/network/start/lib/npcap/Examples-remote/pktdump_ex/pktdump_ex.vcxproj b/network/start/lib/npcap/Examples-remote/pktdump_ex/pktdump_ex.vcxproj new file mode 100644 index 0000000..752e2fc --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/pktdump_ex/pktdump_ex.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {3D62DEB4-3536-44AE-8E4B-AD6DFF1B795E} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/sendcap/sendcap.c b/network/start/lib/npcap/Examples-remote/sendcap/sendcap.c new file mode 100644 index 0000000..5b1b08f --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/sendcap/sendcap.c @@ -0,0 +1,213 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + +#include +#include + +#include + +#ifdef WIN32 +#include +BOOL LoadNpcapDlls() +{ + TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, TEXT("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} +#endif + +void usage(); + +void main(int argc, char **argv) +{ + pcap_t *indesc,*outdesc; + char errbuf[PCAP_ERRBUF_SIZE]; + char source[PCAP_BUF_SIZE]; + FILE *capfile; + int caplen, sync; + u_int res; + pcap_send_queue *squeue; + struct pcap_pkthdr *pktheader; + u_char *pktdata; + float cpu_time; + u_int npacks = 0; + errno_t fopen_error; + +#ifdef WIN32 + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } +#endif + + /* Check the validity of the command line */ + if (argc <= 2 || argc >= 5) + { + usage(); + return; + } + + /* Retrieve the length of the capture file */ + fopen_error = fopen_s(&capfile, argv[1],"rb"); + if(fopen_error != 0){ + printf("Error opening the file, errno %d.\n", fopen_error); + return; + } + + fseek(capfile , 0, SEEK_END); + caplen= ftell(capfile)- sizeof(struct pcap_file_header); + fclose(capfile); + + /* Chek if the timestamps must be respected */ + if(argc == 4 && argv[3][0] == 's') + sync = TRUE; + else + sync = FALSE; + + /* Open the capture */ + /* Create the source string according to the new WinPcap syntax */ + if ( pcap_createsrcstr( source, // variable that will keep the source string + PCAP_SRC_FILE, // we want to open a file + NULL, // remote host + NULL, // port on the remote host + argv[1], // name of the file we want to open + errbuf // error buffer + ) != 0) + { + fprintf(stderr,"\nError creating a source string\n"); + return; + } + + /* Open the capture file */ + if ( (indesc= pcap_open(source, 65536, PCAP_OPENFLAG_PROMISCUOUS, 1000, NULL, errbuf) ) == NULL) + { + fprintf(stderr,"\nUnable to open the file %s.\n", source); + return; + } + + /* Open the output adapter */ + if ( (outdesc= pcap_open(argv[2], 100, PCAP_OPENFLAG_PROMISCUOUS, 1000, NULL, errbuf) ) == NULL) + { + fprintf(stderr,"\nUnable to open adapter %s.\n", source); + return; + } + + /* Check the MAC type */ + if (pcap_datalink(indesc) != pcap_datalink(outdesc)) + { + printf("Warning: the datalink of the capture differs from the one of the selected interface.\n"); + printf("Press a key to continue, or CTRL+C to stop.\n"); + getchar(); + } + + /* Allocate a send queue */ + squeue = pcap_sendqueue_alloc(caplen); + + /* Fill the queue with the packets from the file */ + while ((res = pcap_next_ex( indesc, &pktheader, &pktdata)) == 1) + { + if (pcap_sendqueue_queue(squeue, pktheader, pktdata) == -1) + { + printf("Warning: packet buffer too small, not all the packets will be sent.\n"); + break; + } + + npacks++; + } + + if (res == -1) + { + printf("Corrupted input file.\n"); + pcap_sendqueue_destroy(squeue); + return; + } + + /* Transmit the queue */ + + cpu_time = (float)clock (); + + if ((res = pcap_sendqueue_transmit(outdesc, squeue, sync)) < squeue->len) + { + printf("An error occurred sending the packets: %s. Only %d bytes were sent\n", pcap_geterr(outdesc), res); + } + + cpu_time = (clock() - cpu_time)/CLK_TCK; + + printf ("\n\nElapsed time: %5.3f\n", cpu_time); + printf ("\nTotal packets generated = %d", npacks); + printf ("\nAverage packets per second = %d", (int)((double)npacks/cpu_time)); + printf ("\n"); + + /* free the send queue */ + pcap_sendqueue_destroy(squeue); + + /* Close the input file */ + pcap_close(indesc); + + /* + * lose the output adapter + * IMPORTANT: remember to close the adapter, otherwise there will be no guarantee that all the + * packets will be sent! + */ + pcap_close(outdesc); + + + return; +} + + +void usage() +{ + + printf("\nSendcap, sends a libpcap/tcpdump capture file to the net. Copyright (C) 2002 Loris Degioanni.\n"); + printf("\nUsage:\n"); + printf("\t sendcap file_name adapter [s]\n"); + printf("\nParameters:\n"); + printf("\nfile_name: the name of the dump file that will be sent to the network\n"); + printf("\nadapter: the device to use. Use \"WinDump -D\" for a list of valid devices\n"); + printf("\ns: if present, forces the packets to be sent synchronously, i.e. respecting the timestamps in the dump file. This option will work only under Windows NTx.\n\n"); + + exit(0); +} diff --git a/network/start/lib/npcap/Examples-remote/sendcap/sendcap.vcxproj b/network/start/lib/npcap/Examples-remote/sendcap/sendcap.vcxproj new file mode 100644 index 0000000..3eb3c5a --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/sendcap/sendcap.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {D6B93A03-446A-4B13-87B8-9AA752A5CC8C} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/sendcap/sendcap.vcxproj.filters b/network/start/lib/npcap/Examples-remote/sendcap/sendcap.vcxproj.filters new file mode 100644 index 0000000..cd39ae5 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/sendcap/sendcap.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + \ No newline at end of file diff --git a/network/start/lib/npcap/Examples-remote/smp_1/smp_1.c b/network/start/lib/npcap/Examples-remote/smp_1/smp_1.c new file mode 100644 index 0000000..e816eb0 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/smp_1/smp_1.c @@ -0,0 +1,159 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + + +#include +#include +#include + +#include + +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} + + +int main() +{ +pcap_if_t *alldevs, *d; +pcap_t *fp; +u_int inum, i=0; +char errbuf[PCAP_ERRBUF_SIZE]; +int res; +struct pcap_pkthdr *header; +const u_char *pkt_data; +struct pcap_pkthdr old; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + printf("SMP_1\n"); + printf("\nThis program tests the Npcap kernel driver on SMP machines.\n"); + printf("The program tests that timestamps on the captured packets are consistent,\n"); + printf("and that the caplen is equal to the packet length.\n"); + printf("If there is an error, it will print out a message saying \"Inconsistent XXX\"\n"); + + if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1) + { + fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf); + exit(1); + } + + /* Print the list */ + for(d=alldevs; d; d=d->next) + { + printf("%d. %s", ++i, d->name); + if (d->description) + printf(" (%s)\n", d->description); + else + printf(" (No description available)\n"); + } + + if(i==0) + { + printf("\nNo interfaces found! Make sure Npcap is installed.\n"); + return -1; + } + + printf("Enter the interface number (1-%d):",i); + scanf_s("%d", &inum); + + if(inum < 1 || inum > i) + { + printf("\nInterface number out of range.\n"); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + /* Jump to the selected adapter */ + for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++); + + /* Open the device */ + if ( (fp= pcap_open(d->name, 65536, PCAP_OPENFLAG_PROMISCUOUS, 1000, NULL, errbuf) ) == NULL) + { + fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->name); + /* Free the device list */ + pcap_freealldevs(alldevs); + return -1; + } + + old.ts.tv_sec=0; + old.ts.tv_usec=0; + + + /* Read the packets */ + while((res = pcap_next_ex( fp, &header, &pkt_data)) >= 0){ + + if(res == 0) + continue; + + //check that caplen is equal to packet length + if (header->caplen!=header->len) + printf("Inconsistent header: CapLen %d\t Len %d\n",header->caplen,header->len); + + //check that timestamps always grow + if ( old.ts.tv_sec > header->ts.tv_sec || (old.ts.tv_sec == header->ts.tv_sec && old.ts.tv_usec > header->ts.tv_usec)) + printf("Inconsistent Timestamps! Old was %d.%.06d - New is %d.%.06d\n",old.ts.tv_sec,old.ts.tv_usec, header->ts.tv_sec,header->ts.tv_usec); + + old=*header; + + } + + if(res == -1){ + printf("Error reading the packets: %s\n", pcap_geterr(fp)); + return -1; + } + + _getch(); + + return 0; +} diff --git a/network/start/lib/npcap/Examples-remote/smp_1/smp_1.vcxproj b/network/start/lib/npcap/Examples-remote/smp_1/smp_1.vcxproj new file mode 100644 index 0000000..a94689a --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/smp_1/smp_1.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {21F49E7F-6C58-4DA5-ABE5-A9DFB6165C83} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Examples-remote/tcptop/tcptop.c b/network/start/lib/npcap/Examples-remote/tcptop/tcptop.c new file mode 100644 index 0000000..6b04405 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/tcptop/tcptop.c @@ -0,0 +1,183 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + +#include +#include + +#include + +#include +BOOL LoadNpcapDlls() +{ + _TCHAR npcap_dir[512]; + UINT len; + len = GetSystemDirectory(npcap_dir, 480); + if (!len) { + fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError()); + return FALSE; + } + _tcscat_s(npcap_dir, 512, _T("\\Npcap")); + if (SetDllDirectory(npcap_dir) == 0) { + fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError()); + return FALSE; + } + return TRUE; +} + +void usage(); + +void dispatcher_handler(u_char *, const struct pcap_pkthdr *, const u_char *); + + +void main(int argc, char **argv) +{ +pcap_t *fp; +char errbuf[PCAP_ERRBUF_SIZE]; +struct timeval st_ts; +u_int netmask; +struct bpf_program fcode; + + /* Load Npcap and its functions. */ + if (!LoadNpcapDlls()) + { + fprintf(stderr, "Couldn't load Npcap\n"); + exit(1); + } + + /* Check the validity of the command line */ + if (argc != 2) + { + usage(); + return; + } + + /* Open the output adapter */ + if ( (fp= pcap_open(argv[1], 100, PCAP_OPENFLAG_PROMISCUOUS, 1000, NULL, errbuf) ) == NULL) + { + fprintf(stderr,"\nUnable to open adapter %s.\n", errbuf); + return; + } + + /* Don't care about netmask, it won't be used for this filter */ + netmask=0xffffff; + + //compile the filter + if (pcap_compile(fp, &fcode, "tcp", 1, netmask) <0 ) + { + fprintf(stderr,"\nUnable to compile the packet filter. Check the syntax.\n"); + /* Free the device list */ + return; + } + + //set the filter + if (pcap_setfilter(fp, &fcode)<0) + { + fprintf(stderr,"\nError setting the filter.\n"); + pcap_close(fp); + /* Free the device list */ + return; + } + + /* Put the interface in statstics mode */ + if (pcap_setmode(fp, MODE_STAT)<0) + { + fprintf(stderr,"\nError setting the mode.\n"); + pcap_close(fp); + /* Free the device list */ + return; + } + + + printf("TCP traffic summary:\n"); + + /* Start the main loop */ + pcap_loop(fp, 0, dispatcher_handler, (PUCHAR)&st_ts); + + pcap_close(fp); + return; +} + +void dispatcher_handler(u_char *state, const struct pcap_pkthdr *header, const u_char *pkt_data) +{ + struct timeval *old_ts = (struct timeval *)state; + u_int delay; + LARGE_INTEGER Bps,Pps; + struct tm ltime; + char timestr[16]; + time_t local_tv_sec; + + /* Calculate the delay in microseconds from the last sample. */ + /* This value is obtained from the timestamp that the associated with the sample. */ + delay=(header->ts.tv_sec - old_ts->tv_sec) * 1000000 - old_ts->tv_usec + header->ts.tv_usec; + /* Get the number of Bits per second */ + Bps.QuadPart=(((*(LONGLONG*)(pkt_data + 8)) * 8 * 1000000) / (delay)); + /* ^ ^ + | | + | | + | | + converts bytes in bits -- | + | + delay is expressed in microseconds -- + */ + + /* Get the number of Packets per second */ + Pps.QuadPart=(((*(LONGLONG*)(pkt_data)) * 1000000) / (delay)); + + /* Convert the timestamp to readable format */ + local_tv_sec = header->ts.tv_sec; + localtime_s(<ime, &local_tv_sec); + strftime( timestr, sizeof timestr, "%H:%M:%S", <ime); + + /* Print timestamp*/ + printf("%s ", timestr); + + /* Print the samples */ + printf("BPS=%I64u ", Bps.QuadPart); + printf("PPS=%I64u\n", Pps.QuadPart); + + //store current timestamp + old_ts->tv_sec=header->ts.tv_sec; + old_ts->tv_usec=header->ts.tv_usec; +} + + +void usage() +{ + + printf("\nShows the TCP traffic load, in bits per second and packets per second.\nCopyright (C) 2002 Loris Degioanni.\n"); + printf("\nUsage:\n"); + printf("\t tcptop adapter\n"); + printf("\t You can use \"WinDump -D\" if you don't know the name of your adapters.\n"); + + exit(0); +} diff --git a/network/start/lib/npcap/Examples-remote/tcptop/tcptop.vcxproj b/network/start/lib/npcap/Examples-remote/tcptop/tcptop.vcxproj new file mode 100644 index 0000000..1ef1bd9 --- /dev/null +++ b/network/start/lib/npcap/Examples-remote/tcptop/tcptop.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {B671D5DF-3A80-4A21-BC01-79E3FB73D372} + Win32Proj + + + + Application + true + v140 + + + Application + false + v140 + + + Application + true + v140 + + + Application + false + v140 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + wpcap.dll + C:\npcap-sdk-0.1\Lib;%(AdditionalLibraryDirectories) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + wpcap.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + wpcap.dll + C:\npcap-sdk-0.1\Lib\x64;%(AdditionalLibraryDirectories) + + + C:\npcap-sdk-0.1\Include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;HAVE_REMOTE;WPCAP;%(PreprocessorDefinitions) + + + + + + + + + diff --git a/network/start/lib/npcap/Include/Packet32.h b/network/start/lib/npcap/Include/Packet32.h new file mode 100644 index 0000000..2f0dabc --- /dev/null +++ b/network/start/lib/npcap/Include/Packet32.h @@ -0,0 +1,433 @@ +/***********************IMPORTANT NPCAP LICENSE TERMS*********************** + * * + * Npcap is a Windows packet sniffing driver and library and is copyright * + * (c) 2013-2020 by Insecure.Com LLC ("The Nmap Project"). All rights * + * reserved. * + * * + * Even though Npcap source code is publicly available for review, it is * + * not open source software and may not be redistributed or incorporated * + * into other software without special permission from the Nmap Project. * + * We fund the Npcap project by selling a commercial license which allows * + * companies to redistribute Npcap with their products and also provides * + * for support, warranty, and indemnification rights. For details on * + * obtaining such a license, please contact: * + * * + * sales@nmap.com * + * * + * Free and open source software producers are also welcome to contact us * + * for redistribution requests. However, we normally recommend that such * + * authors instead ask your users to download and install Npcap * + * themselves. * + * * + * Since the Npcap source code is available for download and review, * + * users sometimes contribute code patches to fix bugs or add new * + * features. By sending these changes to the Nmap Project (including * + * through direct email or our mailing lists or submitting pull requests * + * through our source code repository), it is understood unless you * + * specify otherwise that you are offering the Nmap Project the * + * unlimited, non-exclusive right to reuse, modify, and relicence your * + * code contribution so that we may (but are not obligated to) * + * incorporate it into Npcap. If you wish to specify special license * + * conditions or restrictions on your contributions, just say so when you * + * send them. * + * * + * This software 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. * + * * + * Other copyright notices and attribution may appear below this license * + * header. We have kept those for attribution purposes, but any license * + * terms granted by those notices apply only to their original work, and * + * not to any changes made by the Nmap Project or to this entire file. * + * * + * This header summarizes a few important aspects of the Npcap license, * + * but is not a substitute for the full Npcap license agreement, which is * + * in the LICENSE file included with Npcap and also available at * + * https://github.com/nmap/npcap/blob/master/LICENSE. * + * * + ***************************************************************************/ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2007 CACE Technologies, Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + +/** @ingroup packetapi + * @{ + */ + +/** @defgroup packet32h Packet.dll definitions and data structures + * Packet32.h contains the data structures and the definitions used by packet.dll. + * The file is used both by the Win9x and the WinNTx versions of packet.dll, and can be included + * by the applications that use the functions of this library + * @{ + */ + +#ifndef __PACKET32 +#define __PACKET32 + +#include + +#ifdef HAVE_AIRPCAP_API +#include +#else +#if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_) +#define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ +typedef struct _AirpcapHandle* PAirpcapHandle; +#endif /* AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ */ +#endif /* HAVE_AIRPCAP_API */ + +#ifdef HAVE_DAG_API +#include +#endif /* HAVE_DAG_API */ + +// Libpcap/wpcap recognizes this macro and knows Npcap Packet API is provided for compilation. +#define HAVE_NPCAP_PACKET_API + +// Working modes, a bitfield +// 0b00000000 +// | ||_ STAT or CAPT +// | |__ MON (TME extensions, not supported) +// | UNUSED +// | UNUSED +// |_____ DUMP (not supported) +#define PACKET_MODE_CAPT 0x0 ///< Capture mode +#define PACKET_MODE_STAT 0x1 ///< Statistical mode +#define PACKET_MODE_MON 0x2 ///< Monitoring mode +#define PACKET_MODE_DUMP 0x10 ///< Dump mode +#define PACKET_MODE_STAT_DUMP PACKET_MODE_DUMP | PACKET_MODE_STAT ///< Statistical dump Mode + + +/// Alignment macro. Defines the alignment size. +#define Packet_ALIGNMENT sizeof(int) +/// Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT. +#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1)) + +#define NdisMediumNull -1 ///< Custom linktype: NDIS doesn't provide an equivalent +#define NdisMediumCHDLC -2 ///< Custom linktype: NDIS doesn't provide an equivalent +#define NdisMediumPPPSerial -3 ///< Custom linktype: NDIS doesn't provide an equivalent +#define NdisMediumBare80211 -4 ///< Custom linktype: NDIS doesn't provide an equivalent +#define NdisMediumRadio80211 -5 ///< Custom linktype: NDIS doesn't provide an equivalent +#define NdisMediumPpi -6 ///< Custom linktype: NDIS doesn't provide an equivalent + +// Loopback behaviour definitions +#define NPF_DISABLE_LOOPBACK 1 ///< Drop the packets sent by the NPF driver +#define NPF_ENABLE_LOOPBACK 2 ///< Capture the packets sent by the NPF driver + +// Timestamp Modes +#define TIMESTAMPMODE_SINGLE_SYNCHRONIZATION 0 // KeQueryPerformanceCounter +#define TIMESTAMPMODE_QUERYSYSTEMTIME 2 // KeQuerySystemTime +#define TIMESTAMPMODE_QUERYSYSTEMTIME_PRECISE 4 // KeQuerySystemTimePrecise, Windows 8 and newer + +/*! + \brief Network type structure. + + This structure is used by the PacketGetNetType() function to return information on the current adapter's type and speed. +*/ +typedef struct NetType +{ + UINT LinkType; ///< The MAC of the current network adapter (see function PacketGetNetType() for more information) + ULONGLONG LinkSpeed; ///< The speed of the network in bits per second +}NetType; + + +//some definitions stolen from libpcap + +#ifndef BPF_MAJOR_VERSION + +/*! + \brief A BPF pseudo-assembly program. + + The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet. +*/ +struct bpf_program +{ + UINT bf_len; ///< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow. + struct bpf_insn* bf_insns; ///< A pointer to the first instruction of the program. +}; + +/*! + \brief A single BPF pseudo-instruction. + + bpf_insn contains a single instruction for the BPF register-machine. It is used to send a filter program to the driver. +*/ +struct bpf_insn +{ + USHORT code; ///< Instruction type and addressing mode. + UCHAR jt; ///< Jump if true + UCHAR jf; ///< Jump if false + int k; ///< Generic field used for various purposes. +}; + +/*! + \brief Structure that contains a couple of statistics values on the current capture. + + It is used by packet.dll to return statistics about a capture session. +*/ +struct bpf_stat +{ + UINT bs_recv; ///< Number of packets that the driver received from the network adapter + ///< from the beginning of the current capture. This value includes the packets + ///< lost by the driver. + UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture. + ///< Basically, a packet is lost when the the buffer of the driver is full. + ///< In this situation the packet cannot be stored and the driver rejects it. + UINT ps_ifdrop; ///< drops by interface. XXX not yet supported + UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and + ///< thus reach the application. +}; + +/*! + \brief Packet header. + + This structure defines the header associated with every packet delivered to the application. +*/ +struct bpf_hdr +{ + struct timeval bh_tstamp; ///< The timestamp associated with the captured packet. + ///< It is stored in a TimeVal structure. + UINT bh_caplen; ///< Length of captured portion. The captured portion can be different + ///< from the original packet, because it is possible (with a proper filter) + ///< to instruct the driver to capture only a portion of the packets. + UINT bh_datalen; ///< Original length of packet + USHORT bh_hdrlen; ///< Length of bpf header (this struct plus alignment padding). In some cases, + ///< a padding could be added between the end of this structure and the packet + ///< data for performance reasons. This filed can be used to retrieve the actual data + ///< of the packet. +}; + +/*! + \brief Dump packet header. + + This structure defines the header associated with the packets in a buffer to be used with PacketSendPackets(). + It is simpler than the bpf_hdr, because it corresponds to the header associated by WinPcap and libpcap to a + packet in a dump file. This makes straightforward sending WinPcap dump files to the network. +*/ +struct dump_bpf_hdr +{ + struct timeval ts; ///< Time stamp of the packet + UINT caplen; ///< Length of captured portion. The captured portion can smaller than the + ///< the original packet, because it is possible (with a proper filter) to + ///< instruct the driver to capture only a portion of the packets. + UINT len; ///< Length of the original packet (off wire). +}; + + +#endif + +struct bpf_stat; + +#define DOSNAMEPREFIX TEXT("Packet_") ///< Prefix added to the adapters device names to create the WinPcap devices +#define MAX_LINK_NAME_LENGTH 64 //< Maximum length of the devices symbolic links +#define NMAX_PACKET 65535 + +/*! + \brief Addresses of a network adapter. + + This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with + an adapter. +*/ +typedef struct npf_if_addr +{ + struct sockaddr_storage IPAddress; ///< IP address. + struct sockaddr_storage SubnetMask; ///< Netmask for that address. + struct sockaddr_storage Broadcast; ///< Broadcast address. +}npf_if_addr; + + +#define ADAPTER_NAME_LENGTH 256 + 12 ///< Maximum length for the name of an adapter. The value is the same used by the IP Helper API. +#define ADAPTER_DESC_LENGTH 128 ///< Maximum length for the description of an adapter. The value is the same used by the IP Helper API. +#define MAX_MAC_ADDR_LENGTH 8 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. +#define MAX_NETWORK_ADDRESSES 16 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. + + +typedef struct WAN_ADAPTER_INT WAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API +typedef WAN_ADAPTER* PWAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API + +#define INFO_FLAG_NDIS_ADAPTER 0 ///< Flag for ADAPTER_INFO: this is a traditional ndis adapter +#define INFO_FLAG_NDISWAN_ADAPTER 1 ///< Flag for ADAPTER_INFO: this is a NdisWan adapter, and it's managed by WANPACKET +#define INFO_FLAG_DAG_CARD 2 ///< Flag for ADAPTER_INFO: this is a DAG card +#define INFO_FLAG_DAG_FILE 6 ///< Flag for ADAPTER_INFO: this is a DAG file +#define INFO_FLAG_DONT_EXPORT 8 ///< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones. +#define INFO_FLAG_AIRPCAP_CARD 16 ///< Flag for ADAPTER_INFO: this is an airpcap card +#define INFO_FLAG_NPFIM_DEVICE 32 + +/*! + \brief Describes an opened network adapter. + + This structure is the most important for the functioning of packet.dll, but the great part of its fields + should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters +*/ +typedef struct _ADAPTER +{ + HANDLE hFile; ///< \internal Handle to an open instance of the NPF driver. + CHAR SymbolicLink[MAX_LINK_NAME_LENGTH]; ///< \internal A string containing the name of the network adapter currently opened. + int NumWrites; ///< \internal Number of times a packets written on this adapter will be repeated + ///< on the wire. + HANDLE ReadEvent; ///< A notification event associated with the read calls on the adapter. + ///< It can be passed to standard Win32 functions (like WaitForSingleObject + ///< or WaitForMultipleObjects) to wait until the driver's buffer contains some + ///< data. It is particularly useful in GUI applications that need to wait + ///< concurrently on several events. In Windows NT/2000 the PacketSetMinToCopy() + ///< function can be used to define the minimum amount of data in the kernel buffer + ///< that will cause the event to be signalled. + + UINT ReadTimeOut; ///< \internal The amount of time after which a read on the driver will be released and + ///< ReadEvent will be signaled, also if no packets were captured + CHAR Name[ADAPTER_NAME_LENGTH]; + PWAN_ADAPTER pWanAdapter; + UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. + +#ifdef HAVE_AIRPCAP_API + PAirpcapHandle AirpcapAd; +#endif // HAVE_AIRPCAP_API + +#ifdef HAVE_NPFIM_API + void* NpfImHandle; +#endif // HAVE_NPFIM_API + +#ifdef HAVE_DAG_API + dagc_t* pDagCard; ///< Pointer to the dagc API adapter descriptor for this adapter + PCHAR DagBuffer; ///< Pointer to the buffer with the packets that is received from the DAG card + struct timeval DagReadTimeout; ///< Read timeout. The dagc API requires a timeval structure + unsigned DagFcsLen; ///< Length of the frame check sequence attached to any packet by the card. Obtained from the registry + DWORD DagFastProcess; ///< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps). +#endif // HAVE_DAG_API +} ADAPTER, * LPADAPTER; + +/*! + \brief Structure that contains a group of packets coming from the driver. + + This structure defines the header associated with every packet delivered to the application. +*/ +typedef struct _PACKET +{ + HANDLE hEvent; ///< \deprecated Still present for compatibility with old applications. + OVERLAPPED OverLapped; ///< \deprecated Still present for compatibility with old applications. + PVOID Buffer; ///< Buffer with containing the packets. See the PacketReceivePacket() for + ///< details about the organization of the data in this buffer + UINT Length; ///< Length of the buffer + DWORD ulBytesReceived; ///< Number of valid bytes present in the buffer, i.e. amount of data + ///< received by the last call to PacketReceivePacket() + BOOLEAN bIoComplete; ///< \deprecated Still present for compatibility with old applications. +} PACKET, * LPPACKET; + +/*! + \brief Structure containing an OID request. + + It is used by the PacketRequest() function to send an OID to the interface card driver. + It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address, + the list of the multicast groups defined on it, and so on. +*/ +struct _PACKET_OID_DATA +{ + ULONG Oid; ///< OID code. See the Microsoft DDK documentation or the file ntddndis.h + ///< for a complete list of valid codes. + ULONG Length; ///< Length of the data field + UCHAR Data[1]; ///< variable-lenght field that contains the information passed to or received + ///< from the adapter. +}; +typedef struct _PACKET_OID_DATA PACKET_OID_DATA, * PPACKET_OID_DATA; + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * @} + */ + + /* + BOOLEAN QueryWinPcapRegistryStringA(CHAR *SubKeyName, + CHAR *Value, + UINT *pValueLen, + CHAR *DefaultVal); + BOOLEAN QueryWinPcapRegistryStringW(WCHAR *SubKeyName, + WCHAR *Value, + UINT *pValueLen, + WCHAR *DefaultVal); + */ + + //--------------------------------------------------------------------------- + // EXPORTED FUNCTIONS + //--------------------------------------------------------------------------- + + LPCSTR PacketGetVersion(); + LPCSTR PacketGetDriverVersion(); + LPCSTR PacketGetDriverName(); + BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject, int nbytes); + BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject, int nwrites); + BOOLEAN PacketSetMode(LPADAPTER AdapterObject, int mode); + BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject, int timeout); + BOOLEAN PacketSetBpf(LPADAPTER AdapterObject, struct bpf_program* fp); + BOOLEAN PacketSetLoopbackBehavior(LPADAPTER AdapterObject, UINT LoopbackBehavior); + BOOLEAN PacketSetTimestampMode(LPADAPTER AdapterObject, ULONG mode); + INT PacketSetSnapLen(LPADAPTER AdapterObject, int snaplen); + BOOLEAN PacketGetStats(LPADAPTER AdapterObject, struct bpf_stat* s); + BOOLEAN PacketGetStatsEx(LPADAPTER AdapterObject, struct bpf_stat* s); + BOOLEAN PacketSetBuff(LPADAPTER AdapterObject, int dim); + BOOLEAN PacketGetNetType(LPADAPTER AdapterObject, NetType* type); + BOOLEAN PacketIsLoopbackAdapter(PCHAR AdapterName); + int PacketIsMonitorModeSupported(PCHAR AdapterName); + int PacketSetMonitorMode(PCHAR AdapterName, int mode); + int PacketGetMonitorMode(PCHAR AdapterName); + LPADAPTER PacketOpenAdapter(PCHAR AdapterName); + BOOLEAN PacketSendPacket(LPADAPTER AdapterObject, LPPACKET pPacket, BOOLEAN Sync); + INT PacketSendPackets(LPADAPTER AdapterObject, PVOID PacketBuff, ULONG Size, BOOLEAN Sync); + LPPACKET PacketAllocatePacket(void); + VOID PacketInitPacket(LPPACKET lpPacket, PVOID Buffer, UINT Length); + VOID PacketFreePacket(LPPACKET lpPacket); + BOOLEAN PacketReceivePacket(LPADAPTER AdapterObject, LPPACKET lpPacket, BOOLEAN Sync); + BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject, ULONG Filter); + BOOLEAN PacketGetAdapterNames(PCHAR pStr, PULONG BufferSize); + BOOLEAN PacketGetNetInfoEx(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries); + BOOLEAN PacketRequest(LPADAPTER AdapterObject, BOOLEAN Set, PPACKET_OID_DATA OidData); + HANDLE PacketGetReadEvent(LPADAPTER AdapterObject); + BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void* name, int len); + BOOLEAN PacketSetDumpLimits(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks); + BOOLEAN PacketIsDumpEnded(LPADAPTER AdapterObject, BOOLEAN sync); + BOOL PacketStopDriver(); + BOOL PacketStopDriver60(); + VOID PacketCloseAdapter(LPADAPTER lpAdapter); + BOOLEAN PacketStartOem(PCHAR errorString, UINT errorStringLength); + BOOLEAN PacketStartOemEx(PCHAR errorString, UINT errorStringLength, ULONG flags); + PAirpcapHandle PacketGetAirPcapHandle(LPADAPTER AdapterObject); + + // + // Used by PacketStartOemEx + // +#define PACKET_START_OEM_NO_NETMON 0x00000001 + +#ifdef __cplusplus +} +#endif + +#endif //__PACKET32 diff --git a/network/start/lib/npcap/Include/pcap-bpf.h b/network/start/lib/npcap/Include/pcap-bpf.h new file mode 100644 index 0000000..d46c27a --- /dev/null +++ b/network/start/lib/npcap/Include/pcap-bpf.h @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +/* + * For backwards compatibility. + * + * Note to OS vendors: do NOT get rid of this file! Some applications + * might expect to be able to include . + */ +#include diff --git a/network/start/lib/npcap/Include/pcap-namedb.h b/network/start/lib/npcap/Include/pcap-namedb.h new file mode 100644 index 0000000..198e130 --- /dev/null +++ b/network/start/lib/npcap/Include/pcap-namedb.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 1994, 1996 + * The Regents of the University of California. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +/* + * For backwards compatibility. + * + * Note to OS vendors: do NOT get rid of this file! Some applications + * might expect to be able to include . + */ +#include diff --git a/network/start/lib/npcap/Include/pcap.h b/network/start/lib/npcap/Include/pcap.h new file mode 100644 index 0000000..b299832 --- /dev/null +++ b/network/start/lib/npcap/Include/pcap.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +/* + * For backwards compatibility. + * + * Note to OS vendors: do NOT get rid of this file! Many applications + * expect to be able to include , and at least some of them + * go through contortions in their configure scripts to try to detect + * OSes that have "helpfully" moved pcap.h to without + * leaving behind a file. + */ +#include diff --git a/network/start/lib/npcap/Include/pcap/bluetooth.h b/network/start/lib/npcap/Include/pcap/bluetooth.h new file mode 100644 index 0000000..43353ea --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/bluetooth.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2006 Paolo Abeni (Italy) + * 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. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + * bluetooth data struct + * By Paolo Abeni + */ + +#ifndef lib_pcap_bluetooth_h +#define lib_pcap_bluetooth_h + +#include + +/* + * Header prepended libpcap to each bluetooth h4 frame, + * fields are in network byte order + */ +typedef struct _pcap_bluetooth_h4_header { + uint32_t direction; /* if first bit is set direction is incoming */ +} pcap_bluetooth_h4_header; + +/* + * Header prepended libpcap to each bluetooth linux monitor frame, + * fields are in network byte order + */ +typedef struct _pcap_bluetooth_linux_monitor_header { + uint16_t adapter_id; + uint16_t opcode; +} pcap_bluetooth_linux_monitor_header; + +#endif diff --git a/network/start/lib/npcap/Include/pcap/bpf.h b/network/start/lib/npcap/Include/pcap/bpf.h new file mode 100644 index 0000000..e0e3095 --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/bpf.h @@ -0,0 +1,259 @@ +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * @(#)bpf.h 7.1 (Berkeley) 5/7/91 + */ + +/* + * This is libpcap's cut-down version of bpf.h; it includes only + * the stuff needed for the code generator and the userland BPF + * interpreter, and the libpcap APIs for setting filters, etc.. + * + * "pcap-bpf.c" will include the native OS version, as it deals with + * the OS's BPF implementation. + * + * At least two programs found by Google Code Search explicitly includes + * (even though / includes it for you), + * so moving that stuff to would break the build for some + * programs. + */ + +/* + * If we've already included , don't re-define this stuff. + * We assume BSD-style multiple-include protection in , + * which is true of all but the oldest versions of FreeBSD and NetBSD, + * or Tru64 UNIX-style multiple-include protection (or, at least, + * Tru64 UNIX 5.x-style; I don't have earlier versions available to check), + * or AIX-style multiple-include protection (or, at least, AIX 5.x-style; + * I don't have earlier versions available to check), or QNX-style + * multiple-include protection (as per GitHub pull request #394). + * + * We do not check for BPF_MAJOR_VERSION, as that's defined by + * , which is directly or indirectly included in some + * programs that also include pcap.h, and doesn't + * define stuff we need. + * + * This also provides our own multiple-include protection. + */ +#if !defined(_NET_BPF_H_) && !defined(_NET_BPF_H_INCLUDED) && !defined(_BPF_H_) && !defined(_H_BPF) && !defined(lib_pcap_bpf_h) +#define lib_pcap_bpf_h + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* BSD style release date */ +#define BPF_RELEASE 199606 + +#ifdef MSDOS /* must be 32-bit */ +typedef long bpf_int32; +typedef unsigned long bpf_u_int32; +#else +typedef int bpf_int32; +typedef u_int bpf_u_int32; +#endif + +/* + * Alignment macros. BPF_WORDALIGN rounds up to the next + * even multiple of BPF_ALIGNMENT. + * + * Tcpdump's print-pflog.c uses this, so we define it here. + */ +#ifndef __NetBSD__ +#define BPF_ALIGNMENT sizeof(bpf_int32) +#else +#define BPF_ALIGNMENT sizeof(long) +#endif +#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) + +/* + * Structure for "pcap_compile()", "pcap_setfilter()", etc.. + */ +struct bpf_program { + u_int bf_len; + struct bpf_insn *bf_insns; +}; + +#include + +/* + * The instruction encodings. + * + * Please inform tcpdump-workers@lists.tcpdump.org if you use any + * of the reserved values, so that we can note that they're used + * (and perhaps implement it in the reference BPF implementation + * and encourage its implementation elsewhere). + */ + +/* + * The upper 8 bits of the opcode aren't used. BSD/OS used 0x8000. + */ + +/* instruction classes */ +#define BPF_CLASS(code) ((code) & 0x07) +#define BPF_LD 0x00 +#define BPF_LDX 0x01 +#define BPF_ST 0x02 +#define BPF_STX 0x03 +#define BPF_ALU 0x04 +#define BPF_JMP 0x05 +#define BPF_RET 0x06 +#define BPF_MISC 0x07 + +/* ld/ldx fields */ +#define BPF_SIZE(code) ((code) & 0x18) +#define BPF_W 0x00 +#define BPF_H 0x08 +#define BPF_B 0x10 +/* 0x18 reserved; used by BSD/OS */ +#define BPF_MODE(code) ((code) & 0xe0) +#define BPF_IMM 0x00 +#define BPF_ABS 0x20 +#define BPF_IND 0x40 +#define BPF_MEM 0x60 +#define BPF_LEN 0x80 +#define BPF_MSH 0xa0 +/* 0xc0 reserved; used by BSD/OS */ +/* 0xe0 reserved; used by BSD/OS */ + +/* alu/jmp fields */ +#define BPF_OP(code) ((code) & 0xf0) +#define BPF_ADD 0x00 +#define BPF_SUB 0x10 +#define BPF_MUL 0x20 +#define BPF_DIV 0x30 +#define BPF_OR 0x40 +#define BPF_AND 0x50 +#define BPF_LSH 0x60 +#define BPF_RSH 0x70 +#define BPF_NEG 0x80 +#define BPF_MOD 0x90 +#define BPF_XOR 0xa0 +/* 0xb0 reserved */ +/* 0xc0 reserved */ +/* 0xd0 reserved */ +/* 0xe0 reserved */ +/* 0xf0 reserved */ + +#define BPF_JA 0x00 +#define BPF_JEQ 0x10 +#define BPF_JGT 0x20 +#define BPF_JGE 0x30 +#define BPF_JSET 0x40 +/* 0x50 reserved; used on BSD/OS */ +/* 0x60 reserved */ +/* 0x70 reserved */ +/* 0x80 reserved */ +/* 0x90 reserved */ +/* 0xa0 reserved */ +/* 0xb0 reserved */ +/* 0xc0 reserved */ +/* 0xd0 reserved */ +/* 0xe0 reserved */ +/* 0xf0 reserved */ +#define BPF_SRC(code) ((code) & 0x08) +#define BPF_K 0x00 +#define BPF_X 0x08 + +/* ret - BPF_K and BPF_X also apply */ +#define BPF_RVAL(code) ((code) & 0x18) +#define BPF_A 0x10 +/* 0x18 reserved */ + +/* misc */ +#define BPF_MISCOP(code) ((code) & 0xf8) +#define BPF_TAX 0x00 +/* 0x08 reserved */ +/* 0x10 reserved */ +/* 0x18 reserved */ +/* #define BPF_COP 0x20 NetBSD "coprocessor" extensions */ +/* 0x28 reserved */ +/* 0x30 reserved */ +/* 0x38 reserved */ +/* #define BPF_COPX 0x40 NetBSD "coprocessor" extensions */ +/* also used on BSD/OS */ +/* 0x48 reserved */ +/* 0x50 reserved */ +/* 0x58 reserved */ +/* 0x60 reserved */ +/* 0x68 reserved */ +/* 0x70 reserved */ +/* 0x78 reserved */ +#define BPF_TXA 0x80 +/* 0x88 reserved */ +/* 0x90 reserved */ +/* 0x98 reserved */ +/* 0xa0 reserved */ +/* 0xa8 reserved */ +/* 0xb0 reserved */ +/* 0xb8 reserved */ +/* 0xc0 reserved; used on BSD/OS */ +/* 0xc8 reserved */ +/* 0xd0 reserved */ +/* 0xd8 reserved */ +/* 0xe0 reserved */ +/* 0xe8 reserved */ +/* 0xf0 reserved */ +/* 0xf8 reserved */ + +/* + * The instruction data structure. + */ +struct bpf_insn { + u_short code; + u_char jt; + u_char jf; + bpf_u_int32 k; +}; + +/* + * Macros for insn array initializers. + */ +#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } +#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } + +PCAP_API int bpf_validate(const struct bpf_insn *, int); +PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int); + +/* + * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). + */ +#define BPF_MEMWORDS 16 + +#ifdef __cplusplus +} +#endif + +#endif /* !defined(_NET_BPF_H_) && !defined(_BPF_H_) && !defined(_H_BPF) && !defined(lib_pcap_bpf_h) */ diff --git a/network/start/lib/npcap/Include/pcap/can_socketcan.h b/network/start/lib/npcap/Include/pcap/can_socketcan.h new file mode 100644 index 0000000..b30e3ab --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/can_socketcan.h @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +#ifndef lib_pcap_can_socketcan_h +#define lib_pcap_can_socketcan_h + +#include + +/* + * SocketCAN header, as per Documentation/networking/can.txt in the + * Linux source. + */ +typedef struct { + uint32_t can_id; + uint8_t payload_length; + uint8_t pad; + uint8_t reserved1; + uint8_t reserved2; +} pcap_can_socketcan_hdr; + +#endif diff --git a/network/start/lib/npcap/Include/pcap/compiler-tests.h b/network/start/lib/npcap/Include/pcap/compiler-tests.h new file mode 100644 index 0000000..d7b116c --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/compiler-tests.h @@ -0,0 +1,163 @@ +/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ +/* + * Copyright (c) 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +#ifndef lib_pcap_compiler_tests_h +#define lib_pcap_compiler_tests_h + +/* + * This was introduced by Clang: + * + * http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute + * + * in some version (which version?); it has been picked up by GCC 5.0. + */ +#ifndef __has_attribute + /* + * It's a macro, so you can check whether it's defined to check + * whether it's supported. + * + * If it's not, define it to always return 0, so that we move on to + * the fallback checks. + */ + #define __has_attribute(x) 0 +#endif + +/* + * Note that the C90 spec's "6.8.1 Conditional inclusion" and the + * C99 spec's and C11 spec's "6.10.1 Conditional inclusion" say: + * + * Prior to evaluation, macro invocations in the list of preprocessing + * tokens that will become the controlling constant expression are + * replaced (except for those macro names modified by the defined unary + * operator), just as in normal text. If the token "defined" is + * generated as a result of this replacement process or use of the + * "defined" unary operator does not match one of the two specified + * forms prior to macro replacement, the behavior is undefined. + * + * so you shouldn't use defined() in a #define that's used in #if or + * #elif. Some versions of Clang, for example, will warn about this. + * + * Instead, we check whether the pre-defined macros for particular + * compilers are defined and, if not, define the "is this version XXX + * or a later version of this compiler" macros as 0. + */ + +/* + * Check whether this is GCC major.minor or a later release, or some + * compiler that claims to be "just like GCC" of that version or a + * later release. + */ + +#if ! defined(__GNUC__) +#define PCAP_IS_AT_LEAST_GNUC_VERSION(major, minor) 0 +#else +#define PCAP_IS_AT_LEAST_GNUC_VERSION(major, minor) \ + (__GNUC__ > (major) || \ + (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) +#endif + +/* + * Check whether this is Clang major.minor or a later release. + */ + +#if !defined(__clang__) +#define PCAP_IS_AT_LEAST_CLANG_VERSION(major, minor) 0 +#else +#define PCAP_IS_AT_LEAST_CLANG_VERSION(major, minor) \ + (__clang_major__ > (major) || \ + (__clang_major__ == (major) && __clang_minor__ >= (minor))) +#endif + +/* + * Check whether this is Sun C/SunPro C/Oracle Studio major.minor + * or a later release. + * + * The version number in __SUNPRO_C is encoded in hex BCD, with the + * uppermost hex digit being the major version number, the next + * one or two hex digits being the minor version number, and + * the last digit being the patch version. + * + * It represents the *compiler* version, not the product version; + * see + * + * https://sourceforge.net/p/predef/wiki/Compilers/ + * + * for a partial mapping, which we assume continues for later + * 12.x product releases. + */ + +#if ! defined(__SUNPRO_C) +#define PCAP_IS_AT_LEAST_SUNC_VERSION(major,minor) 0 +#else +#define PCAP_SUNPRO_VERSION_TO_BCD(major, minor) \ + (((minor) >= 10) ? \ + (((major) << 12) | (((minor)/10) << 8) | (((minor)%10) << 4)) : \ + (((major) << 8) | ((minor) << 4))) +#define PCAP_IS_AT_LEAST_SUNC_VERSION(major,minor) \ + (__SUNPRO_C >= PCAP_SUNPRO_VERSION_TO_BCD((major), (minor))) +#endif + +/* + * Check whether this is IBM XL C major.minor or a later release. + * + * The version number in __xlC__ has the major version in the + * upper 8 bits and the minor version in the lower 8 bits. + */ + +#if ! defined(__xlC__) +#define PCAP_IS_AT_LEAST_XL_C_VERSION(major,minor) 0 +#else +#define PCAP_IS_AT_LEAST_XL_C_VERSION(major, minor) \ + (__xlC__ >= (((major) << 8) | (minor))) +#endif + +/* + * Check whether this is HP aC++/HP C major.minor or a later release. + * + * The version number in __HP_aCC is encoded in zero-padded decimal BCD, + * with the "A." stripped off, the uppermost two decimal digits being + * the major version number, the next two decimal digits being the minor + * version number, and the last two decimal digits being the patch version. + * (Strip off the A., remove the . between the major and minor version + * number, and add two digits of patch.) + */ + +#if ! defined(__HP_aCC) +#define PCAP_IS_AT_LEAST_HP_C_VERSION(major,minor) 0 +#else +#define PCAP_IS_AT_LEAST_HP_C_VERSION(major,minor) \ + (__HP_aCC >= ((major)*10000 + (minor)*100)) +#endif + +#endif /* lib_pcap_compiler_tests_h */ diff --git a/network/start/lib/npcap/Include/pcap/dlt.h b/network/start/lib/npcap/Include/pcap/dlt.h new file mode 100644 index 0000000..261ccf8 --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/dlt.h @@ -0,0 +1,1434 @@ +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * @(#)bpf.h 7.1 (Berkeley) 5/7/91 + */ + +#ifndef lib_pcap_dlt_h +#define lib_pcap_dlt_h + +/* + * Link-layer header type codes. + * + * Do *NOT* add new values to this list without asking + * "tcpdump-workers@lists.tcpdump.org" for a value. Otherwise, you run + * the risk of using a value that's already being used for some other + * purpose, and of having tools that read libpcap-format captures not + * being able to handle captures with your new DLT_ value, with no hope + * that they will ever be changed to do so (as that would destroy their + * ability to read captures using that value for that other purpose). + * + * See + * + * https://www.tcpdump.org/linktypes.html + * + * for detailed descriptions of some of these link-layer header types. + */ + +/* + * These are the types that are the same on all platforms, and that + * have been defined by for ages. + */ +#define DLT_NULL 0 /* BSD loopback encapsulation */ +#define DLT_EN10MB 1 /* Ethernet (10Mb) */ +#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ +#define DLT_AX25 3 /* Amateur Radio AX.25 */ +#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ +#define DLT_CHAOS 5 /* Chaos */ +#define DLT_IEEE802 6 /* 802.5 Token Ring */ +#define DLT_ARCNET 7 /* ARCNET, with BSD-style header */ +#define DLT_SLIP 8 /* Serial Line IP */ +#define DLT_PPP 9 /* Point-to-point Protocol */ +#define DLT_FDDI 10 /* FDDI */ + +/* + * These are types that are different on some platforms, and that + * have been defined by for ages. We use #ifdefs to + * detect the BSDs that define them differently from the traditional + * libpcap + * + * XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS, + * but I don't know what the right #define is for BSD/OS. + */ +#define DLT_ATM_RFC1483 11 /* LLC-encapsulated ATM */ + +#ifdef __OpenBSD__ +#define DLT_RAW 14 /* raw IP */ +#else +#define DLT_RAW 12 /* raw IP */ +#endif + +/* + * Given that the only OS that currently generates BSD/OS SLIP or PPP + * is, well, BSD/OS, arguably everybody should have chosen its values + * for DLT_SLIP_BSDOS and DLT_PPP_BSDOS, which are 15 and 16, but they + * didn't. So it goes. + */ +#if defined(__NetBSD__) || defined(__FreeBSD__) +#ifndef DLT_SLIP_BSDOS +#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */ +#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */ +#endif +#else +#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ +#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ +#endif + +/* + * 17 was used for DLT_PFLOG in OpenBSD; it no longer is. + * + * It was DLT_LANE8023 in SuSE 6.3, so we defined LINKTYPE_PFLOG + * as 117 so that pflog captures would use a link-layer header type + * value that didn't collide with any other values. On all + * platforms other than OpenBSD, we defined DLT_PFLOG as 117, + * and we mapped between LINKTYPE_PFLOG and DLT_PFLOG. + * + * OpenBSD eventually switched to using 117 for DLT_PFLOG as well. + * + * Don't use 17 for anything else. + */ + +/* + * 18 is used for DLT_PFSYNC in OpenBSD, NetBSD, DragonFly BSD and + * macOS; don't use it for anything else. (FreeBSD uses 121, which + * collides with DLT_HHDLC, even though it doesn't use 18 for + * anything and doesn't appear to have ever used it for anything.) + * + * We define it as 18 on those platforms; it is, unfortunately, used + * for DLT_CIP in Suse 6.3, so we don't define it as DLT_PFSYNC + * in general. As the packet format for it, like that for + * DLT_PFLOG, is not only OS-dependent but OS-version-dependent, + * we don't support printing it in tcpdump except on OSes that + * have the relevant header files, so it's not that useful on + * other platforms. + */ +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__) +#define DLT_PFSYNC 18 +#endif + +#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ + +/* + * Apparently Redback uses this for its SmartEdge 400/800. I hope + * nobody else decided to use it, too. + */ +#define DLT_REDBACK_SMARTEDGE 32 + +/* + * These values are defined by NetBSD; other platforms should refrain from + * using them for other purposes, so that NetBSD savefiles with link + * types of 50 or 51 can be read as this type on all platforms. + */ +#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ +#define DLT_PPP_ETHER 51 /* PPP over Ethernet */ + +/* + * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses + * a link-layer type of 99 for the tcpdump it supplies. The link-layer + * header has 6 bytes of unknown data, something that appears to be an + * Ethernet type, and 36 bytes that appear to be 0 in at least one capture + * I've seen. + */ +#define DLT_SYMANTEC_FIREWALL 99 + +/* + * Values between 100 and 103 are used in capture file headers as + * link-layer header type LINKTYPE_ values corresponding to DLT_ types + * that differ between platforms; don't use those values for new DLT_ + * new types. + */ + +/* + * Values starting with 104 are used for newly-assigned link-layer + * header type values; for those link-layer header types, the DLT_ + * value returned by pcap_datalink() and passed to pcap_open_dead(), + * and the LINKTYPE_ value that appears in capture files, are the + * same. + * + * DLT_MATCHING_MIN is the lowest such value; DLT_MATCHING_MAX is + * the highest such value. + */ +#define DLT_MATCHING_MIN 104 + +/* + * This value was defined by libpcap 0.5; platforms that have defined + * it with a different value should define it here with that value - + * a link type of 104 in a save file will be mapped to DLT_C_HDLC, + * whatever value that happens to be, so programs will correctly + * handle files with that link type regardless of the value of + * DLT_C_HDLC. + * + * The name DLT_C_HDLC was used by BSD/OS; we use that name for source + * compatibility with programs written for BSD/OS. + * + * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, + * for source compatibility with programs written for libpcap 0.5. + */ +#define DLT_C_HDLC 104 /* Cisco HDLC */ +#define DLT_CHDLC DLT_C_HDLC + +#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ + +/* + * 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW, + * except when it isn't. (I.e., sometimes it's just raw IP, and + * sometimes it isn't.) We currently handle it as DLT_LINUX_SLL, + * so that we don't have to worry about the link-layer header.) + */ + +/* + * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides + * with other values. + * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header + * (DLCI, etc.). + */ +#define DLT_FRELAY 107 + +/* + * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except + * that the AF_ type in the link-layer header is in network byte order. + * + * DLT_LOOP is 12 in OpenBSD, but that's DLT_RAW in other OSes, so + * we don't use 12 for it in OSes other than OpenBSD. + */ +#ifdef __OpenBSD__ +#define DLT_LOOP 12 +#else +#define DLT_LOOP 108 +#endif + +/* + * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's + * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other + * than OpenBSD. + */ +#ifdef __OpenBSD__ +#define DLT_ENC 13 +#else +#define DLT_ENC 109 +#endif + +/* + * Values between 110 and 112 are reserved for use in capture file headers + * as link-layer types corresponding to DLT_ types that might differ + * between platforms; don't use those values for new DLT_ types + * other than the corresponding DLT_ types. + */ + +/* + * Linux cooked sockets. + */ +#define DLT_LINUX_SLL 113 + +/* + * Apple LocalTalk hardware. + */ +#define DLT_LTALK 114 + +/* + * Acorn Econet. + */ +#define DLT_ECONET 115 + +/* + * Reserved for use with OpenBSD ipfilter. + */ +#define DLT_IPFILTER 116 + +/* + * OpenBSD DLT_PFLOG. + */ +#define DLT_PFLOG 117 + +/* + * Registered for Cisco-internal use. + */ +#define DLT_CISCO_IOS 118 + +/* + * For 802.11 cards using the Prism II chips, with a link-layer + * header including Prism monitor mode information plus an 802.11 + * header. + */ +#define DLT_PRISM_HEADER 119 + +/* + * Reserved for Aironet 802.11 cards, with an Aironet link-layer header + * (see Doug Ambrisko's FreeBSD patches). + */ +#define DLT_AIRONET_HEADER 120 + +/* + * Sigh. + * + * 121 was reserved for Siemens HiPath HDLC on 2002-01-25, as + * requested by Tomas Kukosa. + * + * On 2004-02-25, a FreeBSD checkin to sys/net/bpf.h was made that + * assigned 121 as DLT_PFSYNC. In current versions, its libpcap + * does DLT_ <-> LINKTYPE_ mapping, mapping DLT_PFSYNC to a + * LINKTYPE_PFSYNC value of 246, so it should write out DLT_PFSYNC + * dump files with 246 as the link-layer header type. (Earlier + * versions might not have done mapping, in which case they would + * have written them out with a link-layer header type of 121.) + * + * OpenBSD, from which pf came, however, uses 18 for DLT_PFSYNC; + * its libpcap does no DLT_ <-> LINKTYPE_ mapping, so it would + * write out DLT_PFSYNC dump files with use 18 as the link-layer + * header type. + * + * NetBSD, DragonFly BSD, and Darwin also use 18 for DLT_PFSYNC; in + * current versions, their libpcaps do DLT_ <-> LINKTYPE_ mapping, + * mapping DLT_PFSYNC to a LINKTYPE_PFSYNC value of 246, so they + * should write out DLT_PFSYNC dump files with 246 as the link-layer + * header type. (Earlier versions might not have done mapping, + * in which case they'd work the same way OpenBSD does, writing + * them out with a link-layer header type of 18.) + * + * We'll define DLT_PFSYNC as: + * + * 18 on NetBSD, OpenBSD, DragonFly BSD, and Darwin; + * + * 121 on FreeBSD; + * + * 246 everywhere else. + * + * We'll define DLT_HHDLC as 121 on everything except for FreeBSD; + * anybody who wants to compile, on FreeBSD, code that uses DLT_HHDLC + * is out of luck. + * + * We'll define LINKTYPE_PFSYNC as 246 on *all* platforms, so that + * savefiles written using *this* code won't use 18 or 121 for PFSYNC, + * they'll all use 246. + * + * Code that uses pcap_datalink() to determine the link-layer header + * type of a savefile won't, when built and run on FreeBSD, be able + * to distinguish between LINKTYPE_PFSYNC and LINKTYPE_HHDLC capture + * files, as pcap_datalink() will give 121 for both of them. Code + * that doesn't, such as the code in Wireshark, will be able to + * distinguish between them. + * + * FreeBSD's libpcap won't map a link-layer header type of 18 - i.e., + * DLT_PFSYNC files from OpenBSD and possibly older versions of NetBSD, + * DragonFly BSD, and macOS - to DLT_PFSYNC, so code built with FreeBSD's + * libpcap won't treat those files as DLT_PFSYNC files. + * + * Other libpcaps won't map a link-layer header type of 121 to DLT_PFSYNC; + * this means they can read DLT_HHDLC files, if any exist, but won't + * treat pcap files written by any older versions of FreeBSD libpcap that + * didn't map to 246 as DLT_PFSYNC files. + */ +#ifdef __FreeBSD__ +#define DLT_PFSYNC 121 +#else +#define DLT_HHDLC 121 +#endif + +/* + * This is for RFC 2625 IP-over-Fibre Channel. + * + * This is not for use with raw Fibre Channel, where the link-layer + * header starts with a Fibre Channel frame header; it's for IP-over-FC, + * where the link-layer header starts with an RFC 2625 Network_Header + * field. + */ +#define DLT_IP_OVER_FC 122 + +/* + * This is for Full Frontal ATM on Solaris with SunATM, with a + * pseudo-header followed by an AALn PDU. + * + * There may be other forms of Full Frontal ATM on other OSes, + * with different pseudo-headers. + * + * If ATM software returns a pseudo-header with VPI/VCI information + * (and, ideally, packet type information, e.g. signalling, ILMI, + * LANE, LLC-multiplexed traffic, etc.), it should not use + * DLT_ATM_RFC1483, but should get a new DLT_ value, so tcpdump + * and the like don't have to infer the presence or absence of a + * pseudo-header and the form of the pseudo-header. + */ +#define DLT_SUNATM 123 /* Solaris+SunATM */ + +/* + * Reserved as per request from Kent Dahlgren + * for private use. + */ +#define DLT_RIO 124 /* RapidIO */ +#define DLT_PCI_EXP 125 /* PCI Express */ +#define DLT_AURORA 126 /* Xilinx Aurora link layer */ + +/* + * Header for 802.11 plus a number of bits of link-layer information + * including radio information, used by some recent BSD drivers as + * well as the madwifi Atheros driver for Linux. + */ +#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus radiotap radio header */ + +/* + * Reserved for the TZSP encapsulation, as per request from + * Chris Waters + * TZSP is a generic encapsulation for any other link type, + * which includes a means to include meta-information + * with the packet, e.g. signal strength and channel + * for 802.11 packets. + */ +#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */ + +/* + * BSD's ARCNET headers have the source host, destination host, + * and type at the beginning of the packet; that's what's handed + * up to userland via BPF. + * + * Linux's ARCNET headers, however, have a 2-byte offset field + * between the host IDs and the type; that's what's handed up + * to userland via PF_PACKET sockets. + * + * We therefore have to have separate DLT_ values for them. + */ +#define DLT_ARCNET_LINUX 129 /* ARCNET */ + +/* + * Juniper-private data link types, as per request from + * Hannes Gredler . The DLT_s are used + * for passing on chassis-internal metainformation such as + * QOS profiles, etc.. + */ +#define DLT_JUNIPER_MLPPP 130 +#define DLT_JUNIPER_MLFR 131 +#define DLT_JUNIPER_ES 132 +#define DLT_JUNIPER_GGSN 133 +#define DLT_JUNIPER_MFR 134 +#define DLT_JUNIPER_ATM2 135 +#define DLT_JUNIPER_SERVICES 136 +#define DLT_JUNIPER_ATM1 137 + +/* + * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund + * . The header that's presented is an Ethernet-like + * header: + * + * #define FIREWIRE_EUI64_LEN 8 + * struct firewire_header { + * u_char firewire_dhost[FIREWIRE_EUI64_LEN]; + * u_char firewire_shost[FIREWIRE_EUI64_LEN]; + * u_short firewire_type; + * }; + * + * with "firewire_type" being an Ethernet type value, rather than, + * for example, raw GASP frames being handed up. + */ +#define DLT_APPLE_IP_OVER_IEEE1394 138 + +/* + * Various SS7 encapsulations, as per a request from Jeff Morriss + * and subsequent discussions. + */ +#define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */ +#define DLT_MTP2 140 /* MTP2, without pseudo-header */ +#define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */ +#define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */ + +/* + * DOCSIS MAC frames. + */ +#define DLT_DOCSIS 143 + +/* + * Linux-IrDA packets. Protocol defined at http://www.irda.org. + * Those packets include IrLAP headers and above (IrLMP...), but + * don't include Phy framing (SOF/EOF/CRC & byte stuffing), because Phy + * framing can be handled by the hardware and depend on the bitrate. + * This is exactly the format you would get capturing on a Linux-IrDA + * interface (irdaX), but not on a raw serial port. + * Note the capture is done in "Linux-cooked" mode, so each packet include + * a fake packet header (struct sll_header). This is because IrDA packet + * decoding is dependant on the direction of the packet (incomming or + * outgoing). + * When/if other platform implement IrDA capture, we may revisit the + * issue and define a real DLT_IRDA... + * Jean II + */ +#define DLT_LINUX_IRDA 144 + +/* + * Reserved for IBM SP switch and IBM Next Federation switch. + */ +#define DLT_IBM_SP 145 +#define DLT_IBM_SN 146 + +/* + * Reserved for private use. If you have some link-layer header type + * that you want to use within your organization, with the capture files + * using that link-layer header type not ever be sent outside your + * organization, you can use these values. + * + * No libpcap release will use these for any purpose, nor will any + * tcpdump release use them, either. + * + * Do *NOT* use these in capture files that you expect anybody not using + * your private versions of capture-file-reading tools to read; in + * particular, do *NOT* use them in products, otherwise you may find that + * people won't be able to use tcpdump, or snort, or Ethereal, or... to + * read capture files from your firewall/intrusion detection/traffic + * monitoring/etc. appliance, or whatever product uses that DLT_ value, + * and you may also find that the developers of those applications will + * not accept patches to let them read those files. + * + * Also, do not use them if somebody might send you a capture using them + * for *their* private type and tools using them for *your* private type + * would have to read them. + * + * Instead, ask "tcpdump-workers@lists.tcpdump.org" for a new DLT_ value, + * as per the comment above, and use the type you're given. + */ +#define DLT_USER0 147 +#define DLT_USER1 148 +#define DLT_USER2 149 +#define DLT_USER3 150 +#define DLT_USER4 151 +#define DLT_USER5 152 +#define DLT_USER6 153 +#define DLT_USER7 154 +#define DLT_USER8 155 +#define DLT_USER9 156 +#define DLT_USER10 157 +#define DLT_USER11 158 +#define DLT_USER12 159 +#define DLT_USER13 160 +#define DLT_USER14 161 +#define DLT_USER15 162 + +/* + * For future use with 802.11 captures - defined by AbsoluteValue + * Systems to store a number of bits of link-layer information + * including radio information: + * + * http://www.shaftnet.org/~pizza/software/capturefrm.txt + * + * but it might be used by some non-AVS drivers now or in the + * future. + */ +#define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . The DLT_s are used + * for passing on chassis-internal metainformation such as + * QOS profiles, etc.. + */ +#define DLT_JUNIPER_MONITOR 164 + +/* + * BACnet MS/TP frames. + */ +#define DLT_BACNET_MS_TP 165 + +/* + * Another PPP variant as per request from Karsten Keil . + * + * This is used in some OSes to allow a kernel socket filter to distinguish + * between incoming and outgoing packets, on a socket intended to + * supply pppd with outgoing packets so it can do dial-on-demand and + * hangup-on-lack-of-demand; incoming packets are filtered out so they + * don't cause pppd to hold the connection up (you don't want random + * input packets such as port scans, packets from old lost connections, + * etc. to force the connection to stay up). + * + * The first byte of the PPP header (0xff03) is modified to accomodate + * the direction - 0x00 = IN, 0x01 = OUT. + */ +#define DLT_PPP_PPPD 166 + +/* + * Names for backwards compatibility with older versions of some PPP + * software; new software should use DLT_PPP_PPPD. + */ +#define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD +#define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . The DLT_s are used + * for passing on chassis-internal metainformation such as + * QOS profiles, cookies, etc.. + */ +#define DLT_JUNIPER_PPPOE 167 +#define DLT_JUNIPER_PPPOE_ATM 168 + +#define DLT_GPRS_LLC 169 /* GPRS LLC */ +#define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */ +#define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */ + +/* + * Requested by Oolan Zimmer for use in Gcom's T1/E1 line + * monitoring equipment. + */ +#define DLT_GCOM_T1E1 172 +#define DLT_GCOM_SERIAL 173 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . The DLT_ is used + * for internal communication to Physical Interface Cards (PIC) + */ +#define DLT_JUNIPER_PIC_PEER 174 + +/* + * Link types requested by Gregor Maier of Endace + * Measurement Systems. They add an ERF header (see + * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of + * the link-layer header. + */ +#define DLT_ERF_ETH 175 /* Ethernet */ +#define DLT_ERF_POS 176 /* Packet-over-SONET */ + +/* + * Requested by Daniele Orlandi for raw LAPD + * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header + * includes additional information before the LAPD header, so it's + * not necessarily a generic LAPD header. + */ +#define DLT_LINUX_LAPD 177 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + * The DLT_ are used for prepending meta-information + * like interface index, interface name + * before standard Ethernet, PPP, Frelay & C-HDLC Frames + */ +#define DLT_JUNIPER_ETHER 178 +#define DLT_JUNIPER_PPP 179 +#define DLT_JUNIPER_FRELAY 180 +#define DLT_JUNIPER_CHDLC 181 + +/* + * Multi Link Frame Relay (FRF.16) + */ +#define DLT_MFR 182 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + * The DLT_ is used for internal communication with a + * voice Adapter Card (PIC) + */ +#define DLT_JUNIPER_VP 183 + +/* + * Arinc 429 frames. + * DLT_ requested by Gianluca Varenni . + * Every frame contains a 32bit A429 label. + * More documentation on Arinc 429 can be found at + * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf + */ +#define DLT_A429 184 + +/* + * Arinc 653 Interpartition Communication messages. + * DLT_ requested by Gianluca Varenni . + * Please refer to the A653-1 standard for more information. + */ +#define DLT_A653_ICM 185 + +/* + * This used to be "USB packets, beginning with a USB setup header; + * requested by Paolo Abeni ." + * + * However, that header didn't work all that well - it left out some + * useful information - and was abandoned in favor of the DLT_USB_LINUX + * header. + * + * This is now used by FreeBSD for its BPF taps for USB; that has its + * own headers. So it is written, so it is done. + * + * For source-code compatibility, we also define DLT_USB to have this + * value. We do it numerically so that, if code that includes this + * file (directly or indirectly) also includes an OS header that also + * defines DLT_USB as 186, we don't get a redefinition warning. + * (NetBSD 7 does that.) + */ +#define DLT_USB_FREEBSD 186 +#define DLT_USB 186 + +/* + * Bluetooth HCI UART transport layer (part H:4); requested by + * Paolo Abeni. + */ +#define DLT_BLUETOOTH_HCI_H4 187 + +/* + * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz + * . + */ +#define DLT_IEEE802_16_MAC_CPS 188 + +/* + * USB packets, beginning with a Linux USB header; requested by + * Paolo Abeni . + */ +#define DLT_USB_LINUX 189 + +/* + * Controller Area Network (CAN) v. 2.0B packets. + * DLT_ requested by Gianluca Varenni . + * Used to dump CAN packets coming from a CAN Vector board. + * More documentation on the CAN v2.0B frames can be found at + * http://www.can-cia.org/downloads/?269 + */ +#define DLT_CAN20B 190 + +/* + * IEEE 802.15.4, with address fields padded, as is done by Linux + * drivers; requested by Juergen Schimmer. + */ +#define DLT_IEEE802_15_4_LINUX 191 + +/* + * Per Packet Information encapsulated packets. + * DLT_ requested by Gianluca Varenni . + */ +#define DLT_PPI 192 + +/* + * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header; + * requested by Charles Clancy. + */ +#define DLT_IEEE802_16_MAC_CPS_RADIO 193 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + * The DLT_ is used for internal communication with a + * integrated service module (ISM). + */ +#define DLT_JUNIPER_ISM 194 + +/* + * IEEE 802.15.4, exactly as it appears in the spec (no padding, no + * nothing); requested by Mikko Saarnivala . + * For this one, we expect the FCS to be present at the end of the frame; + * if the frame has no FCS, DLT_IEEE802_15_4_NOFCS should be used. + * + * We keep the name DLT_IEEE802_15_4 as an alias for backwards + * compatibility, but, again, this should *only* be used for 802.15.4 + * frames that include the FCS. + */ +#define DLT_IEEE802_15_4_WITHFCS 195 +#define DLT_IEEE802_15_4 DLT_IEEE802_15_4_WITHFCS + +/* + * Various link-layer types, with a pseudo-header, for SITA + * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com). + */ +#define DLT_SITA 196 + +/* + * Various link-layer types, with a pseudo-header, for Endace DAG cards; + * encapsulates Endace ERF records. Requested by Stephen Donnelly + * . + */ +#define DLT_ERF 197 + +/* + * Special header prepended to Ethernet packets when capturing from a + * u10 Networks board. Requested by Phil Mulholland + * . + */ +#define DLT_RAIF1 198 + +/* + * IPMB packet for IPMI, beginning with a 2-byte header, followed by + * the I2C slave address, followed by the netFn and LUN, etc.. + * Requested by Chanthy Toeung . + * + * XXX - this used to be called DLT_IPMB, back when we got the + * impression from the email thread requesting it that the packet + * had no extra 2-byte header. We've renamed it; if anybody used + * DLT_IPMB and assumed no 2-byte header, this will cause the compile + * to fail, at which point we'll have to figure out what to do about + * the two header types using the same DLT_/LINKTYPE_ value. If that + * doesn't happen, we'll assume nobody used it and that the redefinition + * is safe. + */ +#define DLT_IPMB_KONTRON 199 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + * The DLT_ is used for capturing data on a secure tunnel interface. + */ +#define DLT_JUNIPER_ST 200 + +/* + * Bluetooth HCI UART transport layer (part H:4), with pseudo-header + * that includes direction information; requested by Paolo Abeni. + */ +#define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201 + +/* + * AX.25 packet with a 1-byte KISS header; see + * + * http://www.ax25.net/kiss.htm + * + * as per Richard Stearn . + */ +#define DLT_AX25_KISS 202 + +/* + * LAPD packets from an ISDN channel, starting with the address field, + * with no pseudo-header. + * Requested by Varuna De Silva . + */ +#define DLT_LAPD 203 + +/* + * PPP, with a one-byte direction pseudo-header prepended - zero means + * "received by this host", non-zero (any non-zero value) means "sent by + * this host" - as per Will Barker . + */ +#define DLT_PPP_WITH_DIR 204 /* Don't confuse with DLT_PPP_WITH_DIRECTION */ + +/* + * Cisco HDLC, with a one-byte direction pseudo-header prepended - zero + * means "received by this host", non-zero (any non-zero value) means + * "sent by this host" - as per Will Barker . + */ +#define DLT_C_HDLC_WITH_DIR 205 + +/* + * Frame Relay, with a one-byte direction pseudo-header prepended - zero + * means "received by this host" (DCE -> DTE), non-zero (any non-zero + * value) means "sent by this host" (DTE -> DCE) - as per Will Barker + * . + */ +#define DLT_FRELAY_WITH_DIR 206 + +/* + * LAPB, with a one-byte direction pseudo-header prepended - zero means + * "received by this host" (DCE -> DTE), non-zero (any non-zero value) + * means "sent by this host" (DTE -> DCE)- as per Will Barker + * . + */ +#define DLT_LAPB_WITH_DIR 207 + +/* + * 208 is reserved for an as-yet-unspecified proprietary link-layer + * type, as requested by Will Barker. + */ + +/* + * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman + * . + */ +#define DLT_IPMB_LINUX 209 + +/* + * FlexRay automotive bus - http://www.flexray.com/ - as requested + * by Hannes Kaelber . + */ +#define DLT_FLEXRAY 210 + +/* + * Media Oriented Systems Transport (MOST) bus for multimedia + * transport - http://www.mostcooperation.com/ - as requested + * by Hannes Kaelber . + */ +#define DLT_MOST 211 + +/* + * Local Interconnect Network (LIN) bus for vehicle networks - + * http://www.lin-subbus.org/ - as requested by Hannes Kaelber + * . + */ +#define DLT_LIN 212 + +/* + * X2E-private data link type used for serial line capture, + * as requested by Hannes Kaelber . + */ +#define DLT_X2E_SERIAL 213 + +/* + * X2E-private data link type used for the Xoraya data logger + * family, as requested by Hannes Kaelber . + */ +#define DLT_X2E_XORAYA 214 + +/* + * IEEE 802.15.4, exactly as it appears in the spec (no padding, no + * nothing), but with the PHY-level data for non-ASK PHYs (4 octets + * of 0 as preamble, one octet of SFD, one octet of frame length+ + * reserved bit, and then the MAC-layer data, starting with the + * frame control field). + * + * Requested by Max Filippov . + */ +#define DLT_IEEE802_15_4_NONASK_PHY 215 + +/* + * David Gibson requested this for + * captures from the Linux kernel /dev/input/eventN devices. This + * is used to communicate keystrokes and mouse movements from the + * Linux kernel to display systems, such as Xorg. + */ +#define DLT_LINUX_EVDEV 216 + +/* + * GSM Um and Abis interfaces, preceded by a "gsmtap" header. + * + * Requested by Harald Welte . + */ +#define DLT_GSMTAP_UM 217 +#define DLT_GSMTAP_ABIS 218 + +/* + * MPLS, with an MPLS label as the link-layer header. + * Requested by Michele Marchetto on behalf + * of OpenBSD. + */ +#define DLT_MPLS 219 + +/* + * USB packets, beginning with a Linux USB header, with the USB header + * padded to 64 bytes; required for memory-mapped access. + */ +#define DLT_USB_LINUX_MMAPPED 220 + +/* + * DECT packets, with a pseudo-header; requested by + * Matthias Wenzel . + */ +#define DLT_DECT 221 + +/* + * From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" + * Date: Mon, 11 May 2009 11:18:30 -0500 + * + * DLT_AOS. We need it for AOS Space Data Link Protocol. + * I have already written dissectors for but need an OK from + * legal before I can submit a patch. + * + */ +#define DLT_AOS 222 + +/* + * Wireless HART (Highway Addressable Remote Transducer) + * From the HART Communication Foundation + * IES/PAS 62591 + * + * Requested by Sam Roberts . + */ +#define DLT_WIHART 223 + +/* + * Fibre Channel FC-2 frames, beginning with a Frame_Header. + * Requested by Kahou Lei . + */ +#define DLT_FC_2 224 + +/* + * Fibre Channel FC-2 frames, beginning with an encoding of the + * SOF, and ending with an encoding of the EOF. + * + * The encodings represent the frame delimiters as 4-byte sequences + * representing the corresponding ordered sets, with K28.5 + * represented as 0xBC, and the D symbols as the corresponding + * byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2, + * is represented as 0xBC 0xB5 0x55 0x55. + * + * Requested by Kahou Lei . + */ +#define DLT_FC_2_WITH_FRAME_DELIMS 225 + +/* + * Solaris ipnet pseudo-header; requested by Darren Reed . + * + * The pseudo-header starts with a one-byte version number; for version 2, + * the pseudo-header is: + * + * struct dl_ipnetinfo { + * uint8_t dli_version; + * uint8_t dli_family; + * uint16_t dli_htype; + * uint32_t dli_pktlen; + * uint32_t dli_ifindex; + * uint32_t dli_grifindex; + * uint32_t dli_zsrc; + * uint32_t dli_zdst; + * }; + * + * dli_version is 2 for the current version of the pseudo-header. + * + * dli_family is a Solaris address family value, so it's 2 for IPv4 + * and 26 for IPv6. + * + * dli_htype is a "hook type" - 0 for incoming packets, 1 for outgoing + * packets, and 2 for packets arriving from another zone on the same + * machine. + * + * dli_pktlen is the length of the packet data following the pseudo-header + * (so the captured length minus dli_pktlen is the length of the + * pseudo-header, assuming the entire pseudo-header was captured). + * + * dli_ifindex is the interface index of the interface on which the + * packet arrived. + * + * dli_grifindex is the group interface index number (for IPMP interfaces). + * + * dli_zsrc is the zone identifier for the source of the packet. + * + * dli_zdst is the zone identifier for the destination of the packet. + * + * A zone number of 0 is the global zone; a zone number of 0xffffffff + * means that the packet arrived from another host on the network, not + * from another zone on the same machine. + * + * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates + * which of those it is. + */ +#define DLT_IPNET 226 + +/* + * CAN (Controller Area Network) frames, with a pseudo-header as supplied + * by Linux SocketCAN, and with multi-byte numerical fields in that header + * in big-endian byte order. + * + * See Documentation/networking/can.txt in the Linux source. + * + * Requested by Felix Obenhuber . + */ +#define DLT_CAN_SOCKETCAN 227 + +/* + * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies + * whether it's v4 or v6. Requested by Darren Reed . + */ +#define DLT_IPV4 228 +#define DLT_IPV6 229 + +/* + * IEEE 802.15.4, exactly as it appears in the spec (no padding, no + * nothing), and with no FCS at the end of the frame; requested by + * Jon Smirl . + */ +#define DLT_IEEE802_15_4_NOFCS 230 + +/* + * Raw D-Bus: + * + * http://www.freedesktop.org/wiki/Software/dbus + * + * messages: + * + * http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages + * + * starting with the endianness flag, followed by the message type, etc., + * but without the authentication handshake before the message sequence: + * + * http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol + * + * Requested by Martin Vidner . + */ +#define DLT_DBUS 231 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + */ +#define DLT_JUNIPER_VS 232 +#define DLT_JUNIPER_SRX_E2E 233 +#define DLT_JUNIPER_FIBRECHANNEL 234 + +/* + * DVB-CI (DVB Common Interface for communication between a PC Card + * module and a DVB receiver). See + * + * http://www.kaiser.cx/pcap-dvbci.html + * + * for the specification. + * + * Requested by Martin Kaiser . + */ +#define DLT_DVB_CI 235 + +/* + * Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but + * *not* the same as, 27.010). Requested by Hans-Christoph Schemmel + * . + */ +#define DLT_MUX27010 236 + +/* + * STANAG 5066 D_PDUs. Requested by M. Baris Demiray + * . + */ +#define DLT_STANAG_5066_D_PDU 237 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . + */ +#define DLT_JUNIPER_ATM_CEMIC 238 + +/* + * NetFilter LOG messages + * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets) + * + * Requested by Jakub Zawadzki + */ +#define DLT_NFLOG 239 + +/* + * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type + * for Ethernet packets with a 4-byte pseudo-header and always + * with the payload including the FCS, as supplied by their + * netANALYZER hardware and software. + * + * Requested by Holger P. Frommer + */ +#define DLT_NETANALYZER 240 + +/* + * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type + * for Ethernet packets with a 4-byte pseudo-header and FCS and + * with the Ethernet header preceded by 7 bytes of preamble and + * 1 byte of SFD, as supplied by their netANALYZER hardware and + * software. + * + * Requested by Holger P. Frommer + */ +#define DLT_NETANALYZER_TRANSPARENT 241 + +/* + * IP-over-InfiniBand, as specified by RFC 4391. + * + * Requested by Petr Sumbera . + */ +#define DLT_IPOIB 242 + +/* + * MPEG-2 transport stream (ISO 13818-1/ITU-T H.222.0). + * + * Requested by Guy Martin . + */ +#define DLT_MPEG_2_TS 243 + +/* + * ng4T GmbH's UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format as + * used by their ng40 protocol tester. + * + * Requested by Jens Grimmer . + */ +#define DLT_NG40 244 + +/* + * Pseudo-header giving adapter number and flags, followed by an NFC + * (Near-Field Communications) Logical Link Control Protocol (LLCP) PDU, + * as specified by NFC Forum Logical Link Control Protocol Technical + * Specification LLCP 1.1. + * + * Requested by Mike Wakerly . + */ +#define DLT_NFC_LLCP 245 + +/* + * 246 is used as LINKTYPE_PFSYNC; do not use it for any other purpose. + * + * DLT_PFSYNC has different values on different platforms, and all of + * them collide with something used elsewhere. On platforms that + * don't already define it, define it as 246. + */ +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) && !defined(__APPLE__) +#define DLT_PFSYNC 246 +#endif + +/* + * Raw InfiniBand packets, starting with the Local Routing Header. + * + * Requested by Oren Kladnitsky . + */ +#define DLT_INFINIBAND 247 + +/* + * SCTP, with no lower-level protocols (i.e., no IPv4 or IPv6). + * + * Requested by Michael Tuexen . + */ +#define DLT_SCTP 248 + +/* + * USB packets, beginning with a USBPcap header. + * + * Requested by Tomasz Mon + */ +#define DLT_USBPCAP 249 + +/* + * Schweitzer Engineering Laboratories "RTAC" product serial-line + * packets. + * + * Requested by Chris Bontje . + */ +#define DLT_RTAC_SERIAL 250 + +/* + * Bluetooth Low Energy air interface link-layer packets. + * + * Requested by Mike Kershaw . + */ +#define DLT_BLUETOOTH_LE_LL 251 + +/* + * DLT type for upper-protocol layer PDU saves from wireshark. + * + * the actual contents are determined by two TAGs stored with each + * packet: + * EXP_PDU_TAG_LINKTYPE the link type (LINKTYPE_ value) of the + * original packet. + * + * EXP_PDU_TAG_PROTO_NAME the name of the wireshark dissector + * that can make sense of the data stored. + */ +#define DLT_WIRESHARK_UPPER_PDU 252 + +/* + * DLT type for the netlink protocol (nlmon devices). + */ +#define DLT_NETLINK 253 + +/* + * Bluetooth Linux Monitor headers for the BlueZ stack. + */ +#define DLT_BLUETOOTH_LINUX_MONITOR 254 + +/* + * Bluetooth Basic Rate/Enhanced Data Rate baseband packets, as + * captured by Ubertooth. + */ +#define DLT_BLUETOOTH_BREDR_BB 255 + +/* + * Bluetooth Low Energy link layer packets, as captured by Ubertooth. + */ +#define DLT_BLUETOOTH_LE_LL_WITH_PHDR 256 + +/* + * PROFIBUS data link layer. + */ +#define DLT_PROFIBUS_DL 257 + +/* + * Apple's DLT_PKTAP headers. + * + * Sadly, the folks at Apple either had no clue that the DLT_USERn values + * are for internal use within an organization and partners only, and + * didn't know that the right way to get a link-layer header type is to + * ask tcpdump.org for one, or knew and didn't care, so they just + * used DLT_USER2, which causes problems for everything except for + * their version of tcpdump. + * + * So I'll just give them one; hopefully this will show up in a + * libpcap release in time for them to get this into 10.10 Big Sur + * or whatever Mavericks' successor is called. LINKTYPE_PKTAP + * will be 258 *even on macOS*; that is *intentional*, so that + * PKTAP files look the same on *all* OSes (different OSes can have + * different numerical values for a given DLT_, but *MUST NOT* have + * different values for what goes in a file, as files can be moved + * between OSes!). + * + * When capturing, on a system with a Darwin-based OS, on a device + * that returns 149 (DLT_USER2 and Apple's DLT_PKTAP) with this + * version of libpcap, the DLT_ value for the pcap_t will be DLT_PKTAP, + * and that will continue to be DLT_USER2 on Darwin-based OSes. That way, + * binary compatibility with Mavericks is preserved for programs using + * this version of libpcap. This does mean that if you were using + * DLT_USER2 for some capture device on macOS, you can't do so with + * this version of libpcap, just as you can't with Apple's libpcap - + * on macOS, they define DLT_PKTAP to be DLT_USER2, so programs won't + * be able to distinguish between PKTAP and whatever you were using + * DLT_USER2 for. + * + * If the program saves the capture to a file using this version of + * libpcap's pcap_dump code, the LINKTYPE_ value in the file will be + * LINKTYPE_PKTAP, which will be 258, even on Darwin-based OSes. + * That way, the file will *not* be a DLT_USER2 file. That means + * that the latest version of tcpdump, when built with this version + * of libpcap, and sufficiently recent versions of Wireshark will + * be able to read those files and interpret them correctly; however, + * Apple's version of tcpdump in OS X 10.9 won't be able to handle + * them. (Hopefully, Apple will pick up this version of libpcap, + * and the corresponding version of tcpdump, so that tcpdump will + * be able to handle the old LINKTYPE_USER2 captures *and* the new + * LINKTYPE_PKTAP captures.) + */ +#ifdef __APPLE__ +#define DLT_PKTAP DLT_USER2 +#else +#define DLT_PKTAP 258 +#endif + +/* + * Ethernet packets preceded by a header giving the last 6 octets + * of the preamble specified by 802.3-2012 Clause 65, section + * 65.1.3.2 "Transmit". + */ +#define DLT_EPON 259 + +/* + * IPMI trace packets, as specified by Table 3-20 "Trace Data Block Format" + * in the PICMG HPM.2 specification. + */ +#define DLT_IPMI_HPM_2 260 + +/* + * per Joshua Wright , formats for Zwave captures. + */ +#define DLT_ZWAVE_R1_R2 261 +#define DLT_ZWAVE_R3 262 + +/* + * per Steve Karg , formats for Wattstopper + * Digital Lighting Management room bus serial protocol captures. + */ +#define DLT_WATTSTOPPER_DLM 263 + +/* + * ISO 14443 contactless smart card messages. + */ +#define DLT_ISO_14443 264 + +/* + * Radio data system (RDS) groups. IEC 62106. + * Per Jonathan Brucker . + */ +#define DLT_RDS 265 + +/* + * USB packets, beginning with a Darwin (macOS, etc.) header. + */ +#define DLT_USB_DARWIN 266 + +/* + * OpenBSD DLT_OPENFLOW. + */ +#define DLT_OPENFLOW 267 + +/* + * SDLC frames containing SNA PDUs. + */ +#define DLT_SDLC 268 + +/* + * per "Selvig, Bjorn" used for + * TI protocol sniffer. + */ +#define DLT_TI_LLN_SNIFFER 269 + +/* + * per: Erik de Jong for + * https://github.com/eriknl/LoRaTap/releases/tag/v0.1 + */ +#define DLT_LORATAP 270 + +/* + * per: Stefanha at gmail.com for + * http://lists.sandelman.ca/pipermail/tcpdump-workers/2017-May/000772.html + * and: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/vsockmon.h + * for: http://qemu-project.org/Features/VirtioVsock + */ +#define DLT_VSOCK 271 + +/* + * Nordic Semiconductor Bluetooth LE sniffer. + */ +#define DLT_NORDIC_BLE 272 + +/* + * Excentis DOCSIS 3.1 RF sniffer (XRA-31) + * per: bruno.verstuyft at excentis.com + * http://www.xra31.com/xra-header + */ +#define DLT_DOCSIS31_XRA31 273 + +/* + * mPackets, as specified by IEEE 802.3br Figure 99-4, starting + * with the preamble and always ending with a CRC field. + */ +#define DLT_ETHERNET_MPACKET 274 + +/* + * DisplayPort AUX channel monitoring data as specified by VESA + * DisplayPort(DP) Standard preceeded by a pseudo-header. + * per dirk.eibach at gdsys.cc + */ +#define DLT_DISPLAYPORT_AUX 275 + +/* + * Linux cooked sockets v2. + */ +#define DLT_LINUX_SLL2 276 + +/* + * In case the code that includes this file (directly or indirectly) + * has also included OS files that happen to define DLT_MATCHING_MAX, + * with a different value (perhaps because that OS hasn't picked up + * the latest version of our DLT definitions), we undefine the + * previous value of DLT_MATCHING_MAX. + */ +#ifdef DLT_MATCHING_MAX +#undef DLT_MATCHING_MAX +#endif +#define DLT_MATCHING_MAX 276 /* highest value in the "matching" range */ + +/* + * DLT and savefile link type values are split into a class and + * a member of that class. A class value of 0 indicates a regular + * DLT_/LINKTYPE_ value. + */ +#define DLT_CLASS(x) ((x) & 0x03ff0000) + +/* + * NetBSD-specific generic "raw" link type. The class value indicates + * that this is the generic raw type, and the lower 16 bits are the + * address family we're dealing with. Those values are NetBSD-specific; + * do not assume that they correspond to AF_ values for your operating + * system. + */ +#define DLT_CLASS_NETBSD_RAWAF 0x02240000 +#define DLT_NETBSD_RAWAF(af) (DLT_CLASS_NETBSD_RAWAF | (af)) +#define DLT_NETBSD_RAWAF_AF(x) ((x) & 0x0000ffff) +#define DLT_IS_NETBSD_RAWAF(x) (DLT_CLASS(x) == DLT_CLASS_NETBSD_RAWAF) + +#endif /* !defined(lib_pcap_dlt_h) */ diff --git a/network/start/lib/npcap/Include/pcap/funcattrs.h b/network/start/lib/npcap/Include/pcap/funcattrs.h new file mode 100644 index 0000000..fbb6760 --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/funcattrs.h @@ -0,0 +1,263 @@ +/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ +/* + * Copyright (c) 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +#ifndef lib_pcap_funcattrs_h +#define lib_pcap_funcattrs_h + +#include + +/* + * Attributes to apply to functions and their arguments, using various + * compiler-specific extensions. + */ + +/* + * PCAP_API_DEF must be used when defining *data* exported from + * libpcap. It can be used when defining *functions* exported + * from libpcap, but it doesn't have to be used there. It + * should not be used in declarations in headers. + * + * PCAP_API must be used when *declaring* data or functions + * exported from libpcap; PCAP_API_DEF won't work on all platforms. + */ + +#if defined(_WIN32) + /* + * For Windows: + * + * when building libpcap: + * + * if we're building it as a DLL, we have to declare API + * functions with __declspec(dllexport); + * + * if we're building it as a static library, we don't want + * to do so. + * + * when using libpcap: + * + * if we're using the DLL, calls to its functions are a + * little more efficient if they're declared with + * __declspec(dllimport); + * + * if we're not using the dll, we don't want to declare + * them that way. + * + * So: + * + * if pcap_EXPORTS is defined, we define PCAP_API_DEF as + * __declspec(dllexport); + * + * if PCAP_DLL is defined, we define PCAP_API_DEF as + * __declspec(dllimport); + * + * otherwise, we define PCAP_API_DEF as nothing. + */ + #if defined(pcap_EXPORTS) + /* + * We're compiling libpcap as a DLL, so we should export functions + * in our API. + */ + #define PCAP_API_DEF __declspec(dllexport) + #elif defined(PCAP_DLL) + /* + * We're using libpcap as a DLL, so the calls will be a little more + * efficient if we explicitly import the functions. + */ + #define PCAP_API_DEF __declspec(dllimport) + #else + /* + * Either we're building libpcap as a static library, or we're using + * it as a static library, or we don't know for certain that we're + * using it as a dynamic library, so neither import nor export the + * functions explicitly. + */ + #define PCAP_API_DEF + #endif +#elif defined(MSDOS) + /* XXX - does this need special treatment? */ + #define PCAP_API_DEF +#else /* UN*X */ + #ifdef pcap_EXPORTS + /* + * We're compiling libpcap as a (dynamic) shared library, so we should + * export functions in our API. The compiler might be configured not + * to export functions from a shared library by default, so we might + * have to explicitly mark functions as exported. + */ + #if PCAP_IS_AT_LEAST_GNUC_VERSION(3,4) \ + || PCAP_IS_AT_LEAST_XL_C_VERSION(12,0) + /* + * GCC 3.4 or later, or some compiler asserting compatibility with + * GCC 3.4 or later, or XL C 13.0 or later, so we have + * __attribute__((visibility()). + */ + #define PCAP_API_DEF __attribute__((visibility("default"))) + #elif PCAP_IS_AT_LEAST_SUNC_VERSION(5,5) + /* + * Sun C 5.5 or later, so we have __global. + * (Sun C 5.9 and later also have __attribute__((visibility()), + * but there's no reason to prefer it with Sun C.) + */ + #define PCAP_API_DEF __global + #else + /* + * We don't have anything to say. + */ + #define PCAP_API_DEF + #endif + #else + /* + * We're not building libpcap. + */ + #define PCAP_API_DEF + #endif +#endif /* _WIN32/MSDOS/UN*X */ + +#define PCAP_API PCAP_API_DEF extern + +/* + * PCAP_NORETURN, before a function declaration, means "this function + * never returns". (It must go before the function declaration, e.g. + * "extern PCAP_NORETURN func(...)" rather than after the function + * declaration, as the MSVC version has to go before the declaration.) + * + * PCAP_NORETURN_DEF, before a function *definition*, means "this + * function never returns"; it would be used only for static functions + * that are defined before any use, and thus have no declaration. + * (MSVC doesn't support that; I guess the "decl" in "__declspec" + * means "declaration", and __declspec doesn't work with definitions.) + */ +#if __has_attribute(noreturn) \ + || PCAP_IS_AT_LEAST_GNUC_VERSION(2,5) \ + || PCAP_IS_AT_LEAST_SUNC_VERSION(5,9) \ + || PCAP_IS_AT_LEAST_XL_C_VERSION(10,1) \ + || PCAP_IS_AT_LEAST_HP_C_VERSION(6,10) + /* + * Compiler with support for __attribute((noreturn)), or GCC 2.5 or + * later, or some compiler asserting compatibility with GCC 2.5 or + * later, or Solaris Studio 12 (Sun C 5.9) or later, or IBM XL C 10.1 + * or later (do any earlier versions of XL C support this?), or HP aCC + * A.06.10 or later. + */ + #define PCAP_NORETURN __attribute((noreturn)) + #define PCAP_NORETURN_DEF __attribute((noreturn)) +#elif defined(_MSC_VER) + /* + * MSVC. + */ + #define PCAP_NORETURN __declspec(noreturn) + #define PCAP_NORETURN_DEF +#else + #define PCAP_NORETURN + #define PCAP_NORETURN_DEF +#endif + +/* + * PCAP_PRINTFLIKE(x,y), after a function declaration, means "this function + * does printf-style formatting, with the xth argument being the format + * string and the yth argument being the first argument for the format + * string". + */ +#if __has_attribute(__format__) \ + || PCAP_IS_AT_LEAST_GNUC_VERSION(2,3) \ + || PCAP_IS_AT_LEAST_XL_C_VERSION(10,1) \ + || PCAP_IS_AT_LEAST_HP_C_VERSION(6,10) + /* + * Compiler with support for it, or GCC 2.3 or later, or some compiler + * asserting compatibility with GCC 2.3 or later, or IBM XL C 10.1 + * and later (do any earlier versions of XL C support this?), + * or HP aCC A.06.10 and later. + */ + #define PCAP_PRINTFLIKE(x,y) __attribute__((__format__(__printf__,x,y))) +#else + #define PCAP_PRINTFLIKE(x,y) +#endif + +/* + * PCAP_DEPRECATED(func, msg), after a function declaration, marks the + * function as deprecated. + * + * The first argument is the name of the function; the second argument is + * a string giving the warning message to use if the compiler supports that. + * + * (Thank you, Microsoft, for requiring the function name.) + */ +#if __has_attribute(deprecated) \ + || PCAP_IS_AT_LEAST_GNUC_VERSION(4,5) \ + || PCAP_IS_AT_LEAST_SUNC_VERSION(5,13) + /* + * Compiler that supports __has_attribute and __attribute__((deprecated)), + * or GCC 4.5 or later, or Sun/Oracle C 12.4 (Sun C 5.13) or later. + * + * Those support __attribute__((deprecated(msg))) (we assume, perhaps + * incorrectly, that anything that supports __has_attribute() is + * recent enough to support __attribute__((deprecated(msg)))). + */ + #define PCAP_DEPRECATED(func, msg) __attribute__((deprecated(msg))) +#elif PCAP_IS_AT_LEAST_GNUC_VERSION(3,1) + /* + * GCC 3.1 through 4.4. + * + * Those support __attribute__((deprecated)) but not + * __attribute__((deprecated(msg))). + */ + #define PCAP_DEPRECATED(func, msg) __attribute__((deprecated)) +#elif (defined(_MSC_VER) && (_MSC_VER >= 1500)) && !defined(BUILDING_PCAP) + /* + * MSVC from Visual Studio 2008 or later, and we're not building + * libpcap itself. + * + * If we *are* building libpcap, we don't want this, as it'll warn + * us even if we *define* the function. + */ + #define PCAP_DEPRECATED(func, msg) __pragma(deprecated(func)) +#else + #define PCAP_DEPRECATED(func, msg) +#endif + +/* + * For flagging arguments as format strings in MSVC. + */ +#ifdef _MSC_VER + #include + #if _MSC_VER > 1400 + #define PCAP_FORMAT_STRING(p) _Printf_format_string_ p + #else + #define PCAP_FORMAT_STRING(p) __format_string p + #endif +#else + #define PCAP_FORMAT_STRING(p) p +#endif + +#endif /* lib_pcap_funcattrs_h */ diff --git a/network/start/lib/npcap/Include/pcap/ipnet.h b/network/start/lib/npcap/Include/pcap/ipnet.h new file mode 100644 index 0000000..ca21cf4 --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/ipnet.h @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +#define IPH_AF_INET 2 /* Matches Solaris's AF_INET */ +#define IPH_AF_INET6 26 /* Matches Solaris's AF_INET6 */ + +#define IPNET_OUTBOUND 1 +#define IPNET_INBOUND 2 diff --git a/network/start/lib/npcap/Include/pcap/namedb.h b/network/start/lib/npcap/Include/pcap/namedb.h new file mode 100644 index 0000000..abc11e2 --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/namedb.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 1994, 1996 + * The Regents of the University of California. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +#ifndef lib_pcap_namedb_h +#define lib_pcap_namedb_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * As returned by the pcap_next_etherent() + * XXX this stuff doesn't belong in this interface, but this + * library already must do name to address translation, so + * on systems that don't have support for /etc/ethers, we + * export these hooks since they're already being used by + * some applications (such as tcpdump) and already being + * marked as exported in some OSes offering libpcap (such + * as Debian). + */ +struct pcap_etherent { + u_char addr[6]; + char name[122]; +}; +#ifndef PCAP_ETHERS_FILE +#define PCAP_ETHERS_FILE "/etc/ethers" +#endif +PCAP_API struct pcap_etherent *pcap_next_etherent(FILE *); +PCAP_API u_char *pcap_ether_hostton(const char*); +PCAP_API u_char *pcap_ether_aton(const char *); + +PCAP_API bpf_u_int32 **pcap_nametoaddr(const char *); +PCAP_API struct addrinfo *pcap_nametoaddrinfo(const char *); +PCAP_API bpf_u_int32 pcap_nametonetaddr(const char *); + +PCAP_API int pcap_nametoport(const char *, int *, int *); +PCAP_API int pcap_nametoportrange(const char *, int *, int *, int *); +PCAP_API int pcap_nametoproto(const char *); +PCAP_API int pcap_nametoeproto(const char *); +PCAP_API int pcap_nametollc(const char *); +/* + * If a protocol is unknown, PROTO_UNDEF is returned. + * Also, pcap_nametoport() returns the protocol along with the port number. + * If there are ambiguous entried in /etc/services (i.e. domain + * can be either tcp or udp) PROTO_UNDEF is returned. + */ +#define PROTO_UNDEF -1 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/network/start/lib/npcap/Include/pcap/nflog.h b/network/start/lib/npcap/Include/pcap/nflog.h new file mode 100644 index 0000000..7e03ca3 --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/nflog.h @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2013, Petar Alilovic, + * Faculty of Electrical Engineering and Computing, University of Zagreb + * All rights reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * 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. + */ + +#ifndef lib_pcap_nflog_h +#define lib_pcap_nflog_h + +#include + +/* + * Structure of an NFLOG header and TLV parts, as described at + * https://www.tcpdump.org/linktypes/LINKTYPE_NFLOG.html + * + * The NFLOG header is big-endian. + * + * The TLV length and type are in host byte order. The value is either + * big-endian or is an array of bytes in some externally-specified byte + * order (text string, link-layer address, link-layer header, packet + * data, etc.). + */ +typedef struct nflog_hdr { + uint8_t nflog_family; /* address family */ + uint8_t nflog_version; /* version */ + uint16_t nflog_rid; /* resource ID */ +} nflog_hdr_t; + +typedef struct nflog_tlv { + uint16_t tlv_length; /* tlv length */ + uint16_t tlv_type; /* tlv type */ + /* value follows this */ +} nflog_tlv_t; + +typedef struct nflog_packet_hdr { + uint16_t hw_protocol; /* hw protocol */ + uint8_t hook; /* netfilter hook */ + uint8_t pad; /* padding to 32 bits */ +} nflog_packet_hdr_t; + +typedef struct nflog_hwaddr { + uint16_t hw_addrlen; /* address length */ + uint16_t pad; /* padding to 32-bit boundary */ + uint8_t hw_addr[8]; /* address, up to 8 bytes */ +} nflog_hwaddr_t; + +typedef struct nflog_timestamp { + uint64_t sec; + uint64_t usec; +} nflog_timestamp_t; + +/* + * TLV types. + */ +#define NFULA_PACKET_HDR 1 /* nflog_packet_hdr_t */ +#define NFULA_MARK 2 /* packet mark from skbuff */ +#define NFULA_TIMESTAMP 3 /* nflog_timestamp_t for skbuff's time stamp */ +#define NFULA_IFINDEX_INDEV 4 /* ifindex of device on which packet received (possibly bridge group) */ +#define NFULA_IFINDEX_OUTDEV 5 /* ifindex of device on which packet transmitted (possibly bridge group) */ +#define NFULA_IFINDEX_PHYSINDEV 6 /* ifindex of physical device on which packet received (not bridge group) */ +#define NFULA_IFINDEX_PHYSOUTDEV 7 /* ifindex of physical device on which packet transmitted (not bridge group) */ +#define NFULA_HWADDR 8 /* nflog_hwaddr_t for hardware address */ +#define NFULA_PAYLOAD 9 /* packet payload */ +#define NFULA_PREFIX 10 /* text string - null-terminated, count includes NUL */ +#define NFULA_UID 11 /* UID owning socket on which packet was sent/received */ +#define NFULA_SEQ 12 /* sequence number of packets on this NFLOG socket */ +#define NFULA_SEQ_GLOBAL 13 /* sequence number of pakets on all NFLOG sockets */ +#define NFULA_GID 14 /* GID owning socket on which packet was sent/received */ +#define NFULA_HWTYPE 15 /* ARPHRD_ type of skbuff's device */ +#define NFULA_HWHEADER 16 /* skbuff's MAC-layer header */ +#define NFULA_HWLEN 17 /* length of skbuff's MAC-layer header */ + +#endif diff --git a/network/start/lib/npcap/Include/pcap/pcap-inttypes.h b/network/start/lib/npcap/Include/pcap/pcap-inttypes.h new file mode 100644 index 0000000..993c9d0 --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/pcap-inttypes.h @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2009 CACE Technologies, Inc. Davis (California) + * 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. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + */ +#ifndef pcap_pcap_inttypes_h +#define pcap_pcap_inttypes_h + +/* + * Get the integer types and PRi[doux]64 values from C99 + * defined, by hook or by crook. + */ +#if defined(_MSC_VER) + /* + * Compiler is MSVC. + */ + #if _MSC_VER >= 1800 + /* + * VS 2013 or newer; we have . + */ + #include + #else + /* + * Earlier VS; we have to define this stuff ourselves. + */ + typedef unsigned char uint8_t; + typedef signed char int8_t; + typedef unsigned short uint16_t; + typedef signed short int16_t; + typedef unsigned int uint32_t; + typedef signed int int32_t; + #ifdef _MSC_EXTENSIONS + typedef unsigned _int64 uint64_t; + typedef _int64 int64_t; + #else /* _MSC_EXTENSIONS */ + typedef unsigned long long uint64_t; + typedef long long int64_t; + #endif + #endif + + /* + * These may be defined by . + * + * XXX - for MSVC, we always want the _MSC_EXTENSIONS versions. + * What about other compilers? If, as the MinGW Web site says MinGW + * does, the other compilers just use Microsoft's run-time library, + * then they should probably use the _MSC_EXTENSIONS even if the + * compiler doesn't define _MSC_EXTENSIONS. + * + * XXX - we currently aren't using any of these, but this allows + * their use in the future. + */ + #ifndef PRId64 + #ifdef _MSC_EXTENSIONS + #define PRId64 "I64d" + #else + #define PRId64 "lld" + #endif + #endif /* PRId64 */ + + #ifndef PRIo64 + #ifdef _MSC_EXTENSIONS + #define PRIo64 "I64o" + #else + #define PRIo64 "llo" + #endif + #endif /* PRIo64 */ + + #ifndef PRIx64 + #ifdef _MSC_EXTENSIONS + #define PRIx64 "I64x" + #else + #define PRIx64 "llx" + #endif + #endif + + #ifndef PRIu64 + #ifdef _MSC_EXTENSIONS + #define PRIu64 "I64u" + #else + #define PRIu64 "llu" + #endif + #endif + + /* + * MSVC's support library doesn't support %zu to print a size_t until + * Visual Studio 2017, but supports %Iu earlier, so use that. + */ + #define PRIsize "Iu" +#elif defined(__MINGW32__) || !defined(_WIN32) + /* + * Compiler is MinGW or target is UN*X or MS-DOS. Just use + * . + */ + #include + + /* + * Assume the support library supports %zu; it's required by C99. + */ + #define PRIsize "zu" +#endif + +#endif /* pcap/pcap-inttypes.h */ diff --git a/network/start/lib/npcap/Include/pcap/pcap.h b/network/start/lib/npcap/Include/pcap/pcap.h new file mode 100644 index 0000000..a6c6e2a --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/pcap.h @@ -0,0 +1,976 @@ +/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ +/* + * Copyright (c) 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +/* + * Remote packet capture mechanisms and extensions from WinPcap: + * + * Copyright (c) 2002 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * 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. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + */ + +#ifndef lib_pcap_pcap_h +#define lib_pcap_pcap_h + +#include + +#include + +#if defined(_WIN32) + #include /* u_int, u_char etc. */ + #include /* _get_osfhandle() */ +#elif defined(MSDOS) + #include /* u_int, u_char etc. */ + #include +#else /* UN*X */ + #include /* u_int, u_char etc. */ + #include +#endif /* _WIN32/MSDOS/UN*X */ + +#include /* for SOCKET, as the active-mode rpcap APIs use it */ + +#ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H +#include +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Version number of the current version of the pcap file format. + * + * NOTE: this is *NOT* the version number of the libpcap library. + * To fetch the version information for the version of libpcap + * you're using, use pcap_lib_version(). + */ +#define PCAP_VERSION_MAJOR 2 +#define PCAP_VERSION_MINOR 4 + +#define PCAP_ERRBUF_SIZE 256 + +/* + * Compatibility for systems that have a bpf.h that + * predates the bpf typedefs for 64-bit support. + */ +#if BPF_RELEASE - 0 < 199406 +typedef int bpf_int32; +typedef u_int bpf_u_int32; +#endif + +typedef struct pcap pcap_t; +typedef struct pcap_dumper pcap_dumper_t; +typedef struct pcap_if pcap_if_t; +typedef struct pcap_addr pcap_addr_t; + +/* + * The first record in the file contains saved values for some + * of the flags used in the printout phases of tcpdump. + * Many fields here are 32 bit ints so compilers won't insert unwanted + * padding; these files need to be interchangeable across architectures. + * + * Do not change the layout of this structure, in any way (this includes + * changes that only affect the length of fields in this structure). + * + * Also, do not change the interpretation of any of the members of this + * structure, in any way (this includes using values other than + * LINKTYPE_ values, as defined in "savefile.c", in the "linktype" + * field). + * + * Instead: + * + * introduce a new structure for the new format, if the layout + * of the structure changed; + * + * send mail to "tcpdump-workers@lists.tcpdump.org", requesting + * a new magic number for your new capture file format, and, when + * you get the new magic number, put it in "savefile.c"; + * + * use that magic number for save files with the changed file + * header; + * + * make the code in "savefile.c" capable of reading files with + * the old file header as well as files with the new file header + * (using the magic number to determine the header format). + * + * Then supply the changes by forking the branch at + * + * https://github.com/the-tcpdump-group/libpcap/issues + * + * and issuing a pull request, so that future versions of libpcap and + * programs that use it (such as tcpdump) will be able to read your new + * capture file format. + */ +struct pcap_file_header { + bpf_u_int32 magic; + u_short version_major; + u_short version_minor; + bpf_int32 thiszone; /* gmt to local correction */ + bpf_u_int32 sigfigs; /* accuracy of timestamps */ + bpf_u_int32 snaplen; /* max length saved portion of each pkt */ + bpf_u_int32 linktype; /* data link type (LINKTYPE_*) */ +}; + +/* + * Macros for the value returned by pcap_datalink_ext(). + * + * If LT_FCS_LENGTH_PRESENT(x) is true, the LT_FCS_LENGTH(x) macro + * gives the FCS length of packets in the capture. + */ +#define LT_FCS_LENGTH_PRESENT(x) ((x) & 0x04000000) +#define LT_FCS_LENGTH(x) (((x) & 0xF0000000) >> 28) +#define LT_FCS_DATALINK_EXT(x) ((((x) & 0xF) << 28) | 0x04000000) + +typedef enum { + PCAP_D_INOUT = 0, + PCAP_D_IN, + PCAP_D_OUT +} pcap_direction_t; + +/* + * Generic per-packet information, as supplied by libpcap. + * + * The time stamp can and should be a "struct timeval", regardless of + * whether your system supports 32-bit tv_sec in "struct timeval", + * 64-bit tv_sec in "struct timeval", or both if it supports both 32-bit + * and 64-bit applications. The on-disk format of savefiles uses 32-bit + * tv_sec (and tv_usec); this structure is irrelevant to that. 32-bit + * and 64-bit versions of libpcap, even if they're on the same platform, + * should supply the appropriate version of "struct timeval", even if + * that's not what the underlying packet capture mechanism supplies. + */ +struct pcap_pkthdr { + struct timeval ts; /* time stamp */ + bpf_u_int32 caplen; /* length of portion present */ + bpf_u_int32 len; /* length this packet (off wire) */ +}; + +/* + * As returned by the pcap_stats() + */ +struct pcap_stat { + u_int ps_recv; /* number of packets received */ + u_int ps_drop; /* number of packets dropped */ + u_int ps_ifdrop; /* drops by interface -- only supported on some platforms */ +#ifdef _WIN32 + u_int ps_capt; /* number of packets that reach the application */ + u_int ps_sent; /* number of packets sent by the server on the network */ + u_int ps_netdrop; /* number of packets lost on the network */ +#endif /* _WIN32 */ +}; + +#ifdef MSDOS +/* + * As returned by the pcap_stats_ex() + */ +struct pcap_stat_ex { + u_long rx_packets; /* total packets received */ + u_long tx_packets; /* total packets transmitted */ + u_long rx_bytes; /* total bytes received */ + u_long tx_bytes; /* total bytes transmitted */ + u_long rx_errors; /* bad packets received */ + u_long tx_errors; /* packet transmit problems */ + u_long rx_dropped; /* no space in Rx buffers */ + u_long tx_dropped; /* no space available for Tx */ + u_long multicast; /* multicast packets received */ + u_long collisions; + + /* detailed rx_errors: */ + u_long rx_length_errors; + u_long rx_over_errors; /* receiver ring buff overflow */ + u_long rx_crc_errors; /* recv'd pkt with crc error */ + u_long rx_frame_errors; /* recv'd frame alignment error */ + u_long rx_fifo_errors; /* recv'r fifo overrun */ + u_long rx_missed_errors; /* recv'r missed packet */ + + /* detailed tx_errors */ + u_long tx_aborted_errors; + u_long tx_carrier_errors; + u_long tx_fifo_errors; + u_long tx_heartbeat_errors; + u_long tx_window_errors; + }; +#endif + +/* + * Item in a list of interfaces. + */ +struct pcap_if { + struct pcap_if *next; + char *name; /* name to hand to "pcap_open_live()" */ + char *description; /* textual description of interface, or NULL */ + struct pcap_addr *addresses; + bpf_u_int32 flags; /* PCAP_IF_ interface flags */ +}; + +#define PCAP_IF_LOOPBACK 0x00000001 /* interface is loopback */ +#define PCAP_IF_UP 0x00000002 /* interface is up */ +#define PCAP_IF_RUNNING 0x00000004 /* interface is running */ +#define PCAP_IF_WIRELESS 0x00000008 /* interface is wireless (*NOT* necessarily Wi-Fi!) */ +#define PCAP_IF_CONNECTION_STATUS 0x00000030 /* connection status: */ +#define PCAP_IF_CONNECTION_STATUS_UNKNOWN 0x00000000 /* unknown */ +#define PCAP_IF_CONNECTION_STATUS_CONNECTED 0x00000010 /* connected */ +#define PCAP_IF_CONNECTION_STATUS_DISCONNECTED 0x00000020 /* disconnected */ +#define PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE 0x00000030 /* not applicable */ + +/* + * Representation of an interface address. + */ +struct pcap_addr { + struct pcap_addr *next; + struct sockaddr *addr; /* address */ + struct sockaddr *netmask; /* netmask for that address */ + struct sockaddr *broadaddr; /* broadcast address for that address */ + struct sockaddr *dstaddr; /* P2P destination address for that address */ +}; + +typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *, + const u_char *); + +/* + * Error codes for the pcap API. + * These will all be negative, so you can check for the success or + * failure of a call that returns these codes by checking for a + * negative value. + */ +#define PCAP_ERROR -1 /* generic error code */ +#define PCAP_ERROR_BREAK -2 /* loop terminated by pcap_breakloop */ +#define PCAP_ERROR_NOT_ACTIVATED -3 /* the capture needs to be activated */ +#define PCAP_ERROR_ACTIVATED -4 /* the operation can't be performed on already activated captures */ +#define PCAP_ERROR_NO_SUCH_DEVICE -5 /* no such device exists */ +#define PCAP_ERROR_RFMON_NOTSUP -6 /* this device doesn't support rfmon (monitor) mode */ +#define PCAP_ERROR_NOT_RFMON -7 /* operation supported only in monitor mode */ +#define PCAP_ERROR_PERM_DENIED -8 /* no permission to open the device */ +#define PCAP_ERROR_IFACE_NOT_UP -9 /* interface isn't up */ +#define PCAP_ERROR_CANTSET_TSTAMP_TYPE -10 /* this device doesn't support setting the time stamp type */ +#define PCAP_ERROR_PROMISC_PERM_DENIED -11 /* you don't have permission to capture in promiscuous mode */ +#define PCAP_ERROR_TSTAMP_PRECISION_NOTSUP -12 /* the requested time stamp precision is not supported */ + +/* + * Warning codes for the pcap API. + * These will all be positive and non-zero, so they won't look like + * errors. + */ +#define PCAP_WARNING 1 /* generic warning code */ +#define PCAP_WARNING_PROMISC_NOTSUP 2 /* this device doesn't support promiscuous mode */ +#define PCAP_WARNING_TSTAMP_TYPE_NOTSUP 3 /* the requested time stamp type is not supported */ + +/* + * Value to pass to pcap_compile() as the netmask if you don't know what + * the netmask is. + */ +#define PCAP_NETMASK_UNKNOWN 0xffffffff + +/* + * We're deprecating pcap_lookupdev() for various reasons (not + * thread-safe, can behave weirdly with WinPcap). Callers + * should use pcap_findalldevs() and use the first device. + */ +PCAP_API char *pcap_lookupdev(char *) +PCAP_DEPRECATED(pcap_lookupdev, "use 'pcap_findalldevs' and use the first device"); + +PCAP_API int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *); + +PCAP_API pcap_t *pcap_create(const char *, char *); +PCAP_API int pcap_set_snaplen(pcap_t *, int); +PCAP_API int pcap_set_promisc(pcap_t *, int); +PCAP_API int pcap_can_set_rfmon(pcap_t *); +PCAP_API int pcap_set_rfmon(pcap_t *, int); +PCAP_API int pcap_set_timeout(pcap_t *, int); +PCAP_API int pcap_set_tstamp_type(pcap_t *, int); +PCAP_API int pcap_set_immediate_mode(pcap_t *, int); +PCAP_API int pcap_set_buffer_size(pcap_t *, int); +PCAP_API int pcap_set_tstamp_precision(pcap_t *, int); +PCAP_API int pcap_get_tstamp_precision(pcap_t *); +PCAP_API int pcap_activate(pcap_t *); + +PCAP_API int pcap_list_tstamp_types(pcap_t *, int **); +PCAP_API void pcap_free_tstamp_types(int *); +PCAP_API int pcap_tstamp_type_name_to_val(const char *); +PCAP_API const char *pcap_tstamp_type_val_to_name(int); +PCAP_API const char *pcap_tstamp_type_val_to_description(int); + +#ifdef __linux__ +PCAP_API int pcap_set_protocol_linux(pcap_t *, int); +#endif + +/* + * Time stamp types. + * Not all systems and interfaces will necessarily support all of these. + * + * A system that supports PCAP_TSTAMP_HOST is offering time stamps + * provided by the host machine, rather than by the capture device, + * but not committing to any characteristics of the time stamp; + * it will not offer any of the PCAP_TSTAMP_HOST_ subtypes. + * + * PCAP_TSTAMP_HOST_LOWPREC is a time stamp, provided by the host machine, + * that's low-precision but relatively cheap to fetch; it's normally done + * using the system clock, so it's normally synchronized with times you'd + * fetch from system calls. + * + * PCAP_TSTAMP_HOST_HIPREC is a time stamp, provided by the host machine, + * that's high-precision; it might be more expensive to fetch. It might + * or might not be synchronized with the system clock, and might have + * problems with time stamps for packets received on different CPUs, + * depending on the platform. + * + * PCAP_TSTAMP_ADAPTER is a high-precision time stamp supplied by the + * capture device; it's synchronized with the system clock. + * + * PCAP_TSTAMP_ADAPTER_UNSYNCED is a high-precision time stamp supplied by + * the capture device; it's not synchronized with the system clock. + * + * Note that time stamps synchronized with the system clock can go + * backwards, as the system clock can go backwards. If a clock is + * not in sync with the system clock, that could be because the + * system clock isn't keeping accurate time, because the other + * clock isn't keeping accurate time, or both. + * + * Note that host-provided time stamps generally correspond to the + * time when the time-stamping code sees the packet; this could + * be some unknown amount of time after the first or last bit of + * the packet is received by the network adapter, due to batching + * of interrupts for packet arrival, queueing delays, etc.. + */ +#define PCAP_TSTAMP_HOST 0 /* host-provided, unknown characteristics */ +#define PCAP_TSTAMP_HOST_LOWPREC 1 /* host-provided, low precision */ +#define PCAP_TSTAMP_HOST_HIPREC 2 /* host-provided, high precision */ +#define PCAP_TSTAMP_ADAPTER 3 /* device-provided, synced with the system clock */ +#define PCAP_TSTAMP_ADAPTER_UNSYNCED 4 /* device-provided, not synced with the system clock */ + +/* + * Time stamp resolution types. + * Not all systems and interfaces will necessarily support all of these + * resolutions when doing live captures; all of them can be requested + * when reading a savefile. + */ +#define PCAP_TSTAMP_PRECISION_MICRO 0 /* use timestamps with microsecond precision, default */ +#define PCAP_TSTAMP_PRECISION_NANO 1 /* use timestamps with nanosecond precision */ + +PCAP_API pcap_t *pcap_open_live(const char *, int, int, int, char *); +PCAP_API pcap_t *pcap_open_dead(int, int); +PCAP_API pcap_t *pcap_open_dead_with_tstamp_precision(int, int, u_int); +PCAP_API pcap_t *pcap_open_offline_with_tstamp_precision(const char *, u_int, char *); +PCAP_API pcap_t *pcap_open_offline(const char *, char *); +#ifdef _WIN32 + PCAP_API pcap_t *pcap_hopen_offline_with_tstamp_precision(intptr_t, u_int, char *); + PCAP_API pcap_t *pcap_hopen_offline(intptr_t, char *); + /* + * If we're building libpcap, these are internal routines in savefile.c, + * so we must not define them as macros. + * + * If we're not building libpcap, given that the version of the C runtime + * with which libpcap was built might be different from the version + * of the C runtime with which an application using libpcap was built, + * and that a FILE structure may differ between the two versions of the + * C runtime, calls to _fileno() must use the version of _fileno() in + * the C runtime used to open the FILE *, not the version in the C + * runtime with which libpcap was built. (Maybe once the Universal CRT + * rules the world, this will cease to be a problem.) + */ + #ifndef BUILDING_PCAP + #define pcap_fopen_offline_with_tstamp_precision(f,p,b) \ + pcap_hopen_offline_with_tstamp_precision(_get_osfhandle(_fileno(f)), p, b) + #define pcap_fopen_offline(f,b) \ + pcap_hopen_offline(_get_osfhandle(_fileno(f)), b) + #endif +#else /*_WIN32*/ + PCAP_API pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *); + PCAP_API pcap_t *pcap_fopen_offline(FILE *, char *); +#endif /*_WIN32*/ + +PCAP_API void pcap_close(pcap_t *); +PCAP_API int pcap_loop(pcap_t *, int, pcap_handler, u_char *); +PCAP_API int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *); +PCAP_API const u_char *pcap_next(pcap_t *, struct pcap_pkthdr *); +PCAP_API int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **); +PCAP_API void pcap_breakloop(pcap_t *); +PCAP_API int pcap_stats(pcap_t *, struct pcap_stat *); +PCAP_API int pcap_setfilter(pcap_t *, struct bpf_program *); +PCAP_API int pcap_setdirection(pcap_t *, pcap_direction_t); +PCAP_API int pcap_getnonblock(pcap_t *, char *); +PCAP_API int pcap_setnonblock(pcap_t *, int, char *); +PCAP_API int pcap_inject(pcap_t *, const void *, size_t); +PCAP_API int pcap_sendpacket(pcap_t *, const u_char *, int); +PCAP_API const char *pcap_statustostr(int); +PCAP_API const char *pcap_strerror(int); +PCAP_API char *pcap_geterr(pcap_t *); +PCAP_API void pcap_perror(pcap_t *, const char *); +PCAP_API int pcap_compile(pcap_t *, struct bpf_program *, const char *, int, + bpf_u_int32); +PCAP_API int pcap_compile_nopcap(int, int, struct bpf_program *, + const char *, int, bpf_u_int32); +PCAP_API void pcap_freecode(struct bpf_program *); +PCAP_API int pcap_offline_filter(const struct bpf_program *, + const struct pcap_pkthdr *, const u_char *); +PCAP_API int pcap_datalink(pcap_t *); +PCAP_API int pcap_datalink_ext(pcap_t *); +PCAP_API int pcap_list_datalinks(pcap_t *, int **); +PCAP_API int pcap_set_datalink(pcap_t *, int); +PCAP_API void pcap_free_datalinks(int *); +PCAP_API int pcap_datalink_name_to_val(const char *); +PCAP_API const char *pcap_datalink_val_to_name(int); +PCAP_API const char *pcap_datalink_val_to_description(int); +PCAP_API const char *pcap_datalink_val_to_description_or_dlt(int); +PCAP_API int pcap_snapshot(pcap_t *); +PCAP_API int pcap_is_swapped(pcap_t *); +PCAP_API int pcap_major_version(pcap_t *); +PCAP_API int pcap_minor_version(pcap_t *); +PCAP_API int pcap_bufsize(pcap_t *); + +/* XXX */ +PCAP_API FILE *pcap_file(pcap_t *); +PCAP_API int pcap_fileno(pcap_t *); + +#ifdef _WIN32 + PCAP_API int pcap_wsockinit(void); +#endif + +PCAP_API pcap_dumper_t *pcap_dump_open(pcap_t *, const char *); +#ifdef _WIN32 + PCAP_API pcap_dumper_t *pcap_dump_hopen(pcap_t *, intptr_t); + /* + * If we're building libpcap, this is an internal routine in sf-pcap.c, so + * we must not define it as a macro. + * + * If we're not building libpcap, given that the version of the C runtime + * with which libpcap was built might be different from the version + * of the C runtime with which an application using libpcap was built, + * and that a FILE structure may differ between the two versions of the + * C runtime, calls to _fileno() must use the version of _fileno() in + * the C runtime used to open the FILE *, not the version in the C + * runtime with which libpcap was built. (Maybe once the Universal CRT + * rules the world, this will cease to be a problem.) + */ + #ifndef BUILDING_PCAP + #define pcap_dump_fopen(p,f) \ + pcap_dump_hopen(p, _get_osfhandle(_fileno(f))) + #endif +#else /*_WIN32*/ + PCAP_API pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp); +#endif /*_WIN32*/ +PCAP_API pcap_dumper_t *pcap_dump_open_append(pcap_t *, const char *); +PCAP_API FILE *pcap_dump_file(pcap_dumper_t *); +PCAP_API long pcap_dump_ftell(pcap_dumper_t *); +PCAP_API int64_t pcap_dump_ftell64(pcap_dumper_t *); +PCAP_API int pcap_dump_flush(pcap_dumper_t *); +PCAP_API void pcap_dump_close(pcap_dumper_t *); +PCAP_API void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *); + +PCAP_API int pcap_findalldevs(pcap_if_t **, char *); +PCAP_API void pcap_freealldevs(pcap_if_t *); + +/* + * We return a pointer to the version string, rather than exporting the + * version string directly. + * + * On at least some UNIXes, if you import data from a shared library into + * an program, the data is bound into the program binary, so if the string + * in the version of the library with which the program was linked isn't + * the same as the string in the version of the library with which the + * program is being run, various undesirable things may happen (warnings, + * the string being the one from the version of the library with which the + * program was linked, or even weirder things, such as the string being the + * one from the library but being truncated). + * + * On Windows, the string is constructed at run time. + */ +PCAP_API const char *pcap_lib_version(void); + +/* + * On at least some versions of NetBSD and QNX, we don't want to declare + * bpf_filter() here, as it's also be declared in , with a + * different signature, but, on other BSD-flavored UN*Xes, it's not + * declared in , so we *do* want to declare it here, so it's + * declared when we build pcap-bpf.c. + */ +#if !defined(__NetBSD__) && !defined(__QNX__) + PCAP_API u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int); +#endif +PCAP_API int bpf_validate(const struct bpf_insn *f, int len); +PCAP_API char *bpf_image(const struct bpf_insn *, int); +PCAP_API void bpf_dump(const struct bpf_program *, int); + +#if defined(_WIN32) + + /* + * Win32 definitions + */ + + /*! + \brief A queue of raw packets that will be sent to the network with pcap_sendqueue_transmit(). + */ + struct pcap_send_queue + { + u_int maxlen; /* Maximum size of the queue, in bytes. This + variable contains the size of the buffer field. */ + u_int len; /* Current size of the queue, in bytes. */ + char *buffer; /* Buffer containing the packets to be sent. */ + }; + + typedef struct pcap_send_queue pcap_send_queue; + + /*! + \brief This typedef is a support for the pcap_get_airpcap_handle() function + */ + #if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_) + #define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ + typedef struct _AirpcapHandle *PAirpcapHandle; + #endif + + PCAP_API int pcap_setbuff(pcap_t *p, int dim); + PCAP_API int pcap_setmode(pcap_t *p, int mode); + PCAP_API int pcap_setmintocopy(pcap_t *p, int size); + + PCAP_API HANDLE pcap_getevent(pcap_t *p); + + PCAP_API int pcap_oid_get_request(pcap_t *, bpf_u_int32, void *, size_t *); + PCAP_API int pcap_oid_set_request(pcap_t *, bpf_u_int32, const void *, size_t *); + + PCAP_API pcap_send_queue* pcap_sendqueue_alloc(u_int memsize); + + PCAP_API void pcap_sendqueue_destroy(pcap_send_queue* queue); + + PCAP_API int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data); + + PCAP_API u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync); + + PCAP_API struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size); + + PCAP_API int pcap_setuserbuffer(pcap_t *p, int size); + + PCAP_API int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks); + + PCAP_API int pcap_live_dump_ended(pcap_t *p, int sync); + + PCAP_API int pcap_start_oem(char* err_str, int flags); + + PCAP_API PAirpcapHandle pcap_get_airpcap_handle(pcap_t *p); + + #define MODE_CAPT 0 + #define MODE_STAT 1 + #define MODE_MON 2 + +#elif defined(MSDOS) + + /* + * MS-DOS definitions + */ + + PCAP_API int pcap_stats_ex (pcap_t *, struct pcap_stat_ex *); + PCAP_API void pcap_set_wait (pcap_t *p, void (*yield)(void), int wait); + PCAP_API u_long pcap_mac_packets (void); + +#else /* UN*X */ + + /* + * UN*X definitions + */ + + PCAP_API int pcap_get_selectable_fd(pcap_t *); + PCAP_API struct timeval *pcap_get_required_select_timeout(pcap_t *); + +#endif /* _WIN32/MSDOS/UN*X */ + +/* + * Remote capture definitions. + * + * These routines are only present if libpcap has been configured to + * include remote capture support. + */ + +/* + * The maximum buffer size in which address, port, interface names are kept. + * + * In case the adapter name or such is larger than this value, it is truncated. + * This is not used by the user; however it must be aware that an hostname / interface + * name longer than this value will be truncated. + */ +#define PCAP_BUF_SIZE 1024 + +/* + * The type of input source, passed to pcap_open(). + */ +#define PCAP_SRC_FILE 2 /* local savefile */ +#define PCAP_SRC_IFLOCAL 3 /* local network interface */ +#define PCAP_SRC_IFREMOTE 4 /* interface on a remote host, using RPCAP */ + +/* + * The formats allowed by pcap_open() are the following: + * - file://path_and_filename [opens a local file] + * - rpcap://devicename [opens the selected device devices available on the local host, without using the RPCAP protocol] + * - rpcap://host/devicename [opens the selected device available on a remote host] + * - rpcap://host:port/devicename [opens the selected device available on a remote host, using a non-standard port for RPCAP] + * - adaptername [to open a local adapter; kept for compability, but it is strongly discouraged] + * - (NULL) [to open the first local adapter; kept for compability, but it is strongly discouraged] + * + * The formats allowed by the pcap_findalldevs_ex() are the following: + * - file://folder/ [lists all the files in the given folder] + * - rpcap:// [lists all local adapters] + * - rpcap://host:port/ [lists the devices available on a remote host] + * + * Referring to the 'host' and 'port' parameters, they can be either numeric or literal. Since + * IPv6 is fully supported, these are the allowed formats: + * + * - host (literal): e.g. host.foo.bar + * - host (numeric IPv4): e.g. 10.11.12.13 + * - host (numeric IPv4, IPv6 style): e.g. [10.11.12.13] + * - host (numeric IPv6): e.g. [1:2:3::4] + * - port: can be either numeric (e.g. '80') or literal (e.g. 'http') + * + * Here you find some allowed examples: + * - rpcap://host.foo.bar/devicename [everything literal, no port number] + * - rpcap://host.foo.bar:1234/devicename [everything literal, with port number] + * - rpcap://10.11.12.13/devicename [IPv4 numeric, no port number] + * - rpcap://10.11.12.13:1234/devicename [IPv4 numeric, with port number] + * - rpcap://[10.11.12.13]:1234/devicename [IPv4 numeric with IPv6 format, with port number] + * - rpcap://[1:2:3::4]/devicename [IPv6 numeric, no port number] + * - rpcap://[1:2:3::4]:1234/devicename [IPv6 numeric, with port number] + * - rpcap://[1:2:3::4]:http/devicename [IPv6 numeric, with literal port number] + */ + +/* + * URL schemes for capture source. + */ +/* + * This string indicates that the user wants to open a capture from a + * local file. + */ +#define PCAP_SRC_FILE_STRING "file://" +/* + * This string indicates that the user wants to open a capture from a + * network interface. This string does not necessarily involve the use + * of the RPCAP protocol. If the interface required resides on the local + * host, the RPCAP protocol is not involved and the local functions are used. + */ +#define PCAP_SRC_IF_STRING "rpcap://" + +/* + * Flags to pass to pcap_open(). + */ + +/* + * Specifies whether promiscuous mode is to be used. + */ +#define PCAP_OPENFLAG_PROMISCUOUS 0x00000001 + +/* + * Specifies, for an RPCAP capture, whether the data transfer (in + * case of a remote capture) has to be done with UDP protocol. + * + * If it is '1' if you want a UDP data connection, '0' if you want + * a TCP data connection; control connection is always TCP-based. + * A UDP connection is much lighter, but it does not guarantee that all + * the captured packets arrive to the client workstation. Moreover, + * it could be harmful in case of network congestion. + * This flag is meaningless if the source is not a remote interface. + * In that case, it is simply ignored. + */ +#define PCAP_OPENFLAG_DATATX_UDP 0x00000002 + +/* + * Specifies wheether the remote probe will capture its own generated + * traffic. + * + * In case the remote probe uses the same interface to capture traffic + * and to send data back to the caller, the captured traffic includes + * the RPCAP traffic as well. If this flag is turned on, the RPCAP + * traffic is excluded from the capture, so that the trace returned + * back to the collector is does not include this traffic. + * + * Has no effect on local interfaces or savefiles. + */ +#define PCAP_OPENFLAG_NOCAPTURE_RPCAP 0x00000004 + +/* + * Specifies whether the local adapter will capture its own generated traffic. + * + * This flag tells the underlying capture driver to drop the packets + * that were sent by itself. This is useful when building applications + * such as bridges that should ignore the traffic they just sent. + * + * Supported only on Windows. + */ +#define PCAP_OPENFLAG_NOCAPTURE_LOCAL 0x00000008 + +/* + * This flag configures the adapter for maximum responsiveness. + * + * In presence of a large value for nbytes, WinPcap waits for the arrival + * of several packets before copying the data to the user. This guarantees + * a low number of system calls, i.e. lower processor usage, i.e. better + * performance, which is good for applications like sniffers. If the user + * sets the PCAP_OPENFLAG_MAX_RESPONSIVENESS flag, the capture driver will + * copy the packets as soon as the application is ready to receive them. + * This is suggested for real time applications (such as, for example, + * a bridge) that need the best responsiveness. + * + * The equivalent with pcap_create()/pcap_activate() is "immediate mode". + */ +#define PCAP_OPENFLAG_MAX_RESPONSIVENESS 0x00000010 + +/* + * Remote authentication methods. + * These are used in the 'type' member of the pcap_rmtauth structure. + */ + +/* + * NULL authentication. + * + * The 'NULL' authentication has to be equal to 'zero', so that old + * applications can just put every field of struct pcap_rmtauth to zero, + * and it does work. + */ +#define RPCAP_RMTAUTH_NULL 0 +/* + * Username/password authentication. + * + * With this type of authentication, the RPCAP protocol will use the username/ + * password provided to authenticate the user on the remote machine. If the + * authentication is successful (and the user has the right to open network + * devices) the RPCAP connection will continue; otherwise it will be dropped. + * + * *******NOTE********: the username and password are sent over the network + * to the capture server *IN CLEAR TEXT*. Don't use this on a network + * that you don't completely control! (And be *really* careful in your + * definition of "completely"!) + */ +#define RPCAP_RMTAUTH_PWD 1 + +/* + * This structure keeps the information needed to autheticate the user + * on a remote machine. + * + * The remote machine can either grant or refuse the access according + * to the information provided. + * In case the NULL authentication is required, both 'username' and + * 'password' can be NULL pointers. + * + * This structure is meaningless if the source is not a remote interface; + * in that case, the functions which requires such a structure can accept + * a NULL pointer as well. + */ +struct pcap_rmtauth +{ + /* + * \brief Type of the authentication required. + * + * In order to provide maximum flexibility, we can support different types + * of authentication based on the value of this 'type' variable. The currently + * supported authentication methods are defined into the + * \link remote_auth_methods Remote Authentication Methods Section\endlink. + */ + int type; + /* + * \brief Zero-terminated string containing the username that has to be + * used on the remote machine for authentication. + * + * This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication + * and it can be NULL. + */ + char *username; + /* + * \brief Zero-terminated string containing the password that has to be + * used on the remote machine for authentication. + * + * This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication + * and it can be NULL. + */ + char *password; +}; + +/* + * This routine can open a savefile, a local device, or a device on + * a remote machine running an RPCAP server. + * + * For opening a savefile, the pcap_open_offline routines can be used, + * and will work just as well; code using them will work on more + * platforms than code using pcap_open() to open savefiles. + * + * For opening a local device, pcap_open_live() can be used; it supports + * most of the capabilities that pcap_open() supports, and code using it + * will work on more platforms than code using pcap_open(). pcap_create() + * and pcap_activate() can also be used; they support all capabilities + * that pcap_open() supports, except for the Windows-only + * PCAP_OPENFLAG_NOCAPTURE_LOCAL, and support additional capabilities. + * + * For opening a remote capture, pcap_open() is currently the only + * API available. + */ +PCAP_API pcap_t *pcap_open(const char *source, int snaplen, int flags, + int read_timeout, struct pcap_rmtauth *auth, char *errbuf); +PCAP_API int pcap_createsrcstr(char *source, int type, const char *host, + const char *port, const char *name, char *errbuf); +PCAP_API int pcap_parsesrcstr(const char *source, int *type, char *host, + char *port, char *name, char *errbuf); + +/* + * This routine can scan a directory for savefiles, list local capture + * devices, or list capture devices on a remote machine running an RPCAP + * server. + * + * For scanning for savefiles, it can be used on both UN*X systems and + * Windows systems; for each directory entry it sees, it tries to open + * the file as a savefile using pcap_open_offline(), and only includes + * it in the list of files if the open succeeds, so it filters out + * files for which the user doesn't have read permission, as well as + * files that aren't valid savefiles readable by libpcap. + * + * For listing local capture devices, it's just a wrapper around + * pcap_findalldevs(); code using pcap_findalldevs() will work on more + * platforms than code using pcap_findalldevs_ex(). + * + * For listing remote capture devices, pcap_findalldevs_ex() is currently + * the only API available. + */ +PCAP_API int pcap_findalldevs_ex(const char *source, + struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf); + +/* + * Sampling methods. + * + * These allow pcap_loop(), pcap_dispatch(), pcap_next(), and pcap_next_ex() + * to see only a sample of packets, rather than all packets. + * + * Currently, they work only on Windows local captures. + */ + +/* + * Specifies that no sampling is to be done on the current capture. + * + * In this case, no sampling algorithms are applied to the current capture. + */ +#define PCAP_SAMP_NOSAMP 0 + +/* + * Specifies that only 1 out of N packets must be returned to the user. + * + * In this case, the 'value' field of the 'pcap_samp' structure indicates the + * number of packets (minus 1) that must be discarded before one packet got + * accepted. + * In other words, if 'value = 10', the first packet is returned to the + * caller, while the following 9 are discarded. + */ +#define PCAP_SAMP_1_EVERY_N 1 + +/* + * Specifies that we have to return 1 packet every N milliseconds. + * + * In this case, the 'value' field of the 'pcap_samp' structure indicates + * the 'waiting time' in milliseconds before one packet got accepted. + * In other words, if 'value = 10', the first packet is returned to the + * caller; the next returned one will be the first packet that arrives + * when 10ms have elapsed. + */ +#define PCAP_SAMP_FIRST_AFTER_N_MS 2 + +/* + * This structure defines the information related to sampling. + * + * In case the sampling is requested, the capturing device should read + * only a subset of the packets coming from the source. The returned packets + * depend on the sampling parameters. + * + * WARNING: The sampling process is applied *after* the filtering process. + * In other words, packets are filtered first, then the sampling process + * selects a subset of the 'filtered' packets and it returns them to the + * caller. + */ +struct pcap_samp +{ + /* + * Method used for sampling; see above. + */ + int method; + + /* + * This value depends on the sampling method defined. + * For its meaning, see above. + */ + int value; +}; + +/* + * New functions. + */ +PCAP_API struct pcap_samp *pcap_setsampling(pcap_t *p); + +/* + * RPCAP active mode. + */ + +/* Maximum length of an host name (needed for the RPCAP active mode) */ +#define RPCAP_HOSTLIST_SIZE 1024 + +PCAP_API SOCKET pcap_remoteact_accept(const char *address, const char *port, + const char *hostlist, char *connectinghost, + struct pcap_rmtauth *auth, char *errbuf); +PCAP_API int pcap_remoteact_list(char *hostlist, char sep, int size, + char *errbuf); +PCAP_API int pcap_remoteact_close(const char *host, char *errbuf); +PCAP_API void pcap_remoteact_cleanup(void); + +#ifdef __cplusplus +} +#endif + +#endif /* lib_pcap_pcap_h */ diff --git a/network/start/lib/npcap/Include/pcap/sll.h b/network/start/lib/npcap/Include/pcap/sll.h new file mode 100644 index 0000000..b7cfdba --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/sll.h @@ -0,0 +1,149 @@ +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +/* + * For captures on Linux cooked sockets, we construct a fake header + * that includes: + * + * a 2-byte "packet type" which is one of: + * + * LINUX_SLL_HOST packet was sent to us + * LINUX_SLL_BROADCAST packet was broadcast + * LINUX_SLL_MULTICAST packet was multicast + * LINUX_SLL_OTHERHOST packet was sent to somebody else + * LINUX_SLL_OUTGOING packet was sent *by* us; + * + * a 2-byte Ethernet protocol field; + * + * a 2-byte link-layer type; + * + * a 2-byte link-layer address length; + * + * an 8-byte source link-layer address, whose actual length is + * specified by the previous value. + * + * All fields except for the link-layer address are in network byte order. + * + * DO NOT change the layout of this structure, or change any of the + * LINUX_SLL_ values below. If you must change the link-layer header + * for a "cooked" Linux capture, introduce a new DLT_ type (ask + * "tcpdump-workers@lists.tcpdump.org" for one, so that you don't give it + * a value that collides with a value already being used), and use the + * new header in captures of that type, so that programs that can + * handle DLT_LINUX_SLL captures will continue to handle them correctly + * without any change, and so that capture files with different headers + * can be told apart and programs that read them can dissect the + * packets in them. + */ + +#ifndef lib_pcap_sll_h +#define lib_pcap_sll_h + +#include + +/* + * A DLT_LINUX_SLL fake link-layer header. + */ +#define SLL_HDR_LEN 16 /* total header length */ +#define SLL_ADDRLEN 8 /* length of address field */ + +struct sll_header { + uint16_t sll_pkttype; /* packet type */ + uint16_t sll_hatype; /* link-layer address type */ + uint16_t sll_halen; /* link-layer address length */ + uint8_t sll_addr[SLL_ADDRLEN]; /* link-layer address */ + uint16_t sll_protocol; /* protocol */ +}; + +/* + * A DLT_LINUX_SLL2 fake link-layer header. + */ +#define SLL2_HDR_LEN 20 /* total header length */ + +struct sll2_header { + uint16_t sll2_protocol; /* protocol */ + uint16_t sll2_reserved_mbz; /* reserved - must be zero */ + uint32_t sll2_if_index; /* 1-based interface index */ + uint16_t sll2_hatype; /* link-layer address type */ + uint8_t sll2_pkttype; /* packet type */ + uint8_t sll2_halen; /* link-layer address length */ + uint8_t sll2_addr[SLL_ADDRLEN]; /* link-layer address */ +}; + +/* + * The LINUX_SLL_ values for "sll_pkttype" and LINUX_SLL2_ values for + * "sll2_pkttype"; these correspond to the PACKET_ values on Linux, + * which are defined by a header under include/uapi in the current + * kernel source, and are thus not going to change on Linux. We + * define them here so that they're available even on systems other + * than Linux. + */ +#define LINUX_SLL_HOST 0 +#define LINUX_SLL_BROADCAST 1 +#define LINUX_SLL_MULTICAST 2 +#define LINUX_SLL_OTHERHOST 3 +#define LINUX_SLL_OUTGOING 4 + +/* + * The LINUX_SLL_ values for "sll_protocol" and LINUX_SLL2_ values for + * "sll2_protocol"; these correspond to the ETH_P_ values on Linux, but + * are defined here so that they're available even on systems other than + * Linux. We assume, for now, that the ETH_P_ values won't change in + * Linux; if they do, then: + * + * if we don't translate them in "pcap-linux.c", capture files + * won't necessarily be readable if captured on a system that + * defines ETH_P_ values that don't match these values; + * + * if we do translate them in "pcap-linux.c", that makes life + * unpleasant for the BPF code generator, as the values you test + * for in the kernel aren't the values that you test for when + * reading a capture file, so the fixup code run on BPF programs + * handed to the kernel ends up having to do more work. + * + * Add other values here as necessary, for handling packet types that + * might show up on non-Ethernet, non-802.x networks. (Not all the ones + * in the Linux "if_ether.h" will, I suspect, actually show up in + * captures.) + */ +#define LINUX_SLL_P_802_3 0x0001 /* Novell 802.3 frames without 802.2 LLC header */ +#define LINUX_SLL_P_802_2 0x0004 /* 802.2 frames (not D/I/X Ethernet) */ +#define LINUX_SLL_P_CAN 0x000C /* CAN frames, with SocketCAN pseudo-headers */ +#define LINUX_SLL_P_CANFD 0x000D /* CAN FD frames, with SocketCAN pseudo-headers */ + +#endif diff --git a/network/start/lib/npcap/Include/pcap/socket.h b/network/start/lib/npcap/Include/pcap/socket.h new file mode 100644 index 0000000..e8bf79a --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/socket.h @@ -0,0 +1,93 @@ +/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ +/* + * Copyright (c) 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +#ifndef lib_pcap_socket_h +#define lib_pcap_socket_h + +/* + * Some minor differences between sockets on various platforms. + * We include whatever sockets are needed for Internet-protocol + * socket access on UN*X and Windows. + */ +#ifdef _WIN32 + /* Need windef.h for defines used in winsock2.h under MingW32 */ + #ifdef __MINGW32__ + #include + #endif + #include + #include + + /* + * Winsock doesn't have this UN*X type; it's used in the UN*X + * sockets API. + * + * XXX - do we need to worry about UN*Xes so old that *they* + * don't have it, either? + */ + typedef int socklen_t; + + /* + * Winsock doesn't have this POSIX type; it's used for the + * tv_usec value of struct timeval. + */ + typedef long suseconds_t; +#else /* _WIN32 */ + #include + #include + #include /* for struct addrinfo/getaddrinfo() */ + #include /* for sockaddr_in, in BSD at least */ + #include + + /*! + * \brief In Winsock, a socket handle is of type SOCKET; in UN*X, it's + * a file descriptor, and therefore a signed integer. + * We define SOCKET to be a signed integer on UN*X, so that it can + * be used on both platforms. + */ + #ifndef SOCKET + #define SOCKET int + #endif + + /*! + * \brief In Winsock, the error return if socket() fails is INVALID_SOCKET; + * in UN*X, it's -1. + * We define INVALID_SOCKET to be -1 on UN*X, so that it can be used on + * both platforms. + */ + #ifndef INVALID_SOCKET + #define INVALID_SOCKET -1 + #endif +#endif /* _WIN32 */ + +#endif /* lib_pcap_socket_h */ diff --git a/network/start/lib/npcap/Include/pcap/usb.h b/network/start/lib/npcap/Include/pcap/usb.h new file mode 100644 index 0000000..61370e6 --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/usb.h @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2006 Paolo Abeni (Italy) + * 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. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER 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. + * + * Basic USB data struct + * By Paolo Abeni + */ + +#ifndef lib_pcap_usb_h +#define lib_pcap_usb_h + +#include + +/* + * possible transfer mode + */ +#define URB_TRANSFER_IN 0x80 +#define URB_ISOCHRONOUS 0x0 +#define URB_INTERRUPT 0x1 +#define URB_CONTROL 0x2 +#define URB_BULK 0x3 + +/* + * possible event type + */ +#define URB_SUBMIT 'S' +#define URB_COMPLETE 'C' +#define URB_ERROR 'E' + +/* + * USB setup header as defined in USB specification. + * Appears at the front of each Control S-type packet in DLT_USB captures. + */ +typedef struct _usb_setup { + uint8_t bmRequestType; + uint8_t bRequest; + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; +} pcap_usb_setup; + +/* + * Information from the URB for Isochronous transfers. + */ +typedef struct _iso_rec { + int32_t error_count; + int32_t numdesc; +} iso_rec; + +/* + * Header prepended by linux kernel to each event. + * Appears at the front of each packet in DLT_USB_LINUX captures. + */ +typedef struct _usb_header { + uint64_t id; + uint8_t event_type; + uint8_t transfer_type; + uint8_t endpoint_number; + uint8_t device_address; + uint16_t bus_id; + char setup_flag;/*if !=0 the urb setup header is not present*/ + char data_flag; /*if !=0 no urb data is present*/ + int64_t ts_sec; + int32_t ts_usec; + int32_t status; + uint32_t urb_len; + uint32_t data_len; /* amount of urb data really present in this event*/ + pcap_usb_setup setup; +} pcap_usb_header; + +/* + * Header prepended by linux kernel to each event for the 2.6.31 + * and later kernels; for the 2.6.21 through 2.6.30 kernels, the + * "iso_rec" information, and the fields starting with "interval" + * are zeroed-out padding fields. + * + * Appears at the front of each packet in DLT_USB_LINUX_MMAPPED captures. + */ +typedef struct _usb_header_mmapped { + uint64_t id; + uint8_t event_type; + uint8_t transfer_type; + uint8_t endpoint_number; + uint8_t device_address; + uint16_t bus_id; + char setup_flag;/*if !=0 the urb setup header is not present*/ + char data_flag; /*if !=0 no urb data is present*/ + int64_t ts_sec; + int32_t ts_usec; + int32_t status; + uint32_t urb_len; + uint32_t data_len; /* amount of urb data really present in this event*/ + union { + pcap_usb_setup setup; + iso_rec iso; + } s; + int32_t interval; /* for Interrupt and Isochronous events */ + int32_t start_frame; /* for Isochronous events */ + uint32_t xfer_flags; /* copy of URB's transfer flags */ + uint32_t ndesc; /* number of isochronous descriptors */ +} pcap_usb_header_mmapped; + +/* + * Isochronous descriptors; for isochronous transfers there might be + * one or more of these at the beginning of the packet data. The + * number of descriptors is given by the "ndesc" field in the header; + * as indicated, in older kernels that don't put the descriptors at + * the beginning of the packet, that field is zeroed out, so that field + * can be trusted even in captures from older kernels. + */ +typedef struct _usb_isodesc { + int32_t status; + uint32_t offset; + uint32_t len; + uint8_t pad[4]; +} usb_isodesc; + +#endif diff --git a/network/start/lib/npcap/Include/pcap/vlan.h b/network/start/lib/npcap/Include/pcap/vlan.h new file mode 100644 index 0000000..47ffef0 --- /dev/null +++ b/network/start/lib/npcap/Include/pcap/vlan.h @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +#ifndef lib_pcap_vlan_h +#define lib_pcap_vlan_h + +#include + +struct vlan_tag { + uint16_t vlan_tpid; /* ETH_P_8021Q */ + uint16_t vlan_tci; /* VLAN TCI */ +}; + +#define VLAN_TAG_LEN 4 + +#endif diff --git a/network/start/lib/npcap/Lib/Packet.lib b/network/start/lib/npcap/Lib/Packet.lib new file mode 100644 index 0000000..f4d1ffe Binary files /dev/null and b/network/start/lib/npcap/Lib/Packet.lib differ diff --git a/network/start/lib/npcap/Lib/wpcap.lib b/network/start/lib/npcap/Lib/wpcap.lib new file mode 100644 index 0000000..24ff5d7 Binary files /dev/null and b/network/start/lib/npcap/Lib/wpcap.lib differ diff --git a/network/start/lib/npcap/Lib/x64/Packet.lib b/network/start/lib/npcap/Lib/x64/Packet.lib new file mode 100644 index 0000000..37e0538 Binary files /dev/null and b/network/start/lib/npcap/Lib/x64/Packet.lib differ diff --git a/network/start/lib/npcap/Lib/x64/wpcap.lib b/network/start/lib/npcap/Lib/x64/wpcap.lib new file mode 100644 index 0000000..a9f9239 Binary files /dev/null and b/network/start/lib/npcap/Lib/x64/wpcap.lib differ diff --git a/network/start/lib/npcap/Npcap_Guide.html b/network/start/lib/npcap/Npcap_Guide.html new file mode 100644 index 0000000..a75d525 --- /dev/null +++ b/network/start/lib/npcap/Npcap_Guide.html @@ -0,0 +1,16 @@ + + + + + + Npcap Guide + + + +

The Npcap Guide is located in the "docs" directory. + You can also find the latest version of the Guide on Npcap.org. +

+ + diff --git a/network/start/lib/npcap/docs/index.html b/network/start/lib/npcap/docs/index.html new file mode 100644 index 0000000..bc5deed --- /dev/null +++ b/network/start/lib/npcap/docs/index.html @@ -0,0 +1,253 @@ +Npcap: Nmap Project's packet sniffing library for Windows

Npcap: Nmap Project's packet sniffing library for Windows

Abstract

+

A guide to Npcap, a packet capture and network analysis framework for Windows, for users and software developers. Npcap is a modern, safe, and compatible update to WinPcap.

+

+ + + +

Introduction

+ + +

This Manual describes the programming interface and the source code of + Npcap. It provides detailed descriptions of the functions and structures + exported to programmers, along with complete documentation of the Npcap + internals. Several tutorials and examples are provided as well.

+ +

What is Npcap?

+ + +

Npcap is an architecture for packet capture and network analysis for + Windows operating systems, consisting of a software library and a network + driver.

+ +

Most networking applications access the network through widely-used + operating system primitives such as sockets. It is easy to access data on + the network with this approach since the operating system copes with the + low level details (protocol handling, packet reassembly, etc.) and + provides a familiar interface that is similar to the one used to read and + write files.

+ +

Sometimes, however, the easy way is not up to the task, + since some applications require direct access to packets on the network. + That is, they need access to the raw data on the network + without the interposition of protocol processing by the operating + system.

+ +

The purpose of Npcap is to give this kind of access to Windows + applications. It provides facilities to:

+ +
  • capture raw packets, both the ones destined to the machine where + it's running and the ones exchanged by other hosts (on shared media)
  • filter the packets according to user-specified rules before + dispatching them to the application
  • transmit raw packets to the network
  • gather statistical information on the network traffic
+ +

This set of capabilities is obtained by means of a device driver, + which is installed inside the networking portion of the Windows kernel, + plus a couple of DLLs.

+ +

All of these features are exported through a powerful programming + interface, easily usable by applications. The main goal of this manual is + to document this interface, with the help of several examples.

+ +

What kind of programs use Npcap?

+ + +

The Npcap programming interface can be used by many types of + network tools for analysis, troubleshooting, security and monitoring. + In particular, classical tools that rely on Npcap are:

+ +
  • network and protocol analyzers
  • network monitors
  • traffic loggers
  • traffic generators
  • user-level bridges and routers
  • network intrusion detection systems (NIDS)
  • network scanners
  • security tools
+
+ +

What Npcap can't do

+ + +

Npcap receives and sends the packets independently from the host + protocols, like TCP/IP. This means that it isn't able to block, filter or + manipulate the traffic generated by other programs on the same machine: it + simply sniffs the packets that transit on the wire. Therefore, it does not + provide the appropriate support for applications like traffic shapers, QoS + schedulers and personal firewalls.

+
+ +
+ +

Npcap and WinPcap

+ + +

Npcap is an update of WinPcap + to the NDIS 6 Light-Weight Filter (LWF) API. + It supports Windows 7, 8, 8.1, and 10. It is developed + by the Nmap Project + as a continuation of the project started by Yang Luo + under Google Summer of Code 2013 and + 2015. + It also received many helpful tests from Wireshark + and NetScanTools. +

+ +

Feature comparison with WinPcap

+ + +

Npcap carries on the WinPcap legacy, but is not without its own + innovations. Here are some of the most exciting improvements and new + features that Npcap adds:

+ +
  • NDIS 6 Support: Npcap makes use of the new NDIS Lightweight Filter driver introduced in + NDIS 6.0. This driver type is faster and has less overhead + than the legacy NDIS 5 Intermediate Driver + type used by WinPcap. +

  • Latest libpcap API Support: Npcap provides support + for the latest libpcap API + by accepting libpcap as a Git submodule. + The latest libpcap 1.8 has integrated more fascinating features and functions than the + deprecated libpcap 1.0.0 shipped by WinPcap. + Moreover, since Linux already has a good support for latest libpcap API, using + Npcap on Windows facilitates your software to base on the same API on both Windows and Linux.

  • Admin-only Mode Support: Npcap supports to restrict its + use to Administrators for safety purpose. If Npcap is installed with + the option Restrict Npcap driver's access to Administrators only checked, + when a non-Admin user tries to start a user software (Nmap, Wireshark, etc), + the User Account Control (UAC) + dialog will prompt asking for Administrator privilege. Only when the end + user chooses Yes, the driver can be accessed. This is similar to UNIX + where you need root access to capture packets.

  • Loopback Packet Capture: Npcap is able to + see Windows loopback packets using the + + Windows Filtering Platform (WFP). Npcap supplies an + interface named NPF_Loopback, with the description Adapter for loopback capture. + If you are a Wireshark user, choose this adapter + to capture, you will see all loopback traffic the same way as other + non-loopback adapters. Try it by typing in commands like ping 127.0.0.1 + (IPv4) or ping ::1 (IPv6).

  • Loopback Packet Injection: Besides loopback packet + capturing, Npcap can also send out loopback packets using the + Winsock Kernel (WSK) + technique. A user software (e.g. Nmap) can just send packets + on the NPF_Loopback device using + pcap_inject() or + PacketSendPacket just like on a standard + interface. Npcap + will automatically remove the packet's DLT_NULL header and + inject the payload into Windows TCP/IP stack.

  • Raw 802.11 Packets Capture Support: Npcap is able to see + 802.11 packets instead of fake Ethernet packets on ordinary wireless + adapters. You need to select the Support raw 802.11 traffic (and monitor + mode) for wireless adapters option in the installation wizard to enable + this feature. When your adapter is in Monitor Mode, Npcap will supply all + 802.11 data + control + management packets with radiotap headers. When + your adapter is in Managed Mode, Npcap will only supply Ethernet + packets. Npcap directly supports to use Wireshark to capture in Monitor Mode. + Meantime, Npcap also provides the WlanHelper.exe + tool to help you switch to Monitor Mode on your own. See more details + about this feature in section + For software that uses Npcap raw 802.11 feature. + See more details about radiotap here: + http://www.radiotap.org/

  • WinPcap API-compatible Mode + Support: WinPcap API-compatible Mode makes Npcap a + strict WinPcap replacement by using the same DLL location and service name as + WinPcap. This is useful for testing or migrating from software that only uses + WinPcap, but because Npcap is masquerading as WinPcap, software will not be + able to be aware of and use Npcap's newer features. It's notable that before + installing in this mode, any existing WinPcap installation will be + uninstalled and replaced. +

+
+
+ +

Purpose of this manual

+ + +

The purpose of this manual is to provide a comprehensive and easy way + to browse the documentation of the Npcap architecture. You will find + three main sections: the section called “Npcap Users' Guide”, + the section called “Developing software with Npcap”, + and the section called “Npcap internals”.

+ +

the section called “Npcap Users' Guide” is for end users of Npcap, and + primarily concerns installation options, hardware compatibility, and bug + reporting procedures.

+ +

the section called “Developing software with Npcap” is for programmers who need to use + Npcap from an application: it contains information about functions and + data structures exported by the Npcap API, a manual for writing packet + filters, and information on how to include it in an application. A + tutorial with several code samples is provided as well; it can be used to + learn the basics of the Npcap API using a step-by-step approach, but it + also offers code snippets that demonstrate advanced features.

+ +

the section called “Npcap internals” is intended for Npcap developers + and maintainers, or for people who are curious about how this system + works: it provides a general description of the Npcap architecture and + explains how it works. Additionally, it documents the complete device + driver structure, the source code, the Packet.dll interface and the + low-level Npcap API. If you want to understand what happens inside Npcap + or if you need to extend it, this is the section you will want to + read.

+
+ +

Terminology

+ + +

We call Npcap an architecture rather than + library because packet capture is a low level + mechanism that requires a strict interaction with the network adapter and + with the operating system, in particular with its networking + implementation, so a simple library is not sufficient.

+ +

For consistency with the literature, we will use the term + packet even though + frame is more accurate since the capture process + is done at the data-link layer and the data-link header is included in + the captured data.

+ +
+ +

Npcap License

+ + +

Even though Npcap source code is publicly available for review, it is + not open source software and may not be redistributed without special + permission from the Nmap Project. The + Npcap License + allows end users to download, install, and use Npcap from our site for + free. Software providers (open source or otherwise) which want to use + Npcap functionality are welcome to point their users to npcap.org for + those users to download and install.

+

We fund the Npcap project by selling licenses to companies who wish + to redistribute Npcap within their products. The + Npcap OEM edition allows + companies to silently and seamlessly install Npcap during their product's + installation rather than asking users to download and install Npcap + themselves. The Npcap OEM commercial license also includes support, + updates and indemnification. This is similar to the commercial licenses + we offer for embedding Nmap in + commercial software. More details are available from the Npcap OEM page.

+
+ +

Obtaining Npcap

+ + +

The latest Npcap release can always be found + on the Npcap + website as an executable installer and as a source code + archive.

+
+ +

Acknowledgements and copyright

+ + +

Portions of this guide were adapted from the WinPcap documentation. + Copyright 2002-2005 Politecnico di Torino. Copyright + 2005-2010 CACE Technologies. Copyright 2010-2013 Riverbed + Technology. Copyright 2020 Insecure.Com, LLC. All rights + reserved.

+
+
+ + + + + + + + + + + +
diff --git a/network/start/lib/npcap/docs/npcap-devguide.html b/network/start/lib/npcap/docs/npcap-devguide.html new file mode 100644 index 0000000..3f77c39 --- /dev/null +++ b/network/start/lib/npcap/docs/npcap-devguide.html @@ -0,0 +1,705 @@ +Developing software with Npcap

Developing software with Npcap

Abstract

+

Writing software that captures or injects network traffic is easy + with Npcap. This guide describes the Npcap SDK, WinPcap compatibility, + and the Npcap API.

+
+ + + +

Using the Npcap SDK

+ + +

+ To build software that uses Npcap, use the latest version of the Npcap Software Development Kit (SDK). + The latest SDK can be downloaded on Npcap.org. + Updates to the SDK are much less frequent than updates to the Npcap binaries. +

+
+ +

Examples

+ + +

+ Examples of applications using Npcap are available in the Examples directory in the source distribution. + Several of these examples are explored in more depth in the the section called “Npcap Development Tutorial”. +

+ +

+ Npcap developer Yang Luo has also provided an example: + UserBridge, + which is a tool to redirect all packets from one interface to another. +

+
+ +

Updating WinPcap software to Npcap

+ +

+ For the most part, Npcap is completely compatible with software written + for WinPcap. Minor changes need to be made to the section called “DLL loading” and in some + cases the section called “Service name”. However, there have been many improvements to the libpcap + API between the last release of WinPcap and the current release of Npcap. + Reviewing the changes may help improve performance, reliability, and + maintainability of software that uses Npcap. +

+ +

Apart from the libpcap API, WinPcap exported a few functions used by + WinDump that were + related to porting a Unix-style tool to Windows but unrelated to packet + capture. Those functions were not documented in the WinPcap + documentation, have never been included in libpcap, and are therefore not + in the Npcap API: getservent, endservent, and + eproto_db.

+ +

One other function exported by WinPcap, wsockinit, is + available via the Npcap API as pcap_wsockinit. It calls + WSAStartup for Windows Sockets version 1.1 and ensures that + WSACleanup is called when the process ends.

+ +
+ +

How to detect what version Npcap/WinPcap you are using?

+ + +

+ Sometimes, our user software needs to detect the existence of Npcap/WinPcap + at install-time or run-time. Although Npcap's GUI installer has the ability + to handle this, you may want to handle it by yourself in some conditions, + like you run Npcap installer in silent-mode. The run-time detection is even + more useful. Your software probably has some functions that rely on Npcap's + particular features (like loopback capture). You need to know if you + are running on top of Npcap or the legacy WinPcap to control whether to + switch your functions on. Fortunately, Npcap provides you some methods to + detect Npcap/WinPcap at install-time and run-time. +

+ +

Npcap version

+ + +

Npcap has a version number that is independent of WinPcap. The last + release of WinPcap was version 4.1.3, but Npcap started over counting + versions from 0.00. In order to make it clear to the installers and other + software that Npcap is newer and more advanced, the executable + file version was advanced to 5.0.0.000 at + that point. The major version will always be 5 to + distinguish Npcap from WinPcap. The minor version is Npcap's major + version; the revision is Npcap's minor version; and the build number is + an encoding of the build date. So a file version of + 5.0.92.612 is Npcap 0.92, built on June 12th.

+
+ +

Install-time detection

+ + +

+ You can check the existence of C:\Program Files\Npcap\NPFInstall.exe to + detect Npcap's existence. If Npcap exists, you can check the file version of + C:\Program Files\Npcap\NPFInstall.exe to detect Npcap e-version. The + e-version also gives you the version. The NSIS code is shown below. $inst_ver + is an e-version string like 5.0.7.424 +

+
+        GetDllVersion "C:\Program Files\Npcap\NPFInstall.exe" $R0 $R1
+        IntOp $R2 $R0 / 0x00010000
+        IntOp $R3 $R0 & 0x0000FFFF
+        IntOp $R4 $R1 / 0x00010000
+        IntOp $R5 $R1 & 0x0000FFFF
+        StrCpy $inst_ver "$R2.$R3.$R4.$R5"
+      
+ +

+ You can check the installation options of an already installed Npcap by reading the registry + key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\npcap\Parameters. + The entries like AdminOnly, + LoopbackSupport, DltNull,Dot11Support, + VlanSupport, WinPcapCompatible, etc. + are REG_DWORD type. A 0x00000001 value + indicates the installation option is CHECKED. +

+

Note: Prior to Npcap 0.93, these values were stored in the + Services\npcap key directly.

+
+ +

Run-time detection

+ + +

+ Npcap and WinPcap can be installed together on a system. Which capture + library is used by the user software relies on the DLL loading path. If + Npcap's wpcap.dll is loaded first, then you are using + Npcap, vice versa. However, it's difficult and fragile to check the DLL + loading path by yourself. Fortunately, you can use + pcap_lib_version to get the Npcap/WinPcap version + string. +

+ +
+        char *pcap_version = pcap_lib_version();
+        printf("%s", pcap_version);
+        // Npcap output: "Npcap version 0.92, based on libpcap version 1.8.1"
+        // WinPcap output: "WinPcap version 4.1.3"
+      
+ +

Npcap requires the npcap service to be running. If + installed in WinPcap Compatible Mode, the + npf service can be started instead. Given that + npcap service is always installed + in both modes, a good practice is just trying the npcap service first. + If it fails, then try the npf service. This is also what most of our users + do in their software based on our investigation. A code sample from Nmap is + here. +

+
+
+ +

For software that want to use Npcap first when Npcap and WinPcap coexist

+ + +

+ Prerequisite: Uncheck the Install Npcap in WinPcap API-compatible Mode option at + install-time (which is by default). +

+ +

DLL loading

+ + +

Npcap installs its DLLs into C:\Windows\System32\Npcap\ + instead of WinPcap's C:\Windows\System32\. Because of how Windows' + DLL search path works, + your application will use WinPcap first by default when Npcap and WinPcap coexist, + as C:\Windows\System32\ is prior to C:\Windows\System32\Npcap\. + So when Npcap and WinPcap coexist, an application that want to use Npcap instead + of WinPcap must make C:\Windows\System32\Npcap\ precedent to the + C:\Windows\System32\ in the DLL search path. Here are two ways + to modify this search path to make your application load Npcap's DLLs first, + based on how your application links Npcap/WinPcap's library + (wpcap.dll).

+ +
If the application implicitly links wpcap.dll
+ + +

Implicit linking means that either you specified wpcap.lib + in your Project Properties -> Configuration Properties + -> Linker -> Input -> Additional Dependencies in Visual Studio, + or specified #pragma comment(linker, "wpcap.lib") in your code.

+ +

You need to do the following two steps:

+ +
  • Specify wpcap.dll as a delay-loaded DLL: In + Visual Studio, open the Project Properties window. Go to: + Configuration Properties -> Linker -> Input + -> Delay Loaded Dlls. Enter wpcap.dll + in that option.

  • Before calling any wpcap.dll functions, + call SetDllDirectory to add C:\Windows\System32\Npcap\ + to DLL search path.

+ + +

Here + is an example called WinDump, a simple packet capture tool using Npcap/WinPcap. + And this commit + makes it able to use Npcap first when Npcap and WinPcap coexist.

+
+ +
If the application explicitly links wpcap.dll
+ + +

Explicit linking means that you explicitly called LoadLibrary + to load wpcap.dll and called GetProcAddress to get the + function pointers.

+ +

You need to do the following one step:

+ +
  • Before calling LoadLibrary to load wpcap.dll, + call SetDllDirectory to add C:\Windows\System32\Npcap\ + to DLL search path.

+ +

The function init_npcap_dll_path is provided in the following example: + WinDump

+
+
+ +

Service name

+ + +

Because Npcap is a NDIS 6 LWF filter driver it is designed to run + at system boot, so software will generally not need to start it, + unlike WinPcap which was often installed in a demand-start + configuration.

+ +

Npcap uses service name npcap instead of WinPcap's npf with + WinPcap Compatible Mode OFF. So applications using + net start npf for starting service must change to this: + run net start npcap first, if it fails, then try + net start npf.

+
+
+ +

For software that uses Npcap loopback feature

+ + +

+ Npcap 0.9983 and newer support loopback traffic capture and injection without requiring a particular installation option. +

+ +

+ Npcap's loopback adapter device is reported by + pcap_findalldevs() as + \Device\NPF_Loopback. This name is always available even + if Legacy loopback support was chosen at install time, + which puts the name of the legacy loopback adapter in the + LoopbackAdapter REG_SZ value of the + HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\npcap\Parameters. + Registry key. +

+ +

+ Traffic captured and injected on the loopback adapter uses the + DLT_NULL data link type, which consists of a 4-byte + header in host byte order that is either 2 for IPv4 packets or 24 for + IPv6 packets. +

+ +

+ The MTU of Npcap Loopback Adapter is hard-coded to 65536 by Npcap. Software + using Npcap should get this value automatically and no special handling is needed. This value is + arbitrary and does not imply a limitation on the Windows loopback stack, + so it may be possible to capture packets with a size larger than the adapter's MTU. +

+ +

+ Don't try to make OID requests to Npcap Loopback Adapter except + OID_GEN_MAXIMUM_TOTAL_SIZE (MTU). Those requests will still succeed like + other adapters do, but they only make sense for NDIS adapters and Npcap doesn't even use the + NDIS way to handle the loopback traffic. The only handled OID request by Npcap is + OID_GEN_MAXIMUM_TOTAL_SIZE. If you query its value, you will always get + 65550 (65536 + 14). If you try to set its value, the operation will always fail. +

+ +

If you use IP Helper API to get adapter list, you will get an interface named + like Loopback Pseudo-Interface 1. This interface is a DUMMY interface by Microsoft + and can't be seen in NDIS layer. And it also takes the 127.0.0.1/::1 IP address. A good practice + for software is replacing the AdapterName of the + Loopback Pseudo-Interface 1 entry with + NPF_Loopback, as Nmap does in its enhancements to + libdnet.

+ +

Legacy loopback support installs a copy of the + Microsft KM-TEST loopback adapter named Npcap Loopback + Adapter for software that expects to find the loopback adapter + via ordinary Windows API calls. The features and operation are no + different from standard loopback support, but the + name of the adapter will be written to the + LoopbackAdapter Registry value. +

+ +
+ +

For software that uses Npcap raw 802.11 feature

+ + +

+ Prerequisite: Check the Support raw 802.11 traffic (and monitor mode) for wireless adapters option at install-time. +

+ +

Steps

+ +
  • Install the latest version Npcap with the + Support raw 802.11 traffic (and monitor mode) for wireless + adapters option checked in the installation wizard. With this + option checked, Npcap will see packets with Radiotap + + 802.11 headers for wireless adapters. Otherwise, Npcap will + see packets with fake Ethernet headers for wireless + adapters.

  • Run WlanHelper.exe with + Administrator privilege. If you use + -i, follow the interactive prompts to choose your + wireless adapter and select Network Monitor mode. + WlanHelper.exe also supports parameters to be used + in an API manner, run WlanHelper.exe -h for + details.

  • Use the Npcap API from your user software as usual. For + example, launch Wireshark and capture on the wireless adapter, viewingall + 802.11 packets (data + control + management). +

  • If you need to return to Managed Mode, run + WlanHelper.exe again, following the prompts or + selecting the appropriate command-line options to switch off the + Monitor Mode.

+
+ +

Tips

+ +
  • You can use WlanHelper.exe tool to + switch on the Monitor Mode in order to see + 802.11 control and management packets. You + can also use the pcap_set_rfmon function within your + code, as Wireshark does. +

  • Switching on the Monitor Mode will + disconnect your wireless network from the AP, you can switch back to + Managed Mode using the same + WlanHelper.exe tool.

  • The WlanHelper.exe tool is + installed to %SYSTEMROOT%\System32\Npcap after installing Npcap.

+
+ +

Terminology

+ +

+ Managed Mode (for Linux) = Extensible Station Mode (aka ExtSTA, for Windows) +

+ +

+ Monitor Mode (for Linux) = Network Monitor Mode (aka NetMon, for Windows) +

+ +

+ Master Mode (for Linux) = Extensible Access Point (aka ExtAP, for Windows) +

+
+ +

WlanHelper

+ +

+ WlanHelper is used to set/get the operation mode (like Monitor + Mode) for a wireless adapter on Windows. WlanHelper tries to + follow the grammar of iwconfig, a wireless + management tool for Linux. So if you rename + WlanHelper.exe to iwconfig.exe, + your command lines for WlanHelper will be exactly the same with the + iwconfig tool. + +

+ +
WlanHelper's Usage
+ +

+ Note: WlanHelper must run under Administrator privilege. +

+ +
Interactive way
+ +

+ Run WlanHelper with the -i option. +

+
+ +
Command-line API way
+ + +
  • Run netsh wlan show interfaces, get the Name or GUID for the interface.

  • Run WlanHelper -h to see the man page.

+

Example1.WlanHelper Man

+ +
+              C:\> WlanHelper.exe
+              WlanHelper for Npcap 0.91 ( http://npcap.org )
+              Usage: WlanHelper [Commands]
+              or: WlanHelper {Interface Name or GUID} [Options]
+
+              OPTIONS:
+              mode                  : Get interface operation mode
+              mode <managed|monitor|master|..>  : Set interface operation mode
+              modes                 : Get all operation modes supported by the interface, comma-separated
+              channel               : Get interface channel
+              channel <1-14>            : Set interface channel (only works in monitor mode)
+              freq                  : Get interface frequency
+              freq <VALUE>              : Set interface frequency (only works in monitor mode)
+              modu                  : Get interface modulation
+              modu <dsss|fhss|irbaseband|ofdm|hrdsss|erp|ht|vht|ihv (VALUE)|..> : Set interface modulation
+              modus                 : Get all modulations supported by the interface, comma-separated
+
+              COMMANDS:
+              -i                    : Enter the interactive mode
+              -h                    : Print this help summary page
+
+              OPERATION MODES:
+              managed   : The Extensible Station (ExtSTA) operation mode
+              monitor   : The Network Monitor (NetMon) operation mode
+              master    : The Extensible Access Point (ExtAP) operation mode (supported from Windows 7 and later)
+              wfd_device    : The Wi-Fi Direct Device operation mode (supported from Windows 8 and later)
+              wfd_owner : The Wi-Fi Direct Group Owner operation mode (supported from Windows 8 and later)
+              wfd_client    : The Wi-Fi Direct Client operation mode (supported from Windows 8 and later)
+
+              802.11 MODULATIONS (https://en.wikipedia.org/wiki/IEEE_802.11):
+              802.11-1997   : dsss, fhss
+              802.11a   : ofdm
+              802.11b   : dsss
+              802.11g   : ofdm
+              802.11n   : mimo-ofdm
+              802.11ac  : mimo-ofdm
+
+              EXAMPLES:
+              WlanHelper Wi-Fi mode
+              WlanHelper 42dfd47a-2764-43ac-b58e-3df569c447da channel 11
+              WlanHelper 42dfd47a-2764-43ac-b58e-3df569c447da freq 2
+              WlanHelper "Wireless Network Connection" mode monitor
+
+              SEE THE MAN PAGE (https://github.com/nmap/npcap) FOR MORE OPTIONS AND EXAMPLES
+            
+

+

+ An example: +

+

Example2.WlanHelper API Usage

+ +
+              C:\> netsh wlan show interfaces
+
+              There is 1 interface on the system:
+
+              Name                   : Wi-Fi
+              Description            : Qualcomm Atheros AR9485WB-EG Wireless Network Adapter
+              GUID                   : 42dfd47a-2764-43ac-b58e-3df569c447da
+              Physical address       : a4:db:30:d9:3a:9a
+              State                  : connected
+              SSID                   : LUO-PC_Network
+              BSSID                  : d8:15:0d:72:8c:18
+              Network type           : Infrastructure
+              Radio type             : 802.11n
+              Authentication         : WPA2-Personal
+              Cipher                 : CCMP
+              Connection mode        : Auto Connect
+              Channel                : 1
+              Receive rate (Mbps)    : 150
+              Transmit rate (Mbps)   : 150
+              Signal                 : 100%
+              Profile                : LUO-PC_Network
+
+              Hosted network status  : Not available
+
+              C:\> WlanHelper.exe wi-fi mode
+              managed
+              C:\> WlanHelper.exe wi-fi mode monitor
+              Success
+              C:\> WlanHelper.exe wi-fi mode 
+              monitor
+              C:\> WlanHelper.exe wi-fi mode managed
+              Success
+              C:\> WlanHelper.exe wi-fi mode
+              managed
+            
+

+
+
+
+ +
+ +

The Npcap API

+ +

The Npcap API is exported by wpcap.dll and is the + Windows port of libpcap. + The API and functions are described in + the pcap(1) man page. +

+

Extensions to libpcap for Windows

+ +

+ There are a few extensions to libpcap that exist only on Windows. + Software that uses these extensions will not be portable to non-Windows + systems. The following is a brief list of these extensions and their purpose. +

+
+ pcap_setbuff +
+

+ Sets the size of the kernel buffer associated with an adapter. +

+ int pcap_setbuff(pcap_t *p, int dim); +

dim specifies the size of the buffer in + bytes. The return value is 0 when the call succeeds, -1 otherwise. + If an old buffer was already created with a previous call to + pcap_setbuff(), it is deleted and its content is + discarded. pcap_open_live() creates + a 1 MByte buffer by default. +

+

+ Portability note: libpcap provides the pcap_set_buffer_size() + function for setting the kernel buffer size. This removes the need + to use the non-portable pcap_setbuff() for this + purpose. +

+
+ pcap_setmode +
+

Sets the working mode of the interface.

+ int pcap_setmode(pcap_t *p, int mode); +

+ Valid values for mode are MODE_CAPT (default + capture mode) and MODE_STAT (statistical mode). + See the section called “Gathering Statistics on the network traffic” for details about + statistical mode. +

+
+ pcap_setmintocopy +
+

+ Sets the minumum amount of data received by the kernel in a single call. +

+ int pcap_setmintocopy(pcap_t *p, int size); + +

+ This function changes the minimum amount of data in the + kernel buffer that causes a read from the application to return + (unless the timeout expires). If the value of + size is large, the kernel is forced to wait the + arrival of several packets before + copying the data to the user. This guarantees a low number of + system calls, i.e. low processor usage, and is a good setting for + applications like packet-sniffers and protocol analyzers. Vice + versa, in presence of a small value for this variable, the kernel + will copy the packets as soon as the application is ready to + receive them. This is useful for real time applications that need + the best responsiveness from the kernel. pcap_open_live() sets a + default size value of 16000 bytes. +

+

+ Portability note: libpcap provides the pcap_set_immediate_mode() + function for applications that need to receive packets as soon as + they arrive. This removes the need to use the non-portable + pcap_setmintocopy() for this purpose. +

+
+ pcap_getevent +
+

Returns the handle of the event associated with the interface.

+ HANDLE pcap_getevent(pcap_t *p); + +

This event can be passed to functions like + WaitForSingleObject() or + WaitForMultipleObjects() to wait until the + driver's buffer contains some data without performing a read. +

+ +

+ Portability note: This function is the Windows + alternative to pcap_get_selectable_fd(), + which is only available on UNIX-like systems. Most applications + will not need an event loop that waits on multiple packet capture + handles. +

+
+ pcap_oid_get_request and pcap_oid_set_request +
+

Send an OID request to the underlying NDIS drivers

+ int pcap_oid_get_request(pcap_t *, bpf_u_int32, void *, size_t *); + int pcap_oid_set_request(pcap_t *, bpf_u_int32, const void *, size_t *); +
+ Queuing sent packets with pcap_send_queue +
+

+ Npcap has the ability to queue multiple raw packets for + transmission on the network in a single call. This is more + efficient than issuing a series of + pcap_sendpacket(), because the packets are + buffered in the kernel driver, so the number of context switches is + reduced. +

+ pcap_send_queue* pcap_sendqueue_alloc(u_int memsize); + void pcap_sendqueue_destroy(pcap_send_queue* queue); +

Allocate a send queue as a buffer of memsize + bytes. The pcap_send_queue allocated can be + freed with pcap_sendqueue_destroy().

+ int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data); +

+ pcap_sendqueue_queue() adds a packet at the end + of the send queue pointed by the queue + parameter. pkt_header points to a + pcap_pkthdr structure with the timestamp and the + length of the packet, pkt_data points to a + buffer with the data of the packet. +

+ +

+ The pcap_pkthdr structure is the same used by + Npcap and libpcap to store the packets in a file, therefore sending + a capture file is straightforward. 'Raw packet' means that the + sending application will have to include the protocol headers, + since every packet is sent to the network 'as is'. The CRC of the + packets needs not to be calculated, because it will be + transparently added by the network interface. +

+ u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync); +

+ This function transmits the content of a queue to the wire. + p is a pointer to the adapter on which the + packets will be sent, queue points to a + pcap_send_queue structure containing the packets + to send), sync determines if the send operation + must be synchronized: if it is non-zero, the packets are sent + respecting the timestamps, otherwise they are sent as fast as + possible. +

+ +

+ The return value is the amount of bytes actually sent. If it is + smaller than the size parameter, an error + occurred during the send. The error can be caused by a + driver/adapter problem or by an inconsistent/bogus send queue. +

+ +

+ Performance note: When sync + is set to TRUE, the packets are synchronized in + the kernel with a high precision timestamp. This requires a + non-negligible amount of CPU, but allows normally to send the + packets with a precision of some microseconds (depending on the + accuracy of the performance counter of the machine). Such a + precision cannot be reached sending the packets with + pcap_sendpacket(). +

+
+ pcap_stats_ex +
+ struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size); +

+ pcap_stats_ex() extends the + pcap_stats() allowing to return more statistical + parameters than the old call. One of the advantages of + this new call is that the pcap_stat structure is + not allocated by the user; instead, it is returned back by the + system. This allow to extend the pcap_stat + structure without affecting backward compatibility on older + applications. These will simply check at the values of the members + at the beginning of the structure, while only newest applications + are able to read new statistical values, which are appended in + tail. +

+ +

+ To be sure not to read a piece of memory which has not been allocated + by the system, the variable pcap_stat_size will + return back the size of the structure pcap_stat + allocated by the system. +

+ +

+ p: pointer to the pcap_t + currently in use. pcap_stat_size: pointer to an + integer that will contain (when the function returns back) the size + of the structure pcap_stat as it has been + allocated by the system. +

+ +

+ The function returns a pointer to a pcap_stat structure, that will + contain the statistics related to the current device. The return + value is NULL in case of errors, and the error + text can be obtained with pcap_perror() or + pcap_geterr(). +

+
+ pcap_setuserbuffer +
+

Sets the size of the buffer that accepts packets from the kernel driver.

+ int pcap_setuserbuffer(pcap_t *p, int size); + +

+ The size of the packet buffer is a parameter that can sensibly + influence the performance of the capture process, since this buffer + will contain the packets received from the the Npcap driver. The + driver is able to return several packets using a single read call, + and the number of packets transferable to the application in a call + is limited only by the size of this buffer. Therefore setting a + larger buffer siz can noticeably decrease the number of system + calls, reducing the impact of the capture process on the processor. +

+
+
+
+ +
diff --git a/network/start/lib/npcap/docs/npcap-internals.html b/network/start/lib/npcap/docs/npcap-internals.html new file mode 100644 index 0000000..096e304 --- /dev/null +++ b/network/start/lib/npcap/docs/npcap-internals.html @@ -0,0 +1,305 @@ +Npcap internals

Npcap internals

Abstract

+

Describes the internal structure and interfaces of Npcap: the NPF + driver and Packet.dll

+
+ + +

This portion of the manual describes the internal structure and + interfaces of Npcap, starting from the lowest-level module. It is targeted + at people who must extend or modify this software, or to the ones + interested in how it works. Therefore, developers who just want to use + Npcap in their software don't need to read it.

+ +

Npcap structure

+ + +

Npcap is an architecture for packet capture and network analysis for the + Win32 platforms. It includes a kernel-level packet filter, a + low-level dynamic link library (packet.dll), and a high-level and + system-independent library (wpcap.dll).

+ +

Why do we use the term architecture rather + than library? Because packet capture is a low + level mechanism that requires a strict interaction with the network + adapter and with the operating system, in particular with its networking + implementation, so a simple library is not sufficient.

+ + +

Main components of Npcap.

+ + +

First, a capture system needs to bypass the operating systems's + protocol stack in order to access the raw data transiting on the + network. This requires a portion running inside the kernel of OS, + interacting directly with the network interface drivers. This portion + is very system dependent, and in our solution it is realized as a + device driver, called Netgroup Packet Filter (NPF); This driver offers + basic features like packet capture and injection, as well as more + advanced ones like a programmable filtering system and a monitoring + engine. The filtering system can be used to restrict a capture session + to a subset of the network traffic (e.g. it is possible to capture only + the ftp traffic generated by a particular host); the monitoring engine + provides a powerful but simple to use mechanism to obtain statistics on + the traffic (e.g. it is possible to obtain the network load or the + amount of data exchanged between two hosts).

+ +

Second, the capture system must export an interface that user-level + applications will use to take advantage of the features provided by the + kernel driver. Npcap provides two different libraries: + packet.dll and + wpcap.dll.

+ +

Packet.dll offers a low-level API that can be used to directly + access the functions of the driver, with a programming interface + independent from the Microsoft OS.

+ + +

Wpcap.dll exports a more powerful set of high level capture + primitives that are compatible with libpcap, the well known Unix + capture library. These functions enable packet capture in a manner that + is independent of the underlying network hardware and operating + system.

+
+
+ +

Npcap driver internals

+ + +

This section documents the internals of the Netgroup Packet Filter + (NPF), the kernel portion of Npcap. Normal users are probably interested + in how to use Npcap and not in its internal structure. Therefore the + information present in this module is destined mainly to Npcap developers + and maintainers, or to the people interested in how the driver works. In + particular, a good knowledge of OSes, networking and Windows kernel + programming and device drivers development is required to profitably read + this section.

+ +

NPF is the Npcap component that does the hard work, processing the + packets that transit on the network and exporting capture, injection and + analysis capabilities to user-level.

+ +

The following paragraphs will describe the interaction of NPF with + the OS and its basic structure.

+ +

NPF and NDIS

+ + +

NDIS (Network Driver Interface Specification) is a standard that + defines the communication between a network adapter (or, better, the + driver that manages it) and the protocol drivers (that implement for + example TCP/IP). Main NDIS purpose is to act as a wrapper that allows + protocol drivers to send and receive packets onto a network (LAN or + WAN) without caring either the particular adapter or the particular + Win32 operating system.

+ +

NDIS supports four types of network drivers:

+ +
  1. +

    Miniport drivers. Miniport drivers + directly manage network interface cards, referred to as NICs. The + miniport drivers interface directly to the hardware at their lower + edge and at their upper edge present an interface to allow upper + layers to send packets on the network, to handle interrupts, to + reset the NIC, to halt the NIC and to query and set the operational + characteristics of the driver.

    +

    Miniport drivers implement only the hardware-specific + operations necessary to manage a NIC, including sending and + receiving data on the NIC. Operations common to all lowest level + NIC drivers, such as synchronization, is provided by NDIS. + Miniports do not call operating system routines directly; their + interface to the operating system is NDIS.

    +

    A miniport does not keep track of bindings. It merely passes + packets up to NDIS and NDIS makes sure that these packets are + passed to the correct protocols.

    +
  2. +

    Intermediate drivers. Intermediate drivers + interface between an upper-level driver such as a protocol driver + and a miniport. To the upper-level driver, an intermediate driver + looks like a miniport. To a miniport, the intermediate driver looks + like a protocol driver. An intermediate protocol driver can layer + on top of another intermediate driver although such layering could + have a negative effect on system performance. A typical reason for + developing an intermediate driver is to perform media translation + between an existing legacy protocol driver and a miniport that + manages a NIC for a new media type unknown to the protocol driver. + For instance, an intermediate driver could translate from LAN + protocol to ATM protocol. An intermediate driver cannot communicate + with user-mode applications, but only with other NDIS drivers.

    +
  3. +

    Filter drivers. Filter drivers can monitor + and modify traffic between protocol drivers and miniport drivers + like an intermediate driver, but are much simpler. They have less + processing overhead than intermediate drivers.

    +
  4. +

    Transport drivers or protocol drivers. A + protocol driver implements a network protocol stack such as IPX/SPX + or TCP/IP, offering its services over one or more network interface + cards. A protocol driver services application-layer clients at its + upper edge and connects to one or more NIC driver(s) or + intermediate NDIS driver(s) at its lower edge.

    +
+ +

NPF is implemented as a filter driver. In order to provide complete + access to the raw traffic and allow injection of packets, it is + registered as a modifying filter driver in the compression + FilterClass.

+ +

Notice that the various Windows operating systems have different + versions of NDIS: NPF is NDIS 6.0 compliant, and so requires a Windows + OS that supports NDIS 6.0: Windows Vista or later.

+ + + +
+

NPF structure basics

+ + + + +

NPF is able to perform a number of different operations: capture, + monitoring, dump to disk, packet injection. The following paragraphs + will describe shortly each of these operations.

+
Packet Capture
+ + +

The most important operation of NPF is packet capture. During a + capture, the driver sniffs the packets using a network interface and + delivers them intact to the user-level applications.

+

The capture process relies on two main components:

+
  • A packet filter that decides if an incoming packet + has to be accepted and copied to the listening application. Most + applications using NPF reject far more packets than those + accepted, therefore a versatile and efficient packet filter is + critical for good over-all performance. A packet filter is a + function with boolean output that is applied to a packet. If the + value of the function is true the capture driver copies the + packet to the application; if it is false the packet is + discarded. NPF packet filter is a bit more complex, because it + determines not only if the packet should be kept, but also the + amount of bytes to keep. The filtering system adopted by NPF + derives from the BSD Packet Filter (BPF), a + virtual processor able to execute filtering programs expressed in + a pseudo-assembler and created at user level. The application + takes a user-defined filter (e.g. pick up all UDP + packets) and, using wpcap.dll, compiles them into a BPF + program (e.g. if the packet is IP and the + protocol type field is equal to 17, then + return true). Then, the application uses the + BIOCSETF IOCTL to inject the filter in the + kernel. At this point, the program is executed for every incoming + packet, and only the conformant packets are accepted. Unlike + traditional solutions, NPF does not + interpret the filters, but it + executes them. For performance reasons, + before using the filter NPF feeds it to a JIT compiler that + translates it into a native 80x86 function. When a packet is + captured, NPF calls this native function instead of invoking the + filter interpreter, and this makes the process very fast. The + concept behind this optimization is very similar to the one of + Java jitters.

    +
  • +

    A circular buffer to store the packets and avoid loss. A + packet is stored in the buffer with a header that maintains + information like the timestamp and the size of the packet. + Moreover, an alignment padding is inserted between the packets in + order to speed-up the access to their data by the applications. + Groups of packets can be copied with a single operation from the + NPF buffer to the applications. This improves performances + because it minimizes the number of reads. If the buffer is full + when a new packet arrives, the packet is discarded and hence it's + lost. Both kernel and user buffer can be changed at runtime for + maximum versatility: packet.dll and wpcap.dll provide functions + for this purpose.

    +
+ +

The size of the user buffer is very important because it determines + the maximum amount of data that can be copied from + kernel space to user space within a single system call. On the other + hand, it can be noticed that also the minimum + amount of data that can be copied in a single call is extremely + important. In presence of a large value for this variable, the kernel + waits for the arrival of several packets before copying the data to the + user. This guarantees a low number of system calls, i.e. low processor + usage, which is a good setting for applications like sniffers. On the + other side, a small value means that the kernel will copy the packets + as soon as the application is ready to receive them. This is excellent + for real time applications (like, for example, ARP redirectors or + bridges) that need the better responsiveness from the kernel. From + this point of view, NPF has a configurable behavior, that allows users + to choose between best efficiency or best responsiveness (or any + intermediate situation).

+ +

The wpcap library includes a couple of system calls that can be + used both to set the timeout after which a read expires and the minimum + amount of data that can be transferred to the application. By default, + the read timeout is 1 second, and the minimum amount of data copied + between the kernel and the application is 16K.

+
+
Packet injection
+ + +

NPF allows to write raw packets to the network. To send data, a + user-level application performs a WriteFile() system call on the NPF + device file. The data is sent to the network as is, without + encapsulating it in any protocol, therefore the application will have + to build the various headers for each packet. The application usually + does not need to generate the FCS because it is calculated by the + network adapter hardware and it is attached automatically at the end of + a packet before sending it to the network.

+ +

In normal situations, the sending rate of the packets to the + network is not very high because of the need of a system call for each + packet. For this reason, the possibility to send a single packet more + than once with a single write system call has been added. The + user-level application can set, with an IOCTL call + (BIOCSWRITEREP), the number of times a single packet + will be repeated: for example, if this value is set to 1000, every raw + packet written by the application on the driver's device file will be + sent 1000 times. This feature can be used to generate high speed + traffic for testing purposes: the overload of context switches is no + longer present, so performance is remarkably better.

+
+ +
Network monitoring
+ + +

Npcap offers a kernel-level programmable monitoring module, able to + calculate simple statistics on the network traffic. Statistics can be + gathered without the need to copy the packets to the application, that + simply receives and displays the results obtained from the monitoring + engine. This allows to avoid great part of the capture overhead in + terms of memory and CPU clocks.

+ +

The monitoring engine is made of a classifier + followed by a counter. The packets are classified + using the filtering engine of NPF, that provides a configurable way to + select a subset of the traffic. The data that pass the filter go to the + counter, that keeps some variables like the number of packets and the + amount of bytes accepted by the filter and updates them with the data + of the incoming packets. These variables are passed to the user-level + application at regular intervals whose period can be configured by the + user. No buffers are allocated at kernel and user level.

+
+ + +
+
+

Further reading

+ +

The structure of NPF and its filtering engine derive directly from + the one of the BSD Packet Filter (BPF), so if you are interested the + subject you can read the following papers:

+
+
+ +
diff --git a/network/start/lib/npcap/docs/npcap-tutorial.html b/network/start/lib/npcap/docs/npcap-tutorial.html new file mode 100644 index 0000000..e2f5fa4 --- /dev/null +++ b/network/start/lib/npcap/docs/npcap-tutorial.html @@ -0,0 +1,1693 @@ +Npcap Development Tutorial

Npcap Development Tutorial

Abstract

+

A step-by-step guide to writing software that uses Npcap to list + network adapters, capture packets, and send network traffic.

+
+ + + +

This section shows how to use the features of the Npcap API. It is + organized as a tutorial, subdivided into a set of lessons that will + introduce the reader, in a step-by-step fashion, to program development + using Npcap, from the basic functions (obtaining the adapter list, + starting a capture, etc.) to the most advanced ones (handling send queues + and gathering statistics about network traffic).

+ + + +

The samples are written in plain C, so a basic knowledge of C + programming is required. Also, since this is a tutorial about a library + dealing with "raw" networking packets, good knowledge of networks and + network protocols is assumed.

+ +

The code in this section is copied from the the section called “Examples” in the source + distribution and the SDK. The code is released under a BSD-3-clause license and + copyright: NetGroup, Politecnico di Torino (Italy); CACE Technologies, + Davis (California); and Insecure.com, LLC. Full text of the code license + can be found in each source file.

+ +

Obtaining the device list

+ +

Typically, the first thing that a Npcap-based application does is + get a list of attached network adapters. Both libpcap and Npcap provide + the pcap_findalldevs_ex() function for this purpose: + this function returns a linked list of pcap_if structures, each of which contains + comprehensive information about an attached adapter. In particular, the + fields name and description contain the name and a + human readable description, respectively, of the corresponding + device.

+ +

The following code retrieves the adapter list and shows it on the + screen, printing an error if no adapters are found.

+ +
+#include "pcap.h"
+
+main()
+{
+	pcap_if_t *alldevs;
+	pcap_if_t *d;
+	int i=0;
+	char errbuf[PCAP_ERRBUF_SIZE];
+	
+	/* Retrieve the device list from the local machine */
+	if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL /* auth is not needed */, &alldevs, errbuf) == -1)
+	{
+		fprintf(stderr,"Error in pcap_findalldevs_ex: %s\n", errbuf);
+		exit(1);
+	}
+	
+	/* Print the list */
+	for(d= alldevs; d != NULL; d= d->next)
+	{
+		printf("%d. %s", ++i, d->name);
+		if (d->description)
+			printf(" (%s)\n", d->description);
+		else
+			printf(" (No description available)\n");
+	}
+	
+	if (i == 0)
+	{
+		printf("\nNo interfaces found! Make sure Npcap is installed.\n");
+		return;
+	}
+
+	/* We don't need any more the device list. Free it */
+	pcap_freealldevs(alldevs);
+}
+
+ +

Some comments about this code.

+ +

First of all, pcap_findalldevs_ex(), like + other libpcap functions, has an errbuf parameter. This + parameter points to a string filled by libpcap with a description of the + error if something goes wrong.

+ +

Second, remember that not all the OSes supported by libpcap provide a + description of the network interfaces, therefore if we want to write a + portable application, we must consider the case in which + description is null: we print the string "No + description available" in that situation.

+ +

Note finally that we free the list with pcap_freealldevs() once when + we have finished with it.

+ +

Assuming we have compiled the program, let's try to run it. On a + particular Windows workstation, the result we optained is

+ +
+      1. \Device\NPF_{4E273621-5161-46C8-895A-48D0E52A0B83} (Realtek RTL8029(AS) Ethernet Adapter)
+      2. \Device\NPF_{5D24AE04-C486-4A96-83FB-8B5EC6C7F430} (3Com EtherLink PCI) 
+    
+ +

As you can see, the name of the network adapters (that will be passed + to libpcap when opening the devices) under Windows are quite unreadable, + so the parenthetical descriptions can be very helpful.

+
+ +

Obtaining advanced information about installed devices

+ + +

Lesson 1 (the section called “Obtaining the device list”) demonstrated how + to get basic information (i.e. device name and description) about + available adapters. Actually, Npcap provides also other advanced + information. In particular, every pcap_if structure + returned by pcap_findalldevs_ex() + contains also a list of pcap_addr structures, + with:

+ +
  • a list of addresses for that interface.
  • a list of netmasks (each of which corresponds to an entry in + the addresses list).
  • a list of broadcast addresses (each of which corresponds to an + entry in the addresses list).
  • a list of destination addresses (each of which corresponds to + an entry in the addresses list).
+ +

Additionally, pcap_findalldevs_ex() can also + return remote adapters and a list of pcap files that are located in a + given local folder.

+ +

The following sample provides an ifprint() function that prints the + complete contents of a pcap_if structure. It is + invoked by the program for every entry returned by + pcap_findalldevs_ex().

+ +
+/* Print all the available information on the given interface */
+void ifprint(pcap_if_t *d)
+{
+  pcap_addr_t *a;
+  char ip6str[128];
+
+  /* Name */
+  printf("%s\n",d->name);
+
+  /* Description */
+  if (d->description)
+    printf("\tDescription: %s\n",d->description);
+
+  /* Loopback Address*/
+  printf("\tLoopback: %s\n",(d->flags & PCAP_IF_LOOPBACK)?"yes":"no");
+
+  /* IP addresses */
+  for(a=d->addresses;a;a=a->next) {
+    printf("\tAddress Family: #%d\n",a->addr->sa_family);
+  
+    switch(a->addr->sa_family)
+    {
+      case AF_INET:
+        printf("\tAddress Family Name: AF_INET\n");
+        if (a->addr)
+          printf("\tAddress: %s\n",iptos(((struct sockaddr_in *)a->addr)->sin_addr.s_addr));
+        if (a->netmask)
+          printf("\tNetmask: %s\n",iptos(((struct sockaddr_in *)a->netmask)->sin_addr.s_addr));
+        if (a->broadaddr)
+          printf("\tBroadcast Address: %s\n",iptos(((struct sockaddr_in *)a->broadaddr)->sin_addr.s_addr));
+        if (a->dstaddr)
+          printf("\tDestination Address: %s\n",iptos(((struct sockaddr_in *)a->dstaddr)->sin_addr.s_addr));
+        break;
+
+	  case AF_INET6:
+        printf("\tAddress Family Name: AF_INET6\n");
+        if (a->addr)
+          printf("\tAddress: %s\n", ip6tos(a->addr, ip6str, sizeof(ip6str)));
+       break;
+
+	  default:
+        printf("\tAddress Family Name: Unknown\n");
+        break;
+    }
+  }
+  printf("\n");
+}
+
+ +
+ +

Opening an adapter and capturing the packets

+ + +

Now that we've seen how to obtain an adapter to play with, let's + start the real job, opening an adapter and capturing some traffic. In + this lesson we'll write a program that prints some information about each + packet flowing through the adapter.

+ +

The function that opens a capture device is pcap_open(). The parameters, + snaplen, flags and + to_ms deserve some explanation.

+ +

snaplen specifies the portion of the packet to capture. On + some OSes (like xBSD and Win32), the packet driver can be configured to + capture only the initial part of any packet: this decreases the amount of + data to copy to the application and therefore improves the efficiency of + the capture. In this case we use the value 65536 which is higher than the + greatest MTU that we could encounter. In this manner we ensure that the + application will always receive the whole packet.

+ +

flags: the most important flag is the one that + indicates if the adapter will be put in promiscuous mode. In normal + operation, an adapter only captures packets from the network that are + destined to it; the packets exchanged by other hosts are therefore + ignored. Instead, when the adapter is in promiscuous mode it captures all + packets whether they are destined to it or not. This means that on shared + media (like non-switched Ethernet), Npcap will be able to capture the + packets of other hosts. Promiscuous mode is the default for most capture + applications, so we enable it in the following example.

+ +

to_ms specifies the read timeout, in milliseconds. + A read on the adapter (for example, with pcap_dispatch() or pcap_next_ex()) will always + return after to_ms milliseconds, even if no packets + are available from the network. to_ms also defines the + interval between statistical reports if the adapter is in statistical + mode (see the lesson "\ref wpcap_tut9" for information about statistical + mode). Setting to_ms to 0 means no timeout, a read on + the adapter never returns if no packets arrive. A -1 timeout on the other + side causes a read on the adapter to always return immediately.

+ +
+#include <pcap.h>
+#include "misc.h" /* LoadNpcapDlls */
+
+/* prototype of the packet handler */
+void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data);
+
+int main()
+{
+	pcap_if_t *alldevs;
+	pcap_if_t *d;
+	int inum;
+	int i=0;
+	pcap_t *adhandle;
+	char errbuf[PCAP_ERRBUF_SIZE];
+	
+	/* Load Npcap and its functions. */
+	if (!LoadNpcapDlls())
+	{
+		fprintf(stderr, "Couldn't load Npcap\n");
+		exit(1);
+	}
+
+	/* Retrieve the device list on the local machine */
+	if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1)
+	{
+		fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf);
+		exit(1);
+	}
+	
+	/* Print the list */
+	for(d=alldevs; d; d=d->next)
+	{
+		printf("%d. %s", ++i, d->name);
+		if (d->description)
+			printf(" (%s)\n", d->description);
+		else
+			printf(" (No description available)\n");
+	}
+	
+	if(i==0)
+	{
+		printf("\nNo interfaces found! Make sure Npcap is installed.\n");
+		return -1;
+	}
+	
+	printf("Enter the interface number (1-%d):",i);
+	scanf_s("%d", &inum);
+	
+	if(inum < 1 || inum > i)
+	{
+		printf("\nInterface number out of range.\n");
+		/* Free the device list */
+		pcap_freealldevs(alldevs);
+		return -1;
+	}
+	
+	/* Jump to the selected adapter */
+	for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++);
+	
+	/* Open the device */
+	if ( (adhandle= pcap_open(d->name,			// name of the device
+				  65536,			// portion of the packet to capture
+								// 65536 guarantees that the whole packet will be captured on all the link layers
+				  PCAP_OPENFLAG_PROMISCUOUS, 	// promiscuous mode
+				  1000,				// read timeout
+				  NULL,				// authentication on the remote machine
+				  errbuf			// error buffer
+				  ) ) == NULL)
+	{
+		fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->name);
+		/* Free the device list */
+		pcap_freealldevs(alldevs);
+		return -1;
+	}
+	
+	printf("\nlistening on %s...\n", d->description);
+	
+	/* At this point, we don't need any more the device list. Free it */
+	pcap_freealldevs(alldevs);
+	
+	/* start the capture */
+	pcap_loop(adhandle, 0, packet_handler, NULL);
+	
+	return 0;
+}
+
+
+/* Callback function invoked by libpcap for every incoming packet */
+void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)
+{
+	struct tm ltime;
+	char timestr[16];
+	time_t local_tv_sec;
+
+	/*
+	 * unused variables
+	 */
+	(VOID)(param);
+	(VOID)(pkt_data);
+
+	/* convert the timestamp to readable format */
+	local_tv_sec = header->ts.tv_sec;
+	localtime_s(&ltime, &local_tv_sec);
+	strftime( timestr, sizeof timestr, "%H:%M:%S", &ltime);
+	
+	printf("%s,%.6d len:%d\n", timestr, header->ts.tv_usec, header->len);
+}
+      
+ +

Once the adapter is opened, the capture can be started with pcap_dispatch() or pcap_loop(). These two functions are + very similar, the difference is that pcap_dispatch() + returns (although not guaranteed) when the timeout expires while + pcap_loop() doesn't return until + cnt packets have been captured, so it can block for an + arbitrary period on an under-utilized network. + pcap_loop() is enough for the purpose of this sample, + while pcap_dispatch() is normally used in a more + complex program.

+ +

Both of these functions have a callback parameter, + packet_handler, pointing to a function that will + receive the packets. This function is invoked by libpcap for every new + packet coming from the network and receives a generic status + (corresponding to the user parameter of pcap_loop() and pcap_dispatch()), a header with some + information on the packet like the timestamp and the length and the + actual data of the packet including all the protocol headers. Note that + the frame CRC is normally not present, because it is removed by the + network adapter after frame validation. Note also that most adapters + discard packets with wrong CRCs, therefore Npcap is normally not able + to capture them.

+ +

The above example extracts the timestamp and the length of every + packet from the pcap_pkthdr header and prints them on + the screen.

+ +

Please note that there may be a drawback using pcap_loop() mainly related to the + fact that the handler is called by the packet capture driver; therefore + the user application does not have direct control over it. Another + approach (and to have more readable programs) is to use the pcap_next_ex() function, which is + presented in the next example (the section called “Capturing the packets without the callback”).

+
+ +

Capturing the packets without the callback

+ + +

The example program in this lesson behaves exactly like the previous + program (the section called “Opening an adapter and capturing the packets”), but it uses + pcap_next_ex() instead of + pcap_loop().

+ +

The callback-based capture mechanism of pcap_loop() is elegant and it could + be a good choice in some situations. However, handling a callback is + sometimes not practical—it often makes the program more complex + especially in situations with multithreaded applications or C++ + classes.

+ +

In these cases, pcap_next_ex() retrievs a packet + with a direct call—using pcap_next_ex(), + packets are received only when the programmer wants them.

+ +

The parameters of this function are the same as a capture callback. + It takes an adapter descriptor and a couple of pointers that will be + initialized and returned to the user (one to a + pcap_pkthdr structure and another to a buffer with the + packet data).

+ +

In the following program, we recycle the callback code of the + previous lesson's example and move it inside main() right after the call + to pcap_next_ex().

+ +
+/* Open the device */
+if ( (adhandle= pcap_open(d->name,			// name of the device
+			65536,				// portion of the packet to capture. 
+							// 65536 guarantees that the whole packet will be captured on all the link layers
+			PCAP_OPENFLAG_PROMISCUOUS, 	// promiscuous mode
+			1000,				// read timeout
+			NULL,				// authentication on the remote machine
+			errbuf				// error buffer
+	) ) == NULL)
+{
+	fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->name);
+	/* Free the device list */
+	pcap_freealldevs(alldevs);
+	return -1;
+}
+
+printf("\nlistening on %s...\n", d->description);
+
+/* At this point, we don't need any more the device list. Free it */
+pcap_freealldevs(alldevs);
+
+/* Retrieve the packets */
+while((res = pcap_next_ex( adhandle, &header, &pkt_data)) >= 0){
+
+	if(res == 0)
+		/* Timeout elapsed */
+		continue;
+
+	/* convert the timestamp to readable format */
+	local_tv_sec = header->ts.tv_sec;
+	localtime_s(&ltime, &local_tv_sec);
+	strftime( timestr, sizeof timestr, "%H:%M:%S", &ltime);
+
+	printf("%s,%.6d len:%d\n", timestr, header->ts.tv_usec, header->len);
+}
+
+if(res == -1){
+	printf("Error reading the packets: %s\n", pcap_geterr(adhandle));
+	return -1;
+}
+      
+ +

Why do we use pcap_next_ex() instead of the old + pcap_next()? Because + pcap_next() has some drawbacks. First of all, it is + inefficient because it hides the callback method but still relies on + pcap_dispatch(). Second, it is not able to detect EOF, + so it's not very useful when gathering packets from a file.

+ +

Notice also that pcap_next_ex() returns different + values for success, timeout elapsed, error and EOF conditions.

+
+ +

Filtering the traffic

+ + +

One of the most powerful features offered by Npcap (and by libpcap as + well) is the filtering engine. It provides a very efficient way to + receive subsets of the network traffic, and is (usually) integrated with + the capture mechanism provided by Npcap. The functions used to filter + packets are pcap_compile() + and pcap_setfilter().

+ +

pcap_compile() takes a + string containing a high-level Boolean (filter) expression and produces a + low-level byte code that can be interpreted by the fileter engine in the + packet driver. The syntax of the boolean expression can be found in the + Filtering expression syntax + section of this documentation.

+ +

pcap_setfilter() + associates a filter with a capture session in the kernel driver. Once + pcap_setfilter() is called, the associated filter will + be applied to all the packets coming from the network, and all the + conformant packets (i.e., packets for which the Boolean expression + evaluates to true) will be actually copied to the application.

+ +

The following code shows how to compile and set a filter. Note that + we must retrieve the netmask from the pcap_if + structure that describes the adapter, because some filters created by + pcap_compile() require it.

+ +

The filter passed to pcap_compile() in this code + snippet is "ip and tcp", which means to "keep only the packets that are + both IPv4 and TCP and deliver them to the application".

+ + +
+	if (d->addresses != NULL)
+		/* Retrieve the mask of the first address of the interface */
+		netmask=((struct sockaddr_in *)(d->addresses->netmask))->sin_addr.S_un.S_addr;
+	else
+		/* If the interface is without an address we suppose to be in a C class network */
+		netmask=0xffffff; 
+
+
+	//compile the filter
+	if (pcap_compile(adhandle, &fcode, "ip and tcp", 1, netmask) < 0)
+	{
+		fprintf(stderr,"\nUnable to compile the packet filter. Check the syntax.\n");
+		/* Free the device list */
+		pcap_freealldevs(alldevs);
+		return -1;
+	}
+	
+	//set the filter
+	if (pcap_setfilter(adhandle, &fcode) < 0)
+	{
+		fprintf(stderr,"\nError setting the filter.\n");
+		/* Free the device list */
+		pcap_freealldevs(alldevs);
+		return -1;
+	}
+      
+ +

If you want to see some code that uses the filtering functions shown + in this lesson, look at the example presented in the next Lesson, the section called “Interpreting the packets”.

+ +
+ +

Interpreting the packets

+ + +

Now that we are able to capture and filter network traffic, we want + to put our knowledge to work with a simple "real world" + application.

+ +

In this lesson we will take code from the previous lessons and use + these pieces to build a more useful program. the main purpose of the + current program is to show how the protocol headers of a captured packet + can be parsed and interpreted. The resulting application, called UDPdump, + prints a summary of the UDP traffic on our network.

+ +

We have chosen to parse and display the UDP protocol because it is + more accessible than other protocols such as TCP and consequently is an + excellent initial example. Let's look at the code:

+ +
+#include <pcap.h>
+#include <Winsock2.h>
+#include <tchar.h>
+BOOL LoadNpcapDlls()
+{
+    _TCHAR npcap_dir[512];
+    UINT len;
+    len = GetSystemDirectory(npcap_dir, 480);
+    if (!len) {
+        fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError());
+        return FALSE;
+    }
+    _tcscat_s(npcap_dir, 512, _T("\\Npcap"));
+    if (SetDllDirectory(npcap_dir) == 0) {
+        fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError());
+        return FALSE;
+    }
+    return TRUE;
+}
+
+
+/* 4 bytes IP address */
+typedef struct ip_address{
+	u_char byte1;
+	u_char byte2;
+	u_char byte3;
+	u_char byte4;
+}ip_address;
+
+/* IPv4 header */
+typedef struct ip_header{
+	u_char	ver_ihl;		// Version (4 bits) + Internet header length (4 bits)
+	u_char	tos;			// Type of service 
+	u_short tlen;			// Total length 
+	u_short identification; // Identification
+	u_short flags_fo;		// Flags (3 bits) + Fragment offset (13 bits)
+	u_char	ttl;			// Time to live
+	u_char	proto;			// Protocol
+	u_short crc;			// Header checksum
+	ip_address	saddr;		// Source address
+	ip_address	daddr;		// Destination address
+	u_int	op_pad;			// Option + Padding
+}ip_header;
+
+/* UDP header*/
+typedef struct udp_header{
+	u_short sport;			// Source port
+	u_short dport;			// Destination port
+	u_short len;			// Datagram length
+	u_short crc;			// Checksum
+}udp_header;
+
+/* prototype of the packet handler */
+void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data);
+
+
+int main()
+{
+pcap_if_t *alldevs;
+pcap_if_t *d;
+int inum;
+int i=0;
+pcap_t *adhandle;
+char errbuf[PCAP_ERRBUF_SIZE];
+u_int netmask;
+char packet_filter[] = "ip and udp";
+struct bpf_program fcode;
+
+    /* Load Npcap and its functions. */
+    if (!LoadNpcapDlls())
+    {
+        fprintf(stderr, "Couldn't load Npcap\n");
+        exit(1);
+    }
+
+	/* Retrieve the device list */
+	if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1)
+	{
+		fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf);
+		exit(1);
+	}
+	
+	/* Print the list */
+	for(d=alldevs; d; d=d->next)
+	{
+		printf("%d. %s", ++i, d->name);
+		if (d->description)
+			printf(" (%s)\n", d->description);
+		else
+			printf(" (No description available)\n");
+	}
+
+	if(i==0)
+	{
+		printf("\nNo interfaces found! Make sure Npcap is installed.\n");
+		return -1;
+	}
+	
+	printf("Enter the interface number (1-%d):",i);
+	scanf_s("%d", &inum);
+	
+	if(inum < 1 || inum > i)
+	{
+		printf("\nInterface number out of range.\n");
+		/* Free the device list */
+		pcap_freealldevs(alldevs);
+		return -1;
+	}
+
+	/* Jump to the selected adapter */
+	for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++);
+	
+	/* Open the adapter */
+	if ( (adhandle= pcap_open(d->name,	// name of the device
+							 65536,		// portion of the packet to capture. 
+										// 65536 grants that the whole packet will be captured on all the MACs.
+							 PCAP_OPENFLAG_PROMISCUOUS,			// promiscuous mode
+							 1000,		// read timeout
+							 NULL,		// remote authentication
+							 errbuf		// error buffer
+							 ) ) == NULL)
+	{
+		fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->name);
+		/* Free the device list */
+		pcap_freealldevs(alldevs);
+		return -1;
+	}
+	
+	/* Check the link layer. We support only Ethernet for simplicity. */
+	if(pcap_datalink(adhandle) != DLT_EN10MB)
+	{
+		fprintf(stderr,"\nThis program works only on Ethernet networks.\n");
+		/* Free the device list */
+		pcap_freealldevs(alldevs);
+		return -1;
+	}
+	
+	if(d->addresses != NULL)
+		/* Retrieve the mask of the first address of the interface */
+		netmask=((struct sockaddr_in *)(d->addresses->netmask))->sin_addr.S_un.S_addr;
+	else
+		/* If the interface is without addresses we suppose to be in a C class network */
+		netmask=0xffffff; 
+
+
+	//compile the filter
+	if (pcap_compile(adhandle, &fcode, packet_filter, 1, netmask) <0 )
+	{
+		fprintf(stderr,"\nUnable to compile the packet filter. Check the syntax.\n");
+		/* Free the device list */
+		pcap_freealldevs(alldevs);
+		return -1;
+	}
+	
+	//set the filter
+	if (pcap_setfilter(adhandle, &fcode)<0)
+	{
+		fprintf(stderr,"\nError setting the filter.\n");
+		/* Free the device list */
+		pcap_freealldevs(alldevs);
+		return -1;
+	}
+	
+	printf("\nlistening on %s...\n", d->description);
+	
+	/* At this point, we don't need any more the device list. Free it */
+	pcap_freealldevs(alldevs);
+	
+	/* start the capture */
+	pcap_loop(adhandle, 0, packet_handler, NULL);
+	
+	return 0;
+}
+
+/* Callback function invoked by libpcap for every incoming packet */
+void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)
+{
+	struct tm ltime;
+	char timestr[16];
+	ip_header *ih;
+	udp_header *uh;
+	u_int ip_len;
+	u_short sport,dport;
+	time_t local_tv_sec;
+
+	/*
+	 * Unused variable
+	 */
+	(VOID)(param);
+
+	/* convert the timestamp to readable format */
+	local_tv_sec = header->ts.tv_sec;
+	localtime_s(&ltime, &local_tv_sec);
+	strftime( timestr, sizeof timestr, "%H:%M:%S", &ltime);
+
+	/* print timestamp and length of the packet */
+	printf("%s.%.6d len:%d ", timestr, header->ts.tv_usec, header->len);
+
+	/* retireve the position of the ip header */
+	ih = (ip_header *) (pkt_data +
+		14); //length of ethernet header
+
+	/* retireve the position of the udp header */
+	ip_len = (ih->ver_ihl & 0xf) * 4;
+	uh = (udp_header *) ((u_char*)ih + ip_len);
+
+	/* convert from network byte order to host byte order */
+	sport = ntohs( uh->sport );
+	dport = ntohs( uh->dport );
+
+	/* print ip addresses and udp ports */
+	printf("%d.%d.%d.%d.%d -> %d.%d.%d.%d.%d\n",
+		ih->saddr.byte1,
+		ih->saddr.byte2,
+		ih->saddr.byte3,
+		ih->saddr.byte4,
+		sport,
+		ih->daddr.byte1,
+		ih->daddr.byte2,
+		ih->daddr.byte3,
+		ih->daddr.byte4,
+		dport);
+}
+    
+ +

First of all, we set the filter to "ip and udp". In this way we are + sure that packet_handler() will receive only UDP packets over IPv4: this + simplifies the parsing and increases the efficiency of the + program.

+ +

We have also created a couple of structs that describe the IP and UDP + headers. These structs are used by packet_handler() to properly locate + the various header fields.

+ +

packet_handler(), although limited to a single protocol dissector + (UDP over IPv4), shows how complex "sniffers" like tcpdump/WinDump decode + the network traffic. Since we aren't interested in the MAC header, we + skip it. For simplicity and before starting the capture, we check the MAC + layer with pcap_datalink() + to make sure that we are dealing with an Ethernet network. This way we + can be sure that the MAC header is exactly 14 bytes.

+ +

The IP header is located just after the MAC header. We will extract + the IP source and destination addresses from the IP header.

+ +

Reaching the UDP header is a bit more complicated, because the IP + header doesn't have a fixed length. Therefore, we use the IP header's + length field to know its size. Once we know the location of the UDP + header, we extract the source and destination ports.

+ +

The extracted values are printed on the screen, and the result is + something like:

+
+\Device\Packet_{A7FD048A-5D4B-478E-B3C1-34401AC3B72F} (Xircom t 10/100 Adapter)
+Enter the interface number (1-2):1
+ listening on Xircom CardBus Ethernet 10/100 Adapter...
+16:13:15.312784 len:87 130.192.31.67.2682 -> 130.192.3.21.53
+16:13:15.314796 len:137 130.192.3.21.53 -> 130.192.31.67.2682
+16:13:15.322101 len:78 130.192.31.67.2683 -> 130.192.3.21.53
+    
+

Each of the final 3 lines represents a different packet.

+
+ +

Handling offline dump files

+ + +

In this lession we are going to learn how to handle packet capture to + a file (dump to file). Npcap offers a wide range of functions to save + the network traffic to a file and to read the content of + dumps—this lesson will teach how to use all of these + functions.

+ +

The format for dump files is the libpcap one. This format contains + the data of the captured packets in binary form and is a standard used by + many network tools including WinDump, Wireshark and Snort.

+ +

Saving packets to a dump file

+ + +

First of all, let's see how to write packets in libpcap + format.

+ +

The following example captures the packets from the selected + interface and saves them on a file whose name is provided by the + user.

+
+#include <pcap.h>
+#include "misc.h" /* LoadNpcapDlls */
+
+/* prototype of the packet handler */
+void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data);
+
+int main(int argc, char **argv)
+{
+pcap_if_t *alldevs;
+pcap_if_t *d;
+int inum;
+int i=0;
+pcap_t *adhandle;
+char errbuf[PCAP_ERRBUF_SIZE];
+pcap_dumper_t *dumpfile;
+
+    /* Load Npcap and its functions. */
+    if (!LoadNpcapDlls())
+    {
+        fprintf(stderr, "Couldn't load Npcap\n");
+        exit(1);
+    }
+
+    /* Check command line */
+	if(argc != 2)
+	{
+        printf("usage: %s filename", argv[0]);
+        return -1;
+    }
+    
+	/* Retrieve the device list on the local machine */
+	if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1)
+	{
+		fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf);
+		exit(1);
+	}
+    
+    /* Print the list */
+    for(d=alldevs; d; d=d->next)
+    {
+        printf("%d. %s", ++i, d->name);
+        if (d->description)
+            printf(" (%s)\n", d->description);
+        else
+            printf(" (No description available)\n");
+    }
+
+    if(i==0)
+    {
+        printf("\nNo interfaces found! Make sure Npcap is installed.\n");
+        return -1;
+    }
+    
+    printf("Enter the interface number (1-%d):",i);
+    scanf_s("%d", &inum);
+    
+    if(inum < 1 || inum > i)
+    {
+        printf("\nInterface number out of range.\n");
+        /* Free the device list */
+        pcap_freealldevs(alldevs);
+        return -1;
+    }
+		
+	/* Jump to the selected adapter */
+    for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++);
+    
+    
+	/* Open the device */
+	if ( (adhandle= pcap_open(d->name,			// name of the device
+							  65536,			// portion of the packet to capture
+												// 65536 guarantees that the whole packet will be captured on all the link layers
+							  PCAP_OPENFLAG_PROMISCUOUS, 	// promiscuous mode
+							  1000,				// read timeout
+							  NULL,				// authentication on the remote machine
+							  errbuf			// error buffer
+							  ) ) == NULL)
+	{
+		fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", d->name);
+		/* Free the device list */
+		pcap_freealldevs(alldevs);
+		return -1;
+	}
+
+	/* Open the dump file */
+	dumpfile = pcap_dump_open(adhandle, argv[1]);
+
+	if(dumpfile==NULL)
+	{
+		fprintf(stderr,"\nError opening output file\n");
+		return -1;
+	}
+    
+    printf("\nlistening on %s... Press Ctrl+C to stop...\n", d->description);
+	
+    /* At this point, we no longer need the device list. Free it */
+    pcap_freealldevs(alldevs);
+    
+    /* start the capture */
+    pcap_loop(adhandle, 0, packet_handler, (unsigned char *)dumpfile);
+
+    return 0;
+}
+
+/* Callback function invoked by libpcap for every incoming packet */
+void packet_handler(u_char *dumpfile, const struct pcap_pkthdr *header, const u_char *pkt_data)
+{
+	/* save the packet on the dump file */
+	pcap_dump(dumpfile, header, pkt_data);
+}
+        
+ +

As you can see, the structure of the program is very similar to the + ones we have seen in the previous lessons. The differences + are:

+ +
  • a call to pcap_dump_open() is issued + once the interface is opened. This call opens a dump file and + associates it with the interface.
  • the packets are written to this file with a pcap_dump() from the + packet_handler() callback. The parameters of + pcap_dump() are in 1-1 correspondence with the + parameters of pcap_handler().
+
+ +

Reading packets from a dump file

+ + +

Now that we have a dump file available, we can try to read its + content. The following code opens a Npcap/libpcap dump file and + displays every packet contained in the file. The file is opened with + pcap_open_offline(), + then the usual pcap_loop() is + used to sequence through the packets. As you can see, reading packets + from an offline capture is nearly identical to receiving them from a + physical interface.

+ +

This example introduces another function: + pcap_createsrcstr(). This function is required to + create a source string that begins with a marker used to tell Npcap the + type of the source, e.g. "rpcap://" if we are going to open an adapter, + or "file://" if we are going to open a file. This step is not required + when pcap_findalldevs_ex() is used (the returned + values already contain these strings). However, it is required in this + example because the name of the file is read from the user + input.

+ +
+#include <stdio.h>
+#include <pcap.h>
+#include "misc.h" /* LoadNpcapDlls */
+
+#define LINE_LEN 16
+
+void dispatcher_handler(u_char *, const struct pcap_pkthdr *, const u_char *);
+
+int main(int argc, char **argv)
+{
+pcap_t *fp;
+char errbuf[PCAP_ERRBUF_SIZE];
+char source[PCAP_BUF_SIZE];
+
+    /* Load Npcap and its functions. */
+    if (!LoadNpcapDlls())
+    {
+        fprintf(stderr, "Couldn't load Npcap\n");
+        exit(1);
+    }
+
+	if(argc != 2){
+
+		printf("usage: %s filename", argv[0]);
+		return -1;
+
+	}
+
+	/* Create the source string according to the new Npcap syntax */
+	if ( pcap_createsrcstr(	source,			// variable that will keep the source string
+							PCAP_SRC_FILE,	// we want to open a file
+							NULL,			// remote host
+							NULL,			// port on the remote host
+							argv[1],		// name of the file we want to open
+							errbuf			// error buffer
+							) != 0)
+	{
+		fprintf(stderr,"\nError creating a source string\n");
+		return -1;
+	}
+	
+	/* Open the capture file */
+	if ( (fp= pcap_open(source,			// name of the device
+						65536,			// portion of the packet to capture
+										// 65536 guarantees that the whole packet will be captured on all the link layers
+						 PCAP_OPENFLAG_PROMISCUOUS, 	// promiscuous mode
+						 1000,				// read timeout
+						 NULL,				// authentication on the remote machine
+						 errbuf			// error buffer
+						 ) ) == NULL)
+	{
+		fprintf(stderr,"\nUnable to open the file %s.\n", source);
+		return -1;
+	}
+
+	// read and dispatch packets until EOF is reached
+	pcap_loop(fp, 0, dispatcher_handler, NULL);
+
+	return 0;
+}
+
+
+
+void dispatcher_handler(u_char *temp1, 
+						const struct pcap_pkthdr *header, const u_char *pkt_data)
+{
+	u_int i=0;
+
+	/*
+	 * Unused variable
+	 */
+	(VOID)temp1;
+
+	/* print pkt timestamp and pkt len */
+	printf("%ld:%ld (%ld)\n", header->ts.tv_sec, header->ts.tv_usec, header->len);			
+	
+	/* Print the packet */
+	for (i=1; (i < header->caplen + 1 ) ; i++)
+	{
+		printf("%.2x ", pkt_data[i-1]);
+		if ( (i % LINE_LEN) == 0) printf("\n");
+	}
+	
+	printf("\n\n");		
+	
+}
+        
+ +

The following example has the same purpose of the last one, but + pcap_next_ex() is used + instead of the pcap_loop() + callback method.

+ +
+#include <stdio.h>
+#include <pcap.h>
+#include "misc.h" /* LoadNpcapDlls */
+
+#define LINE_LEN 16
+
+int main(int argc, char **argv)
+{
+pcap_t *fp;
+char errbuf[PCAP_ERRBUF_SIZE];
+char source[PCAP_BUF_SIZE];
+struct pcap_pkthdr *header;
+const u_char *pkt_data;
+u_int i=0;
+int res;
+
+    /* Load Npcap and its functions. */
+    if (!LoadNpcapDlls())
+    {
+        fprintf(stderr, "Couldn't load Npcap\n");
+        exit(1);
+    }
+
+	if(argc != 2)
+	{
+		printf("usage: %s filename", argv[0]);
+		return -1;
+	}
+	
+	/* Create the source string according to the new Npcap syntax */
+	if ( pcap_createsrcstr(	source,			// variable that will keep the source string
+							PCAP_SRC_FILE,	// we want to open a file
+							NULL,			// remote host
+							NULL,			// port on the remote host
+							argv[1],		// name of the file we want to open
+							errbuf			// error buffer
+							) != 0)
+	{
+		fprintf(stderr,"\nError creating a source string\n");
+		return -1;
+	}
+	
+	/* Open the capture file */
+	if ( (fp= pcap_open(source,			// name of the device
+						65536,			// portion of the packet to capture
+										// 65536 guarantees that the whole packet will be captured on all the link layers
+						 PCAP_OPENFLAG_PROMISCUOUS, 	// promiscuous mode
+						 1000,				// read timeout
+						 NULL,				// authentication on the remote machine
+						 errbuf			// error buffer
+						 ) ) == NULL)
+	{
+		fprintf(stderr,"\nUnable to open the file %s.\n", source);
+		return -1;
+	}
+	
+	/* Retrieve the packets from the file */
+	while((res = pcap_next_ex( fp, &header, &pkt_data)) >= 0)
+	{
+		/* print pkt timestamp and pkt len */
+		printf("%ld:%ld (%ld)\n", header->ts.tv_sec, header->ts.tv_usec, header->len);			
+		
+		/* Print the packet */
+		for (i=1; (i < header->caplen + 1 ) ; i++)
+		{
+			printf("%.2x ", pkt_data[i-1]);
+			if ( (i % LINE_LEN) == 0) printf("\n");
+		}
+		
+		printf("\n\n");		
+	}
+	
+	
+	if (res == -1)
+	{
+		printf("Error reading the packets: %s\n", pcap_geterr(fp));
+	}
+	
+	return 0;
+}
+
+        
+ +
+ +
+ +

Sending Packets

+ +

Although the name Npcap indicates clearly that the purpose + of the library is packet capture, other useful features for raw + networking are provided. Among them, the user can find a complete set of + functions to send packets.

+ +

Sending a single packet with pcap_sendpacket()

+ + +

The simplest way to send a packet is shown in the following code + snippet. After opening an adapter, pcap_sendpacket() is called to + send a hand-crafted packet. pcap_sendpacket() takes + as arguments a buffer containing the data to send, the length of the + buffer and the adapter that will send it. Notice that the buffer is + sent to the net as is, without any manipulation. This means that the + application has to create the correct protocol headers in order to send + something meaningful.

+ +
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <pcap.h>
+#include "misc.h" /* LoadNpcapDlls */
+
+
+void main(int argc, char **argv)
+{
+pcap_t *fp;
+char errbuf[PCAP_ERRBUF_SIZE];
+u_char packet[100];
+int i;
+
+    /* Load Npcap and its functions. */
+    if (!LoadNpcapDlls())
+    {
+        fprintf(stderr, "Couldn't load Npcap\n");
+        exit(1);
+    }
+
+	/* Check the validity of the command line */
+	if (argc != 2)
+	{
+		printf("usage: %s interface (e.g. 'rpcap://eth0')", argv[0]);
+		return;
+	}
+    
+	/* Open the output device */
+	if ( (fp= pcap_open(argv[1],			// name of the device
+						100,				// portion of the packet to capture (only the first 100 bytes)
+						PCAP_OPENFLAG_PROMISCUOUS, 	// promiscuous mode
+						1000,				// read timeout
+						NULL,				// authentication on the remote machine
+						errbuf				// error buffer
+						) ) == NULL)
+	{
+		fprintf(stderr,"\nUnable to open the adapter. %s is not supported by Npcap\n", argv[1]);
+		return;
+	}
+
+	/* Supposing to be on ethernet, set mac destination to 1:1:1:1:1:1 */
+	packet[0]=1;
+	packet[1]=1;
+	packet[2]=1;
+	packet[3]=1;
+	packet[4]=1;
+	packet[5]=1;
+	
+	/* set mac source to 2:2:2:2:2:2 */
+	packet[6]=2;
+	packet[7]=2;
+	packet[8]=2;
+	packet[9]=2;
+	packet[10]=2;
+	packet[11]=2;
+	
+	/* Fill the rest of the packet */
+	for(i=12;i<100;i++)
+	{
+		packet[i]=(u_char)i;
+	}
+
+	/* Send down the packet */
+	if (pcap_sendpacket(fp, packet, 100 /* size */) != 0)
+	{
+		fprintf(stderr,"\nError sending the packet: %s\n", pcap_geterr(fp));
+		return;
+	}
+
+	return;
+}
+        
+ +
+ +

Send queues

+ + +

While pcap_sendpacket() + offers a simple and immediate way to send a single packet, + send queues provide an advanced, powerful and + optimized mechanism to send a collection of packets. A send queue is a + container for a variable number of packets that will be sent to the + network. It has a size, that represents the maximum amount of bytes it + can store.

+ +

A send queue is created calling the + pcap_sendqueue_alloc() function, specifying the size + of the new send queue.

+ +

Once the send queue is created, + pcap_sendqueue_queue() can be used to add a packet + to the send queue. This function takes a pcap_pkthdr + with the timestamp and the length and a buffer with the data of the + packet. These parameters are the same as those received by pcap_next_ex() and + pcap_handler(), therefore queuing a packet that was + just captured or read from a file is a matter of passing these + parameters to pcap_sendqueue_queue().

+ +

To transmit a send queue, Npcap provides the + pcap_sendqueue_transmit() function. Note the third + parameter: if nonzero, the send will be + synchronized, i.e. the relative timestamps of the + packets will be respected. This operation requires a remarkable amount + of CPU, because the synchronization takes place in the kernel driver + using "busy wait" loops. Although this operation is quite CPU + intensive, it often results in very high precision packet transmissions + (often around few microseconds or less).

+ +

Note that transmitting a send queue with + pcap_sendqueue_transmit() is much more efficient + than performing a series of pcap_sendpacket(), because the + send queue is buffered at kernel level drastically decreasing the + number of context switches.

+ +

When a queue is no longer needed, it can be deleted with + pcap_sendqueue_destroy() that frees all the buffers + associated with the send queue.

+ +

The next program shows how to use send queues. It opens a capture + file with pcap_open_offline(), then + it moves the packets from the file to a properly allocated send queue. + At his point it transmits the queue, synchronizing it if requested by + the user.

+ +

Note that the link-layer of the dumpfile is compared with the one + of the interface that will send the packets using pcap_datalink(), and a warning + is printed if they are different—it is important that the + capture-file link-layer be the same as the adapter's link layer for + otherwise the transmission is pointless.

+ +
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <pcap.h>
+
+#ifdef WIN32
+#include <tchar.h>
+BOOL LoadNpcapDlls()
+{
+	TCHAR npcap_dir[512];
+	UINT len;
+	len = GetSystemDirectory(npcap_dir, 480);
+	if (!len) {
+		fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError());
+		return FALSE;
+	}
+	_tcscat_s(npcap_dir, 512, TEXT("\\Npcap"));
+	if (SetDllDirectory(npcap_dir) == 0) {
+		fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError());
+		return FALSE;
+	}
+	return TRUE;
+}
+#endif
+
+void usage();
+
+void main(int argc, char **argv)
+{
+	pcap_t *indesc,*outdesc;
+	char errbuf[PCAP_ERRBUF_SIZE];
+	char source[PCAP_BUF_SIZE];
+	FILE *capfile;
+	int caplen, sync;
+	u_int res;
+	pcap_send_queue *squeue;
+	struct pcap_pkthdr *pktheader;
+	u_char *pktdata;
+	float cpu_time;
+	u_int npacks = 0;
+	errno_t fopen_error;
+
+#ifdef WIN32
+	/* Load Npcap and its functions. */
+	if (!LoadNpcapDlls())
+	{
+		fprintf(stderr, "Couldn't load Npcap\n");
+		exit(1);
+	}
+#endif
+
+	/* Check the validity of the command line */
+	if (argc <= 2 || argc >= 5)
+	{
+		usage();
+		return;
+	}
+		
+	/* Retrieve the length of the capture file */
+	fopen_error = fopen_s(&capfile, argv[1],"rb");
+	if(fopen_error != 0){
+		printf("Error opening the file, errno %d.\n", fopen_error);
+		return;
+	}
+	
+	fseek(capfile , 0, SEEK_END);
+	caplen= ftell(capfile)- sizeof(struct pcap_file_header);
+	fclose(capfile);
+			
+	/* Chek if the timestamps must be respected */
+	if(argc == 4 && argv[3][0] == 's')
+		sync = TRUE;
+	else
+		sync = FALSE;
+
+	/* Open the capture */
+	/* Create the source string according to the new WinPcap syntax */
+	if ( pcap_createsrcstr(	source,			// variable that will keep the source string
+							PCAP_SRC_FILE,	// we want to open a file
+							NULL,			// remote host
+							NULL,			// port on the remote host
+							argv[1],		// name of the file we want to open
+							errbuf			// error buffer
+							) != 0)
+	{
+		fprintf(stderr,"\nError creating a source string\n");
+		return;
+	}
+	
+	/* Open the capture file */
+	if ( (indesc= pcap_open(source, 65536, PCAP_OPENFLAG_PROMISCUOUS, 1000, NULL, errbuf) ) == NULL)
+	{
+		fprintf(stderr,"\nUnable to open the file %s.\n", source);
+		return;
+	}
+
+	/* Open the output adapter */
+	if ( (outdesc= pcap_open(argv[2], 100, PCAP_OPENFLAG_PROMISCUOUS, 1000, NULL, errbuf) ) == NULL)
+	{
+		fprintf(stderr,"\nUnable to open adapter %s.\n", source);
+		return;
+	}
+
+	/* Check the MAC type */
+	if (pcap_datalink(indesc) != pcap_datalink(outdesc))
+	{
+		printf("Warning: the datalink of the capture differs from the one of the selected interface.\n");
+		printf("Press a key to continue, or CTRL+C to stop.\n");
+		getchar();
+	}
+
+	/* Allocate a send queue */
+	squeue = pcap_sendqueue_alloc(caplen);
+
+	/* Fill the queue with the packets from the file */
+	while ((res = pcap_next_ex( indesc, &pktheader, &pktdata)) == 1)
+	{
+		if (pcap_sendqueue_queue(squeue, pktheader, pktdata) == -1)
+		{
+			printf("Warning: packet buffer too small, not all the packets will be sent.\n");
+			break;
+		}
+
+		npacks++;
+	}
+
+	if (res == -1)
+	{
+		printf("Corrupted input file.\n");
+		pcap_sendqueue_destroy(squeue);
+		return;
+	}
+
+	/* Transmit the queue */
+	
+	cpu_time = (float)clock ();
+
+	if ((res = pcap_sendqueue_transmit(outdesc, squeue, sync)) < squeue->len)
+	{
+		printf("An error occurred sending the packets: %s. Only %d bytes were sent\n", pcap_geterr(outdesc), res);
+	}
+	
+	cpu_time = (clock() - cpu_time)/CLK_TCK;
+	
+	printf ("\n\nElapsed time: %5.3f\n", cpu_time);
+	printf ("\nTotal packets generated = %d", npacks);
+	printf ("\nAverage packets per second = %d", (int)((double)npacks/cpu_time));
+	printf ("\n");
+
+	/* free the send queue */
+	pcap_sendqueue_destroy(squeue);
+
+	/* Close the input file */
+	pcap_close(indesc);
+
+	/* 
+	 * lose the output adapter 
+	 * IMPORTANT: remember to close the adapter, otherwise there will be no guarantee that all the 
+	 * packets will be sent!
+	 */
+	pcap_close(outdesc);
+
+
+	return;
+}
+
+
+void usage()
+{
+	
+	printf("\nSendcap, sends a libpcap/tcpdump capture file to the net. Copyright (C) 2002 Loris Degioanni.\n");
+	printf("\nUsage:\n");
+	printf("\t sendcap file_name adapter [s]\n");
+	printf("\nParameters:\n");
+	printf("\nfile_name: the name of the dump file that will be sent to the network\n");
+	printf("\nadapter: the device to use. Use \"WinDump -D\" for a list of valid devices\n");
+	printf("\ns: if present, forces the packets to be sent synchronously, i.e. respecting the timestamps in the dump file. This option will work only under Windows NTx.\n\n");
+
+	exit(0);
+}
+        
+
+
+ +

Gathering Statistics on the network traffic

+ + +

This lesson shows another advanced feature of Npcap: the ability to + collect statistics about network traffic. The statistical engine makes + use of the kernel-level packet filter to efficiently classify the + incoming packet.

+ +

In order to use this feature, the programmer must open an adapter and + put it in statistical mode. This can be done with + pcap_setmode(). In particular, + MODE_STAT must be used as the mode + argument of this function.

+ +

With statistical mode, making an application that monitors the TCP + traffic load is a matter of few lines of code. The following sample shows + how to do it.

+ +
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <pcap.h>
+
+#include <tchar.h>
+BOOL LoadNpcapDlls()
+{
+    _TCHAR npcap_dir[512];
+    UINT len;
+    len = GetSystemDirectory(npcap_dir, 480);
+    if (!len) {
+        fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError());
+        return FALSE;
+    }
+    _tcscat_s(npcap_dir, 512, _T("\\Npcap"));
+    if (SetDllDirectory(npcap_dir) == 0) {
+        fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError());
+        return FALSE;
+    }
+    return TRUE;
+}
+
+void usage();
+
+void dispatcher_handler(u_char *, const struct pcap_pkthdr *, const u_char *);
+
+
+void main(int argc, char **argv)
+{
+pcap_t *fp;
+char errbuf[PCAP_ERRBUF_SIZE];
+struct timeval st_ts;
+u_int netmask;
+struct bpf_program fcode;
+  
+    /* Load Npcap and its functions. */
+    if (!LoadNpcapDlls())
+    {
+        fprintf(stderr, "Couldn't load Npcap\n");
+        exit(1);
+    }
+
+	/* Check the validity of the command line */
+	if (argc != 2)
+	{
+		usage();
+		return;
+	}
+		
+	/* Open the output adapter */
+	if ( (fp= pcap_open(argv[1], 100, PCAP_OPENFLAG_PROMISCUOUS, 1000, NULL, errbuf) ) == NULL)
+	{
+		fprintf(stderr,"\nUnable to open adapter %s.\n", errbuf);
+		return;
+	}
+
+    /* Don't care about netmask, it won't be used for this filter */
+    netmask=0xffffff; 
+
+    //compile the filter
+    if (pcap_compile(fp, &fcode, "tcp", 1, netmask) <0 )
+	{
+        fprintf(stderr,"\nUnable to compile the packet filter. Check the syntax.\n");
+        /* Free the device list */
+        return;
+    }
+    
+    //set the filter
+    if (pcap_setfilter(fp, &fcode)<0)
+	{
+        fprintf(stderr,"\nError setting the filter.\n");
+		pcap_close(fp);
+        /* Free the device list */
+        return;
+    }
+
+	/* Put the interface in statstics mode */
+	if (pcap_setmode(fp, MODE_STAT)<0)
+	{
+        fprintf(stderr,"\nError setting the mode.\n");
+		pcap_close(fp);
+        /* Free the device list */
+        return;
+    }
+
+
+	printf("TCP traffic summary:\n");
+
+	/* Start the main loop */
+	pcap_loop(fp, 0, dispatcher_handler, (PUCHAR)&st_ts);
+
+	pcap_close(fp);
+	return;
+}
+
+void dispatcher_handler(u_char *state, const struct pcap_pkthdr *header, const u_char *pkt_data)
+{
+	struct timeval *old_ts = (struct timeval *)state;
+	u_int delay;
+	LARGE_INTEGER Bps,Pps;
+	struct tm ltime;
+	char timestr[16];
+	time_t local_tv_sec;
+
+	/* Calculate the delay in microseconds from the last sample. */
+	/* This value is obtained from the timestamp that the associated with the sample. */
+	delay=(header->ts.tv_sec - old_ts->tv_sec) * 1000000 - old_ts->tv_usec + header->ts.tv_usec;
+	/* Get the number of Bits per second */
+	Bps.QuadPart=(((*(LONGLONG*)(pkt_data + 8)) * 8 * 1000000) / (delay));
+	/*                                            ^      ^
+                                                  |      |
+                                                  |      | 
+                                                  |      |
+                         converts bytes in bits --       |
+                                                         |
+                    delay is expressed in microseconds --
+	*/
+
+	/* Get the number of Packets per second */
+	Pps.QuadPart=(((*(LONGLONG*)(pkt_data)) * 1000000) / (delay));
+
+	/* Convert the timestamp to readable format */
+	local_tv_sec = header->ts.tv_sec;
+	localtime_s(&ltime, &local_tv_sec);
+	strftime( timestr, sizeof timestr, "%H:%M:%S", &ltime);
+
+	/* Print timestamp*/
+	printf("%s ", timestr);
+
+	/* Print the samples */
+	printf("BPS=%I64u ", Bps.QuadPart);
+	printf("PPS=%I64u\n", Pps.QuadPart);
+
+	//store current timestamp
+	old_ts->tv_sec=header->ts.tv_sec;
+	old_ts->tv_usec=header->ts.tv_usec;
+}
+
+
+void usage()
+{
+	
+	printf("\nShows the TCP traffic load, in bits per second and packets per second.\nCopyright (C) 2002 Loris Degioanni.\n");
+	printf("\nUsage:\n");
+	printf("\t tcptop adapter\n");
+	printf("\t You can use \"WinDump -D\" if you don't know the name of your adapters.\n");
+
+	exit(0);
+}
+      
+ +

Before enabling statistical mode, the user has the option to set a + filter that defines the subset of network traffic that will be monitored. + See the Filtering expression + syntax documentation for details. If no filter has been set, + all of the traffic will be monitored.

+ +

Once +

  • the filter is set
  • pcap_setmode() is called
  • callback invocation is enabled with pcap_loop()

+ the interface descriptor starts to work in statistical mode. Notice the + fourth parameter (to_ms) of pcap_open(): it defines the interval + among the statistical samples. The callback function receives the samples + calculated by the driver every to_ms milliseconds. + These samples are encapsulated in the second and third parameters of the + callback function. + + Two 64-bit counters are provided: the number of packets and the amount of + bytes received during the last interval.

+ +

In the example, the adapter is opened with a timeout of 1000 ms. This + means that dispatcher_handler() is called once per second. At this point + a filter that keeps only tcp packets is compiled and set. Then + pcap_setmode() and pcap_loop() are + called. Note that a struct timeval pointer is passed to + pcap_loop() as the user parameter. + This structure will be used to store a timestamp in order to calculate + the interval between two samples. dispatcher_handler()uses this interval + to obtain the bits per second and the packets per second and then prints + these values on the screen.

+ +

Note finally that this example is by far more efficient than a + program that captures the packets in the traditional way and calculates + statistics at user-level. Statistical mode requires the minumum amount of + data copies and context switches and therefore the CPU is optimized. + Moreover, a very small amount of memory is required.

+
+
diff --git a/network/start/lib/npcap/docs/npcap-users-guide.html b/network/start/lib/npcap/docs/npcap-users-guide.html new file mode 100644 index 0000000..6343aa3 --- /dev/null +++ b/network/start/lib/npcap/docs/npcap-users-guide.html @@ -0,0 +1,382 @@ +Npcap Users' Guide

Npcap Users' Guide

Abstract

+

The Users' Guide covers the basics of installing and removing + Npcap, interactions with WinPcap, frequently asked questions, + and how to report bugs.

+
+ + + +

Because Npcap is a packet capture architecture, not merely a software + library, some aspects of installation and configuration may fall to the end + user. This Users' Guide covers the basics of installing, configuring, and + removing Npcap, as well as how to report bugs.

+ +

Installation

+ + +

+ Npcap is distributed as a signed executable installer, downloadable from + Nmap.com. Major + versions are backwards-compatible, and users of the free non-commercial + version are encouraged to upgrade regularly for security and stability + fixes. Software distributors may have separate requirements for supported + Npcap versions. Please refer to + the Npcap License for + terms of use and redistribution.

+ +

+ The Npcap installer and uninstaller are easy to use in + Graphical Mode (direct run) and Silent Mode (run with + /S parameter, available only with Npcap OEM). +

+ +

Installer options

+ +

+ The installer accepts several command-line options that correspond to the + options presented in the graphical interface (GUI). The options can be + set by command-line flags taking the form + /name=value. +

+

The values for these options must be one of: +

+
  • yes: select the option

  • no: unselect the option

  • enforced: select the option and make it unchangable in the GUI

  • disabled: unselect the option and make it unchangable in the GUI

+
Graphical installer options
+ +

The following options are presented as checkboxes in the + installer, but can be set or locked via command-line flags. Unless + otherwise noted, the default for these options is no. +

+ +
/loopback_support

+ Legacy loopback support for Nmap 7.80 and older. Not needed for Wireshark. + Older versions of Npcap required a Microsoft KM-TEST loopback + adapter to be installed in order to capture and inject loopback + traffic. This is no longer needed, but some software won't be + able to do loopback injection unless the adapter is installed. + Use this option to install the legacy loopback adapter if + needed. +

+

See the section called “For software that uses Npcap loopback feature” for more + information. +

/admin_only

+ Restrict Npcap driver's access to Administrators + only. When this option is chosen, the devices + created by the Npcap driver for capture and injection on each + network adapter will be created with a restrictive ACL that + only allows access to the device by the SYSTEM and built-in + Administrators. Because this level of access requires UAC + elevation, a helper binary, NpcapHelper.exe, + is used to request elevation for each process that opens a + capture handle. +

/dot11_support

+ Support raw 802.11 traffic (and monitor mode) for + wireless adapters. This option installs a second + Lightweight Filter Driver that uses the Native WiFi API to + capture raw 802.11 WiFi frames on devices that are put into + network monitor mode. Captured frames are given a Radiotap + header. Not all hardware or network drivers support the Native + WiFi API. +

/winpcap_mode

+ Install Npcap in WinPcap API-compatible + Mode. Npcap uses the same API and DLL names as + WinPcap, so to avoid unintentionally removing working WinPcap + installations, it places its DLLs in a different directory than + WinPcap. This option also installs the DLLs to the system + directory, so software written for WinPcap will work + seamlessly, though the new features of Npcap will not be + available. This requires removal of any old WinPcap + installations. +

+
+ +
Command-line installation options
+ +

Some advanced or deprecated options are only available on the + command-line. Options marked (deprecated) are + subject to removal in future versions.

+ +
/S (Silent install, Npcap OEM only)

+ Installs Npcap without showing any graphical windows or + prompts. Silent install is available only for Npcap OEM. +

/disable_restore_point

+ The default for this option is yes, so the + installer will not set a system restore point. Windows may + independently create a restore point because of the driver + installation independent from this option. To ensure a + restore point is made, specify + /disable_restore_point=no. +

/no_kill

+ Control termination of + processes using Npcap during upgrades or WinPcap when + /winpcap_mode=yes is chosen. See + the section called “Uninstaller options” + for more detailed discussion. +

/D (destination directory)

+ The destination directory for installation can be overridden by + the /D option, with a few restrictions. First, it will + only affect where Npcap keeps its installation logs and helper utilities. + The driver and DLLs will always be installed into the appropriate + directories below %SYSTEMROOT%\System32\. Second, the + /D must be the last option in the command, and the path + must not contain quotes. For example, to change the installation directory + to C:\Path With Spaces\, the invocation would be: + npcap-version.exe /D=C:\Path With Spaces +

/npf_startup (deprecated)

+ Automatically start the Npcap driver at boot + time. This option defaults to + yes, because Windows expects NDIS filter + drivers to be available at boot time. If you choose to disable + this, Windows may not start networking for up to 90 seconds + after boot. +

/vlan_support (deprecated, ignored)

+ Support 802.1Q VLAN tag when capturing and sending + data (currently unsupported). This feature was + disabled in 2016 to prevent a crash and has not been + re-enabled. +

+ +
+
+ +

Uninstaller options

+ +

+ The uninstaller provided with Npcap also accepts some command-line options. +

+
/S (Silent uninstall)
+

Uninstalls Npcap without showing any graphical windows or + prompts. Silent uninstall is available in all editions of Npcap, + not just Npcap OEM. If Npcap OEM installer in silent mode needs + to uninstall an older Npcap installation, it passes the + /S option to the existing uninstaller.

+
/Q (Quick uninstall)
+

Skips the confirmation page and finish page in the uninstall + wizard. This option does not have any meaning for silent + uninstalls.

+
/no_kill=yes|no (do not kill processes)
+

Controls how the uninstaller handles processes that are still using + Npcap at the time of uninstall. The default value is + no, which allows the uninstaller to terminate + processes that would block Npcap from being uninstalled. If + /no_kill=yes is specified, then Npcap + uninstaller will fail if there are still applications using Npcap + driver or DLLs.

+ +

In the default case, /no_kill=no, the + graphical uninstaller will give the user the choice to manually + close the offending programs, have the uninstaller terminate + them, or abort the uninstallation. In silent mode, Npcap + uninstaller will immediately terminate any command-line processes + that are using Npcap (like a Nmap process that is still + scanning), and wait for at most 15 seconds to gracefully + terminate any GUI processes that are using Npcap (like Wireshark + UI that is still capturing). Gracefully means + that if you are still capturing via Wireshark, Wireshark UI will + prompt the user about whether to save the current capture before + closing. The user will have 15 seconds to save his session. + Note: although Npcap uninstaller won't + terminate Wireshark UI processes immediately, the live capture + stops immediately. This is because Wireshark UI uses command-line + processes named dumpcap.exe to capture, and + that command-line process will be terminated immediately.

+ +

If this option is provided on the + installer command line, it will be passed to + the Npcap uninstaller when doing an upgrade or + replacement.

+
+ +
+ +

Disabled and enforced options for GUI Mode

+ + +

+ We may disable or enforce certain options in the installer GUI to make them unselectable. This + usually means that those options can easily cause compatibility issues and are considered + not suitable for most users, or we think we need to enforce some rules for the Npcap API. Advanced users can still change their states via command-line + parameters, which is described in following sections. +

+ +

+ Fortunately, if a distributor wants to start the Npcap installer GUI and disable or enforce + certain options for reasons like compatibility. It can also use the four value + mechanism by setting the command-line parameters to disabled or enforced. + For example, the following command will start an installer GUI with the + loopback_support option disabled and unselected: +

+ +

+ npcap-version.exe /loopback_support=disabled +

+
+ +
+ +

How to use Wireshark to capture raw 802.11 traffic in Monitor Mode

+ + +

+ The latest Wireshark has already integrated the support for Npcap's Monitor Mode capture. + If you want to use Wireshark to capture raw 802.11 traffic in Monitor Mode, you need to + switch on the monitor mode inside the Wireshark UI instead of using the section called “WlanHelper”. + This is because Wireshark only recognizes the monitor mode set by itself. So when you turn + on monitor mode outside Wireshark (like in WlanHelper), Wireshark will not know the adapter + has been in monitor mode, and will still try to capture in Ethernet mode, which will get no traffic. + + So after all, the correct steps are: +

+ +
  • Install latest version Wireshark and latest version Npcap with + Support raw 802.11 traffic option checked.

  • Launch Wireshark QT UI (GTK version is similar), go to Capture options. + Then toggle the checkbox in the Monitor Mode column of your wireless adapter's row. + Click the Start button. If you see a horizontal line instead of the checkbox, + then it probably means that your adapter doesn't support monitor mode. You can use the + WlanHelper tool to double-check this fact.

  • To decrypt encrypted 802.11 data + packets, you need to specify the decipher key in Wireshark, otherwise + you will only see 802.11 data packets.

  • Stop the capture in Wireshark UI when you finishes capturing, the monitor mode + will be turned off automatically by Npcap.

+
+ +

Q & A

+ + +
  • Network disconnects after installing Npcap: As Microsoft states + here, + an optional NDIS light-weight filter (LWF) driver like Npcap could cause + 90-second delay in network availability. Some solutions you could try + are: 1) wait for 90 seconds; 2) disable and re-enable the adapter icon in + ncpa.cpl; 3) reboot. If this doesn't work, + please file a bug report. +

  • Installation fails with error code 0x8004a029: + The cause is that you have reached the maximum number of network filter + drivers, see solution + here. +

  • Npcap Loopback Adapter is missing (legacy loopback support): + The legacy Npcap Loopback Adapter is actually a wrapper of Microsoft Loopback Adapter. + Such adapters won't show up in Wireshark if the Basic Filtering Enging (BFE) + service was not running. To fix this issue, you should start this service at services.msc + manually and restart the Npcap service by running net stop npcap + and net start npcap. See details about this issue + here. +

  • Npcap only captures TCP handshake and teardown, but not data packets. + Some network adapters support offloading of tasks to free up CPU time for + performance reasons. When this happens, Npcap may not receive all of the + packets, or may receive them in a different form than is actually sent on the + wire. To avoid this issue, you may disable TCP Chimney, IP Checksum + Offloading, and Large Send Offloading in the network adapter properites on + Windows. See details about this issue in + issue + #989 on our tracker. +

+
+ +

Reporting Bugs

+ + +

+ Please report any bugs or issues about Npcap on + the Nmap Project's Issues tracker. + In your report, please provide your DiagReport output, user + software version (e.g. Nmap, Wireshark), steps to reproduce the problem, and other information + you think necessary. If your issue occurs only on a particular OS version (e.g. Win10 + 1511, 1607), please mention it in the report. +

+ +

Diagnostic report

+ + +

+ Npcap has provided a diagnostic utility called DiagReport. + It provides a lot of information including OS metadata, Npcap related files, + install options, registry values, services, etc. You can simply click the + C:\Program Files\Npcap\DiagReport.bat file to run DiagReport. + It will pop up a text report via Notepad (it's stored in: C:\Program Files\Npcap\DiagReport.txt). + Please always submit it to us if you encounter any issues. +

+ +
+

General installation log

+ + +

+ Npcap keeps track of the installation in a log file: + C:\Program Files\Npcap\install.log. Please submit it + together in your report if you encounter issues during the installation + (e.g. the installer halts). +

+
+ +

Driver installation log

+ + +

+ Npcap keeps track of the driver installation (aka commands run by + NPFInstall.exe) in a log file: + C:\Program Files\Npcap\NPFInstall.log, please submit + it together in your report if you encounter issues during the driver + installation or problems with the Npcap Loopback Adapter. +

+ +

+ There's another system-provided driver installation log in: + C:\Windows\INF\setupapi.dev.log. + If you encounter errors during the driver/service installation, please copy + the Npcap-related lines out and send them together in + your report. +

+
+ +

Dynamic link library (DLL) log

+ + +

+ For problems with Npcap's regular operation, you may need to obtain a + debug log from Packet.dll. To do this, you will + need a debug build of Npcap. If you are a Npcap developer, you can build + the Packet.sln project with the + _DEBUG_TO_FILE macro defined. If you are an end user, + you can contact the Npcap development team for the latest Npcap debug + build. The debugging process will continue to append to the debug log + (C:\Program Files\Npcap\Packet.log), so you may want + to delete it after an amount of time, or save your output to another + place before it gets too large. +

+
+ +

Driver log

+ + +

+ If there is an issue with the Npcap driver, you can open an + Administrator command prompt, enter sc query + npcap to query the driver status and net start + npcap to start the driver (replace + npcap with npf if you + installed Npcap in WinPcap Compatible Mode). The command + output will inform you whether there's an error. If the driver is running + well, but the issue still exists, then you may need to check the driver's + log. Normal Npcap releases don't switch on the driver log function for + performance. Contact the Npcap development team to obtain a driver-debug + version of the Npcap installer. When you have got an appropriate + driver-debug version Npcap, you need to use DbgView + to read the Windows kernel log (which contains our driver log). You may + need to turn on DbgView before installing Npcap, if the error occurs when + the driver loads. When done, save the DbgView output to a file and submit + it in your report. +

+
+

Blue screen of death (BSoD) dump

+ + +

+ If you encountered BSoD when using Npcap, please attach the minidump + file (in C:\Windows\Minidump\) to your report + together with the Npcap version. We may ask you to provide the full + dump (C:\Windows\MEMORY.DMP) for further troubleshooting. +

+
+
+ +
diff --git a/network/start/lib/npcap/docs/wpcap/pcap-filter.html b/network/start/lib/npcap/docs/wpcap/pcap-filter.html new file mode 100644 index 0000000..51458d3 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap-filter.html @@ -0,0 +1,540 @@ + + +PCAP-FILTER man page + + + + +

NAME

+

pcap-filter - packet filter syntax
+

DESCRIPTION

+

+

pcap_compile() is used to compile a string into a filter program. The resulting filter program can then be applied to some stream of packets to determine which packets will be supplied to pcap_loop, pcap_dispatch(3PCAP), pcap_next(3PCAP), or pcap_next_ex. +

The filter expression consists of one or more primitives. Primitives usually consist of an id (name or number) preceded by one or more qualifiers. There are three different kinds of qualifier: +

type +

type qualifiers say what kind of thing the id name or number refers to. Possible types are host, net , port and portrange. E.g., `host foo', `net 128.3', `port 20', `portrange 6000-6008'. If there is no type qualifier, host is assumed. +

dir +

dir qualifiers specify a particular transfer direction to and/or from id. Possible directions are src, dst, src or dst, src and dst, ra, ta, addr1, addr2, addr3, and addr4. E.g., `src foo', `dst net 128.3', `src or dst port ftp-data'. If there is no dir qualifier, src or dst is assumed. The ra, ta, addr1, addr2, addr3, and addr4 qualifiers are only valid for IEEE 802.11 Wireless LAN link layers. +

proto +

proto qualifiers restrict the match to a particular protocol. Possible protos are: ether, fddi, tr, wlan, ip, ip6, arp, rarp, decnet, tcp and udp. E.g., `ether src foo', `arp net 128.3', `tcp port 21', `udp portrange 7000-7009', `wlan addr2 0:2:3:4:5:6'. If there is no proto qualifier, all protocols consistent with the type are assumed. E.g., `src foo' means `(ip or arp or rarp) src foo' (except the latter is not legal syntax), `net bar' means `(ip or arp or rarp) net bar' and `port 53' means `(tcp or udp) port 53'. +

[`fddi' is actually an alias for `ether'; the parser treats them identically as meaning ``the data link level used on the specified network interface.'' FDDI headers contain Ethernet-like source and destination addresses, and often contain Ethernet-like packet types, so you can filter on these FDDI fields just as with the analogous Ethernet fields. FDDI headers also contain other fields, but you cannot name them explicitly in a filter expression. +

Similarly, `tr' and `wlan' are aliases for `ether'; the previous paragraph's statements about FDDI headers also apply to Token Ring and 802.11 wireless LAN headers. For 802.11 headers, the destination address is the DA field and the source address is the SA field; the BSSID, RA, and TA fields aren't tested.] +

In addition to the above, there are some special `primitive' keywords that don't follow the pattern: gateway, broadcast, less, greater and arithmetic expressions. All of these are described below. +

More complex filter expressions are built up by using the words and, or and not to combine primitives. E.g., `host foo and not port ftp and not port ftp-data'. To save typing, identical qualifier lists can be omitted. E.g., `tcp dst port ftp or ftp-data or domain' is exactly the same as `tcp dst port ftp or tcp dst port ftp-data or tcp dst port domain'. +

Allowable primitives are: +

dst host host +

True if the IPv4/v6 destination field of the packet is host, which may be either an address or a name. +

src host host +

True if the IPv4/v6 source field of the packet is host. +

host host +

True if either the IPv4/v6 source or destination of the packet is host. +

+

Any of the above host expressions can be prepended with the keywords, ip, arp, rarp, or ip6 as in: +

+ip host host
+
+ +

+

which is equivalent to: +

+ether proto \ip and host host
+
+ +

+

If host is a name with multiple IP addresses, each address will be checked for a match. +

ether dst ehost +

True if the Ethernet destination address is ehost. Ehost may be either a name from /etc/ethers or a numerical MAC address of the form "xx:xx:xx:xx:xx:xx", "xx.xx.xx.xx.xx.xx", "xx-xx-xx-xx-xx-xx", "xxxx.xxxx.xxxx", "xxxxxxxxxxxx", or various mixes of ':', '.', and '-', where each "x" is a hex digit (0-9, a-f, or A-F). +

ether src ehost +

True if the Ethernet source address is ehost. +

ether host ehost +

True if either the Ethernet source or destination address is ehost. +

gateway host +

True if the packet used host as a gateway. I.e., the Ethernet source or destination address was host but neither the IP source nor the IP destination was host. Host must be a name and must be found both by the machine's host-name-to-IP-address resolution mechanisms (host name file, DNS, NIS, etc.) and by the machine's host-name-to-Ethernet-address resolution mechanism (/etc/ethers, etc.). (An equivalent expression is +

+ether host ehost and not host host
+
+ +

+

which can be used with either names or numbers for host / ehost.) This syntax does not work in IPv6-enabled configuration at this moment. +

dst net net +

True if the IPv4/v6 destination address of the packet has a network number of net. Net may be either a name from the networks database (/etc/networks, etc.) or a network number. An IPv4 network number can be written as a dotted quad (e.g., 192.168.1.0), dotted triple (e.g., 192.168.1), dotted pair (e.g, 172.16), or single number (e.g., 10); the netmask is 255.255.255.255 for a dotted quad (which means that it's really a host match), 255.255.255.0 for a dotted triple, 255.255.0.0 for a dotted pair, or 255.0.0.0 for a single number. An IPv6 network number must be written out fully; the netmask is ff:ff:ff:ff:ff:ff:ff:ff, so IPv6 "network" matches are really always host matches, and a network match requires a netmask length. +

src net net +

True if the IPv4/v6 source address of the packet has a network number of net. +

net net +

True if either the IPv4/v6 source or destination address of the packet has a network number of net. +

net net mask netmask +

True if the IPv4 address matches net with the specific netmask. May be qualified with src or dst. Note that this syntax is not valid for IPv6 net. +

net net/len +

True if the IPv4/v6 address matches net with a netmask len bits wide. May be qualified with src or dst. +

dst port port +

True if the packet is ip/tcp, ip/udp, ip6/tcp or ip6/udp and has a destination port value of port. The port can be a number or a name used in /etc/services (see tcp(4P) and udp(4P)). If a name is used, both the port number and protocol are checked. If a number or ambiguous name is used, only the port number is checked (e.g., dst port 513 will print both tcp/login traffic and udp/who traffic, and port domain will print both tcp/domain and udp/domain traffic). +

src port port +

True if the packet has a source port value of port. +

port port +

True if either the source or destination port of the packet is port. +

dst portrange port1-port2 +

True if the packet is ip/tcp, ip/udp, ip6/tcp or ip6/udp and has a destination port value between port1 and port2. port1 and port2 are interpreted in the same fashion as the port parameter for port. +

src portrange port1-port2 +

True if the packet has a source port value between port1 and port2. +

portrange port1-port2 +

True if either the source or destination port of the packet is between port1 and port2. +

+

Any of the above port or port range expressions can be prepended with the keywords, tcp or udp, as in: +

+tcp src port port
+
+ +

+

which matches only tcp packets whose source port is port. +

less length +

True if the packet has a length less than or equal to length. This is equivalent to: +

+len <= length.
+
+ +

+

+

greater length +

True if the packet has a length greater than or equal to length. This is equivalent to: +

+len >= length.
+
+ +

+

+

ip proto protocol +

True if the packet is an IPv4 packet (see ip(4P)) of protocol type protocol. Protocol can be a number or one of the names icmp, icmp6, igmp, igrp, pim, ah, esp, vrrp, udp, or tcp. Note that the identifiers tcp, udp, and icmp are also keywords and must be escaped via backslash (\). Note that this primitive does not chase the protocol header chain. +

ip6 proto protocol +

True if the packet is an IPv6 packet of protocol type protocol. Note that this primitive does not chase the protocol header chain. +

proto protocol +

True if the packet is an IPv4 or IPv6 packet of protocol type protocol. Note that this primitive does not chase the protocol header chain. +

tcp, udp, icmp +

Abbreviations for: +

+proto p
+
+ +

+

where p is one of the above protocols. +

ip6 protochain protocol +

True if the packet is IPv6 packet, and contains protocol header with type protocol in its protocol header chain. For example, +

+ip6 protochain 6
+
+ +

+

matches any IPv6 packet with TCP protocol header in the protocol header chain. The packet may contain, for example, authentication header, routing header, or hop-by-hop option header, between IPv6 header and TCP header. The BPF code emitted by this primitive is complex and cannot be optimized by the BPF optimizer code, and is not supported by filter engines in the kernel, so this can be somewhat slow, and may cause more packets to be dropped. +

ip protochain protocol +

Equivalent to ip6 protochain protocol, but this is for IPv4. +

protochain protocol +

True if the packet is an IPv4 or IPv6 packet of protocol type protocol. Note that this primitive chases the protocol header chain. +

ether broadcast +

True if the packet is an Ethernet broadcast packet. The ether keyword is optional. +

ip broadcast +

True if the packet is an IPv4 broadcast packet. It checks for both the all-zeroes and all-ones broadcast conventions, and looks up the subnet mask on the interface on which the capture is being done. +

+

If the subnet mask of the interface on which the capture is being done is not available, either because the interface on which capture is being done has no netmask or because the capture is being done on the Linux "any" interface, which can capture on more than one interface, this check will not work correctly. +

ether multicast +

True if the packet is an Ethernet multicast packet. The ether keyword is optional. This is shorthand for `ether[0] & 1 != 0'. +

ip multicast +

True if the packet is an IPv4 multicast packet. +

ip6 multicast +

True if the packet is an IPv6 multicast packet. +

ether proto protocol +

True if the packet is of ether type protocol. Protocol can be a number or one of the names ip, ip6, arp, rarp, atalk, aarp, decnet, sca, lat, mopdl, moprc, iso, stp, ipx, or netbeui. Note these identifiers are also keywords and must be escaped via backslash (\). +

+

[In the case of FDDI (e.g., `fddi proto arp'), Token Ring (e.g., `tr proto arp'), and IEEE 802.11 wireless LANS (e.g., `wlan proto arp'), for most of those protocols, the protocol identification comes from the 802.2 Logical Link Control (LLC) header, which is usually layered on top of the FDDI, Token Ring, or 802.11 header. +

+

When filtering for most protocol identifiers on FDDI, Token Ring, or 802.11, the filter checks only the protocol ID field of an LLC header in so-called SNAP format with an Organizational Unit Identifier (OUI) of 0x000000, for encapsulated Ethernet; it doesn't check whether the packet is in SNAP format with an OUI of 0x000000. The exceptions are: +

+

iso the filter checks the DSAP (Destination Service Access Point) and SSAP (Source Service Access Point) fields of the LLC header; +

stp and netbeui the filter checks the DSAP of the LLC header; +

atalk the filter checks for a SNAP-format packet with an OUI of 0x080007 and the AppleTalk etype. +

+

+

In the case of Ethernet, the filter checks the Ethernet type field for most of those protocols. The exceptions are: +

+

iso, stp, and netbeui the filter checks for an 802.3 frame and then checks the LLC header as it does for FDDI, Token Ring, and 802.11; +

atalk the filter checks both for the AppleTalk etype in an Ethernet frame and for a SNAP-format packet as it does for FDDI, Token Ring, and 802.11; +

aarp the filter checks for the AppleTalk ARP etype in either an Ethernet frame or an 802.2 SNAP frame with an OUI of 0x000000; +

ipx the filter checks for the IPX etype in an Ethernet frame, the IPX DSAP in the LLC header, the 802.3-with-no-LLC-header encapsulation of IPX, and the IPX etype in a SNAP frame. +

+

ip, ip6, arp, rarp, atalk, aarp, decnet, iso, stp, ipx, netbeui +

Abbreviations for: +

+ether proto p
+
+ +

+

where p is one of the above protocols. +

lat, moprc, mopdl +

Abbreviations for: +

+ether proto p
+
+ +

+

where p is one of the above protocols. Note that not all applications using pcap(3PCAP) currently know how to parse these protocols. +

decnet src host +

True if the DECNET source address is host, which may be an address of the form ``10.123'', or a DECNET host name. [DECNET host name support is only available on ULTRIX systems that are configured to run DECNET.] +

decnet dst host +

True if the DECNET destination address is host. +

decnet host host +

True if either the DECNET source or destination address is host. +

llc +

True if the packet has an 802.2 LLC header. This includes: +

+

Ethernet packets with a length field rather than a type field that aren't raw NetWare-over-802.3 packets; +

+

IEEE 802.11 data packets; +

+

Token Ring packets (no check is done for LLC frames); +

+

FDDI packets (no check is done for LLC frames); +

+

LLC-encapsulated ATM packets, for SunATM on Solaris. +

llc \Fitype +

True if the packet has an 802.2 LLC header and has the specified type. type can be one of: +

+

i Information (I) PDUs +

s Supervisory (S) PDUs +

u Unnumbered (U) PDUs +

rr Receiver Ready (RR) S PDUs +

rnr Receiver Not Ready (RNR) S PDUs +

rej Reject (REJ) S PDUs +

ui Unnumbered Information (UI) U PDUs +

ua Unnumbered Acknowledgment (UA) U PDUs +

disc Disconnect (DISC) U PDUs +

sabme Set Asynchronous Balanced Mode Extended (SABME) U PDUs +

test Test (TEST) U PDUs +

xid Exchange Identification (XID) U PDUs +

frmr Frame Reject (FRMR) U PDUs +

+

inbound +

Packet was received by the host performing the capture rather than being sent by that host. This is only supported for certain link-layer types, such as SLIP and the ``cooked'' Linux capture mode used for the ``any'' device and for some other device types. +

outbound +

Packet was sent by the host performing the capture rather than being received by that host. This is only supported for certain link-layer types, such as SLIP and the ``cooked'' Linux capture mode used for the ``any'' device and for some other device types. +

ifname interface +

True if the packet was logged as coming from the specified interface (applies only to packets logged by OpenBSD's or FreeBSD's pf(4)). +

on interface +

Synonymous with the ifname modifier. +

rnr num +

True if the packet was logged as matching the specified PF rule number (applies only to packets logged by OpenBSD's or FreeBSD's pf(4)). +

rulenum num +

Synonymous with the rnr modifier. +

reason code +

True if the packet was logged with the specified PF reason code. The known codes are: match, bad-offset, fragment, short, normalize, and memory (applies only to packets logged by OpenBSD's or FreeBSD's pf(4)). +

rset name +

True if the packet was logged as matching the specified PF ruleset name of an anchored ruleset (applies only to packets logged by OpenBSD's or FreeBSD's pf(4)). +

ruleset name +

Synonymous with the rset modifier. +

srnr num +

True if the packet was logged as matching the specified PF rule number of an anchored ruleset (applies only to packets logged by OpenBSD's or FreeBSD's pf(4)). +

subrulenum num +

Synonymous with the srnr modifier. +

action act +

True if PF took the specified action when the packet was logged. Known actions are: pass and block and, with later versions of pf(4), nat, rdr, binat and scrub (applies only to packets logged by OpenBSD's or FreeBSD's pf(4)). +

wlan ra ehost +

True if the IEEE 802.11 RA is ehost. The RA field is used in all frames except for management frames. +

wlan ta ehost +

True if the IEEE 802.11 TA is ehost. The TA field is used in all frames except for management frames and CTS (Clear To Send) and ACK (Acknowledgment) control frames. +

wlan addr1 ehost +

True if the first IEEE 802.11 address is ehost. +

wlan addr2 ehost +

True if the second IEEE 802.11 address, if present, is ehost. The second address field is used in all frames except for CTS (Clear To Send) and ACK (Acknowledgment) control frames. +

wlan addr3 ehost +

True if the third IEEE 802.11 address, if present, is ehost. The third address field is used in management and data frames, but not in control frames. +

wlan addr4 ehost +

True if the fourth IEEE 802.11 address, if present, is ehost. The fourth address field is only used for WDS (Wireless Distribution System) frames. +

type wlan_type +

True if the IEEE 802.11 frame type matches the specified wlan_type. Valid wlan_types are: mgt, ctl and data. +

type wlan_type subtype wlan_subtype +

True if the IEEE 802.11 frame type matches the specified wlan_type and frame subtype matches the specified wlan_subtype. +

+

If the specified wlan_type is mgt, then valid wlan_subtypes are: assoc-req, assoc-resp, reassoc-req, reassoc-resp, probe-req, probe-resp, beacon, atim, disassoc, auth and deauth. +

+

If the specified wlan_type is ctl, then valid wlan_subtypes are: ps-poll, rts, cts, ack, cf-end and cf-end-ack. +

+

If the specified wlan_type is data, then valid wlan_subtypes are: data, data-cf-ack, data-cf-poll, data-cf-ack-poll, null, cf-ack, cf-poll, cf-ack-poll, qos-data, qos-data-cf-ack, qos-data-cf-poll, qos-data-cf-ack-poll, qos, qos-cf-poll and qos-cf-ack-poll. +

subtype wlan_subtype +

True if the IEEE 802.11 frame subtype matches the specified wlan_subtype and frame has the type to which the specified wlan_subtype belongs. +

dir dir +

True if the IEEE 802.11 frame direction matches the specified dir. Valid directions are: nods, tods, fromds, dstods, or a numeric value. +

vlan [vlan_id] +

True if the packet is an IEEE 802.1Q VLAN packet. If [vlan_id] is specified, only true if the packet has the specified vlan_id. Note that the first vlan keyword encountered in expression changes the decoding offsets for the remainder of expression on the assumption that the packet is a VLAN packet. The vlan [vlan_id] expression may be used more than once, to filter on VLAN hierarchies. Each use of that expression increments the filter offsets by 4. +

+

For example: +

+vlan 100 && vlan 200
+
+ +

+

filters on VLAN 200 encapsulated within VLAN 100, and +

+vlan && vlan 300 && ip
+
+ +

+

filters IPv4 protocols encapsulated in VLAN 300 encapsulated within any higher order VLAN. +

mpls [label_num] +

True if the packet is an MPLS packet. If [label_num] is specified, only true is the packet has the specified label_num. Note that the first mpls keyword encountered in expression changes the decoding offsets for the remainder of expression on the assumption that the packet is a MPLS-encapsulated IP packet. The mpls [label_num] expression may be used more than once, to filter on MPLS hierarchies. Each use of that expression increments the filter offsets by 4. +

+

For example: +

+mpls 100000 && mpls 1024
+
+ +

+

filters packets with an outer label of 100000 and an inner label of 1024, and +

+mpls && mpls 1024 && host 192.9.200.1
+
+ +

+

filters packets to or from 192.9.200.1 with an inner label of 1024 and any outer label. +

pppoed +

True if the packet is a PPP-over-Ethernet Discovery packet (Ethernet type 0x8863). +

pppoes [session_id] +

True if the packet is a PPP-over-Ethernet Session packet (Ethernet type 0x8864). If [session_id] is specified, only true if the packet has the specified session_id. Note that the first pppoes keyword encountered in expression changes the decoding offsets for the remainder of expression on the assumption that the packet is a PPPoE session packet. +

+

For example: +

+pppoes 0x27 && ip
+
+ +

+

filters IPv4 protocols encapsulated in PPPoE session id 0x27. +

geneve [vni] +

True if the packet is a Geneve packet (UDP port 6081). If [vni] is specified, only true if the packet has the specified vni. Note that when the geneve keyword is encountered in expression, it changes the decoding offsets for the remainder of expression on the assumption that the packet is a Geneve packet. +

+

For example: +

+geneve 0xb && ip
+
+ +

+

filters IPv4 protocols encapsulated in Geneve with VNI 0xb. This will match both IP directly encapsulated in Geneve as well as IP contained inside an Ethernet frame. +

iso proto protocol +

True if the packet is an OSI packet of protocol type protocol. Protocol can be a number or one of the names clnp, esis, or isis. +

clnp, esis, isis +

Abbreviations for: +

+iso proto p
+
+ +

+

where p is one of the above protocols. +

l1, l2, iih, lsp, snp, csnp, psnp +

Abbreviations for IS-IS PDU types. +

vpi n +

True if the packet is an ATM packet, for SunATM on Solaris, with a virtual path identifier of n. +

vci n +

True if the packet is an ATM packet, for SunATM on Solaris, with a virtual channel identifier of n. +

lane +

True if the packet is an ATM packet, for SunATM on Solaris, and is an ATM LANE packet. Note that the first lane keyword encountered in expression changes the tests done in the remainder of expression on the assumption that the packet is either a LANE emulated Ethernet packet or a LANE LE Control packet. If lane isn't specified, the tests are done under the assumption that the packet is an LLC-encapsulated packet. +

oamf4s +

True if the packet is an ATM packet, for SunATM on Solaris, and is a segment OAM F4 flow cell (VPI=0 & VCI=3). +

oamf4e +

True if the packet is an ATM packet, for SunATM on Solaris, and is an end-to-end OAM F4 flow cell (VPI=0 & VCI=4). +

oamf4 +

True if the packet is an ATM packet, for SunATM on Solaris, and is a segment or end-to-end OAM F4 flow cell (VPI=0 & (VCI=3 | VCI=4)). +

oam +

True if the packet is an ATM packet, for SunATM on Solaris, and is a segment or end-to-end OAM F4 flow cell (VPI=0 & (VCI=3 | VCI=4)). +

metac +

True if the packet is an ATM packet, for SunATM on Solaris, and is on a meta signaling circuit (VPI=0 & VCI=1). +

bcc +

True if the packet is an ATM packet, for SunATM on Solaris, and is on a broadcast signaling circuit (VPI=0 & VCI=2). +

sc +

True if the packet is an ATM packet, for SunATM on Solaris, and is on a signaling circuit (VPI=0 & VCI=5). +

ilmic +

True if the packet is an ATM packet, for SunATM on Solaris, and is on an ILMI circuit (VPI=0 & VCI=16). +

connectmsg +

True if the packet is an ATM packet, for SunATM on Solaris, and is on a signaling circuit and is a Q.2931 Setup, Call Proceeding, Connect, Connect Ack, Release, or Release Done message. +

metaconnect +

True if the packet is an ATM packet, for SunATM on Solaris, and is on a meta signaling circuit and is a Q.2931 Setup, Call Proceeding, Connect, Release, or Release Done message. +

expr relop expr +

True if the relation holds, where relop is one of >, <, >=, <=, =, !=, and expr is an arithmetic expression composed of integer constants (expressed in standard C syntax), the normal binary operators [+, -, *, /, %, &, |, ^, <<, >>], a length operator, and special packet data accessors. Note that all comparisons are unsigned, so that, for example, 0x80000000 and 0xffffffff are > 0. +

+

The % and ^ operators are currently only supported for filtering in the kernel on Linux with 3.7 and later kernels; on all other systems, if those operators are used, filtering will be done in user mode, which will increase the overhead of capturing packets and may cause more packets to be dropped. +

+

To access data inside the packet, use the following syntax: +

+proto [ expr : size ]
+
+ +

+

Proto is one of ether, fddi, tr, wlan, ppp, slip, link, ip, arp, rarp, tcp, udp, icmp, ip6 or radio, and indicates the protocol layer for the index operation. (ether, fddi, wlan, tr, ppp, slip and link all refer to the link layer. radio refers to the "radio header" added to some 802.11 captures.) Note that tcp, udp and other upper-layer protocol types only apply to IPv4, not IPv6 (this will be fixed in the future). The byte offset, relative to the indicated protocol layer, is given by expr. Size is optional and indicates the number of bytes in the field of interest; it can be either one, two, or four, and defaults to one. The length operator, indicated by the keyword len, gives the length of the packet. +

For example, `ether[0] & 1 != 0' catches all multicast traffic. The expression `ip[0] & 0xf != 5' catches all IPv4 packets with options. The expression `ip[6:2] & 0x1fff = 0' catches only unfragmented IPv4 datagrams and frag zero of fragmented IPv4 datagrams. This check is implicitly applied to the tcp and udp index operations. For instance, tcp[0] always means the first byte of the TCP header, and never means the first byte of an intervening fragment. +

Some offsets and field values may be expressed as names rather than as numeric values. The following protocol header field offsets are available: icmptype (ICMP type field), icmp6type (ICMP v6 type field) icmpcode (ICMP code field), icmp6code (ICMP v6 code field), and tcpflags (TCP flags field). +

The following ICMP type field values are available: icmp-echoreply, icmp-unreach, icmp-sourcequench, icmp-redirect, icmp-echo, icmp-routeradvert, icmp-routersolicit, icmp-timxceed, icmp-paramprob, icmp-tstamp, icmp-tstampreply, icmp-ireq, icmp-ireqreply, icmp-maskreq, icmp-maskreply. +

The following ICMPv6 type fields are available: icmp6-echo, icmp6-echoreply, icmp6-multicastlistenerquery, icmp6-multicastlistenerreportv1, icmp6-multicastlistenerdone, icmp6-routersolicit, icmp6-routeradvert, icmp6-neighborsolicit, icmp6-neighboradvert, icmp6-redirect, icmp6-routerrenum, icmp6-nodeinformationquery, icmp6-nodeinformationresponse, icmp6-ineighbordiscoverysolicit, icmp6-ineighbordiscoveryadvert, icmp6-multicastlistenerreportv2, icmp6-homeagentdiscoveryrequest, icmp6-homeagentdiscoveryreply, icmp6-mobileprefixsolicit, icmp6-mobileprefixadvert, icmp6-certpathsolicit, icmp6-certpathadvert, icmp6-multicastrouteradvert, icmp6-multicastroutersolicit, icmp6-multicastrouterterm. +

The following TCP flags field values are available: tcp-fin, tcp-syn, tcp-rst, tcp-push, tcp-ack, tcp-urg, tcp-ece, tcp-cwr. +

Primitives may be combined using: +

+

A parenthesized group of primitives and operators. +

+

Negation (`!' or `not'). +

+

Concatenation (`&&' or `and'). +

+

Alternation (`||' or `or'). +

Negation has highest precedence. Alternation and concatenation have equal precedence and associate left to right. Note that explicit and tokens, not juxtaposition, are now required for concatenation. +

If an identifier is given without a keyword, the most recent keyword is assumed. For example, +

+not host vs and ace
+
+ +

+

is short for +

+not host vs and host ace
+
+ +

+

which should not be confused with +

+not ( host vs or ace )
+
+ +

+

EXAMPLES

+

+

To select all packets arriving at or departing from sundown: +

+host sundown
+
+ +

+

+

To select traffic between helios and either hot or ace: +

+host helios and \( hot or ace \)
+
+ +

+

+

To select all IP packets between ace and any host except helios: +

+ip host ace and not helios
+
+ +

+

+

To select all traffic between local hosts and hosts at Berkeley: +

+ 
+net ucb-ether
+
+ +

+

+

To select all ftp traffic through internet gateway snup: +

+ 
+gateway snup and (port ftp or ftp-data)
+
+ +

+

+

To select traffic neither sourced from nor destined for local hosts (if you gateway to one other net, this stuff should never make it onto your local net). +

+ 
+ip and not net localnet
+
+ +

+

+

To select the start and end packets (the SYN and FIN packets) of each TCP conversation that involves a non-local host. +

+ 
+tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net localnet
+
+ +

+

+

To select all IPv4 HTTP packets to and from port 80, i.e. print only packets that contain data, not, for example, SYN and FIN packets and ACK-only packets. (IPv6 is left as an exercise for the reader.) +

+ 
+tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)
+
+ +

+

+

To select IP packets longer than 576 bytes sent through gateway snup: +

+ 
+gateway snup and ip[2:2] > 576
+
+ +

+

+

To select IP broadcast or multicast packets that were not sent via Ethernet broadcast or multicast: +

+ 
+ether[0] & 1 = 0 and ip[16] >= 224
+
+ +

+

+

To select all ICMP packets that are not echo requests/replies (i.e., not ping packets): +

+ 
+icmp[icmptype] != icmp-echo and icmp[icmptype] != icmp-echoreply
+
+ +

+

SEE ALSO

+

pcap(3PCAP)

BUGS

+

To report a security issue please send an e-mail to security@tcpdump.org. +

To report bugs and other problems, contribute patches, request a feature, provide generic feedback etc please see the file CONTRIBUTING in the libpcap source tree root. +

Filter expressions on fields other than those in Token Ring headers will not correctly handle source-routed Token Ring packets. +

Filter expressions on fields other than those in 802.11 headers will not correctly handle 802.11 data packets with both To DS and From DS set. +

ip6 proto should chase header chain, but at this moment it does not. ip6 protochain is supplied for this behavior. +

Arithmetic expression against transport layer headers, like tcp[0], does not work against IPv6 packets. It only looks at IPv4 packets.

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap-linktype.html b/network/start/lib/npcap/docs/wpcap/pcap-linktype.html new file mode 100644 index 0000000..830356c --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap-linktype.html @@ -0,0 +1,60 @@ + + +PCAP-LINKTYPE man page + + + + +

NAME

+

pcap-linktype - link-layer header types supported by libpcap

DESCRIPTION

+

For a live capture or ``savefile'', libpcap supplies, as the return value of the pcap_datalink(3PCAP) routine, a value that indicates the type of link-layer header at the beginning of the packets it provides. This is not necessarily the type of link-layer header that the packets being captured have on the network from which they're being captured; for example, packets from an IEEE 802.11 network might be provided by libpcap with Ethernet headers that the network adapter or the network adapter driver generates from the 802.11 headers. The names for those values begin with DLT_, so they are sometimes called "DLT_ values". +

The values stored in the link-layer header type field in the savefile header are, in most but not all cases, the same as the values returned by pcap_datalink(). The names for those values begin with LINKTYPE_. +

The link-layer header types supported by libpcap are described at https://www.tcpdump.org/linktypes.html.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap-savefile.html b/network/start/lib/npcap/docs/wpcap/pcap-savefile.html new file mode 100644 index 0000000..58d0942 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap-savefile.html @@ -0,0 +1,84 @@ + + +PCAP-SAVEFILE man page + + + + +

NAME

+

pcap-savefile - libpcap savefile format

DESCRIPTION

+

NOTE: applications and libraries should, if possible, use libpcap to read savefiles, rather than having their own code to read savefiles. If, in the future, a new file format is supported by libpcap, applications and libraries using libpcap to read savefiles will be able to read the new format of savefiles, but applications and libraries using their own code to read savefiles will have to be changed to support the new file format. +

``Savefiles'' read and written by libpcap and applications using libpcap start with a per-file header. The format of the per-file header is: +

+

box; c s c | c c s. Magic number _ Major version Minor version _ Time zone offset _ Time stamp accuracy _ Snapshot length _ Link-layer header type +

+

+

All fields in the per-file header are in the byte order of the host writing the file. Normally, the first field in the per-file header is a 4-byte magic number, with the value 0xa1b2c3d4. The magic number, when read by a host with the same byte order as the host that wrote the file, will have the value 0xa1b2c3d4, and, when read by a host with the opposite byte order as the host that wrote the file, will have the value 0xd4c3b2a1. That allows software reading the file to determine whether the byte order of the host that wrote the file is the same as the byte order of the host on which the file is being read, and thus whether the values in the per-file and per-packet headers need to be byte-swapped. +

If the magic number has the value 0xa1b23c4d (with the two nibbles of the two lower-order bytes of the magic number swapped), which would be read as 0xa1b23c4d by a host with the same byte order as the host that wrote the file and as 0x4d3cb2a1 by a host with the opposite byte order as the host that wrote the file, the file format is the same as for regular files, except that the time stamps for packets are given in seconds and nanoseconds rather than seconds and microseconds. +

Following this are: +

+

A 2-byte file format major version number; the current version number is 2. +

+

A 2-byte file format minor version number; the current version number is 4. +

+

A 4-byte time zone offset; this is always 0. +

+

A 4-byte number giving the accuracy of time stamps in the file; this is always 0. +

+

A 4-byte number giving the "snapshot length" of the capture; packets longer than the snapshot length are truncated to the snapshot length, so that, if the snapshot length is N, only the first N bytes of a packet longer than N bytes will be saved in the capture. +

+

a 4-byte number giving the link-layer header type for packets in the capture; see pcap-linktype(7) for the LINKTYPE_ values that can appear in this field. +

Following the per-file header are zero or more packets; each packet begins with a per-packet header, which is immediately followed by the raw packet data. The format of the per-packet header is: +

+

box; c. Time stamp, seconds value _ Time stamp, microseconds or nanoseconds value _ Length of captured packet data _ Un-truncated length of the packet data +

+

+

All fields in the per-packet header are in the byte order of the host writing the file. The per-packet header begins with a time stamp giving the approximate time the packet was captured; the time stamp consists of a 4-byte value, giving the time in seconds since January 1, 1970, 00:00:00 UTC, followed by a 4-byte value, giving the time in microseconds or nanoseconds since that second, depending on the magic number in the file header. Following that are a 4-byte value giving the number of bytes of captured data that follow the per-packet header and a 4-byte value giving the number of bytes that would have been present had the packet not been truncated by the snapshot length. The two lengths will be equal if the number of bytes of packet data are less than or equal to the snapshot length.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap-tstamp.html b/network/start/lib/npcap/docs/wpcap/pcap-tstamp.html new file mode 100644 index 0000000..cd24d27 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap-tstamp.html @@ -0,0 +1,82 @@ + + +PCAP-TSTAMP man page + + + + +

NAME

+

pcap-tstamp - packet time stamps in libpcap

DESCRIPTION

+

When capturing traffic, each packet is given a time stamp representing, for incoming packets, the arrival time of the packet and, for outgoing packets, the transmission time of the packet. This time is an approximation of the arrival or transmission time. If it is supplied by the operating system running on the host on which the capture is being done, there are several reasons why it might not precisely represent the arrival or transmission time: +

+

if the time stamp is applied to the packet when the networking stack receives the packet, the networking stack might not see the packet until an interrupt is delivered for the packet or a timer event causes the networking device driver to poll for packets, and the time stamp might not be applied until the packet has had some processing done by other code in the networking stack, so there might be a significant delay between the time when the last bit of the packet is received by the capture device and when the networking stack time-stamps the packet; +

+

the timer used to generate the time stamps might have low resolution, for example, it might be a timer updated once per host operating system timer tick, with the host operating system timer ticking once every few milliseconds; +

+

a high-resolution timer might use a counter that runs at a rate dependent on the processor clock speed, and that clock speed might be adjusted upwards or downwards over time and the timer might not be able to compensate for all those adjustments; +

+

the host operating system's clock might be adjusted over time to match a time standard to which the host is being synchronized, which might be done by temporarily slowing down or speeding up the clock or by making a single adjustment; +

+

different CPU cores on a multi-core or multi-processor system might be running at different speeds, or might not have time counters all synchronized, so packets time-stamped by different cores might not have consistent time stamps. +

In addition, packets time-stamped by different cores might be time-stamped in one order and added to the queue of packets for libpcap to read in another order, so time stamps might not be monotonically increasing. +

Some capture devices on some platforms can provide time stamps for packets; those time stamps are usually high-resolution time stamps, and are usually applied to the packet when the first or last bit of the packet arrives, and are thus more accurate than time stamps provided by the host operating system. Those time stamps might not, however, be synchronized with the host operating system's clock, so that, for example, the time stamp of a packet might not correspond to the time stamp of an event on the host triggered by the arrival of that packet. +

Depending on the capture device and the software on the host, libpcap might allow different types of time stamp to be used. The pcap_list_tstamp_types(3PCAP) routine provides, for a packet capture handle created by pcap_create(3PCAP) but not yet activated by pcap_activate(3PCAP), a list of time stamp types supported by the capture device for that handle. The list might be empty, in which case no choice of time stamp type is offered for that capture device. If the list is not empty, the pcap_set_tstamp_type(3PCAP) routine can be used after a pcap_create() call and before a pcap_activate() call to specify the type of time stamp to be used on the device. The time stamp types are listed here; the first value is the #define to use in code, the second value is the value returned by pcap_tstamp_type_val_to_name and accepted by pcap_tstamp_type_name_to_val. +

+

PCAP_TSTAMP_HOST - host Time stamp provided by the host on which the capture is being done. The precision of this time stamp is unspecified; it might or might not be synchronized with the host operating system's clock. +

PCAP_TSTAMP_HOST_LOWPREC - host_lowprec Time stamp provided by the host on which the capture is being done. This is a low-precision time stamp, synchronized with the host operating system's clock. +

PCAP_TSTAMP_HOST_HIPREC - host_hiprec Time stamp provided by the host on which the capture is being done. This is a high-precision time stamp; it might or might not be synchronized with the host operating system's clock. It might be more expensive to fetch than PCAP_TSTAMP_HOST_LOWPREC. +

PCAP_TSTAMP_ADAPTER - adapter Time stamp provided by the network adapter on which the capture is being done. This is a high-precision time stamp, synchronized with the host operating system's clock. +

PCAP_TSTAMP_ADAPTER_UNSYNCED - adapter_unsynced Time stamp provided by the network adapter on which the capture is being done. This is a high-precision time stamp; it is not synchronized with the host operating system's clock. +

+

By default, when performing a live capture or reading from a savefile, time stamps are supplied as seconds since January 1, 1970, 00:00:00 UTC, and microseconds since that seconds value, even if higher-resolution time stamps are available from the capture device or in the savefile. If, when reading a savefile, the time stamps in the file have a higher resolution than one microsecond, the additional digits of resolution are discarded. +

The pcap_set_tstamp_precision(3PCAP) routine can be used after a pcap_create() call and after a pcap_activate() call to specify the resolution of the time stamps to get for the device. If the hardware or software cannot supply a higher-resolution time stamp, the pcap_set_tstamp_precision() call will fail, and the time stamps supplied after the pcap_activate() call will have microsecond resolution. +

When opening a savefile, the \%pcap_open_offline_with_tstamp_precision(3PCAP) and \%pcap_fopen_offline_with_tstamp_precision(3PCAP) routines can be used to specify the resolution of time stamps to be read from the file; if the time stamps in the file have a lower resolution, the fraction-of-a-second portion of the time stamps will be scaled to the specified resolution. +

The pcap_get_tstamp_precision(3PCAP) routine returns the resolution of time stamps that will be supplied; when capturing packets, this does not reflect the actual precision of the time stamp supplied by the hardware or operating system and, when reading a savefile, this does not indicate the actual precision of time stamps in the file.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap.html b/network/start/lib/npcap/docs/wpcap/pcap.html new file mode 100644 index 0000000..3d0e8cb --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap.html @@ -0,0 +1,269 @@ + + +3PCAP man page + + + + +

NAME

+

pcap - Packet Capture library

SYNOPSIS

+

+#include <pcap/pcap.h>
+
+ +

DESCRIPTION

+

The Packet Capture library provides a high level interface to packet capture systems. All packets on the network, even those destined for other hosts, are accessible through this mechanism. It also supports saving captured packets to a ``savefile'', and reading packets from a ``savefile''.

Opening a capture handle for reading

+

To open a handle for a live capture, given the name of the network or other interface on which the capture should be done, call pcap_create(), set the appropriate options on the handle, and then activate it with pcap_activate(). +

To obtain a list of devices that can be opened for a live capture, call pcap_findalldevs(); to free the list returned by pcap_findalldevs(), call pcap_freealldevs(). pcap_lookupdev() will return the first device on that list that is not a ``loopback`` network interface. +

To open a handle for a ``savefile'' from which to read packets, given the pathname of the ``savefile'', call pcap_open_offline(); to set up a handle for a ``savefile'', given a FILE\ * referring to a file already opened for reading, call pcap_fopen_offline(). +

In order to get a ``fake'' pcap_t for use in routines that require a pcap_t as an argument, such as routines to open a ``savefile'' for writing and to compile a filter expression, call pcap_open_dead(). +

pcap_create(), pcap_open_offline(), pcap_fopen_offline(), and pcap_open_dead() return a pointer to a pcap_t, which is the handle used for reading packets from the capture stream or the ``savefile'', and for finding out information about the capture stream or ``savefile''. To close a handle, use pcap_close(). +

The options that can be set on a capture handle include +

snapshot length +

If, when capturing, you capture the entire contents of the packet, that requires more CPU time to copy the packet to your application, more disk and possibly network bandwidth to write the packet data to a file, and more disk space to save the packet. If you don't need the entire contents of the packet - for example, if you are only interested in the TCP headers of packets - you can set the "snapshot length" for the capture to an appropriate value. If the snapshot length is set to snaplen, and snaplen is less than the size of a packet that is captured, only the first snaplen bytes of that packet will be captured and provided as packet data. +

+

A snapshot length of 65535 should be sufficient, on most if not all networks, to capture all the data available from the packet. +

+

The snapshot length is set with pcap_set_snaplen(). +

promiscuous mode +

On broadcast LANs such as Ethernet, if the network isn't switched, or if the adapter is connected to a "mirror port" on a switch to which all packets passing through the switch are sent, a network adapter receives all packets on the LAN, including unicast or multicast packets not sent to a network address that the network adapter isn't configured to recognize. +

+

Normally, the adapter will discard those packets; however, many network adapters support "promiscuous mode", which is a mode in which all packets, even if they are not sent to an address that the adapter recognizes, are provided to the host. This is useful for passively capturing traffic between two or more other hosts for analysis. +

+

Note that even if an application does not set promiscuous mode, the adapter could well be in promiscuous mode for some other reason. +

+

For now, this doesn't work on the "any" device; if an argument of "any" or NULL is supplied, the setting of promiscuous mode is ignored. +

+

Promiscuous mode is set with pcap_set_promisc(). +

monitor mode +

On IEEE 802.11 wireless LANs, even if an adapter is in promiscuous mode, it will supply to the host only frames for the network with which it's associated. It might also supply only data frames, not management or control frames, and might not provide the 802.11 header or radio information pseudo-header for those frames. +

+

In "monitor mode", sometimes also called "rfmon mode" (for "Radio Frequency MONitor"), the adapter will supply all frames that it receives, with 802.11 headers, and might supply a pseudo-header with radio information about the frame as well. +

+

Note that in monitor mode the adapter might disassociate from the network with which it's associated, so that you will not be able to use any wireless networks with that adapter. This could prevent accessing files on a network server, or resolving host names or network addresses, if you are capturing in monitor mode and are not connected to another network with another adapter. +

+

Monitor mode is set with pcap_set_rfmon(), and pcap_can_set_rfmon() can be used to determine whether an adapter can be put into monitor mode. +

packet buffer timeout +

If, when capturing, packets are delivered as soon as they arrive, the application capturing the packets will be woken up for each packet as it arrives, and might have to make one or more calls to the operating system to fetch each packet. +

+

If, instead, packets are not delivered as soon as they arrive, but are delivered after a short delay (called a "packet buffer timeout"), more than one packet can be accumulated before the packets are delivered, so that a single wakeup would be done for multiple packets, and each set of calls made to the operating system would supply multiple packets, rather than a single packet. This reduces the per-packet CPU overhead if packets are arriving at a high rate, increasing the number of packets per second that can be captured. +

+

The packet buffer timeout is required so that an application won't wait for the operating system's capture buffer to fill up before packets are delivered; if packets are arriving slowly, that wait could take an arbitrarily long period of time. +

+

Not all platforms support a packet buffer timeout; on platforms that don't, the packet buffer timeout is ignored. A zero value for the timeout, on platforms that support a packet buffer timeout, will cause a read to wait forever to allow enough packets to arrive, with no timeout. A negative value is invalid; the result of setting the timeout to a negative value is unpredictable. +

+

NOTE: the packet buffer timeout cannot be used to cause calls that read packets to return within a limited period of time, because, on some platforms, the packet buffer timeout isn't supported, and, on other platforms, the timer doesn't start until at least one packet arrives. This means that the packet buffer timeout should NOT be used, for example, in an interactive application to allow the packet capture loop to ``poll'' for user input periodically, as there's no guarantee that a call reading packets will return after the timeout expires even if no packets have arrived. +

+

The packet buffer timeout is set with pcap_set_timeout(). +

immediate mode +

In immediate mode, packets are always delivered as soon as they arrive, with no buffering. Immediate mode is set with pcap_set_immediate_mode(). +

buffer size +

Packets that arrive for a capture are stored in a buffer, so that they do not have to be read by the application as soon as they arrive. On some platforms, the buffer's size can be set; a size that's too small could mean that, if too many packets are being captured and the snapshot length doesn't limit the amount of data that's buffered, packets could be dropped if the buffer fills up before the application can read packets from it, while a size that's too large could use more non-pageable operating system memory than is necessary to prevent packets from being dropped. +

+

The buffer size is set with pcap_set_buffer_size(). +

timestamp type +

On some platforms, the time stamp given to packets on live captures can come from different sources that can have different resolutions or that can have different relationships to the time values for the current time supplied by routines on the native operating system. See pcap-tstamp(7) for a list of time stamp types. +

+

The time stamp type is set with pcap_set_tstamp_type(). +

Reading packets from a network interface may require that you have special privileges: +

Under SunOS 3.x or 4.x with NIT or BPF: You must have read access to /dev/nit or /dev/bpf*. +

Under Solaris with DLPI: You must have read/write access to the network pseudo device, e.g. /dev/le. On at least some versions of Solaris, however, this is not sufficient to allow tcpdump to capture in promiscuous mode; on those versions of Solaris, you must be root, or the application capturing packets must be installed setuid to root, in order to capture in promiscuous mode. Note that, on many (perhaps all) interfaces, if you don't capture in promiscuous mode, you will not see any outgoing packets, so a capture not done in promiscuous mode may not be very useful. +

+

In newer versions of Solaris, you must have been given the net_rawaccess privilege; this is both necessary and sufficient to give you access to the network pseudo-device - there is no need to change the privileges on that device. A user can be given that privilege by, for example, adding that privilege to the user's defaultpriv key with the usermod (@MAN_ADMIN_COMMANDS@) command. +

Under HP-UX with DLPI: You must be root or the application capturing packets must be installed setuid to root. +

Under IRIX with snoop: You must be root or the application capturing packets must be installed setuid to root. +

Under Linux: You must be root or the application capturing packets must be installed setuid to root (unless your distribution has a kernel that supports capability bits such as CAP_NET_RAW and code to allow those capability bits to be given to particular accounts and to cause those bits to be set on a user's initial processes when they log in, in which case you must have CAP_NET_RAW in order to capture and CAP_NET_ADMIN to enumerate network devices with, for example, the -D flag). +

Under ULTRIX and Digital UNIX/Tru64 UNIX: Any user may capture network traffic. However, no user (not even the super-user) can capture in promiscuous mode on an interface unless the super-user has enabled promiscuous-mode operation on that interface using pfconfig(8), and no user (not even the super-user) can capture unicast traffic received by or sent by the machine on an interface unless the super-user has enabled copy-all-mode operation on that interface using pfconfig, so useful packet capture on an interface probably requires that either promiscuous-mode or copy-all-mode operation, or both modes of operation, be enabled on that interface. +

Under BSD (this includes macOS): You must have read access to /dev/bpf* on systems that don't have a cloning BPF device, or to /dev/bpf on systems that do. On BSDs with a devfs (this includes macOS), this might involve more than just having somebody with super-user access setting the ownership or permissions on the BPF devices - it might involve configuring devfs to set the ownership or permissions every time the system is booted, if the system even supports that; if it doesn't support that, you might have to find some other way to make that happen at boot time. +

Reading a saved packet file doesn't require special privileges. +

The packets read from the handle may include a ``pseudo-header'' containing various forms of packet meta-data, and probably includes a link-layer header whose contents can differ for different network interfaces. To determine the format of the packets supplied by the handle, call pcap_datalink(); https://www.tcpdump.org/linktypes.html lists the values it returns and describes the packet formats that correspond to those values. +

Do NOT assume that the packets for a given capture or ``savefile`` will have any given link-layer header type, such as DLT_EN10MB for Ethernet. For example, the "any" device on Linux will have a link-layer header type of DLT_LINUX_SLL even if all devices on the system at the time the "any" device is opened have some other data link type, such as DLT_EN10MB for Ethernet. +

To obtain the FILE\ * corresponding to a pcap_t opened for a ``savefile'', call pcap_file(). +

Routines +

+

pcap_create(3PCAP) get a pcap_t for live capture +

pcap_activate(3PCAP) activate a pcap_t for live capture +

pcap_findalldevs(3PCAP) get a list of devices that can be opened for a live capture +

pcap_freealldevs(3PCAP) free list of devices +

pcap_lookupdev(3PCAP) get first non-loopback device on that list +

pcap_open_offline(3PCAP) open a pcap_t for a ``savefile'', given a pathname +

pcap_open_offline_with_tstamp_precision(3PCAP) open a pcap_t for a ``savefile'', given a pathname, and specify the precision to provide for packet time stamps +

pcap_fopen_offline(3PCAP) open a pcap_t for a ``savefile'', given a FILE\ * +

pcap_fopen_offline_with_tstamp_precision(3PCAP) open a pcap_t for a ``savefile'', given a FILE\ *, and specify the precision to provide for packet time stamps +

pcap_open_dead(3PCAP) create a ``fake'' pcap_t +

pcap_close(3PCAP) close a pcap_t +

pcap_set_snaplen(3PCAP) set the snapshot length for a not-yet-activated pcap_t for live capture +

pcap_snapshot(3PCAP) get the snapshot length for a pcap_t +

pcap_set_promisc(3PCAP) set promiscuous mode for a not-yet-activated pcap_t for live capture +

pcap_set_protocol_linux(3PCAP) set capture protocol for a not-yet-activated pcap_t for live capture (Linux only) +

pcap_set_rfmon(3PCAP) set monitor mode for a not-yet-activated pcap_t for live capture +

pcap_can_set_rfmon(3PCAP) determine whether monitor mode can be set for a pcap_t for live capture +

pcap_set_timeout(3PCAP) set packet buffer timeout for a not-yet-activated pcap_t for live capture +

pcap_set_immediate_mode(3PCAP) set immediate mode for a not-yet-activated pcap_t for live capture +

pcap_set_buffer_size(3PCAP) set buffer size for a not-yet-activated pcap_t for live capture +

pcap_set_tstamp_type(3PCAP) set time stamp type for a not-yet-activated pcap_t for live capture +

pcap_list_tstamp_types(3PCAP) get list of available time stamp types for a not-yet-activated pcap_t for live capture +

pcap_free_tstamp_types(3PCAP) free list of available time stamp types +

pcap_tstamp_type_val_to_name(3PCAP) get name for a time stamp type +

pcap_tstamp_type_val_to_description(3PCAP) get description for a time stamp type +

pcap_tstamp_type_name_to_val(3PCAP) get time stamp type corresponding to a name +

pcap_set_tstamp_precision(3PCAP) set time stamp precision for a not-yet-activated pcap_t for live capture +

pcap_get_tstamp_precision(3PCAP) get the time stamp precision of a pcap_t for live capture +

pcap_datalink(3PCAP) get link-layer header type for a pcap_t +

pcap_file(3PCAP) get the FILE\ * for a pcap_t opened for a ``savefile'' +

pcap_is_swapped(3PCAP) determine whether a ``savefile'' being read came from a machine with the opposite byte order +

pcap_major_version(3PCAP) +

+

pcap_minor_version(3PCAP) get the major and minor version of the file format version for a ``savefile'' +

+

Selecting a link-layer header type for a live capture

+

Some devices may provide more than one link-layer header type. To obtain a list of all link-layer header types provided by a device, call pcap_list_datalinks() on an activated pcap_t for the device. To free a list of link-layer header types, call pcap_free_datalinks(). To set the link-layer header type for a device, call pcap_set_datalink(). This should be done after the device has been activated but before any packets are read and before any filters are compiled or installed. +

Routines +

+

pcap_list_datalinks(3PCAP) get a list of link-layer header types for a device +

pcap_free_datalinks(3PCAP) free list of link-layer header types +

pcap_set_datalink(3PCAP) set link-layer header type for a device +

pcap_datalink_val_to_name(3PCAP) get name for a link-layer header type +

pcap_datalink_val_to_description(3PCAP) get description for a link-layer header type +

pcap_datalink_name_to_val(3PCAP) get link-layer header type corresponding to a name +

Reading packets

+

Packets are read with pcap_dispatch() or pcap_loop(), which process one or more packets, calling a callback routine for each packet, or with pcap_next() or pcap_next_ex(), which return the next packet. The callback for pcap_dispatch() and pcap_loop() is supplied a pointer to a struct pcap_pkthdr, which includes the following members: +

+

ts a struct timeval containing the time when the packet was captured +

caplen a bpf_u_int32 giving the number of bytes of the packet that are available from the capture +

len a bpf_u_int32 giving the length of the packet, in bytes (which might be more than the number of bytes available from the capture, if the length of the packet is larger than the maximum number of bytes to capture). +

+

The callback is also supplied a const u_char pointer to the first caplen (as given in the struct pcap_pkthdr mentioned above) bytes of data from the packet. This won't necessarily be the entire packet; to capture the entire packet, you will have to provide a value for snaplen in your call to pcap_set_snaplen() that is sufficiently large to get all of the packet's data - a value of 65535 should be sufficient on most if not all networks). When reading from a ``savefile'', the snapshot length specified when the capture was performed will limit the amount of packet data available. +

pcap_next() is passed an argument that points to a struct pcap_pkthdr structure, and fills it in with the time stamp and length values for the packet. It returns a const u_char to the first caplen bytes of the packet on success, and NULL on error. +

pcap_next_ex() is passed two pointer arguments, one of which points to a structpcap_pkthdr* and one of which points to a const u_char*. It sets the first pointer to point to a struct pcap_pkthdr structure with the time stamp and length values for the packet, and sets the second pointer to point to the first caplen bytes of the packet. +

To force the loop in pcap_dispatch() or pcap_loop() to terminate, call pcap_breakloop(). +

By default, when reading packets from an interface opened for a live capture, pcap_dispatch(), pcap_next(), and pcap_next_ex() will, if no packets are currently available to be read, block waiting for packets to become available. On some, but not all, platforms, if a packet buffer timeout was specified, the wait will terminate after the packet buffer timeout expires; applications should be prepared for this, as it happens on some platforms, but should not rely on it, as it does not happen on other platforms. Note that the wait might, or might not, terminate even if no packets are available; applications should be prepared for this to happen, but must not rely on it happening. +

A handle can be put into ``non-blocking mode'', so that those routines will, rather than blocking, return an indication that no packets are available to read. Call pcap_setnonblock() to put a handle into non-blocking mode or to take it out of non-blocking mode; call pcap_getnonblock() to determine whether a handle is in non-blocking mode. Note that non-blocking mode does not work correctly in Mac OS X 10.6. +

Non-blocking mode is often combined with routines such as select(2) or poll(2) or other routines a platform offers to wait for any of a set of descriptors to be ready to read. To obtain, for a handle, a descriptor that can be used in those routines, call pcap_get_selectable_fd(). If the routine indicates that data is available to read on the descriptor, an attempt should be made to read from the device. +

Not all handles have such a descriptor available; pcap_get_selectable_fd() will return PCAP_ERROR if no such descriptor is available. If no such descriptor is available, this may be because the device must be polled periodically for packets; in that case, pcap_get_required_select_timeout() will return a pointer to a struct timeval whose value can be used as a timeout in those routines. When the routine returns, an attmept should be made to read packets from the device. If pcap_get_required_select_timeout() returns NULL, no such timeout is available, and those routines cannot be used with the device. +

In addition, for various reasons, one or more of those routines will not work properly with the descriptor; the documentation for pcap_get_selectable_fd() gives details. Note that, just as an attempt to read packets from a pcap_t may not return any packets if the packet buffer timeout expires, a select(), poll(), or other such call may, if the packet buffer timeout expires, indicate that a descriptor is ready to read even if there are no packets available to read. +

Routines +

+

pcap_dispatch(3PCAP) read a bufferful of packets from a pcap_t open for a live capture or the full set of packets from a pcap_t open for a ``savefile'' +

pcap_loop(3PCAP) read packets from a pcap_t until an interrupt or error occurs +

pcap_next(3PCAP) read the next packet from a pcap_t without an indication whether an error occurred +

pcap_next_ex(3PCAP) read the next packet from a pcap_t with an error indication on an error +

pcap_breakloop(3PCAP) prematurely terminate the loop in pcap_dispatch() or pcap_loop() +

pcap_setnonblock(3PCAP) set or clear non-blocking mode on a pcap_t +

pcap_getnonblock(3PCAP) get the state of non-blocking mode for a pcap_t +

pcap_get_selectable_fd(3PCAP) attempt to get a descriptor for a pcap_t that can be used in calls such as select(2) and poll(2) +

pcap_get_required_select_timeout(3PCAP) if no descriptor usable with select(2) and poll(2) is available for the pcap_t, attempt to get a timeout usable with those routines +

Filters

+

In order to cause only certain packets to be returned when reading packets, a filter can be set on a handle. For a live capture, the filtering will be performed in kernel mode, if possible, to avoid copying ``uninteresting'' packets from the kernel to user mode. +

A filter can be specified as a text string; the syntax and semantics of the string are as described by pcap-filter(7). A filter string is compiled into a program in a pseudo-machine-language by pcap_compile() and the resulting program can be made a filter for a handle with pcap_setfilter(). The result of pcap_compile() can be freed with a call to pcap_freecode(). pcap_compile() may require a network mask for certain expressions in the filter string; pcap_lookupnet() can be used to find the network address and network mask for a given capture device. +

A compiled filter can also be applied directly to a packet that has been read using pcap_offline_filter(). +

Routines +

+

pcap_compile(3PCAP) compile filter expression to a pseudo-machine-language code program +

pcap_freecode(3PCAP) free a filter program +

pcap_setfilter(3PCAP) set filter for a pcap_t +

pcap_lookupnet(3PCAP) get network address and network mask for a capture device +

pcap_offline_filter(3PCAP) apply a filter program to a packet +

Incoming and outgoing packets

+

By default, libpcap will attempt to capture both packets sent by the machine and packets received by the machine. To limit it to capturing only packets received by the machine or, if possible, only packets sent by the machine, call pcap_setdirection(). +

Routines +

+

pcap_setdirection(3PCAP) specify whether to capture incoming packets, outgoing packets, or both +

Capture statistics

+

To get statistics about packets received and dropped in a live capture, call pcap_stats(). +

Routines +

+

pcap_stats(3PCAP) get capture statistics +

Opening a handle for writing captured packets

+

To open a ``savefile`` to which to write packets, given the pathname the ``savefile'' should have, call pcap_dump_open(). To open a ``savefile`` to which to write packets, given the pathname the ``savefile'' should have, call pcap_dump_open(); to set up a handle for a ``savefile'', given a FILE\ * referring to a file already opened for writing, call pcap_dump_fopen(). They each return pointers to a pcap_dumper_t, which is the handle used for writing packets to the ``savefile''. If it succeeds, it will have created the file if it doesn't exist and truncated the file if it does exist. To close a pcap_dumper_t, call pcap_dump_close(). +

Routines +

+

pcap_dump_open(3PCAP) open a pcap_dumper_t for a ``savefile``, given a pathname +

pcap_dump_fopen(3PCAP) open a pcap_dumper_t for a ``savefile``, given a FILE\ * +

pcap_dump_close(3PCAP) close a pcap_dumper_t +

pcap_dump_file(3PCAP) get the FILE\ * for a pcap_dumper_t opened for a ``savefile'' +

Writing packets

+

To write a packet to a pcap_dumper_t, call pcap_dump(). Packets written with pcap_dump() may be buffered, rather than being immediately written to the ``savefile''. Closing the pcap_dumper_t will cause all buffered-but-not-yet-written packets to be written to the ``savefile''. To force all packets written to the pcap_dumper_t, and not yet written to the ``savefile'' because they're buffered by the pcap_dumper_t, to be written to the ``savefile'', without closing the pcap_dumper_t, call pcap_dump_flush(). +

Routines +

+

pcap_dump(3PCAP) write packet to a pcap_dumper_t +

pcap_dump_flush(3PCAP) flush buffered packets written to a pcap_dumper_t to the ``savefile'' +

pcap_dump_ftell(3PCAP) get current file position for a pcap_dumper_t +

Injecting packets

+

If you have the required privileges, you can inject packets onto a network with a pcap_t for a live capture, using pcap_inject() or pcap_sendpacket(). (The two routines exist for compatibility with both OpenBSD and WinPcap; they perform the same function, but have different return values.) +

Routines +

+

pcap_inject(3PCAP) +

+

pcap_sendpacket(3PCAP) transmit a packet +

+

Reporting errors

+

Some routines return error or warning status codes; to convert them to a string, use pcap_statustostr(). +

Routines +

+

pcap_statustostr(3PCAP) get a string for an error or warning status code +

Getting library version information

+

To get a string giving version information about libpcap, call pcap_lib_version(). +

Routines +

+

pcap_lib_version(3PCAP) get library version string +

BACKWARD COMPATIBILITY

+

+

In versions of libpcap prior to 1.0, the pcap.h header file was not in a pcap directory on most platforms; if you are writing an application that must work on versions of libpcap prior to 1.0, include <pcap.h>, which will include <pcap/pcap.h> for you, rather than including <pcap/pcap.h>. +

pcap_create() and pcap_activate() were not available in versions of libpcap prior to 1.0; if you are writing an application that must work on versions of libpcap prior to 1.0, either use pcap_open_live() to get a handle for a live capture or, if you want to be able to use the additional capabilities offered by using pcap_create() and pcap_activate(), use an autoconf(1) script or some other configuration script to check whether the libpcap 1.0 APIs are available and use them only if they are.

SEE ALSO

+

autoconf(1), tcpdump(1), tcpslice(1), pcap-filter(7), pfconfig(8), usermod(@MAN_ADMIN_COMMANDS@)

AUTHORS

+

The original authors of libpcap are: +

Van Jacobson, Craig Leres and Steven McCanne, all of the Lawrence Berkeley National Laboratory, University of California, Berkeley, CA. +

The current version is available from "The Tcpdump Group"'s Web site at +

+

https://www.tcpdump.org/ +

BUGS

+

To report a security issue please send an e-mail to security@tcpdump.org. +

To report bugs and other problems, contribute patches, request a feature, provide generic feedback etc please see the file CONTRIBUTING in the libpcap source tree root.

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_activate.html b/network/start/lib/npcap/docs/wpcap/pcap_activate.html new file mode 100644 index 0000000..06e4334 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_activate.html @@ -0,0 +1,79 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_activate - activate a capture handle

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_activate(pcap_t *p);
+
+ +

DESCRIPTION

+

pcap_activate() is used to activate a packet capture handle to look at packets on the network, with the options that were set on the handle being in effect.

RETURN VALUE

+

pcap_activate() returns 0 on success without warnings, a non-zero positive value on success with warnings, and a negative value on error. A non-zero return value indicates what warning or error condition occurred. +

The possible warning values are: +

PCAP_WARNING_PROMISC_NOTSUP Promiscuous mode was requested, but the capture source doesn't support promiscuous mode. +

PCAP_WARNING_TSTAMP_TYPE_NOTSUP The time stamp type specified in a previous pcap_set_tstamp_type call isn't supported by the capture source (the time stamp type is left as the default), +

PCAP_WARNING Another warning condition occurred; pcap_geterr or pcap_perror(3PCAP) may be called with p as an argument to fetch or display a message describing the warning condition. +

The possible error values are: +

PCAP_ERROR_ACTIVATED The handle has already been activated. +

PCAP_ERROR_NO_SUCH_DEVICE The capture source specified when the handle was created doesn't exist. +

PCAP_ERROR_PERM_DENIED The process doesn't have permission to open the capture source. +

PCAP_ERROR_PROMISC_PERM_DENIED The process has permission to open the capture source but doesn't have permission to put it into promiscuous mode. +

PCAP_ERROR_RFMON_NOTSUP Monitor mode was specified but the capture source doesn't support monitor mode. +

PCAP_ERROR_IFACE_NOT_UP The capture source device is not up. +

PCAP_ERROR Another error occurred. pcap_geterr() or pcap_perror() may be called with p as an argument to fetch or display a message describing the error. +

If PCAP_WARNING_PROMISC_NOTSUP, PCAP_ERROR_NO_SUCH_DEVICE, or PCAP_ERROR_PERM_DENIED is returned, pcap_geterr() or pcap_perror() may be called with p as an argument to fetch or display an message giving additional details about the problem that might be useful for debugging the problem if it's unexpected. +

Additional warning and error codes may be added in the future; a program should check for positive, negative, and zero return codes, and treat all positive return codes as warnings and all negative return codes as errors. pcap_statustostr can be called, with a warning or error code as an argument, to fetch a message describing the warning or error code.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_breakloop.html b/network/start/lib/npcap/docs/wpcap/pcap_breakloop.html new file mode 100644 index 0000000..8267413 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_breakloop.html @@ -0,0 +1,70 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_breakloop - force a pcap_dispatch() or pcap_loop() call to return

SYNOPSIS

+

+#include <pcap/pcap.h>
+void pcap_breakloop(pcap_t *);
+
+ +

DESCRIPTION

+

pcap_breakloop() sets a flag that will force pcap_dispatch(3PCAP) or pcap_loop to return rather than looping; they will return the number of packets that have been processed so far, or PCAP_ERROR_BREAK if no packets have been processed so far. +

This routine is safe to use inside a signal handler on UNIX or a console control handler on Windows, as it merely sets a flag that is checked within the loop. +

The flag is checked in loops reading packets from the OS - a signal by itself will not necessarily terminate those loops - as well as in loops processing a set of packets returned by the OS. Note that if you are catching signals on UNIX systems that support restarting system calls after a signal, and calling pcap_breakloop() in the signal handler, you must specify, when catching those signals, that system calls should NOT be restarted by that signal. Otherwise, if the signal interrupted a call reading packets in a live capture, when your signal handler returns after calling pcap_breakloop(), the call will be restarted, and the loop will not terminate until more packets arrive and the call completes. +

Note also that, in a multi-threaded application, if one thread is blocked in pcap_dispatch(), pcap_loop(), pcap_next(3PCAP), or pcap_next_ex(3PCAP), a call to pcap_breakloop() in a different thread will not unblock that thread. You will need to use whatever mechanism the OS provides for breaking a thread out of blocking calls in order to unblock the thread, such as thread cancellation or thread signalling in systems that support POSIX threads, or SetEvent() on the result of pcap_getevent() on a pcap_t on which the thread is blocked on Windows. Asynchronous procedure calls will not work on Windows, as a thread blocked on a pcap_t will not be in an alertable state. +

Note that pcap_next() and pcap_next_ex() will, on some platforms, loop reading packets from the OS; that loop will not necessarily be terminated by a signal, so pcap_breakloop() should be used to terminate packet processing even if pcap_next() or pcap_next_ex() is being used. +

pcap_breakloop() does not guarantee that no further packets will be processed by pcap_dispatch() or pcap_loop() after it is called; at most one more packet might be processed. +

If PCAP_ERROR_BREAK is returned from pcap_dispatch() or pcap_loop(), the flag is cleared, so a subsequent call will resume reading packets. If a positive number is returned, the flag is not cleared, so a subsequent call will return PCAP_ERROR_BREAK and clear the flag.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_can_set_rfmon.html b/network/start/lib/npcap/docs/wpcap/pcap_can_set_rfmon.html new file mode 100644 index 0000000..d75dcf8 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_can_set_rfmon.html @@ -0,0 +1,70 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_can_set_rfmon - check whether monitor mode can be set for a not-yet-activated capture handle

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_can_set_rfmon(pcap_t *p);
+
+ +

DESCRIPTION

+

pcap_can_set_rfmon() checks whether monitor mode could be set on a capture handle when the handle is activated.

RETURN VALUE

+

pcap_can_set_rfmon() returns 0 if monitor mode could not be set, 1 if monitor mode could be set, and a negative value on error. A negative return value indicates what error condition occurred. The possible error values are: +

PCAP_ERROR_NO_SUCH_DEVICE The capture source specified when the handle was created doesn't exist. +

PCAP_ERROR_PERM_DENIED The process doesn't have permission to check whether monitor mode could be supported. +

PCAP_ERROR_ACTIVATED The capture handle has already been activated. +

PCAP_ERROR Another error occurred. pcap_geterr or \%pcap_perror(3PCAP) may be called with p as an argument to fetch or display a message describing the error. +

Additional error codes may be added in the future; a program should check for 0, 1, and negative, return codes, and treat all negative return codes as errors. pcap_statustostr can be called, with a warning or error code as an argument, to fetch a message describing the warning or error code.

SEE ALSO

+

pcap(3PCAP), pcap_create(3PCAP), pcap_activate(3PCAP), pcap_set_rfmon(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_close.html b/network/start/lib/npcap/docs/wpcap/pcap_close.html new file mode 100644 index 0000000..28b20c0 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_close.html @@ -0,0 +1,64 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_close - close a capture device or savefile

SYNOPSIS

+

+#include <pcap/pcap.h>
+void pcap_close(pcap_t *p);
+
+ +

DESCRIPTION

+

pcap_close() closes the files associated with p and deallocates resources.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_compile.html b/network/start/lib/npcap/docs/wpcap/pcap_compile.html new file mode 100644 index 0000000..69d9489 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_compile.html @@ -0,0 +1,69 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_compile - compile a filter expression

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_compile(pcap_t *p, struct bpf_program *fp,
+    const char *str, int optimize, bpf_u_int32 netmask);
+
+ +

DESCRIPTION

+

pcap_compile() is used to compile the string str into a filter program. See pcap-filter(7) for the syntax of that string. program is a pointer to a bpf_program struct and is filled in by pcap_compile(). optimize controls whether optimization on the resulting code is performed. netmask specifies the IPv4 netmask of the network on which packets are being captured; it is used only when checking for IPv4 broadcast addresses in the filter program. If the netmask of the network on which packets are being captured isn't known to the program, or if packets are being captured on the Linux "any" pseudo-interface that can capture on more than one network, a value of PCAP_NETMASK_UNKNOWN can be supplied; tests for IPv4 broadcast addresses will fail to compile, but all other tests in the filter program will be OK. +

NOTE: in libpcap 1.8.0 and later, pcap_compile() can be used in multiple threads within a single process. However, in earlier versions of libpcap, it is not safe to use pcap_compile() in multiple threads in a single process without some form of mutual exclusion allowing only one thread to call it at any given time.

RETURN VALUE

+

pcap_compile() returns 0 on success and PCAP_ERROR on failure. If PCAP_ERROR is returned, pcap_geterr or pcap_perror(3PCAP) may be called with p as an argument to fetch or display the error text.

BACKWARD COMPATIBILITY

+

+

The PCAP_NETMASK_UNKNOWN constant became available in libpcap release 1.1.0.

SEE ALSO

+

pcap(3PCAP), pcap_setfilter(3PCAP), pcap_freecode(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_create.html b/network/start/lib/npcap/docs/wpcap/pcap_create.html new file mode 100644 index 0000000..b967abb --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_create.html @@ -0,0 +1,68 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_create - create a live capture handle

SYNOPSIS

+

+#include <pcap/pcap.h>
+
+char errbuf[PCAP_ERRBUF_SIZE];
+pcap_t *pcap_create(const char *source, char *errbuf);
+
+ +

DESCRIPTION

+

pcap_create() is used to create a packet capture handle to look at packets on the network. source is a string that specifies the network device to open; on Linux systems with 2.2 or later kernels, a source argument of "any" or NULL can be used to capture packets from all interfaces. +

The returned handle must be activated with pcap_activate before packets can be captured with it; options for the capture, such as promiscuous mode, can be set on the handle before activating it.

RETURN VALUE

+

pcap_create() returns a pcap_t * on success and NULL on failure. If NULL is returned, errbuf is filled in with an appropriate error message. errbuf is assumed to be able to hold at least PCAP_ERRBUF_SIZE chars.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_datalink.html b/network/start/lib/npcap/docs/wpcap/pcap_datalink.html new file mode 100644 index 0000000..add8ed3 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_datalink.html @@ -0,0 +1,68 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_datalink - get the link-layer header type

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_datalink(pcap_t *p);
+
+ +

DESCRIPTION

+

pcap_datalink() returns the link-layer header type for the live capture or ``savefile'' specified by p. +

It must not be called on a pcap descriptor created by \%pcap_create(3PCAP) that has not yet been activated by \%pcap_activate(3PCAP). +

https://www.tcpdump.org/linktypes.html lists the values pcap_datalink() can return and describes the packet formats that correspond to those values. +

Do NOT assume that the packets for a given capture or ``savefile`` will have any given link-layer header type, such as DLT_EN10MB for Ethernet. For example, the "any" device on Linux will have a link-layer header type of DLT_LINUX_SLL even if all devices on the system at the time the "any" device is opened have some other data link type, such as DLT_EN10MB for Ethernet.

RETURN VALUE

+

pcap_datalink() returns the link-layer header type on success and PCAP_ERROR_NOT_ACTIVATED if called on a capture handle that has been created but not activated.

SEE ALSO

+

pcap(3PCAP), pcap-linktype(7)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_datalink_name_to_val.html b/network/start/lib/npcap/docs/wpcap/pcap_datalink_name_to_val.html new file mode 100644 index 0000000..75e2fda --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_datalink_name_to_val.html @@ -0,0 +1,65 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_datalink_name_to_val - get the link-layer header type value corresponding to a header type name

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_datalink_name_to_val(const char *name);
+
+ +

DESCRIPTION

+

pcap_datalink_name_to_val() translates a link-layer header type name, which is a DLT_ name with the DLT_ removed, to the corresponding link-layer header type value. The translation is case-insensitive.

RETURN VALUE

+

pcap_datalink_name_to_val() returns the type value on success and PCAP_ERROR if the name is not a known type name..

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_datalink_val_to_name.html b/network/start/lib/npcap/docs/wpcap/pcap_datalink_val_to_name.html new file mode 100644 index 0000000..489ccde --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_datalink_val_to_name.html @@ -0,0 +1,68 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_datalink_val_to_name, pcap_datalink_val_to_description, pcap_datalink_val_to_description_or_dlt - get a name or description for a link-layer header type value

SYNOPSIS

+

+#include <pcap.h>
+const char *pcap_datalink_val_to_name(int dlt);
+const char *pcap_datalink_val_to_description(int dlt);
+const char *pcap_datalink_val_to_description_or_dlt(int dlt);
+
+ +

DESCRIPTION

+

pcap_datalink_val_to_name() translates a link-layer header type value to the corresponding link-layer header type name, which is the DLT_ name for the link-layer header type value with the DLT_ removed. NULL is returned if the type value does not correspond to a known DLT_ value. +

pcap_datalink_val_to_description() translates a link-layer header type value to a short description of that link-layer header type. NULL is returned if the type value does not correspond to a known DLT_ value. +

pcap_datalink_val_to_description_or_dlt() translates a link-layer header type value to a short description of that link-layer header type just like pcap_datalink_val_to_description. If the type value does not correspond to a known DLT_ value, the string "DLT n" is returned, where n is the value of the dlt argument.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_dump.html b/network/start/lib/npcap/docs/wpcap/pcap_dump.html new file mode 100644 index 0000000..6fa3095 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_dump.html @@ -0,0 +1,65 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_dump - write a packet to a capture file

SYNOPSIS

+

+#include <pcap/pcap.h>
+void pcap_dump(u_char *user, struct pcap_pkthdr *h,
+    u_char *sp);
+
+ +

DESCRIPTION

+

pcap_dump() outputs a packet to the ``savefile'' opened with pcap_dump_open. Note that its calling arguments are suitable for use with pcap_dispatch(3PCAP) or pcap_loop. If called directly, the user parameter is of type pcap_dumper_t as returned by pcap_dump_open().

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_dump_close.html b/network/start/lib/npcap/docs/wpcap/pcap_dump_close.html new file mode 100644 index 0000000..2bb2738 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_dump_close.html @@ -0,0 +1,64 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_dump_close - close a savefile being written to

SYNOPSIS

+

+#include <pcap/pcap.h>
+void pcap_dump_close(pcap_dumper_t *p);
+
+ +

DESCRIPTION

+

pcap_dump_close() closes the ``savefile.''

SEE ALSO

+

pcap(3PCAP), pcap_dump_open(3PCAP), pcap_dump(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_dump_file.html b/network/start/lib/npcap/docs/wpcap/pcap_dump_file.html new file mode 100644 index 0000000..d96cae9 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_dump_file.html @@ -0,0 +1,64 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_dump_file - get the standard I/O stream for a savefile being written

SYNOPSIS

+

+#include <pcap/pcap.h>
+FILE *pcap_dump_file(pcap_dumper_t *p);
+
+ +

DESCRIPTION

+

pcap_dump_file() returns the standard I/O stream of the ``savefile'' opened by pcap_dump_open.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_dump_flush.html b/network/start/lib/npcap/docs/wpcap/pcap_dump_flush.html new file mode 100644 index 0000000..6107af5 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_dump_flush.html @@ -0,0 +1,65 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_dump_flush - flush to a savefile packets dumped

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_dump_flush(pcap_dumper_t *p);
+
+ +

DESCRIPTION

+

pcap_dump_flush() flushes the output buffer to the ``savefile,'' so that any packets written with pcap_dump but not yet written to the ``savefile'' will be written.

RETURN VALUE

+

pcap_dump_flush() returns 0 on success and PCAP_ERROR on failure.

SEE ALSO

+

pcap(3PCAP), pcap_dump_open(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_dump_ftell.html b/network/start/lib/npcap/docs/wpcap/pcap_dump_ftell.html new file mode 100644 index 0000000..790a9a1 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_dump_ftell.html @@ -0,0 +1,65 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_dump_ftell, pcap_dump_ftell64 - get the current file offset for a savefile being written

SYNOPSIS

+

+#include <pcap/pcap.h>
+long pcap_dump_ftell(pcap_dumper_t *p);
+int64_t pcap_dump_ftell64(pcap_dumper_t *p);
+
+ +

DESCRIPTION

+

pcap_dump_ftell() returns the current file position for the ``savefile'', representing the number of bytes written by pcap_dump_open and pcap_dump. PCAP_ERROR is returned on error. If the current file position does not fit in a long, it will be truncated; this can happen on 32-bit UNIX-like systems with large file support and on Windows. pcap_dump_ftell64() returns the current file position in a int64_t, so if file offsets that don't fit in a long but that fit in a int64_t are supported, this will return the file offset without truncation. PCAP_ERROR is returned on error.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_dump_open.html b/network/start/lib/npcap/docs/wpcap/pcap_dump_open.html new file mode 100644 index 0000000..3e14368 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_dump_open.html @@ -0,0 +1,73 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_dump_open, pcap_dump_fopen - open a file to which to write packets

SYNOPSIS

+

+#include <pcap/pcap.h>
+
+pcap_dumper_t *pcap_dump_open(pcap_t *p, const char *fname);
+pcap_dumper_t *pcap_dump_open_append(pcap_t *p, const char *fname);
+pcap_dumper_t *pcap_dump_fopen(pcap_t *p, FILE *fp);
+
+ +

DESCRIPTION

+

pcap_dump_open() is called to open a ``savefile'' for writing. fname specifies the name of the file to open. The file will have the same format as those used by tcpdump(1) and tcpslice(1). The name "-" is a synonym for stdout. +

pcap_dump_fopen() is called to write data to an existing open stream fp; this stream will be closed by a subsequent call to pcap_dump_close. Note that on Windows, that stream should be opened in binary mode. +

p is a capture or ``savefile'' handle returned by an earlier call to pcap_create and activated by an earlier call to \%pcap_activate(3PCAP), or returned by an earlier call to \%pcap_open_offline(3PCAP), pcap_open_live, or pcap_open_dead. The time stamp precision, link-layer type, and snapshot length from p are used as the link-layer type and snapshot length of the output file. +

pcap_dump_open_append() is like pcap_dump_open() but does not create the file if it does not exist and, if it does already exist, and is a pcap file with the same byte order as the host opening the file, and has the same time stamp precision, link-layer header type, and snapshot length as p, it will write new packets at the end of the file.

RETURN VALUES

+

A pointer to a pcap_dumper_t structure to use in subsequent pcap_dump and pcap_dump_close calls is returned on success. NULL is returned on failure. If NULL is returned, pcap_geterr can be used to get the error text.

BACKWARD COMPATIBILITY

+

+

The pcap_dump_open_append() function became available in libpcap release 1.7.2. In previous releases, there is no support for appending packets to an existing savefile.

SEE ALSO

+

pcap(3PCAP), \%pcap-savefile(5)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_file.html b/network/start/lib/npcap/docs/wpcap/pcap_file.html new file mode 100644 index 0000000..414e76c --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_file.html @@ -0,0 +1,65 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_file - get the standard I/O stream for a savefile being read

SYNOPSIS

+

+#include <pcap/pcap.h>
+FILE *pcap_file(pcap_t *p);
+
+ +

DESCRIPTION

+

pcap_file() returns the standard I/O stream of the ``savefile,'' if a ``savefile'' was opened with pcap_open_offline, or NULL, if a network device was opened with pcap_create and \%pcap_activate(3PCAP), or with pcap_open_live. +

Note that the Packet Capture library is usually built with large file support, so the standard I/O stream of the ``savefile'' might refer to a file larger than 2 gigabytes; applications that use pcap_file() should, if possible, use calls that support large files on the return value of pcap_file() or the value returned by fileno(3) when passed the return value of pcap_file().

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_fileno.html b/network/start/lib/npcap/docs/wpcap/pcap_fileno.html new file mode 100644 index 0000000..9048af5 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_fileno.html @@ -0,0 +1,65 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_fileno - get the file descriptor for a live capture

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_fileno(pcap_t *p);
+
+ +

DESCRIPTION

+

If p refers to a network device that was opened for a live capture using a combination of pcap_create and pcap_activate, or using pcap_open_live, pcap_fileno() returns the file descriptor from which captured packets are read. +

If p refers to a ``savefile'' that was opened using functions such as pcap_open_offline or pcap_fopen_offline(3PCAP), a ``dead'' pcap_t opened using pcap_open_dead, or a pcap_t that was created with pcap_create() but that has not yet been activated with pcap_activate(), it returns PCAP_ERROR.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_findalldevs.html b/network/start/lib/npcap/docs/wpcap/pcap_findalldevs.html new file mode 100644 index 0000000..e4ab07d --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_findalldevs.html @@ -0,0 +1,99 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_findalldevs, pcap_freealldevs - get a list of capture devices, and free that list

SYNOPSIS

+

+#include <pcap/pcap.h>
+
+char errbuf[PCAP_ERRBUF_SIZE];
+int pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf);
+void pcap_freealldevs(pcap_if_t *alldevs);
+
+ +

DESCRIPTION

+

pcap_findalldevs() constructs a list of network devices that can be opened with pcap_create and pcap_activate or with pcap_open_live. (Note that there may be network devices that cannot be opened by the process calling pcap_findalldevs(), because, for example, that process does not have sufficient privileges to open them for capturing; if so, those devices will not appear on the list.) If pcap_findalldevs() succeeds, the pointer pointed to by alldevsp is set to point to the first element of the list, or to NULL if no devices were found (this is considered success). Each element of the list is of type pcap_if_t, and has the following members: +

+

next if not NULL, a pointer to the next element in the list; NULL for the last element of the list +

name a pointer to a string giving a name for the device to pass to pcap_open_live() +

description if not NULL, a pointer to a string giving a human-readable description of the device +

addresses a pointer to the first element of a list of network addresses for the device, or NULL if the device has no addresses +

flags device flags: +

+

PCAP_IF_LOOPBACK set if the device is a loopback interface +

PCAP_IF_UP set if the device is up +

PCAP_IF_RUNNING set if the device is running +

PCAP_IF_WIRELESS set if the device is a wireless interface; this includes IrDA as well as radio-based networks such as IEEE 802.15.4 and IEEE 802.11, so it doesn't just mean Wi-Fi +

PCAP_IF_CONNECTION_STATUS a bitmask for an indication of whether the adapter is connected or not; for wireless interfaces, "connected" means "associated with a network" +

The possible values for the connection status bits are: +

PCAP_IF_CONNECTION_STATUS_UNKNOWN it's unknown whether the adapter is connected or not +

PCAP_IF_CONNECTION_STATUS_CONNECTED the adapter is connected +

PCAP_IF_CONNECTION_STATUS_DISCONNECTED the adapter is disconnected +

PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE the notion of "connected" and "disconnected" don't apply to this interface; for example, it doesn't apply to a loopback device +

+

+

Each element of the list of addresses is of type pcap_addr_t, and has the following members: +

+

next if not NULL, a pointer to the next element in the list; NULL for the last element of the list +

addr a pointer to a struct sockaddr containing an address +

netmask if not NULL, a pointer to a struct sockaddr that contains the netmask corresponding to the address pointed to by addr +

broadaddr if not NULL, a pointer to a struct sockaddr that contains the broadcast address corresponding to the address pointed to by addr; may be null if the device doesn't support broadcasts +

dstaddr if not NULL, a pointer to a struct sockaddr that contains the destination address corresponding to the address pointed to by addr; may be null if the device isn't a point-to-point interface +

+

Note that the addresses in the list of addresses might be IPv4 addresses, IPv6 addresses, or some other type of addresses, so you must check the sa_family member of the struct sockaddr before interpreting the contents of the address; do not assume that the addresses are all IPv4 addresses, or even all IPv4 or IPv6 addresses. IPv4 addresses have the value AF_INET, IPv6 addresses have the value AF_INET6 (which older operating systems that don't support IPv6 might not define), and other addresses have other values. Whether other addresses are returned, and what types they might have is platform-dependent. For IPv4 addresses, the struct sockaddr pointer can be interpreted as if it pointed to a struct sockaddr_in; for IPv6 addresses, it can be interpreted as if it pointed to a struct sockaddr_in6. +

The list of devices must be freed with pcap_freealldevs(3PCAP), which frees the list pointed to by alldevs.

RETURN VALUE

+

pcap_findalldevs() returns 0 on success and PCAP_ERROR on failure; as indicated, finding no devices is considered success, rather than failure, so 0 will be returned in that case. If PCAP_ERROR is returned, errbuf is filled in with an appropriate error message. errbuf is assumed to be able to hold at least PCAP_ERRBUF_SIZE chars.

BACKWARD COMPATIBILITY

+

+

The PCAP_IF_UP and PCAP_IF_RUNNING constants became available in libpcap release 1.6.1. The PCAP_IF_WIRELESS, PCAP_IF_CONNECTION_STATUS, PCAP_IF_CONNECTION_STATUS_UNKNOWN, PCAP_IF_CONNECTION_STATUS_CONNECTED, PCAP_IF_CONNECTION_STATUS_DISCONNECTED, and PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE constants became available in libpcap release 1.9.0.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_freecode.html b/network/start/lib/npcap/docs/wpcap/pcap_freecode.html new file mode 100644 index 0000000..beda321 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_freecode.html @@ -0,0 +1,64 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_freecode - free a BPF program

SYNOPSIS

+

+#include <pcap/pcap.h>
+void pcap_freecode(struct bpf_program *);
+
+ +

DESCRIPTION

+

pcap_freecode() is used to free up allocated memory pointed to by a bpf_program struct generated by pcap_compile when that BPF program is no longer needed, for example after it has been made the filter program for a pcap structure by a call to pcap_setfilter.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_get_required_select_timeout.html b/network/start/lib/npcap/docs/wpcap/pcap_get_required_select_timeout.html new file mode 100644 index 0000000..7f2e4dd --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_get_required_select_timeout.html @@ -0,0 +1,70 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_get_required_select_timeout - get a file descriptor on which a select() can be done for a live capture

SYNOPSIS

+

+#include <pcap/pcap.h>
+struct timeval *pcap_get_required_select_timeout(pcap_t *p);
+
+ +

DESCRIPTION

+

pcap_get_required_select_timeout() returns, on UNIX, a pointer to a struct timeval containing a value that must be used as the minimum timeout in select(2), poll(2), epoll_wait(2), and kevent() calls if pcap_get_selectable_fd returns PCAP_ERROR. +

The timeout that should be used in those calls must be no larger than the smallest of all timeouts returned by \%pcap_get_required_select_timeout() for devices from which packets will be captured. +

The device for which pcap_get_selectable_fd() returned PCAP_ERROR must be put in non-blocking mode with pcap_setnonblock, and an attempt must always be made to read packets from the device when the select(), poll(), epoll_wait(), or kevent() call returns. +

Note that a device on which a read can be done without blocking may, on some platforms, not have any packets to read if the packet buffer timeout has expired. A call to pcap_dispatch(3PCAP) or pcap_next_ex will return 0 in this case, but will not block. +

pcap_get_required_select_timeout() is not available on Windows.

RETURN VALUE

+

A pointer to a struct timeval is returned if the timeout is required; otherwise NULL is returned.

BACKWARD COMPATIBILITY

+

This function became available in libpcap release 1.9.0. In previous releases, select(), poll(), epoll_wait(), and kevent() cannot be used on any capture source for which pcap_get_selectable_fd returns -1.

SEE ALSO

+

pcap(3PCAP), pcap_get_selectable_fd(3PCAP), select(2), poll(2), epoll_wait(2), kqueue(2)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_get_selectable_fd.html b/network/start/lib/npcap/docs/wpcap/pcap_get_selectable_fd.html new file mode 100644 index 0000000..647136d --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_get_selectable_fd.html @@ -0,0 +1,79 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_get_selectable_fd - get a file descriptor on which a select() can be done for a live capture

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_get_selectable_fd(pcap_t *p);
+
+ +

DESCRIPTION

+

pcap_get_selectable_fd() returns, on UNIX, a file descriptor number for a file descriptor on which one can do a select(2), poll(2), epoll_wait(2), kevent(), or other such call to wait for it to be possible to read packets without blocking, if such a descriptor exists, or PCAP_ERROR, if no such descriptor exists. +

Some network devices opened with pcap_create and pcap_activate, or with pcap_open_live, do not support those calls (for example, regular network devices on FreeBSD 4.3 and 4.4, and Endace DAG devices), so PCAP_ERROR is returned for those devices. In that case, those calls must be given a timeout less than or equal to the timeout returned by pcap_get_required_select_timeout for the device for which pcap_get_selectable_fd() returned PCAP_ERROR, the device must be put in non-blocking mode with a call to \%pcap_setnonblock(3PCAP), and an attempt must always be made to read packets from the device when the call returns. If \%pcap_get_required_select_timeout() returns NULL, it is not possible to wait for packets to arrive on the device in an event loop. +

Note that a device on which a read can be done without blocking may, on some platforms, not have any packets to read if the packet buffer timeout has expired. A call to pcap_dispatch(3PCAP) or pcap_next_ex will return 0 in this case, but will not block. +

Note that in: +

+

FreeBSD prior to FreeBSD 4.6; +

+

NetBSD prior to NetBSD 3.0; +

+

OpenBSD prior to OpenBSD 2.4; +

+

Mac OS X prior to Mac OS X 10.7; +

select(), poll(), and kevent() do not work correctly on BPF devices; pcap_get_selectable_fd() will return a file descriptor on most of those versions (the exceptions being FreeBSD 4.3 and 4.4), but a simple select(), poll(), or kevent() call will not indicate that the descriptor is readable until a full buffer's worth of packets is received, even if the packet timeout expires before then. To work around this, code that uses those calls to wait for packets to arrive must put the pcap_t in non-blocking mode, and must arrange that the call have a timeout less than or equal to the packet buffer timeout, and must try to read packets after that timeout expires, regardless of whether the call indicated that the file descriptor for the pcap_t is ready to be read or not. (That workaround will not work in FreeBSD 4.3 and later; however, in FreeBSD 4.6 and later, those calls work correctly on BPF devices, so the workaround isn't necessary, although it does no harm.) +

Note also that poll() and kevent() doesn't work on character special files, including BPF devices, in Mac OS X 10.4 and 10.5, so, while select() can be used on the descriptor returned by pcap_get_selectable_fd(), poll() and kevent() cannot be used on it those versions of Mac OS X. poll(), but not kevent(), works on that descriptor in Mac OS X releases prior to 10.4; poll() and kevent() work on that descriptor in Mac OS X 10.6 and later. +

pcap_get_selectable_fd() is not available on Windows.

RETURN VALUE

+

A selectable file descriptor is returned if one exists; otherwise, PCAP_ERROR is returned.

SEE ALSO

+

pcap(3PCAP), kqueue(2)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_get_tstamp_precision.html b/network/start/lib/npcap/docs/wpcap/pcap_get_tstamp_precision.html new file mode 100644 index 0000000..93e125c --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_get_tstamp_precision.html @@ -0,0 +1,75 @@ + + +3PCAP man page + + + + +

+

+

+

+

+

+

+

+

+

NAME

+

pcap_get_tstamp_precision - get the time stamp precision returned in captures

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_get_tstamp_precision(pcap_t *p);
+
+ +

DESCRIPTION

+

pcap_get_tstamp_precision() returns the precision of the time stamp returned in packet captures on the pcap descriptor.

RETURN VALUE

+

pcap_get_tstamp_precision() returns PCAP_TSTAMP_PRECISION_MICRO or PCAP_TSTAMP_PRECISION_NANO, which indicates that pcap captures contains time stamps in microseconds or nanoseconds respectively.

BACKWARD COMPATIBILITY

+

This function became available in libpcap release 1.5.1. In previous releases, time stamps from a capture device or savefile are always given in seconds and microseconds.

SEE ALSO

+

pcap(3PCAP), pcap_set_tstamp_precision(3PCAP), pcap-tstamp(7)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_geterr.html b/network/start/lib/npcap/docs/wpcap/pcap_geterr.html new file mode 100644 index 0000000..ad7c668 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_geterr.html @@ -0,0 +1,66 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_geterr, pcap_perror - get or print libpcap error message text

SYNOPSIS

+

+#include <pcap/pcap.h>
+char *pcap_geterr(pcap_t *p);
+void pcap_perror(pcap_t *p, const char *prefix);
+
+ +

DESCRIPTION

+

pcap_geterr() returns the error text pertaining to the last pcap library error. NOTE: the pointer it returns will no longer point to a valid error message string after the pcap_t passed to it is closed; you must use or copy the string before closing the pcap_t. +

pcap_perror() prints the text of the last pcap library error on stderr, prefixed by prefix.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_inject.html b/network/start/lib/npcap/docs/wpcap/pcap_inject.html new file mode 100644 index 0000000..895b44b --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_inject.html @@ -0,0 +1,71 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_inject, pcap_sendpacket - transmit a packet

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_inject(pcap_t *p, const void *buf, size_t size);
+int pcap_sendpacket(pcap_t *p, const u_char *buf, int size);
+
+ +

DESCRIPTION

+

pcap_inject() sends a raw packet through the network interface; buf points to the data of the packet, including the link-layer header, and size is the number of bytes in the packet. +

Note that, even if you successfully open the network interface, you might not have permission to send packets on it, or it might not support sending packets; as pcap_open_live doesn't have a flag to indicate whether to open for capturing, sending, or capturing and sending, you cannot request an open that supports sending and be notified at open time whether sending will be possible. Note also that some devices might not support sending packets. +

Note that, on some platforms, the link-layer header of the packet that's sent might not be the same as the link-layer header of the packet supplied to pcap_inject(), as the source link-layer address, if the header contains such an address, might be changed to be the address assigned to the interface on which the packet it sent, if the platform doesn't support sending completely raw and unchanged packets. Even worse, some drivers on some platforms might change the link-layer type field to whatever value libpcap used when attaching to the device, even on platforms that do nominally support sending completely raw and unchanged packets. +

pcap_sendpacket() is like pcap_inject(), but it returns 0 on success, rather than returning the number of bytes written. (pcap_inject() comes from OpenBSD; pcap_sendpacket() comes from WinPcap. Both are provided for compatibility.)

RETURN VALUE

+

pcap_inject() returns the number of bytes written on success and PCAP_ERROR on failure. +

pcap_sendpacket() returns 0 on success and PCAP_ERROR on failure. +

If PCAP_ERROR is returned, pcap_geterr or pcap_perror(3PCAP) may be called with p as an argument to fetch or display the error text.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_is_swapped.html b/network/start/lib/npcap/docs/wpcap/pcap_is_swapped.html new file mode 100644 index 0000000..80499b7 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_is_swapped.html @@ -0,0 +1,66 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_is_swapped - find out whether a savefile has the native byte order

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_is_swapped(pcap_t *p);
+
+ +

DESCRIPTION

+

pcap_is_swapped() returns true (1) if p refers to a ``savefile'' that uses a different byte order than the current system. For a live capture, it always returns false (0). +

It must not be called on a pcap descriptor created by \%pcap_create(3PCAP) that has not yet been activated by \%pcap_activate(3PCAP).

RETURN VALUE

+

pcap_is_swapped() returns true (1) or false (0) on success and PCAP_ERROR_NOT_ACTIVATED if called on a capture handle that has been created but not activated.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_lib_version.html b/network/start/lib/npcap/docs/wpcap/pcap_lib_version.html new file mode 100644 index 0000000..6f488f5 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_lib_version.html @@ -0,0 +1,64 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_lib_version - get the version information for libpcap

SYNOPSIS

+

+#include <pcap/pcap.h>
+const char *pcap_lib_version(void);
+
+ +

DESCRIPTION

+

pcap_lib_version() returns a pointer to a string giving information about the version of the libpcap library being used; note that it contains more information than just a version number.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_list_datalinks.html b/network/start/lib/npcap/docs/wpcap/pcap_list_datalinks.html new file mode 100644 index 0000000..2fa7df5 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_list_datalinks.html @@ -0,0 +1,68 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_list_datalinks, pcap_free_datalinks - get a list of link-layer header types supported by a capture device, and free that list

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_list_datalinks(pcap_t *p, int **dlt_buf);
+void pcap_free_datalinks(int *dlt_list);
+
+ +

DESCRIPTION

+

pcap_list_datalinks() is used to get a list of the supported link-layer header types of the interface associated with the pcap descriptor. pcap_list_datalinks() allocates an array to hold the list and sets *dlt_buf to point to that array. +

The caller is responsible for freeing the array with pcap_free_datalinks(), which frees the list of link-layer header types pointed to by dlt_list. +

It must not be called on a pcap descriptor created by \%pcap_create(3PCAP) that has not yet been activated by \%pcap_activate(3PCAP).

RETURN VALUE

+

pcap_list_datalinks() returns the number of link-layer header types in the array on success, PCAP_ERROR_NOT_ACTIVATED if called on a capture handle that has been created but not activated, and PCAP_ERROR on other errors. If PCAP_ERROR is returned, pcap_geterr or \%pcap_perror(3PCAP) may be called with p as an argument to fetch or display the error text.

SEE ALSO

+

pcap(3PCAP), pcap_datalink_val_to_name(3PCAP), pcap-linktype(7)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_list_tstamp_types.html b/network/start/lib/npcap/docs/wpcap/pcap_list_tstamp_types.html new file mode 100644 index 0000000..88dfca1 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_list_tstamp_types.html @@ -0,0 +1,69 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_list_tstamp_types, pcap_free_tstamp_types - get a list of time stamp types supported by a capture device, and free that list

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_list_tstamp_types(pcap_t *p, int **tstamp_typesp);
+void pcap_free_tstamp_types(int *tstamp_types);
+
+ +

DESCRIPTION

+

pcap_list_tstamp_types() is used to get a list of the supported time stamp types of the interface associated with the pcap descriptor. pcap_list_tstamp_types() allocates an array to hold the list and sets *tstamp_typesp to point to the array. See pcap-tstamp(7) for a list of all the time stamp types. +

The caller is responsible for freeing the array with pcap_free_tstamp_types(), which frees the list pointed to by tstamp_types.

RETURN VALUE

+

pcap_list_tstamp_types() returns the number of time stamp types in the array on success and PCAP_ERROR on failure. A return value of one means that the only time stamp type supported is the one in the list, which is the capture device's default time stamp type. A return value of zero means that the only time stamp type supported is PCAP_TSTAMP_HOST, which is the capture device's default time stamp type (only older versions of libpcap will return that; newer versions will always return one or more types). If PCAP_ERROR is returned, pcap_geterr or pcap_perror(3PCAP) may be called with p as an argument to fetch or display the error text.

BACKWARD COMPATIBILITY

+

+

These functions became available in libpcap release 1.2.1. In previous releases, the time stamp type cannot be set; only the default time stamp type offered by a capture source is available.

SEE ALSO

+

pcap(3PCAP), pcap_tstamp_type_val_to_name(3PCAP), pcap-tstamp(7)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_lookupdev.html b/network/start/lib/npcap/docs/wpcap/pcap_lookupdev.html new file mode 100644 index 0000000..24d1abd --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_lookupdev.html @@ -0,0 +1,70 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_lookupdev - find the default device on which to capture

SYNOPSIS

+

+#include <pcap/pcap.h>
+
+char errbuf[PCAP_ERRBUF_SIZE];
+[DEPRECATED] char *pcap_lookupdev(char *errbuf);
+
+ +

DESCRIPTION

+

This interface is obsoleted by pcap_findalldevs(3PCAP). To find a default device on which to capture, call pcap_findalldevs() and, if the list it returns is not empty, use the first device in the list. (If the list is empty, there are no devices on which capture is possible.) +

pcap_lookupdev() returns a pointer to a string giving the name of a network device suitable for use with pcap_create and \%pcap_activate(3PCAP), or with pcap_open_live, and with pcap_lookupnet. If there is an error, NULL is returned and errbuf is filled in with an appropriate error message. errbuf is assumed to be able to hold at least PCAP_ERRBUF_SIZE chars.

SEE ALSO

+

pcap(3PCAP)

BUGS

+

The pointer returned by pcap_lookupdev() points to a static buffer; subsequent calls to pcap_lookupdev() in the same thread, or calls to pcap_lookupdev() in another thread, may overwrite that buffer. +

In WinPcap, this function may return a UTF-16 string rather than an ASCII or UTF-8 string. +

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_lookupnet.html b/network/start/lib/npcap/docs/wpcap/pcap_lookupnet.html new file mode 100644 index 0000000..d432da7 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_lookupnet.html @@ -0,0 +1,68 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_lookupnet - find the IPv4 network number and netmask for a device

SYNOPSIS

+

+#include <pcap/pcap.h>
+
+char errbuf[PCAP_ERRBUF_SIZE];
+int pcap_lookupnet(const char *device, bpf_u_int32 *netp,
+    bpf_u_int32 *maskp, char *errbuf);
+
+ +

DESCRIPTION

+

pcap_lookupnet() is used to determine the IPv4 network number and mask associated with the network device device. Both netp and maskp are bpf_u_int32 pointers.

RETURN VALUE

+

pcap_lookupnet() returns 0 on success and PCAP_ERROR on failure. If PCAP_ERROR is returned, errbuf is filled in with an appropriate error message. errbuf is assumed to be able to hold at least PCAP_ERRBUF_SIZE chars.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_loop.html b/network/start/lib/npcap/docs/wpcap/pcap_loop.html new file mode 100644 index 0000000..4ec5ca0 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_loop.html @@ -0,0 +1,78 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_loop, pcap_dispatch - process packets from a live capture or savefile

SYNOPSIS

+

+#include <pcap/pcap.h>
+typedef void (*pcap_handler)(u_char *user, const struct pcap_pkthdr *h,
+    			     const u_char *bytes);
+int pcap_loop(pcap_t *p, int cnt,
+    pcap_handler callback, u_char *user);
+int pcap_dispatch(pcap_t *p, int cnt,
+    pcap_handler callback, u_char *user);
+
+ +

DESCRIPTION

+

pcap_loop() processes packets from a live capture or ``savefile'' until cnt packets are processed, the end of the ``savefile'' is reached when reading from a ``savefile'', pcap_breakloop is called, or an error occurs. It does not return when live packet buffer timeouts occur. A value of -1 or 0 for cnt is equivalent to infinity, so that packets are processed until another ending condition occurs. +

pcap_dispatch() processes packets from a live capture or ``savefile'' until cnt packets are processed, the end of the current bufferful of packets is reached when doing a live capture, the end of the ``savefile'' is reached when reading from a ``savefile'', pcap_breakloop() is called, or an error occurs. Thus, when doing a live capture, cnt is the maximum number of packets to process before returning, but is not a minimum number; when reading a live capture, only one bufferful of packets is read at a time, so fewer than cnt packets may be processed. A value of -1 or 0 for cnt causes all the packets received in one buffer to be processed when reading a live capture, and causes all the packets in the file to be processed when reading a ``savefile''. +

Note that, when doing a live capture on some platforms, if the read timeout expires when there are no packets available, pcap_dispatch() will return 0, even when not in non-blocking mode, as there are no packets to process. Applications should be prepared for this to happen, but must not rely on it happening. +

(In older versions of libpcap, the behavior when cnt was 0 was undefined; different platforms and devices behaved differently, so code that must work with older versions of libpcap should use -1, not 0, as the value of cnt.) +

callback specifies a pcap_handler routine to be called with three arguments: a u_char pointer which is passed in the user argument to pcap_loop() or pcap_dispatch(), a const struct pcap_pkthdr pointer pointing to the packet time stamp and lengths, and a const u_char pointer to the first caplen (as given in the struct pcap_pkthdr a pointer to which is passed to the callback routine) bytes of data from the packet. The struct pcap_pkthdr and the packet data are not to be freed by the callback routine, and are not guaranteed to be valid after the callback routine returns; if the code needs them to be valid after the callback, it must make a copy of them. +

The bytes of data from the packet begin with a link-layer header. The format of the link-layer header is indicated by the return value of the pcap_datalink routine when handed the pcap_t value also passed to pcap_loop() or pcap_dispatch(). https://www.tcpdump.org/linktypes.html lists the values pcap_datalink() can return and describes the packet formats that correspond to those values. The value it returns will be valid for all packets received unless and until pcap_set_datalink is called; after a successful call to pcap_set_datalink(), all subsequent packets will have a link-layer header of the type specified by the link-layer header type value passed to pcap_set_datalink(). +

Do NOT assume that the packets for a given capture or ``savefile`` will have any given link-layer header type, such as DLT_EN10MB for Ethernet. For example, the "any" device on Linux will have a link-layer header type of DLT_LINUX_SLL even if all devices on the system at the time the "any" device is opened have some other data link type, such as DLT_EN10MB for Ethernet.

RETURN VALUE

+

pcap_loop() returns 0 if cnt is exhausted or if, when reading from a ``savefile'', no more packets are available. It returns PCAP_ERROR if an error occurs or PCAP_ERROR_BREAK if the loop terminated due to a call to pcap_breakloop() before any packets were processed. It does not return when live packet buffer timeouts occur; instead, it attempts to read more packets. +

pcap_dispatch() returns the number of packets processed on success; this can be 0 if no packets were read from a live capture (if, for example, they were discarded because they didn't pass the packet filter, or if, on platforms that support a packet buffer timeout that starts before any packets arrive, the timeout expires before any packets arrive, or if the file descriptor for the capture device is in non-blocking mode and no packets were available to be read) or if no more packets are available in a ``savefile.'' It returns PCAP_ERROR if an error occurs or PCAP_ERROR_BREAK if the loop terminated due to a call to pcap_breakloop() before any packets were processed. If your application uses pcap_breakloop(), make sure that you explicitly check for PCAP_ERROR and PCAP_ERROR_BREAK, rather than just checking for a return value < 0. +

If PCAP_ERROR is returned, pcap_geterr or pcap_perror(3PCAP) may be called with p as an argument to fetch or display the error text.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_major_version.html b/network/start/lib/npcap/docs/wpcap/pcap_major_version.html new file mode 100644 index 0000000..f79120f --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_major_version.html @@ -0,0 +1,66 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_major_version, pcap_minor_version - get the version number of a savefile

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_major_version(pcap_t *p);
+int pcap_minor_version(pcap_t *p);
+
+ +

DESCRIPTION

+

If p refers to a ``savefile'', pcap_major_version() returns the major number of the file format of the ``savefile'' and pcap_minor_version() returns the minor number of the file format of the ``savefile''. The version number is stored in the ``savefile''; note that the meaning of its values depends on the type of ``savefile'' (for example, pcap or pcapng). +

If p refers to a live capture, the values returned by pcap_major_version() and pcap_minor_version() are not meaningful.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_next_ex.html b/network/start/lib/npcap/docs/wpcap/pcap_next_ex.html new file mode 100644 index 0000000..d5d62fe --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_next_ex.html @@ -0,0 +1,71 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_next_ex, pcap_next - read the next packet from a pcap_t

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header,
+    const u_char **pkt_data);
+const u_char *pcap_next(pcap_t *p, struct pcap_pkthdr *h);
+
+ +

DESCRIPTION

+

pcap_next_ex() reads the next packet and returns a success/failure indication. If the packet was read without problems, the pointer pointed to by the pkt_header argument is set to point to the pcap_pkthdr struct for the packet, and the pointer pointed to by the pkt_data argument is set to point to the data in the packet. The struct pcap_pkthdr and the packet data are not to be freed by the caller, and are not guaranteed to be valid after the next call to pcap_next_ex(), pcap_next(), pcap_loop, or pcap_dispatch(3PCAP); if the code needs them to remain valid, it must make a copy of them. +

pcap_next() reads the next packet (by calling pcap_dispatch() with a cnt of 1) and returns a u_char pointer to the data in that packet. The packet data is not to be freed by the caller, and is not guaranteed to be valid after the next call to pcap_next_ex(), pcap_next(), pcap_loop(), or pcap_dispatch(); if the code needs it to remain valid, it must make a copy of it. The pcap_pkthdr structure pointed to by h is filled in with the appropriate values for the packet. +

The bytes of data from the packet begin with a link-layer header. The format of the link-layer header is indicated by the return value of the pcap_datalink(PCAP) routine when handed the pcap_t value also passed to pcap_loop() or pcap_dispatch(). https://www.tcpdump.org/linktypes.html lists the values pcap_datalink() can return and describes the packet formats that correspond to those values. The value it returns will be valid for all packets received unless and until pcap_set_datalink is called; after a successful call to pcap_set_datalink(), all subsequent packets will have a link-layer header of the type specified by the link-layer header type value passed to pcap_set_datalink(). +

Do NOT assume that the packets for a given capture or ``savefile`` will have any given link-layer header type, such as DLT_EN10MB for Ethernet. For example, the "any" device on Linux will have a link-layer header type of DLT_LINUX_SLL even if all devices on the system at the time the "any" device is opened have some other data link type, such as DLT_EN10MB for Ethernet.

RETURN VALUE

+

pcap_next_ex() returns 1 if the packet was read without problems, 0 if packets are being read from a live capture and the packet buffer timeout expired, PCAP_ERROR if an error occurred while reading the packet, and PCAP_ERROR_BREAK if packets are being read from a ``savefile'' and there are no more packets to read from the savefile. If PCAP_ERROR is returned, pcap_geterr or pcap_perror(3PCAP) may be called with p as an argument to fetch or display the error text. +

pcap_next() returns a pointer to the packet data on success, and returns NULL if an error occurred, or if no packets were read from a live capture (if, for example, they were discarded because they didn't pass the packet filter, or if, on platforms that support a packet buffer timeout that starts before any packets arrive, the timeout expires before any packets arrive, or if the file descriptor for the capture device is in non-blocking mode and no packets were available to be read), or if no more packets are available in a ``savefile.'' Unfortunately, there is no way to determine whether an error occurred or not.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_offline_filter.html b/network/start/lib/npcap/docs/wpcap/pcap_offline_filter.html new file mode 100644 index 0000000..ec73ce9 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_offline_filter.html @@ -0,0 +1,66 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_offline_filter - check whether a filter matches a packet

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_offline_filter(const struct bpf_program *fp,
+    const struct pcap_pkthdr *h, const u_char *pkt)
+
+ +

DESCRIPTION

+

pcap_offline_filter() checks whether a filter matches a packet. fp is a pointer to a bpf_program struct, usually the result of a call to pcap_compile. h points to the pcap_pkthdr structure for the packet, and pkt points to the data in the packet.

RETURN VALUE

+

pcap_offline_filter() returns the return value of the filter program. This will be zero if the packet doesn't match the filter and non-zero if the packet matches the filter.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_open_dead.html b/network/start/lib/npcap/docs/wpcap/pcap_open_dead.html new file mode 100644 index 0000000..eeb75c0 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_open_dead.html @@ -0,0 +1,70 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_open_dead, pcap_open_dead_with_tstamp_precision - open a fake pcap_t for compiling filters or opening a capture for output

SYNOPSIS

+

+#include <pcap/pcap.h>
+pcap_t *pcap_open_dead(int linktype, int snaplen);
+pcap_t *pcap_open_dead_with_tstamp_precision(int linktype, int snaplen,
+    u_int precision);
+
+ +

DESCRIPTION

+

+

pcap_open_dead() and pcap_open_dead_with_tstamp_precision() are used for creating a pcap_t structure to use when calling the other functions in libpcap. It is typically used when just using libpcap for compiling BPF code; it can also be used if using pcap_dump_open, pcap_dump, and pcap_dump_close to write a savefile if there is no pcap_t that supplies the packets to be written. +

linktype specifies the link-layer type for the pcap_t. +

snaplen specifies the snapshot length for the pcap_t. +

When pcap_open_dead_with_tstamp_precision(), is used to create a pcap_t for use with pcap_dump_open(), precision specifies the time stamp precision for packets; PCAP_TSTAMP_PRECISION_MICRO should be specified if the packets to be written have time stamps in seconds and microseconds, and PCAP_TSTAMP_PRECISION_NANO should be specified if the packets to be written have time stamps in seconds and nanoseconds. Its value does not affect pcap_compile.

SEE ALSO

+

pcap(3PCAP), \%pcap-linktype(7)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_open_live.html b/network/start/lib/npcap/docs/wpcap/pcap_open_live.html new file mode 100644 index 0000000..89c9c19 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_open_live.html @@ -0,0 +1,71 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_open_live - open a device for capturing

SYNOPSIS

+

+#include <pcap/pcap.h>
+
+char errbuf[PCAP_ERRBUF_SIZE];
+pcap_t *pcap_open_live(const char *device, int snaplen,
+    int promisc, int to_ms, char *errbuf);
+
+ +

DESCRIPTION

+

pcap_open_live() is used to obtain a packet capture handle to look at packets on the network. device is a string that specifies the network device to open; on Linux systems with 2.2 or later kernels, a device argument of "any" or NULL can be used to capture packets from all interfaces. +

snaplen specifies the snapshot length to be set on the handle. +

promisc specifies if the interface is to be put into promiscuous mode. +

to_ms specifies the packet buffer timeout, as a non-negative value, in milliseconds. (See pcap(3PCAP) for an explanation of the packet buffer timeout.)

RETURN VALUE

+

pcap_open_live() returns a pcap_t * on success and NULL on failure. If NULL is returned, errbuf is filled in with an appropriate error message. errbuf may also be set to warning text when pcap_open_live() succeeds; to detect this case the caller should store a zero-length string in errbuf before calling pcap_open_live() and display the warning to the user if errbuf is no longer a zero-length string. errbuf is assumed to be able to hold at least PCAP_ERRBUF_SIZE chars.

SEE ALSO

+

pcap_create(3PCAP), pcap_activate(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_open_offline.html b/network/start/lib/npcap/docs/wpcap/pcap_open_offline.html new file mode 100644 index 0000000..6899a45 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_open_offline.html @@ -0,0 +1,76 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_open_offline, pcap_open_offline_with_tstamp_precision, pcap_fopen_offline, pcap_fopen_offline_with_tstamp_precision - open a saved capture file for reading

SYNOPSIS

+

+#include <pcap/pcap.h>
+
+char errbuf[PCAP_ERRBUF_SIZE];
+pcap_t *pcap_open_offline(const char *fname, char *errbuf);
+pcap_t *pcap_open_offline_with_tstamp_precision(const char *fname,
+    u_int precision, char *errbuf);
+pcap_t *pcap_fopen_offline(FILE *fp, char *errbuf);
+pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *fp,
+    u_int precision, char *errbuf);
+
+ +

DESCRIPTION

+

pcap_open_offline() and pcap_open_offline_with_tstamp_precision() are called to open a ``savefile'' for reading. +

fname specifies the name of the file to open. The file can have the pcap file format as described in pcap-savefile(5), which is the file format used by, among other programs, tcpdump(1) and tcpslice(1), or can have the pcapng file format, although not all pcapng files can be read. The name "-" is a synonym for stdin. +

pcap_open_offline_with_tstamp_precision() takes an additional precision argument specifying the time stamp precision desired; if PCAP_TSTAMP_PRECISION_MICRO is specified, packet time stamps will be supplied in seconds and microseconds, and if PCAP_TSTAMP_PRECISION_NANO is specified, packet time stamps will be supplied in seconds and nanoseconds. If the time stamps in the file do not have the same precision as the requested precision, they will be scaled up or down as necessary before being supplied. +

Alternatively, you may call pcap_fopen_offline() or pcap_fopen_offline_with_tstamp_precision() to read dumped data from an existing open stream fp. pcap_fopen_offline_with_tstamp_precision() takes an additional precision argument as described above. Note that on Windows, that stream should be opened in binary mode.

RETURN VALUE

+

pcap_open_offline(), pcap_open_offline_with_tstamp_precision(), pcap_fopen_offline(), and pcap_fopen_offline_with_tstamp_precision() return a pcap_t * on success and NULL on failure. If NULL is returned, errbuf is filled in with an appropriate error message. errbuf is assumed to be able to hold at least PCAP_ERRBUF_SIZE chars.

BACKWARD COMPATIBILITY

+

pcap_open_offline_with_tstamp_precision and pcap_fopen_offline_with_tstamp_precision became available in libpcap release 1.5.1. In previous releases, time stamps from a savefile are always given in seconds and microseconds.

SEE ALSO

+

pcap(3PCAP), pcap-savefile(5)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_set_buffer_size.html b/network/start/lib/npcap/docs/wpcap/pcap_set_buffer_size.html new file mode 100644 index 0000000..a93b22d --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_set_buffer_size.html @@ -0,0 +1,65 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_set_buffer_size - set the buffer size for a not-yet-activated capture handle

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_set_buffer_size(pcap_t *p, int buffer_size);
+
+ +

DESCRIPTION

+

pcap_set_buffer_size() sets the buffer size that will be used on a capture handle when the handle is activated to buffer_size, which is in units of bytes.

RETURN VALUE

+

pcap_set_buffer_size() returns 0 on success or PCAP_ERROR_ACTIVATED if called on a capture handle that has been activated.

SEE ALSO

+

pcap(3PCAP), pcap_create(3PCAP), pcap_activate(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_set_datalink.html b/network/start/lib/npcap/docs/wpcap/pcap_set_datalink.html new file mode 100644 index 0000000..57c55f1 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_set_datalink.html @@ -0,0 +1,65 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_set_datalink - set the link-layer header type to be used by a capture device

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_set_datalink(pcap_t *p, int dlt);
+
+ +

DESCRIPTION

+

pcap_set_datalink() is used to set the current link-layer header type of the pcap descriptor to the type specified by dlt.

RETURN VALUE

+

pcap_set_datalink() returns 0 on success and PCAP_ERROR on failure. If PCAP_ERROR is returned, pcap_geterr or pcap_perror(3PCAP) may be called with p as an argument to fetch or display the error text.

SEE ALSO

+

pcap(3PCAP), pcap_datalink_name_to_val(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_set_promisc.html b/network/start/lib/npcap/docs/wpcap/pcap_set_promisc.html new file mode 100644 index 0000000..0a3d7b2 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_set_promisc.html @@ -0,0 +1,65 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_set_promisc - set promiscuous mode for a not-yet-activated capture handle

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_set_promisc(pcap_t *p, int promisc);
+
+ +

DESCRIPTION

+

pcap_set_promisc() sets whether promiscuous mode should be set on a capture handle when the handle is activated. If promisc is non-zero, promiscuous mode will be set, otherwise it will not be set.

RETURN VALUE

+

pcap_set_promisc() returns 0 on success or PCAP_ERROR_ACTIVATED if called on a capture handle that has been activated.

SEE ALSO

+

pcap(3PCAP), pcap_create(3PCAP), pcap_activate(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_set_protocol_linux.html b/network/start/lib/npcap/docs/wpcap/pcap_set_protocol_linux.html new file mode 100644 index 0000000..cfc16fa --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_set_protocol_linux.html @@ -0,0 +1,68 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_set_protocol_linux - set capture protocol for a not-yet-activated capture handle

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_set_protocol_linux(pcap_t *p, int protocol);
+
+ +

DESCRIPTION

+

On network interface devices on Linux, pcap_set_protocol_linux() sets the protocol to be used in the socket(2) call to create a capture socket when the handle is activated. The argument is a link-layer protocol value, such as the values in the <linux/if_ether.h> header file, specified in host byte order. If protocol is non-zero, packets of that protocol will be captured when the handle is activated, otherwise, all packets will be captured. This function is only provided on Linux, and, if it is used on any device other than a network interface, it will have no effect. +

It should not be used in portable code; instead, a filter should be specified with pcap_setfilter. +

If a given network interface provides a standard link-layer header, with a standard packet type, but provides some packet types with a different socket-layer protocol type from the one in the link-layer header, that packet type cannot be filtered with a filter specified with pcap_setfilter() but can be filtered by specifying the socket-layer protocol type using pcap_set_protocol_linux().

RETURN VALUE

+

pcap_set_protocol_linux() returns 0 on success or PCAP_ERROR_ACTIVATED if called on a capture handle that has been activated.

BACKWARD COMPATIBILITY

+

This function became available in libpcap release 1.9.0.

SEE ALSO

+

pcap(3PCAP), pcap_create(3PCAP), pcap_activate(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_set_rfmon.html b/network/start/lib/npcap/docs/wpcap/pcap_set_rfmon.html new file mode 100644 index 0000000..a2f4a37 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_set_rfmon.html @@ -0,0 +1,65 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_set_rfmon - set monitor mode for a not-yet-activated capture handle

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_set_rfmon(pcap_t *p, int rfmon);
+
+ +

DESCRIPTION

+

pcap_set_rfmon() sets whether monitor mode should be set on a capture handle when the handle is activated. If rfmon is non-zero, monitor mode will be set, otherwise it will not be set.

RETURN VALUE

+

pcap_set_rfmon() returns 0 on success or PCAP_ERROR_ACTIVATED if called on a capture handle that has been activated.

SEE ALSO

+

pcap(3PCAP), pcap_create(3PCAP), pcap_activate(3PCAP), pcap_can_set_rfmon(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_set_snaplen.html b/network/start/lib/npcap/docs/wpcap/pcap_set_snaplen.html new file mode 100644 index 0000000..65b79a4 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_set_snaplen.html @@ -0,0 +1,65 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_set_snaplen - set the snapshot length for a not-yet-activated capture handle

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_set_snaplen(pcap_t *p, int snaplen);
+
+ +

DESCRIPTION

+

pcap_set_snaplen() sets the snapshot length to be used on a capture handle when the handle is activated to snaplen.

RETURN VALUE

+

pcap_set_snaplen() returns 0 on success or PCAP_ERROR_ACTIVATED if called on a capture handle that has been activated.

SEE ALSO

+

pcap(3PCAP), pcap_create(3PCAP), pcap_activate(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_set_timeout.html b/network/start/lib/npcap/docs/wpcap/pcap_set_timeout.html new file mode 100644 index 0000000..7b48fb5 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_set_timeout.html @@ -0,0 +1,66 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_set_timeout - set the packet buffer timeout for a not-yet-activated capture handle

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_set_timeout(pcap_t *p, int to_ms);
+
+ +

DESCRIPTION

+

pcap_set_timeout() sets the packet buffer timeout that will be used on a capture handle when the handle is activated to to_ms, which is in units of milliseconds. (See pcap(3PCAP) for an explanation of the packet buffer timeout.) +

The behavior, if the timeout isn't specified, is undefined, as is the behavior if the timeout is set to zero or to a negative value. We recommend always setting the timeout to a non-zero value unless immediate mode is set, in which case the timeout has no effect.

RETURN VALUE

+

pcap_set_timeout() returns 0 on success or PCAP_ERROR_ACTIVATED if called on a capture handle that has been activated.

SEE ALSO

+

pcap_create(3PCAP), pcap_activate(3PCAP), \%pcap_set_immediate_mode(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_set_tstamp_precision.html b/network/start/lib/npcap/docs/wpcap/pcap_set_tstamp_precision.html new file mode 100644 index 0000000..715d0bc --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_set_tstamp_precision.html @@ -0,0 +1,75 @@ + + +3PCAP man page + + + + +

+

+

+

+

+

+

+

+

+

NAME

+

pcap_set_tstamp_precision - set the time stamp precision returned in captures

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_set_tstamp_precision(pcap_t *p, int tstamp_precision);
+
+ +

DESCRIPTION

+

pcap_set_tstamp_precision() sets the precision of the time stamp desired for packets captured on the pcap descriptor to the type specified by tstamp_precision. It must be called on a pcap descriptor created by pcap_create that has not yet been activated by pcap_activate. Two time stamp precisions are supported, microseconds and nanoseconds. One can use options PCAP_TSTAMP_PRECISION_MICRO and PCAP_TSTAMP_PRECISION_NANO to request desired precision. By default, time stamps are in microseconds.

RETURN VALUE

+

pcap_set_tstamp_precision() returns 0 on success if the specified time stamp precision is expected to be supported by the capture device, PCAP_ERROR_TSTAMP_PRECISION_NOTSUP if the capture device does not support the requested time stamp precision, PCAP_ERROR_ACTIVATED if called on a capture handle that has been activated.

BACKWARD COMPATIBILITY

+

This function became available in libpcap release 1.5.1. In previous releases, time stamps from a capture device or savefile are always given in seconds and microseconds.

SEE ALSO

+

pcap(3PCAP), pcap_get_tstamp_precision(3PCAP), pcap-tstamp(7)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_set_tstamp_type.html b/network/start/lib/npcap/docs/wpcap/pcap_set_tstamp_type.html new file mode 100644 index 0000000..02b432f --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_set_tstamp_type.html @@ -0,0 +1,67 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_set_tstamp_type - set the time stamp type to be used by a capture device

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_set_tstamp_type(pcap_t *p, int tstamp_type);
+
+ +

DESCRIPTION

+

pcap_set_tstamp_type() sets the type of time stamp desired for packets captured on the pcap descriptor to the type specified by tstamp_type. It must be called on a pcap descriptor created by pcap_create that has not yet been activated by pcap_activate. pcap_list_tstamp_types will give a list of the time stamp types supported by a given capture device. See pcap-tstamp(7) for a list of all the time stamp types.

RETURN VALUE

+

pcap_set_tstamp_type() returns 0 on success if the specified time stamp type is expected to be supported by the capture device, PCAP_WARNING_TSTAMP_TYPE_NOTSUP if the specified time stamp type is not supported by the capture device, PCAP_ERROR_ACTIVATED if called on a capture handle that has been activated, and PCAP_ERROR_CANTSET_TSTAMP_TYPE if the capture device doesn't support setting the time stamp type (only older versions of libpcap will return that; newer versions will always allow the time stamp type to be set to the default type).

BACKWARD COMPATIBILITY

+

+

This function became available in libpcap release 1.2.1. In previous releases, the time stamp type cannot be set; only the default time stamp type offered by a capture source is available.

SEE ALSO

+

pcap(3PCAP), pcap_tstamp_type_name_to_val(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_setdirection.html b/network/start/lib/npcap/docs/wpcap/pcap_setdirection.html new file mode 100644 index 0000000..f93e6d1 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_setdirection.html @@ -0,0 +1,67 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_setdirection - set the direction for which packets will be captured

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_setdirection(pcap_t *p, pcap_direction_t d);
+
+ +

DESCRIPTION

+

pcap_setdirection() is used to specify a direction that packets will be captured. d is one of the constants PCAP_D_IN, PCAP_D_OUT or PCAP_D_INOUT. PCAP_D_IN will only capture packets received by the device, PCAP_D_OUT will only capture packets sent by the device and PCAP_D_INOUT will capture packets received by or sent by the device. PCAP_D_INOUT is the default setting if this function is not called. +

pcap_setdirection() isn't necessarily fully supported on all platforms; some platforms might return an error for all values, and some other platforms might not support PCAP_D_OUT. +

This operation is not supported if a ``savefile'' is being read.

RETURN VALUE

+

pcap_setdirection() returns 0 on success and PCAP_ERROR on failure. If PCAP_ERROR is returned, pcap_geterr or pcap_perror(3PCAP) may be called with p as an argument to fetch or display the error text.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_setfilter.html b/network/start/lib/npcap/docs/wpcap/pcap_setfilter.html new file mode 100644 index 0000000..3ad6818 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_setfilter.html @@ -0,0 +1,65 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_setfilter - set the filter

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_setfilter(pcap_t *p, struct bpf_program *fp);
+
+ +

DESCRIPTION

+

pcap_setfilter() is used to specify a filter program. fp is a pointer to a bpf_program struct, usually the result of a call to \%pcap_compile(3PCAP).

RETURN VALUE

+

pcap_setfilter() returns 0 on success and PCAP_ERROR on failure. If PCAP_ERROR is returned, pcap_geterr or pcap_perror(3PCAP) may be called with p as an argument to fetch or display the error text.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_setnonblock.html b/network/start/lib/npcap/docs/wpcap/pcap_setnonblock.html new file mode 100644 index 0000000..a0865fe --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_setnonblock.html @@ -0,0 +1,70 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_setnonblock, pcap_getnonblock - set or get the state of non-blocking mode on a capture device

SYNOPSIS

+

+#include <pcap/pcap.h>
+
+char errbuf[PCAP_ERRBUF_SIZE];
+int pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf);
+int pcap_getnonblock(pcap_t *p, char *errbuf);
+
+ +

DESCRIPTION

+

pcap_setnonblock() puts a capture handle into ``non-blocking'' mode, or takes it out of ``non-blocking'' mode, depending on whether the nonblock argument is non-zero or zero. It has no effect on ``savefiles''. If there is an error, PCAP_ERROR is returned and errbuf is filled in with an appropriate error message; otherwise, 0 is returned. In ``non-blocking'' mode, an attempt to read from the capture descriptor with pcap_dispatch(3PCAP) will, if no packets are currently available to be read, return 0 immediately rather than blocking waiting for packets to arrive. pcap_loop and pcap_next(3PCAP) will not work in ``non-blocking'' mode. +

When first activated with pcap_activate or opened with pcap_open_live(3PCAP) , a capture handle is not in ``non-blocking mode''; a call to pcap_setnonblock() is required in order to put it into ``non-blocking'' mode.

RETURN VALUE

+

pcap_getnonblock() returns the current ``non-blocking'' state of the capture descriptor; it always returns 0 on ``savefiles''. If there is an error, PCAP_ERROR is returned and errbuf is filled in with an appropriate error message. +

errbuf is assumed to be able to hold at least PCAP_ERRBUF_SIZE chars.

SEE ALSO

+

pcap(3PCAP), pcap_next_ex(3PCAP), pcap_geterr(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_snapshot.html b/network/start/lib/npcap/docs/wpcap/pcap_snapshot.html new file mode 100644 index 0000000..2b30b20 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_snapshot.html @@ -0,0 +1,66 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_snapshot - get the snapshot length

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_snapshot(pcap_t *p);
+
+ +

DESCRIPTION

+

pcap_snapshot() returns the snapshot length specified when pcap_set_snaplen or pcap_open_live was called, for a live capture, or the snapshot length from the capture file, for a ``savefile''. +

It must not be called on a pcap descriptor created by \%pcap_create(3PCAP) that has not yet been activated by \%pcap_activate(3PCAP).

RETURN VALUE

+

pcap_snapshot() returns the snapshot length on success and PCAP_ERROR_NOT_ACTIVATED if called on a capture handle that has been created but not activated.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_stats.html b/network/start/lib/npcap/docs/wpcap/pcap_stats.html new file mode 100644 index 0000000..ee24ecd --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_stats.html @@ -0,0 +1,73 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_stats - get capture statistics

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_stats(pcap_t *p, struct pcap_stat *ps);
+
+ +

DESCRIPTION

+

pcap_stats() fills in the struct pcap_stat pointed to by its second argument. The values represent packet statistics from the start of the run to the time of the call. +

pcap_stats() is supported only on live captures, not on ``savefiles''; no statistics are stored in ``savefiles'', so no statistics are available when reading from a ``savefile''. +

A struct pcap_stat has the following members: +

+

ps_recv number of packets received; +

ps_drop number of packets dropped because there was no room in the operating system's buffer when they arrived, because packets weren't being read fast enough; +

ps_ifdrop number of packets dropped by the network interface or its driver. +

+

The statistics do not behave the same way on all platforms. ps_recv might count packets whether they passed any filter set with pcap_setfilter(3PCAP) or not, or it might count only packets that pass the filter. It also might, or might not, count packets dropped because there was no room in the operating system's buffer when they arrived. ps_drop is not available on all platforms; it is zero on platforms where it's not available. If packet filtering is done in libpcap, rather than in the operating system, it would count packets that don't pass the filter. Both ps_recv and ps_drop might, or might not, count packets not yet read from the operating system and thus not yet seen by the application. ps_ifdrop might, or might not, be implemented; if it's zero, that might mean that no packets were dropped by the interface, or it might mean that the statistic is unavailable, so it should not be treated as an indication that the interface did not drop any packets.

RETURN VALUE

+

pcap_stats() returns 0 on success and returns PCAP_ERROR if there is an error or if p doesn't support packet statistics. If PCAP_ERROR is returned, pcap_geterr or pcap_perror(3PCAP) may be called with p as an argument to fetch or display the error text.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_statustostr.html b/network/start/lib/npcap/docs/wpcap/pcap_statustostr.html new file mode 100644 index 0000000..ee03a0b --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_statustostr.html @@ -0,0 +1,64 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_statustostr - convert a PCAP_ERROR_ or PCAP_WARNING_ value to a string

SYNOPSIS

+

+#include <pcap/pcap.h>
+const char *pcap_statustostr(int error);
+
+ +

DESCRIPTION

+

pcap_statustostr() converts a PCAP_ERROR_ or PCAP_WARNING_ value returned by a libpcap routine to an error string.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_strerror.html b/network/start/lib/npcap/docs/wpcap/pcap_strerror.html new file mode 100644 index 0000000..2a17456 --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_strerror.html @@ -0,0 +1,64 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_strerror - convert an errno value to a string

SYNOPSIS

+

+#include <pcap/pcap.h>
+const char *pcap_strerror(int error);
+
+ +

DESCRIPTION

+

pcap_strerror() is provided in case strerror(3) isn't available. It returns an error message string corresponding to error.

SEE ALSO

+

pcap(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_tstamp_type_name_to_val.html b/network/start/lib/npcap/docs/wpcap/pcap_tstamp_type_name_to_val.html new file mode 100644 index 0000000..ef941ea --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_tstamp_type_name_to_val.html @@ -0,0 +1,67 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_tstamp_type_name_to_val - get the time stamp type value corresponding to a time stamp type name

SYNOPSIS

+

+#include <pcap/pcap.h>
+int pcap_tstamp_type_name_to_val(const char *name);
+
+ +

DESCRIPTION

+

pcap_tstamp_type_name_to_val() translates a time stamp type name to the corresponding time stamp type value. The translation is case-insensitive.

RETURN VALUE

+

pcap_tstamp_type_name_to_val() returns time stamp type value on success and PCAP_ERROR on failure.

BACKWARD COMPATIBILITY

+

+

This function became available in libpcap release 1.2.1.

SEE ALSO

+

pcap(3PCAP), pcap_tstamp_type_val_to_name(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/npcap/docs/wpcap/pcap_tstamp_type_val_to_name.html b/network/start/lib/npcap/docs/wpcap/pcap_tstamp_type_val_to_name.html new file mode 100644 index 0000000..d594b5e --- /dev/null +++ b/network/start/lib/npcap/docs/wpcap/pcap_tstamp_type_val_to_name.html @@ -0,0 +1,68 @@ + + +3PCAP man page + + + + +

NAME

+

pcap_tstamp_type_val_to_name, pcap_tstamp_type_val_to_description - get a name or description for a time stamp type value

SYNOPSIS

+

+#include <pcap.h>
+const char *pcap_tstamp_type_val_to_name(int tstamp_type);
+const char *pcap_tstamp_type_val_to_description(int tstamp_type);
+
+ +

DESCRIPTION

+

pcap_tstamp_type_val_to_name() translates a time stamp type value to the corresponding time stamp type name. NULL is returned on failure. +

pcap_tstamp_type_val_to_description() translates a time stamp type value to a short description of that time stamp type. NULL is returned on failure.

BACKWARD COMPATIBILITY

+

+

These functions became available in libpcap release 1.2.1.

SEE ALSO

+

pcap(3PCAP), pcap_tstamp_type_name_to_val(3PCAP)

+ This HTML page was made with roffit. + diff --git a/network/start/lib/xnet/CMakeLists.txt b/network/start/lib/xnet/CMakeLists.txt new file mode 100644 index 0000000..dec4ad4 --- /dev/null +++ b/network/start/lib/xnet/CMakeLists.txt @@ -0,0 +1,6 @@ +include_directories( + ${PROJECT_SOURCE_DIR}/xnet/src/xnet/inc +) + +aux_source_directory(. DIR_HELLO_SRCS) +add_library(xnet_lib ${DIR_HELLO_SRCS} ) diff --git a/network/start/lib/xnet/enc28j60_device.c b/network/start/lib/xnet/enc28j60_device.c new file mode 100644 index 0000000..5d5827d --- /dev/null +++ b/network/start/lib/xnet/enc28j60_device.c @@ -0,0 +1,317 @@ +#include +#include "enc28j60_device.h" + +// 一共8KB的以太网缓存 +static u8 ENC28J60BANK; +int NextPacketPtr; + + +//delay for ms unit +//suitable for crystal is 8MHz +//static function for ENC28J60 +static void ENC28J60_delayms(u32 ms) +{ + u16 i=0; + while(ms--) + { + for(i=0;i<8000;i++); + } +} + +static inline void ENC28J60_cs_delayms(void) +{ +} + +//Reset ENC28J60 +//Initialize SPI2 and related I/O for ENC28J60 +static void ENC28J60_SPI2_Init(void) +{ + NVIC_InitTypeDef NVIC_InitStructure; + EXTI_InitTypeDef EXTI_InitStructure; + SPI_InitTypeDef SPI_InitStructure; + GPIO_InitTypeDef GPIO_InitStructure; + RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2, ENABLE ); + RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC, ENABLE ); + + // INT A7 + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; + GPIO_Init(GPIOA, &GPIO_InitStructure); + RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE); + GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource7); + + EXTI_InitStructure.EXTI_Line= EXTI_Line7; + EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; + EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; + EXTI_InitStructure.EXTI_LineCmd = ENABLE; + EXTI_Init(&EXTI_InitStructure); + + NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn; //使能外部中断所在的通道 + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02; //抢占优先级 2, + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x02; //子优先级 2 + NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能外部中断通道 + + NVIC_Init(&NVIC_InitStructure); //根据结构体信息进行优先级初始化 + + //CS pin + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; + GPIO_Init(GPIOB, &GPIO_InitStructure); + GPIO_SetBits(GPIOB,GPIO_Pin_12); + + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_Init(GPIOB, &GPIO_InitStructure); + GPIO_SetBits(GPIOB,GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15); + + //RST pin + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_Init(GPIOC, &GPIO_InitStructure); + GPIO_SetBits(GPIOC,GPIO_Pin_5); + + //setup SPI2 + SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; + SPI_InitStructure.SPI_Mode = SPI_Mode_Master; + SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; + SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low; + SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge; + SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; + SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2; + SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; + SPI_InitStructure.SPI_CRCPolynomial = 7; + SPI_Init(SPI2, &SPI_InitStructure); + + SPI_Cmd(SPI2, ENABLE); + + SPI2_ReadWriteByte(0xff); +} + +void ENC28J60_Reset(void) +{ + + ENC28J60_SPI2_Init(); //re-init SPI2 + ENC28J60_RST_CLEAR(); //reset ENC28J60 + ENC28J60_delayms(10); + ENC28J60_RST_SET(); //finish reset + ENC28J60_delayms(10); +} + +//Read ENC28J60 register +//op: command +//addr: register address +//return: read out data +u8 ENC28J60_Read_Op(u8 op,u8 addr) +{ + u8 dat=0; + + ENC28J60_SELECT(); + ENC28J60_cs_delayms(); + dat=op|(addr&ADDR_MASK); + SPI2_ReadWriteByte(dat); + dat=SPI2_ReadWriteByte(0xFF); + //datasheet p.29, read two times to get MAC/MII register value + if(addr&0x80)dat=SPI2_ReadWriteByte(0xFF); + ENC28J60_cs_delayms(); + ENC28J60_NO_SELECT(); + return dat; +} +//Write ENC28J60 register +//op: command +//addr: register address +//data: parameter to write +void ENC28J60_Write_Op(u8 op,u8 addr,u8 data) +{ + u8 dat = 0; + ENC28J60_SELECT(); + ENC28J60_cs_delayms(); + dat=op|(addr&ADDR_MASK); + SPI2_ReadWriteByte(dat); + SPI2_ReadWriteByte(data); + ENC28J60_cs_delayms(); + ENC28J60_NO_SELECT(); +} +//Read Rx buffer data from ENC28J60 +//len: data length to read +//data: pointer to store data +void ENC28J60_Read_Buf(u32 len,u8* data) +{ + ENC28J60_SELECT(); + ENC28J60_cs_delayms(); + SPI2_ReadWriteByte(ENC28J60_READ_BUF_MEM); + while(len--) { + *data++=(u8)SPI2_ReadWriteByte(0); + } + ENC28J60_cs_delayms(); + ENC28J60_NO_SELECT(); +} +//Write data to send via ENC28J60 +//len: data length to send +//data: data pointer +void ENC28J60_Write_Buf(u32 len,u8* data) +{ + ENC28J60_SELECT(); + ENC28J60_cs_delayms(); + SPI2_ReadWriteByte(ENC28J60_WRITE_BUF_MEM); + while(len--) + { + SPI2_ReadWriteByte(*data++); + } + ENC28J60_cs_delayms(); + ENC28J60_NO_SELECT(); +} +//Setup ENC28J60 register bank +//ban: Bank to be setup +void ENC28J60_Set_Bank(u8 bank) +{ + if((bank&BANK_MASK)!=ENC28J60BANK) + { + ENC28J60_Write_Op(ENC28J60_BIT_FIELD_CLR,ECON1,(ECON1_BSEL1|ECON1_BSEL0)); + ENC28J60_Write_Op(ENC28J60_BIT_FIELD_SET,ECON1,(bank&BANK_MASK)>>5); + ENC28J60BANK=(bank&BANK_MASK); + } +} +//Read ENC28J60 register +//addr: register address +//return: read out value +u8 ENC28J60_Read(u8 addr) +{ + ENC28J60_Set_Bank(addr);//select bank + return ENC28J60_Read_Op(ENC28J60_READ_CTRL_REG,addr); +} +//Write ENC28J60 register +//addr: register address +void ENC28J60_Write(u8 addr,u8 data) +{ + ENC28J60_Set_Bank(addr); + ENC28J60_Write_Op(ENC28J60_WRITE_CTRL_REG,addr,data); +} +//Write into PHY register of ENC28J60 +//addr: register address +//data: parameter written into register +void ENC28J60_PHY_Write(u8 addr,u32 data) +{ + u16 retry=0; + ENC28J60_Write(MIREGADR,addr); + ENC28J60_Write(MIWRL,data); + ENC28J60_Write(MIWRH,data>>8); + while((ENC28J60_Read(MISTAT)&MISTAT_BUSY)&&retry<0XFFF)retry++;//wait until PHY writing finish +} +//Setup ENC28J60 +//macaddr: assigned MAC address +//return: 0=success, 1=failed +u8 ENC28J60_Init(u8* macaddr) +{ + u16 retry=0; + ENC28J60_Reset(); + ENC28J60_Write_Op(ENC28J60_SOFT_RESET,0,ENC28J60_SOFT_RESET); //software reset + while(!(ENC28J60_Read(ESTAT)&ESTAT_CLKRDY)&&retry<500) //wait until clock is stable + { + retry++; + ENC28J60_delayms(1); + }; + if(retry>=500)return 1;//initialization failed + //set Rx buffer address with 8k capacity + NextPacketPtr=RXSTART_INIT; + + //初始化接收缓冲区,设置接收起始地址 + ENC28J60_Write(ERXSTL,RXSTART_INIT&0xFF); + ENC28J60_Write(ERXSTH,RXSTART_INIT>>8); + + //设置接收读指针指向地址 + ENC28J60_Write(ERXRDPTL, RXSTART_INIT &0xFF); + ENC28J60_Write(ERXRDPTH, RXSTART_INIT>>8); + + //设置接收缓冲区的末尾地址 + ENC28J60_Write(ERXNDL,RXSTOP_INIT&0xFF); + ENC28J60_Write(ERXNDH,RXSTOP_INIT>>8); + + //设置发送缓冲区的起始地址 + ENC28J60_Write(ETXSTL,TXSTART_INIT&0xFF); + ENC28J60_Write(ETXSTH,TXSTART_INIT>>8); + //setup "eno of tx" byte + ENC28J60_Write(ETXNDL,TXSTOP_INIT&0xFF); + ENC28J60_Write(ETXNDH,TXSTOP_INIT>>8); + + + ENC28J60_Write(ERXFCON, ERXFCON_UCEN|ERXFCON_CRCEN|ERXFCON_PMEN); + + ENC28J60_Write(EPMM0,0x3f); + ENC28J60_Write(EPMM1,0x30); + ENC28J60_Write(EPMCSL,0xf9); + ENC28J60_Write(EPMCSH,0xf7); + + //MAC接收使能,下行程序段表示使能MAC接收,使能IEEE流量控制 + ENC28J60_Write(MACON1,MACON1_MARXEN|MACON1_TXPAUS|MACON1_RXPAUS); + // bring MAC out of reset + ENC28J60_Write(MACON2,0x00); //MACON2清零,让MAC退出复位状态 + // enable automatic padding to 60bytes and CRC operations + ENC28J60_Write_Op(ENC28J60_BIT_FIELD_SET,MACON3,MACON3_PADCFG0|MACON3_TXCRCEN|MACON3_FRMLNEN|MACON3_FULDPX); + // set inter-frame gap (non-back-to-back) + ENC28J60_Write(MAIPGL,0x12); + ENC28J60_Write(MAIPGH,0x0C); + // set inter-frame gap (back-to-back) + ENC28J60_Write(MABBIPG,0x15); + // Set the maximum packet size which the controller will accept + // Do not send packets longer than MAX_FRAMELEN: + ENC28J60_Write(MAMXFLL,MAX_FRAMELEN&0xFF); + ENC28J60_Write(MAMXFLH,MAX_FRAMELEN>>8); + + // do bank 3 stuff + // write MAC address + // NOTE: MAC address in ENC28J60 is byte-backward + ENC28J60_Write(MAADR5,macaddr[0]); + ENC28J60_Write(MAADR4,macaddr[1]); + ENC28J60_Write(MAADR3,macaddr[2]); + ENC28J60_Write(MAADR2,macaddr[3]); + ENC28J60_Write(MAADR1,macaddr[4]); + ENC28J60_Write(MAADR0,macaddr[5]); + + //setup PHY as Duplex + ENC28J60_PHY_Write(PHCON1,PHCON1_PDPXMD); + // no loopback of transmitted frames 禁止环回 + //HDLDIS:PHY 半双工环回禁止位 + ENC28J60_PHY_Write(PHCON2,PHCON2_HDLDIS); + // switch to bank 0 + ENC28J60_Set_Bank(ECON1); + // enable interrutps + ENC28J60_Write_Op(ENC28J60_BIT_FIELD_SET,EIE,EIE_INTIE|EIE_PKTIE); + // enable packet reception + ENC28J60_Write_Op(ENC28J60_BIT_FIELD_SET,ECON1,ECON1_RXEN); + if(ENC28J60_Read(MAADR5)== macaddr[0]) { + ENC28J60_delayms(10); + return 0;//initialization success + } + if(ENC28J60_Read(MAADR4)== macaddr[1]) { + ENC28J60_delayms(10); + return 0;//initialization success + } + if(ENC28J60_Read(MAADR3)== macaddr[2]) { + ENC28J60_delayms(10); + return 0;//initialization success + } + if(ENC28J60_Read(MAADR2)== macaddr[3]) { + ENC28J60_delayms(10); + return 0;//initialization success + } + if(ENC28J60_Read(MAADR1)== macaddr[4]) { + ENC28J60_delayms(10); + return 0;//initialization success + } + if(ENC28J60_Read(MAADR0)== macaddr[5]) { + ENC28J60_delayms(10); + return 0;//initialization success + } + + return -1; +} +//Read EREVID +u8 ENC28J60_Get_EREVID(void) +{ + return ENC28J60_Read(EREVID); +} + + diff --git a/network/start/lib/xnet/enc28j60_device.h b/network/start/lib/xnet/enc28j60_device.h new file mode 100644 index 0000000..6169446 --- /dev/null +++ b/network/start/lib/xnet/enc28j60_device.h @@ -0,0 +1,294 @@ + +#ifndef _ENC28J60_H +#define _ENC28J60_H + +//Include +#include "stm32f10x.h" +#include "stm32f10x_conf.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// ENC28J60 Control Registers +// Control register definitions are a combination of address, +// bank number, and Ethernet/MAC/PHY indicator bits. +// - Register address (bits 0-4) +// - Bank number (bits 5-6) +// - MAC/PHY indicator (bit 7) +#define ADDR_MASK 0x1F +#define BANK_MASK 0x60 +#define SPRD_MASK 0x80 +// All-bank registers +#define EIE 0x1B +#define EIR 0x1C +#define ESTAT 0x1D +#define ECON2 0x1E +#define ECON1 0x1F +// Bank 0 registers +#define ERDPTL (0x00|0x00) +#define ERDPTH (0x01|0x00) +#define EWRPTL (0x02|0x00) +#define EWRPTH (0x03|0x00) +#define ETXSTL (0x04|0x00) +#define ETXSTH (0x05|0x00) +#define ETXNDL (0x06|0x00) +#define ETXNDH (0x07|0x00) +#define ERXSTL (0x08|0x00) +#define ERXSTH (0x09|0x00) +#define ERXNDL (0x0A|0x00) +#define ERXNDH (0x0B|0x00) +//ERXWRPTH:ERXWRPTL 寄存器定义硬件向FIFO 中 +//的哪个位置写入其接收到的字节。 指针是只读的,在成 +//功接收到一个数据包后,硬件会自动更新指针。 指针可 +//用于判断FIFO 内剩余空间的大小。 +#define ERXRDPTL (0x0C|0x00) +#define ERXRDPTH (0x0D|0x00) +#define ERXWRPTL (0x0E|0x00) +#define ERXWRPTH (0x0F|0x00) +#define EDMASTL (0x10|0x00) +#define EDMASTH (0x11|0x00) +#define EDMANDL (0x12|0x00) +#define EDMANDH (0x13|0x00) +#define EDMADSTL (0x14|0x00) +#define EDMADSTH (0x15|0x00) +#define EDMACSL (0x16|0x00) +#define EDMACSH (0x17|0x00) +// Bank 1 registers +#define EHT0 (0x00|0x20) +#define EHT1 (0x01|0x20) +#define EHT2 (0x02|0x20) +#define EHT3 (0x03|0x20) +#define EHT4 (0x04|0x20) +#define EHT5 (0x05|0x20) +#define EHT6 (0x06|0x20) +#define EHT7 (0x07|0x20) +#define EPMM0 (0x08|0x20) +#define EPMM1 (0x09|0x20) +#define EPMM2 (0x0A|0x20) +#define EPMM3 (0x0B|0x20) +#define EPMM4 (0x0C|0x20) +#define EPMM5 (0x0D|0x20) +#define EPMM6 (0x0E|0x20) +#define EPMM7 (0x0F|0x20) +#define EPMCSL (0x10|0x20) +#define EPMCSH (0x11|0x20) +#define EPMOL (0x14|0x20) +#define EPMOH (0x15|0x20) +#define EWOLIE (0x16|0x20) +#define EWOLIR (0x17|0x20) +#define ERXFCON (0x18|0x20) +#define EPKTCNT (0x19|0x20) +// Bank 2 registers +#define MACON1 (0x00|0x40|0x80) +#define MACON2 (0x01|0x40|0x80) +#define MACON3 (0x02|0x40|0x80) +#define MACON4 (0x03|0x40|0x80) +#define MABBIPG (0x04|0x40|0x80) +#define MAIPGL (0x06|0x40|0x80) +#define MAIPGH (0x07|0x40|0x80) +#define MACLCON1 (0x08|0x40|0x80) +#define MACLCON2 (0x09|0x40|0x80) +#define MAMXFLL (0x0A|0x40|0x80) +#define MAMXFLH (0x0B|0x40|0x80) +#define MAPHSUP (0x0D|0x40|0x80) +#define MICON (0x11|0x40|0x80) +#define MICMD (0x12|0x40|0x80) +#define MIREGADR (0x14|0x40|0x80) +#define MIWRL (0x16|0x40|0x80) +#define MIWRH (0x17|0x40|0x80) +#define MIRDL (0x18|0x40|0x80) +#define MIRDH (0x19|0x40|0x80) +// Bank 3 registers +#define MAADR1 (0x00|0x60|0x80) +#define MAADR0 (0x01|0x60|0x80) +#define MAADR3 (0x02|0x60|0x80) +#define MAADR2 (0x03|0x60|0x80) +#define MAADR5 (0x04|0x60|0x80) +#define MAADR4 (0x05|0x60|0x80) +#define EBSTSD (0x06|0x60) +#define EBSTCON (0x07|0x60) +#define EBSTCSL (0x08|0x60) +#define EBSTCSH (0x09|0x60) +#define MISTAT (0x0A|0x60|0x80) +#define EREVID (0x12|0x60) +#define ECOCON (0x15|0x60) +#define EFLOCON (0x17|0x60) +#define EPAUSL (0x18|0x60) +#define EPAUSH (0x19|0x60) +// PHY registers +#define PHCON1 0x00 +#define PHSTAT1 0x01 +#define PHHID1 0x02 +#define PHHID2 0x03 +#define PHCON2 0x10 +#define PHSTAT2 0x11 +#define PHIE 0x12 +#define PHIR 0x13 +#define PHLCON 0x14 +// ENC28J60 ERXFCON Register Bit Definitions +#define ERXFCON_UCEN 0x80 +#define ERXFCON_ANDOR 0x40 +#define ERXFCON_CRCEN 0x20 +#define ERXFCON_PMEN 0x10 +#define ERXFCON_MPEN 0x08 +#define ERXFCON_HTEN 0x04 +#define ERXFCON_MCEN 0x02 +#define ERXFCON_BCEN 0x01 +// ENC28J60 EIE Register Bit Definitions +#define EIE_INTIE 0x80 +#define EIE_PKTIE 0x40 +#define EIE_DMAIE 0x20 +#define EIE_LINKIE 0x10 +#define EIE_TXIE 0x08 +#define EIE_WOLIE 0x04 +#define EIE_TXERIE 0x02 +#define EIE_RXERIE 0x01 +// ENC28J60 EIR Register Bit Definitions +#define EIR_PKTIF 0x40 +#define EIR_DMAIF 0x20 +#define EIR_LINKIF 0x10 +#define EIR_TXIF 0x08 +#define EIR_WOLIF 0x04 +#define EIR_TXERIF 0x02 +#define EIR_RXERIF 0x01 +// ENC28J60 ESTAT Register Bit Definitions +#define ESTAT_INT 0x80 +#define ESTAT_LATECOL 0x10 +#define ESTAT_RXBUSY 0x04 +#define ESTAT_TXABRT 0x02 +#define ESTAT_CLKRDY 0x01 +// ENC28J60 ECON2 Register Bit Definitions +#define ECON2_AUTOINC 0x80 +#define ECON2_PKTDEC 0x40 +#define ECON2_PWRSV 0x20 +#define ECON2_VRPS 0x08 +// ENC28J60 ECON1 Register Bit Definitions +#define ECON1_TXRST 0x80 +#define ECON1_RXRST 0x40 +#define ECON1_DMAST 0x20 +#define ECON1_CSUMEN 0x10 +#define ECON1_TXRTS 0x08 +#define ECON1_RXEN 0x04 +#define ECON1_BSEL1 0x02 +#define ECON1_BSEL0 0x01 +// ENC28J60 MACON1 Register Bit Definitions +#define MACON1_LOOPBK 0x10 +#define MACON1_TXPAUS 0x08 +#define MACON1_RXPAUS 0x04 +#define MACON1_PASSALL 0x02 +#define MACON1_MARXEN 0x01 +// ENC28J60 MACON2 Register Bit Definitions +#define MACON2_MARST 0x80 +#define MACON2_RNDRST 0x40 +#define MACON2_MARXRST 0x08 +#define MACON2_RFUNRST 0x04 +#define MACON2_MATXRST 0x02 +#define MACON2_TFUNRST 0x01 +// ENC28J60 MACON3 Register Bit Definitions +#define MACON3_PADCFG2 0x80 +#define MACON3_PADCFG1 0x40 +#define MACON3_PADCFG0 0x20 +#define MACON3_TXCRCEN 0x10 +#define MACON3_PHDRLEN 0x08 +#define MACON3_HFRMLEN 0x04 +#define MACON3_FRMLNEN 0x02 +#define MACON3_FULDPX 0x01 +// ENC28J60 MICMD Register Bit Definitions +#define MICMD_MIISCAN 0x02 +#define MICMD_MIIRD 0x01 +// ENC28J60 MISTAT Register Bit Definitions +#define MISTAT_NVALID 0x04 +#define MISTAT_SCAN 0x02 +#define MISTAT_BUSY 0x01 +// ENC28J60 PHY PHCON1 Register Bit Definitions +#define PHCON1_PRST 0x8000 +#define PHCON1_PLOOPBK 0x4000 +#define PHCON1_PPWRSV 0x0800 +#define PHCON1_PDPXMD 0x0100 +// ENC28J60 PHY PHSTAT1 Register Bit Definitions +#define PHSTAT1_PFDPX 0x1000 +#define PHSTAT1_PHDPX 0x0800 +#define PHSTAT1_LLSTAT 0x0004 +#define PHSTAT1_JBSTAT 0x0002 +// ENC28J60 PHY PHCON2 Register Bit Definitions +#define PHCON2_FRCLINK 0x4000 +#define PHCON2_TXDIS 0x2000 +#define PHCON2_JABBER 0x0400 +#define PHCON2_HDLDIS 0x0100 + +// ENC28J60 Packet Control Byte Bit Definitions +#define PKTCTRL_PHUGEEN 0x08 +#define PKTCTRL_PPADEN 0x04 +#define PKTCTRL_PCRCEN 0x02 +#define PKTCTRL_POVERRIDE 0x01 + +// SPI operation codes +#define ENC28J60_READ_CTRL_REG 0x00 +#define ENC28J60_READ_BUF_MEM 0x3A +#define ENC28J60_WRITE_CTRL_REG 0x40 +#define ENC28J60_WRITE_BUF_MEM 0x7A +#define ENC28J60_BIT_FIELD_SET 0x80 +#define ENC28J60_BIT_FIELD_CLR 0xA0 +#define ENC28J60_SOFT_RESET 0xFF + +// The RXSTART_INIT should be zero. See Rev. B4 Silicon Errata +// buffer boundaries applied to internal 8K ram +// the entire available packet buffer space is allocated +// +// start with recbuf at 0/ +#define RXSTART_INIT 0x0 +// receive buffer end +#define RXSTOP_INIT 0x800 +// start TX buffer at 0x1FFF-0x0600, pace for one full ethernet frame (0~1518 bytes) +#define TXSTART_INIT (0x1FFF-3*1518) +// stp TX buffer at end of mem +#define TXSTOP_INIT 0x1FFF +// max frame length which the conroller will accept: +#define MAX_FRAMELEN 1518 // (note: maximum ethernet frame length would be 1518) +//////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + +static inline u8 SPI2_ReadWriteByte(u8 TxData) +{ + //Fill output buffer with data + SPI2->DR = TxData; + + //Wait for transmission to complete + while ((SPI2->SR & (SPI_I2S_FLAG_RXNE | SPI_I2S_FLAG_TXE)) == RESET) {} + while (SPI2->SR & SPI_I2S_FLAG_BSY) {} + + //Return data from buffer + return SPI2->DR; +} + +/*CS Pin Definition*/ +#define ENC28J60_CS_PORT GPIOB +#define ENC28J60_CS_CLK RCC_APB2Periph_GPIOB +#define ENC28J60_CS_PIN GPIO_Pin_12 +#define ENC28J60_NO_SELECT() GPIOB->BSRR = GPIO_Pin_12 +#define ENC28J60_SELECT() GPIOB->BRR = GPIO_Pin_12 + +/*RST Pin Definition*/ +#define ENC28J60_RST_PORT GPIOC +#define ENC28J60_RST_CLK RCC_APB2Periph_GPIOC +#define ENC28J60_RST_PIN GPIO_Pin_5 +#define ENC28J60_RST_SET() GPIOC->BSRR = GPIO_Pin_5 +#define ENC28J60_RST_CLEAR() GPIOC->BRR = GPIO_Pin_5 +//SPI1初始化 +void ENC28J60_Reset(void); +u8 ENC28J60_Read_Op(u8 op,u8 addr); +void ENC28J60_Write_Op(u8 op,u8 addr,u8 data); +void ENC28J60_Read_Buf(u32 len,u8* data); +void ENC28J60_Write_Buf(u32 len,u8* data); +void ENC28J60_Set_Bank(u8 bank); +u8 ENC28J60_Read(u8 addr); +void ENC28J60_Write(u8 addr,u8 data); +void ENC28J60_PHY_Write(u8 addr,u32 data); +u8 ENC28J60_Init(u8* macaddr); +u8 ENC28J60_Get_EREVID(void); +void ENC28J60_Packet_Send(u32 len,u8* packet); +u32 ENC28J60_Packet_Receive(u32 maxlen,u8* packet); + +extern int NextPacketPtr; + +#endif + + diff --git a/network/start/lib/xnet/pcap_device.c b/network/start/lib/xnet/pcap_device.c new file mode 100644 index 0000000..db75053 --- /dev/null +++ b/network/start/lib/xnet/pcap_device.c @@ -0,0 +1,225 @@ +#include +#include "pcap_device.h" +#include +#include + +static int load_pcap_lib() { + return 0; +} + +/** + * 找到指定IP地址的网卡名 + * @param ip 物理网卡或者由虚拟软件生成的虚拟刚卡, 字符串形式,如"192.168.1.1" + * @param name_buf 找到的对应网卡名称 + */ +static int pcap_find_device(const char* ip, char* name_buf) { + char err_buf[PCAP_ERRBUF_SIZE]; + pcap_if_t* pcap_if_list = NULL; + struct in_addr dest_ip; + pcap_if_t* item; + + inet_pton(AF_INET, ip, &dest_ip); + + int err = pcap_findalldevs(&pcap_if_list, err_buf); + if (err < 0) { + pcap_freealldevs(pcap_if_list); + return -1; + } + + for (item = pcap_if_list; item != NULL; item = item->next) { + if (item->addresses == NULL) { + continue; + } + + for (struct pcap_addr* pcap_addr = item->addresses; pcap_addr != NULL; pcap_addr = pcap_addr->next) { + struct sockaddr_in* curr_addr; + struct sockaddr* sock_addr = pcap_addr->addr; + + if (sock_addr->sa_family != AF_INET) { + continue; + } + + curr_addr = ((struct sockaddr_in*)sock_addr); + if (curr_addr->sin_addr.s_addr == dest_ip.s_addr) { + strcpy(name_buf, item->name); + pcap_freealldevs(pcap_if_list); + return 0; + } + } + } + + pcap_freealldevs(pcap_if_list); + return -1; +} + +/* + * 显示所有的网络接口列表 + */ +static int pcap_show_list(void) { + char err_buf[PCAP_ERRBUF_SIZE]; + pcap_if_t* pcapif_list = NULL; + int count = 0; + + // 查找所有的网络接口 + int err = pcap_findalldevs(&pcapif_list, err_buf); + if (err < 0) { + fprintf(stderr, "pcap_show_list: find all net list failed:%s\n", err_buf); + pcap_freealldevs(pcapif_list); + return -1; + } + + printf("pcap_show_list: card list\n"); + + // 遍历所有的可用接口,输出其信息 + for (pcap_if_t* item = pcapif_list; item != NULL; item = item->next) { + if (item->addresses == NULL) { + continue; + } + + for (struct pcap_addr* pcap_addr = item->addresses; pcap_addr != NULL; pcap_addr = pcap_addr->next) { + char str[INET_ADDRSTRLEN]; + struct sockaddr_in* ip_addr; + + struct sockaddr* sockaddr = pcap_addr->addr; + if (sockaddr->sa_family != AF_INET) { + continue; + } + + ip_addr = (struct sockaddr_in*)sockaddr; + printf("card %d: IP:%s name: %s, \n\n", + count++, + item->description == NULL ? "" : item->description, + inet_ntop(AF_INET, &ip_addr->sin_addr, str, sizeof(str)) + ); + break; + } + } + + pcap_freealldevs(pcapif_list); + + if ((pcapif_list == NULL) || (count == 0)) { + fprintf(stderr, "pcap_show_list: no available card!\n"); + return -1; + } + + return 0; +} + +/** + * 打开pcap设备接口 + * @param ip 打开网卡的指定ip + * @param 给网卡设置mac + */ +pcap_t* pcap_device_open(const char* ip, const uint8_t * mac_addr, uint8_t poll_mode) { + char err_buf[PCAP_ERRBUF_SIZE]; + struct bpf_program fp; + bpf_u_int32 mask; + bpf_u_int32 net; + char filter_exp[256]; + char name_buf[256]; + pcap_t* pcap; + + if (load_pcap_lib() < 0) { + fprintf(stderr, "pcap_open: load pcap dll failed! install it first\n"); + return (pcap_t*)0; + } + + if (pcap_find_device(ip, name_buf) < 0) { + fprintf(stderr, "pcap_open: no net card has ip: %s, use the following:\n", ip); + pcap_show_list(); + return (pcap_t*)0; + } + + if (pcap_lookupnet(name_buf, &net, &mask, err_buf) == -1) { + printf("pcap_open: can't find use net card: %s\n", name_buf); + net = 0; + mask = 0; + } + + pcap = pcap_open_live(name_buf, // 设置字符串 + 65536, // 要捕获的最大字节数 + 1, // 混杂模式 + 0, // 读取超时(以毫秒为单位) + err_buf); + if (pcap == NULL) { + fprintf(stderr, "pcap_open: create pcap failed %s\n net card name: %s\n", err_buf, name_buf); + fprintf(stderr, "Use the following:\n"); + pcap_show_list(); + return (pcap_t*)0; + } + + // 非阻塞模式读取,程序中使用查询的方式读 + if (pcap_setnonblock(pcap, 1, err_buf) != 0) { + fprintf(stderr, "pcap_open: set none block failed: %s\n", pcap_geterr(pcap)); + return (pcap_t*)0; + } + + // 只捕获输入,不要捕获自己发出去的 + // 注:win平台似乎不支持这个选项 + if (pcap_setdirection(pcap, PCAP_D_IN) != 0) { + // fprintf(stderr, "pcap_open: set direction not suppor: %s\n", pcap_geterr(pcap)); + + } + + // 只捕获发往本接口与广播的数据帧。相当于只处理发往这张网卡的包 + sprintf(filter_exp, + "(ether dst %02x:%02x:%02x:%02x:%02x:%02x or ether broadcast) and (not ether src %02x:%02x:%02x:%02x:%02x:%02x)", + mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5], + mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); + if (pcap_compile(pcap, &fp, filter_exp, 0, net) == -1) { + printf("pcap_open: couldn't parse filter %s: %s\n", filter_exp, pcap_geterr(pcap)); + return (pcap_t*)0; + } + if (pcap_setfilter(pcap, &fp) == -1) { + printf("pcap_open: couldn't install filter %s: %s\n", filter_exp, pcap_geterr(pcap)); + return (pcap_t*)0; + } + + return pcap; +} + +/** + * 关闭Pcapif接口 + */ +void pcap_device_close(pcap_t* pcap) { + if (pcap == (pcap_t *)0) { + fprintf(stderr, "pcap = 0"); + pcap_show_list(); + return; + } + pcap_close(pcap); +} + +/** + * 向网络接口发送数据包 + */ +uint32_t pcap_device_send(pcap_t* pcap, const uint8_t* buffer, uint32_t length) { + if (pcap_sendpacket(pcap, buffer, length) == -1) { + fprintf(stderr, "pcap send: send packet failed!:%s\n", pcap_geterr(pcap)); + fprintf(stderr, "pcap send: pcaket size %d\n", length); + return 0; + } + + return 0; +} + +/** + * 从网络接口读取数据包 + */ +uint32_t pcap_device_read(pcap_t* pcap, uint8_t* buffer, uint32_t length) { + int err; + struct pcap_pkthdr* pkthdr; + const uint8_t* pkt_data; + + err = pcap_next_ex(pcap, &pkthdr, &pkt_data); + if (err == 0) { + return 0; + } else if (err == 1) { // 1 - 成功读取数据包, 0 - 没有数据包,其它值-出错 + memcpy(buffer, pkt_data, pkthdr->len); + return pkthdr->len; + } + + fprintf(stderr, "pcap_read: reading packet failed!:%s", pcap_geterr(pcap)); + return 0; +} + diff --git a/network/start/lib/xnet/pcap_device.h b/network/start/lib/xnet/pcap_device.h new file mode 100644 index 0000000..4498a73 --- /dev/null +++ b/network/start/lib/xnet/pcap_device.h @@ -0,0 +1,18 @@ +#ifndef PCAP_DRIVER_H +#define PCAP_DRIVER_H + +#include +#include + +// 主-次版本号 +#define NPCAP_VERSION_M 0 +#define NPCAP_VERSION_N 9986 + +typedef void (*irq_handler_t)(void* arg, uint8_t is_rx, const uint8_t* data, uint32_t size); + +pcap_t* pcap_device_open(const char* ip, const uint8_t *mac_addr, uint8_t poll_mode); +void pcap_device_close(pcap_t* pcap); +uint32_t pcap_device_send(pcap_t* pcap, const uint8_t* buffer, uint32_t length); +uint32_t pcap_device_read(pcap_t* pcap, uint8_t* buffer, uint32_t length); + +#endif //PCAP_DRIVER_H diff --git a/network/start/xnet_tiny/.idea/.name b/network/start/xnet_tiny/.idea/.name new file mode 100644 index 0000000..e634a87 --- /dev/null +++ b/network/start/xnet_tiny/.idea/.name @@ -0,0 +1 @@ +xnet \ No newline at end of file diff --git a/network/start/xnet_tiny/.idea/misc.xml b/network/start/xnet_tiny/.idea/misc.xml new file mode 100644 index 0000000..8822db8 --- /dev/null +++ b/network/start/xnet_tiny/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/network/start/xnet_tiny/.idea/modules.xml b/network/start/xnet_tiny/.idea/modules.xml new file mode 100644 index 0000000..e6803fc --- /dev/null +++ b/network/start/xnet_tiny/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/network/start/xnet_tiny/.idea/vcs.xml b/network/start/xnet_tiny/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/network/start/xnet_tiny/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/network/start/xnet_tiny/.idea/workspace.xml b/network/start/xnet_tiny/.idea/workspace.xml new file mode 100644 index 0000000..074e7b6 --- /dev/null +++ b/network/start/xnet_tiny/.idea/workspace.xml @@ -0,0 +1,563 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + opt_len + data_size + response_packet + hdr_size + pcap + ip_packet_id + ether_broadcast + tcp_send_reset + xip_in + xicmp_in + xudp_in + err + xnet_ntohs + netif_mac + xipaddr_is_equal_buf + xipaddr_is_equal + XNET_IPV4_ADDR_SIZE + PSH + http_send + XHTTP_RTX_SIZE + tx_buffer + get_line + XTCP_STATE_FIN_WAIT_1 + ip_hdr_size + tcp_hdr + size + XTCP_STATE_LAST_ACK + tcp + ip + min + + + memcpy + uint8_t + uint16_t + dest_packet->hdr.t + packet-> + swap_order32 + swap_order16 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +