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_SIMPLE_H
24 #define PURPLE_SIMPLE_SIMPLE_H
31 #include "circularbuffer.h"
38 #define SIMPLE_BUF_INC 1024
39 #define SIMPLE_REGISTER_RETRY_MAX 2
41 #define SIMPLE_REGISTER_SENT 1
42 #define SIMPLE_REGISTER_RETRY 2
43 #define SIMPLE_REGISTER_COMPLETE 3
45 #define PUBLISH_EXPIRATION 600
46 #define SUBSCRIBE_EXPIRATION 1200
48 #define SIMPLE_TYPE_PROTOCOL (simple_protocol_get_type())
49 #define SIMPLE_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SIMPLE_TYPE_PROTOCOL, SIMPLEProtocol))
50 #define SIMPLE_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SIMPLE_TYPE_PROTOCOL, SIMPLEProtocolClass))
51 #define SIMPLE_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SIMPLE_TYPE_PROTOCOL))
52 #define SIMPLE_IS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SIMPLE_TYPE_PROTOCOL))
53 #define SIMPLE_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SIMPLE_TYPE_PROTOCOL, SIMPLEProtocolClass))
57 PurpleProtocol parent
;
62 PurpleProtocolClass parent_class
;
63 } SIMPLEProtocolClass
;
71 struct simple_watcher
{
74 struct sip_dialog dialog
;
81 struct sip_dialog
*dialog
;
85 int type
; /* 1 = Digest / 2 = NTLM */
92 gchar
*digest_session_key
;
96 struct simple_account_data
{
101 GCancellable
*cancellable
;
102 PurpleNetworkListenData
*listen_data
;
107 int registerstatus
; /* 0 nothing, 1 first registration send, 2 auth received, 3 registered */
108 struct sip_auth registrar
;
109 struct sip_auth proxy
;
115 guint registertimeout
;
118 PurpleAccount
*account
;
119 PurpleCircularBuffer
*txbuf
;
122 GSList
*transactions
;
126 struct sockaddr_in serveraddr
;
129 int realport
; /* port and hostname from SRV record */
133 struct sip_connection
{
143 typedef gboolean (*TransCallback
) (struct simple_account_data
*, struct sipmsg
*, struct transaction
*);
148 int transport
; /* 0 = tcp, 1 = udp */
152 TransCallback callback
;
155 G_MODULE_EXPORT GType
simple_protocol_get_type(void);
157 #endif /* PURPLE_SIMPLE_SIMPLE_H */