comparison src/protocols/zephyr/ZWait4Not.c @ 10867:5727afad0fb8

[gaim-migrate @ 12553] sf patch #991208, from Arun A Tharuvai "Here's a patch, against current CVS, to build and compile zephyr on Windows, with, or without Kerberos 4 Authentication. In order to be built (and run) with Kerberos 4 authentication, the Kerberos for Windows SDK (version 2.6.3 is the current version) (licensed under the MIT license) and runtimes, both available from http://web.mit.edu/kerberos/www/dist/index.html#KFW2.6.3 Also, USE_KRB4 should be set to true in the attached Makefile.mingw As on the UNIX side, an external 'zhm' binary needs to run for zephyr to work. Source and a win32 executable (using code from gaim's libzephyr, and also MIT's zephyr distribution), can be found at http://web.mit.edu/aatharuv/www/zhm-windows.html" I decided not to make zephyr compiled by default in Windows. If you want to compile it, I think you you can modify the root Makefile.mingw or cd to the src/protocols/zephyr/ directory and run "make -f Makefile.mingw" using make from mingw committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 25 Apr 2005 01:53:01 +0000
parents 43d6c08d7e96
children 64895571248f
comparison
equal deleted inserted replaced
10866:f38bda97f981 10867:5727afad0fb8
3 * a notice, with a timeout. 3 * a notice, with a timeout.
4 * 4 *
5 * Created by: <Joe Random Hacker> 5 * Created by: <Joe Random Hacker>
6 * 6 *
7 * $Source$ 7 * $Source$
8 * $Author: chipx86 $ 8 * $Author: thekingant $
9 * 9 *
10 * Copyright (c) 1991 by the Massachusetts Institute of Technology. 10 * Copyright (c) 1991 by the Massachusetts Institute of Technology.
11 * For copying and distribution information, see the file 11 * For copying and distribution information, see the file
12 * "mit-copyright.h". 12 * "mit-copyright.h".
13 */ 13 */
17 #ifndef lint 17 #ifndef lint
18 static char rcsid_ZWaitForNotice_c[] = "$Zephyr$"; 18 static char rcsid_ZWaitForNotice_c[] = "$Zephyr$";
19 #endif 19 #endif
20 20
21 #include "internal.h" 21 #include "internal.h"
22
23 #ifdef WIN32
24 #include <winsock2.h>
25
26 #ifndef ZEPHYR_USES_KERBEROS
27 static int gettimeofday(struct timeval* tv, struct timezone* tz){
28 union {
29 long long ns100; /*time since 1 Jan 1601 in 100ns units */
30 FILETIME ft;
31 } _now;
32
33 GetSystemTimeAsFileTime( &(_now.ft) );
34 tv->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL );
35 tv->tv_sec= (long)((_now.ns100-(116444736000000000LL))/10000000LL);
36 return 0;
37 }
38 #endif
39
40 #else
22 #include <sys/socket.h> 41 #include <sys/socket.h>
42 #endif
23 43
24 Code_t Z_WaitForNotice (notice, pred, arg, timeout) 44 Code_t Z_WaitForNotice (notice, pred, arg, timeout)
25 ZNotice_t *notice; 45 ZNotice_t *notice;
26 int (*pred) __P((ZNotice_t *, void *)); 46 int (*pred) __P((ZNotice_t *, void *));
27 void *arg; 47 void *arg;
41 61
42 fd = ZGetFD (); 62 fd = ZGetFD ();
43 FD_ZERO (&fdmask); 63 FD_ZERO (&fdmask);
44 tv.tv_sec = timeout; 64 tv.tv_sec = timeout;
45 tv.tv_usec = 0; 65 tv.tv_usec = 0;
46 gettimeofday (&t0, (struct timezone *) 0); 66 gettimeofday (&t0, (struct timezone *)NULL);
47 t0.tv_sec += timeout; 67 t0.tv_sec += timeout;
48 while (1) { 68 while (1) {
49 FD_SET (fd, &fdmask); 69 FD_SET (fd, &fdmask);
50 i = select (fd + 1, &fdmask, (fd_set *) 0, (fd_set *) 0, &tv); 70 i = select (fd + 1, &fdmask, (fd_set *) 0, (fd_set *) 0, &tv);
51 if (i == 0) 71 if (i == 0)
56 retval = ZCheckIfNotice (notice, (struct sockaddr_in *) 0, pred, 76 retval = ZCheckIfNotice (notice, (struct sockaddr_in *) 0, pred,
57 (char *) arg); 77 (char *) arg);
58 if (retval != ZERR_NONOTICE) /* includes ZERR_NONE */ 78 if (retval != ZERR_NONOTICE) /* includes ZERR_NONE */
59 return retval; 79 return retval;
60 } 80 }
61 gettimeofday (&tv, (struct timezone *) 0); 81 gettimeofday (&tv, (struct timezone *) NULL);
62 tv.tv_usec = t0.tv_usec - tv.tv_usec; 82 tv.tv_usec = t0.tv_usec - tv.tv_usec;
63 if (tv.tv_usec < 0) { 83 if (tv.tv_usec < 0) {
64 tv.tv_usec += 1000000; 84 tv.tv_usec += 1000000;
65 tv.tv_sec = t0.tv_sec - tv.tv_sec - 1; 85 tv.tv_sec = t0.tv_sec - tv.tv_sec - 1;
66 } 86 }