File: gnut_lib.h

package info (click to toggle)
between 6%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,532 kB
  • sloc: cpp: 28,110; php: 718; ansic: 638; objc: 245; sh: 236; makefile: 97; perl: 67
file content (103 lines) | stat: -rw-r--r-- 2,282 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* Josh Pieper, (c) 2000 */

/* This file is distributed under the GPL, see file COPYING for details */

#ifndef GNUT_LIB_H
#define GNUT_LIB_H 0

#include <sys/types.h>
#ifndef WIN32
#include <sys/socket.h>
#include <netinet/in.h>
#endif

#ifdef DMALLOC
#include <dmalloc.h>
#endif

#ifndef MIN
	#define MIN(a,b) (((a < b)) ? (a) : (b))
	#define MAX(a,b) (((a > b)) ? (a) : (b))
#endif

#ifndef __bswap_16
  #define __bswap_16(x) \
    ((((x) >> 8) & 0xff) | (((x) &0xff) <<8))
#endif
      
#ifndef __bswap_32
  #define __bswap_32(x) \
    ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
    (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
#endif
                                                
#ifndef GUINT16_TO_LE
#ifdef WORDS_BIGENDIAN
  #define GUINT16_TO_LE(x)  __bswap_16(x)
  #define GUINT32_TO_LE(x)  __bswap_32(x)
  #define GUINT16_FROM_LE(x)  __bswap_16(x)
  #define GUINT32_FROM_LE(x)  __bswap_32(x)
#else
  #define GUINT16_TO_LE(x)  (x)
  #define GUINT32_TO_LE(x)  (x)
  #define GUINT16_FROM_LE(x)  (x)
  #define GUINT32_FROM_LE(x)  (x)
#endif
#endif

typedef unsigned int 	uint32;
typedef unsigned short 	uint16;
typedef unsigned char	uchar;
#ifndef WIN32
typedef unsigned long long uint64;

//#define g_debug(num, format, args... ) 
#define g_debug(num, format, args... ) _g_debug(__FUNCTION__,__LINE__, num, format, ##args)
void _g_debug(char *,int,int num, char *,...);
#endif

extern int gnut_lib_debug;

int gnut_mprobe(void *);

char *gnut_strdelimit(char *string, char *delimeters, char new_delim);

char *expand_path(char *);

#ifndef xmalloc
char *xmalloc(int size);
#endif

#ifdef WIN32
#include <windows.h>

#define VERSION "0.3.22/win32"

void g_debug(int, char *, ...);

typedef unsigned __int64 uint64;
typedef unsigned int uint;

#define sleep Sleep
char *strtok_r(char *, const char *, char **);
int getopt(int argc, char *argv[], char *);
extern char *optarg;
extern int optind;

#define strncasecmp strnicmp

#define inet_aton(string, ip) (ip)->s_addr = inet_addr(string)

#define write(sock, buf, len) send(sock, buf, len, 0)
#define read(sock, buf, len) recv(sock, buf, len, 0)
#define close(sock) closesocket(sock)

#define F_SETFL 1
#define O_NONBLOCK 1
int fcntl(int sock, int, uint);

#define flock(a,b) 0
#endif


#endif