forked from hufrea/byedpi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ruti
committed
Feb 18, 2024
1 parent
4982846
commit 7666899
Showing
12 changed files
with
236 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
TARGET = ciadpi | ||
CC ?= gcc | ||
CFLAGS += -std=c99 -O2 -D_XOPEN_SOURCE=500 | ||
SOURCES = packets.c main.c conev.c proxy.c desync.c | ||
SOURCES = packets.c main.c conev.c proxy.c desync.c error.c | ||
|
||
all: | ||
$(CC) $(CFLAGS) $(SOURCES) -I . -o $(TARGET) | ||
|
||
windows: | ||
$(CC) $(CFLAGS) $(SOURCES) -I . -lws2_32 -o $(TARGET).exe | ||
|
||
clean: | ||
rm -f $(TARGET) *.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <errno.h> | ||
|
||
#ifdef _WIN32 | ||
#include <winsock2.h> | ||
#endif | ||
|
||
int unie(int e) | ||
{ | ||
#ifdef _WIN32 | ||
switch (e) { | ||
case WSAEWOULDBLOCK: | ||
return EAGAIN; | ||
case WSAETIMEDOUT: | ||
return ETIMEDOUT; | ||
case WSAENETUNREACH: | ||
return ENETUNREACH; | ||
case WSAEHOSTUNREACH: | ||
return EHOSTUNREACH; | ||
case WSAECONNREFUSED: | ||
return ECONNREFUSED; | ||
} | ||
#endif | ||
return e; | ||
} | ||
|
||
int get_e() | ||
{ | ||
#ifdef _WIN32 | ||
int e = WSAGetLastError(); | ||
return unie(e); | ||
#else | ||
return errno; | ||
#endif | ||
} | ||
|
||
void uniperror(char *str) | ||
{ | ||
#ifdef _WIN32 | ||
int e = WSAGetLastError(); | ||
fprintf(stderr, "%s: %d\n", str, e); | ||
#else | ||
perror(str); | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
int unie(int e); | ||
void uniperror(char *str); | ||
int get_e(); | ||
void uniperror(char *str); |
Oops, something went wrong.