Data Tables

IN THIS APPENDIX

• Domains: First Parameter to socket() 396
• Types: Second Parameter to
socket() 404
• Protocol Definitions 404
• Standard Internet Port Assignments (First 100 Ports) 405
• HTTP 1.1 Status Codes 407
• Socket Options (
setsockopt() ) 408
• Signal Definitions 414
• ICMP Codes 415
• IPv4 Multicast Allocation 417
• Proposed IPv6 Address Allocation 417
• ICMPv6 Codes 418
• IPv6 Multicast Scope Field 419
• IPv6 Multicast Flags Field 420


This appendix identifies and lists all the tables and data formats relevant to sockets programming.

Domains: First Parameter to socket()

Table A.1 lists the values for the first parameter of the socket() system call. You can use these types as well in a bind() system call. While most programs use the AF style for both socket() and bind() , the correct form is to use the PF style for socket() and the AF style for bind() . If you are uncomfortable using the PF style, you can safely use the AF style because the C header files define the AF style as the PF style. The structure definitions are located in
<bits/socket.h> .


appendix_a2tablesasimages03-00.jpg 733x498


appendix_a2tablesasimages04-00.jpg 731x584


appendix_a2tablesasimages05-00.jpg 727x550


appendix_a2tablesasimages06-00.jpg 723x568


appendix_a2tablesasimages07-00.jpg 737x550


appendix_a2tablesasimages08-00.jpg 730x591


appendix_a2tablesasimages09-00.jpg 740x438


Types: Second Parameter to socket()

The second parameter ( ) selects the protocol layer. Some constants defined in Table A.2 are mere placeholders for when the kernel supports the protocol.

appendix_a2tablesasimages10-00.jpg 586x484

Protocol Definitions

Listing A.1 is an excerpt from the /etc/protocols file [RFC2292] on your distribution. It contains the common and standard protocol standards used in the network packet. Revising this file is not a good idea.


appendix_a2tablesasimages11-00.jpg 566x386

Standard Internet Port Assignments (First 100 Ports)

Listing A.2 shows the standard ports (up to port #100) defined in the /etc/services file. You can change many of these to suit your needs, but be sure to notify the clients if you do so.

appendix_a2tablesasimages11-01.jpg 565x248


appendix_a2tablesasimages12-00.jpg 583x750


HTTP 1.1 Status Codes

If you want to write your own Web server, you need to understand and use the standard status codes of HTTP 1.1 [RFC2616, RFC2817]. Table A.3 lists these codes.

appendix_a2tablesasimages13-00.jpg 561x625


appendix_a2tablesasimages14-00.jpg 577x270

Socket Options (setsockopt() )

Tables A.4 through A.7 list the various socket options and the required parameters. Not all options are size compatible between UNIX types. For example, IP_TTL in Linux allows a type int , but only fills the first byte. IBM’s AIX restricts the same option to a char instead.

appendix_a2tablesasimages14-01.jpg 570x333


appendix_a2tablesasimages15-00.jpg 577x750


appendix_a2tablesasimages16-00.jpg 730x538


appendix_a2tablesasimages17-00.jpg 740x530


appendix_a2tablesasimages18-00.jpg 745x563


appendix_a2tablesasimages19-00.jpg 572x698


Signal Definitions

Table A.8 lists the standard signals and their meanings.

appendix_a2tablesasimages20-00.jpg 580x647


appendix_a2tablesasimages21-00.jpg 570x400

ICMP Codes

Table A.9 shows the different types of ICMP [RFC792] packets and what they mean.

appendix_a2tablesasimages21-01.jpg 565x273


appendix_a2tablesasimages22-00.jpg 601x719


IPv4 Multicast Allocation

Table A.10 defines the current multicast address allocation [RFC2365] in spectrum order.

appendix_a2tablesasimages23-00.jpg 576x202

Proposed IPv6 Address Allocation

Table A.11 lists the proposed IPv6 address allocation in bits.

appendix_a2tablesasimages23-01.jpg 575x390


appendix_a2tablesasimages24-00.jpg 588x201

ICMPv6 Codes

Table A.12 shows the new ICMPv6 [RFC2463] for IPv6.

appendix_a2tablesasimages24-01.jpg 598x450


appendix_a2tablesasimages25-00.jpg 565x202

IPv6 Multicast Scope Field

Table A.13 defines the different values for the scope field in the multicast IPv6 addresses.

appendix_a2tablesasimages25-01.jpg 575x356


IPv6 Multicast Flags Field

Table A.14 shows the currently defined flag fields for IPv6 multicast addresses.

appendix_a2tablesasimages26-00.jpg 587x231