1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
-
+
|
/*
* tclWinSock.c --
*
* This file contains Windows-specific socket related code.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclWinSock.c,v 1.5 1999/02/03 00:51:20 stanton Exp $
* RCS: @(#) $Id: tclWinSock.c,v 1.5.4.1 1999/03/03 00:38:47 stanton Exp $
*/
#include "tclInt.h"
#include "tclPort.h"
/*
* The following variable is used to tell whether this module has been
|
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
|
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
|
-
+
-
+
-
+
-
-
+
+
-
+
|
*
* Side effects:
* As defined for each function.
*
*----------------------------------------------------------------------
*/
int PASCAL FAR
int
TclWinGetSockOpt(SOCKET s, int level, int optname, char FAR * optval,
int FAR *optlen)
{
/*
* Check that WinSock is initialized; do not call it if not, to
* prevent system crashes. This can happen at exit time if the exit
* handler for WinSock ran before other exit handlers that want to
* use sockets.
*/
if (winSock.hInstance == NULL) {
return SOCKET_ERROR;
}
return (*winSock.getsockopt)(s, level, optname, optval, optlen);
}
int PASCAL FAR
int
TclWinSetSockOpt(SOCKET s, int level, int optname, const char FAR * optval,
int optlen)
{
/*
* Check that WinSock is initialized; do not call it if not, to
* prevent system crashes. This can happen at exit time if the exit
* handler for WinSock ran before other exit handlers that want to
* use sockets.
*/
if (winSock.hInstance == NULL) {
return SOCKET_ERROR;
}
return (*winSock.setsockopt)(s, level, optname, optval, optlen);
}
u_short PASCAL FAR
u_short
TclWinNToHS(u_short netshort)
{
/*
* Check that WinSock is initialized; do not call it if not, to
* prevent system crashes. This can happen at exit time if the exit
* handler for WinSock ran before other exit handlers that want to
* use sockets.
*/
if (winSock.hInstance == NULL) {
return (u_short) -1;
}
return (*winSock.ntohs)(netshort);
}
struct servent FAR * PASCAL FAR
TclWinGetServByName(const char FAR * name, const char FAR * proto)
struct servent *
TclWinGetServByName(const char * name, const char * proto)
{
/*
* Check that WinSock is initialized; do not call it if not, to
* prevent system crashes. This can happen at exit time if the exit
* handler for WinSock ran before other exit handlers that want to
* use sockets.
*/
if (winSock.hInstance == NULL) {
return (struct servent FAR *) NULL;
return (struct servent *) NULL;
}
return (*winSock.getservbyname)(name, proto);
}
|