|
@@ -7,9 +7,62 @@
|
7
|
7
|
*
|
8
|
8
|
*/
|
9
|
9
|
|
10
|
|
-/* Network address family numbers */
|
11
|
|
-#define AF_INET 1
|
12
|
|
-#define AF_INET6 2
|
|
10
|
+/**
|
|
11
|
+ * @defgroup commdomains Communication domains
|
|
12
|
+ *
|
|
13
|
+ * @{
|
|
14
|
+ */
|
|
15
|
+#define PF_INET 1 /**< IPv4 Internet protocols */
|
|
16
|
+#define PF_INET6 2 /**< IPv6 Internet protocols */
|
|
17
|
+/** @} */
|
|
18
|
+
|
|
19
|
+/**
|
|
20
|
+ * Name communication domain
|
|
21
|
+ *
|
|
22
|
+ * @v domain Communication domain (e.g. PF_INET)
|
|
23
|
+ * @ret name Name of communication domain
|
|
24
|
+ */
|
|
25
|
+static inline __attribute__ (( always_inline )) const char *
|
|
26
|
+socket_domain_name ( int domain ) {
|
|
27
|
+ switch ( domain ) {
|
|
28
|
+ case PF_INET: return "PF_INET";
|
|
29
|
+ case PF_INET6: return "PF_INET6";
|
|
30
|
+ default: return "PF_UNKNOWN";
|
|
31
|
+ }
|
|
32
|
+}
|
|
33
|
+
|
|
34
|
+/**
|
|
35
|
+ * @defgroup commtypes Communication types
|
|
36
|
+ *
|
|
37
|
+ * @{
|
|
38
|
+ */
|
|
39
|
+#define SOCK_STREAM 1 /**< Connection-based, reliable streams */
|
|
40
|
+#define SOCK_DGRAM 2 /**< Connectionless, unreliable streams */
|
|
41
|
+/** @} */
|
|
42
|
+
|
|
43
|
+/**
|
|
44
|
+ * Name communication type
|
|
45
|
+ *
|
|
46
|
+ * @v type Communication type (e.g. SOCK_STREAM)
|
|
47
|
+ * @ret name Name of communication type
|
|
48
|
+ */
|
|
49
|
+static inline __attribute__ (( always_inline )) const char *
|
|
50
|
+socket_type_name ( int type ) {
|
|
51
|
+ switch ( type ) {
|
|
52
|
+ case SOCK_STREAM: return "SOCK_STREAM";
|
|
53
|
+ case SOCK_DGRAM: return "SOCK_DGRAM";
|
|
54
|
+ default: return "SOCK_UNKNOWN";
|
|
55
|
+ }
|
|
56
|
+}
|
|
57
|
+
|
|
58
|
+/**
|
|
59
|
+ * @defgroup addrfam Address families
|
|
60
|
+ *
|
|
61
|
+ * @{
|
|
62
|
+ */
|
|
63
|
+#define AF_INET 1 /**< IPv4 Internet addresses */
|
|
64
|
+#define AF_INET6 2 /**< IPv6 Internet addresses */
|
|
65
|
+/** @} */
|
13
|
66
|
|
14
|
67
|
/** A socket address family */
|
15
|
68
|
typedef uint16_t sa_family_t;
|