Remove useless comparison
[pidgin-git.git] / libpurple / protocols / simple / simple.h
blob8f15e4d79292f399933cbde0613efa9059b73bc9
1 /**
2 * @file simple.h
4 * purple
6 * Copyright (C) 2005, Thomas Butter <butter@uni-mannheim.de>
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 #ifndef _PURPLE_SIMPLE_H
24 #define _PURPLE_SIMPLE_H
26 #include <glib.h>
27 #include <time.h>
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"
37 #include "sipmsg.h"
39 #define SIMPLE_BUF_INC 1024
40 #define SIMPLE_REGISTER_RETRY_MAX 2
42 #define SIMPLE_REGISTER_SENT 1
43 #define SIMPLE_REGISTER_RETRY 2
44 #define SIMPLE_REGISTER_COMPLETE 3
46 #define PUBLISH_EXPIRATION 600
47 #define SUBSCRIBE_EXPIRATION 1200
49 struct sip_dialog {
50 gchar *ourtag;
51 gchar *theirtag;
52 gchar *callid;
55 struct simple_watcher {
56 gchar *name;
57 time_t expire;
58 struct sip_dialog dialog;
59 gboolean needsxpidf;
62 struct simple_buddy {
63 gchar *name;
64 time_t resubscribe;
65 struct sip_dialog *dialog;
68 struct sip_auth {
69 int type; /* 1 = Digest / 2 = NTLM */
70 gchar *nonce;
71 gchar *opaque;
72 gchar *realm;
73 gchar *target;
74 guint32 flags;
75 int nc;
76 gchar *digest_session_key;
77 int retries;
80 struct simple_account_data {
81 PurpleConnection *gc;
82 gchar *servername;
83 gchar *username;
84 gchar *password;
85 PurpleDnsQueryData *query_data;
86 PurpleSrvTxtQueryData *srv_query_data;
87 PurpleNetworkListenData *listen_data;
88 int fd;
89 int cseq;
90 time_t reregister;
91 time_t republish;
92 int registerstatus; /* 0 nothing, 1 first registration send, 2 auth received, 3 registered */
93 struct sip_auth registrar;
94 struct sip_auth proxy;
95 int listenfd;
96 int listenport;
97 int listenpa;
98 gchar *status;
99 GHashTable *buddies;
100 guint registertimeout;
101 guint resendtimeout;
102 gboolean connecting;
103 PurpleAccount *account;
104 PurpleCircBuffer *txbuf;
105 guint tx_handler;
106 gchar *regcallid;
107 GSList *transactions;
108 GSList *watcher;
109 GSList *openconns;
110 gboolean udp;
111 struct sockaddr_in serveraddr;
112 int registerexpire;
113 gchar *realhostname;
114 int realport; /* port and hostname from SRV record */
115 gchar *publish_etag;
118 struct sip_connection {
119 int fd;
120 gchar *inbuf;
121 int inbuflen;
122 int inbufused;
123 int inputhandler;
126 struct transaction;
128 typedef gboolean (*TransCallback) (struct simple_account_data *, struct sipmsg *, struct transaction *);
130 struct transaction {
131 time_t time;
132 int retries;
133 int transport; /* 0 = tcp, 1 = udp */
134 int fd;
135 const gchar *cseq;
136 struct sipmsg *msg;
137 TransCallback callback;
140 #endif /* _PURPLE_SIMPLE_H */