Appendix D. Miscellaneous Source Code

unp.h Header

Almost every program in the text includes our unp.h header, shown in Figure D.1. This header includes all the standard system headers that most network programs need, along with some general system headers. It also defines constants such as MAXLINE, ANSI C function prototypes for the functions we define in the text (e.g., readline), and all the wrapper functions we use. We do not show these prototypes.

Example D.1. Our header unp.h.

lib/unp.h

 1 /* Our own header. Tabs are set for 4 spaces, not 8 */ 2 #ifndef __unp_h 3 #define __unp_h 4 #include "../config.h" /* configuration options for current OS */ 5 /* "../config.h" is generated by configure */ 6 /* If anything changes in the following list of ...

Get The Sockets Networking API: UNIX® Network Programming Volume 1, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.