I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 9f4b4c5d authored by mpc's avatar mpc Committed by zzz
Browse files

Still trying to get this to compile under VS.NET

parent 33bfa942
No related branches found
No related tags found
No related merge requests found
...@@ -28,26 +28,27 @@ ...@@ -28,26 +28,27 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef PLATFORM_H #ifndef LIBSAM_PLATFORM_H
#define PLATFORM_H #define LIBSAM_PLATFORM_H
/* /*
* Operating system * Operating system
*/ */
#define FREEBSD 0 // FreeBSD #define FREEBSD 0 // FreeBSD
#define MINGW 1 // Windows native (Mingw) #define CYGWIN 1 // Cygwin
#define LINUX 2 // Linux #define LINUX 2 // Linux
#define CYGWIN 3 // Cygwin #define MINGW 3 // Windows native (Mingw)
#define MSVC 4 // Windows native (Visual C++ 2003)
#if OS == MINGW #if OS == CYGWIN
#define INET_ADDRSTRLEN 16 #define INET_ADDRSTRLEN 16
#define NO_GETHOSTBYNAME2 #define NO_GETHOSTBYNAME2
#define NO_INET_ATON /* implies NO_INET_PTON */
#define NO_INET_NTOP #define NO_INET_NTOP
#define NO_SSIZE_T #define NO_INET_PTON
#define NO_SNPRINTF
#define NO_STRL #define NO_STRL
#define NO_VSNPRINTF
#define NO_Z_FORMAT #define NO_Z_FORMAT
#define WINSOCK
#endif #endif
#if OS == LINUX #if OS == LINUX
...@@ -56,23 +57,23 @@ ...@@ -56,23 +57,23 @@
#define NO_Z_FORMAT #define NO_Z_FORMAT
#endif #endif
#if OS == CYGWIN #if OS == MINGW
#define INET_ADDRSTRLEN 16 #define INET_ADDRSTRLEN 16
#define NO_GETHOSTBYNAME2 #define NO_GETHOSTBYNAME2
#define NO_INET_ATON // implies NO_INET_PTON
#define NO_INET_NTOP #define NO_INET_NTOP
#define NO_INET_PTON #define NO_SSIZE_T
#define NO_SNPRINTF
#define NO_STRL #define NO_STRL
#define NO_VSNPRINTF
#define NO_Z_FORMAT #define NO_Z_FORMAT
#define WINSOCK
#endif #endif
/* #if OS == MSVC // FIXME: doesn't work
* Standard C99 includes - if your compiler doesn't have these, it's time to #define NO_STDBOOL_H
* upgrade #define NO_SSIZE_T
*/ #define NO_STRL
#include <stdbool.h> // bool #define WINSOCK
#include <stddef.h> // size_t #endif
/* /*
* System includes * System includes
...@@ -141,4 +142,4 @@ typedef unsigned short ushort; ...@@ -141,4 +142,4 @@ typedef unsigned short ushort;
#include <ctype.h> #include <ctype.h>
#endif #endif
#endif /* PLATFORM_H */ #endif /* LIBSAM_PLATFORM_H */
...@@ -28,17 +28,19 @@ ...@@ -28,17 +28,19 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef SAM_H #ifndef LIBSAM_SAM_H
#define SAM_H #define LIBSAM_SAM_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* #ifdef NO_STDBOOL_H
* Standard C99 includes - if your compiler doesn't have these, it's time to typedef int bool;
* upgrade #define true 0
*/ #define false 1
#include <stdbool.h> // bool #else
#include <stdbool.h>
#endif
#include <stddef.h> // size_t #include <stddef.h> // size_t
...@@ -70,12 +72,6 @@ extern "C" { ...@@ -70,12 +72,6 @@ extern "C" {
* Some LibSAM variable types * Some LibSAM variable types
*/ */
#ifdef WINSOCK
typedef SOCKET socket_t;
#else
typedef int socket_t;
#endif
typedef enum {SAM_STREAM, SAM_DGRAM, SAM_RAW} sam_conn_t; /* SAM connection */ typedef enum {SAM_STREAM, SAM_DGRAM, SAM_RAW} sam_conn_t; /* SAM connection */
typedef char sam_pubkey_t[SAM_PUBKEY_LEN]; /* base 64 public key */ typedef char sam_pubkey_t[SAM_PUBKEY_LEN]; /* base 64 public key */
...@@ -88,7 +84,7 @@ typedef struct { ...@@ -88,7 +84,7 @@ typedef struct {
typedef long sam_sid_t; /* stream id number */ typedef long sam_sid_t; /* stream id number */
typedef struct { typedef struct {
socket_t sock; /* the socket used for communications with SAM */ int sock; /* the socket used for communications with SAM */
bool connected; /* whether the socket is connected */ bool connected; /* whether the socket is connected */
sam_sid_t prev_id; /* the last stream id number we used */ sam_sid_t prev_id; /* the last stream id number we used */
} sam_sess_t; /* a SAM session */ } sam_sess_t; /* a SAM session */
...@@ -166,4 +162,4 @@ void (*sam_rawback)(sam_sess_t *session, void *data, size_t size); ...@@ -166,4 +162,4 @@ void (*sam_rawback)(sam_sess_t *session, void *data, size_t size);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* SAM_H */ #endif /* LIBSAM_SAM_H */
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
* snprintf.c) * snprintf.c)
*/ */
#ifndef SNPRINTF_H #ifndef LIBSAM_SNPRINTF_H
#define SNPRINTF_H #define LIBSAM_SNPRINTF_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
...@@ -46,4 +46,4 @@ int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); ...@@ -46,4 +46,4 @@ int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* SNPRINTF_H */ #endif /* LIBSAM_SNPRINTF_H */
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
* Note: The strl.c file retains its original license (at the top of strl.c) * Note: The strl.c file retains its original license (at the top of strl.c)
*/ */
#ifndef STRL_H #ifndef LIBSAM_STRL_H
#define STRL_H #define LIBSAM_STRL_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
...@@ -44,4 +44,4 @@ extern size_t strlcpy(char *dst, const char *src, size_t siz); ...@@ -44,4 +44,4 @@ extern size_t strlcpy(char *dst, const char *src, size_t siz);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* STRL_H */ #endif /* LIBSAM_STRL_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment