Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EtherBone Core
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
EtherBone Core
Commits
816f2171
There was an error fetching the commit references. Please try again later.
Commit
816f2171
authored
13 years ago
by
Wesley W. Terpstra
Browse files
Options
Downloads
Patches
Plain Diff
Fix win32 compilation
parent
d36a01f5
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/Makefile
+1
-1
1 addition, 1 deletion
api/Makefile
api/tools/eb-discover.c
+28
-2
28 additions, 2 deletions
api/tools/eb-discover.c
with
29 additions
and
3 deletions
api/Makefile
+
1
−
1
View file @
816f2171
...
...
@@ -94,7 +94,7 @@ tools/%: tools/%.c tools/common.c $(LIBRARY)
tools/eb-tunnel
:
tools/eb-tunnel.c $(ARCHIVE)
$(
CC
)
$(
CFLAGS
)
-o
$@
$^
$(
LIBS
)
tools/eb-discover
:
tools/eb-discover.c
tools/common.c
$(ARCHIVE)
tools/eb-discover
:
tools/eb-discover.c $(ARCHIVE)
$(
CC
)
$(
CFLAGS
)
-o
$@
$^
$(
LIBS
)
test/%
:
test/%.c $(LIBRARY)
...
...
This diff is collapsed.
Click to expand it.
api/tools/eb-discover.c
+
28
−
2
View file @
816f2171
...
...
@@ -26,13 +26,35 @@
*/
#include
"../transport/posix-udp.h"
#include
"common.h"
#include
<unistd.h>
/* getopt */
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#ifdef __WIN32
#include
<winsock2.h>
#endif
static
const
char
*
width_str
[
16
]
=
{
/* 0 */
"<null>"
,
/* 1 */
"8"
,
/* 2 */
"16"
,
/* 3 */
"8/16"
,
/* 4 */
"32"
,
/* 5 */
"8/32"
,
/* 6 */
"16/32"
,
/* 7 */
"8/16/32"
,
/* 8 */
"64"
,
/* 9 */
"8/64"
,
/* 10 */
"16/64"
,
/* 11 */
"8/16/64"
,
/* 12 */
"32/64"
,
/* 13 */
"8/32/64"
,
/* 14 */
"16/32/64"
,
/* 15 */
"8/16/32/64"
};
struct
eb_block_readset
{
int
nfd
;
fd_set
rfds
;
...
...
@@ -56,7 +78,7 @@ static void check(int sock) {
sslen
=
sizeof
(
ss
);
eb_posix_ip_non_blocking
(
sock
,
1
);
if
(
recvfrom
(
sock
,
&
buf
[
0
],
8
,
MSG_DONTWAIT
,
(
struct
sockaddr
*
)
&
ss
,
&
sslen
)
!=
8
)
return
;
if
(
recvfrom
(
sock
,
(
char
*
)
&
buf
[
0
],
8
,
MSG_DONTWAIT
,
(
struct
sockaddr
*
)
&
ss
,
&
sslen
)
!=
8
)
return
;
if
(
buf
[
0
]
!=
0x4E
||
buf
[
1
]
!=
0x6F
)
return
;
if
(
getnameinfo
((
struct
sockaddr
*
)
&
ss
,
sslen
,
host
,
sizeof
(
host
),
port
,
sizeof
(
port
),
NI_DGRAM
)
!=
0
)
{
...
...
@@ -79,6 +101,10 @@ int main(int argc, char** argv) {
struct
eb_transport
*
transport
;
uint8_t
discover
[
8
];
eb_status_t
status
;
#ifdef __WIN32
WORD
wVersionRequested
;
WSADATA
wsaData
;
#endif
if
(
argc
!=
2
)
{
fprintf
(
stderr
,
"%s: missing non-optional argument -- <broadcast-address>
\n
"
,
argv
[
0
]);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment