netkitty 0.0.19 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.idea/inspectionProfiles/Project_Default.xml +2 -1
  3. package/.idea/netkitty.iml +0 -1
  4. package/cpp/nodepcap/deps/include/Packet32.h +429 -429
  5. package/cpp/nodepcap/deps/include/pcap/bluetooth.h +56 -56
  6. package/cpp/nodepcap/deps/include/pcap/bpf.h +292 -292
  7. package/cpp/nodepcap/deps/include/pcap/can_socketcan.h +56 -56
  8. package/cpp/nodepcap/deps/include/pcap/compiler-tests.h +163 -163
  9. package/cpp/nodepcap/deps/include/pcap/dlt.h +1514 -1514
  10. package/cpp/nodepcap/deps/include/pcap/funcattrs.h +325 -325
  11. package/cpp/nodepcap/deps/include/pcap/ipnet.h +43 -43
  12. package/cpp/nodepcap/deps/include/pcap/namedb.h +84 -84
  13. package/cpp/nodepcap/deps/include/pcap/nflog.h +94 -94
  14. package/cpp/nodepcap/deps/include/pcap/pcap-inttypes.h +101 -101
  15. package/cpp/nodepcap/deps/include/pcap/pcap.h +1219 -1219
  16. package/cpp/nodepcap/deps/include/pcap/sll.h +149 -149
  17. package/cpp/nodepcap/deps/include/pcap/socket.h +84 -84
  18. package/cpp/nodepcap/deps/include/pcap/usb.h +143 -143
  19. package/cpp/nodepcap/deps/include/pcap/vlan.h +46 -46
  20. package/cpp/nodepcap/deps/include/pcap-bpf.h +45 -45
  21. package/cpp/nodepcap/deps/include/pcap-namedb.h +40 -40
  22. package/cpp/nodepcap/deps/include/pcap.h +43 -43
  23. package/dist/CodecExports.d.ts +1 -0
  24. package/dist/CodecExports.d.ts.map +1 -1
  25. package/dist/lib/codec/Codec.js +1 -1
  26. package/dist/lib/codec/PacketHeaders.d.ts +5 -0
  27. package/dist/lib/codec/PacketHeaders.d.ts.map +1 -1
  28. package/dist/lib/codec/PacketHeaders.js +13 -1
  29. package/dist/lib/codec/abstracts/BaseHeader.d.ts +2 -2
  30. package/dist/lib/codec/abstracts/BaseHeader.d.ts.map +1 -1
  31. package/dist/lib/codec/abstracts/BaseHeader.js +4 -4
  32. package/dist/lib/codec/headers/EthernetII.js +1 -1
  33. package/dist/lib/codec/headers/Goose.js +5 -5
  34. package/dist/lib/codec/headers/IEC61850SampledValues.js +1 -1
  35. package/dist/lib/codec/headers/IPv4.js +2 -2
  36. package/dist/lib/codec/headers/TLS_Alert.d.ts +10 -0
  37. package/dist/lib/codec/headers/TLS_Alert.d.ts.map +1 -0
  38. package/dist/lib/codec/headers/TLS_Alert.js +624 -0
  39. package/dist/lib/codec/headers/TLS_ApplicationData.d.ts +10 -0
  40. package/dist/lib/codec/headers/TLS_ApplicationData.d.ts.map +1 -0
  41. package/dist/lib/codec/headers/TLS_ApplicationData.js +155 -0
  42. package/dist/lib/codec/headers/TLS_ChangeCipherSpec.d.ts +10 -0
  43. package/dist/lib/codec/headers/TLS_ChangeCipherSpec.d.ts.map +1 -0
  44. package/dist/lib/codec/headers/TLS_ChangeCipherSpec.js +154 -0
  45. package/dist/lib/codec/headers/TLS_Handshake.d.ts +10 -0
  46. package/dist/lib/codec/headers/TLS_Handshake.d.ts.map +1 -0
  47. package/dist/lib/codec/headers/TLS_Handshake.js +339 -0
  48. package/dist/lib/codec/headers/TLS_Heartbeat.d.ts +10 -0
  49. package/dist/lib/codec/headers/TLS_Heartbeat.d.ts.map +1 -0
  50. package/dist/lib/codec/headers/TLS_Heartbeat.js +206 -0
  51. package/dist/lib/codec/headers/VLAN_802dot1Q.js +1 -1
  52. package/package.json +1 -1
  53. package/src/CodecExports.ts +1 -1
  54. package/src/lib/codec/Codec.ts +1 -1
  55. package/src/lib/codec/PacketHeaders.ts +7 -0
  56. package/src/lib/codec/abstracts/BaseHeader.ts +4 -4
  57. package/src/lib/codec/headers/EthernetII.ts +1 -1
  58. package/src/lib/codec/headers/Goose.ts +5 -5
  59. package/src/lib/codec/headers/IEC61850SampledValues.ts +1 -1
  60. package/src/lib/codec/headers/IPv4.ts +2 -2
  61. package/src/lib/codec/headers/TLS_Alert.ts +539 -0
  62. package/src/lib/codec/headers/TLS_ApplicationData.ts +145 -0
  63. package/src/lib/codec/headers/TLS_ChangeCipherSpec.ts +146 -0
  64. package/src/lib/codec/headers/TLS_Handshake.ts +313 -0
  65. package/src/lib/codec/headers/TLS_Heartbeat.ts +188 -0
  66. package/src/lib/codec/headers/VLAN_802dot1Q.ts +1 -1
@@ -1,43 +1,43 @@
1
- /*-
2
- * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
3
- * The Regents of the University of California. All rights reserved.
4
- *
5
- * This code is derived from the Stanford/CMU enet packet filter,
6
- * (net/enet.c) distributed as part of 4.3BSD, and code contributed
7
- * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
8
- * Berkeley Laboratory.
9
- *
10
- * Redistribution and use in source and binary forms, with or without
11
- * modification, are permitted provided that the following conditions
12
- * are met:
13
- * 1. Redistributions of source code must retain the above copyright
14
- * notice, this list of conditions and the following disclaimer.
15
- * 2. Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the distribution.
18
- * 3. All advertising materials mentioning features or use of this software
19
- * must display the following acknowledgement:
20
- * This product includes software developed by the University of
21
- * California, Berkeley and its contributors.
22
- * 4. Neither the name of the University nor the names of its contributors
23
- * may be used to endorse or promote products derived from this software
24
- * without specific prior written permission.
25
- *
26
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36
- * SUCH DAMAGE.
37
- */
38
-
39
- #define IPH_AF_INET 2 /* Matches Solaris's AF_INET */
40
- #define IPH_AF_INET6 26 /* Matches Solaris's AF_INET6 */
41
-
42
- #define IPNET_OUTBOUND 1
43
- #define IPNET_INBOUND 2
1
+ /*-
2
+ * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
3
+ * The Regents of the University of California. All rights reserved.
4
+ *
5
+ * This code is derived from the Stanford/CMU enet packet filter,
6
+ * (net/enet.c) distributed as part of 4.3BSD, and code contributed
7
+ * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
8
+ * Berkeley Laboratory.
9
+ *
10
+ * Redistribution and use in source and binary forms, with or without
11
+ * modification, are permitted provided that the following conditions
12
+ * are met:
13
+ * 1. Redistributions of source code must retain the above copyright
14
+ * notice, this list of conditions and the following disclaimer.
15
+ * 2. Redistributions in binary form must reproduce the above copyright
16
+ * notice, this list of conditions and the following disclaimer in the
17
+ * documentation and/or other materials provided with the distribution.
18
+ * 3. All advertising materials mentioning features or use of this software
19
+ * must display the following acknowledgement:
20
+ * This product includes software developed by the University of
21
+ * California, Berkeley and its contributors.
22
+ * 4. Neither the name of the University nor the names of its contributors
23
+ * may be used to endorse or promote products derived from this software
24
+ * without specific prior written permission.
25
+ *
26
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36
+ * SUCH DAMAGE.
37
+ */
38
+
39
+ #define IPH_AF_INET 2 /* Matches Solaris's AF_INET */
40
+ #define IPH_AF_INET6 26 /* Matches Solaris's AF_INET6 */
41
+
42
+ #define IPNET_OUTBOUND 1
43
+ #define IPNET_INBOUND 2
@@ -1,84 +1,84 @@
1
- /*
2
- * Copyright (c) 1994, 1996
3
- * The Regents of the University of California. All rights reserved.
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- * 1. Redistributions of source code must retain the above copyright
9
- * notice, this list of conditions and the following disclaimer.
10
- * 2. Redistributions in binary form must reproduce the above copyright
11
- * notice, this list of conditions and the following disclaimer in the
12
- * documentation and/or other materials provided with the distribution.
13
- * 3. All advertising materials mentioning features or use of this software
14
- * must display the following acknowledgement:
15
- * This product includes software developed by the Computer Systems
16
- * Engineering Group at Lawrence Berkeley Laboratory.
17
- * 4. Neither the name of the University nor of the Laboratory may be used
18
- * to endorse or promote products derived from this software without
19
- * specific prior written permission.
20
- *
21
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31
- * SUCH DAMAGE.
32
- */
33
-
34
- #ifndef lib_pcap_namedb_h
35
- #define lib_pcap_namedb_h
36
-
37
- #ifdef __cplusplus
38
- extern "C" {
39
- #endif
40
-
41
- /*
42
- * As returned by the pcap_next_etherent()
43
- * XXX this stuff doesn't belong in this interface, but this
44
- * library already must do name to address translation, so
45
- * on systems that don't have support for /etc/ethers, we
46
- * export these hooks since they're already being used by
47
- * some applications (such as tcpdump) and already being
48
- * marked as exported in some OSes offering libpcap (such
49
- * as Debian).
50
- */
51
- struct pcap_etherent {
52
- u_char addr[6];
53
- char name[122];
54
- };
55
- #ifndef PCAP_ETHERS_FILE
56
- #define PCAP_ETHERS_FILE "/etc/ethers"
57
- #endif
58
- PCAP_API struct pcap_etherent *pcap_next_etherent(FILE *);
59
- PCAP_API u_char *pcap_ether_hostton(const char*);
60
- PCAP_API u_char *pcap_ether_aton(const char *);
61
-
62
- PCAP_API bpf_u_int32 **pcap_nametoaddr(const char *)
63
- PCAP_DEPRECATED(pcap_nametoaddr, "this is not reentrant; use 'pcap_nametoaddrinfo' instead");
64
- PCAP_API struct addrinfo *pcap_nametoaddrinfo(const char *);
65
- PCAP_API bpf_u_int32 pcap_nametonetaddr(const char *);
66
-
67
- PCAP_API int pcap_nametoport(const char *, int *, int *);
68
- PCAP_API int pcap_nametoportrange(const char *, int *, int *, int *);
69
- PCAP_API int pcap_nametoproto(const char *);
70
- PCAP_API int pcap_nametoeproto(const char *);
71
- PCAP_API int pcap_nametollc(const char *);
72
- /*
73
- * If a protocol is unknown, PROTO_UNDEF is returned.
74
- * Also, pcap_nametoport() returns the protocol along with the port number.
75
- * If there are ambiguous entried in /etc/services (i.e. domain
76
- * can be either tcp or udp) PROTO_UNDEF is returned.
77
- */
78
- #define PROTO_UNDEF -1
79
-
80
- #ifdef __cplusplus
81
- }
82
- #endif
83
-
84
- #endif
1
+ /*
2
+ * Copyright (c) 1994, 1996
3
+ * The Regents of the University of California. All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions
7
+ * are met:
8
+ * 1. Redistributions of source code must retain the above copyright
9
+ * notice, this list of conditions and the following disclaimer.
10
+ * 2. Redistributions in binary form must reproduce the above copyright
11
+ * notice, this list of conditions and the following disclaimer in the
12
+ * documentation and/or other materials provided with the distribution.
13
+ * 3. All advertising materials mentioning features or use of this software
14
+ * must display the following acknowledgement:
15
+ * This product includes software developed by the Computer Systems
16
+ * Engineering Group at Lawrence Berkeley Laboratory.
17
+ * 4. Neither the name of the University nor of the Laboratory may be used
18
+ * to endorse or promote products derived from this software without
19
+ * specific prior written permission.
20
+ *
21
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31
+ * SUCH DAMAGE.
32
+ */
33
+
34
+ #ifndef lib_pcap_namedb_h
35
+ #define lib_pcap_namedb_h
36
+
37
+ #ifdef __cplusplus
38
+ extern "C" {
39
+ #endif
40
+
41
+ /*
42
+ * As returned by the pcap_next_etherent()
43
+ * XXX this stuff doesn't belong in this interface, but this
44
+ * library already must do name to address translation, so
45
+ * on systems that don't have support for /etc/ethers, we
46
+ * export these hooks since they're already being used by
47
+ * some applications (such as tcpdump) and already being
48
+ * marked as exported in some OSes offering libpcap (such
49
+ * as Debian).
50
+ */
51
+ struct pcap_etherent {
52
+ u_char addr[6];
53
+ char name[122];
54
+ };
55
+ #ifndef PCAP_ETHERS_FILE
56
+ #define PCAP_ETHERS_FILE "/etc/ethers"
57
+ #endif
58
+ PCAP_API struct pcap_etherent *pcap_next_etherent(FILE *);
59
+ PCAP_API u_char *pcap_ether_hostton(const char*);
60
+ PCAP_API u_char *pcap_ether_aton(const char *);
61
+
62
+ PCAP_API bpf_u_int32 **pcap_nametoaddr(const char *)
63
+ PCAP_DEPRECATED(pcap_nametoaddr, "this is not reentrant; use 'pcap_nametoaddrinfo' instead");
64
+ PCAP_API struct addrinfo *pcap_nametoaddrinfo(const char *);
65
+ PCAP_API bpf_u_int32 pcap_nametonetaddr(const char *);
66
+
67
+ PCAP_API int pcap_nametoport(const char *, int *, int *);
68
+ PCAP_API int pcap_nametoportrange(const char *, int *, int *, int *);
69
+ PCAP_API int pcap_nametoproto(const char *);
70
+ PCAP_API int pcap_nametoeproto(const char *);
71
+ PCAP_API int pcap_nametollc(const char *);
72
+ /*
73
+ * If a protocol is unknown, PROTO_UNDEF is returned.
74
+ * Also, pcap_nametoport() returns the protocol along with the port number.
75
+ * If there are ambiguous entried in /etc/services (i.e. domain
76
+ * can be either tcp or udp) PROTO_UNDEF is returned.
77
+ */
78
+ #define PROTO_UNDEF -1
79
+
80
+ #ifdef __cplusplus
81
+ }
82
+ #endif
83
+
84
+ #endif
@@ -1,94 +1,94 @@
1
- /*
2
- * Copyright (c) 2013, Petar Alilovic,
3
- * Faculty of Electrical Engineering and Computing, University of Zagreb
4
- * All rights reserved
5
- *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions are met:
8
- *
9
- * * Redistributions of source code must retain the above copyright notice,
10
- * this list of conditions and the following disclaimer.
11
- * * Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- *
15
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
16
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
19
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
25
- * DAMAGE.
26
- */
27
-
28
- #ifndef lib_pcap_nflog_h
29
- #define lib_pcap_nflog_h
30
-
31
- #include <pcap/pcap-inttypes.h>
32
-
33
- /*
34
- * Structure of an NFLOG header and TLV parts, as described at
35
- * https://www.tcpdump.org/linktypes/LINKTYPE_NFLOG.html
36
- *
37
- * The NFLOG header is big-endian.
38
- *
39
- * The TLV length and type are in host byte order. The value is either
40
- * big-endian or is an array of bytes in some externally-specified byte
41
- * order (text string, link-layer address, link-layer header, packet
42
- * data, etc.).
43
- */
44
- typedef struct nflog_hdr {
45
- uint8_t nflog_family; /* address family */
46
- uint8_t nflog_version; /* version */
47
- uint16_t nflog_rid; /* resource ID */
48
- } nflog_hdr_t;
49
-
50
- typedef struct nflog_tlv {
51
- uint16_t tlv_length; /* tlv length */
52
- uint16_t tlv_type; /* tlv type */
53
- /* value follows this */
54
- } nflog_tlv_t;
55
-
56
- typedef struct nflog_packet_hdr {
57
- uint16_t hw_protocol; /* hw protocol */
58
- uint8_t hook; /* netfilter hook */
59
- uint8_t pad; /* padding to 32 bits */
60
- } nflog_packet_hdr_t;
61
-
62
- typedef struct nflog_hwaddr {
63
- uint16_t hw_addrlen; /* address length */
64
- uint16_t pad; /* padding to 32-bit boundary */
65
- uint8_t hw_addr[8]; /* address, up to 8 bytes */
66
- } nflog_hwaddr_t;
67
-
68
- typedef struct nflog_timestamp {
69
- uint64_t sec;
70
- uint64_t usec;
71
- } nflog_timestamp_t;
72
-
73
- /*
74
- * TLV types.
75
- */
76
- #define NFULA_PACKET_HDR 1 /* nflog_packet_hdr_t */
77
- #define NFULA_MARK 2 /* packet mark from skbuff */
78
- #define NFULA_TIMESTAMP 3 /* nflog_timestamp_t for skbuff's time stamp */
79
- #define NFULA_IFINDEX_INDEV 4 /* ifindex of device on which packet received (possibly bridge group) */
80
- #define NFULA_IFINDEX_OUTDEV 5 /* ifindex of device on which packet transmitted (possibly bridge group) */
81
- #define NFULA_IFINDEX_PHYSINDEV 6 /* ifindex of physical device on which packet received (not bridge group) */
82
- #define NFULA_IFINDEX_PHYSOUTDEV 7 /* ifindex of physical device on which packet transmitted (not bridge group) */
83
- #define NFULA_HWADDR 8 /* nflog_hwaddr_t for hardware address */
84
- #define NFULA_PAYLOAD 9 /* packet payload */
85
- #define NFULA_PREFIX 10 /* text string - null-terminated, count includes NUL */
86
- #define NFULA_UID 11 /* UID owning socket on which packet was sent/received */
87
- #define NFULA_SEQ 12 /* sequence number of packets on this NFLOG socket */
88
- #define NFULA_SEQ_GLOBAL 13 /* sequence number of pakets on all NFLOG sockets */
89
- #define NFULA_GID 14 /* GID owning socket on which packet was sent/received */
90
- #define NFULA_HWTYPE 15 /* ARPHRD_ type of skbuff's device */
91
- #define NFULA_HWHEADER 16 /* skbuff's MAC-layer header */
92
- #define NFULA_HWLEN 17 /* length of skbuff's MAC-layer header */
93
-
94
- #endif
1
+ /*
2
+ * Copyright (c) 2013, Petar Alilovic,
3
+ * Faculty of Electrical Engineering and Computing, University of Zagreb
4
+ * All rights reserved
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * * Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ *
15
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
16
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
19
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
25
+ * DAMAGE.
26
+ */
27
+
28
+ #ifndef lib_pcap_nflog_h
29
+ #define lib_pcap_nflog_h
30
+
31
+ #include <pcap/pcap-inttypes.h>
32
+
33
+ /*
34
+ * Structure of an NFLOG header and TLV parts, as described at
35
+ * https://www.tcpdump.org/linktypes/LINKTYPE_NFLOG.html
36
+ *
37
+ * The NFLOG header is big-endian.
38
+ *
39
+ * The TLV length and type are in host byte order. The value is either
40
+ * big-endian or is an array of bytes in some externally-specified byte
41
+ * order (text string, link-layer address, link-layer header, packet
42
+ * data, etc.).
43
+ */
44
+ typedef struct nflog_hdr {
45
+ uint8_t nflog_family; /* address family */
46
+ uint8_t nflog_version; /* version */
47
+ uint16_t nflog_rid; /* resource ID */
48
+ } nflog_hdr_t;
49
+
50
+ typedef struct nflog_tlv {
51
+ uint16_t tlv_length; /* tlv length */
52
+ uint16_t tlv_type; /* tlv type */
53
+ /* value follows this */
54
+ } nflog_tlv_t;
55
+
56
+ typedef struct nflog_packet_hdr {
57
+ uint16_t hw_protocol; /* hw protocol */
58
+ uint8_t hook; /* netfilter hook */
59
+ uint8_t pad; /* padding to 32 bits */
60
+ } nflog_packet_hdr_t;
61
+
62
+ typedef struct nflog_hwaddr {
63
+ uint16_t hw_addrlen; /* address length */
64
+ uint16_t pad; /* padding to 32-bit boundary */
65
+ uint8_t hw_addr[8]; /* address, up to 8 bytes */
66
+ } nflog_hwaddr_t;
67
+
68
+ typedef struct nflog_timestamp {
69
+ uint64_t sec;
70
+ uint64_t usec;
71
+ } nflog_timestamp_t;
72
+
73
+ /*
74
+ * TLV types.
75
+ */
76
+ #define NFULA_PACKET_HDR 1 /* nflog_packet_hdr_t */
77
+ #define NFULA_MARK 2 /* packet mark from skbuff */
78
+ #define NFULA_TIMESTAMP 3 /* nflog_timestamp_t for skbuff's time stamp */
79
+ #define NFULA_IFINDEX_INDEV 4 /* ifindex of device on which packet received (possibly bridge group) */
80
+ #define NFULA_IFINDEX_OUTDEV 5 /* ifindex of device on which packet transmitted (possibly bridge group) */
81
+ #define NFULA_IFINDEX_PHYSINDEV 6 /* ifindex of physical device on which packet received (not bridge group) */
82
+ #define NFULA_IFINDEX_PHYSOUTDEV 7 /* ifindex of physical device on which packet transmitted (not bridge group) */
83
+ #define NFULA_HWADDR 8 /* nflog_hwaddr_t for hardware address */
84
+ #define NFULA_PAYLOAD 9 /* packet payload */
85
+ #define NFULA_PREFIX 10 /* text string - null-terminated, count includes NUL */
86
+ #define NFULA_UID 11 /* UID owning socket on which packet was sent/received */
87
+ #define NFULA_SEQ 12 /* sequence number of packets on this NFLOG socket */
88
+ #define NFULA_SEQ_GLOBAL 13 /* sequence number of pakets on all NFLOG sockets */
89
+ #define NFULA_GID 14 /* GID owning socket on which packet was sent/received */
90
+ #define NFULA_HWTYPE 15 /* ARPHRD_ type of skbuff's device */
91
+ #define NFULA_HWHEADER 16 /* skbuff's MAC-layer header */
92
+ #define NFULA_HWLEN 17 /* length of skbuff's MAC-layer header */
93
+
94
+ #endif
@@ -1,101 +1,101 @@
1
- /*
2
- * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy)
3
- * Copyright (c) 2005 - 2009 CACE Technologies, Inc. Davis (California)
4
- * All rights reserved.
5
- *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions
8
- * are met:
9
- *
10
- * 1. Redistributions of source code must retain the above copyright
11
- * notice, this list of conditions and the following disclaimer.
12
- * 2. Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the distribution.
15
- * 3. Neither the name of the Politecnico di Torino nor the names of its
16
- * contributors may be used to endorse or promote products derived from
17
- * this software without specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
- */
31
- #ifndef pcap_pcap_inttypes_h
32
- #define pcap_pcap_inttypes_h
33
-
34
- /*
35
- * If we're compiling with Visual Studio, make sure the C99 integer
36
- * types are defined, by hook or by crook.
37
- *
38
- * XXX - verify that we have at least C99 support on UN*Xes?
39
- *
40
- * What about MinGW or various DOS toolchains? We're currently assuming
41
- * sufficient C99 support there.
42
- */
43
- #if defined(_MSC_VER)
44
- /*
45
- * Compiler is MSVC.
46
- */
47
- #if _MSC_VER >= 1800
48
- /*
49
- * VS 2013 or newer; we have <inttypes.h>.
50
- */
51
- #include <inttypes.h>
52
- #else
53
- /*
54
- * Earlier VS; we have to define this stuff ourselves.
55
- * We don't support building libpcap with earlier versions of VS,
56
- * but SDKs for Npcap have to support building applications using
57
- * earlier versions of VS, so we work around this by defining
58
- * those types ourselves, as some files use them.
59
- */
60
- typedef unsigned char uint8_t;
61
- typedef signed char int8_t;
62
- typedef unsigned short uint16_t;
63
- typedef signed short int16_t;
64
- typedef unsigned int uint32_t;
65
- typedef signed int int32_t;
66
- #ifdef _MSC_EXTENSIONS
67
- typedef unsigned _int64 uint64_t;
68
- typedef _int64 int64_t;
69
- #else /* _MSC_EXTENSIONS */
70
- typedef unsigned long long uint64_t;
71
- typedef long long int64_t;
72
- #endif
73
- #endif
74
- #else /* defined(_MSC_VER) */
75
- /*
76
- * Not Visual Studio.
77
- * Include <inttypes.h> to get the integer types and PRi[doux]64 values
78
- * defined.
79
- *
80
- * If the compiler is MinGW, we assume we have <inttypes.h> - and
81
- * support for %zu in the formatted printing functions.
82
- *
83
- * If the target is UN*X, we assume we have a C99-or-later development
84
- * environment, and thus have <inttypes.h> - and support for %zu in
85
- * the formatted printing functions.
86
- *
87
- * If the target is MS-DOS, we assume we have <inttypes.h> - and support
88
- * for %zu in the formatted printing functions.
89
- *
90
- * I.e., assume we have <inttypes.h> and that it suffices.
91
- */
92
-
93
- /*
94
- * XXX - somehow make sure we have enough C99 support with other
95
- * compilers and support libraries?
96
- */
97
-
98
- #include <inttypes.h>
99
- #endif /* defined(_MSC_VER) */
100
-
101
- #endif /* pcap/pcap-inttypes.h */
1
+ /*
2
+ * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy)
3
+ * Copyright (c) 2005 - 2009 CACE Technologies, Inc. Davis (California)
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions
8
+ * are met:
9
+ *
10
+ * 1. Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * 2. Redistributions in binary form must reproduce the above copyright
13
+ * notice, this list of conditions and the following disclaimer in the
14
+ * documentation and/or other materials provided with the distribution.
15
+ * 3. Neither the name of the Politecnico di Torino nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ */
31
+ #ifndef pcap_pcap_inttypes_h
32
+ #define pcap_pcap_inttypes_h
33
+
34
+ /*
35
+ * If we're compiling with Visual Studio, make sure the C99 integer
36
+ * types are defined, by hook or by crook.
37
+ *
38
+ * XXX - verify that we have at least C99 support on UN*Xes?
39
+ *
40
+ * What about MinGW or various DOS toolchains? We're currently assuming
41
+ * sufficient C99 support there.
42
+ */
43
+ #if defined(_MSC_VER)
44
+ /*
45
+ * Compiler is MSVC.
46
+ */
47
+ #if _MSC_VER >= 1800
48
+ /*
49
+ * VS 2013 or newer; we have <inttypes.h>.
50
+ */
51
+ #include <inttypes.h>
52
+ #else
53
+ /*
54
+ * Earlier VS; we have to define this stuff ourselves.
55
+ * We don't support building libpcap with earlier versions of VS,
56
+ * but SDKs for Npcap have to support building applications using
57
+ * earlier versions of VS, so we work around this by defining
58
+ * those types ourselves, as some files use them.
59
+ */
60
+ typedef unsigned char uint8_t;
61
+ typedef signed char int8_t;
62
+ typedef unsigned short uint16_t;
63
+ typedef signed short int16_t;
64
+ typedef unsigned int uint32_t;
65
+ typedef signed int int32_t;
66
+ #ifdef _MSC_EXTENSIONS
67
+ typedef unsigned _int64 uint64_t;
68
+ typedef _int64 int64_t;
69
+ #else /* _MSC_EXTENSIONS */
70
+ typedef unsigned long long uint64_t;
71
+ typedef long long int64_t;
72
+ #endif
73
+ #endif
74
+ #else /* defined(_MSC_VER) */
75
+ /*
76
+ * Not Visual Studio.
77
+ * Include <inttypes.h> to get the integer types and PRi[doux]64 values
78
+ * defined.
79
+ *
80
+ * If the compiler is MinGW, we assume we have <inttypes.h> - and
81
+ * support for %zu in the formatted printing functions.
82
+ *
83
+ * If the target is UN*X, we assume we have a C99-or-later development
84
+ * environment, and thus have <inttypes.h> - and support for %zu in
85
+ * the formatted printing functions.
86
+ *
87
+ * If the target is MS-DOS, we assume we have <inttypes.h> - and support
88
+ * for %zu in the formatted printing functions.
89
+ *
90
+ * I.e., assume we have <inttypes.h> and that it suffices.
91
+ */
92
+
93
+ /*
94
+ * XXX - somehow make sure we have enough C99 support with other
95
+ * compilers and support libraries?
96
+ */
97
+
98
+ #include <inttypes.h>
99
+ #endif /* defined(_MSC_VER) */
100
+
101
+ #endif /* pcap/pcap-inttypes.h */