pcap_open_live.html 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html><head>
  4. <title>3PCAP man page</title>
  5. <meta name="generator" content="roffit">
  6. <STYLE type="text/css">
  7. pre {
  8. overflow: auto;
  9. margin: 0;
  10. }
  11. P.level0, pre.level0 {
  12. padding-left: 2em;
  13. }
  14. P.level1, pre.level1 {
  15. padding-left: 4em;
  16. }
  17. P.level2, pre.level2 {
  18. padding-left: 6em;
  19. }
  20. span.emphasis {
  21. font-style: italic;
  22. }
  23. span.bold {
  24. font-weight: bold;
  25. }
  26. span.manpage {
  27. font-weight: bold;
  28. }
  29. h2.nroffsh {
  30. background-color: #e0e0e0;
  31. }
  32. span.nroffip {
  33. font-weight: bold;
  34. font-size: 120%;
  35. font-family: monospace;
  36. }
  37. p.roffit {
  38. text-align: center;
  39. font-size: 80%;
  40. }
  41. </STYLE>
  42. </head><body>
  43. <p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
  44. <p class="level0">pcap_open_live - open a device for capturing <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2>
  45. <p class="level0"><pre class="level0">
  46. &#35;include &lt;pcap/pcap.h&gt;
  47. <pre class="level0">
  48. char errbuf[PCAP_ERRBUF_SIZE];
  49. pcap_t *pcap_open_live(const char *device, int snaplen,
  50. &nbsp;&nbsp;&nbsp;&nbsp;int promisc, int to_ms, char *errbuf);
  51. </pre>
  52. <p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
  53. <p class="level0"><span Class="bold">pcap_open_live</span>() is used to obtain a packet capture handle to look at packets on the network. <span Class="emphasis">device</span> is a string that specifies the network device to open; on Linux systems with 2.2 or later kernels, a <span Class="emphasis">device</span> argument of &quot;any&quot; or <span Class="bold">NULL</span> can be used to capture packets from all interfaces.
  54. <p class="level0"><span Class="emphasis">snaplen</span> specifies the snapshot length to be set on the handle.
  55. <p class="level0"><span Class="emphasis">promisc</span> specifies whether the interface is to be put into promiscuous mode. If <span Class="emphasis">promisc</span> is non-zero, promiscuous mode will be set, otherwise it will not be set.
  56. <p class="level0"><span Class="emphasis">to_ms</span> specifies the packet buffer timeout, as a non-negative value, in milliseconds. (See <a Class="bold" href="./pcap.html">pcap</a>(3PCAP) for an explanation of the packet buffer timeout.) <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2>
  57. <p class="level0"><span Class="bold">pcap_open_live</span>() returns a <span Class="emphasis">pcap_t *</span> on success and <span Class="bold">NULL</span> on failure. If <span Class="bold">NULL</span> is returned, <span Class="emphasis">errbuf</span> is filled in with an appropriate error message. <span Class="emphasis">errbuf</span> may also be set to warning text when <span Class="bold">pcap_open_live</span>() succeeds; to detect this case the caller should store a zero-length string in <span Class="emphasis">errbuf</span> before calling <span Class="bold">pcap_open_live</span>() and display the warning to the user if <span Class="emphasis">errbuf</span> is no longer a zero-length string. <span Class="emphasis">errbuf</span> is assumed to be able to hold at least <span Class="bold">PCAP_ERRBUF_SIZE</span> chars. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2>
  58. <p class="level0"><a Class="bold" href="./pcap_create.html">pcap_create</a>(3PCAP), <a Class="bold" href="./pcap_activate.html">pcap_activate</a>(3PCAP) <p class="roffit">
  59. This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>.
  60. </body></html>