DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

icmp(ADMP)


icmp -- Internet control message protocol

Synopsis

Programmer's interface:
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <netinet/in.h>

s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);

#include <paths.h> #include <fcntl.h> #include <netinet/in_systm.h> #include <netinet/ip.h> #include <netinet/ip_icmp.h> #include <netinet/ip_var.h> #include <netinet/icmp_var.h>

fd = open(_PATH_ICMP, flags);

Description

ICMPv4 is the error and control message (or device) protocol used by IPv4 and the Internet protocol family. It may be accessed through a ``raw socket'' for network monitoring and diagnostic functions. ICMPv4 sockets are connectionless, and are normally used with the sendto and recvfrom calls; the connect(SSC) call may also be used to fix the destination for future packets (in which case the read(S) or recv(SSC) and write(S) or send(SSC) system calls may be used).

Outgoing packets automatically have an IPv4 header prepended to them (based on the destination address). Incoming packets are received with the IPv4 header and options intact.

The ICMP driver can also be accessed by opening _PATH_ICMP directly. Networking statistics can be gathered by issuing an ioctl directive to the driver.

The following STREAMS ioctl requests, defined in <netinet/ip_var.h>, are supported by the ICMP driver:


SIOCGICMPSTATS
Fetch the ICMP statistics structure. The argument passed to the I_STR call is a pointer to an icmpstat structure.

SIOCSMGMT
To set the inpcb associated with that end-point as a management inpcb (to distinguish it from others when network statistics are gathered).

Diagnostics

A socket operation may fail with one of the following errors returned:

[EADDRNOTAVAIL]
when an attempt is made to create a socket with a network address for which no network interface exists.

[EISCONN]
when trying to establish a connection on a socket which already has one, or when trying to send a datagram with the destination address specified and the socket is already connected.

[ENOMEM]
when the system runs out of memory for an internal data structure.

[ENOSR]
when the system runs out of STREAMS resources.

[ENOTCONN]
when trying to send a datagram, but no destination address is specified, and the socket has not been connected.
The errno is set to the following value upon the failure of the ioctl operation:

[EINVAL]
when an invalid argument is passed to the driver.

References

if(ADMP), inconfig(ADMN), inet(ADMP), ip(ADMP), maskreply(ADMN), recv(SSC), send(SSC), streamio(HW)

``Internet Control Message Protocol Version 4 (ICMPv4) parameters'' on the inconfig(ADMN) manual page

RFC 792, RFC 950


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005