4 * Copyright (C) 2005, Thomas Butter <butter@uni-mannheim.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
21 #ifndef PURPLE_SIMPLE_SIMPLE_H
22 #define PURPLE_SIMPLE_SIMPLE_H
33 #define SIMPLE_BUF_INC 1024
34 #define SIMPLE_REGISTER_RETRY_MAX 2
36 #define SIMPLE_REGISTER_SENT 1
37 #define SIMPLE_REGISTER_RETRY 2
38 #define SIMPLE_REGISTER_COMPLETE 3
40 #define PUBLISH_EXPIRATION 600
41 #define SUBSCRIBE_EXPIRATION 1200
43 #define SIMPLE_TYPE_PROTOCOL (simple_protocol_get_type())
44 #define SIMPLE_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SIMPLE_TYPE_PROTOCOL, SIMPLEProtocol))
45 #define SIMPLE_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SIMPLE_TYPE_PROTOCOL, SIMPLEProtocolClass))
46 #define SIMPLE_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SIMPLE_TYPE_PROTOCOL))
47 #define SIMPLE_IS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SIMPLE_TYPE_PROTOCOL))
48 #define SIMPLE_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SIMPLE_TYPE_PROTOCOL, SIMPLEProtocolClass))
52 PurpleProtocol parent
;
57 PurpleProtocolClass parent_class
;
58 } SIMPLEProtocolClass
;
66 struct simple_watcher
{
69 struct sip_dialog dialog
;
76 struct sip_dialog
*dialog
;
80 int type
; /* 1 = Digest / 2 = NTLM */
87 gchar
*digest_session_key
;
91 struct simple_account_data
{
96 GCancellable
*cancellable
;
97 PurpleNetworkListenData
*listen_data
;
102 int registerstatus
; /* 0 nothing, 1 first registration send, 2 auth received, 3 registered */
103 struct sip_auth registrar
;
104 struct sip_auth proxy
;
110 guint registertimeout
;
113 PurpleAccount
*account
;
114 PurpleCircularBuffer
*txbuf
;
117 GSList
*transactions
;
121 struct sockaddr_in serveraddr
;
124 int realport
; /* port and hostname from SRV record */
128 struct sip_connection
{
138 typedef gboolean (*TransCallback
) (struct simple_account_data
*, struct sipmsg
*, struct transaction
*);
143 int transport
; /* 0 = tcp, 1 = udp */
147 TransCallback callback
;
150 G_MODULE_EXPORT GType
simple_protocol_get_type(void);
152 #endif /* PURPLE_SIMPLE_SIMPLE_H */