| |
1 /** |
| |
2 * @file simple.h |
| |
3 * |
| |
4 * gaim |
| |
5 * |
| |
6 * Copyright (C) 2005, Thomas Butter <butter@uni-mannheim.de> |
| |
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 _GAIM_SIMPLE_H |
| |
24 #define _GAIM_SIMPLE_H |
| |
25 |
| |
26 #include <glib.h> |
| |
27 #include <time.h> |
| |
28 |
| |
29 #include "cipher.h" |
| |
30 #include "circbuffer.h" |
| |
31 #include "dnsquery.h" |
| |
32 #include "dnssrv.h" |
| |
33 #include "network.h" |
| |
34 #include "proxy.h" |
| |
35 #include "prpl.h" |
| |
36 |
| |
37 #include "sipmsg.h" |
| |
38 |
| |
39 #define SIMPLE_BUF_INC 1024 |
| |
40 |
| |
41 struct sip_dialog { |
| |
42 gchar *ourtag; |
| |
43 gchar *theirtag; |
| |
44 gchar *callid; |
| |
45 }; |
| |
46 |
| |
47 struct simple_watcher { |
| |
48 gchar *name; |
| |
49 time_t expire; |
| |
50 struct sip_dialog dialog; |
| |
51 gboolean needsxpidf; |
| |
52 }; |
| |
53 |
| |
54 struct simple_buddy { |
| |
55 gchar *name; |
| |
56 time_t resubscribe; |
| |
57 }; |
| |
58 |
| |
59 struct sip_auth { |
| |
60 int type; /* 1 = Digest / 2 = NTLM */ |
| |
61 gchar *nonce; |
| |
62 gchar *opaque; |
| |
63 gchar *realm; |
| |
64 gchar *target; |
| |
65 guint32 flags; |
| |
66 int nc; |
| |
67 gchar *digest_session_key; |
| |
68 int retries; |
| |
69 }; |
| |
70 |
| |
71 struct simple_account_data { |
| |
72 GaimConnection *gc; |
| |
73 gchar *servername; |
| |
74 gchar *username; |
| |
75 gchar *password; |
| |
76 GaimDnsQueryData *query_data; |
| |
77 GaimSrvQueryData *srv_query_data; |
| |
78 GaimNetworkListenData *listen_data; |
| |
79 int fd; |
| |
80 int cseq; |
| |
81 time_t reregister; |
| |
82 time_t republish; |
| |
83 int registerstatus; /* 0 nothing, 1 first registration send, 2 auth received, 3 registered */ |
| |
84 struct sip_auth registrar; |
| |
85 struct sip_auth proxy; |
| |
86 int listenfd; |
| |
87 int listenport; |
| |
88 int listenpa; |
| |
89 gchar *status; |
| |
90 GHashTable *buddies; |
| |
91 guint registertimeout; |
| |
92 guint resendtimeout; |
| |
93 gboolean connecting; |
| |
94 GaimAccount *account; |
| |
95 GaimCircBuffer *txbuf; |
| |
96 guint tx_handler; |
| |
97 gchar *regcallid; |
| |
98 GSList *transactions; |
| |
99 GSList *watcher; |
| |
100 GSList *openconns; |
| |
101 gboolean udp; |
| |
102 struct sockaddr_in serveraddr; |
| |
103 int registerexpire; |
| |
104 gchar *realhostname; |
| |
105 int realport; /* port and hostname from SRV record */ |
| |
106 }; |
| |
107 |
| |
108 struct sip_connection { |
| |
109 int fd; |
| |
110 gchar *inbuf; |
| |
111 int inbuflen; |
| |
112 int inbufused; |
| |
113 int inputhandler; |
| |
114 }; |
| |
115 |
| |
116 struct transaction; |
| |
117 |
| |
118 typedef gboolean (*TransCallback) (struct simple_account_data *, struct sipmsg *, struct transaction *); |
| |
119 |
| |
120 struct transaction { |
| |
121 time_t time; |
| |
122 int retries; |
| |
123 int transport; /* 0 = tcp, 1 = udp */ |
| |
124 int fd; |
| |
125 gchar *cseq; |
| |
126 struct sipmsg *msg; |
| |
127 TransCallback callback; |
| |
128 }; |
| |
129 |
| |
130 #endif /* _GAIM_SIMPLE_H */ |