Commit | Line | Data |
---|---|---|
f29f3a8b MK |
1 | .\" Copyright (c) 1986 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
5 | .\" @(#)icmp.4 6.1 (Berkeley) %G% | |
6 | .\" | |
7 | .TH ICMP 4P "" | |
8 | .UC 6 | |
9 | .SH NAME | |
10 | icmp \- Internet Control Message Protocol | |
11 | .SH SYNOPSIS | |
12 | .B #include <sys/socket.h> | |
13 | .br | |
14 | .B #include <netinet/in.h> | |
15 | .PP | |
16 | .B s = socket(AF_INET, SOCK_RAW, proto); | |
17 | .SH DESCRIPTION | |
18 | ICMP is the error and control message protocol used | |
19 | by IP and the Internet protocol family. It may be accessed | |
20 | through a \*(lqraw socket\*(rq for network monitoring | |
21 | and diagnostic functions. | |
22 | The | |
23 | .I proto | |
24 | parameter to the socket call to create an ICMP socket | |
25 | is obtained from | |
26 | .IR getprotobyname (3N). | |
27 | ICMP sockets are connectionless, | |
28 | and are normally used with the | |
29 | .I sendto | |
30 | and | |
31 | .I recvfrom | |
32 | calls, though the | |
33 | .IR connect (2) | |
34 | call may also be used to fix the destination for future | |
35 | packets (in which case the | |
36 | .IR read (2) | |
37 | or | |
38 | .IR recv (2) | |
39 | and | |
40 | .IR write (2) | |
41 | or | |
42 | .IR send (2) | |
43 | system calls may be used). | |
44 | .PP | |
45 | Outgoing packets automatically have an IP header prepended to | |
46 | them (based on the destination address). | |
47 | Incoming packets are received with the IP header and options intact. | |
48 | .SH DIAGNOSTICS | |
49 | A socket operation may fail with one of the following errors returned: | |
50 | .TP 15 | |
51 | [EISCONN] | |
52 | when trying to establish a connection on a socket which | |
53 | already has one, or when trying to send a datagram with the destination | |
54 | address specified and the socket is already connected; | |
55 | .TP 15 | |
56 | [ENOTCONN] | |
57 | when trying to send a datagram, but | |
58 | no destination address is specified, and the socket hasn't been | |
59 | connected; | |
60 | .TP 15 | |
61 | [ENOBUFS] | |
62 | when the system runs out of memory for | |
63 | an internal data structure; | |
64 | .TP 15 | |
65 | [EADDRNOTAVAIL] | |
66 | when an attempt is made to create a | |
67 | socket with a network address for which no network interface | |
68 | exists. | |
69 | .SH SEE ALSO | |
70 | send(2), recv(2), intro(4N), inet(4F), ip(4P) |