Mercurial > pidgin
annotate libpurple/protocols/myspace/myspace.h @ 17293:bfda36bd957a
Add incomplete msim_add_buddy() implementation.
author | Jeffrey Connelly <jaconnel@calpoly.edu> |
---|---|
date | Sun, 03 Jun 2007 02:14:03 +0000 |
parents | d8903e1320a9 |
children | 1905859d7a3b |
rev | line source |
---|---|
17286
58b4d103a5b8
Use symbolic constants for persist messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17280
diff
changeset
|
1 /* MySpaceIM Protocol Plugin, header file |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
2 * |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
3 * Copyright (C) 2007, Jeff Connelly <jeff2@homing.pidgin.im> |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
4 * |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
7 * the Free Software Foundation; either version 2 of the License, or |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
8 * (at your option) any later version. |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
9 * |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
13 * GNU General Public License for more details. |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
14 * |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
16 * along with this program; if not, write to the Free Software |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
18 */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
19 |
16735
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
20 #ifndef _MYSPACE_MYSPACE_H |
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
21 #define _MYSPACE_MYSPACE_H |
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
22 |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
23 /* Other includes */ |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
24 #include <string.h> |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
25 #include <errno.h> /* for EAGAIN */ |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
26 #include <stdarg.h> |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
27 |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
28 #include <glib.h> |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
29 |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
30 #ifdef _WIN32 |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
31 #include "win32dep.h" |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
32 #else |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
33 /* For recv() and send(); needed to match Win32 */ |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
34 #include <sys/types.h> |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
35 #include <sys/socket.h> |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
36 #endif |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
37 |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
38 #include "internal.h" |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
39 |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
40 #include "notify.h" |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
41 #include "plugin.h" |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
42 #include "accountopt.h" |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
43 #include "version.h" |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
44 #include "cipher.h" /* for SHA-1 */ |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
45 #include "util.h" /* for base64 */ |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
46 #include "debug.h" /* for purple_debug_info */ |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
47 |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
48 |
17266
793301c04e3a
(Incomplete - plugin does not load) Begin migrating protocol message receiving to MsimMessage.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16738
diff
changeset
|
49 /* MySpaceIM includes */ |
793301c04e3a
(Incomplete - plugin does not load) Begin migrating protocol message receiving to MsimMessage.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16738
diff
changeset
|
50 #include "message.h" |
793301c04e3a
(Incomplete - plugin does not load) Begin migrating protocol message receiving to MsimMessage.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16738
diff
changeset
|
51 |
16725
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
52 /* Conditional compilation options */ |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
53 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
54 /* Debugging options */ |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
55 #define MSIM_DEBUG_MSG |
16407
bb649c52fc19
Replace printf() in MySpaceIM prpl with purple_debug_info().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16405
diff
changeset
|
56 /* Low-level and rarely needed */ |
16725
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
57 /*#define MSIM_DEBUG_PARSE */ |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
58 /*#define MSIM_DEBUG_LOGIN_CHALLENGE */ |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
59 /*#define MSIM_DEBUG_RXBUF */ |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
60 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
61 /* RC4 didn't make it into Libpurple 2.0.0's cipher suite, so we have |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
62 * to use our own RC4 code (from Samba) by not defining this. */ |
16737
da7621e799b7
Enable usage of RC4 in libpurple, now that it is in 2.0.1.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16736
diff
changeset
|
63 /* RC4 is in Libpurple 2.0.1, so define this. */ |
da7621e799b7
Enable usage of RC4 in libpurple, now that it is in 2.0.1.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16736
diff
changeset
|
64 #define MSIM_USE_PURPLE_RC4 |
16725
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
65 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
66 /* TODO: when RC4 makes it into libpurple, use the PURPLE_VERSION_CHECK |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
67 * macro to conditionally compile. And then later, get rid of our own |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
68 * RC4 code and only support libpurple with RC4. */ |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
69 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
70 /* Constants */ |
16407
bb649c52fc19
Replace printf() in MySpaceIM prpl with purple_debug_info().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16405
diff
changeset
|
71 |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
72 /* Build version of MySpaceIM to report to servers (1.0.xxx.0) */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
73 #define MSIM_CLIENT_VERSION 673 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
74 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
75 /* Server */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
76 #define MSIM_SERVER "im.myspace.akadns.net" |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
77 //#define MSIM_SERVER "localhost" |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
78 #define MSIM_PORT 1863 /* TODO: alternate ports and automatic */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
79 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
80 /* Constants */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
81 #define HASH_SIZE 0x14 /**< Size of SHA-1 hash for login */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
82 #define NONCE_SIZE 0x20 /**< Half of decoded 'nc' field */ |
17275
f3ec513efb59
Parenthesize 5 * 1024, in case the macro expansion occurs within a complex
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17269
diff
changeset
|
83 #define MSIM_READ_BUF_SIZE (5 * 1024) /**< Receive buffer size */ |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
84 #define MSIM_FINAL_STRING "\\final\\" /**< Message end marker */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
85 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
86 /* Messages */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
87 #define MSIM_BM_INSTANT 1 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
88 #define MSIM_BM_STATUS 100 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
89 #define MSIM_BM_ACTION 121 |
16738
0fa4a3e9b318
Stylistic improvements - use type *name instead of type* name for pointers
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16737
diff
changeset
|
90 /* #define MSIM_BM_UNKNOWN1 122 */ |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
91 |
16734
3f53f8f502b2
Replacement magic numbers by symbolic constants.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16732
diff
changeset
|
92 /* Authentication algorithm for login2 */ |
3f53f8f502b2
Replacement magic numbers by symbolic constants.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16732
diff
changeset
|
93 #define MSIM_AUTH_ALGORITHM 196610 |
3f53f8f502b2
Replacement magic numbers by symbolic constants.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16732
diff
changeset
|
94 |
17289
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17286
diff
changeset
|
95 /* Indexes into status string (0|1|2|3|..., but 0 always empty) */ |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17286
diff
changeset
|
96 #define MSIM_STATUS_ORDINAL_EMPTY 0 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17286
diff
changeset
|
97 #define MSIM_STATUS_ORDINAL_UNKNOWNs 1 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17286
diff
changeset
|
98 #define MSIM_STATUS_ORDINAL_ONLINE 2 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17286
diff
changeset
|
99 #define MSIM_STATUS_ORDINAL_UNKNOWNss 3 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17286
diff
changeset
|
100 #define MSIM_STATUS_ORDINAL_HEADLINE 4 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17286
diff
changeset
|
101 #define MSIM_STATUS_ORDINAL_UNKNOWNls 5 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17286
diff
changeset
|
102 #define MSIM_STATUS_ORDINAL_UNKNOWN 6 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17286
diff
changeset
|
103 #define MSIM_STATUS_ORDINAL_UNKNOWN1 7 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17286
diff
changeset
|
104 #define MSIM_STATUS_ORDINAL_UNKNOWNp 8 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17286
diff
changeset
|
105 #define MSIM_STATUS_ORDINAL_UNKNOWN2 9 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17286
diff
changeset
|
106 |
17269
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
107 /* Random number in every MsimSession, to ensure it is valid. */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
108 #define MSIM_SESSION_STRUCT_MAGIC 0xe4a6752b |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
109 |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
110 /* Everything needed to keep track of a session. */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
111 typedef struct _MsimSession |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
112 { |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
113 guint magic; /**< MSIM_SESSION_STRUCT_MAGIC */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
114 PurpleAccount *account; |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
115 PurpleConnection *gc; |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
116 gchar *sesskey; /**< Session key text string from server */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
117 gchar *userid; /**< This user's numeric user ID */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
118 gint fd; /**< File descriptor to/from server */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
119 |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
120 GHashTable *user_lookup_cb; /**< Username -> userid lookup callback */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
121 GHashTable *user_lookup_cb_data; /**< Username -> userid lookup callback data */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
122 GHashTable *user_lookup_cache; /**< Cached information on users */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
123 |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
124 gchar *rxbuf; /**< Receive buffer */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
125 guint rxoff; /**< Receive buffer offset */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
126 guint next_rid; /**< Next request/response ID */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
127 } MsimSession; |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
128 |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
129 /* Check if an MsimSession is valid */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
130 #define MSIM_SESSION_VALID(s) (session != NULL && \ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
131 session->magic == MSIM_SESSION_STRUCT_MAGIC) |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17266
diff
changeset
|
132 |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
133 /* Callback function pointer type for when a user's information is received, |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
134 * initiated from a user lookup. */ |
17280
d3e17c9d16e9
Use MsimMessage for receiving messages everywhere, instead of GHashTable.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17275
diff
changeset
|
135 typedef void (*MSIM_USER_LOOKUP_CB)(MsimSession *session, MsimMessage *userinfo, |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
136 gpointer data); |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
137 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
138 /* Passed to MSIM_USER_LOOKUP_CB for msim_send_im_cb - called when |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
139 * user information is available, ready to send a message. */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
140 typedef struct _send_im_cb_struct |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
141 { |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
142 gchar *who; |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
143 gchar *message; |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
144 PurpleMessageFlags flags; |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
145 } send_im_cb_struct; |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
146 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
147 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
148 /* Functions */ |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
149 gboolean msim_load(PurplePlugin *plugin); |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
150 GList *msim_status_types(PurpleAccount *acct); |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
151 const gchar *msim_list_icon(PurpleAccount *acct, PurpleBuddy *buddy); |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
152 |
16735
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
153 /* TODO: move these three functions to message.c/h */ |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
154 gchar *msim_unescape(const gchar *msg); |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
155 gchar *msim_escape(const gchar *msg); |
16738
0fa4a3e9b318
Stylistic improvements - use type *name instead of type* name for pointers
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16737
diff
changeset
|
156 gchar *str_replace(const gchar *str, const gchar *old, const gchar *new); |
16735
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
157 |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
158 void print_hash_item(gpointer key, gpointer value, gpointer user_data); |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
159 gboolean msim_send_raw(MsimSession *session, const gchar *msg); |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
160 |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
161 void msim_login(PurpleAccount *acct); |
17291
d8903e1320a9
Previously, the return value of the processing function and msim_process() told
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17290
diff
changeset
|
162 gboolean msim_login_challenge(MsimSession *session, MsimMessage *msg); |
17280
d3e17c9d16e9
Use MsimMessage for receiving messages everywhere, instead of GHashTable.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17275
diff
changeset
|
163 gchar *msim_compute_login_response(gchar nonce[2 * NONCE_SIZE], |
16738
0fa4a3e9b318
Stylistic improvements - use type *name instead of type* name for pointers
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16737
diff
changeset
|
164 gchar *email, gchar *password, guint *response_len); |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
165 |
17290
aa8e70fa1edc
Add, but do not use, incomplete functions for using typing notifications.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17289
diff
changeset
|
166 |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
167 int msim_send_im(PurpleConnection *gc, const char *who, |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
168 const char *message, PurpleMessageFlags flags); |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
169 int msim_send_im_by_userid(MsimSession *session, const gchar *userid, |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
170 const gchar *message, PurpleMessageFlags flags); |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
171 void msim_send_im_by_userid_cb(MsimSession *session, |
17280
d3e17c9d16e9
Use MsimMessage for receiving messages everywhere, instead of GHashTable.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17275
diff
changeset
|
172 MsimMessage *userinfo, gpointer data); |
d3e17c9d16e9
Use MsimMessage for receiving messages everywhere, instead of GHashTable.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17275
diff
changeset
|
173 void msim_incoming_im_cb(MsimSession *session, MsimMessage *userinfo, |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
174 gpointer data); |
17280
d3e17c9d16e9
Use MsimMessage for receiving messages everywhere, instead of GHashTable.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17275
diff
changeset
|
175 int msim_incoming_im(MsimSession *session, MsimMessage *msg); |
17290
aa8e70fa1edc
Add, but do not use, incomplete functions for using typing notifications.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17289
diff
changeset
|
176 int msim_incoming_action(MsimSession *session, MsimMessage *msg); |
aa8e70fa1edc
Add, but do not use, incomplete functions for using typing notifications.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17289
diff
changeset
|
177 |
aa8e70fa1edc
Add, but do not use, incomplete functions for using typing notifications.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17289
diff
changeset
|
178 unsigned int msim_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state); |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
179 |
17291
d8903e1320a9
Previously, the return value of the processing function and msim_process() told
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17290
diff
changeset
|
180 gboolean msim_process_reply(MsimSession *session, MsimMessage *msg); |
d8903e1320a9
Previously, the return value of the processing function and msim_process() told
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17290
diff
changeset
|
181 gboolean msim_process(PurpleConnection *gc, MsimMessage *msg); |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
182 |
17291
d8903e1320a9
Previously, the return value of the processing function and msim_process() told
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17290
diff
changeset
|
183 gboolean msim_error(MsimSession *session, MsimMessage *msg); |
17280
d3e17c9d16e9
Use MsimMessage for receiving messages everywhere, instead of GHashTable.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17275
diff
changeset
|
184 void msim_status_cb(MsimSession *session, MsimMessage *userinfo, |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
185 gpointer data); |
17291
d8903e1320a9
Previously, the return value of the processing function and msim_process() told
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17290
diff
changeset
|
186 gboolean msim_status(MsimSession *session, MsimMessage *msg); |
17293
bfda36bd957a
Add incomplete msim_add_buddy() implementation.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17291
diff
changeset
|
187 |
bfda36bd957a
Add incomplete msim_add_buddy() implementation.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17291
diff
changeset
|
188 void msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); |
bfda36bd957a
Add incomplete msim_add_buddy() implementation.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17291
diff
changeset
|
189 |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
190 void msim_input_cb(gpointer gc_uncasted, gint source, |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
191 PurpleInputCondition cond); |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
192 void msim_connect_cb(gpointer data, gint source, |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
193 const gchar *error_message); |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
194 |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
195 MsimSession *msim_session_new(PurpleAccount *acct); |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
196 void msim_session_destroy(MsimSession *session); |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
197 |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
198 void msim_close(PurpleConnection *gc); |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
199 |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
200 gboolean msim_is_userid(const gchar *user); |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
201 gboolean msim_is_email(const gchar *user); |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
202 |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
203 void msim_lookup_user(MsimSession *session, const gchar *user, |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
204 MSIM_USER_LOOKUP_CB cb, gpointer data); |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
205 |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
206 char *msim_status_text(PurpleBuddy *buddy); |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
207 void msim_tooltip_text(PurpleBuddy *buddy, |
16405
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
208 PurpleNotifyUserInfo *user_info, gboolean full); |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
209 |
16736
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
210 void init_plugin(PurplePlugin *plugin); |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16735
diff
changeset
|
211 |
16725
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
212 #ifndef MSIM_USE_PURPLE_RC4 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
213 /* |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
214 Unix SMB/CIFS implementation. |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
215 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
216 a partial implementation of RC4 designed for use in the |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
217 SMB authentication protocol |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
218 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
219 Copyright (C) Andrew Tridgell 1998 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
220 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
221 $Id: crypt-rc4.h 12116 2004-09-27 23:29:22Z guy $ |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
222 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
223 This program is free software; you can redistribute it and/or modify |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
224 it under the terms of the GNU General Public License as published by |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
225 the Free Software Foundation; either version 2 of the License, or |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
226 (at your option) any later version. |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
227 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
228 This program is distributed in the hope that it will be useful, |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
229 but WITHOUT ANY WARRANTY; without even the implied warranty of |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
230 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
231 GNU General Public License for more details. |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
232 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
233 You should have received a copy of the GNU General Public License |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
234 along with this program; if not, write to the Free Software |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
235 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
236 */ |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
237 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
238 typedef struct _rc4_state_struct { |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
239 unsigned char s_box[256]; |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
240 unsigned char index_i; |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
241 unsigned char index_j; |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
242 } rc4_state_struct; |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
243 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
244 void crypt_rc4_init(rc4_state_struct *rc4_state, |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
245 const unsigned char *key, int key_len); |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
246 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
247 void crypt_rc4(rc4_state_struct *rc4_state, unsigned char *data, int data_len); |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16723
diff
changeset
|
248 #endif /* !MSIM_USE_PURPLE_RC4 */ |
16735
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
249 |
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
250 #endif /* !_MYSPACE_MYSPACE_H */ |