Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pk(4) [v7 man page]

PK(4)							     Kernel Interfaces Manual							     PK(4)

NAME
pk - packet driver DESCRIPTION
The packet driver implements a full-duplex end-to-end flow control strategy for machine-to-machine communication. Packet driver protocol is established by calling pkon(2) with a character device file descriptor and a desired packet size in bytes. The packet size must be a power of 2, 32<=size<=4096. The file descriptor must represent an 8-bit data path. This is normally obtained by setting the device in raw mode (see ioctl(2)). The actual packet size, which may be smaller than the desired packet size, is arrived at by negotiation with the packet driver at the remote end of the data link. The packet driver maintains two data areas for incoming and outgoing packets. The output area is needed to implement retransmission on errors, and arriving packets are queued in the input area. Data arriving for a file not open for reading is discarded. Initially the size of both areas is set to two packets. It is not necessary that reads and writes be multiples of the packet size although there is less system overhead if they are. Read opera- tions return the maximum amount of data available from the input area up to the number of bytes specified in the system call. The buffer sizes in write operations are not normally transmitted across the link. However, writes of zero length are treated specially and are reflected at the remote end as a zero-length read. This facilitates marking the serial byte stream, usually for delimiting files. When one side of a packet driver link is shut down by close(2)or pkoff (see pkon(2)), read(2) on the other side will return 0, and write on the other side will raise a SIGPIPE signal. SEE ALSO
pkon(2), pkopen(3) local PK(4)

Check Out this Related Man Page

PCAP_INJECT(3)						     Library Functions Manual						    PCAP_INJECT(3)

NAME
pcap_inject, pcap_sendpacket - transmit a packet SYNOPSIS
#include <pcap/pcap.h> int pcap_inject(pcap_t *p, const void *buf, size_t size); int pcap_sendpacket(pcap_t *p, const u_char *buf, int size); DESCRIPTION
pcap_inject() sends a raw packet through the network interface; buf points to the data of the packet, including the link-layer header, and size 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 sup- port sending packets; as pcap_open_live() 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. 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 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 completely raw and unchanged packets. Even worse, some drivers on some platforms might change the link-layer type field to whatever value libpcap used when attaching to the device, even on platforms that do nominally support sending completely raw and unchanged packets. pcap_sendpacket() is like pcap_inject(), but it returns 0 on success, rather than returning the number of bytes written. (pcap_inject() comes from OpenBSD; pcap_sendpacket() comes from WinPcap. Both are provided for compatibility.) RETURN VALUE
pcap_inject() returns the number of bytes written on success and -1 on failure. pcap_sendpacket() returns 0 on success and -1 on failure. If -1 is returned, pcap_geterr() or pcap_perror() may be called with p as an argument to fetch or display the error text. SEE ALSO
pcap(3), pcap_geterr(3) 5 April 2008 PCAP_INJECT(3)
Man Page