Mercurial > pidgin
annotate 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 |
rev | line source |
---|---|
2086 | 1 /* This file is part of the Project Athena Zephyr Notification System. |
2 * It contains the ZCheckIfNotice/select loop used for waiting for | |
3 * a notice, with a timeout. | |
4 * | |
5 * Created by: <Joe Random Hacker> | |
6 * | |
7 * $Source$ | |
10867 | 8 * $Author: thekingant $ |
2086 | 9 * |
10 * Copyright (c) 1991 by the Massachusetts Institute of Technology. | |
11 * For copying and distribution information, see the file | |
12 * "mit-copyright.h". | |
13 */ | |
14 | |
15 #include "mit-copyright.h" | |
16 | |
17 #ifndef lint | |
18 static char rcsid_ZWaitForNotice_c[] = "$Zephyr$"; | |
19 #endif | |
20 | |
8792
43d6c08d7e96
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2086
diff
changeset
|
21 #include "internal.h" |
10867 | 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 | |
2086 | 41 #include <sys/socket.h> |
10867 | 42 #endif |
2086 | 43 |
44 Code_t Z_WaitForNotice (notice, pred, arg, timeout) | |
45 ZNotice_t *notice; | |
46 int (*pred) __P((ZNotice_t *, void *)); | |
47 void *arg; | |
48 int timeout; | |
49 { | |
50 Code_t retval; | |
51 struct timeval tv, t0; | |
52 fd_set fdmask; | |
53 int i, fd; | |
54 | |
55 retval = ZCheckIfNotice (notice, (struct sockaddr_in *) 0, pred, | |
56 (char *) arg); | |
57 if (retval == ZERR_NONE) | |
58 return ZERR_NONE; | |
59 if (retval != ZERR_NONOTICE) | |
60 return retval; | |
61 | |
62 fd = ZGetFD (); | |
63 FD_ZERO (&fdmask); | |
64 tv.tv_sec = timeout; | |
65 tv.tv_usec = 0; | |
10867 | 66 gettimeofday (&t0, (struct timezone *)NULL); |
2086 | 67 t0.tv_sec += timeout; |
68 while (1) { | |
69 FD_SET (fd, &fdmask); | |
70 i = select (fd + 1, &fdmask, (fd_set *) 0, (fd_set *) 0, &tv); | |
71 if (i == 0) | |
72 return ETIMEDOUT; | |
73 if (i < 0 && errno != EINTR) | |
74 return errno; | |
75 if (i > 0) { | |
76 retval = ZCheckIfNotice (notice, (struct sockaddr_in *) 0, pred, | |
77 (char *) arg); | |
78 if (retval != ZERR_NONOTICE) /* includes ZERR_NONE */ | |
79 return retval; | |
80 } | |
10867 | 81 gettimeofday (&tv, (struct timezone *) NULL); |
2086 | 82 tv.tv_usec = t0.tv_usec - tv.tv_usec; |
83 if (tv.tv_usec < 0) { | |
84 tv.tv_usec += 1000000; | |
85 tv.tv_sec = t0.tv_sec - tv.tv_sec - 1; | |
86 } | |
87 else | |
88 tv.tv_sec = t0.tv_sec - tv.tv_sec; | |
89 } | |
90 /*NOTREACHED*/ | |
91 } |