Replace functions which called once with their bodies
[pidgin-git.git] / libpurple / protocols / simple / simple.h
bloba06e5523c6a938b319ec6eb87cfab1a6ea798247
1 /**
2 * purple
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
24 #include <glib.h>
25 #include <gmodule.h>
26 #include <gio/gio.h>
27 #include <time.h>
29 #include <purple.h>
31 #include "sipmsg.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))
50 typedef struct
52 PurpleProtocol parent;
53 } SIMPLEProtocol;
55 typedef struct
57 PurpleProtocolClass parent_class;
58 } SIMPLEProtocolClass;
60 struct sip_dialog {
61 gchar *ourtag;
62 gchar *theirtag;
63 gchar *callid;
66 struct simple_watcher {
67 gchar *name;
68 time_t expire;
69 struct sip_dialog dialog;
70 gboolean needsxpidf;
73 struct simple_buddy {
74 gchar *name;
75 time_t resubscribe;
76 struct sip_dialog *dialog;
79 struct sip_auth {
80 int type; /* 1 = Digest / 2 = NTLM */
81 gchar *nonce;
82 gchar *opaque;
83 gchar *realm;
84 gchar *target;
85 guint32 flags;
86 int nc;
87 gchar *digest_session_key;
88 int retries;
91 struct simple_account_data {
92 PurpleConnection *gc;
93 gchar *servername;
94 gchar *username;
95 gchar *password;
96 GCancellable *cancellable;
97 PurpleNetworkListenData *listen_data;
98 int fd;
99 int cseq;
100 time_t reregister;
101 time_t republish;
102 int registerstatus; /* 0 nothing, 1 first registration send, 2 auth received, 3 registered */
103 struct sip_auth registrar;
104 struct sip_auth proxy;
105 int listenfd;
106 int listenport;
107 int listenpa;
108 gchar *status;
109 GHashTable *buddies;
110 guint registertimeout;
111 guint resendtimeout;
112 gboolean connecting;
113 PurpleAccount *account;
114 PurpleCircularBuffer *txbuf;
115 guint tx_handler;
116 gchar *regcallid;
117 GSList *transactions;
118 GSList *watcher;
119 GSList *openconns;
120 gboolean udp;
121 struct sockaddr_in serveraddr;
122 int registerexpire;
123 gchar *realhostname;
124 int realport; /* port and hostname from SRV record */
125 gchar *publish_etag;
128 struct sip_connection {
129 int fd;
130 gchar *inbuf;
131 int inbuflen;
132 int inbufused;
133 int inputhandler;
136 struct transaction;
138 typedef gboolean (*TransCallback) (struct simple_account_data *, struct sipmsg *, struct transaction *);
140 struct transaction {
141 time_t time;
142 int retries;
143 int transport; /* 0 = tcp, 1 = udp */
144 int fd;
145 const gchar *cseq;
146 struct sipmsg *msg;
147 TransCallback callback;
150 G_MODULE_EXPORT GType simple_protocol_get_type(void);
152 #endif /* PURPLE_SIMPLE_SIMPLE_H */