Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
acffab8a
Commit
acffab8a
authored
Jun 24, 2003
by
Russell Daniel Christensen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for tmcc to compile under Windows with the WIN_SOCK networking API.
parent
58960470
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
5 deletions
+51
-5
tmcd/ssl.h
tmcd/ssl.h
+17
-1
tmcd/tmcc.c
tmcd/tmcc.c
+34
-4
No files found.
tmcd/ssl.h
View file @
acffab8a
...
...
@@ -34,9 +34,25 @@ int isssl;
#define READ tmcd_sslread
#define CLOSE tmcd_sslclose
#else
#ifdef _WIN32
inline
int
win_send
(
SOCKET
s
,
const
char
FAR
*
buf
,
int
len
)
{
return
send
(
s
,
buf
,
len
,
0
);
}
inline
int
win_recv
(
SOCKET
s
,
char
FAR
*
buf
,
int
len
)
{
return
recv
(
s
,
buf
,
len
,
0
);
}
#define ACCEPT accept
#define CONNECT connect
#define WRITE win_send
#define READ win_recv
#define CLOSE close
#else
#define ACCEPT accept
#define CONNECT connect
#define WRITE write
#define READ read
#define CLOSE close
#endif
#endif
/*_WIN32*/
#endif
/*WITHSSL*/
tmcd/tmcc.c
View file @
acffab8a
...
...
@@ -3,9 +3,22 @@
* Copyright (c) 2000-2003 University of Utah and the Flux Group.
* All rights reserved.
*/
#ifdef _WIN32
/*Windows version should be linked to: WS2_32*/
/*g++ -Wall -o tmcc tmcc.c -D_WIN32 -lWS2_32*/
#include <winsock2.h>
#include <unistd.h>
#include <getopt.h>
typedef
int
socklen_t
;
#define ECONNREFUSED WSAECONNREFUSED
#endif
#include <sys/types.h>
#ifndef _WIN32
#include <sys/socket.h>
#include <netinet/in.h>
#endif
#include <sys/un.h>
#include <sys/fcntl.h>
#include <stdio.h>
...
...
@@ -20,18 +33,22 @@
#include <time.h>
#include <assert.h>
#include <sys/types.h>
#ifndef _WIN32
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#endif
#include "decls.h"
#include "ssl.h"
#ifndef STANDALONE
#include "config.h"
#endif
#ifndef _WIN32
#undef BOSSNODE
#ifndef BOSSNODE
#include <resolv.h>
#endif
#endif
#ifndef KEYFILE
#define KEYFILE "/etc/emulab.pkey"
...
...
@@ -132,6 +149,9 @@ main(int argc, char **argv)
char
*
keyfile
=
NULL
;
char
*
privkey
=
NULL
;
char
*
proxypath
=
NULL
;
#ifdef _WIN32
WSADATA
wsaData
;
#endif
while
((
ch
=
getopt
(
argc
,
argv
,
"v:s:p:un:t:k:x:l:do:"
))
!=
-
1
)
switch
(
ch
)
{
...
...
@@ -195,6 +215,14 @@ main(int argc, char **argv)
usage
();
}
#ifdef _WIN32
/*Windows requires us to start up the version of the network API that we want*/
if
(
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
wsaData
))
{
fprintf
(
stderr
,
"WSAStartup failed
\n
"
);
exit
(
1
);
}
#endif
if
(
!
bossnode
)
{
int
port
=
0
;
...
...
@@ -356,6 +384,7 @@ getbossnode(char **bossnode, int *portp)
}
}
#ifndef _WIN32
/*
* Nameserver goo
*/
...
...
@@ -365,6 +394,7 @@ getbossnode(char **bossnode, int *portp)
if
(
he
&&
he
->
h_name
)
*
bossnode
=
strdup
(
he
->
h_name
);
else
#endif
*
bossnode
=
strdup
(
"UNKNOWN"
);
return
0
;
#endif
...
...
@@ -519,8 +549,8 @@ doudp(char *data, int outfd, struct in_addr serverip, int portnum)
static
int
dounix
(
char
*
data
,
int
outfd
,
char
*
unixpath
)
{
#if
def linux
fprintf
(
stderr
,
"unix domain socket mode not supported on
linux
!
\n
"
);
#if
defined(linux) || defined(_WIN32)
fprintf
(
stderr
,
"unix domain socket mode not supported on
this platform
!
\n
"
);
return
-
1
;
#else
int
n
,
sock
,
cc
,
length
;
...
...
@@ -596,8 +626,8 @@ dounix(char *data, int outfd, char *unixpath)
static
void
beproxy
(
char
*
localpath
,
struct
in_addr
serverip
,
char
*
partial
)
{
#if
def linux
fprintf
(
stderr
,
"proxy mode not supported on
linux
!
\n
"
);
#if
defined(linux) || defined(_WIN32)
fprintf
(
stderr
,
"proxy mode not supported on
this platform
!
\n
"
);
exit
(
-
1
);
#else
int
sock
,
newsock
,
cc
,
length
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment