|
@@ -12,8 +12,15 @@
|
12
|
12
|
*
|
13
|
13
|
* @{
|
14
|
14
|
*/
|
15
|
|
-#define SOCK_STREAM 1 /**< Connection-based, reliable streams */
|
16
|
|
-#define SOCK_DGRAM 2 /**< Connectionless, unreliable streams */
|
|
15
|
+
|
|
16
|
+/** Connection-based, reliable streams */
|
|
17
|
+#define SOCK_STREAM ( ( int ) TCP_SOCK_STREAM )
|
|
18
|
+extern char TCP_SOCK_STREAM[];
|
|
19
|
+
|
|
20
|
+/** Connectionless, unreliable streams */
|
|
21
|
+#define SOCK_DGRAM ( ( int ) UDP_SOCK_DGRAM )
|
|
22
|
+extern char UDP_SOCK_DGRAM[];
|
|
23
|
+
|
17
|
24
|
/** @} */
|
18
|
25
|
|
19
|
26
|
/**
|
|
@@ -24,10 +31,13 @@
|
24
|
31
|
*/
|
25
|
32
|
static inline __attribute__ (( always_inline )) const char *
|
26
|
33
|
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";
|
|
34
|
+ /* Cannot use a switch() because of the {TCP_UDP}_SOCK_XXX hack */
|
|
35
|
+ if ( semantics == SOCK_STREAM ) {
|
|
36
|
+ return "SOCK_STREAM";
|
|
37
|
+ } else if ( semantics == SOCK_DGRAM ) {
|
|
38
|
+ return "SOCK_DGRAM";
|
|
39
|
+ } else {
|
|
40
|
+ return "SOCK_UNKNOWN";
|
31
|
41
|
}
|
32
|
42
|
}
|
33
|
43
|
|