JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1 | .\" Copyright (c) 1994, 1996, 1997 |
| 2 | .\" The Regents of the University of California. All rights reserved. |
| 3 | .\" |
| 4 | .\" Redistribution and use in source and binary forms, with or without |
| 5 | .\" modification, are permitted provided that: (1) source code distributions |
| 6 | .\" retain the above copyright notice and this paragraph in its entirety, (2) |
| 7 | .\" distributions including binary code include the above copyright notice and |
| 8 | .\" this paragraph in its entirety in the documentation or other materials |
| 9 | .\" provided with the distribution, and (3) all advertising materials mentioning |
| 10 | .\" features or use of this software display the following acknowledgement: |
| 11 | .\" ``This product includes software developed by the University of California, |
| 12 | .\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of |
| 13 | .\" the University nor the names of its contributors may be used to endorse |
| 14 | .\" or promote products derived from this software without specific prior |
| 15 | .\" written permission. |
| 16 | .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED |
| 17 | .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
| 18 | .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 19 | .\" |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 20 | .TH PCAP_ACTIVATE 3PCAP "24 November 2019" |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 21 | .SH NAME |
| 22 | pcap_activate \- activate a capture handle |
| 23 | .SH SYNOPSIS |
| 24 | .nf |
| 25 | .ft B |
| 26 | #include <pcap/pcap.h> |
| 27 | .ft |
| 28 | .LP |
| 29 | .ft B |
| 30 | int pcap_activate(pcap_t *p); |
| 31 | .ft |
| 32 | .fi |
| 33 | .SH DESCRIPTION |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 34 | .BR pcap_activate () |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 35 | is used to activate a packet capture handle to look |
| 36 | at packets on the network, with the options that were set on the handle |
| 37 | being in effect. |
| 38 | .SH RETURN VALUE |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 39 | .BR pcap_activate () |
| 40 | returns |
| 41 | .B 0 |
| 42 | on success without warnings, a non-zero positive value on |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 43 | success with warnings, and a negative value on error. |
| 44 | A non-zero return value indicates what warning or error condition |
| 45 | occurred. |
| 46 | .LP |
| 47 | The possible warning values are: |
| 48 | .TP |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 49 | .B PCAP_WARNING_PROMISC_NOTSUP |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 50 | Promiscuous mode was requested, but the capture source doesn't support |
| 51 | promiscuous mode. |
| 52 | .TP |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 53 | .B PCAP_WARNING_TSTAMP_TYPE_NOTSUP |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 54 | The time stamp type specified in a previous |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 55 | .BR pcap_set_tstamp_type (3PCAP) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 56 | call isn't supported by the capture source (the time stamp type is |
| 57 | left as the default), |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 58 | .TP |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 59 | .B PCAP_WARNING |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 60 | Another warning condition occurred; |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 61 | .BR pcap_geterr (3PCAP) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 62 | or |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 63 | .BR pcap_perror (3PCAP) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 64 | may be called with |
| 65 | .I p |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 66 | as an argument to fetch or display a message describing the warning |
| 67 | condition. |
| 68 | .LP |
| 69 | The possible error values are: |
| 70 | .TP |
| 71 | .B PCAP_ERROR_ACTIVATED |
| 72 | The handle has already been activated. |
| 73 | .TP |
| 74 | .B PCAP_ERROR_NO_SUCH_DEVICE |
| 75 | The capture source specified when the handle was created doesn't |
| 76 | exist. |
| 77 | .TP |
| 78 | .B PCAP_ERROR_PERM_DENIED |
| 79 | The process doesn't have permission to open the capture source. |
| 80 | .TP |
| 81 | .B PCAP_ERROR_PROMISC_PERM_DENIED |
| 82 | The process has permission to open the capture source but doesn't |
| 83 | have permission to put it into promiscuous mode. |
| 84 | .TP |
| 85 | .B PCAP_ERROR_RFMON_NOTSUP |
| 86 | Monitor mode was specified but the capture source doesn't support |
| 87 | monitor mode. |
| 88 | .TP |
| 89 | .B PCAP_ERROR_IFACE_NOT_UP |
| 90 | The capture source device is not up. |
| 91 | .TP |
| 92 | .B PCAP_ERROR |
| 93 | Another error occurred. |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 94 | .BR pcap_geterr () |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 95 | or |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 96 | .BR pcap_perror () |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 97 | may be called with |
| 98 | .I p |
| 99 | as an argument to fetch or display a message describing the error. |
| 100 | .LP |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 101 | If |
| 102 | .BR PCAP_WARNING_PROMISC_NOTSUP , |
| 103 | .BR PCAP_ERROR_NO_SUCH_DEVICE , |
| 104 | or |
| 105 | .B PCAP_ERROR_PERM_DENIED |
| 106 | is returned, |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 107 | .BR pcap_geterr () |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 108 | or |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 109 | .BR pcap_perror () |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 110 | may be called with |
| 111 | .I p |
| 112 | as an argument to fetch or display an message giving additional details |
| 113 | about the problem that might be useful for debugging the problem if it's |
| 114 | unexpected. |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 115 | .LP |
| 116 | Additional warning and error codes may be added in the future; a program |
| 117 | should check for positive, negative, and zero return codes, and treat |
| 118 | all positive return codes as warnings and all negative return |
| 119 | codes as errors. |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 120 | .BR pcap_statustostr (3PCAP) |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 121 | can be called, with a warning or error code as an argument, to fetch a |
| 122 | message describing the warning or error code. |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 123 | .LP |
| 124 | If |
| 125 | .BR pcap_activate () |
| 126 | fails, the |
| 127 | .I pcap_t * |
| 128 | is not closed and freed; it should be closed using |
| 129 | .BR pcap_close (). |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 130 | .SH SEE ALSO |
Haibo Huang | ee759ce | 2021-01-05 21:34:29 -0800 | [diff] [blame] | 131 | .BR pcap (3PCAP) |