1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
/* -*- 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.
*
*/
/* _WIN32/MSDOS/UN*X */
extern "C" BPF_RELEASE - 0 < 199406
typedef int bpf_int32;
typedef u_int bpf_u_int32;
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.
* Documentation: https://www.tcpdump.org/manpages/pcap-savefile.5.txt.
*
* 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.
*/
;
/*
* 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.
*/
typedef enum 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.
*/
;
/*
* As returned by the pcap_stats()
*/
;
/*
* As returned by the pcap_stats_ex()
*/
;
/*
* Item in a list of interfaces.
*/
;
/*
* Representation of an interface address.
*/
;
typedef void ;
/*
* 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.
*/
/*
* Warning codes for the pcap API.
* These will all be positive and non-zero, so they won't look like
* errors.
*/
/*
* Value to pass to pcap_compile() as the netmask if you don't know what
* the netmask is.
*/
/*
* 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_API int ;
PCAP_API pcap_t *;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API void ;
PCAP_API int ;
PCAP_API const char *;
PCAP_API const char *;
PCAP_API int ;
/*
* 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..
*/
/*
* 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.
*/
PCAP_API pcap_t *;
PCAP_API pcap_t *;
PCAP_API pcap_t *;
PCAP_API pcap_t *;
PCAP_API pcap_t *;
PCAP_API pcap_t *;
PCAP_API pcap_t *;
/*
* 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.)
*/
PCAP_API pcap_t *;
PCAP_API pcap_t *;
/*_WIN32*/
PCAP_API void ;
PCAP_API int ;
PCAP_API int ;
PCAP_API const u_char *;
PCAP_API int ;
PCAP_API void ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API const char *;
PCAP_API const char *;
PCAP_API char *;
PCAP_API void ;
PCAP_API int ;
PCAP_API int ;
PCAP_API void ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API void ;
PCAP_API int ;
PCAP_API const char *;
PCAP_API const char *;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
/* XXX */
PCAP_API FILE *;
PCAP_API int ;
PCAP_API int ;
PCAP_API pcap_dumper_t *;
PCAP_API pcap_dumper_t *;
PCAP_API pcap_dumper_t *;
PCAP_API FILE *;
PCAP_API long ;
PCAP_API int64_t ;
PCAP_API int ;
PCAP_API void ;
PCAP_API void ;
PCAP_API int ;
PCAP_API void ;
/*
* 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 *;
/*
* Win32 definitions
*/
/*!
\brief A queue of raw packets that will be sent to the network with pcap_sendqueue_transmit().
*/
;
typedef struct pcap_send_queue pcap_send_queue;
/*!
\brief This typedef is a support for the pcap_get_airpcap_handle() function
*/
typedef struct _AirpcapHandle *PAirpcapHandle;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API HANDLE ;
PCAP_API int ;
PCAP_API int ;
PCAP_API pcap_send_queue* ;
PCAP_API void ;
PCAP_API int ;
PCAP_API u_int ;
PCAP_API struct pcap_stat *;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API int ;
PCAP_API PAirpcapHandle ;
/*
* MS-DOS definitions
*/
PCAP_API int ;
PCAP_API void ;
PCAP_API u_long ;
/*
* UN*X definitions
*/
PCAP_API int ;
PCAP_API struct timeval *;
/* _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.
*/
/*
* The type of input source, passed to pcap_open().
*/
/*
* 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.
*/
/*
* 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.
*/
/*
* Flags to pass to pcap_open().
*/
/*
* Specifies whether promiscuous mode is to be used.
*/
/*
* 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.
*/
/*
* 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.
*/
/*
* 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.
*/
/*
* 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".
*/
/*
* 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.
*/
/*
* 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"!)
*/
/*
* 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.
*/
;
/*
* 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_API int ;
PCAP_API int ;
/*
* 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 ;
/*
* 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.
*/
/*
* 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.
*/
/*
* 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.
*/
/*
* 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.
*/
;
/*
* New functions.
*/
PCAP_API struct pcap_samp *;
/*
* RPCAP active mode.
*/
/* Maximum length of an host name (needed for the RPCAP active mode) */
/*
* Some minor differences between UN*X sockets and and Winsock sockets.
*/
/*!
* \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.
*/
/*!
* \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.
*/
PCAP_API SOCKET ;
PCAP_API int ;
PCAP_API int ;
PCAP_API void ;
}
/* lib_pcap_pcap_h */