annotate src/protocols/simple/simple.h @ 11354:97028c1c69e9

[gaim-migrate @ 13573] added retries and nat type detection (#ifdef NOTYET since no one needs it at the moment) committer: Tailor Script <tailor@pidgin.im>
author Thomas Butter <tbutter>
date Sat, 27 Aug 2005 14:16:13 +0000
parents e40318d2bcd8
children b4cf724b64f8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11181
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
1 /**
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
2 * @file simple.h
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
3 *
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
4 * gaim
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
5 *
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
6 * Copyright (C) 2005, Thomas Butter <butter@uni-mannheim.de>
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
7 *
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
11 * (at your option) any later version.
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
12 *
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
16 * GNU General Public License for more details.
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
17 *
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
21 */
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
22
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
23 #ifndef _GAIM_SIMPLE_H
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
24 #define _GAIM_SIMPLE_H
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
25
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
26 #include <glib.h>
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
27 #include <time.h>
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
28 #include <prpl.h>
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
29 #include <digcalc.h>
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
30 #include "sipmsg.h"
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
31
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
32 #define SIMPLE_BUF_INC 1024
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
33
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
34 struct sip_dialog {
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
35 gchar *ourtag;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
36 gchar *theirtag;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
37 gchar *callid;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
38 };
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
39
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
40 struct simple_watcher {
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
41 gchar *name;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
42 time_t expire;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
43 struct sip_dialog dialog;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
44 };
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
45
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
46 struct simple_buddy {
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
47 gchar *name;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
48 time_t resubscribe;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
49 };
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
50
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
51 struct sip_auth {
11346
e40318d2bcd8 [gaim-migrate @ 13563]
Thomas Butter <tbutter>
parents: 11194
diff changeset
52 int type; /* 1 = Digest / 2 = NTLM */
11181
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
53 gchar *nonce;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
54 gchar *realm;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
55 int nc;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
56 HASHHEX HA1;
11346
e40318d2bcd8 [gaim-migrate @ 13563]
Thomas Butter <tbutter>
parents: 11194
diff changeset
57 int retries;
11181
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
58 };
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
59
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
60 struct simple_account_data {
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
61 GaimConnection *gc;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
62 gchar *servername;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
63 gchar *username;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
64 gchar *password;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
65 int fd;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
66 int cseq;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
67 time_t reregister;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
68 time_t republish;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
69 int registerstatus; // 0 nothing, 1 first registration send, 2 auth received, 3 registered
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
70 struct sip_auth registrar;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
71 struct sip_auth proxy;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
72 int listenfd;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
73 int listenport;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
74 gchar *ip;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
75 gchar *status;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
76 GHashTable *buddies;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
77 guint registertimeout;
11194
4c1f45ac00e9 [gaim-migrate @ 13317]
Thomas Butter <tbutter>
parents: 11189
diff changeset
78 guint resendtimeout;
11181
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
79 int connecting;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
80 GaimAccount *account;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
81 gchar *sendlater;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
82 GSList *transactions;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
83 GSList *watcher;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
84 GSList *openconns;
11189
5f79dfde334c [gaim-migrate @ 13307]
Thomas Butter <tbutter>
parents: 11181
diff changeset
85 gboolean udp;
5f79dfde334c [gaim-migrate @ 13307]
Thomas Butter <tbutter>
parents: 11181
diff changeset
86 struct sockaddr_in serveraddr;
11194
4c1f45ac00e9 [gaim-migrate @ 13317]
Thomas Butter <tbutter>
parents: 11189
diff changeset
87 int registerexpire;
11181
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
88 };
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
89
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
90 struct sip_connection {
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
91 int fd;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
92 gchar *inbuf;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
93 int inbuflen;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
94 int inbufused;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
95 int inputhandler;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
96 };
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
97
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
98 struct transaction;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
99
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
100 typedef gboolean (*TransCallback) (struct simple_account_data *, struct sipmsg *, struct transaction *);
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
101
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
102 struct transaction {
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
103 time_t time;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
104 int retries;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
105 int transport; // 0 = tcp, 1 = udp
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
106 int fd;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
107 gchar *cseq;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
108 struct sipmsg *msg;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
109 TransCallback callback;
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
110 };
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
111
e5bbe5070e04 [gaim-migrate @ 13292]
Thomas Butter <tbutter>
parents:
diff changeset
112 #endif /* _GAIM_SIMPLE_H */