aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2007-06-28 18:06:25 +0100
committerMichael Brown <mcb30@etherboot.org>2007-06-28 18:06:25 +0100
commit5de837cc67ccbd30c5d3b13579c697cf1061d252 (patch)
tree778b473e7f6f703d53feb327c9b867bf295407d6 /src/include
parente4c9c91d6ee360d744e89924b90ffc4882a9ec22 (diff)
downloadipxe-5de837cc67ccbd30c5d3b13579c697cf1061d252.zip
ipxe-5de837cc67ccbd30c5d3b13579c697cf1061d252.tar.gz
ipxe-5de837cc67ccbd30c5d3b13579c697cf1061d252.tar.bz2
Mildly ugly hack to force correct linkage.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gpxe/socket.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/include/gpxe/socket.h b/src/include/gpxe/socket.h
index d47369a..9c7afb8 100644
--- a/src/include/gpxe/socket.h
+++ b/src/include/gpxe/socket.h
@@ -12,8 +12,15 @@
*
* @{
*/
-#define SOCK_STREAM 1 /**< Connection-based, reliable streams */
-#define SOCK_DGRAM 2 /**< Connectionless, unreliable streams */
+
+/** Connection-based, reliable streams */
+#define SOCK_STREAM ( ( int ) TCP_SOCK_STREAM )
+extern char TCP_SOCK_STREAM[];
+
+/** Connectionless, unreliable streams */
+#define SOCK_DGRAM ( ( int ) UDP_SOCK_DGRAM )
+extern char UDP_SOCK_DGRAM[];
+
/** @} */
/**
@@ -24,10 +31,13 @@
*/
static inline __attribute__ (( always_inline )) const char *
socket_semantics_name ( int semantics ) {
- switch ( semantics ) {
- case SOCK_STREAM: return "SOCK_STREAM";
- case SOCK_DGRAM: return "SOCK_DGRAM";
- default: return "SOCK_UNKNOWN";
+ /* Cannot use a switch() because of the {TCP_UDP}_SOCK_XXX hack */
+ if ( semantics == SOCK_STREAM ) {
+ return "SOCK_STREAM";
+ } else if ( semantics == SOCK_DGRAM ) {
+ return "SOCK_DGRAM";
+ } else {
+ return "SOCK_UNKNOWN";
}
}