11 * @defgroup commtypes Communication semantics
15 #define SOCK_STREAM 1 /**< Connection-based, reliable streams */
16 #define SOCK_DGRAM 2 /**< Connectionless, unreliable streams */
20 * Name communication semantics
22 * @v semantics Communication semantics (e.g. SOCK_STREAM)
23 * @ret name Name of communication semantics
25 static inline __attribute__ (( always_inline )) const char *
26 socket_semantics_name ( int semantics ) {
27 switch ( semantics ) {
28 case SOCK_STREAM: return "SOCK_STREAM";
29 case SOCK_DGRAM: return "SOCK_DGRAM";
30 default: return "SOCK_UNKNOWN";
35 * @defgroup addrfam Address families
39 #define AF_INET 1 /**< IPv4 Internet addresses */
40 #define AF_INET6 2 /**< IPv6 Internet addresses */
46 * @v family Address family (e.g. AF_INET)
47 * @ret name Name of address family
49 static inline __attribute__ (( always_inline )) const char *
50 socket_family_name ( int family ) {
52 case AF_INET: return "AF_INET";
53 case AF_INET6: return "AF_INET6";
54 default: return "AF_UNKNOWN";
58 /** A socket address family */
59 typedef uint16_t sa_family_t;
61 /** Length of a @c struct @c sockaddr */
65 * Generalized socket address structure
67 * This contains the fields common to socket addresses for all address
71 /** Socket address family
73 * This is an AF_XXX constant.
75 sa_family_t sa_family;
78 * This ensures that a struct @c sockaddr_tcpip is large
79 * enough to hold a socket address for any TCP/IP address
82 char pad[ SA_LEN - sizeof ( sa_family_t ) ];
85 #endif /* _GPXE_SOCKET_H */