home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 024 / psi110g.zip / SOCKADDR.H < prev    next >
C/C++ Source or Header  |  1994-04-17  |  1KB  |  35 lines

  1. #ifndef _SOCKADDR_H
  2. #define _SOCKADDR_H
  3.   
  4. /* Berkeley format socket address structures. These things were rather
  5.  * poorly thought out, but compatibility is important (or so they say).
  6.  * Note that all the sockaddr variants must be of the same size, 16 bytes
  7.  * to be specific. Although attempts have been made to account for alignment
  8.  * requirements (notably in sockaddr_ax), porters should check each
  9.  * structure.
  10.  */
  11.   
  12. /* Generic socket address structure */
  13. struct sockaddr {
  14.     short sa_family;
  15.     char sa_data[14];
  16. };
  17.   
  18. /* This is a structure for "historical" reasons (whatever they are) */
  19. struct in_addr {
  20.     unsigned long s_addr;
  21. };
  22.   
  23. /* Socket address, DARPA Internet style */
  24. struct sockaddr_in {
  25.     short sin_family;
  26.     unsigned short sin_port;
  27.     struct in_addr sin_addr;
  28.     char sin_zero[8];
  29. };
  30.   
  31. #define SOCKSIZE    (sizeof(struct sockaddr))
  32. #define MAXSOCKSIZE SOCKSIZE /* All sockets are of the same size for now */
  33.   
  34. #endif /* _SOCKADDR_H */
  35.