Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
9ae5fdb2
Commit
9ae5fdb2
authored
Aug 01, 2019
by
Olivier Crête
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stund: Add win32 support
parent
5e5e9ad5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
stun/tools/stund.c
stun/tools/stund.c
+19
-11
No files found.
stun/tools/stund.c
View file @
9ae5fdb2
...
@@ -44,8 +44,6 @@
...
@@ -44,8 +44,6 @@
#define _XPG4_2 1
#define _XPG4_2 1
#endif
#endif
#ifndef _WIN32
#include <assert.h>
#include <assert.h>
#include <stdio.h>
#include <stdio.h>
#include <stdint.h>
#include <stdint.h>
...
@@ -55,10 +53,13 @@
...
@@ -55,10 +53,13 @@
#include <sys/types.h>
#include <sys/types.h>
#ifdef _WIN32
#include <WinSock2.h>
#else
#include <sys/socket.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/in.h>
#endif
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
# include <unistd.h>
# include <unistd.h>
...
@@ -127,7 +128,7 @@ int listen_socket (int fam, int type, int proto, unsigned int port)
...
@@ -127,7 +128,7 @@ int listen_socket (int fam, int type, int proto, unsigned int port)
case
AF_INET6
:
case
AF_INET6
:
#ifdef IPV6_V6ONLY
#ifdef IPV6_V6ONLY
setsockopt
(
fd
,
SOL_IPV6
,
IPV6_V6ONLY
,
&
yes
,
sizeof
(
yes
));
setsockopt
(
fd
,
SOL_IPV6
,
IPV6_V6ONLY
,
(
const
char
*
)
&
yes
,
sizeof
(
yes
));
#endif
#endif
addr
.
in6
.
sin6_port
=
htons
(
port
);
addr
.
in6
.
sin6_port
=
htons
(
port
);
break
;
break
;
...
@@ -148,13 +149,13 @@ int listen_socket (int fam, int type, int proto, unsigned int port)
...
@@ -148,13 +149,13 @@ int listen_socket (int fam, int type, int proto, unsigned int port)
{
{
case
AF_INET
:
case
AF_INET
:
#ifdef IP_RECVERR
#ifdef IP_RECVERR
setsockopt
(
fd
,
SOL_IP
,
IP_RECVERR
,
&
yes
,
sizeof
(
yes
));
setsockopt
(
fd
,
SOL_IP
,
IP_RECVERR
,
(
const
char
*
)
&
yes
,
sizeof
(
yes
));
#endif
#endif
break
;
break
;
case
AF_INET6
:
case
AF_INET6
:
#ifdef IPV6_RECVERR
#ifdef IPV6_RECVERR
setsockopt
(
fd
,
SOL_IPV6
,
IPV6_RECVERR
,
&
yes
,
sizeof
(
yes
));
setsockopt
(
fd
,
SOL_IPV6
,
IPV6_RECVERR
,
(
const
char
*
)
&
yes
,
sizeof
(
yes
));
#endif
#endif
break
;
break
;
...
@@ -288,6 +289,18 @@ int main (int argc, char *argv[])
...
@@ -288,6 +289,18 @@ int main (int argc, char *argv[])
unsigned
port
=
IPPORT_STUN
;
unsigned
port
=
IPPORT_STUN
;
int
i
;
int
i
;
#ifdef _WIN32
WSADATA
wsadata
;
if
(
WSAStartup
(
MAKEWORD
(
2
,
0
),
&
wsadata
)
!=
0
)
{
fprintf
(
stderr
,
"Could not start Winsock2"
);
return
1
;
}
#endif
for
(
i
=
1
;
i
<
argc
;
++
i
)
for
(
i
=
1
;
i
<
argc
;
++
i
)
{
{
const
char
*
arg
=
argv
[
i
];
const
char
*
arg
=
argv
[
i
];
...
@@ -316,8 +329,3 @@ int main (int argc, char *argv[])
...
@@ -316,8 +329,3 @@ int main (int argc, char *argv[])
return
run
(
family
,
IPPROTO_UDP
,
port
)
?
EXIT_FAILURE
:
EXIT_SUCCESS
;
return
run
(
family
,
IPPROTO_UDP
,
port
)
?
EXIT_FAILURE
:
EXIT_SUCCESS
;
}
}
#else
int
main
(
int
argc
,
char
**
argv
)
{
return
0
;
}
#endif
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