diff options
author | Michael Brown <mcb30@etherboot.org> | 2007-06-28 18:06:25 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2007-06-28 18:06:25 +0100 |
commit | 5de837cc67ccbd30c5d3b13579c697cf1061d252 (patch) | |
tree | 778b473e7f6f703d53feb327c9b867bf295407d6 /src | |
parent | e4c9c91d6ee360d744e89924b90ffc4882a9ec22 (diff) | |
download | ipxe-5de837cc67ccbd30c5d3b13579c697cf1061d252.zip ipxe-5de837cc67ccbd30c5d3b13579c697cf1061d252.tar.gz ipxe-5de837cc67ccbd30c5d3b13579c697cf1061d252.tar.bz2 |
Mildly ugly hack to force correct linkage.
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gpxe/socket.h | 22 | ||||
-rw-r--r-- | src/net/tcp.c | 2 | ||||
-rw-r--r-- | src/net/udp.c | 2 |
3 files changed, 20 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"; } } diff --git a/src/net/tcp.c b/src/net/tcp.c index 00c7b74..ebfaaa4 100644 --- a/src/net/tcp.c +++ b/src/net/tcp.c @@ -973,6 +973,8 @@ struct socket_opener tcp_socket_opener __socket_opener = { .open = tcp_open, }; +char TCP_SOCK_STREAM[1]; + /** * Open TCP URI * diff --git a/src/net/udp.c b/src/net/udp.c index c99a3eb..c6216d8 100644 --- a/src/net/udp.c +++ b/src/net/udp.c @@ -436,6 +436,8 @@ struct socket_opener udp_socket_opener __socket_opener = { .open = udp_open, }; +char UDP_SOCK_DGRAM[1]; + /** * Open UDP URI * |