* Server side transport handle
*/
typedef struct SVCXPRT {
+#ifdef _WIN32
+ SOCKET xp_sock;
+#else
int xp_sock;
+#endif
u_short xp_port; /* associated port number */
struct xp_ops {
/* receive incomming requests */
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
+#include <port-sockets.h>
#include "autoconf.h"
static struct callrpc_private {
CLIENT *client;
- int socket;
+ SOCKET socket;
int oldprognum, oldversnum, valid;
char *oldhost;
} *callrpc_private;
/* reuse old client */
} else {
crp->valid = 0;
- (void)close(crp->socket);
+ (void)closesocket(crp->socket);
crp->socket = RPC_ANYSOCK;
if (crp->client) {
clnt_destroy(crp->client);
#include <gssrpc/pmap_clnt.h>
/* FD_ZERO may need memset declaration (e.g., Solaris 9) */
#include <string.h>
+#include <port-sockets.h>
#define MCALL_MSG_SIZE 24
struct sockaddr_in *raddr,
rpcprog_t prog,
rpcvers_t vers,
- register int *sockp,
+ SOCKET *sockp,
u_int sendsz,
u_int recvsz)
{
sizeof(*raddr)) < 0)) {
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
- (void)close(*sockp);
+ (void)closesocket(*sockp);
goto fooy;
}
ct->ct_closeit = TRUE;
xdrmem_create(&(ct->ct_xdrs), ct->ct_u.ct_mcall, MCALL_MSG_SIZE,
XDR_ENCODE);
if (! xdr_callhdr(&(ct->ct_xdrs), &call_msg)) {
- if (ct->ct_closeit) {
- (void)close(*sockp);
- }
+ if (ct->ct_closeit)
+ (void)closesocket(*sockp);
goto fooy;
}
ct->ct_mpos = XDR_GETPOS(&(ct->ct_xdrs));
register struct ct_data *ct =
(struct ct_data *) h->cl_private;
- if (ct->ct_closeit) {
- (void)close(ct->ct_sock);
- }
+ if (ct->ct_closeit)
+ (void)closesocket(ct->ct_sock);
XDR_DESTROY(&(ct->ct_xdrs));
mem_free((caddr_t)ct, sizeof(struct ct_data));
mem_free((caddr_t)h, sizeof(CLIENT));
#include <errno.h>
#include <string.h>
#include <gssrpc/pmap_clnt.h>
+#include <port-sockets.h>
#include <errno.h>
* Private data kept per client handle
*/
struct cu_data {
- int cu_sock;
+ SOCKET cu_sock;
bool_t cu_closeit;
struct sockaddr_in cu_raddr;
int cu_rlen;
{
register struct cu_data *cu = (struct cu_data *)cl->cl_private;
- if (cu->cu_closeit) {
- (void)close(cu->cu_sock);
- }
+ if (cu->cu_closeit)
+ (void)closesocket(cu->cu_sock);
XDR_DESTROY(&(cu->cu_outxdrs));
mem_free((caddr_t)cu, (sizeof(*cu) + cu->cu_sendsz + cu->cu_recvsz));
mem_free((caddr_t)cl, sizeof(CLIENT));
#include <arpa/inet.h>
#define MAX_BROADCAST_SIZE 1400
#include <string.h>
+#include <port-sockets.h>
#include "k5-platform.h" /* set_cloexec_fd */
static struct timeval timeout = { 3, 0 };
struct timeval tout,
rpcport_t *port_ptr)
{
- int sock = -1;
+ SOCKET sock = INVALID_SOCKET;
register CLIENT *client;
struct rmtcallargs a;
struct rmtcallres r;
} else {
stat = RPC_FAILED;
}
- (void)close(sock);
+ (void)closesocket(sock);
addr->sin_port = 0;
return (stat);
}
XDR xdr_stream;
register XDR *xdrs = &xdr_stream;
int outlen, inlen, fromlen, nets;
- register int sock;
+ SOCKET sock;
int on = 1;
#ifdef FD_SETSIZE
fd_set mask;
}
}
done_broad:
- (void)close(sock);
+ (void)closesocket(sock);
AUTH_DESTROY(unix_auth);
return (stat);
}
#include <stdlib.h>
#include "autoconf.h"
#include "k5-platform.h" /* set_cloexec_fd */
+#include <port-sockets.h>
/*extern bool_t abort();
extern errno;
*/
*/
SVCXPRT *
svctcp_create(
- register int sock,
+ SOCKET sock,
u_int sendsize,
u_int recvsize)
{
}
if (getsockname(sock, (struct sockaddr *)&addr, &len) != 0) {
perror("svc_tcp.c - cannot getsockname");
- if (madesock)
- (void) close(sock);
+ if (madesock)
+ (void)closesocket(sock);
return ((SVCXPRT *)NULL);
}
if (listen(sock, 2) != 0) {
perror("svctcp_.c - cannot listen");
- if (madesock)
- (void)close(sock);
+ if (madesock)
+ (void)closesocket(sock);
return ((SVCXPRT *)NULL);
}
r = (struct tcp_rendezvous *)mem_alloc(sizeof(*r));
register SVCXPRT *xprt,
struct rpc_msg *msg)
{
- int sock;
+ SOCKET sock;
struct tcp_rendezvous *r;
struct sockaddr_in addr, laddr;
int len, llen;
*/
xprt = makefd_xprt(sock, r->sendsize, r->recvsize);
if (xprt == NULL) {
- close(sock);
+ (void)closesocket(sock);
return (FALSE);
}
xprt->xp_raddr = addr;
register struct tcp_conn *cd = (struct tcp_conn *)xprt->xp_p1;
xprt_unregister(xprt);
- (void)close(xprt->xp_sock);
+ (void)closesocket(xprt->xp_sock);
if (xprt->xp_port != 0) {
/* a rendezvouser socket */
xprt->xp_port = 0;
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
+#include <port-sockets.h>
#include "k5-platform.h"
register struct svcudp_data *su = su_data(xprt);
xprt_unregister(xprt);
- if (xprt->xp_sock != -1)
- (void)close(xprt->xp_sock);
- xprt->xp_sock = -1;
+ if (xprt->xp_sock != INVALID_SOCKET)
+ (void)closesocket(xprt->xp_sock);
+ xprt->xp_sock = INVALID_SOCKET;
if (xprt->xp_auth != NULL) {
SVCAUTH_DESTROY(xprt->xp_auth);
xprt->xp_auth = NULL;