MIT Information Systems

Macintosh Development

[Home] [About Us] [People] [Information Systems]
[Kerberos for Macintosh] [Applications] [Miscellaneous Documentation]


Structures and Types used by the Sockets Library


typedef UInt32  in_addr_t; 



typedef UInt32 socklen_t;



struct sockaddr {
	u_short	sa_family;
	char	sa_data[14];
};



struct in_addr {
  in_addr_t s_addr;               /* the IP address in network byte order    */
};



struct sockaddr_in {
  u_short         sin_family;     /* always AF_INET                          */
  u_short         sin_port;       /* the service port                        */
  struct in_addr  sin_addr;       /* the IP address                          */
  char            sin_zero[8];    /* unused (reserved for expansion          */
};



struct iovec {
  struct iovec *next;           /* For compatibility with Open Transport     */
  void         *iov_base;       /* Starting address of buffer                */
  size_t       iov_len;         /* size of buffer                            */
};



struct servent{
  char  *s_name;         /* official service name                            */
  char **s_aliases;      /* alias list                                       */
  int    s_port;         /* port number, network-byte order                  */
  char  *s_proto;        /* protocol to use                                  */
};



struct hostent{
  char  *h_name;         /* official (cannonical) name of host               */
  char **h_aliases;      /* pointer to array of pointers of alias names      */
  int    h_addrtype;     /* host address type: AF_INET                       */
  int    h_length;       /* length of address: 4                             */
  char **h_addr_list;    /* pointer to array of pointers with IPv4 addresses */
};



#define h_addr  h_addr_list[0]  /* first address in list                     */



struct timeval {
	int tv_sec;						/* seconds */
	int tv_usec;					/* microseconds  */
};



typedef long fd_mask;
#define NFDBITS			(sizeof(fd_mask) * NUMBITSPERBYTE)      /* bits per mask */

typedef struct fd_set {
  fd_mask fds_bits[(FD_SETSIZE + NFDBITS - 1) / NFDBITS];
} fd_set;



Questions or comments? Send mail to macdev@mit.edu
Last updated on $Date: 2003/11/19 20:49:27 $
Last modified by $Author: smcguire $