]> The Tcpdump Group git mirrors - libpcap/blobdiff - pcap_inject.3pcap
Update config.{guess,sub}, timestamps 2023-01-01,2023-01-21
[libpcap] / pcap_inject.3pcap
index ff9792d2096621f87b7fa48ab24fac38c462daa8..83eae1c3846dd6f063b2d029b2a82dfce3f118ef 100644 (file)
@@ -17,7 +17,7 @@
 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.TH PCAP_INJECT 3PCAP "3 January 2014"
+.TH PCAP_INJECT 3PCAP "5 March 2022"
 .SH NAME
 pcap_inject, pcap_sendpacket \- transmit a packet
 .SH SYNOPSIS
@@ -32,7 +32,7 @@ int pcap_sendpacket(pcap_t *p, const u_char *buf, int size);
 .ft
 .fi
 .SH DESCRIPTION
-.B pcap_inject()
+.BR pcap_inject ()
 sends a raw packet through the network interface;
 .I buf
 points to the data of the packet, including the link-layer header, and
@@ -42,7 +42,7 @@ is the number of bytes in the packet.
 Note that, even if you successfully open the network interface, you
 might not have permission to send packets on it, or it might not support
 sending packets; as
-.I pcap_open_live()
+.BR pcap_open_live (3PCAP)
 doesn't have a flag to indicate whether to open for capturing, sending,
 or capturing and sending, you cannot request an open that supports
 sending and be notified at open time whether sending will be possible.
@@ -51,7 +51,7 @@ Note also that some devices might not support sending packets.
 Note that, on some platforms, the link-layer header of the packet that's
 sent might not be the same as the link-layer header of the packet
 supplied to
-.BR pcap_inject() ,
+.BR pcap_inject (),
 as the source link-layer address, if the header contains such an
 address, might be changed to be the address assigned to the interface on
 which the packet it sent, if the platform doesn't support sending
@@ -61,28 +61,42 @@ libpcap used when attaching to the device, even on platforms that
 .I do
 nominally support sending completely raw and unchanged packets.
 .PP
-.B pcap_sendpacket()
+.BR pcap_sendpacket ()
 is like
-.BR pcap_inject() ,
-but it returns 0 on success, rather than returning the number of bytes
+.BR pcap_inject (),
+but it returns
+.B 0
+on success, rather than returning the number of bytes
 written.
-.RB ( pcap_inject()
+.RB ( pcap_inject ()
 comes from OpenBSD;
-.B pcap_sendpacket()
-comes from WinPcap.  Both are provided for compatibility.)
+.BR pcap_sendpacket ()
+comes from WinPcap/Npcap.  Both are provided for compatibility.)
 .SH RETURN VALUE
-.B pcap_inject()
-returns the number of bytes written on success and \-1 on failure.
+.BR pcap_inject ()
+returns the number of bytes written on success,
+.B PCAP_ERROR_NOT_ACTIVATED
+if called on a capture handle that has been created but not activated, and
+.B PCAP_ERROR
+on other errors.
 .PP
-.B pcap_sendpacket()
-returns 0 on success and \-1 on failure.
+.BR pcap_sendpacket ()
+returns
+.B 0
+on success,
+.B PCAP_ERROR_NOT_ACTIVATED
+if called on a capture handle that has been created but not activated, and
+.B PCAP_ERROR
+on other errors.
 .PP
-If \-1 is returned,
-.B pcap_geterr()
+If
+.B PCAP_ERROR
+is returned,
+.BR pcap_geterr (3PCAP)
 or
-.B pcap_perror()
+.BR pcap_perror (3PCAP)
 may be called with
 .I p
 as an argument to fetch or display the error text.
 .SH SEE ALSO
-pcap(3PCAP), pcap_geterr(3PCAP)
+.BR pcap (3PCAP)