annotate R/rdyncall/inst/dynports/pcap.R @ 56:16151547265e

made callback example python 2 compatible, and added some randomness to numbers to sort
author Tassilo Philipp
date Tue, 02 Feb 2021 21:07:41 +0100
parents 0cfcc391201f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 dynbind( c("pcap","pcap.so.0.8") , "
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 pcap_activate(*<pcap>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 pcap_breakloop(*<pcap>)v;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 pcap_can_set_rfmon(*<pcap>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 pcap_close(*<pcap>)v;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 pcap_compile(*<pcap>*<bpf_program>*ciI)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9 pcap_compile_nopcap(ii*<bpf_program>*ciI)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 pcap_create(*c*c)*<pcap>;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 pcap_datalink(*<pcap>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 pcap_datalink_ext(*<pcap>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 pcap_datalink_name_to_val(*c)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 pcap_datalink_val_to_description(i)*c;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 pcap_datalink_val_to_name(i)*c;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 pcap_dispatch(*<pcap>i*p*C)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 pcap_dump(*C*<pcap_pkthdr>*C)v;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 pcap_dump_close(*<pcap_dumper>)v;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 pcap_dump_file(*<pcap_dumper>)*<__sFILE>;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 pcap_dump_flush(*<pcap_dumper>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 pcap_dump_fopen(*<pcap>*<__sFILE>)*<pcap_dumper>;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22 pcap_dump_ftell(*<pcap_dumper>)j;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23 pcap_dump_open(*<pcap>*c)*<pcap_dumper>;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 pcap_file(*<pcap>)*<__sFILE>;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25 pcap_fileno(*<pcap>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26 pcap_findalldevs(**<pcap_if>*c)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 pcap_fopen_offline(*<__sFILE>*c)*<pcap>;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 pcap_fopen_offline_with_tstamp_precision(*<__sFILE>I*c)*<pcap>;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29 pcap_free_datalinks(*i)v;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30 pcap_free_tstamp_types(*i)v;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31 pcap_freealldevs(*<pcap_if>)v;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32 pcap_freecode(*<bpf_program>)v;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33 pcap_get_selectable_fd(*<pcap>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34 pcap_get_tstamp_precision(*<pcap>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 pcap_geterr(*<pcap>)*c;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 pcap_getnonblock(*<pcap>*c)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37 pcap_inject(*<pcap>*vJ)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 pcap_is_swapped(*<pcap>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 pcap_lib_version()*c;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 pcap_list_datalinks(*<pcap>**i)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41 pcap_list_tstamp_types(*<pcap>**i)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42 pcap_lookupdev(*c)*c;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43 pcap_lookupnet(*c*I*I*c)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 pcap_loop(*<pcap>i*p*C)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 pcap_major_version(*<pcap>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 pcap_minor_version(*<pcap>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47 pcap_next(*<pcap>*<pcap_pkthdr>)*C;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48 pcap_next_ex(*<pcap>**<pcap_pkthdr>**C)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 pcap_offline_filter(*<bpf_program>*<pcap_pkthdr>*C)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 pcap_open_dead(ii)*<pcap>;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 pcap_open_dead_with_tstamp_precision(iiI)*<pcap>;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 pcap_open_live(*ciii*c)*<pcap>;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53 pcap_open_offline(*c*c)*<pcap>;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54 pcap_open_offline_with_tstamp_precision(*cI*c)*<pcap>;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 pcap_perror(*<pcap>*c)v;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 pcap_sendpacket(*<pcap>*Ci)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57 pcap_set_buffer_size(*<pcap>i)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 pcap_set_datalink(*<pcap>i)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 pcap_set_immediate_mode(*<pcap>i)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60 pcap_set_promisc(*<pcap>i)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61 pcap_set_rfmon(*<pcap>i)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
62 pcap_set_snaplen(*<pcap>i)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
63 pcap_set_timeout(*<pcap>i)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
64 pcap_set_tstamp_precision(*<pcap>i)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
65 pcap_set_tstamp_type(*<pcap>i)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
66 pcap_setdirection(*<pcap>i)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
67 pcap_setfilter(*<pcap>*<bpf_program>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68 pcap_setnonblock(*<pcap>i*c)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
69 pcap_snapshot(*<pcap>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70 pcap_stats(*<pcap>*<pcap_stat>)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
71 pcap_statustostr(i)*c;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72 pcap_strerror(i)*c;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73 pcap_tstamp_type_name_to_val(*c)i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
74 pcap_tstamp_type_val_to_description(i)*c;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
75 pcap_tstamp_type_val_to_name(i)*c;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
76 ")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
77 parseStructInfos("
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
78 bpf_insn{SCCI}code jt jf k ;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
79 bpf_program{I*<bpf_insn>}bf_len bf_insns ;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
80 pcap_addr{*<pcap_addr>*<sockaddr>*<sockaddr>*<sockaddr>*<sockaddr>}next addr netmask broadaddr dstaddr ;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
81 pcap_dumper{};
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
82 pcap_file_header{ISSiIII}magic version_major version_minor thiszone sigfigs snaplen linktype ;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
83 pcap_if{*<pcap_if>*c*c*<pcap_addr>I}next name description addresses flags ;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
84 pcap_pkthdr{<timeval>II}ts caplen len ;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
85 pcap_stat{III}ps_recv ps_drop ps_ifdrop ;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
86 pcap{};
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
87 sockaddr{};
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
88 timeval{ji}tv_sec tv_usec ;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
89 ")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
90 PCAP_D_IN=1;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
91 PCAP_D_INOUT=0;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
92 PCAP_D_OUT=2;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
93 PCAP_ERRBUF_SIZE=256
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
94 PCAP_ERROR=-1
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
95 PCAP_ERROR_ACTIVATED=-4
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
96 PCAP_ERROR_BREAK=-2
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
97 PCAP_ERROR_CANTSET_TSTAMP_TYPE=-10
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
98 PCAP_ERROR_IFACE_NOT_UP=-9
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
99 PCAP_ERROR_NOT_ACTIVATED=-3
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
100 PCAP_ERROR_NOT_RFMON=-7
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
101 PCAP_ERROR_NO_SUCH_DEVICE=-5
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
102 PCAP_ERROR_PERM_DENIED=-8
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
103 PCAP_ERROR_PROMISC_PERM_DENIED=-11
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
104 PCAP_ERROR_RFMON_NOTSUP=-6
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
105 PCAP_ERROR_TSTAMP_PRECISION_NOTSUP=-12
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
106 PCAP_IF_LOOPBACK=0x00000001
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
107 PCAP_NETMASK_UNKNOWN=0xffffffff
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
108 PCAP_TSTAMP_ADAPTER=3
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
109 PCAP_TSTAMP_ADAPTER_UNSYNCED=4
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
110 PCAP_TSTAMP_HOST=0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
111 PCAP_TSTAMP_HOST_HIPREC=2
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
112 PCAP_TSTAMP_HOST_LOWPREC=1
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
113 PCAP_TSTAMP_PRECISION_MICRO=0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
114 PCAP_TSTAMP_PRECISION_NANO=1
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
115 PCAP_VERSION_MAJOR=2
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
116 PCAP_VERSION_MINOR=4
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
117 PCAP_WARNING=1
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
118 PCAP_WARNING_PROMISC_NOTSUP=2
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
119 PCAP_WARNING_TSTAMP_TYPE_NOTSUP=3
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
120