comparison libpurple/win32/libc_interface.h @ 15373:5fe8042783c1

Rename gtk/ and libgaim/ to pidgin/ and libpurple/
author Sean Egan <seanegan@gmail.com>
date Sat, 20 Jan 2007 02:32:10 +0000
parents
children 32c366eeeb99
comparison
equal deleted inserted replaced
15372:f79e0f4df793 15373:5fe8042783c1
1 /*
2 * gaim
3 *
4 * File: libc_interface.h
5 *
6 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23 #ifndef _LIBC_INTERFACE_H_
24 #define _LIBC_INTERFACE_H_
25 #include <winsock2.h>
26 #include <ws2tcpip.h>
27 #include <io.h>
28 #include <errno.h>
29 #include "libc_internal.h"
30 #include <glib.h>
31
32 /* sys/socket.h */
33 int wgaim_socket(int namespace, int style, int protocol);
34 #define socket( namespace, style, protocol ) \
35 wgaim_socket( namespace, style, protocol )
36
37 int wgaim_connect(int socket, struct sockaddr *addr, u_long length);
38 #define connect( socket, addr, length ) \
39 wgaim_connect( socket, addr, length )
40
41 int wgaim_getsockopt(int socket, int level, int optname, void *optval, socklen_t *optlenptr);
42 #define getsockopt( args... ) \
43 wgaim_getsockopt( args )
44
45 int wgaim_setsockopt(int socket, int level, int optname, const void *optval, socklen_t optlen);
46 #define setsockopt( args... ) \
47 wgaim_setsockopt( args )
48
49 int wgaim_getsockname (int socket, struct sockaddr *addr, socklen_t *lenptr);
50 #define getsockname( socket, addr, lenptr ) \
51 wgaim_getsockname( socket, addr, lenptr )
52
53 int wgaim_bind(int socket, struct sockaddr *addr, socklen_t length);
54 #define bind( socket, addr, length ) \
55 wgaim_bind( socket, addr, length )
56
57 int wgaim_listen(int socket, unsigned int n);
58 #define listen( socket, n ) \
59 wgaim_listen( socket, n )
60
61 int wgaim_sendto(int socket, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen);
62 #define sendto(socket, buf, len, flags, to, tolen) \
63 wgaim_sendto(socket, buf, len, flags, to, tolen)
64
65 /* sys/ioctl.h */
66 int wgaim_ioctl(int fd, int command, void* opt);
67 #define ioctl( fd, command, val ) \
68 wgaim_ioctl( fd, command, val )
69
70 /* fcntl.h */
71 int wgaim_fcntl(int socket, int command, int val);
72 #define fcntl( fd, command, val ) \
73 wgaim_fcntl( fd, command, val )
74
75 /* arpa/inet.h */
76 int wgaim_inet_aton(const char *name, struct in_addr *addr);
77 #define inet_aton( name, addr ) \
78 wgaim_inet_aton( name, addr )
79
80 const char *
81 wgaim_inet_ntop (int af, const void *src, char *dst, socklen_t cnt);
82 #define inet_ntop( af, src, dst, cnt ) \
83 wgaim_inet_ntop( af, src, dst, cnt )
84
85 /* netdb.h */
86 struct hostent* wgaim_gethostbyname(const char *name);
87 #define gethostbyname( name ) \
88 wgaim_gethostbyname( name )
89
90 /* netinet/in.h */
91 #define ntohl( netlong ) \
92 (unsigned int)ntohl( netlong )
93
94 /* string.h */
95 char* wgaim_strerror( int errornum );
96 #define hstrerror( herror ) \
97 wgaim_strerror( errno )
98 #define strerror( errornum ) \
99 wgaim_strerror( errornum )
100
101 #define bzero( dest, size ) memset( dest, 0, size )
102
103 /* unistd.h */
104 int wgaim_read(int fd, void *buf, unsigned int size);
105 #define read( fd, buf, buflen ) \
106 wgaim_read( fd, buf, buflen )
107
108 int wgaim_write(int fd, const void *buf, unsigned int size);
109 #define write( socket, buf, buflen ) \
110 wgaim_write( socket, buf, buflen )
111
112 int wgaim_recv(int fd, void *buf, size_t len, int flags);
113 #define recv(fd, buf, len, flags) \
114 wgaim_recv(fd, buf, len, flags)
115
116 int wgaim_send(int fd, const void *buf, unsigned int size, int flags);
117 #define send(socket, buf, buflen, flags) \
118 wgaim_send(socket, buf, buflen, flags)
119
120 int wgaim_close(int fd);
121 #define close( fd ) \
122 wgaim_close( fd )
123
124 #if !GLIB_CHECK_VERSION(2,8,0)
125 int wgaim_g_access(const gchar *filename, int mode);
126 #define g_access( filename, mode) \
127 wgaim_g_access( filename, mode )
128 #endif
129
130 #ifndef sleep
131 #define sleep(x) Sleep((x)*1000)
132 #endif
133
134 int wgaim_gethostname(char *name, size_t size);
135 #define gethostname( name, size ) \
136 wgaim_gethostname( name, size )
137
138 /* sys/time.h */
139 int wgaim_gettimeofday(struct timeval *p, struct timezone *z);
140 #define gettimeofday( timeval, timezone ) \
141 wgaim_gettimeofday( timeval, timezone )
142
143 /* stdio.h */
144 #define snprintf _snprintf
145 #define vsnprintf _vsnprintf
146
147 int wgaim_rename(const char *oldname, const char *newname);
148 #define rename( oldname, newname ) \
149 wgaim_rename( oldname, newname )
150
151 #if GLIB_CHECK_VERSION(2,6,0)
152 #ifdef g_rename
153 # undef g_rename
154 #endif
155 /* This is necessary because we want rename on win32 to be able to overwrite an existing file, it is done in internal.h if GLib < 2.6*/
156 #define g_rename(oldname, newname) \
157 wgaim_rename(oldname, newname)
158 #endif
159
160
161 /* sys/stat.h */
162
163 #define fchmod(a,b)
164
165 /* time.h */
166 struct tm *wgaim_localtime_r(const time_t *time, struct tm *resultp);
167 #define localtime_r( time, resultp ) \
168 wgaim_localtime_r( time, resultp )
169
170 /* helper for gaim_utf8_strftime() by way of gaim_internal_strftime() in src/util.c */
171 const char *wgaim_get_timezone_abbreviation(const struct tm *tm);
172
173 #endif /* _LIBC_INTERFACE_H_ */