2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-24 04:01:33 +00:00

Added PF_INET[6] and SOCK_{STREAM,DGRAM} definitions and debug

functions.
This commit is contained in:
Michael Brown 2007-04-28 20:53:48 +00:00
parent 1c765b3988
commit 27b3bd10c9

View File

@ -7,9 +7,62 @@
*
*/
/* Network address family numbers */
#define AF_INET 1
#define AF_INET6 2
/**
* @defgroup commdomains Communication domains
*
* @{
*/
#define PF_INET 1 /**< IPv4 Internet protocols */
#define PF_INET6 2 /**< IPv6 Internet protocols */
/** @} */
/**
* Name communication domain
*
* @v domain Communication domain (e.g. PF_INET)
* @ret name Name of communication domain
*/
static inline __attribute__ (( always_inline )) const char *
socket_domain_name ( int domain ) {
switch ( domain ) {
case PF_INET: return "PF_INET";
case PF_INET6: return "PF_INET6";
default: return "PF_UNKNOWN";
}
}
/**
* @defgroup commtypes Communication types
*
* @{
*/
#define SOCK_STREAM 1 /**< Connection-based, reliable streams */
#define SOCK_DGRAM 2 /**< Connectionless, unreliable streams */
/** @} */
/**
* Name communication type
*
* @v type Communication type (e.g. SOCK_STREAM)
* @ret name Name of communication type
*/
static inline __attribute__ (( always_inline )) const char *
socket_type_name ( int type ) {
switch ( type ) {
case SOCK_STREAM: return "SOCK_STREAM";
case SOCK_DGRAM: return "SOCK_DGRAM";
default: return "SOCK_UNKNOWN";
}
}
/**
* @defgroup addrfam Address families
*
* @{
*/
#define AF_INET 1 /**< IPv4 Internet addresses */
#define AF_INET6 2 /**< IPv6 Internet addresses */
/** @} */
/** A socket address family */
typedef uint16_t sa_family_t;